query_id
stringlengths
32
32
query
stringlengths
7
4.32k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
32085cee67202fbdfd07a8e025feea86
Deprecated: Use MethodConfig_HedgingPolicy.ProtoReflect.Descriptor instead.
[ { "docid": "025976655c6742084b30bffdf9716e7e", "score": "0.7492802", "text": "func (*MethodConfig_HedgingPolicy) Descriptor() ([]byte, []int) {\n\treturn file_grpc_service_config_proto_rawDescGZIP(), []int{0, 2}\n}", "title": "" } ]
[ { "docid": "dc7ee570b7785658529cee158256902c", "score": "0.705081", "text": "func (*InspectConfig) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "b454244f2edba4457b863c30cfe676ce", "score": "0.6954477", "text": "func (*ReplaceWithInfoTypeConfig) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{58}\n}", "title": "" }, { "docid": "02f415f8b17007e00358cb7a3437c880", "score": "0.6912866", "text": "func (*DeidentifyConfig) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{49}\n}", "title": "" }, { "docid": "8ea9251a139a24fbea48345a33490e3a", "score": "0.6910322", "text": "func (*UpdateEndpointPolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_networkservices_v1_endpoint_policy_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "e9cbc7111280457609c1a080d060fd08", "score": "0.68448037", "text": "func (*ReplaceDictionaryConfig) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{57}\n}", "title": "" }, { "docid": "e5e541043e9eb7830de26c7c48c72286", "score": "0.6842633", "text": "func (*HTTPFirewallPolicy) Descriptor() ([]byte, []int) {\n\treturn file_models_model_http_firewall_policy_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "2c0aa3845534748a97b95e21afde3c3f", "score": "0.6825896", "text": "func (*InspectionRule) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "f3fda3a04b20e05cfdb5ef46d223ea85", "score": "0.6824723", "text": "func (*EndpointPolicy) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_networkservices_v1_endpoint_policy_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "4908eb92ebc338e4719a0e41b0779e73", "score": "0.6785386", "text": "func (*ReplaceValueConfig) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{56}\n}", "title": "" }, { "docid": "0d907d0bdf20cee279ab1885d5058b3a", "score": "0.67809284", "text": "func (*Listener_DeprecatedV1) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_listener_v3_listener_proto_rawDescGZIP(), []int{2, 0}\n}", "title": "" }, { "docid": "746642bc0a501a09ebc464393121c2e7", "score": "0.6770849", "text": "func (*PrivacyMetric) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{43}\n}", "title": "" }, { "docid": "b9bdd01d0280b9303e709c339c2c0caa", "score": "0.67664945", "text": "func (*PasswordComplexityPolicyUpdate) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{50}\n}", "title": "" }, { "docid": "b1cfde97588a619f8a247e06ea02627f", "score": "0.6760856", "text": "func (*GetEndpointPolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_networkservices_v1_endpoint_policy_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "183912f814050cccd5875275f3596f4a", "score": "0.67579764", "text": "func (*RecordSuppression) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{73}\n}", "title": "" }, { "docid": "3e607b0ad3e280fbbe7e7f387b5534db", "score": "0.6752683", "text": "func (*Policy) Descriptor() ([]byte, []int) {\n\treturn file_apps_policy_pb_policy_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "93c259653281eb5ba07999cc943b1b01", "score": "0.6750399", "text": "func (*UpdateClientTlsPolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_networksecurity_v1beta1_client_tls_policy_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "86535d027b2c4e40e4b65e78ea6585b8", "score": "0.67489785", "text": "func (*CreateEndpointPolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_networkservices_v1_endpoint_policy_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "2bd206ab411dad6ade2e4ef25e52347f", "score": "0.67435044", "text": "func (*DeleteEndpointPolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_networkservices_v1_endpoint_policy_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "7004c1c0dc38f01833fa6f51556359e0", "score": "0.674268", "text": "func (*PrivacyMetric_DeltaPresenceEstimationConfig) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{43, 5}\n}", "title": "" }, { "docid": "307877770ab2c94ec2b2eac2f5c89810", "score": "0.67192036", "text": "func (*Manual) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{84}\n}", "title": "" }, { "docid": "79537371a15e253c0c0968f978568155", "score": "0.6705757", "text": "func (*VersionDescription) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{37}\n}", "title": "" }, { "docid": "8c0a275cdf57a433153c8263f876b8cd", "score": "0.66949916", "text": "func (*TransformationConfig) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{90}\n}", "title": "" }, { "docid": "ebca57b1b98a3bdcfb12b9d812f9a738", "score": "0.66909593", "text": "func (*DeleteClientTlsPolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_networksecurity_v1beta1_client_tls_policy_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "e8d291a8d787d1809940d04718353cc1", "score": "0.66857", "text": "func (*PolicyMetadata) Descriptor() ([]byte, []int) {\n\treturn file_rpc_common_service_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "b46eaec7982fa730913fbcfa5fd92d5d", "score": "0.6681713", "text": "func (*HybridInspectJobTriggerRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{134}\n}", "title": "" }, { "docid": "6d85a73de2bdf9cb81d898f55c1bf6b0", "score": "0.6668995", "text": "func (*Action) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{89}\n}", "title": "" }, { "docid": "2d75e3031e3b3b07037eaaaa7f383946", "score": "0.66671747", "text": "func (*InspectTemplate) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{85}\n}", "title": "" }, { "docid": "4ac3944cfbad5b5e666a9b23d2e6b78f", "score": "0.6663784", "text": "func (*PolicyConfig) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_server_quota_quotapb_policy_config_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "cf5d1f3c1daa86b373b10871b4046c23", "score": "0.66616684", "text": "func (*Policy) Descriptor() ([]byte, []int) {\n\treturn file_gobgp_proto_rawDescGZIP(), []int{137}\n}", "title": "" }, { "docid": "14cb6933f7366fae6d708366382d929d", "score": "0.66568947", "text": "func (*UpdateJobTriggerRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{99}\n}", "title": "" }, { "docid": "f9ab712b38bd83e8c7f5fcc0b18b4809", "score": "0.6651942", "text": "func (*UpdatePolicyReq) Descriptor() ([]byte, []int) {\n\treturn file_external_iam_v2_request_policy_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "cd6d27a1f5778ae5ec01d418e68cd475", "score": "0.665087", "text": "func (*AppliedTrafficPolicy) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_mesh_api_common_v1_status_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "85c17a136a3178fbc6dc046882b0851b", "score": "0.66441387", "text": "func (*DeletePolicyReq) Descriptor() ([]byte, []int) {\n\treturn file_external_iam_v2_request_policy_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "fbb95964d462cc60286fe5c4145989e5", "score": "0.66437185", "text": "func (*PasswordAgePolicyUpdate) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{54}\n}", "title": "" }, { "docid": "82b76aab526fada212aae428be57eff4", "score": "0.662866", "text": "func (*StoredInfoTypeConfig) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{124}\n}", "title": "" }, { "docid": "8d0d49c4f7aaedd452de99f5dab622aa", "score": "0.6623487", "text": "func (*ClientTlsPolicy) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_networksecurity_v1beta1_client_tls_policy_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "643a7d1d79586faf5c7937c3a7d6eecf", "score": "0.6619776", "text": "func (ServiceConfig_LoadBalancingPolicy) EnumDescriptor() ([]byte, []int) {\n\treturn file_grpc_service_config_proto_rawDescGZIP(), []int{6, 0}\n}", "title": "" }, { "docid": "ab68d5abef9664a8cc72851b26a280d1", "score": "0.66172856", "text": "func (*Table) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "f34dd2c0251a4a16e7ba020bd7233e6f", "score": "0.6616319", "text": "func (*ExcludeInfoTypes) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "3a63050f58d060fa6a14496184775587", "score": "0.6610992", "text": "func (x *fastReflection_MsgAuthorizeCircuitBreaker) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgAuthorizeCircuitBreaker\n}", "title": "" }, { "docid": "f68975168cabaa0c9d462b6260f9c374", "score": "0.6606903", "text": "func (*Value) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{46}\n}", "title": "" }, { "docid": "52d009b1a723fe33607814493b19fcaa", "score": "0.66045964", "text": "func (*CryptoDeterministicConfig) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{55}\n}", "title": "" }, { "docid": "7a48b8eab7a5509ab9da1bc9594346c4", "score": "0.66024274", "text": "func (*ReplacePolicyMembersReq) Descriptor() ([]byte, []int) {\n\treturn file_external_iam_v2_request_policy_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "4926c973a5c17c51a286210bc5639652", "score": "0.65942115", "text": "func (*UpdateStoredInfoTypeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{129}\n}", "title": "" }, { "docid": "424eed1ec9c3167ba6fa08802c392028", "score": "0.6587868", "text": "func (*VisibilityRuleMessageInPreviewMethod) Descriptor() ([]byte, []int) {\n\treturn file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "25c8d246b5cc845d70bf7f12cb1d3d6d", "score": "0.65862525", "text": "func (*RedactConfig) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{59}\n}", "title": "" }, { "docid": "86a8e2bc3d0cbd3ae38d9edb484642d1", "score": "0.65857965", "text": "func (*PrimitiveTransformation) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{52}\n}", "title": "" }, { "docid": "a93137922b0f11dfcff63f3a5f6bb280", "score": "0.65850246", "text": "func (*GetClientTlsPolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_networksecurity_v1beta1_client_tls_policy_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "476baa50be6607e0f6af5c4326709117", "score": "0.6584712", "text": "func (*CreateClientTlsPolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_networksecurity_v1beta1_client_tls_policy_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "da578fa46a934153640315c5456aed7f", "score": "0.6580193", "text": "func (*GetPolicyVersionReq) Descriptor() ([]byte, []int) {\n\treturn file_external_iam_v2_request_policy_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "ba92ac8d077682b667d2cbba8e336ed3", "score": "0.65663236", "text": "func (*TransformationDetailsStorageConfig) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{82}\n}", "title": "" }, { "docid": "6bb2e152cbc270550af0713ed8fb0a0f", "score": "0.656298", "text": "func (*PrivacyMetric_LDiversityConfig) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{43, 3}\n}", "title": "" }, { "docid": "36fb7edf79e22a237c52dfaa7ff832ae", "score": "0.6560881", "text": "func (x *fastReflection_MsgTripCircuitBreaker) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgTripCircuitBreaker\n}", "title": "" }, { "docid": "2704d4ed617b94ec9a27cf8bdb5cd131", "score": "0.6553851", "text": "func (*AddPolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_gobgp_proto_rawDescGZIP(), []int{39}\n}", "title": "" }, { "docid": "b90c626491b1a39004323aebdb785b7e", "score": "0.65519285", "text": "func (*UpdateDeidentifyTemplateRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{117}\n}", "title": "" }, { "docid": "07a1dc66a244a9bd4266f0f873b45b76", "score": "0.6550885", "text": "func (*DeleteStoredInfoTypeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{133}\n}", "title": "" }, { "docid": "8484fff18155a4c9939629f4ffd313ec", "score": "0.654801", "text": "func (*GetJobTriggerRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{100}\n}", "title": "" }, { "docid": "7aefd8fa58e28844ecad53cdf297cf5a", "score": "0.654381", "text": "func (*DataProfileConfigSnapshot) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{140}\n}", "title": "" }, { "docid": "8b4243c000682e87e3fcaf676269d9ec", "score": "0.6543158", "text": "func Descriptor(ctx context.Context) error {\n\tmodified, err := zmage.Modified(\"msg.protoset\", \"msg.proto\", \"include/health/health.proto\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !modified {\n\t\treturn nil\n\t}\n\n\treturn sh.Run(\n\t\t\"protoc\",\n\t\t\"-Iinclude\",\n\t\t\"-I.\",\n\t\t\"--descriptor_set_out=msg.protoset\",\n\t\t\"--include_imports\",\n\t\t\"msg.proto\",\n\t\t\"include/health/health.proto\",\n\t)\n}", "title": "" }, { "docid": "5025d78dba3349e1dd1bda2207bbbf8d", "score": "0.65424395", "text": "func (*GetPolicyReq) Descriptor() ([]byte, []int) {\n\treturn file_external_iam_v2_request_policy_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "d03a0e36c91ebb2ddf158b454fff3269", "score": "0.65419114", "text": "func (*CreateJobTriggerRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{97}\n}", "title": "" }, { "docid": "8a27048fefb5cfc5cb00f922fdd37ae9", "score": "0.6538398", "text": "func (*ServiceConfig_RetryThrottlingPolicy) Descriptor() ([]byte, []int) {\n\treturn file_grpc_service_config_proto_rawDescGZIP(), []int{6, 0}\n}", "title": "" }, { "docid": "46e698c06ef07934c0ba065dafb7d3b5", "score": "0.65355176", "text": "func (x *fastReflection_ConfigRequest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ConfigRequest\n}", "title": "" }, { "docid": "c46a5e154828eba1b971e7b3761dec43", "score": "0.6533713", "text": "func (*FirewallInfo) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_networkmanagement_v1_trace_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "2e38e4849e95cc968b7ec758d98c9c3d", "score": "0.6532189", "text": "func (*Action_Deidentify) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{89, 4}\n}", "title": "" }, { "docid": "ce1bf7df1937a3ce122e67daa8e0178c", "score": "0.65300435", "text": "func (*DeidentifyTemplate) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{86}\n}", "title": "" }, { "docid": "fc72dcd58afb7caae7d1f73b8842b8c0", "score": "0.65266097", "text": "func (*InspectionRuleSet) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "35739c1877a374368d9f24e7126f2a58", "score": "0.65179574", "text": "func (*PrivacyMetric_KMapEstimationConfig_TaggedField) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{43, 4, 0}\n}", "title": "" }, { "docid": "1361511d703ed7877d3b4176bd910bee", "score": "0.65152663", "text": "func (*MethodConfig_Name) Descriptor() ([]byte, []int) {\n\treturn file_grpc_service_config_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "ee085e7edd35a767444b0e9ecb71bc1a", "score": "0.6513568", "text": "func (*GRPC) Descriptor() ([]byte, []int) {\n\treturn file_internal_conf_conf_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "d37cc1d88b2079afd4aebebf2eee7512", "score": "0.65054417", "text": "func (*InspectResult) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "c6c327afdf4420f6b701a46cfa0b3c52", "score": "0.6501497", "text": "func (*UpdateInspectTemplateRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{92}\n}", "title": "" }, { "docid": "a17b1a482fff0c9ef77995f676214868", "score": "0.64999014", "text": "func (*StoredInfoTypeVersion) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{126}\n}", "title": "" }, { "docid": "1a5d554e4146fb77dcc6782e5fa57065", "score": "0.6496568", "text": "func (*DeleteJobTriggerRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{104}\n}", "title": "" }, { "docid": "657a2573eeefeb2f41f6782166aff5d5", "score": "0.6488911", "text": "func (*DeletePolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_gobgp_proto_rawDescGZIP(), []int{40}\n}", "title": "" }, { "docid": "0b03a05482658ea192178cf40a6d5bf2", "score": "0.648848", "text": "func (*CryptoReplaceFfxFpeConfig) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{64}\n}", "title": "" }, { "docid": "a1d3cd96f26393fca2c16d76d48fab14", "score": "0.64880776", "text": "func (*DataProfileAction) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{106}\n}", "title": "" }, { "docid": "c89395bb1764547bb1b2ade3f04a4ebf", "score": "0.647813", "text": "func (*SdkSchedulePolicy) Descriptor() ([]byte, []int) {\n\treturn file_api_api_proto_rawDescGZIP(), []int{117}\n}", "title": "" }, { "docid": "3bb62afb4467dd32649b91b0a927e42b", "score": "0.64774793", "text": "func (*AddPolicyMembersReq) Descriptor() ([]byte, []int) {\n\treturn file_external_iam_v2_request_policy_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "3f189aefb8555d40695700c06f92f3dd", "score": "0.6474154", "text": "func (*CreatePolicyReq) Descriptor() ([]byte, []int) {\n\treturn file_external_iam_v2_request_policy_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "d1f30f442006558b244f0d8c97983334", "score": "0.64740855", "text": "func (*DisablePeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_gobgp_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "e7488acc6de070550e2231eabbb24ced", "score": "0.6463057", "text": "func (*DisableMonitorRules) Descriptor() ([]byte, []int) {\n\treturn file_proto_request_proto_rawDescGZIP(), []int{39}\n}", "title": "" }, { "docid": "ecdff7b1dc64e6d558cbeab1b4486862", "score": "0.6462405", "text": "func (*Proto) Descriptor() ([]byte, []int) {\n\treturn file_api_comet_grpc_api_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "a37989b37f8de435b809bea7d02dea2a", "score": "0.64623797", "text": "func (*BuilderPredicate) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_service_config_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "051a18b5cef81e65fdb9e588f24f690c", "score": "0.6459969", "text": "func (*Listener_InternalListenerConfig) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_listener_v3_listener_proto_rawDescGZIP(), []int{2, 2}\n}", "title": "" }, { "docid": "0774d353c88b1de42bf48246bfc45d0b", "score": "0.6457504", "text": "func (x *fastReflection_Streng) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Streng\n}", "title": "" }, { "docid": "5f8ff1f521e919a047898a43a75f9c3a", "score": "0.64550436", "text": "func (*DeleteSpokeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_networkconnectivity_v1_hub_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "63d705577c008d5d042023a1c9f2f613", "score": "0.64544016", "text": "func (*MethodConfig) Descriptor() ([]byte, []int) {\n\treturn file_grpc_service_config_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "a896cbcad8662b722fa69f96311a2720", "score": "0.64534724", "text": "func (*TestDeprecatedMessage) Descriptor() ([]byte, []int) {\n\treturn file_internal_testprotos_test_test_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "a8888d7aff244b58b12ea2741f6ab600", "score": "0.64478964", "text": "func (*MethodSettings) Descriptor() ([]byte, []int) {\n\treturn file_google_api_client_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "5dc206e150ad2d8e2ac84eab3c9465c8", "score": "0.6445822", "text": "func (*PasswordComplexityPolicyID) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{47}\n}", "title": "" }, { "docid": "86d5353e4bab87951163a84d9e3a37b6", "score": "0.6440909", "text": "func (*HybridInspectStatistics) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{34}\n}", "title": "" }, { "docid": "2b757bd4311fdaaf80334a9933247715", "score": "0.64408416", "text": "func (*StorageMetadataLabel) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "a1df1b8a02fd94a4a742a96b27e0269a", "score": "0.64405334", "text": "func (*FieldTransformation) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{71}\n}", "title": "" }, { "docid": "a07cf90cc6ce59a831f3be955aa13aae", "score": "0.643939", "text": "func (*CppSettings) Descriptor() ([]byte, []int) {\n\treturn file_google_api_client_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "b2c1f5125a3eb411d127b424f1ef023a", "score": "0.64329183", "text": "func (*Package) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_osconfig_v1beta_guest_policies_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "2f94f88a22e64d7197efa6fb0aede5e0", "score": "0.64326286", "text": "func (*InfoTypeDescription) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{35}\n}", "title": "" }, { "docid": "f00e12439e37eebd6cc361332c76df0f", "score": "0.64310706", "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": "cead161e3031165c88aa43692efabea3", "score": "0.6426931", "text": "func (*WalletEnablePrivacyResp) Descriptor() ([]byte, []int) {\n\treturn file_mixwallet_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "d09d08d2ea3bf4de0123cc834392ba7f", "score": "0.6424796", "text": "func (*ApplyPolicy) Descriptor() ([]byte, []int) {\n\treturn file_gobgp_proto_rawDescGZIP(), []int{80}\n}", "title": "" } ]
eff8bf0d4d3bb616da5c470e8e801679
MarshalJSON is the custom marshaler for OpenidConnectProviderContract.
[ { "docid": "38834cfd884ce1d77d79d7d9ac6e15ff", "score": "0.7807527", "text": "func (ocpc OpenidConnectProviderContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif ocpc.OpenidConnectProviderContractProperties != nil {\n\t\tobjectMap[\"properties\"] = ocpc.OpenidConnectProviderContractProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" } ]
[ { "docid": "7fefe94a74bc0e08df2b8fe13cf952ee", "score": "0.7092975", "text": "func (ipc IdentityProviderContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif ipc.IdentityProviderContractProperties != nil {\n\t\tobjectMap[\"properties\"] = ipc.IdentityProviderContractProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "3cc93421db195bc578c9da219277ac3c", "score": "0.67551506", "text": "func (ocpuc OpenidConnectProviderUpdateContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif ocpuc.OpenidConnectProviderUpdateContractProperties != nil {\n\t\tobjectMap[\"properties\"] = ocpuc.OpenidConnectProviderUpdateContractProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "e65d08446f4d1ba37b9ae4f8991c50c8", "score": "0.66025966", "text": "func (ipcc IdentityProviderCreateContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif ipcc.IdentityProviderCreateContractProperties != nil {\n\t\tobjectMap[\"properties\"] = ipcc.IdentityProviderCreateContractProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "8fe0c10cd3eec10106e5fa4857090226", "score": "0.65077084", "text": "func (o MicrosoftGraphIdentityProvider) MarshalJSON() ([]byte, error) {\n\ttoSerialize := map[string]interface{}{}\n\tif o.Id != nil {\n\t\ttoSerialize[\"id\"] = o.Id\n\t}\n\tif o.Type == nil {\n\t\tif o.isExplicitNullType {\n\t\t\ttoSerialize[\"type\"] = o.Type\n\t\t}\n\t} else {\n\t\ttoSerialize[\"type\"] = o.Type\n\t}\n\tif o.Name == nil {\n\t\tif o.isExplicitNullName {\n\t\t\ttoSerialize[\"name\"] = o.Name\n\t\t}\n\t} else {\n\t\ttoSerialize[\"name\"] = o.Name\n\t}\n\tif o.ClientId == nil {\n\t\tif o.isExplicitNullClientId {\n\t\t\ttoSerialize[\"clientId\"] = o.ClientId\n\t\t}\n\t} else {\n\t\ttoSerialize[\"clientId\"] = o.ClientId\n\t}\n\tif o.ClientSecret == nil {\n\t\tif o.isExplicitNullClientSecret {\n\t\t\ttoSerialize[\"clientSecret\"] = o.ClientSecret\n\t\t}\n\t} else {\n\t\ttoSerialize[\"clientSecret\"] = o.ClientSecret\n\t}\n\treturn json.Marshal(toSerialize)\n}", "title": "" }, { "docid": "2a00e488923595cc0769b48aadb18045", "score": "0.64594316", "text": "func (r *WorkforcePoolProvider) marshal(c *Client) ([]byte, error) {\n\tm, err := expandWorkforcePoolProvider(c, r)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error marshalling WorkforcePoolProvider: %w\", err)\n\t}\n\n\treturn json.Marshal(m)\n}", "title": "" }, { "docid": "8def4a2bcc0205f1b396de5caadd6e41", "score": "0.6437448", "text": "func (i IdentityProviders) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"apple\", i.Apple)\n\tpopulate(objectMap, \"azureActiveDirectory\", i.AzureActiveDirectory)\n\tpopulate(objectMap, \"azureStaticWebApps\", i.AzureStaticWebApps)\n\tpopulate(objectMap, \"customOpenIdConnectProviders\", i.CustomOpenIDConnectProviders)\n\tpopulate(objectMap, \"facebook\", i.Facebook)\n\tpopulate(objectMap, \"gitHub\", i.GitHub)\n\tpopulate(objectMap, \"google\", i.Google)\n\tpopulate(objectMap, \"legacyMicrosoftAccount\", i.LegacyMicrosoftAccount)\n\tpopulate(objectMap, \"twitter\", i.Twitter)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "0ad465c3bad1c0b0430791163d61c16a", "score": "0.61969703", "text": "func (o OpenIDConnectLogin) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"nameClaimType\", o.NameClaimType)\n\tpopulate(objectMap, \"scopes\", o.Scopes)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "7fab64df5db61520828046ea62fcf08e", "score": "0.61138254", "text": "func (coutipp CreateOrUpdateTrustedIDProviderParameters) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif coutipp.CreateOrUpdateTrustedIDProviderProperties != nil {\n\t\tobjectMap[\"properties\"] = coutipp.CreateOrUpdateTrustedIDProviderProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "f48c7c45f1da8dc619a102e53dad5766", "score": "0.60571766", "text": "func (ocpc *OpenidConnectProviderContract) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range m {\n\t\tswitch k {\n\t\tcase \"properties\":\n\t\t\tif v != nil {\n\t\t\t\tvar openidConnectProviderContractProperties OpenidConnectProviderContractProperties\n\t\t\t\terr = json.Unmarshal(*v, &openidConnectProviderContractProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tocpc.OpenidConnectProviderContractProperties = &openidConnectProviderContractProperties\n\t\t\t}\n\t\tcase \"id\":\n\t\t\tif v != nil {\n\t\t\t\tvar ID string\n\t\t\t\terr = json.Unmarshal(*v, &ID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tocpc.ID = &ID\n\t\t\t}\n\t\tcase \"name\":\n\t\t\tif v != nil {\n\t\t\t\tvar name string\n\t\t\t\terr = json.Unmarshal(*v, &name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tocpc.Name = &name\n\t\t\t}\n\t\tcase \"type\":\n\t\t\tif v != nil {\n\t\t\t\tvar typeVar string\n\t\t\t\terr = json.Unmarshal(*v, &typeVar)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tocpc.Type = &typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d1ab35aa022ea3ffc1d63fd3abe3f7fb", "score": "0.60535085", "text": "func (d DataProviderMetadata) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"propertyBag\", d.PropertyBag)\n\tpopulate(objectMap, \"providerName\", d.ProviderName)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "b24a75b55ba626c28f6447b54982d685", "score": "0.60453564", "text": "func (this *ProviderRef) MarshalJSON() ([]byte, error) {\n\tstr, err := TelemetryMarshaler.MarshalToString(this)\n\treturn []byte(str), err\n}", "title": "" }, { "docid": "1424a64c73c343b949829c34563131dd", "score": "0.5987643", "text": "func (o AuthenticatorOutput) ProviderJson() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Authenticator) pulumi.StringPtrOutput { return v.ProviderJson }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c6a40f7d5ae9333df7bca60ae730ede3", "score": "0.59278095", "text": "func (ctipwap CreateTrustedIDProviderWithAccountParameters) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif ctipwap.Name != nil {\n\t\tobjectMap[\"name\"] = ctipwap.Name\n\t}\n\tif ctipwap.CreateOrUpdateTrustedIDProviderProperties != nil {\n\t\tobjectMap[\"properties\"] = ctipwap.CreateOrUpdateTrustedIDProviderProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "cb298a8fe957180651bf4870ef55bf83", "score": "0.58893555", "text": "func (tip TrustedIDProvider) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif tip.TrustedIDProviderProperties != nil {\n\t\tobjectMap[\"properties\"] = tip.TrustedIDProviderProperties\n\t}\n\tif tip.ID != nil {\n\t\tobjectMap[\"id\"] = tip.ID\n\t}\n\tif tip.Name != nil {\n\t\tobjectMap[\"name\"] = tip.Name\n\t}\n\tif tip.Type != nil {\n\t\tobjectMap[\"type\"] = tip.Type\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "cb983dfacd71d71256a226c39309a191", "score": "0.5840646", "text": "func (pc PolicyContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif pc.PolicyContractProperties != nil {\n\t\tobjectMap[\"properties\"] = pc.PolicyContractProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "8eae41cd32701ba6d408089c4aaab4cc", "score": "0.5816452", "text": "func (rpo ResourceProviderOperation) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif rpo.Name != nil {\n\t\tobjectMap[\"name\"] = rpo.Name\n\t}\n\tif rpo.Display != nil {\n\t\tobjectMap[\"display\"] = rpo.Display\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "04efdcd862588f16d623bbe104d6fa3b", "score": "0.5807923", "text": "func (r ResourceProviderOperationList) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"nextLink\", r.NextLink)\n\tpopulate(objectMap, \"value\", r.Value)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "88f7ecc9b29aaf8c1eb744a1f4c31771", "score": "0.58021426", "text": "func (rpol ResourceProviderOperationList) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif rpol.Value != nil {\n\t\tobjectMap[\"value\"] = rpol.Value\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "88f7ecc9b29aaf8c1eb744a1f4c31771", "score": "0.58021426", "text": "func (rpol ResourceProviderOperationList) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif rpol.Value != nil {\n\t\tobjectMap[\"value\"] = rpol.Value\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "601330d486149ee16bc7a5eb5ea54c31", "score": "0.57830584", "text": "func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif pec.Properties != nil {\n\t\tobjectMap[\"properties\"] = pec.Properties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "2230f704b4f5253980731b52da14e5a1", "score": "0.5760044", "text": "func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"id\", p.ID)\n\tpopulate(objectMap, \"identity\", p.Identity)\n\tpopulate(objectMap, \"location\", p.Location)\n\tpopulate(objectMap, \"name\", p.Name)\n\tpopulate(objectMap, \"properties\", p.Properties)\n\tpopulate(objectMap, \"sku\", p.SKU)\n\tpopulate(objectMap, \"systemData\", p.SystemData)\n\tpopulate(objectMap, \"tags\", p.Tags)\n\tpopulate(objectMap, \"type\", p.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "1a832e61fc30c40cb77eccd5cbf051b6", "score": "0.5722113", "text": "func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", p.ID)\n\tpopulate(objectMap, \"name\", p.Name)\n\tpopulate(objectMap, \"properties\", p.Properties)\n\tpopulate(objectMap, \"systemData\", p.SystemData)\n\tpopulate(objectMap, \"type\", p.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "1a832e61fc30c40cb77eccd5cbf051b6", "score": "0.5722113", "text": "func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", p.ID)\n\tpopulate(objectMap, \"name\", p.Name)\n\tpopulate(objectMap, \"properties\", p.Properties)\n\tpopulate(objectMap, \"systemData\", p.SystemData)\n\tpopulate(objectMap, \"type\", p.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "1a832e61fc30c40cb77eccd5cbf051b6", "score": "0.5722113", "text": "func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", p.ID)\n\tpopulate(objectMap, \"name\", p.Name)\n\tpopulate(objectMap, \"properties\", p.Properties)\n\tpopulate(objectMap, \"systemData\", p.SystemData)\n\tpopulate(objectMap, \"type\", p.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "3c0eef2ac7311ab1e8ae3c20f882dd27", "score": "0.57177454", "text": "func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", p.ID)\n\tpopulate(objectMap, \"name\", p.Name)\n\tpopulate(objectMap, \"properties\", p.Properties)\n\tpopulate(objectMap, \"type\", p.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "3c0eef2ac7311ab1e8ae3c20f882dd27", "score": "0.57177454", "text": "func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", p.ID)\n\tpopulate(objectMap, \"name\", p.Name)\n\tpopulate(objectMap, \"properties\", p.Properties)\n\tpopulate(objectMap, \"type\", p.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "3e03856709a79f1b619264b5c8e98528", "score": "0.5708396", "text": "func (aebc APIEntityBaseContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif aebc.Description != nil {\n\t\tobjectMap[\"description\"] = aebc.Description\n\t}\n\tif aebc.AuthenticationSettings != nil {\n\t\tobjectMap[\"authenticationSettings\"] = aebc.AuthenticationSettings\n\t}\n\tif aebc.SubscriptionKeyParameterNames != nil {\n\t\tobjectMap[\"subscriptionKeyParameterNames\"] = aebc.SubscriptionKeyParameterNames\n\t}\n\tif aebc.APIType != \"\" {\n\t\tobjectMap[\"type\"] = aebc.APIType\n\t}\n\tif aebc.APIRevision != nil {\n\t\tobjectMap[\"apiRevision\"] = aebc.APIRevision\n\t}\n\tif aebc.APIVersion != nil {\n\t\tobjectMap[\"apiVersion\"] = aebc.APIVersion\n\t}\n\tif aebc.IsCurrent != nil {\n\t\tobjectMap[\"isCurrent\"] = aebc.IsCurrent\n\t}\n\tif aebc.APIRevisionDescription != nil {\n\t\tobjectMap[\"apiRevisionDescription\"] = aebc.APIRevisionDescription\n\t}\n\tif aebc.APIVersionDescription != nil {\n\t\tobjectMap[\"apiVersionDescription\"] = aebc.APIVersionDescription\n\t}\n\tif aebc.APIVersionSetID != nil {\n\t\tobjectMap[\"apiVersionSetId\"] = aebc.APIVersionSetID\n\t}\n\tif aebc.SubscriptionRequired != nil {\n\t\tobjectMap[\"subscriptionRequired\"] = aebc.SubscriptionRequired\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "f60048281d696827b748e134dcff0c7a", "score": "0.5703186", "text": "func (pdc PolicyDescriptionContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif pdc.PolicyDescriptionContractProperties != nil {\n\t\tobjectMap[\"properties\"] = pdc.PolicyDescriptionContractProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "35f3223fde8efb266be83ecf56349d76", "score": "0.5699095", "text": "func (o SyntheticsBasicAuthOauthClient) MarshalJSON() ([]byte, error) {\n\ttoSerialize := map[string]interface{}{}\n\tif o.UnparsedObject != nil {\n\t\treturn json.Marshal(o.UnparsedObject)\n\t}\n\ttoSerialize[\"accessTokenUrl\"] = o.AccessTokenUrl\n\tif o.Audience != nil {\n\t\ttoSerialize[\"audience\"] = o.Audience\n\t}\n\ttoSerialize[\"clientId\"] = o.ClientId\n\ttoSerialize[\"clientSecret\"] = o.ClientSecret\n\tif o.Resource != nil {\n\t\ttoSerialize[\"resource\"] = o.Resource\n\t}\n\tif o.Scope != nil {\n\t\ttoSerialize[\"scope\"] = o.Scope\n\t}\n\ttoSerialize[\"tokenApiAuthentication\"] = o.TokenApiAuthentication\n\tif o.Type != nil {\n\t\ttoSerialize[\"type\"] = o.Type\n\t}\n\n\tfor key, value := range o.AdditionalProperties {\n\t\ttoSerialize[key] = value\n\t}\n\treturn json.Marshal(toSerialize)\n}", "title": "" }, { "docid": "9d10e0f8698af9bb6a15f6229582d596", "score": "0.5691382", "text": "func (s ServiceProviderProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"peeringLocations\", s.PeeringLocations)\n\tpopulate(objectMap, \"serviceProviderName\", s.ServiceProviderName)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "6f0688590f0ad632a18dc70650786032", "score": "0.5689162", "text": "func (r ResourceProviderOperationDisplay) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"description\", r.Description)\n\tpopulate(objectMap, \"operation\", r.Operation)\n\tpopulate(objectMap, \"provider\", r.Provider)\n\tpopulate(objectMap, \"resource\", r.Resource)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "076f4cc7b2d713a55498f21a3bd61e12", "score": "0.5658831", "text": "func (afpmcp AzureFirstPartyManagedCertificateParameters) MarshalJSON() ([]byte, error) {\n\tafpmcp.Type = TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate\n\tobjectMap := make(map[string]interface{})\n\tif afpmcp.Type != \"\" {\n\t\tobjectMap[\"type\"] = afpmcp.Type\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "db618428c9efb1e4fd23ebb03e5251c2", "score": "0.5635807", "text": "func (bcc BackendCredentialsContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif bcc.Certificate != nil {\n\t\tobjectMap[\"certificate\"] = bcc.Certificate\n\t}\n\tif bcc.Query != nil {\n\t\tobjectMap[\"query\"] = bcc.Query\n\t}\n\tif bcc.Header != nil {\n\t\tobjectMap[\"header\"] = bcc.Header\n\t}\n\tif bcc.Authorization != nil {\n\t\tobjectMap[\"authorization\"] = bcc.Authorization\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "db618428c9efb1e4fd23ebb03e5251c2", "score": "0.5635807", "text": "func (bcc BackendCredentialsContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif bcc.Certificate != nil {\n\t\tobjectMap[\"certificate\"] = bcc.Certificate\n\t}\n\tif bcc.Query != nil {\n\t\tobjectMap[\"query\"] = bcc.Query\n\t}\n\tif bcc.Header != nil {\n\t\tobjectMap[\"header\"] = bcc.Header\n\t}\n\tif bcc.Authorization != nil {\n\t\tobjectMap[\"authorization\"] = bcc.Authorization\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "aef94a597f0a3b13bc2ec839643b3dab", "score": "0.5634336", "text": "func (asc AuthorizationServerContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif asc.AuthorizationServerContractProperties != nil {\n\t\tobjectMap[\"properties\"] = asc.AuthorizationServerContractProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "c8623080b1fbea67e2bb9544ae0248c2", "score": "0.5625593", "text": "func (aop AFDOriginProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif aop.AzureOrigin != nil {\n\t\tobjectMap[\"azureOrigin\"] = aop.AzureOrigin\n\t}\n\tif aop.HostName != nil {\n\t\tobjectMap[\"hostName\"] = aop.HostName\n\t}\n\tif aop.HTTPPort != nil {\n\t\tobjectMap[\"httpPort\"] = aop.HTTPPort\n\t}\n\tif aop.HTTPSPort != nil {\n\t\tobjectMap[\"httpsPort\"] = aop.HTTPSPort\n\t}\n\tif aop.OriginHostHeader != nil {\n\t\tobjectMap[\"originHostHeader\"] = aop.OriginHostHeader\n\t}\n\tif aop.Priority != nil {\n\t\tobjectMap[\"priority\"] = aop.Priority\n\t}\n\tif aop.Weight != nil {\n\t\tobjectMap[\"weight\"] = aop.Weight\n\t}\n\tif aop.SharedPrivateLinkResource != nil {\n\t\tobjectMap[\"sharedPrivateLinkResource\"] = aop.SharedPrivateLinkResource\n\t}\n\tif aop.EnabledState != \"\" {\n\t\tobjectMap[\"enabledState\"] = aop.EnabledState\n\t}\n\tif aop.EnforceCertificateNameCheck != nil {\n\t\tobjectMap[\"enforceCertificateNameCheck\"] = aop.EnforceCertificateNameCheck\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "497497d68d543e14d195f7d46eb4b2f0", "score": "0.5624097", "text": "func (m WebAPIConnectedServiceDetails) MarshalJSON() ([]byte, error) {\n\t_parts := make([][]byte, 0, 1)\n\n\taO0, err := swag.WriteJSON(m.WebAPIConnectedServiceRef)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_parts = append(_parts, aO0)\n\n\t// now for regular properties\n\tvar propsWebAPIConnectedServiceDetails struct {\n\t\tConnectedServiceMetaData *WebAPIConnectedService `json:\"connectedServiceMetaData,omitempty\"`\n\n\t\tCredentialsXML string `json:\"credentialsXml,omitempty\"`\n\n\t\tEndPoint string `json:\"endPoint,omitempty\"`\n\t}\n\tpropsWebAPIConnectedServiceDetails.ConnectedServiceMetaData = m.ConnectedServiceMetaData\n\n\tpropsWebAPIConnectedServiceDetails.CredentialsXML = m.CredentialsXML\n\n\tpropsWebAPIConnectedServiceDetails.EndPoint = m.EndPoint\n\n\tjsonDataPropsWebAPIConnectedServiceDetails, errWebAPIConnectedServiceDetails := swag.WriteJSON(propsWebAPIConnectedServiceDetails)\n\tif errWebAPIConnectedServiceDetails != nil {\n\t\treturn nil, errWebAPIConnectedServiceDetails\n\t}\n\t_parts = append(_parts, jsonDataPropsWebAPIConnectedServiceDetails)\n\treturn swag.ConcatJSON(_parts...), nil\n}", "title": "" }, { "docid": "bcfd6e7abd7e1ab58e6734b41ea8efae", "score": "0.56108785", "text": "func (gc GatewayContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif gc.GatewayContractProperties != nil {\n\t\tobjectMap[\"properties\"] = gc.GatewayContractProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "4546b54630f053f2ee2c6f40676fd2bf", "score": "0.5591508", "text": "func (brc BackendReconnectContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif brc.BackendReconnectProperties != nil {\n\t\tobjectMap[\"properties\"] = brc.BackendReconnectProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "64f1aff1b1234802507d49a2797f672c", "score": "0.5588225", "text": "func (pc ProductContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif pc.ProductContractProperties != nil {\n\t\tobjectMap[\"properties\"] = pc.ProductContractProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "4eb9cd143667e0c682069ec8c34fc6f8", "score": "0.5582515", "text": "func (o OAuthService) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(OAuthServiceToName(o))\n}", "title": "" }, { "docid": "6d16f509ccd6b2bdeb038c6e12fcaf89", "score": "0.557434", "text": "func (h HybridConnection) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"id\", h.ID)\n\tpopulate(objectMap, \"kind\", h.Kind)\n\tpopulate(objectMap, \"name\", h.Name)\n\tpopulate(objectMap, \"properties\", h.Properties)\n\tpopulate(objectMap, \"type\", h.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "d0ad273ba7ccc2e4bf4dc8e4cf75fd57", "score": "0.55673224", "text": "func (u UpdateTrustedIDProviderParameters) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"properties\", u.Properties)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "4afce4909585f52ff3b974b1e7fd7521", "score": "0.55606204", "text": "func (utipp UpdateTrustedIDProviderParameters) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif utipp.UpdateTrustedIDProviderProperties != nil {\n\t\tobjectMap[\"properties\"] = utipp.UpdateTrustedIDProviderProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "43e67b525a5aae24388c7d277df6b5d1", "score": "0.5559641", "text": "func (lc LoggerContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif lc.LoggerContractProperties != nil {\n\t\tobjectMap[\"properties\"] = lc.LoggerContractProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "b627d5f37d801b6c398f6824f76dd284", "score": "0.5553368", "text": "func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"value\", p.Value)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "b627d5f37d801b6c398f6824f76dd284", "score": "0.5553368", "text": "func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"value\", p.Value)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "c6795e74a0b9d67c8b68399dfd35ae19", "score": "0.5540398", "text": "func (r ResourceProviderOperationDefinition) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"display\", r.Display)\n\tpopulate(objectMap, \"name\", r.Name)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "421da265ef40e4c3a30149d9e4501ddd", "score": "0.5534674", "text": "func (ao AFDOrigin) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif ao.AFDOriginProperties != nil {\n\t\tobjectMap[\"properties\"] = ao.AFDOriginProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "b19bc8cbebc17c1e8e77ac1d8cee8260", "score": "0.55199885", "text": "func (oc OfficeConsent) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif oc.OfficeConsentProperties != nil {\n\t\tobjectMap[\"properties\"] = oc.OfficeConsentProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "f1528ccb740dd934f2fd4a1a9f109d4c", "score": "0.5502135", "text": "func (odc OfficeDataConnector) MarshalJSON() ([]byte, error) {\n\todc.Kind = KindOffice365\n\tobjectMap := make(map[string]interface{})\n\tif odc.OfficeDataConnectorProperties != nil {\n\t\tobjectMap[\"properties\"] = odc.OfficeDataConnectorProperties\n\t}\n\tif odc.Etag != nil {\n\t\tobjectMap[\"etag\"] = odc.Etag\n\t}\n\tif odc.Kind != \"\" {\n\t\tobjectMap[\"kind\"] = odc.Kind\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "8f3fc77835157b6a5f2e943ff6bc2e7e", "score": "0.5496158", "text": "func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif pec.PrivateEndpointConnectionProperties != nil {\n\t\tobjectMap[\"properties\"] = pec.PrivateEndpointConnectionProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "8f3fc77835157b6a5f2e943ff6bc2e7e", "score": "0.5496158", "text": "func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif pec.PrivateEndpointConnectionProperties != nil {\n\t\tobjectMap[\"properties\"] = pec.PrivateEndpointConnectionProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "7e91f2fb91090f7cef9de227fd2ed355", "score": "0.54847556", "text": "func (atrcp APITagResourceContractProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif atrcp.ID != nil {\n\t\tobjectMap[\"id\"] = atrcp.ID\n\t}\n\tif atrcp.Name != nil {\n\t\tobjectMap[\"name\"] = atrcp.Name\n\t}\n\tif atrcp.ServiceURL != nil {\n\t\tobjectMap[\"serviceUrl\"] = atrcp.ServiceURL\n\t}\n\tif atrcp.Path != nil {\n\t\tobjectMap[\"path\"] = atrcp.Path\n\t}\n\tif atrcp.Protocols != nil {\n\t\tobjectMap[\"protocols\"] = atrcp.Protocols\n\t}\n\tif atrcp.Description != nil {\n\t\tobjectMap[\"description\"] = atrcp.Description\n\t}\n\tif atrcp.AuthenticationSettings != nil {\n\t\tobjectMap[\"authenticationSettings\"] = atrcp.AuthenticationSettings\n\t}\n\tif atrcp.SubscriptionKeyParameterNames != nil {\n\t\tobjectMap[\"subscriptionKeyParameterNames\"] = atrcp.SubscriptionKeyParameterNames\n\t}\n\tif atrcp.APIType != \"\" {\n\t\tobjectMap[\"type\"] = atrcp.APIType\n\t}\n\tif atrcp.APIRevision != nil {\n\t\tobjectMap[\"apiRevision\"] = atrcp.APIRevision\n\t}\n\tif atrcp.APIVersion != nil {\n\t\tobjectMap[\"apiVersion\"] = atrcp.APIVersion\n\t}\n\tif atrcp.IsCurrent != nil {\n\t\tobjectMap[\"isCurrent\"] = atrcp.IsCurrent\n\t}\n\tif atrcp.APIRevisionDescription != nil {\n\t\tobjectMap[\"apiRevisionDescription\"] = atrcp.APIRevisionDescription\n\t}\n\tif atrcp.APIVersionDescription != nil {\n\t\tobjectMap[\"apiVersionDescription\"] = atrcp.APIVersionDescription\n\t}\n\tif atrcp.APIVersionSetID != nil {\n\t\tobjectMap[\"apiVersionSetId\"] = atrcp.APIVersionSetID\n\t}\n\tif atrcp.SubscriptionRequired != nil {\n\t\tobjectMap[\"subscriptionRequired\"] = atrcp.SubscriptionRequired\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "182d07119ff61be0b2717d1c2e1ce74f", "score": "0.5472499", "text": "func (utipwap UpdateTrustedIDProviderWithAccountParameters) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif utipwap.Name != nil {\n\t\tobjectMap[\"name\"] = utipwap.Name\n\t}\n\tif utipwap.UpdateTrustedIDProviderProperties != nil {\n\t\tobjectMap[\"properties\"] = utipwap.UpdateTrustedIDProviderProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "a6262d670856f305f93cc3a2e5927ab3", "score": "0.54504424", "text": "func (r ResponseMessageEnvelopeRemotePrivateEndpointConnection) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"error\", r.Error)\n\tpopulate(objectMap, \"id\", r.ID)\n\tpopulate(objectMap, \"identity\", r.Identity)\n\tpopulate(objectMap, \"location\", r.Location)\n\tpopulate(objectMap, \"name\", r.Name)\n\tpopulate(objectMap, \"plan\", r.Plan)\n\tpopulate(objectMap, \"properties\", r.Properties)\n\tpopulate(objectMap, \"sku\", r.SKU)\n\tpopulate(objectMap, \"status\", r.Status)\n\tpopulate(objectMap, \"tags\", r.Tags)\n\tpopulate(objectMap, \"type\", r.Type)\n\tpopulate(objectMap, \"zones\", r.Zones)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "36e6d224082821ab1bb8c6e91db485ef", "score": "0.5438337", "text": "func (m IPPool) MarshalJSON() ([]byte, error) {\n\tvar _parts [][]byte\n\n\taO0, err := swag.WriteJSON(m.ManagedResource)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_parts = append(_parts, aO0)\n\n\tvar data struct {\n\t\tPoolUsage *PoolUsage `json:\"pool_usage,omitempty\"`\n\n\t\tSubnets []*IPPoolSubnet `json:\"subnets,omitempty\"`\n\t}\n\n\tdata.PoolUsage = m.PoolUsage\n\n\tdata.Subnets = m.Subnets\n\n\tjsonData, err := swag.WriteJSON(data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_parts = append(_parts, jsonData)\n\n\treturn swag.ConcatJSON(_parts...), nil\n}", "title": "" }, { "docid": "9f2baf5c07128c8011cba2b656e99296", "score": "0.5434035", "text": "func (afpmc AzureFirstPartyManagedCertificate) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif afpmc.Type != \"\" {\n\t\tobjectMap[\"type\"] = afpmc.Type\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "539b8d9f9ee978eeb4596d3f8bfa4347", "score": "0.54317814", "text": "func (nc NotificationContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif nc.NotificationContractProperties != nil {\n\t\tobjectMap[\"properties\"] = nc.NotificationContractProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "a4df4bea359e4d69df7c099579288f05", "score": "0.54180217", "text": "func (sc SchemaContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif sc.SchemaContractProperties != nil {\n\t\tobjectMap[\"properties\"] = sc.SchemaContractProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "48bb9ef715b4dfafa2123ffc8d32c9d7", "score": "0.5417466", "text": "func (lc LoggerContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif lc.ID != nil {\n\t\tobjectMap[\"id\"] = lc.ID\n\t}\n\tif lc.LoggerType != nil {\n\t\tobjectMap[\"loggerType\"] = lc.LoggerType\n\t}\n\tif lc.Description != nil {\n\t\tobjectMap[\"description\"] = lc.Description\n\t}\n\tif lc.Credentials != nil {\n\t\tobjectMap[\"credentials\"] = lc.Credentials\n\t}\n\tif lc.IsBuffered != nil {\n\t\tobjectMap[\"isBuffered\"] = lc.IsBuffered\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "2e3ccb44d18576bb64323b0b4da8e424", "score": "0.54172474", "text": "func (jn JoinNonce) MarshalJSON() ([]byte, error) { return marshalJSONHexBytes(jn[:]) }", "title": "" }, { "docid": "d2de7fc405540d035dacdaead552b64c", "score": "0.54119194", "text": "func (t TrustedIDProviderListResult) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"nextLink\", t.NextLink)\n\tpopulate(objectMap, \"value\", t.Value)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "2dd64d53edbdd2069287d3035510bfea", "score": "0.5411844", "text": "func (p PrivateEndpointConnectionResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\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": "1a90a28144b1c486778121c896290639", "score": "0.5409198", "text": "func (v GetCorporationsCorporationIdMembertracking200Ok) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonE9f52ab5EncodeGithubComAntihaxGoesiEsi1(w, v)\n}", "title": "" }, { "docid": "44fd64a28bdc081a1841bf20de11248f", "score": "0.54052806", "text": "func (ghcc GatewayHostnameConfigurationContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif ghcc.GatewayHostnameConfigurationContractProperties != nil {\n\t\tobjectMap[\"properties\"] = ghcc.GatewayHostnameConfigurationContractProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "25a53ad4e1965375322a4b83d835c2f9", "score": "0.53981566", "text": "func (cc CallbackConfig) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif cc.ServiceURI != nil {\n\t\tobjectMap[\"serviceUri\"] = cc.ServiceURI\n\t}\n\tif cc.CustomHeaders != nil {\n\t\tobjectMap[\"customHeaders\"] = cc.CustomHeaders\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "a92af5fb00ddcd4cec8b9b6503117543", "score": "0.5396427", "text": "func (p PrivateEndpointConnectionCollection) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"nextLink\", p.NextLink)\n\tpopulate(objectMap, \"value\", p.Value)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "8cbf841f163de8eccc0c88fda050871d", "score": "0.5391426", "text": "func (rc RegionContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif rc.IsMasterRegion != nil {\n\t\tobjectMap[\"isMasterRegion\"] = rc.IsMasterRegion\n\t}\n\tif rc.IsDeleted != nil {\n\t\tobjectMap[\"isDeleted\"] = rc.IsDeleted\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "f025caba11cfe4bd838092d6fee3ea9e", "score": "0.53899205", "text": "func (c *CNPNSWithMeta) Marshal() ([]byte, error) {\n\treturn json.Marshal(c)\n}", "title": "" }, { "docid": "a577eaa9016e01ec4d15d8b3d172dc3b", "score": "0.53681505", "text": "func (b BackendPool) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", b.ID)\n\tpopulate(objectMap, \"name\", b.Name)\n\tpopulate(objectMap, \"properties\", b.Properties)\n\tpopulate(objectMap, \"type\", b.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "b9816ad7353d0882f75efc80afb84813", "score": "0.5362085", "text": "func (m ManagedIdentity) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"principalId\", m.PrincipalID)\n\tpopulate(objectMap, \"tenantId\", m.TenantID)\n\tpopulate(objectMap, \"type\", m.Type)\n\tpopulate(objectMap, \"userAssignedIdentities\", m.UserAssignedIdentities)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "b2e5845130c4916e50e98b24e63231cb", "score": "0.5362003", "text": "func (e EndpointBase) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"credentials\", e.Credentials)\n\tpopulate(objectMap, \"tunnel\", e.Tunnel)\n\tobjectMap[\"@type\"] = e.Type\n\tpopulate(objectMap, \"url\", e.URL)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "2b0929779c97ad46efc7e4329c01c4d9", "score": "0.5359422", "text": "func (p PrivateEndpointConnectionList) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"nextLink\", p.NextLink)\n\tpopulate(objectMap, \"value\", p.Value)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "501230a5e5dc2ed15a91a1d2de8dd2c5", "score": "0.5358979", "text": "func (bc BackendContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif bc.BackendContractProperties != nil {\n\t\tobjectMap[\"properties\"] = bc.BackendContractProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "20bff31302de2fee3a688bc125b900c8", "score": "0.5356294", "text": "func (ac APIContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif ac.APIContractProperties != nil {\n\t\tobjectMap[\"properties\"] = ac.APIContractProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "659bd9e122d76ac75fc95e76df1b6fcd", "score": "0.5348823", "text": "func (empt EdgeModuleProvisioningToken) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "b94e7b4097ceae3098af46c2a5317b62", "score": "0.5345831", "text": "func (p *Provisioner) Marshal() ([]byte, error) {\n\n\tm := make(map[string]interface{})\n\tm[provisioners.MapKey] = ProvisionerType\n\tm[\"bucket\"] = p.cfg.Bucket\n\tm[\"key\"] = p.cfg.Key\n\n\tout, err := json.Marshal(m)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn out, nil\n}", "title": "" }, { "docid": "d81541d1df152e3b2d07318ced5cc6a2", "score": "0.53391945", "text": "func (dc DiagnosticContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif dc.DiagnosticContractProperties != nil {\n\t\tobjectMap[\"properties\"] = dc.DiagnosticContractProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "85d2e1d76d8e53708cee6ff4b04d050c", "score": "0.53388286", "text": "func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "85d2e1d76d8e53708cee6ff4b04d050c", "score": "0.53388286", "text": "func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "0ecb4e40af8799b0355ea022c637734e", "score": "0.5337838", "text": "func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"privateEndpoint\", p.PrivateEndpoint)\n\tpopulate(objectMap, \"privateLinkServiceConnectionState\", p.PrivateLinkServiceConnectionState)\n\tpopulate(objectMap, \"provisioningState\", p.ProvisioningState)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "510f614ae1fbdf3cd2c290e0a1401443", "score": "0.53353995", "text": "func (ape AccessPolicyEntity) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif ape.AccessPolicyProperties != nil {\n\t\tobjectMap[\"properties\"] = ape.AccessPolicyProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "1011d95ce8b851675cd3345f3c9cd312", "score": "0.53325707", "text": "func (v org) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjson2a877177EncodeGithubComPinptGithubInternal44(w, v)\n}", "title": "" }, { "docid": "87c2260f8bb1f9867219148951a53f01", "score": "0.53318894", "text": "func (gc GroupContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif gc.GroupContractProperties != nil {\n\t\tobjectMap[\"properties\"] = gc.GroupContractProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "7e7a60f4265b002ec8a7f1a6383d7b90", "score": "0.5328545", "text": "func (v AddVirtualAuthenticatorReturns) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonC5a4559bEncodeGithubComChromedpCdprotoWebauthn4(w, v)\n}", "title": "" }, { "docid": "450a489b34a350a7e01748347b98a1a0", "score": "0.53244174", "text": "func (n NetworkFunctionUserConfigurationOsProfile) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"customData\", n.CustomData)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "9ed06e9dd527d9a0514a992c8d9d8418", "score": "0.531778", "text": "func (a AccessPolicyEntity) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"id\", a.ID)\n\tpopulate(objectMap, \"name\", a.Name)\n\tpopulate(objectMap, \"properties\", a.Properties)\n\tpopulate(objectMap, \"systemData\", a.SystemData)\n\tpopulate(objectMap, \"type\", a.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "3069a58e8f30c5e0a67bbc36825aaf74", "score": "0.53165543", "text": "func (o OID) MarshalJSON() ([]byte, error) {\n\tif !oidPattern.MatchString(string(o)) {\n\t\treturn nil, fmt.Errorf(\"MarshalJSON: bad OID format `%s`\", o)\n\t}\n\treturn []byte(`\"` + o + `\"`), nil\n}", "title": "" }, { "docid": "332178e9f6dd34a8cc8544b018b36eef", "score": "0.53133833", "text": "func (v AddVirtualAuthenticatorReturns) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonC5a4559bEncodeGithubComChromedpCdprotoWebauthn16(w, v)\n}", "title": "" }, { "docid": "5e2e64ea408ef995f7a5c3a4fa171690", "score": "0.5313148", "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": "bf9bc7cf93774bbb5d433fab288e4f68", "score": "0.5309707", "text": "func (nvcc NamedValueCreateContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif nvcc.NamedValueCreateContractProperties != nil {\n\t\tobjectMap[\"properties\"] = nvcc.NamedValueCreateContractProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "704ec4c1ace0cfd0a6eb8e83dd82424f", "score": "0.5308686", "text": "func (v oidProp) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjson2a877177EncodeGithubComPinptGithubInternal45(w, v)\n}", "title": "" }, { "docid": "4f5034d7dbe7c31e564aa48b6115d825", "score": "0.5303332", "text": "func (s SQLPool) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"id\", s.ID)\n\tpopulate(objectMap, \"location\", s.Location)\n\tpopulate(objectMap, \"name\", s.Name)\n\tpopulate(objectMap, \"properties\", s.Properties)\n\tpopulate(objectMap, \"sku\", s.SKU)\n\tpopulate(objectMap, \"tags\", s.Tags)\n\tpopulate(objectMap, \"type\", s.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "ae41e1fad23e05c66756da300afcbd86", "score": "0.53021675", "text": "func (a ApplicationClientDetails) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"applicationId\", a.ApplicationID)\n\tpopulate(objectMap, \"oid\", a.Oid)\n\tpopulate(objectMap, \"puid\", a.Puid)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "65f83493b245203684bdb8049fe06b86", "score": "0.52988356", "text": "func (h HybridConnectionCollection) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"nextLink\", h.NextLink)\n\tpopulate(objectMap, \"value\", h.Value)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "2e5fd4109b38f296dfb46e446e5abf6b", "score": "0.5297369", "text": "func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"principalId\", m.PrincipalID)\n\tpopulate(objectMap, \"tenantId\", m.TenantID)\n\tpopulate(objectMap, \"type\", m.Type)\n\tpopulate(objectMap, \"userAssignedIdentities\", m.UserAssignedIdentities)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "2e5fd4109b38f296dfb46e446e5abf6b", "score": "0.5297369", "text": "func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"principalId\", m.PrincipalID)\n\tpopulate(objectMap, \"tenantId\", m.TenantID)\n\tpopulate(objectMap, \"type\", m.Type)\n\tpopulate(objectMap, \"userAssignedIdentities\", m.UserAssignedIdentities)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "b5452f532800bb8f037ef19a9894fe32", "score": "0.52958167", "text": "func (p PrivateEndpointConnectionsResponse) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"value\", p.Value)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "cd0ea29bb3a9cd8c737120724200f80b", "score": "0.5294343", "text": "func (m ManagedIdentity) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"principalId\", m.PrincipalID)\n\tpopulate(objectMap, \"tenantId\", m.TenantID)\n\tpopulate(objectMap, \"type\", m.Type)\n\tpopulate(objectMap, \"userAssignedIdentities\", m.UserAssignedIdentities)\n\treturn json.Marshal(objectMap)\n}", "title": "" } ]
af98fda73c7e630e9248803551e3b42a
Split splits a network address of the form "host", "host:port", "[host]", "[host]:port", "[ipv6host%zone]", or "[ipv6host%zone]:port" into host or ipv6host%zone and port. Port will be an empty string if not supplied.
[ { "docid": "f7889bb7b0268344a7822d2ca8ad9ff5", "score": "0.7749518", "text": "func Split(hostport string) (host string, port string, err error) {\n\tvar rawport string\n\n\tif len(hostport) == 0 {\n\t\treturn\n\t}\n\n\t// Limit literal brackets to max one open and one closed\n\topenPos := strings.Index(hostport, \"[\")\n\tif openPos != strings.LastIndex(hostport, \"[\") {\n\t\terr = errors.New(\"too many '['\")\n\t\treturn\n\t}\n\tclosePos := strings.Index(hostport, \"]\")\n\tif closePos != strings.LastIndex(hostport, \"]\") {\n\t\terr = errors.New(\"too many ']'\")\n\t\treturn\n\t}\n\n\t// Break into host and port parts based on literal brackets\n\tif openPos > -1 {\n\t\t// Needs to open with the '['\n\t\tif openPos != 0 {\n\t\t\terr = errors.New(\"nothing can come before '['\")\n\t\t\treturn\n\t\t}\n\t\t// Must have a matching ']'\n\t\tif closePos == -1 {\n\t\t\terr = errors.New(\"missing ']'\")\n\t\t\treturn\n\t\t}\n\t\thost = hostport[1:closePos]\n\t\trawport = hostport[closePos+1:]\n\t} else if closePos > -1 {\n\t\t// Did not have a matching '['\n\t\terr = errors.New(\"missing '['\")\n\t\treturn\n\t} else {\n\t\t// No literal brackets, split on the last :\n\t\tsplitPos := strings.LastIndex(hostport, \":\")\n\t\tif splitPos < 0 {\n\t\t\thost = hostport\n\t\t} else {\n\t\t\thost = hostport[0:splitPos]\n\t\t\trawport = hostport[splitPos:]\n\t\t}\n\t}\n\n\tif rawport != \"\" {\n\t\tif strings.LastIndex(rawport, \":\") != 0 {\n\t\t\terr = errors.New(\"poorly separated or formatted port\")\n\t\t\treturn\n\t\t}\n\t\tport = rawport[1:]\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "1acef691b23a697829e4e2dda67ac031", "score": "0.7390137", "text": "func splitAddr(v string) (network, addr string, err error) {\n\tep := strings.Split(v, \"://\")\n\tif len(ep) != 2 {\n\t\terr = errInvalidAddress\n\t\treturn network, addr, err\n\t}\n\tvar (\n\t\thost string\n\t\tport string\n\t)\n\tnetwork = ep[0]\n\tswitch network {\n\tcase \"tcp\", \"udp\":\n\t\thost, port, err = net.SplitHostPort(ep[1])\n\t\tif err != nil {\n\t\t\treturn network, addr, err\n\t\t}\n\t\tswitch port {\n\t\tcase \"0\", \"*\", \"\":\n\t\t\tport = \"0\"\n\t\t}\n\t\tswitch host {\n\t\tcase \"\", \"*\":\n\t\t\thost = \"0.0.0.0\"\n\t\t}\n\t\taddr = host + \":\" + port\n\t\treturn network, addr, err\n\n\tcase \"ipc\":\n\t\thost = ep[1]\n\t\tport = \"\"\n\t\treturn network, host, nil\n\tcase \"inproc\":\n\t\terr = fmt.Errorf(\"zmq4: protocol %q not implemented\", network)\n\tdefault:\n\t\terr = fmt.Errorf(\"zmq4: unknown protocol %q\", network)\n\t}\n\n\treturn network, addr, err\n}", "title": "" }, { "docid": "f171fae6ac5a536ba94b3e5e7207649a", "score": "0.6869108", "text": "func SplitHostPort(str string) (Host, error) {\n\n\tip, portString, err := net.SplitHostPort(str)\n\tif err != nil {\n\t\treturn Host{}, err\n\t}\n\n\tport64, err := strconv.ParseInt(portString, 10, 64)\n\n\tif err != nil {\n\t\treturn Host{}, err\n\t}\n\n\tport := int(port64)\n\thost := Host{IP: ip, Port: port, Addr: str}\n\treturn host, nil\n}", "title": "" }, { "docid": "1b02961fd9a5f7ae197790914c7648d9", "score": "0.66478944", "text": "func SplitHostPort(hostport string) (host string, port uint16, err error) {\n\tif !strings.HasPrefix(hostport, \"::\") && strings.HasPrefix(hostport, \":\") {\n\t\thostport = localIPv4 + hostport\n\t}\n\thost, portStr, err := net.SplitHostPort(hostport)\n\tif err != nil {\n\t\thost = hostport\n\t\tport = defaultPort\n\t}\n\tif len(portStr) > 0 {\n\t\tvar p uint64\n\t\tp, err = strconv.ParseUint(portStr, 10, 16)\n\t\tif err != nil || p > math.MaxUint16 {\n\t\t\tport = defaultPort\n\t\t} else {\n\t\t\tport = uint16(p)\n\t\t}\n\t}\n\tif len(host) == 0 {\n\t\thost = \"localhost\"\n\t}\n\treturn host, port, err\n}", "title": "" }, { "docid": "de85c625a4e5257f69fdbc7583a67827", "score": "0.6397151", "text": "func splitHostPort(hostPort string) (string, int, error) {\n\thost, portStr, err := net.SplitHostPort(hostPort)\n\tif err != nil {\n\t\treturn \"\", 0, err\n\t}\n\n\tport, err := strconv.Atoi(portStr)\n\tif err != nil {\n\t\treturn \"\", 0, errors.New(fmt.Sprintf(\"error reading port: %s\", err))\n\t}\n\n\treturn host, port, nil\n}", "title": "" }, { "docid": "b743b546ebca4233b31839f934154031", "score": "0.6254607", "text": "func splitServerCred(a string) (server string, port int, err error) {\n\tfullAddress := strings.Split(a, \":\")\n\tif len(fullAddress) != 2 {\n\t\terr = errors.New(\"Please make sure the format of the server name is {serverName}:{port} , localhost:50000\")\n\t\treturn \"\", 0, err\n\t}\n\tserver = fullAddress[0]\n\tport, err = strconv.Atoi(fullAddress[1])\n\tif err != nil {\n\t\treturn \"\", 0, err\n\t}\n\treturn server, port, err\n}", "title": "" }, { "docid": "8498f841481b54a213d40c1ee5197c82", "score": "0.62392616", "text": "func SplitHostPortForSSH(addr string) (host string, port int, err error) {\n\thost = addr\n\th, p, err := net.SplitHostPort(host)\n\tif err == nil {\n\t\thost = h\n\t\tport, err = strconv.Atoi(p)\n\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t} else if host != \"\" {\n\t\t// test valid after concat :22\n\t\tif _, _, err = net.SplitHostPort(host + \":22\"); err == nil {\n\t\t\tport = 22\n\t\t}\n\t}\n\n\tif host == \"\" {\n\t\terr = fmt.Errorf(\"empty addr\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "5f9b1fe88584c326f7e15bdd78e175c0", "score": "0.6172968", "text": "func splitNetAddrV4(addr string) (ipnet *net.IPNet, err error) {\n\tif addr == \"*\" || addr == \"\" {\n\t\taddr = \"0.0.0.0/32\"\n\t}\n\tif !strings.Contains(addr, \"/\") {\n\t\taddr += \"/32\"\n\t}\n\t_, ipnet, err = net.ParseCIDR(addr)\n\treturn\n}", "title": "" }, { "docid": "2260f4e7aded3546700283f08780e697", "score": "0.61684376", "text": "func ParseAddr(addr string) (host, port string) {\n\te := strings.SplitN(addr, \":\", 2)\n\n\tif len(e) == 1 {\n\t\treturn e[0], \"\"\n\t}\n\n\treturn e[0], e[1]\n}", "title": "" }, { "docid": "3976fc5c59d17985391459d39ee1953e", "score": "0.6119033", "text": "func ParseAddr(addr string) (network, address string) {\n\tswitch {\n\tcase IsNamespaceAddr(addr):\n\t\treturn GetNamespace(addr[1:])\n\n\tcase strings.HasPrefix(addr, \"./\"), strings.HasPrefix(addr, \"/\"):\n\t\treturn \"unix\", addr\n\t}\n\n\tparts := strings.SplitN(addr, \":\", 2)\n\tif len(parts) == 2 {\n\t\tif (parts[1] == \"9p\") || (parts[1] == \"9fs\") {\n\t\t\tparts[1] = standardPort\n\t\t}\n\n\t\treturn \"tcp\", strings.Join(parts, \":\")\n\t}\n\n\tparts = strings.SplitN(addr, \"!\", 3)\n\tswitch len(parts) {\n\tcase 2:\n\t\tif parts[0] == \"tcp\" {\n\t\t\tparts[1] += \":\" + standardPort\n\t\t}\n\t\treturn parts[0], parts[1]\n\n\tcase 3:\n\t\tif (parts[2] == \"9p\") || (parts[2] == \"9fs\") {\n\t\t\tparts[2] = standardPort\n\t\t}\n\t\treturn parts[0], strings.Join(parts[1:], \":\")\n\t}\n\n\treturn \"tcp\", addr + \":\" + standardPort\n}", "title": "" }, { "docid": "f1db7391dfb0fbd9920f2915dd8f38fa", "score": "0.60917294", "text": "func Split(address string) (name, domain string, err error) {\n\tparts := strings.Split(address, Separator)\n\n\tif len(parts) != 2 {\n\t\terr = ErrInvalidAddress\n\t\treturn\n\t}\n\n\tname = parts[0]\n\tdomain = parts[1]\n\n\tif name == \"\" {\n\t\terr = ErrInvalidName\n\t\treturn\n\t}\n\n\tif !govalidator.IsDNSName(domain) {\n\t\terr = ErrInvalidDomain\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "5ceaf8aa60d48f632c870ce3ca5f8273", "score": "0.60902894", "text": "func SplitConnectionString(connectionString string) (string, int, error) {\n\turl, err := url_.Parse(connectionString)\n\tif err != nil {\n\t\treturn \"\", 0, err\n\t}\n\tif url.Scheme == \"unix\" {\n\t\treturn \"\", 0, fmt.Errorf(\"can't split to host:port unix socket path <%s>\", connectionString)\n\t}\n\tport, err := strconv.Atoi(url.Port())\n\tif err != nil {\n\t\treturn \"\", 0, err\n\t}\n\treturn url.Hostname(), port, nil\n}", "title": "" }, { "docid": "6ffa26573a4a028e9820c0ade0557c92", "score": "0.6042673", "text": "func Split(addr string) (local, domain string, err error) {\n\tif !Validate(addr) {\n\t\treturn \"\", \"\", errors.New(\"mta: invalid mail address\")\n\t}\n\tparts := strings.SplitN(addr, \"@\", 2)\n\n\tif len(parts) != 2 {\n\t\t// Should never be called!\n\t\treturn \"\", \"\", errors.New(\"mta: invalid mail address\")\n\t}\n\treturn parts[0], parts[1], nil\n}", "title": "" }, { "docid": "65800c38ea79a0c2c5abd33b955b9596", "score": "0.60042524", "text": "func splitHostPortGroupID(raw string) (string, string, error) {\n\ts := strings.SplitN(raw, \":\", 3)\n\tif len(s) != 3 || s[0] != hostPortGroupIDPrefix || s[1] == \"\" || s[2] == \"\" {\n\t\treturn \"\", \"\", fmt.Errorf(\"corrupt ID: %s\", raw)\n\t}\n\treturn s[1], s[2], nil\n}", "title": "" }, { "docid": "be28f8f5c71b9fcfe5ebf714aabc2731", "score": "0.59846365", "text": "func HostNameandPort(node string) (host, port string) {\n\tif len(node) == 0 {\n\t\treturn \"\", \"\"\n\t}\n\ttokens := []string{}\n\n\t// it's an IPv6 with port\n\tif _IPv6 && node[0] == '[' {\n\n\t\t// Then the url should be of the form [::1]:8091\n\t\ttokens = strings.Split(node, \"]:\")\n\t\thost = strings.Replace(tokens[0], \"[\", \"\", 1)\n\t} else {\n\n\t\t// IPv4 with or without port\n\t\t// FQDN with or without port\n\t\t// IPv6 without port\n\t\ttokens = strings.Split(node, \":\")\n\n\t\t// if we have more than two tokens, it was IPv6 without port\n\t\tif len(tokens) > 2 {\n\t\t\ttokens = []string{node}\n\t\t}\n\t\thost = tokens[0]\n\t}\n\n\tif len(tokens) == 2 {\n\t\tport = tokens[1]\n\t} else {\n\t\tport = \"\"\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "80536285fe7ac13c664797bbb815cde9", "score": "0.58884865", "text": "func parseAddr(addr string, defaultPort int) (network, address string, err error) {\n\tu, err := url.Parse(strings.ToLower(addr))\n\tif err != nil {\n\t\t// It's possible that we're dealing with IPv6 localhost here!\n\t\tif strings.HasPrefix(addr, \"[::]\") {\n\t\t\t_, port, e := net.SplitHostPort(addr)\n\t\t\tif e != nil {\n\t\t\t\treturn network, address, e\n\t\t\t}\n\t\t\tif port == \"\" {\n\t\t\t\tport = strconv.Itoa(defaultPort)\n\t\t\t}\n\t\t\treturn \"tcp\", fmt.Sprintf(\"0.0.0.0:%s\", port), nil\n\t\t}\n\n\t\treturn network, address, err\n\t}\n\n\tswitch {\n\tcase u.Scheme == \"\" && u.Opaque == \"\" && u.Host == \"\" && u.Path != \"\": // \"host\"\n\t\tu.Scheme, u.Opaque, u.Host, u.Path = \"tcp\", \"\", net.JoinHostPort(u.Path, strconv.Itoa(defaultPort)), \"\"\n\tcase u.Scheme != \"\" && u.Opaque != \"\" && u.Host == \"\" && u.Path == \"\": // \"host:1234\"\n\t\tu.Scheme, u.Opaque, u.Host, u.Path = \"tcp\", \"\", net.JoinHostPort(u.Scheme, u.Opaque), \"\"\n\tcase u.Scheme != \"\" && u.Opaque == \"\" && u.Host != \"\" && u.Path == \"\": // \"tcp://host[:1234]\"\n\t\tif _, _, err := net.SplitHostPort(u.Host); err != nil {\n\t\t\tu.Host = net.JoinHostPort(u.Host, strconv.Itoa(defaultPort))\n\t\t}\n\tdefault:\n\t\treturn network, address, errors.Errorf(\"%s: unsupported address format\", addr)\n\t}\n\n\treturn u.Scheme, u.Host, nil\n}", "title": "" }, { "docid": "99443c95823d17ee2b9c3982ada6468e", "score": "0.5872488", "text": "func parseAddr(addr string, defaultPort int) (network, address, host string, port int, err error) {\n\tu, err := url.Parse(strings.ToLower(addr))\n\tif err != nil {\n\t\treturn network, address, host, port, err\n\t}\n\n\tswitch {\n\tcase u.Scheme == \"\" && u.Opaque == \"\" && u.Host == \"\" && u.Path != \"\": // \"host\"\n\t\tu.Scheme, u.Opaque, u.Host, u.Path = \"tcp\", \"\", net.JoinHostPort(u.Path, strconv.Itoa(defaultPort)), \"\"\n\tcase u.Scheme != \"\" && u.Opaque != \"\" && u.Host == \"\" && u.Path == \"\": // \"host:1234\"\n\t\tu.Scheme, u.Opaque, u.Host, u.Path = \"tcp\", \"\", net.JoinHostPort(u.Scheme, u.Opaque), \"\"\n\tcase u.Scheme != \"\" && u.Opaque == \"\" && u.Host != \"\" && u.Path == \"\": // \"tcp://host[:1234]\"\n\t\tif _, _, err := net.SplitHostPort(u.Host); err != nil {\n\t\t\tu.Host = net.JoinHostPort(u.Host, strconv.Itoa(defaultPort))\n\t\t}\n\tdefault:\n\t\treturn network, address, host, port, errors.Errorf(\"%s: unsupported address format\", addr)\n\t}\n\n\thost, portStr, err := net.SplitHostPort(u.Host)\n\tif err != nil {\n\t\treturn network, address, host, port, err\n\t}\n\tport, err = strconv.Atoi(portStr)\n\tif err != nil {\n\t\treturn network, address, host, port, err\n\t}\n\n\treturn u.Scheme, u.Host, host, port, nil\n}", "title": "" }, { "docid": "335870837fc1773b0cd033c9066b90cc", "score": "0.5857871", "text": "func extractIpPort(address string) (uint32, uint16, bool) {\n // defaults\n ip := ipUint32(127,0,0,1)\n port := uint16(10001)\n\n address = strings.Trim(address, \" \\t\")\n\n if len(address) == 0 {\n // No address given, hence assume defaults\n return ip, port, true\n }\n\n if strings.HasPrefix(address, \":\") {\n // Only port number given\n p, _ := strconv.Atoi(address[1:])\n return ip, uint16(p), true\n }\n\n splitIpPort := strings.Split(address, \":\")\n\n if len(splitIpPort) == 1 {\n // Only ip address given\n splitIp := strings.Split(address, \".\")\n b1, _ := strconv.Atoi(splitIp[0])\n b2, _ := strconv.Atoi(splitIp[1])\n b3, _ := strconv.Atoi(splitIp[2])\n b4, _ := strconv.Atoi(splitIp[3])\n\n ip = ipUint32(uint8(b1), uint8(b2), uint8(b3), uint8(b4))\n\n return ip, port, true\n } else {\n // both ip:port given\n splitIp := strings.Split(splitIpPort[0], \".\")\n b1, _ := strconv.Atoi(splitIp[0])\n b2, _ := strconv.Atoi(splitIp[1])\n b3, _ := strconv.Atoi(splitIp[2])\n b4, _ := strconv.Atoi(splitIp[3])\n\n ip = ipUint32(uint8(b1), uint8(b2), uint8(b3), uint8(b4))\n p, _ := strconv.Atoi(splitIpPort[1])\n\n return ip, uint16(p), true\n }\n\n return ip, port, false\n}", "title": "" }, { "docid": "eabe4f45daf8f592e8ec349ade114c3f", "score": "0.57762784", "text": "func Extract(hostPort string, lis net.Listener) (string, error) {\n\taddr, port, err := net.SplitHostPort(hostPort)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif lis != nil {\n\t\tif p, ok := Port(lis); ok {\n\t\t\tport = strconv.Itoa(p)\n\t\t}\n\t}\n\tif len(addr) > 0 && (addr != \"0.0.0.0\" && addr != \"[::]\" && addr != \"::\") {\n\t\treturn net.JoinHostPort(addr, port), nil\n\t}\n\tifaces, err := net.Interfaces()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tfor _, iface := range ifaces {\n\t\taddrs, err := iface.Addrs()\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, rawAddr := range addrs {\n\t\t\tvar ip net.IP\n\t\t\tswitch addr := rawAddr.(type) {\n\t\t\tcase *net.IPAddr:\n\t\t\t\tip = addr.IP\n\t\t\tcase *net.IPNet:\n\t\t\t\tip = addr.IP\n\t\t\tdefault:\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif isPrivateIP(ip.String()) {\n\t\t\t\treturn net.JoinHostPort(ip.String(), port), nil\n\t\t\t}\n\t\t}\n\t}\n\treturn \"\", nil\n}", "title": "" }, { "docid": "326513bee0100461402a63871a181a9d", "score": "0.57633644", "text": "func ParseAddress(address string) (string, string) {\n\tsplit := strings.Split(address, \":\")\n\tip := split[0]\n\tport := split[1]\n\n\treturn ip, port\n}", "title": "" }, { "docid": "a1822e0e1bcb512893b5d612df4144d1", "score": "0.57400435", "text": "func splitDockerDomain(name string) (domain, remainder string) {\n\ti := strings.IndexRune(name, '/')\n\tif i == -1 || (!strings.ContainsAny(name[:i], \".:\") && name[:i] != \"localhost\") {\n\t\tdomain, remainder = \"\", name\n\t} else {\n\t\tdomain, remainder = name[:i], name[i+1:]\n\t}\n\treturn\n}", "title": "" }, { "docid": "5495d204cbca75fe82b92921139fc77e", "score": "0.57153934", "text": "func SplitHostArg(connString string) ([]string, string) {\n\n\t// strip off the replica set name from the beginning\n\tslashIndex := strings.Index(connString, \"/\")\n\tsetName := \"\"\n\tif slashIndex != -1 {\n\t\tsetName = connString[:slashIndex]\n\t\tif slashIndex == len(connString)-1 {\n\t\t\treturn []string{\"\"}, setName\n\t\t}\n\t\tconnString = connString[slashIndex+1:]\n\t}\n\n\t// split the hosts, and return them and the set name\n\treturn strings.Split(connString, \",\"), setName\n}", "title": "" }, { "docid": "f10ea545bedca72f86e62e5a4ccfe83b", "score": "0.56474316", "text": "func splitTag(name string) (string, string) {\n\t// Split on \":\"\n\tparts := strings.Split(name, \":\")\n\t// Verify that we aren't confusing a tag for a hostname w/ port for the purposes of weak validation.\n\tif len(parts) > 1 && !strings.Contains(parts[len(parts)-1], \"/\") {\n\t\tbase := strings.Join(parts[:len(parts)-1], \":\")\n\t\ttag := parts[len(parts)-1]\n\t\treturn base, tag\n\t}\n\treturn name, \"\"\n}", "title": "" }, { "docid": "8ef2975c7c462485f057018993d8bc99", "score": "0.564459", "text": "func TestCheckSplit_Case0(t *testing.T) {\n\tvar startIP, endIP net.IP\n\tvar line string\n\tvar err error\n\n\tline = \"1.1.1.1 2.2.2.2\"\n\tstartIP, endIP, err = checkSplit(line, \" \")\n\tif !startIP.Equal(net.ParseIP(\"1.1.1.1\")) ||\n\t\t!endIP.Equal(net.ParseIP(\"2.2.2.2\")) ||\n\t\terr != nil {\n\t\tt.Error(\"TestCheckSplit():\", err)\n\t}\n\n\tline = \"1.1.1.1\"\n\tstartIP, endIP, err = checkSplit(line, \" \")\n\tif !startIP.Equal(net.ParseIP(\"1.1.1.1\")) ||\n\t\t!endIP.Equal(net.ParseIP(\"1.1.1.1\")) ||\n\t\terr != nil {\n\t\tt.Error(\"TestCheckSplit():\", err)\n\t}\n\n\tline = \"1.1.1.1 2.2.2.2\"\n\tstartIP, endIP, err = checkSplit(line, \" \")\n\tif !startIP.Equal(net.ParseIP(\"1.1.1.1\")) ||\n\t\t!endIP.Equal(net.ParseIP(\"2.2.2.2\")) ||\n\t\terr != nil {\n\t\tt.Error(\"TestCheckSplit():\", err)\n\t}\n\n\tline = \"1.1.1.1 \\t\\t 2.2.2.2\"\n\tstartIP, endIP, err = checkSplit(line, \" \")\n\tif !startIP.Equal(net.ParseIP(\"1.1.1.1\")) ||\n\t\t!endIP.Equal(net.ParseIP(\"2.2.2.2\")) ||\n\t\terr != nil {\n\t\tt.Error(\"TestCheckSplit():\", err)\n\t}\n\tline = \"1::1 \\t\\t 1::FFFF\"\n\tstartIP, endIP, err = checkSplit(line, \" \")\n\tif !startIP.Equal(net.ParseIP(\"1::1\")) ||\n\t\t!endIP.Equal(net.ParseIP(\"1::FFFF\")) ||\n\t\terr != nil {\n\t\tt.Error(\"TestCheckSplit():\", err)\n\t}\n}", "title": "" }, { "docid": "af8231ea82c0e3f2ad308eee04012f05", "score": "0.560369", "text": "func splitAuthAndHost(s string) (string, string, error) {\n\t// s := <auth>@<hostname>:<port>\n\tsplitIndex := strings.LastIndexByte(s, '@')\n\n\tif splitIndex == -1 || splitIndex == 0 || splitIndex == len(s)-1 {\n\t\treturn \"\", \"\", errors.New(\"invalid <auth> and <hostname>\")\n\t}\n\n\treturn s[:splitIndex], s[splitIndex+1:], nil\n}", "title": "" }, { "docid": "5346d8ec044eca9a78d4853518e53d9c", "score": "0.5569451", "text": "func splitDockerDomain(name string) (host, locator string) {\n\ti := strings.IndexRune(name, '/')\n\tvar domain string\n\tif i == -1 || (!strings.ContainsAny(name[:i], \".:\") && name[:i] != \"localhost\") {\n\t\treturn dockerDomain, name\n\t} else {\n\t\tdomain = name[:i]\n\t\tlocator = name[i+1:]\n\t}\n\tif domain == legacyDomain {\n\t\tdomain = dockerDomain\n\t}\n\treturn domain, locator\n}", "title": "" }, { "docid": "e4a9b9c2df12b741d38995d4ce25d3fb", "score": "0.5560933", "text": "func Parse(addr string) (host string, port uint16, isLocal, isIPv4, isIPv6 bool, err error) {\n\thost, port, err = SplitHostPort(addr)\n\tif err != nil {\n\t\tlog.Warnf(\"failed to parse addr %s\\terror: %v\", addr, err)\n\t\thost = addr\n\t}\n\n\tip, nerr := netip.ParseAddr(host)\n\tif nerr != nil {\n\t\tlog.Debugf(\"host: %s,\\tport: %d,\\tip: %#v,\\terror: %v\", host, port, ip, nerr)\n\t}\n\n\t// return host and port and flags\n\treturn host, port,\n\t\t// check is local ip or not\n\t\tIsLocal(host) || nerr == nil && ip.IsLoopback(),\n\t\t// check is IPv4 or not\n\t\t// ic < 2,\n\t\tnerr == nil && ip.Is4(),\n\t\t// check is IPv6 or not\n\t\t// ic >= 2,\n\t\tnerr == nil && (ip.Is6() || ip.Is4In6()),\n\t\t// Split error\n\t\terr\n}", "title": "" }, { "docid": "8ed088464f3d884a5542032b5ad2fd9f", "score": "0.5553844", "text": "func ParseIpAndPort(addr string) (net.IP, int, error) {\n\ttaddr, err := net.ResolveTCPAddr(\"tcp\", addr)\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\treturn taddr.IP, taddr.Port, nil\n}", "title": "" }, { "docid": "c68e9229b5412b657f522aa6a7c45fe3", "score": "0.55133015", "text": "func SplitAddrString(addrs string) []string {\n\taddrs = strings.Replace(addrs, \";\", \",\", -1)\n\taddrArray := strings.Split(addrs, \",\")\n\treturn addrArray\n}", "title": "" }, { "docid": "c68e9229b5412b657f522aa6a7c45fe3", "score": "0.55133015", "text": "func SplitAddrString(addrs string) []string {\n\taddrs = strings.Replace(addrs, \";\", \",\", -1)\n\taddrArray := strings.Split(addrs, \",\")\n\treturn addrArray\n}", "title": "" }, { "docid": "405e3f53a31a03f206e525c7636f364b", "score": "0.5480626", "text": "func parseListen(v interface{}) (*HostPort, error) {\n\thp := &HostPort{}\n\tswitch v := v.(type) {\n\t// Only a port\n\tcase int64:\n\t\thp.Port = int(v)\n\tcase string:\n\t\thost, port, err := net.SplitHostPort(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Could not parse address string %q\", v)\n\t\t}\n\t\thp.Port, err = strconv.Atoi(port)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Could not parse port %q\", port)\n\t\t}\n\t\thp.Host = host\n\t}\n\treturn hp, nil\n}", "title": "" }, { "docid": "4b8aa885e6f5ac9e0ecf2b98638c84d7", "score": "0.5475759", "text": "func ParseHost(ctx context.Context) interface{} {\n\treturn func(hostport string) (string, error) {\n\t\tif IsUrl(hostport) {\n\t\t\treturn hostport, ErrNotImplemented\n\t\t} else {\n\t\t\thost, _, err := net.SplitHostPort(hostport)\n\t\t\treturn host, err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8164ab199c10c695bc41ff89910b11cd", "score": "0.54409593", "text": "func hostIPNamePort(hostWithPort string) (ip string, name string, port int) {\n\tvar (\n\t\thostPart, portPart string\n\t\tparsedPort uint64\n\t\terr error\n\t)\n\tif hostPart, portPart, err = net.SplitHostPort(hostWithPort); err != nil {\n\t\thostPart, portPart = hostWithPort, \"\"\n\t}\n\tif parsedIP := net.ParseIP(hostPart); parsedIP != nil {\n\t\tip = parsedIP.String()\n\t} else {\n\t\tname = hostPart\n\t}\n\tif parsedPort, err = strconv.ParseUint(portPart, 10, 16); err == nil {\n\t\tport = int(parsedPort)\n\t}\n\treturn\n}", "title": "" }, { "docid": "ee08cb34521400009622540a2eefb8ee", "score": "0.53834146", "text": "func parsePortMapping(s *string) (port *string, protocol *string, err error) {\n\tif s == nil {\n\t\t// default port for sidecar container to be 80.\n\t\treturn aws.String(defaultSidecarPort), nil, nil\n\t}\n\tportProtocol := strings.Split(*s, \"/\")\n\tswitch len(portProtocol) {\n\tcase 1:\n\t\treturn aws.String(portProtocol[0]), nil, nil\n\tcase 2:\n\t\treturn aws.String(portProtocol[0]), aws.String(portProtocol[1]), nil\n\tdefault:\n\t\treturn nil, nil, fmt.Errorf(\"cannot parse port mapping from %s\", *s)\n\t}\n}", "title": "" }, { "docid": "f41a52ae81eda99894cdb30a14125e15", "score": "0.53826267", "text": "func ParseAddr(fullHostOrPort ...string) string {\n\n\tif len(fullHostOrPort) > 1 {\n\t\tfullHostOrPort = fullHostOrPort[0:1]\n\t}\n\taddr := DefaultServerAddr // default address\n\t// if nothing passed, then use environment's port (if any) or just :8080\n\tif len(fullHostOrPort) == 0 {\n\t\tif envPort := os.Getenv(\"PORT\"); len(envPort) > 0 {\n\t\t\taddr = \":\" + envPort\n\t\t}\n\n\t} else if len(fullHostOrPort) == 1 {\n\t\taddr = fullHostOrPort[0]\n\t\tif strings.IndexRune(addr, ':') == -1 {\n\t\t\t//: doesn't found on the given address, so maybe it's only a port\n\t\t\taddr = \":\" + addr\n\t\t}\n\t}\n\n\treturn addr\n}", "title": "" }, { "docid": "816ef5a0b524b25d43c8af8d98519b21", "score": "0.5359553", "text": "func parseHost(s string) string {\n\treturn strings.Split(s, \":\")[0]\n}", "title": "" }, { "docid": "fc1fe1f35d63160bfe74600a9244ca80", "score": "0.5354759", "text": "func ParseMSSQLHostPort(info string) (host, port string) {\n\thost, port = \"127.0.0.1\", \"1433\"\n\tif strings.Contains(info, \":\") {\n\t\thost = strings.Split(info, \":\")[0]\n\t\tport = strings.Split(info, \":\")[1]\n\t} else if strings.Contains(info, \",\") {\n\t\thost = strings.Split(info, \",\")[0]\n\t\tport = strings.TrimSpace(strings.Split(info, \",\")[1])\n\t} else if len(info) > 0 {\n\t\thost = info\n\t}\n\treturn host, port\n}", "title": "" }, { "docid": "1766d8bde4f98324455d781ea9a59253", "score": "0.53432196", "text": "func ParseIP(addr string) (string, string) {\n\tip, port, err := net.SplitHostPort(addr)\n\tif err != nil {\n\t\tlog.Println(\"Address not valid\")\n\t\treturn \"\", \"\"\n\t}\n\treturn ip, port\n}", "title": "" }, { "docid": "9b030a0dcb5f958f9d9967f4578d6d6f", "score": "0.5340363", "text": "func splitAddress(addr string) []string {\n\tquoted := false\n\treturn strings.FieldsFunc(addr, func(r rune) bool {\n\t\tif r == '\"' {\n\t\t\tquoted = !quoted\n\t\t}\n\t\treturn !quoted && r == '.'\n\t})\n}", "title": "" }, { "docid": "c5c6e21b67a5c3b0a50a95b850a581a9", "score": "0.53370196", "text": "func split(pattern string) (host, path string) {\n\tpStart := strings.Index(pattern, \"/\")\n\tif pStart == -1 {\n\t\tpanic(\"path must begin with slash\")\n\t}\n\n\tpath = pattern[pStart:]\n\n\t// the domain part of the url is case insensitive\n\thost = strings.ToLower(pattern[:pStart])\n\treturn\n}", "title": "" }, { "docid": "34c6c47cfdbe72966993a83b3d1c05ae", "score": "0.5320533", "text": "func ParseSocketAddress(s string) (SocketAddress, error) {\n\tparts := strings.Split(s, \":\")\n\tvar port int\n\tvar err error\n\tif len(parts) == 1 {\n\t\tport = DefaultPort\n\t} else if len(parts) == 2 {\n\t\tport, err = strconv.Atoi(parts[1])\n\t\tif err != nil {\n\t\t\treturn SocketAddress{}, err\n\t\t}\n\t} else {\n\t\treturn SocketAddress{}, fmt.Errorf(\"too many parts. s: %v\", s)\n\t}\n\treturn SocketAddress{parts[0], port}, nil\n}", "title": "" }, { "docid": "2203e7db08e405b178927ca03516fbde", "score": "0.5293537", "text": "func SplitHosts(hostList string) []string {\n\tif hostList == \"\" {\n\t\treturn nil\n\t}\n\n\treturn strings.Split(hostList, \",\")\n}", "title": "" }, { "docid": "23ccb5bb49d26e44c739519c19a81ba1", "score": "0.529297", "text": "func splitTag(tag string) ([3]string, error) {\n\tcolon1, colon2 := -1, -1\n\tfor i, c := range tag {\n\t\tif c == ':' {\n\t\t\tif colon1 == -1 {\n\t\t\t\tcolon1 = i\n\t\t\t} else {\n\t\t\t\tcolon2 = i\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tvar result [3]string\n\tif colon2 == -1 {\n\t\treturn result, fmt.Errorf(\"tag doesn't have at least 3 colons: %q\", tag)\n\t}\n\tresult[0] = tag[:colon1]\n\tresult[1] = tag[colon1+1 : colon2]\n\tresult[2] = tag[colon2+1:]\n\treturn result, nil\n}", "title": "" }, { "docid": "cc2f9190fdefb93a73c630bc91c87768", "score": "0.529069", "text": "func ExtractIPPort(name string) (string, error) {\n\t// TODO: Remove separator. Separator and spliting is needed for backward compatibility.\n\t// Should remove separator checking after all servers don't use separator anymore.\n\ttokens := strings.Split(name, seperator)\n\t/*\n\t\tif len(tokens) <= 1 {\n\t\t\treturn \"\", fmt.Errorf(\"[shard] illegal znode name %s\", name)\n\t\t}\n\t*/\n\treturn tokens[0], nil\n}", "title": "" }, { "docid": "4a63a7b31ffbd48bd770182be098122e", "score": "0.5271472", "text": "func parseRemoteAddr(hostport string) string {\n\tcolon := strings.IndexByte(hostport, ':')\n\tif colon == -1 {\n\t\treturn hostport\n\t}\n\tif i := strings.IndexByte(hostport, ']'); i != -1 {\n\t\treturn strings.TrimPrefix(hostport[:i], \"[\")\n\t}\n\treturn hostport[:colon]\n}", "title": "" }, { "docid": "a165b54759ed7654f4a790eb86e63b83", "score": "0.5233602", "text": "func ParseHostPort(hostport string) (string, string, error) {\n\tvar host, port string\n\tvar err error\n\n\t// try to split host and port\n\tif host, port, err = net.SplitHostPort(hostport); err != nil {\n\t\t// if SplitHostPort returns an error, the entire hostport is considered as host\n\t\thost = hostport\n\t}\n\n\t// if port is defined, parse and validate it\n\tif port != \"\" {\n\t\tif _, err := ParsePort(port); err != nil {\n\t\t\treturn \"\", \"\", errors.Errorf(\"hostport %s: port %s must be a valid number between 1 and 65535, inclusive\", hostport, port)\n\t\t}\n\t}\n\n\t// if host is a valid IP, returns it\n\tif ip := netutils.ParseIPSloppy(host); ip != nil {\n\t\treturn host, port, nil\n\t}\n\n\t// if host is a validate RFC-1123 subdomain, returns it\n\tif errs := validation.IsDNS1123Subdomain(host); len(errs) == 0 {\n\t\treturn host, port, nil\n\t}\n\n\treturn \"\", \"\", errors.Errorf(\"hostport %s: host '%s' must be a valid IP address or a valid RFC-1123 DNS subdomain\", hostport, host)\n}", "title": "" }, { "docid": "3639dcc308a8e75da5144c7fd82954b9", "score": "0.52091885", "text": "func (s *IPAMService) SplitSubnet(id, prefix int) (rootAddr int, prefixIDs []int, resp *http.Response, err error) {\n\treqPath := fmt.Sprintf(\"ipam/address/%d/split\", id)\n\treq, err := s.client.NewRequest(http.MethodPost, reqPath, struct {\n\t\tPrefix int `json:\"prefix\"`\n\t}{\n\t\tPrefix: prefix,\n\t})\n\tif err != nil {\n\t\treturn 0, nil, nil, err\n\t}\n\n\tdata := &struct {\n\t\tRootAddr int `json:\"root_address_id\"`\n\t\tPrefixIDs []int `json:\"prefix_ids\"`\n\t}{}\n\tresp, err = s.client.Do(req, &data)\n\treturn data.RootAddr, data.PrefixIDs, resp, err\n}", "title": "" }, { "docid": "fb36748be9044b8a163b7768f896a598", "score": "0.5204662", "text": "func ParseHostPortFromConnStr(connStr string) (string, int) {\n\thost := strings.Split(connStr, \":\")[0]\n\tport, _ := strconv.Atoi(strings.Split(connStr, \":\")[1])\n\treturn host, port\n}", "title": "" }, { "docid": "7f8d69b317e75070748334bd08b32eb9", "score": "0.51968056", "text": "func Split(subnetID string) (string, string, error) {\n\tparts := strings.Split(subnetID, \"/\")\n\tif len(parts) != 11 {\n\t\treturn \"\", \"\", fmt.Errorf(\"subnet ID %q has incorrect length\", subnetID)\n\t}\n\n\treturn strings.Join(parts[:len(parts)-2], \"/\"), parts[len(parts)-1], nil\n}", "title": "" }, { "docid": "3a5c37f77a9a7b313e705ec215ca0d97", "score": "0.5161793", "text": "func ParsePort(addr string) int {\n\tport, err := strconv.Atoi(addr[strings.Index(addr, \":\")+1:])\n\tif err != nil {\n\t\tlog.Warna(err)\n\t}\n\n\treturn port\n}", "title": "" }, { "docid": "cf2b26cf8bb69b9f172f338f43332418", "score": "0.51516825", "text": "func parseDaemonHost(addr string) (string, error) {\n\taddrParts := strings.SplitN(addr, \"://\", 2)\n\tif len(addrParts) == 1 && addrParts[0] != \"\" {\n\t\taddrParts = []string{\"tcp\", addrParts[0]}\n\t}\n\n\tswitch addrParts[0] {\n\tcase \"tcp\":\n\t\treturn ParseTCPAddr(addrParts[1], DefaultTCPEndpoint)\n\tcase \"unix\":\n\t\treturn parseSimpleProtoAddr(\"unix\", addrParts[1], DefaultUnixSocket)\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"Invalid bind address format: %s\", addr)\n\t}\n}", "title": "" }, { "docid": "78a96960eb6654af1689e85145238389", "score": "0.5133991", "text": "func splitPortList(l []int) []string {\n\tout := []string{}\n\n\tacc := []string{}\n\tfor _, i := range l {\n\t\tacc = append(acc, strconv.Itoa(i))\n\t\tif len(acc) == 15 {\n\t\t\tout = append(out, strings.Join(acc, \",\"))\n\t\t\tacc = []string{}\n\t\t}\n\t}\n\n\tif len(acc) > 0 {\n\t\tout = append(out, strings.Join(acc, \",\"))\n\t}\n\treturn out\n}", "title": "" }, { "docid": "7d166f3d04c2528893074d2fc2a7f4f4", "score": "0.5133532", "text": "func parseRemoteServer(hostStr string) (*Server, error) {\n\tsplitIndex := strings.LastIndexByte(hostStr, ':')\n\n\tif splitIndex == -1 || splitIndex == 0 || splitIndex == len(hostStr)-1 {\n\t\treturn nil, errors.New(\"invalid <hostname>:<port>\")\n\t}\n\n\tport, err := strconv.Atoi(hostStr[splitIndex+1:])\n\tif err != nil {\n\t\treturn nil, errors.New(\"invalid <port>\")\n\t}\n\n\treturn &Server{hostStr[:splitIndex], port}, nil\n}", "title": "" }, { "docid": "2ee8f7c6692b8fc61f42a67cfa0cb1c7", "score": "0.5129727", "text": "func splitDockerDomain(name string) (domain, remainder string) {\n\ti := strings.IndexRune(name, '/')\n\tif i == -1 || (!strings.ContainsAny(name[:i], \".:\") && name[:i] != \"localhost\") {\n\t\tdomain, remainder = defaultDomain, name\n\t} else {\n\t\tdomain, remainder = name[:i], name[i+1:]\n\t}\n\tif domain == legacyDefaultDomain {\n\t\tdomain = defaultDomain\n\t}\n\tif domain == defaultDomain && !strings.ContainsRune(remainder, '/') {\n\t\tremainder = officialRepoName + \"/\" + remainder\n\t}\n\treturn\n}", "title": "" }, { "docid": "d7c917e9885b09f388d94e6655ff7ca0", "score": "0.51174843", "text": "func StrToServer(s string) Server {\r\n\tstrs := strings.Split(s, \":\")\r\n\tif (len(strs) != 3) {\r\n\t\tlog.Fatal(\"Incorrectly formatted addresses\")\r\n\t}\r\n\t\r\n\treturn Server{Address: strs[0], Port: PortPair{Client: strs[1], Server: strs[2]}}\r\n}", "title": "" }, { "docid": "ceb1baf434a59a7261257eb40c230002", "score": "0.5089356", "text": "func Normalize(address string) string {\n\thost, port, err := net.SplitHostPort(address)\n\tif err != nil {\n\t\thost = address\n\t\tport = \"22\"\n\t}\n\tentry := host\n\tif port != \"22\" {\n\t\tentry = \"[\" + entry + \"]:\" + port\n\t} else if strings.Contains(host, \":\") && !strings.HasPrefix(host, \"[\") {\n\t\tentry = \"[\" + entry + \"]\"\n\t}\n\treturn entry\n}", "title": "" }, { "docid": "556f6f64ad1602fb31c9554c8dd28d61", "score": "0.50868994", "text": "func ParseAddress(addrString string) *Address {\n\tsplited := strings.Split(addrString, \":\")\n\tif 2 == len(splited) && splited[0] != \"\" && splited[1] != \"\" {\n\t\treturn &Address{\n\t\t\tName: splited[0],\n\t\t\tPort: splited[1],\n\t\t}\n\t}\n\tlog.Fatalf(\"The address string is invalid.\")\n\treturn nil\n}", "title": "" }, { "docid": "f383d9e75aab2dfeb7743c65bfd2bac7", "score": "0.5061918", "text": "func splitRemoteAndPlugin(uri string) (string, string, error) {\n\t// Add \"//\" prefix. See: https://golang.org/src/net/url/url.go#L508\n\tparsedURI, err := url.Parse(\"//\" + uri)\n\n\tif err != nil {\n\t\treturn \"\", \"\", err //errors.New(\"invalid URI\")\n\t}\n\n\treturn parsedURI.Host, parsedURI.Query().Get(\"plugin\"), nil\n}", "title": "" }, { "docid": "2fa42e2428a689992b4e5c65cb28df84", "score": "0.5044995", "text": "func parseHost(req *http.Request) string {\n\t//if req.Host == \"\" {\n\t//\tlog.Fatalln(\"req.Host empty\") // net/http server set req.Host automatically\n\t//}\n\t// Extract the hostname part req.Host == \"some.hostname.net:1234\"\n\thost_strip, _, err := net.SplitHostPort(req.Host)\n\tif err != nil {\n\t\t// If req.Host doesn't contain any port part.\n\t\t//log.Println(\"net.SplitHostPort error\", err)\n\t\treturn req.Host\n\t}\n\treturn host_strip\n}", "title": "" }, { "docid": "d148763d4ef648e833549bada687553c", "score": "0.50446385", "text": "func ParsePostgreSQLHostPort(info string) (host, port string) {\n\thost, port = \"127.0.0.1\", \"5432\"\n\tif strings.Contains(info, \":\") && !strings.HasSuffix(info, \"]\") {\n\t\tidx := strings.LastIndex(info, \":\")\n\t\thost = info[:idx]\n\t\tport = info[idx+1:]\n\t} else if len(info) > 0 {\n\t\thost = info\n\t}\n\treturn host, port\n}", "title": "" }, { "docid": "5ea4256ca8cab98e3e0990764440ebb3", "score": "0.5042232", "text": "func SplitIPsToip(ips string, suffix string) (s []string, err error) {\n\tisip := common.IsIP(ips)\n\tif !isip {\n\t\treturn nil, nil\n\t}\n\tstr := strings.Split(ips, \".\")\n\tprefix := str[0] + \".\" + str[1] + \".\" + str[2]\n\n\tlastNum, _ := strconv.Atoi(str[3])\n\tswitch {\n\tcase lastNum > 0 && suffix == \"\": //just an ip\n\t\tlog.Println(\"doing 1......\")\n\t\ts = append(s, ips)\n\t\treturn s, nil\n\n\tcase lastNum >= 0:\n\t\tlog.Println(\"doing 2......\")\n\t\tvar start int\n\t\tvar stu int\n\t\tif suffix != \"\" {\n\t\t\tstu, _ = strconv.Atoi(suffix)\n\t\t} else {\n\t\t\tstu = 254\n\t\t}\n\n\t\tif lastNum == 0 {\n\t\t\tstart = 1\n\t\t} else {\n\t\t\tstart = lastNum\n\t\t}\n\t\tfor i := start; i <= stu; i++ {\n\t\t\tnewip := prefix + \".\" + strconv.Itoa(i)\n\t\t\ts = append(s, newip)\n\n\t\t}\n\t\treturn s, nil\n\tdefault:\n\t\treturn nil, nil\n\t}\n\treturn\n}", "title": "" }, { "docid": "827c771957dbda058970135205b7c88f", "score": "0.5039768", "text": "func Port(p string) (string, error) {\n\tif p[0] != ':' {\n\t\tp = \":\" + p\n\t}\n\n\tfor _, v := range p[1:] {\n\t\tif !unicode.IsDigit(v) {\n\t\t\treturn \"\", fmt.Errorf(\"val %q not digit in %q\", v, p)\n\t\t}\n\t}\n\n\treturn p, nil\n}", "title": "" }, { "docid": "f816f20f087aacd0d64ae10488722b4f", "score": "0.5035291", "text": "func parse(host string) (string, string, error) {\n\tt := strings.Split(host, \"/\")\n\tif len(t) == 2 {\n\t\treturn t[1], t[0], nil\n\t}\n\n\ttlsHost, _, err := net.SplitHostPort(host)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\treturn host, tlsHost, nil\n}", "title": "" }, { "docid": "c77298043b554d04a786582a1aa01f97", "score": "0.50343645", "text": "func ParseHostPort(ctx context.Context) interface{} {\n\treturn func(hostport string) (string, error) {\n\t\tif IsUrl(hostport) {\n\t\t\treturn hostport, ErrNotImplemented\n\t\t} else {\n\t\t\thost, port, err := net.SplitHostPort(hostport)\n\t\t\treturn host + \":\" + port, err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1909c8ea539f0c07958bb59240682704", "score": "0.5028451", "text": "func (b BuilderID) Split() (backend, backendGroup, builderName string, err error) {\n\ttoks := strings.SplitN(string(b), \"/\", 3)\n\tif len(toks) != 3 {\n\t\terr = errors.Reason(\"bad BuilderID: not enough tokens: %q\", b).\n\t\t\tTag(grpcutil.InvalidArgumentTag).Err()\n\t\treturn\n\t}\n\tbackend, backendGroup, builderName = toks[0], toks[1], toks[2]\n\tswitch {\n\tcase backend != \"buildbucket\":\n\t\terr = errors.Reason(\"bad BuilderID: unknown backend %q\", backend).\n\t\t\tTag(grpcutil.InvalidArgumentTag).Err()\n\tcase backendGroup == \"\":\n\t\terr = errors.New(\"bad BuilderID: empty backendGroup\", grpcutil.InvalidArgumentTag)\n\tcase builderName == \"\":\n\t\terr = errors.New(\"bad BuilderID: empty builderName\", grpcutil.InvalidArgumentTag)\n\t}\n\treturn\n}", "title": "" }, { "docid": "61ae6e5a7ad540184d18764b4d7dd168", "score": "0.50162715", "text": "func SplitLink(s, sep string) (string, string) {\n\tx := strings.Split(s, sep)\n\treturn x[0], x[1]\n}", "title": "" }, { "docid": "49a79a76f574686ee7b219feddfaffae", "score": "0.49637136", "text": "func parsePort(portArgument string) (string, int) {\n\tsplittedPortArgument := strings.Split(portArgument, \":\")\n\tif len(splittedPortArgument) == 0 {\n\t\tfmt.Println(\"INVALID PORT PARAMETER\")\n\t\tos.Exit(1)\n\t}\n\n\tvar proto string = \"TCP\"\n\tvar port int\n\tif len(splittedPortArgument) > 1 {\n\t\tproto = splittedPortArgument[1]\n\t}\n\n\tport, err := strconv.Atoi(splittedPortArgument[0])\n\tif err != nil {\n\t\tfmt.Println(\"INVALID PORT NUMBER\", splittedPortArgument[0])\n\t\tos.Exit(1)\n\t}\n\n\treturn strings.ToLower(proto), port\n}", "title": "" }, { "docid": "438a7595f31d3a098112d1ba0de13520", "score": "0.49610958", "text": "func NormalizeAddress(addr string, defaultPort string) (hostport string, err error) {\n\t// If the first SplitHostPort errors because of a missing port and not\n\t// for an invalid host, add the port. If the second SplitHostPort\n\t// fails, then a port is not missing and the original error should be\n\t// returned.\n\thost, port, origErr := net.SplitHostPort(addr)\n\tif origErr == nil {\n\t\treturn net.JoinHostPort(host, port), nil\n\t}\n\taddr = net.JoinHostPort(addr, defaultPort)\n\t_, _, err = net.SplitHostPort(addr)\n\tif err != nil {\n\t\treturn \"\", origErr\n\t}\n\treturn addr, nil\n}", "title": "" }, { "docid": "4661158ff16654ecf5518b4dc2363ac3", "score": "0.4944909", "text": "func ParseIPv4Port(address string) (ip gnet.IP, port uint16, err error) {\n\tcolonPos := strings.Index(address, \":\")\n\tif colonPos == -1 {\n\t\terr = errors.New(\"Address must be formated as x.x.x.x:x\")\n\t\treturn\n\t}\n\tip = gnet.ParseIP(address[:colonPos])\n\tif len(ip) != 16 {\n\t\terr = errors.New(\"Can not parse ip to net.IP\")\n\t\treturn\n\t}\n\tip = ip[12:]\n\t_port, err := strconv.Atoi(address[colonPos+1:])\n\tif err != nil {\n\t\terr = errors.New(\"Can not parse port to int\")\n\t\treturn\n\t}\n\tif _port > 65535 || _port < 0 {\n\t\terr = errors.New(\"Port must between 0~65535\")\n\t}\n\tport = uint16(_port)\n\n\treturn\n}", "title": "" }, { "docid": "dace29ff80f37c93f0a91f0832a95a6e", "score": "0.49421215", "text": "func splitEmail(email string) (local string, domain string, ok bool) {\n\tparts := strings.Split(email, \"@\")\n\tif len(parts) < 2 {\n\t\treturn\n\t}\n\tlocal = parts[0]\n\tdomain = parts[1]\n\t// Check that the parts contain enough characters.\n\tif len(local) < 1 {\n\t\treturn\n\t}\n\tif len(domain) < len(\"x.xx\") {\n\t\treturn\n\t}\n\treturn local, domain, true\n}", "title": "" }, { "docid": "7444f5c7fa9b8b0223f19b7338fa0876", "score": "0.49322498", "text": "func parsePorts(ports []string) ([]ForwardedPort, error) {\n\tvar forwards []ForwardedPort\n\tfor _, portString := range ports {\n\t\tparts := strings.Split(portString, \":\")\n\t\tvar localString, remoteString string\n\t\tif len(parts) == 1 {\n\t\t\tlocalString = parts[0]\n\t\t\tremoteString = parts[0]\n\t\t} else if len(parts) == 2 {\n\t\t\tlocalString = parts[0]\n\t\t\tif localString == \"\" {\n\t\t\t\t// support :5000\n\t\t\t\tlocalString = \"0\"\n\t\t\t}\n\t\t\tremoteString = parts[1]\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"invalid port format '%s'\", portString)\n\t\t}\n\n\t\tlocalPort, err := strconv.ParseUint(localString, 10, 16)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error parsing local port '%s': %s\", localString, err)\n\t\t}\n\n\t\tremotePort, err := strconv.ParseUint(remoteString, 10, 16)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error parsing remote port '%s': %s\", remoteString, err)\n\t\t}\n\t\tif remotePort == 0 {\n\t\t\treturn nil, fmt.Errorf(\"remote port must be > 0\")\n\t\t}\n\n\t\tforwards = append(forwards, ForwardedPort{uint16(localPort), uint16(remotePort)})\n\t}\n\n\treturn forwards, nil\n}", "title": "" }, { "docid": "1680ac24b183f65f2707231f8675afc3", "score": "0.49263227", "text": "func normalizeAddress(addr, defaultPort string) string {\n\t_, _, err := net.SplitHostPort(addr)\n\tif err != nil {\n\t\treturn net.JoinHostPort(addr, defaultPort)\n\t}\n\treturn addr\n}", "title": "" }, { "docid": "1680ac24b183f65f2707231f8675afc3", "score": "0.49263227", "text": "func normalizeAddress(addr, defaultPort string) string {\n\t_, _, err := net.SplitHostPort(addr)\n\tif err != nil {\n\t\treturn net.JoinHostPort(addr, defaultPort)\n\t}\n\treturn addr\n}", "title": "" }, { "docid": "6a8dcc57a42ab33cc4958c8e09ca37aa", "score": "0.49205667", "text": "func hostname(hostport string) string {\n\tcolon := strings.IndexByte(hostport, ':')\n\tif colon == -1 {\n\t\treturn hostport\n\t}\n\tif i := strings.IndexByte(hostport, ']'); i != -1 {\n\t\treturn strings.TrimPrefix(hostport[:i], \"[\")\n\t}\n\treturn hostport[:colon]\n}", "title": "" }, { "docid": "a8ec23a948517dee3ed6e4648728add7", "score": "0.4920134", "text": "func split(tosplit string, sep rune) []string {\n\tvar fields []string\n\n\tlast := 0\n\tfor i, c := range tosplit {\n\t\tif c == sep {\n\t\t\t// Found the separator, append a slice\n\t\t\tfields = append(fields, string(tosplit[last:i]))\n\t\t\tlast = i + 1\n\t\t}\n\t}\n\n\t// Don't forget the last field\n\tfields = append(fields, string(tosplit[last:]))\n\n\treturn fields\n}", "title": "" }, { "docid": "7c75c0e452e9577f56677d27457ef46a", "score": "0.49014533", "text": "func withPort(adr string) string {\n\tif strings.ContainsAny(adr, \"[]\") {\n\t\tif strings.Contains(adr, \"]:\") {\n\t\t\treturn adr\n\t\t}\n\t} else {\n\t\tif strings.ContainsAny(adr, \":\") {\n\t\t\treturn adr\n\t\t}\n\t}\n\treturn fmt.Sprintf(\"%s:0\", adr)\n}", "title": "" }, { "docid": "eaa5036333039226272fd7a065473090", "score": "0.48977882", "text": "func ParsePorts(ssport string) ([]ListenTarget, error) {\n\tret := []ListenTarget{}\n\tfor _, pairstring := range strings.Split(ssport, \";\") {\n\t\tpair := strings.Split(pairstring, \"=\")\n\t\tport, err := strconv.ParseUint(pair[1], 10, 0)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error: Failed to parse '%s'\", pairstring)\n\t\t}\n\t\tret = append(ret, ListenTarget{pair[0], uintptr(port)})\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "0232bd6e5b5299ecf5d353d6df56a886", "score": "0.4890531", "text": "func ToAddr(key string) Addr {\n\tvar addr Addr\n\tk := strings.Split(key, \"-\")\n\n\t// 192.168.s1.s2:s3\n\tvar s1, s2, s3 int\n\n\tfor i, word := range library.Words {\n\t\tif word == k[0] {\n\t\t\ts1 = i\n\t\t}\n\t\tif word == k[1] {\n\t\t\ts2 = i\n\t\t}\n\t\tif word == k[2] {\n\t\t\ts3 = i\n\t\t}\n\t}\n\n\taddr.IP = fmt.Sprintf(\"192.168.%v.%v\", s1, s2)\n\taddr.Port = s3 + 4000\n\n\treturn addr\n}", "title": "" }, { "docid": "5597ec4055e729259621cdf7ac4a6fa9", "score": "0.4882921", "text": "func Split(value, sep string) (interface{}, error) {\n\tstringResult := strings.Split(value, sep)\n\tresult := make([]interface{}, len(stringResult))\n\tfor i, val := range stringResult {\n\t\tresult[i] = val\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "9663e8999f897504790ce15872fdc76c", "score": "0.48763832", "text": "func parseBrokerHost(addr string) (string, error) {\n\taddrParts := strings.SplitN(addr, \"://\", 2)\n\tif len(addrParts) == 1 && addrParts[0] != \"\" {\n\t\taddrParts = []string{\"tcp\", addrParts[0]}\n\t}\n\n\tswitch addrParts[0] {\n\tcase \"tcp\":\n\t\treturn ParseTCPAddr(addrParts[1], DefaultBrokerHost)\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"Invalid broker address format: %s\", addr)\n\t}\n}", "title": "" }, { "docid": "b3f01bf63ea4243256ac3863cbcd562f", "score": "0.48665404", "text": "func ParsePort(ctx context.Context) interface{} {\n\treturn func(hostport string) (int, error) {\n\t\tif IsUrl(hostport) {\n\t\t\treturn 0, ErrNotImplemented\n\t\t} else {\n\t\t\t_, port, err := net.SplitHostPort(hostport)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\treturn strconv.Atoi(port)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fdc70f10074132bcba8b9c48ab3dbf54", "score": "0.4865518", "text": "func ParseHostAndPortFromJdbcConnStr(connStr string) (string, string, error) {\n\tr := regexp.MustCompile(`postgres://(.*)+:([0-9]+)/`)\n\tmatches := r.FindStringSubmatch(connStr)\n\tif len(matches) != 3 {\n\t\tlog.Errorf(\"Unexpected regex result groups:\", matches)\n\t\treturn \"\", \"\", fmt.Errorf(\"unexpected regex result groups: %v\", matches)\n\t}\n\treturn matches[1], matches[2], nil\n}", "title": "" }, { "docid": "d36f63bc034fba817e71170fa8498dcb", "score": "0.48605344", "text": "func hostport(hostport string) string {\n\tcolon := strings.IndexByte(hostport, ':')\n\tif colon == -1 {\n\t\treturn \"\"\n\t}\n\tif i := strings.Index(hostport, \"]:\"); i != -1 {\n\t\treturn hostport[i+len(\"]:\"):]\n\t}\n\tif strings.Contains(hostport, \"]\") {\n\t\treturn \"\"\n\t}\n\treturn hostport[colon+len(\":\"):]\n}", "title": "" }, { "docid": "c0cef99e9e7b3f88e5b8d5026f06bab9", "score": "0.48525122", "text": "func parseHosts(input string) []string {\n\tvar hosts []string\n\tfor _, h := range strings.Split(input, \",\") {\n\t\tif host := strings.TrimSpace(h); len(host) > 0 {\n\t\t\thosts = append(hosts, host)\n\t\t}\n\t}\n\treturn hosts\n}", "title": "" }, { "docid": "13a6d9fdf14a58d63f81dd1f25d5879d", "score": "0.48492926", "text": "func ParseEndpoint(addr string) Endpoint {\n\t// assume addr as host, port as 80\n\tip, port, id := addr, 80, util.RandomChars(10)\n\n\t// if its valid port, assume as port, host as 127.0.0.1\n\tif p, err := strconv.Atoi(addr); err == nil {\n\t\tip = \"127.0.0.1\"\n\t\tport = p\n\t}\n\n\t// attempt parse\n\tstr := strings.Split(addr, \":\")\n\n\t// valid host/port\n\tif len(str) > 1 {\n\t\tip = str[0]\n\t\tport, _ = strconv.Atoi(str[1])\n\t}\n\t// valid id\n\tif len(str) > 2 {\n\t\tid = str[2]\n\t}\n\n\treturn Endpoint{\n\t\tId: id,\n\t\tIp: ip,\n\t\tPort: port,\n\t}\n}", "title": "" }, { "docid": "110203682f0f07e244831ec86f2f0570", "score": "0.48492432", "text": "func ExtractHostAndPortFromMultiAddr(multiAddr multiaddr.Multiaddr, portProtoCode int) (string, int, error) {\n\tportStr, err := multiAddr.ValueForProtocol(portProtoCode)\n\tif err != nil {\n\t\treturn \"\", 0, fmt.Errorf(\"unable to parse port for proto code %d: %w\", portProtoCode, err)\n\t}\n\n\tport, err := strconv.Atoi(portStr)\n\tif err != nil {\n\t\treturn \"\", 0, fmt.Errorf(\"unable to parse port as number: %w\", err)\n\t}\n\n\tip4Addr, err := multiAddr.ValueForProtocol(multiaddr.P_IP4)\n\tif err == nil {\n\t\treturn ip4Addr, port, nil\n\t}\n\n\tip6Addr, err := multiAddr.ValueForProtocol(multiaddr.P_IP6)\n\tif err == nil {\n\t\treturn ip6Addr, port, nil\n\t}\n\n\thostName, err := multiAddr.ValueForProtocol(multiaddr.P_DNS)\n\tif err == nil {\n\t\treturn hostName, port, nil\n\t}\n\n\treturn \"\", 0, ErrMultiAddrNoHost\n}", "title": "" }, { "docid": "b7c724168b30d748d69abe746c53230a", "score": "0.48476502", "text": "func parseHost(url string) (*host, error) {\n\t// input: xxxxx.kd.io, output: [xxxxx kd.io]\n\th := strings.SplitN(url, \".\", 2)\n\n\tif len(h) != 2 {\n\t\treturn nil, fmt.Errorf(\"not valid host '%s'\", url)\n\t}\n\n\tif h[1] != \"kd.io\" {\n\t\treturn nil, fmt.Errorf(\"invalid domain: %s\", h[1])\n\t}\n\n\t// input: kitename-key-username, output: [service key username]\n\ts := strings.Split(h[0], \"-\")\n\treturn &host{\n\t\tkite: s[0],\n\t\tversion: s[1],\n\t\tusername: s[2],\n\t}, nil\n}", "title": "" }, { "docid": "15034f6fa9f1a6946ff9ac9fd7722c2f", "score": "0.48402143", "text": "func CreateConnectionAddrs(host, port string) []string {\n\n\t// set to the defaults, if necessary\n\tif host == \"\" {\n\t\thost = DefaultHost\n\t\tif port == \"\" {\n\t\t\thost += fmt.Sprintf(\":%v\", DefaultPort)\n\t\t}\n\t}\n\n\t// parse the host string into the individual hosts\n\taddrs, _ := SplitHostArg(host)\n\n\t// if a port is specified, append it to all the hosts\n\tif port != \"\" {\n\t\tfor idx, addr := range addrs {\n\t\t\taddrs[idx] = fmt.Sprintf(\"%v:%v\", addr, port)\n\t\t}\n\t}\n\n\treturn addrs\n}", "title": "" }, { "docid": "6caa5fab041e3fbc20f47018656ee268", "score": "0.48298174", "text": "func (vv *VatValidator) Split(s string) (country, num string, err error) {\n\n\tif len(s) < 3 {\n\t\treturn \"\", \"\", ErrInvalidInputData\n\t}\n\n\t// currently formatValidationRequired is always false.\n\tif vv.formatValidationRequired == false {\n\t\treturn s[:2], s[2:], nil\n\t}\n\n\tf, ok := vatFormatValidator[s[:2]]\n\tif ok == false {\n\t\treturn \"\", \"\", ErrUnknownCountryPrefix\n\t}\n\n\tif f != nil {\n\t\tif f(s[2:]) == false {\n\t\t\treturn \"\", \"\", ErrInvalidNumberFormat\n\t\t}\n\t}\n\n\treturn s[:2], s[2:], nil\n}", "title": "" }, { "docid": "738b908c2816f3f5ff01133a0713b90a", "score": "0.48240182", "text": "func split(input string) (prefix string, rest string) {\n\tif input == \"\" || input == \"-\" {\n\t\treturn\n\t}\n\n\tif input[0] != '-' {\n\t\trest = input\n\t\treturn\n\t}\n\n\tidx := strings.IndexRune(input, ' ')\n\n\tif idx == -1 {\n\t\tprefix = input[1:]\n\t\treturn\n\t}\n\n\tprefix = input[1:idx]\n\trest = strings.TrimSpace(input[idx:])\n\treturn\n}", "title": "" }, { "docid": "f94f231df39d39eac0dd4d1e58775cb7", "score": "0.48221827", "text": "func SplitNamespaceDomain(name string) (ns string, domain string, err error) {\n\tparts := strings.Split(name, \"/\")\n\tif len(parts) != 2 {\n\t\treturn \"\", \"\", fmt.Errorf(\"invalid address format\")\n\t}\n\treturn parts[0], parts[1], nil\n}", "title": "" }, { "docid": "e2206a3baebb803f53d481136dfb36a6", "score": "0.48188388", "text": "func TestCheckSplit_Case1(t *testing.T) {\n\tvar line string\n\tvar err error\n\n\tline = \"1.1.1.1 a\"\n\t_, _, err = checkSplit(line, \" \")\n\tif err == nil {\n\t\tt.Errorf(\"TestCheckSplit(): line %s err\", line)\n\t}\n\n\tline = \"a 1.1.1.1\"\n\t_, _, err = checkSplit(line, \" \")\n\tif err == nil {\n\t\tt.Errorf(\"TestCheckSplit(): line %s err\", line)\n\t}\n\n\tline = \"a b\"\n\t_, _, err = checkSplit(line, \" \")\n\tif err == nil {\n\t\tt.Errorf(\"TestCheckSplit(): line %s err\", line)\n\t}\n\n\tline = \"1.1.1.1 2.2.2.2 a\"\n\t_, _, err = checkSplit(line, \" \")\n\tif err == nil {\n\t\tt.Errorf(\"TestCheckSplit(): line %s err\", line)\n\t}\n\tline = \"1::1 1::FFFF a\"\n\t_, _, err = checkSplit(line, \" \")\n\tif err == nil {\n\t\tt.Errorf(\"TestCheckSplit(): line %s err\", line)\n\t}\n}", "title": "" }, { "docid": "484cd271555ab2fb5bd7df37768f8521", "score": "0.48157504", "text": "func getListenIPs(httpServerConf *http.Server) (hosts []string, port string) {\n\thost, port, err := net.SplitHostPort(httpServerConf.Addr)\n\tfatalIf(err, \"Unable to parse host address.\", httpServerConf.Addr)\n\n\tif host != \"\" {\n\t\thosts = append(hosts, host)\n\t\treturn hosts, port\n\t}\n\taddrs, err := net.InterfaceAddrs()\n\tfatalIf(err, \"Unable to determine network interface address.\")\n\tfor _, addr := range addrs {\n\t\tif addr.Network() == \"ip+net\" {\n\t\t\thost := strings.Split(addr.String(), \"/\")[0]\n\t\t\tif ip := net.ParseIP(host); ip.To4() != nil {\n\t\t\t\thosts = append(hosts, host)\n\t\t\t}\n\t\t}\n\t}\n\treturn hosts, port\n}", "title": "" }, { "docid": "4e50aeba0c749272cd67b1f8b4c91074", "score": "0.48045152", "text": "func splitGitLabProjectURL(projectURL string) (baseURL, projectName string, err error) {\n\tu, err := url.Parse(projectURL)\n\tif err != nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"parsing project URL %q: %w\", projectURL, err)\n\t}\n\n\tprojectName = u.Path[1:]\n\tbaseURL = strings.TrimSuffix(projectURL, projectName)\n\n\treturn baseURL, projectName, nil\n}", "title": "" }, { "docid": "e2d8f00b30b49dd1729ad3585d9e962a", "score": "0.48035657", "text": "func SplitBlobURI(URI string) (string, string, string, error) {\n\turi, err := url.Parse(URI)\n\tif err != nil {\n\t\treturn \"\", \"\", \"\", err\n\t}\n\n\taccountName := strings.Split(uri.Host, \".\")[0]\n\turlParts := strings.Split(uri.Path, \"/\")\n\n\tcontainerName := urlParts[1]\n\tblobPath := strings.Join(urlParts[2:], \"/\")\n\n\treturn accountName, containerName, blobPath, nil\n}", "title": "" }, { "docid": "4c2a528b691992275706dea4933081d0", "score": "0.48007596", "text": "func ParseTCPAddr(tryAddr string, defaultAddr string) (string, error) {\n\tif tryAddr == \"\" || tryAddr == \"tcp://\" {\n\t\treturn defaultAddr, nil\n\t}\n\taddr := strings.TrimPrefix(tryAddr, \"tcp://\")\n\tif strings.Contains(addr, \"://\") || addr == \"\" {\n\t\treturn \"\", fmt.Errorf(\"Invalid proto, expected tcp: %s\", tryAddr)\n\t}\n\n\tdefaultAddr = strings.TrimPrefix(defaultAddr, \"tcp://\")\n\tdefaultHost, defaultPort, err := net.SplitHostPort(defaultAddr)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// url.Parse fails for trailing colon on IPv6 brackets on Go 1.5, but\n\t// not 1.4. See https://github.com/golang/go/issues/12200 and\n\t// https://github.com/golang/go/issues/6530.\n\tif strings.HasSuffix(addr, \"]:\") {\n\t\taddr += defaultPort\n\t}\n\n\tu, err := url.Parse(\"tcp://\" + addr)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\thost, port, err := net.SplitHostPort(u.Host)\n\tif err != nil {\n\t\t// try port addition once\n\t\thost, port, err = net.SplitHostPort(net.JoinHostPort(u.Host, defaultPort))\n\t}\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Invalid bind address format: %s\", tryAddr)\n\t}\n\n\tif host == \"\" {\n\t\thost = defaultHost\n\t}\n\tif port == \"\" {\n\t\tport = defaultPort\n\t}\n\tp, err := strconv.Atoi(port)\n\tif err != nil && p == 0 {\n\t\treturn \"\", fmt.Errorf(\"Invalid bind address format: %s\", tryAddr)\n\t}\n\n\treturn fmt.Sprintf(\"tcp://%s%s\", net.JoinHostPort(host, port), u.Path), nil\n}", "title": "" }, { "docid": "d6bc9e49f2e7b9ceef5f7bdab548c965", "score": "0.47988027", "text": "func ParseNmap(raw string, options core.Options) []string {\n\tvar result []string\n\tvar hosts []Host\n\tif strings.Count(raw, \"<address\") > 1 {\n\t\thosts = append(hosts, GetHosts(raw)...)\n\t} else {\n\t\thosts = append(hosts, GetHost(raw))\n\t}\n\n\tfor _, host := range hosts {\n\t\t//spew.Dump(host)\n\t\tif len(host.Ports) <= 0 {\n\t\t\tcore.ErrorF(\"No open port found for %v\", host.IPAddress)\n\t\t\tcontinue\n\t\t}\n\t\tif options.JsonOutput {\n\t\t\tif data, err := jsoniter.MarshalToString(host); err == nil {\n\t\t\t\tresult = append(result, data)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, port := range host.Ports {\n\t\t\tinfo := fmt.Sprintf(\"%v:%v/%v/%v\", host.IPAddress, port.PortID, port.Protocol, port.Service.Product)\n\t\t\tresult = append(result, info)\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "abc235f3fc1827175cd8407b0dfada3e", "score": "0.47953764", "text": "func HostAndPortString(host net.IP, port uint16) (peer string) {\n\thost_str := host.String()\n\tport_uint64 := uint64(port)\n\tport_str := strconv.FormatUint(port_uint64, 10)\n\tpeer = host_str + \":\" + port_str\n\treturn peer\n}", "title": "" }, { "docid": "f7746d0aef3c9f702291c1744e42a58e", "score": "0.47869468", "text": "func stripPort(ip string) string {\n\tif strings.Contains(ip, \":\") {\n\t\treturn strings.Split(ip, \":\")[0]\n\t}\n\treturn ip\n}", "title": "" }, { "docid": "baf3525b1f2554c6296001b3612fabce", "score": "0.47825208", "text": "func (s *Script) ParseSplitAddrScript() ([]*types.AddressHash, []uint32, error) {\n\topCode, _, pc, err := s.getNthOp(0, 0)\n\tif err != nil || opCode != OPRETURN {\n\t\treturn nil, nil, ErrInvalidSplitAddrScript\n\t}\n\topCode, _, pc, err = s.getNthOp(pc, 0)\n\tif err != nil || opCode != OP0 {\n\t\treturn nil, nil, ErrInvalidSplitAddrScript\n\t}\n\n\t_, operandHash, pc, err := s.getNthOp(pc, 0)\n\tif err != nil || len(operandHash) != ripemd160.Size {\n\t\treturn nil, nil, ErrInvalidSplitAddrScript\n\t}\n\n\taddrs := make([]*types.AddressHash, 0, 2)\n\tweights := make([]uint32, 0, 2)\n\n\tfor i := 0; ; i++ {\n\t\t// public key\n\t\t_, operand, _, err := s.getNthOp(pc, i)\n\t\tif err != nil {\n\t\t\tif err == ErrScriptBound {\n\t\t\t\t// reached end\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn nil, nil, ErrInvalidSplitAddrScript\n\t\t}\n\t\tif i%2 == 0 {\n\t\t\t// address\n\t\t\taddr, err := types.NewAddressPubKeyHash(operand)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, ErrInvalidSplitAddrScript\n\t\t\t}\n\t\t\taddrs = append(addrs, addr.Hash160())\n\t\t} else {\n\t\t\t// weight\n\t\t\tif len(operand) != 4 {\n\t\t\t\treturn nil, nil, ErrInvalidSplitAddrScript\n\t\t\t}\n\t\t\tweights = append(weights, binary.LittleEndian.Uint32(operand))\n\t\t}\n\t}\n\n\tif len(addrs) > MaxSplitAddrs {\n\t\treturn nil, nil, ErrInvalidSplitAddrScript\n\t}\n\tscript := NewScript()\n\tfor i := 0; i < len(addrs); i++ {\n\t\tw := make([]byte, 4)\n\t\tbinary.LittleEndian.PutUint32(w, weights[i])\n\t\tscript.AddOperand(addrs[i][:]).AddOperand(w)\n\t}\n\tscriptHash := crypto.Hash160(*script)\n\t// Check hash is expected\n\tif !bytes.Equal(scriptHash, operandHash) {\n\t\treturn nil, nil, ErrInvalidSplitAddrScript\n\t}\n\n\treturn addrs, weights, nil\n}", "title": "" }, { "docid": "9e675bae62c5f631f675af7ec77a6668", "score": "0.47661054", "text": "func (f *SplitFilter) Split(input interface{}, data map[string]interface{}) interface{} {\n\ton := core.ToString(f.on.Resolve(data))\n\tswitch typed := input.(type) {\n\tcase string:\n\t\treturn strings.Split(typed, on)\n\tcase []byte:\n\t\treturn strings.Split(string(typed), on)\n\tdefault:\n\t\treturn input\n\t}\n}", "title": "" } ]
f1501ac30bb9d2fb3ad66638f9ebb85d
Read reads data from the underlying the data channel
[ { "docid": "c1df31ec9fb6a6520b57f27b31e81df6", "score": "0.0", "text": "func (c *Conn) Read(b []byte) (int, error) {\n\tif c.isClosed {\n\t\treturn 0, errors.New(\"read on closed conn\")\n\t}\n\ti, err := c.p.Read(b)\n\treturn i, err\n}", "title": "" } ]
[ { "docid": "31aab256efd2396902822846e37eba58", "score": "0.7086542", "text": "func (cb *ChannelBank) Read() (data []byte, err error) {\n\tif len(cb.channelQueue) == 0 {\n\t\treturn nil, io.EOF\n\t}\n\tfirst := cb.channelQueue[0]\n\tch := cb.channels[first]\n\ttimedOut := ch.OpenBlockNumber()+cb.cfg.ChannelTimeout < cb.Origin().Number\n\tif timedOut {\n\t\tcb.log.Info(\"channel timed out\", \"channel\", first, \"frames\", len(ch.inputs))\n\t\tcb.metrics.RecordChannelTimedOut()\n\t\tdelete(cb.channels, first)\n\t\tcb.channelQueue = cb.channelQueue[1:]\n\t\t// There is a new head channel if there is a channel after we have removed the first channel\n\t\tif len(cb.channelQueue) > 0 {\n\t\t\tcb.metrics.RecordHeadChannelOpened()\n\t\t}\n\t\treturn nil, nil // multiple different channels may all be timed out\n\t}\n\tif !ch.IsReady() {\n\t\treturn nil, io.EOF\n\t}\n\tcb.log.Info(\"Reading channel\", \"channel\", first, \"frames\", len(ch.inputs))\n\n\tdelete(cb.channels, first)\n\tcb.channelQueue = cb.channelQueue[1:]\n\t// There is a new head channel if there is a channel after we have removed the first channel\n\tif len(cb.channelQueue) > 0 {\n\t\tcb.metrics.RecordHeadChannelOpened()\n\t}\n\tr := ch.Reader()\n\t// Suppress error here. io.ReadAll does return nil instead of io.EOF though.\n\tdata, _ = io.ReadAll(r)\n\treturn data, nil\n}", "title": "" }, { "docid": "f1202c78a457daad54f577acf7e367a1", "score": "0.7084156", "text": "func (ib *ChannelBank) Read() (data []byte, err error) {\n\tif len(ib.channelQueue) == 0 {\n\t\treturn nil, io.EOF\n\t}\n\tfirst := ib.channelQueue[0]\n\tch := ib.channels[first]\n\ttimedOut := first.Time+ib.cfg.ChannelTimeout < ib.progress.Origin.Time\n\tif timedOut {\n\t\tib.log.Debug(\"channel timed out\", \"channel\", first, \"frames\", len(ch.inputs))\n\t}\n\tif ch.closed {\n\t\tib.log.Debug(\"channel closed\", \"channel\", first)\n\t}\n\tif !timedOut && !ch.closed { // check if channel is done (can then be read)\n\t\treturn nil, io.EOF\n\t}\n\tdelete(ib.channels, first)\n\tib.channelQueue = ib.channelQueue[1:]\n\tdata = ch.Read()\n\treturn data, nil\n}", "title": "" }, { "docid": "e9185fa0de0c2a635db0dfb820212dc1", "score": "0.69629955", "text": "func (c *mockSSHChannel) Read(data []byte) (int, error) {\n\treturn c.stdIn.Read(data)\n}", "title": "" }, { "docid": "959e385e1b75fa30d3f01008b441946b", "score": "0.6962377", "text": "func (r *Receiver) Read() interface{} {\n\tb := <-r.C\n\tv := b.v\n\tr.C <- b\n\tr.C = b.c\n\treturn v\n}", "title": "" }, { "docid": "6aa73c622d36603aaf8e510d9da6865e", "score": "0.6919035", "text": "func (inPort *InPort) read() <-chan interface{} {\n\treturn inPort.channel\n}", "title": "" }, { "docid": "ec3f58e840520cb30f0fc42007667fd4", "score": "0.6891236", "text": "func (r *Receiver) Read() interface{} {\n\tb := <-r.c\n\tv := b.v\n\tr.c <- b\n\tr.c = b.c\n\treturn v\n}", "title": "" }, { "docid": "ec3f58e840520cb30f0fc42007667fd4", "score": "0.6891236", "text": "func (r *Receiver) Read() interface{} {\n\tb := <-r.c\n\tv := b.v\n\tr.c <- b\n\tr.c = b.c\n\treturn v\n}", "title": "" }, { "docid": "ec3f58e840520cb30f0fc42007667fd4", "score": "0.6891236", "text": "func (r *Receiver) Read() interface{} {\n\tb := <-r.c\n\tv := b.v\n\tr.c <- b\n\tr.c = b.c\n\treturn v\n}", "title": "" }, { "docid": "490a8bb7551e0ae1926a7f56096f8067", "score": "0.6829469", "text": "func read(conn net.Conn, ch chan interface{}) {\n\tdefer close(ch) // make sure we close the channel when we stop reading\n\n\tdec := gob.NewDecoder(conn)\n\tbuf := data{}\n\tfor {\n\t\terr := dec.Decode(&buf) // try to de-serialize the data\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tch <- buf.Value // unpack the payload\n\t}\n}", "title": "" }, { "docid": "ec4c1cd01f19ad5da9996635a5924bab", "score": "0.68194985", "text": "func (c *ZmqClient3) Read(p []byte) (n int, err error) {\n\tif c.indx >= int64(len(c.prevData)) {\n\t\tc.indx = 0\n\t\tvar msg zmq4.Msg\n\t\tmsg, err = c.socket.Recv()\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tc.prevData = msg.Bytes() // handle all frames?\n\t}\n\tn = copy(p, c.prevData[c.indx:])\n\tc.indx += int64(n)\n\treturn\n}", "title": "" }, { "docid": "fb4643e530c3e6d18fc0469016d23fec", "score": "0.677185", "text": "func (m *MockChannel) Read(data []byte) (int, error) {\n\tm.Called(data)\n\n\t// Mock read failure\n\tif m.ReadError != nil {\n\t\treturn 0, m.ReadError\n\t}\n\n\t// Mock successful read\n\treturn len(data), nil\n}", "title": "" }, { "docid": "004e723199bdb80f58943ac1dcbcee96", "score": "0.6761585", "text": "func read(stream io.Reader, data chan<- []byte, wg *sync.WaitGroup) {\n\tdefer wg.Done()\n\tlog.Infof(\"opening stream\")\n\tbuffer := make([]byte, 64)\n\tfor {\n\t\tn, err := stream.Read(buffer)\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tlog.Debugf(\"read to EOF (%d bytes)\", n)\n\t\t\t\tdata <- buffer[:n]\n\t\t\t} else {\n\t\t\t\tlog.Errorf(\"error reading from pipe: %v\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tlog.Debugf(\"read data (%d bytes)\", n)\n\t\tdata <- buffer[:n]\n\t}\n\tlog.Infof(\"closing stream\")\n\tclose(data)\n}", "title": "" }, { "docid": "bd28ab4354917159e0f943312530bbce", "score": "0.6757618", "text": "func (m *Mock) Read() <-chan interface{} {\n\targs := m.Called()\n\treturn args.Get(0).(<-chan interface{})\n}", "title": "" }, { "docid": "730a09c84331372e737aa6123af7fdad", "score": "0.672586", "text": "func Read(r io.Reader, order binary.ByteOrder, data interface{}) error", "title": "" }, { "docid": "81751a6f8774d2f0bc459473231c1b7a", "score": "0.6710717", "text": "func (client *Client) Read() ([]byte, error) {\n\tselect {\n\tcase <-client.closeC:\n\t\treturn nil, io.EOF\n\tcase msg := <-client.readC:\n\t\treturn msg, nil\n\t}\n}", "title": "" }, { "docid": "c599b7c7768726ab344054000c2b0d98", "score": "0.6701547", "text": "func (c *client) Read() ([]byte, error) {\n\tc.rReqChan <- struct{}{}\n\treply := <-c.rRepChan\n\treturn reply.payload, reply.err\n}", "title": "" }, { "docid": "88b5f47d62e92a26da79aad7b5c4dc94", "score": "0.67000675", "text": "func (r *AsyncReader) Read(p []byte) (n int, err error) {\n\tr.bufChannel <- p\n\treturn <-r.nChannel, <-r.errChannel\n}", "title": "" }, { "docid": "0e6cce57c6b03229c64d1598901163ad", "score": "0.66524756", "text": "func read(reader io.Reader, data interface{}) error {\n\treturn binary.Read(reader, binary.BigEndian, data)\n}", "title": "" }, { "docid": "715614e822bbc1a47b96d765999e74a2", "score": "0.6638232", "text": "func (s *Session) Read(ctx context.Context) error {\n\t// for s.ReadyRead() < s.config.SampleSize {\n\t// \tselect {\n\t// \tcase <-ctx.Done():\n\t// \t\tlog.Println(\"read timed out\")\n\t// \t\treturn ErrReadTimedOut\n\t// \tdefault:\n\t// \t}\n\t// }\n\n\terr := s.stream.Read()\n\n\t// for i, v := range s.sampleBuf {\n\t// \ts.retBufs[i%s.config.FrameSize][i/s.config.FrameSize] = float64(v)\n\t// }\n\n\tfor xBuf := range s.retBufs {\n\t\tfor xSmpl := range s.retBufs[xBuf] {\n\t\t\ts.retBufs[xBuf][xSmpl] = input.Sample(s.sampleBuf[(xSmpl*s.config.FrameSize)+xBuf])\n\t\t}\n\t}\n\n\tif err != portaudio.InputOverflowed {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2846960484be60e50edf1d21f2e44e99", "score": "0.65928435", "text": "func (k *KernelReader) Read() chan interface{} {\n\treturn k.backlog\n}", "title": "" }, { "docid": "9a116739b2ba77670c5a1d82c33ebe7d", "score": "0.65802264", "text": "func (c *connection) read(timeout time.Duration) ([]byte, error) {\n\tif !c.available() {\n\t\treturn nil, ErrCannotRead\n\t}\n\n\tvar err error\n\tvar count int\n\tvar messageLength uint32\n\tvar rt time.Duration = timeout // rt = 'read timeout'\n\tb := &backoff.Backoff{\n\t\tMin: rt,\n\t\tJitter: true,\n\t}\n\ttry := uint16(0)\n\n\tfor {\n\t\tc.setReadDeadline(rt)\n\t\tif count, err = io.ReadFull(c.conn, c.sizeBuf); err == nil && count == 4 {\n\t\t\tmessageLength = binary.BigEndian.Uint32(c.sizeBuf)\n\t\t\tif messageLength > uint32(cap(c.dataBuf)) {\n\t\t\t\tlogDebug(\"[Connection]\", \"allocating larger dataBuf of size %d\", messageLength)\n\t\t\t\tc.dataBuf = make([]byte, messageLength)\n\t\t\t} else {\n\t\t\t\tc.dataBuf = c.dataBuf[0:messageLength]\n\t\t\t}\n\t\t\t// FUTURE: large object warning / error\n\t\t\t// TODO: FUTURE this deadline should subtract the duration taken by the first\n\t\t\t// ReadFull call. Currently it's could wait up to 2X the read timout value\n\t\t\tc.setReadDeadline(rt)\n\t\t\tcount, err = io.ReadFull(c.conn, c.dataBuf)\n\t\t} else {\n\t\t\tif err == nil && count != 4 {\n\t\t\t\terr = newClientError(fmt.Sprintf(\"[Connection] expected to read 4 bytes, only read: %d\", count), nil)\n\t\t\t}\n\t\t}\n\n\t\tif err == nil && count != int(messageLength) {\n\t\t\terr = newClientError(fmt.Sprintf(\"[Connection] message length: %d, only read: %d\", messageLength, count), nil)\n\t\t}\n\n\t\tif err == nil {\n\t\t\treturn c.dataBuf, nil\n\t\t}\n\n\t\tif try < c.tempNetErrorRetries && isTemporaryNetError(err) {\n\t\t\trt = b.Duration()\n\t\t\ttry++\n\t\t\tlogDebug(\"[Connection]\", \"temporary error, re-try %v, new read timeout: %v\", try, rt)\n\t\t} else {\n\t\t\tc.setState(connInactive)\n\t\t\treturn nil, err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "23c790cbd8f1cfaf1a2734213ef937ec", "score": "0.6551555", "text": "func (p *PipeReader) Read(data []byte) (int, error) {\n\treturn p.r.Read(data)\n}", "title": "" }, { "docid": "03fe87874fd1750b5b045ef9829cb16b", "score": "0.65384126", "text": "func (b *Buffer) Read() (*types.Message, error) {\n\tif b.empty() {\n\t\t//reset to 0, as we dont allow user to read any data once above condition is true\n\t\tb.Reset()\n\t\treturn nil, io.EOF\n\t}\n\n\tdata := b.slice[b.readAt]\n\tb.readAt += 1\n\treturn data, nil\n}", "title": "" }, { "docid": "e1f57a4f60dd64585f509d9fa3203931", "score": "0.6530223", "text": "func (ch *ChannelIn) Read() (out []byte) {\n\tfor frameNr := uint64(0); ; frameNr++ {\n\t\tdata, ok := ch.inputs[frameNr]\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\t\tout = append(out, data...)\n\t}\n}", "title": "" }, { "docid": "9b16a5e40970c7f1b7d9940601bacdd6", "score": "0.6523707", "text": "func read(r io.Reader, n int, order binary.ByteOrder, data interface{}) error {\n\tbinData, err := readNextBytes(r, n)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbuffer := bytes.NewBuffer(binData)\n\n\treturn binary.Read(buffer, order, data)\n}", "title": "" }, { "docid": "22ded3486aa7bed8ec787c26af65e1a8", "score": "0.651121", "text": "func Read(connection *websocket.Conn, inputChan chan component.PlayerInput, outputChan chan interface{}) {\n\tfmt.Printf(\"Starting reader for %p\\n\", &connection)\n\n\t// Send initial message to indicate connection\n\tinputChan <- component.PlayerInput{X: 0, Y: 0, Valid: false, Clicked: false, Disconnected: false, Conn: connection, OutputChan: outputChan}\n\n\t// Read until connection is closed\n\tfor {\n\t\t_, message, err := connection.ReadMessage()\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Read connection closed for %p\\n\", &connection)\n\t\t\tconnection.Close()\n\t\t\tinputChan <- component.PlayerInput{Conn: connection, Disconnected: true, OutputChan: outputChan}\n\t\t\tbreak\n\t\t}\n\t\tfmt.Printf(\"%s\\n\", message)\n\t}\n}", "title": "" }, { "docid": "59a491ee0ac7ea81752168bf2f9cfa44", "score": "0.64900124", "text": "func (s *SyncedReadCloser) Read(p []byte) (n int, err error) {\n\t// If the data fits in the buffer blocks awaiting the sync instruction\n\tif s.p+int64(len(p)) >= s.length && s.enableBlocking {\n\t\t<-s.openGate\n\t}\n\tn = copy(p, s.data[s.p:])\n\ts.p += int64(n)\n\tif s.p == s.length {\n\t\terr = io.EOF\n\t}\n\treturn n, err\n}", "title": "" }, { "docid": "f261150a27a9f5477a500aa090c18a6e", "score": "0.6473683", "text": "func TestRead(t *testing.T) {\n\ttestCtx, testCtxCancel := context.WithCancel(context.Background())\n\tdefer testCtxCancel()\n\n\tdeadline := time.Now().Add(time.Duration(500) * time.Millisecond)\n\treadCh, _, conn := buildTestChannels(testCtx, nil)\n\tif err := expectToNotBlock(t, func() error {\n\t\treturn conn.SetReadDeadline(deadline)\n\t}); err != nil {\n\t\tt.Fatal(err.Error())\n\t}\n\n\terrCh := expectToBlock(t, func() error {\n\t\tbuf := make([]byte, 10)\n\t\t_, _, err := conn.ReadFrom(buf)\n\t\treturn err\n\t})\n\n\treadCh <- []byte{0x10}\n\tif err := <-errCh; err != nil {\n\t\tt.Fatal(err.Error())\n\t}\n}", "title": "" }, { "docid": "6dadddec6bb1d036009bc78e93d1b5e1", "score": "0.6462828", "text": "func AsyncRead(pipe io.Reader, bufSize int, stdDataChan chan StdData) {\n\tif !IsNamedPipe() {\n\t\tstdDataChan <- StdData{\n\t\t\tErr: errors.New(\"Not Valid Named Pipe\"),\n\t\t}\n\t}\n\tr := bufio.NewReader(pipe)\n\tfor {\n\t\tstdData := StdData{}\n\t\tdata, err := readChunk(r, bufSize)\n\t\tif err != nil {\n\t\t\tstdData.Err = err\n\t\t}\n\t\tstdData.Data = data\n\t\tstdDataChan <- stdData\n\t}\n}", "title": "" }, { "docid": "79672e7a366f86c00e2ffc3228294782", "score": "0.6456187", "text": "func (s *UseStorage) Read(path string) <-chan interface{} {\n\treturn s.SendMessage(s.UUID, StorageMessage{Type: StorageMessageTypeRead, Path: path})\n}", "title": "" }, { "docid": "295e0207624734dd93dfc2ee7b809edf", "score": "0.64515114", "text": "func (coll *InterleavedIOCollector) Read() {\n\tdone := make(chan bool)\n\tgo func() {\n\t\tcoll.waitgroup.Wait()\n\t\tdone <- true\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase msg := <-coll.messages:\n\t\t\tfmt.Println(msg.data)\n\t\tcase <-done:\n\t\t\tclose(coll.messages)\n\t\t\tclose(done)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "da7c4e8bb3081eb17c8b3db6dae1ea80", "score": "0.6448168", "text": "func (s *ReadWriteCloser) Read(b []byte) (int, error) {\n\tif s.cr {\n\t\treturn 0, errClosedRead\n\t}\n\treturn s.r.Read(b)\n}", "title": "" }, { "docid": "fcc5e335c9e0c32c81cdddec8a14ea73", "score": "0.6447645", "text": "func (prwc *PipeReadWriteCloser) Read(buf []byte) (int, error) {\n\treturn prwc.Input.Read(buf)\n}", "title": "" }, { "docid": "77c346257ab4e1389524df2cbc229411", "score": "0.6445023", "text": "func (rc *ReadCloser) Read(buffer []byte) (int, error) {\n\treturn rc.reader.Read(buffer)\n}", "title": "" }, { "docid": "6e7fc9aa9b7987d238267d42910ded5e", "score": "0.6442417", "text": "func (srw DialReadWriteCloser) Read(p []byte) (n int, err error) {\n\treturn srw.sr.Read(p)\n}", "title": "" }, { "docid": "b57c99444f38b99760b0edc01ec24d09", "score": "0.64380914", "text": "func (s *socket) Reader() chan interface{} {return s.reader}", "title": "" }, { "docid": "98096f14a25b62dc700ecfbe31251404", "score": "0.6433705", "text": "func (b *readBuffer) read(r io.Reader, n int) ([]byte, error) {\n\toffset := len(b.data)\n\thave := b.end - len(b.data)\n\n\t// If n bytes are available in the buffer, there is no need to read from r at all.\n\tif have >= n {\n\t\tb.data = b.data[:offset+n]\n\t\treturn b.data[offset : offset+n], nil\n\t}\n\n\t// Make buffer space available.\n\tneed := n - have\n\tb.grow(need)\n\n\t// Read.\n\trn, err := io.ReadAtLeast(r, b.data[b.end:cap(b.data)], need)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tb.end += rn\n\tb.data = b.data[:offset+n]\n\treturn b.data[offset : offset+n], nil\n}", "title": "" }, { "docid": "72641582a161daa3d9c55ef570cea272", "score": "0.64329106", "text": "func (c *streamChannel) SyncRead() ([]byte, error) {\n\tc.srMu.Lock()\n\tdefer c.srMu.Unlock()\n\n\tn, err := c.stream.Read(c.syncBuff)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.syncBuff[:n], nil\n}", "title": "" }, { "docid": "abf3c1ba39d20a3417bbda5b04bd69c9", "score": "0.640938", "text": "func readAsync(r io.Reader, p []byte) <-chan ioResult {\n\tresultCh := make(chan ioResult, 1)\n\tgo func() {\n\t\tdefer close(resultCh)\n\t\tn, err := r.Read(p)\n\t\tresultCh <- ioResult{n, err}\n\t}()\n\treturn resultCh\n}", "title": "" }, { "docid": "ac8859e0aec58e96ad6fa2427d8dda25", "score": "0.6395638", "text": "func (p *Protocol) Read(d []byte) (int, error) {\n\tp.c.SetReadDeadline(time.Now().Add(p.readDeadline))\n\treturn p.r.Read(d)\n}", "title": "" }, { "docid": "6435c7192e9d0c05d6539b7896e01504", "score": "0.63953173", "text": "func clientRead(c net.Conn, buff []byte, count *int, chDone chan bool, chErr chan error, duration time.Duration) {\n\ttick := time.NewTicker(duration)\n\n\tchBytes := make(chan []byte)\n\tchErr1 := make(chan error)\n\n\tgo handleClientRead(c, chBytes, count, chErr1)\n\tselect {\n\tcase <-tick.C:\n\t\tchDone <- true\n\t\tbreak\n\tcase buff = <-chBytes:\n\t\tbreak\n\tcase err := <-chErr1:\n\t\tchErr <- err\n\t\tbreak\n\t}\n}", "title": "" }, { "docid": "f679e63a83224852d637855a90bfbbca", "score": "0.6383307", "text": "func (p *BFSS_SNDClient) ReadData(ctx context.Context, index int32, offset int32, size int32, flag int32) (r *READ_RESULT, err error) {\n var _args6 BFSS_SNDReadDataArgs\n _args6.Index = index\n _args6.Offset = offset\n _args6.Size = size\n _args6.Flag = flag\n var _result7 BFSS_SNDReadDataResult\n if err = p.Client_().Call(ctx, \"ReadData\", &_args6, &_result7); err != nil {\n return\n }\n return _result7.GetSuccess(), nil\n}", "title": "" }, { "docid": "ebb5616c59847ef95b97b163fee4542d", "score": "0.6382813", "text": "func (r *cachingReadCloser) Read(p []byte) (n int, err error) {\n\tn, err = r.R.Read(p)\n\tr.buf.Write(p[:n])\n\tif err == io.EOF {\n\t\tr.OnEOF(bytes.NewReader(r.buf.Bytes()))\n\t}\n\treturn n, err\n}", "title": "" }, { "docid": "9e849a45760bc839ee1552923d893136", "score": "0.6382075", "text": "func (ish *OutputSocketHandler) Read(sender *OutputSocket) Sample {\n\tindex := ish.indexes[sender]\n\tif ish.read[index] {\n\t\tfor i, s := range ish.provider.Read() {\n\t\t\tish.buffer[i] = s\n\t\t\tish.read[i] = false\n\t\t}\n\t}\n\n\tish.read[index] = true\n\treturn ish.buffer[index]\n}", "title": "" }, { "docid": "6bcf71231760db4faeaa0668e17d17b0", "score": "0.63752073", "text": "func (c *Client) read() {\n\tfor {\n\t\tc.mtx.RLock()\n\t\tid := c.id\n\t\tc.mtx.RUnlock()\n\n\t\terr := c.conn.SetDeadline(time.Now().Add(c.cfg.ClientTimeout))\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"%s: unable to set deadline: %v\", id, err)\n\t\t\tc.cancel()\n\t\t\treturn\n\t\t}\n\t\tdata, err := c.reader.ReadBytes('\\n')\n\t\tif err != nil {\n\t\t\tif errors.Is(err, io.EOF) {\n\t\t\t\tlog.Errorf(\"%s: EOF\", id)\n\t\t\t\tc.cancel()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tvar nErr *net.OpError\n\t\t\tif !errors.As(err, &nErr) {\n\t\t\t\tlog.Errorf(\"%s: unable to read bytes: %v\", id, err)\n\t\t\t\tc.cancel()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif nErr.Op == \"read\" && nErr.Net == \"tcp\" {\n\t\t\t\tswitch {\n\t\t\t\tcase nErr.Timeout():\n\t\t\t\t\tlog.Errorf(\"%s: read timeout: %v\", id, err)\n\t\t\t\tcase !nErr.Timeout():\n\t\t\t\t\tlog.Errorf(\"%s: read error: %v\", id, err)\n\t\t\t\t}\n\t\t\t\tc.cancel()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Errorf(\"unable to read bytes: %v %T\", err, err)\n\t\t\tc.cancel()\n\t\t\treturn\n\t\t}\n\t\tmsg, reqType, err := IdentifyMessage(data)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"unable to identify message %q: %v\", data, err)\n\t\t\tc.cancel()\n\t\t\treturn\n\t\t}\n\t\tc.readCh <- readPayload{msg, reqType}\n\t}\n}", "title": "" }, { "docid": "3019c85eb02b500a7fb2cd00a6704899", "score": "0.6370475", "text": "func Read(r []byte, order binary.ByteOrder, data interface{}) error {\n\t// Fallback to reflect-based decoding.\n\tv := reflect.ValueOf(data)\n\tswitch v.Kind() {\n\tcase reflect.Ptr:\n\t\tv = v.Elem()\n\t}\n\td := &decoder{order: order, buf: r}\n\td.value(v)\n\treturn nil\n}", "title": "" }, { "docid": "5eee4d1b2fe30302613ffc413aa3c53b", "score": "0.636782", "text": "func (b *Reader) Read(p []byte) (n int, e error) {\n n = len(p)\n\n if n == 0 {\n return 0, nil\n }\n\n if b.w == b.r {\n // read request is larger then current window size\n if n >= len(b.buf) {\n log.Println(\"Read directly from IO\")\n return b.rd.Read(p)\n }\n\n if e = b.fill(); e != nil {\n return 0, e\n }\n }\n\n // drain buffer\n if n > b.w-b.r {\n n = b.w - b.r\n }\n\n copy(p[0:n], b.buf[b.r:])\n b.r += n\n return n, nil\n}", "title": "" }, { "docid": "10da9ac485ea505cf9b977b939f83b27", "score": "0.63670844", "text": "func (m *messageReader) Read(p []byte) (int, error) {\n\treturn m.data.Read(p)\n}", "title": "" }, { "docid": "d78f2066d30a82ad1aae9681039132e1", "score": "0.635733", "text": "func (dec *Decoder) Read(data []byte) (n int, err error) {\n\tif dec.closed {\n\t\treturn 0, io.EOF\n\t}\n\tdec.lockData.Lock()\n\tdefer dec.lockData.Unlock()\n\tif len(dec.decodedData) == 0 {\n\t\treturn\n\t}\n\tn = copy(data, dec.decodedData[:])\n\tdec.decodedData = dec.decodedData[n:]\n\treturn\n}", "title": "" }, { "docid": "6841152de247af046d51b6e85243ea37", "score": "0.63534886", "text": "func (dec *Decoder) Read(data []byte) (n int, err error) {\n\tfor {\n\t\tselect {\n\t\tcase <-dec.context.Done(): // if the decoder is stopped, then here should return EOF\n\t\t\terr = io.EOF\n\t\t\treturn\n\t\tdefault:\n\t\t}\n\t\tif len(dec.data) == 0 && len(dec.decodedData) == 0 && dec.originalEof {\n\t\t\terr = io.EOF\n\t\t\treturn\n\t\t} else if len(dec.decodedData) > 0 {\n\t\t\tbreak\n\t\t}\n\t\t<-time.After(WaitForDataDuration)\n\t}\n\tdec.decoderLocker.Lock()\n\tdefer dec.decoderLocker.Unlock()\n\tn = copy(data, dec.decodedData[:])\n\tdec.decodedData = dec.decodedData[n:]\n\treturn\n}", "title": "" }, { "docid": "459518241c015f7a683d169f0b2a9418", "score": "0.63500994", "text": "func (c *Client) Read(ch chan []byte, errors chan error) error {\n\tif c.connection == nil {\n\t\treturn ErrNotConnected\n\t}\n\n\t// Make a byte slice to read data into.\n\tbuf := make([]byte, 1024)\n\n\tgo func(ch chan []byte, errs chan error) {\n\t\tfor {\n\t\t\t// Read the amount of bytes into the buf.\n\t\t\tbytes, err := c.connection.Read(buf)\n\t\t\tif err != nil {\n\t\t\t\terrs <- err\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Only send the newly written bytes to the channel.\n\t\t\tch <- buf[:bytes]\n\t\t}\n\t}(ch, errors)\n\n\treturn nil\n}", "title": "" }, { "docid": "eccfa4db8948f2759dcf18b0e7e020a2", "score": "0.63499475", "text": "func (r *cachingReadCloser) Read(p []byte) (n int, err error) {\n\tn, err = r.R.Read(p)\n\tr.buf.Write(p[:n])\n\tif err == io.EOF || n < len(p) {\n\t\tr.OnEOF(bytes.NewReader(r.buf.Bytes()))\n\t}\n\treturn n, err\n}", "title": "" }, { "docid": "3973765d5d7034bf3fe6d2a9bad0e0be", "score": "0.6343194", "text": "func read(r io.Reader, msg *Message) error {\n\t// read data length\n\tvar length int64\n\terr := binary.Read(r, binary.BigEndian, &length)\n\t// check tcp error\n\tif /*err = tcpErrorCheck(err);*/err != nil {\n\t\treturn err\n\t}\n\n\tif length < 0 {\n\t\treturn fmt.Errorf(\"read error, data length < 0, length=%d\", length)\n\t}\n\tif length > maxMessageLength {\n\t\treturn errDataLenOvertakeMaxLen\n\t}\n\n\t// rend data\n\tbuffer := make([]byte, length)\n\tn, err := io.ReadFull(r, buffer)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"read error=%s\", err.Error())\n\t}\n\tif int64(n) != length {\n\t\treturn fmt.Errorf(\"read error\")\n\t}\n\n\t// decode data\n\treturn decode(buffer, msg)\n}", "title": "" }, { "docid": "a002d26e2264754d70b78be388ff7e17", "score": "0.6337873", "text": "func (c *NetClient) readData(respHandler func(data []byte, err error, done func())) {\n\tif c.conn == nil {\n\t\trespHandler(make([]byte, 0), fmt.Errorf(\"no network connection to read\"), func() {})\n\t\treturn\n\t}\n\tif c.MaxReadBytes < 0 {\n\t\trespHandler(make([]byte, 0), fmt.Errorf(\"max read bytes can not be negative\"), func() {})\n\t\treturn\n\t}\n\tvar quit = make(chan struct{})\n\tvar buf = make([]byte, c.MaxReadBytes)\n\tfor {\n\t\tselect {\n\t\tcase <-quit:\n\t\t\treturn\n\t\tdefault:\n\t\t\tn, err := c.conn.Read(buf)\n\t\t\trespHandler(buf[:n], err, func() {\n\t\t\t\tclose(quit)\n\t\t\t})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ea0f777c599daf25a8e5e8580e096d3b", "score": "0.6328029", "text": "func (c *Client) listenRead() {\n\tlog.Println(\"Listening read from client\")\n\tfor {\n\t\tselect {\n\n\t\t// receive done request\n\t\tcase <-c.doneCh:\n\t\t\tc.server.Del(c)\n\t\t\tc.doneCh <- true // for listenWrite method\n\t\t\treturn\n\n\t\t// read data from net connection\n\t\tdefault:\n\t\t\tb := make([]byte, 10)\n\t\t\tlength, err := c.conn.Read(b)\n\t\t\tif err == io.EOF {\n\t\t\t\tc.doneCh <- true\n\t\t\t\tc.manager.Handler.OnDisconnected(c.id)\n\t\t\t} else if err != nil {\n\t\t\t\tc.server.Err(err)\n\t\t\t} else {\n\t\t\t\t//log.Printf(\"Client(%d) recv raw: % x\\n\", c.id, b)\n\t\t\t\tc.buf.Write(b[0:length])\n\n\t\t\t\tpayload := &Payload{}\n\t\t\t\terr, more, left := payload.Decode(c.buf.Bytes())\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"Client(%d) payload.Decode err: %s\", c.id, err.Error())\n\t\t\t\t\tc.doneCh <- true\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif more {\n\t\t\t\t\tcontinue\n\t\t\t\t} else {\n\t\t\t\t\tc.buf.Reset()\n\t\t\t\t\tif len(left) > 0 {\n\t\t\t\t\t\tc.buf.Write(left)\n\t\t\t\t\t}\n\n\t\t\t\t\tc.manager.Handler.OnRecievePayload(c.id, payload)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "234d9a14e44bdd8d6ab0846cba625414", "score": "0.6327494", "text": "func (c *Conn) Read(b []byte) (int, error) { return c.fd.Read(b) }", "title": "" }, { "docid": "c0aa184e3f46c6368dbb9a4488aa280a", "score": "0.6325363", "text": "func (s *Stream) Read() chan ReceiveMessage {\n\treturn s.readBuff\n}", "title": "" }, { "docid": "40d5048f307e48e28e118aeaba8e1d3f", "score": "0.63231784", "text": "func (_Lighthouse *LighthouseCaller) Read(opts *bind.CallOpts) ([32]byte, error) {\n\tvar (\n\t\tret0 = new([32]byte)\n\t)\n\tout := ret0\n\terr := _Lighthouse.contract.Call(opts, out, \"read\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "3b546309688444ff7561411cd27371a7", "score": "0.6321187", "text": "func (tl *TraceLog) read() (byte, error) {\n\tvar res byte\n\tlimit := time.Duration(tl.cfg.TraceLog.Serial.ReadWriteTimeout) * time.Second\n\n\tc1 := make(chan byte, 1)\n\tgo func() {\n\t\tb := make([]byte, 1)\n\t\tif tl.cfg.TraceLog.Serial.Type == \"tty\" {\n\t\t\tn, err := tl.serialConn.Read(b)\n\t\t\tif err == nil && n == 1 {\n\t\t\t\tc1 <- b[0]\n\t\t\t}\n\t\t} else {\n\t\t\tn, err := tl.fifoFile2.Read(b)\n\t\t\tif err == nil && n > 0 {\n\t\t\t\tc1 <- b[0]\n\t\t\t}\n\t\t}\n\t}()\n\n\tselect {\n\tcase res = <-c1:\n\t\t{\n\t\t\treturn res, nil\n\t\t}\n\tcase <-time.After(limit):\n\t\t{\n\t\t}\n\t}\n\n\treturn 0, fmt.Errorf(\"Timeout waiting for serial char\")\n}", "title": "" }, { "docid": "055d5cf00dcb815eadd4eafc9dc3b8c5", "score": "0.6317641", "text": "func (prt pipeReaderTimeout) Read(data []byte) (int, error) {\n\ttype result struct {\n\t\tn int\n\t\terr error\n\t}\n\tresultCh := make(chan result, 1)\n\n\tgo func() {\n\t\tn, err := prt.PipeReader.Read(data)\n\t\tresultCh <- result{\n\t\t\tn: n,\n\t\t\terr: err,\n\t\t}\n\t}()\n\tselect {\n\tcase <-time.After(readTimeout):\n\t\treturn 0, io.EOF\n\tcase res := <-resultCh:\n\t\treturn res.n, res.err\n\t}\n}", "title": "" }, { "docid": "421dafa7f74a9a4148f70f3ded1c250f", "score": "0.6316271", "text": "func (sr SecureReader) Read(data []byte) (n int, err error) {\n\n\t// If the last call to Read didn't get the whole message, return\n\t// the part remaining. We can ignore the error since it will only be EOF\n\tif r, _ := sr.remainingData.Read(data); r > 0 {\n\t\treturn r, nil\n\t}\n\n\tvar boxedLen int64\n\tvar nonce [24]byte\n\n\terr = readBinaryData(sr.r, &nonce, err)\n\terr = readBinaryData(sr.r, &boxedLen, err)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tboxed := make([]byte, boxedLen)\n\n\terr = readBinaryData(sr.r, &boxed, err)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tvar out []byte\n\tout, isOk := box.Open(out, boxed, &nonce, sr.peerPub, sr.priv)\n\tif !isOk {\n\t\treturn 0, errors.New(\"Couldn't decode input data\")\n\t}\n\n\t// The tricky part: The caller want to read a 5 byte message, but we receive\n\t// a 200 byte message. The bytes that does not fit in data are saved in\n\t// the Buffer remainingData, and will be returned on a later call to Read\n\t// a new unit test has been created to check this behaviour: TestSmallReadPing\n\tcopied := copy(data, out)\n\tif copied < len(out) {\n\t\t_, err := sr.remainingData.Write(out[copied:])\n\t\tif err != nil {\n\t\t\treturn copied, err\n\t\t}\n\t}\n\n\treturn copied, nil\n}", "title": "" }, { "docid": "19c837e21b5238d9e11e7076fe579058", "score": "0.6315949", "text": "func read(r io.Reader) <-chan message {\n\tlines := make(chan message)\n\tgo func() {\n\t\tdefer close(lines)\n\t\tscan := bufio.NewScanner(r)\n\t\tfor scan.Scan() {\n\t\t\tlines <- message(scan.Bytes())\n\t\t}\n\t}()\n\treturn lines\n}", "title": "" }, { "docid": "a9e546b3650b74eee5ec44fd911df36c", "score": "0.6306106", "text": "func (c *conn) Read(b []byte) (int, error) {}", "title": "" }, { "docid": "c7d2bd28a31af155b0eff146b7483822", "score": "0.6303026", "text": "func (s *Conn) readData(n int) (string, error) {\n\ts.readLock.Lock()\n\tdefer s.readLock.Unlock()\n\tvar err error\n\n\t// clear past data results, then try to read data and otherwise wait.\n\tselect {\n\tcase err = <-s.ioResult:\n\tdefault:\n\t}\n\tb64Data, err := socketCallString(\"receive\", s.socketId, n)\n\tif err == nil && b64Data == \"\" {\n\t\t// no data available, block until there is data\n\t\tselect {\n\t\tcase err = <-s.ioResult:\n\t\t\tif err != io.EOF {\n\t\t\t\tb64Data, err = socketCallString(\"receive\", s.socketId, n)\n\t\t\t}\n\n\t\tcase <-s.readTimeout():\n\t\t\terr = errors.New(\"read timed out\")\n\t\t}\n\t}\n\t// could happen if read was attempted after EOF\n\tif err != nil && err.Error() == \"Error: socket is closed\" {\n\t\terr = io.EOF\n\t}\n\treturn b64Data, err\n}", "title": "" }, { "docid": "5f65dec4574e3b670bf67e7a2a9b5891", "score": "0.6302259", "text": "func (c *Client) Read(cb DataCallback) {\n\tswitch c.protocol {\n\tcase Websocket:\n\t\tfor {\n\t\t\tdata := &model.Message{}\n\t\t\terr := c.socket.ReadJSON(data)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcb(data)\n\t\t}\n\n\tcase GRPC:\n\t\tfor {\n\t\t\tin, err := c.stream.Recv()\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\tvar data map[string]interface{}\n\t\t\tdata[\"Token\"] = in.Token\n\t\t\tdata[\"DBType\"] = in.DbType\n\t\t\tdata[\"Project\"] = in.Project\n\t\t\tdata[\"Group\"] = in.Group\n\t\t\tdata[\"Type\"] = in.Type\n\t\t\tdata[\"ID\"] = in.Id\n\t\t\tvar temp interface{}\n\t\t\terr = json.Unmarshal(in.Where, &temp)\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\tdata[\"Where\"] = temp\n\n\t\t\tmsg := &model.Message{Type: in.Type, ID: in.Id, Data: data}\n\t\t\tcb(msg)\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "56702f07b4d2b50e529d164760595d8c", "score": "0.62833756", "text": "func PipeReaderRead(r *io.PipeReader, data []byte) (int, error)", "title": "" }, { "docid": "32756f37ffe63d4041568fbf4094376a", "score": "0.6281162", "text": "func (ochan *objectIDBufferedChan) read() {\n\tdefer close(ochan.send)\n\n\tfor file := range ochan.files {\n\t\terr := ochan.readFile(file)\n\t\tif err != nil {\n\t\t\tochan.errors <- err\n\t\t\t// Since we encountered an error we should stop.\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c2aaad0d60650b8e0aa317c2824c15b0", "score": "0.6280143", "text": "func (r *TimeoutReader) Read(p []byte) (n int, err error) {\n\tch := make(chan readResult, 1)\n\tgo func() {\n\t\tpp := make([]byte, len(p))\n\t\t_, err := r.r.Read(pp)\n\t\tch <- readResult{pp, err}\n\t}()\n\tselect {\n\tcase <-time.After(r.timeout):\n\t\treturn 0, ErrTimeout\n\tcase res := <-ch:\n\t\tcopy(p, res.b)\n\t\treturn len(res.b), res.err\n\t}\n}", "title": "" }, { "docid": "3999b4c6fe847034e8f5bef3bb9f0e07", "score": "0.62775177", "text": "func (ws *WebSocket) ReadChannel() <-chan interface{} {\n\treturn ws.in\n}", "title": "" }, { "docid": "40f970d1183b7e44fb78b7676b2d016f", "score": "0.6271823", "text": "func (asRd *AsyncReader) Read() (interface{}, error) {\n\tobjErrTup := <-asRd.rowCh\n\n\tif objErrTup.obj == nil && objErrTup.err == nil {\n\t\treturn nil, io.EOF\n\t}\n\n\treturn objErrTup.obj, objErrTup.err\n}", "title": "" }, { "docid": "ead976f88fec7e1b12505965d471e4b4", "score": "0.6271382", "text": "func (h *BufferedWR) Read(p []byte) (int, error) {\n\t// wait to make sure there is data in buffer\n\tif h.buffer.Len() == 0 {\n\t\tselect {\n\t\tcase _, ok := <-h.update: // data received from client\n\t\t\tif !ok {\n\t\t\t\treturn 0, io.EOF\n\t\t\t}\n\t\t}\n\t}\n\n\th.mu.Lock()\n\tdefer h.mu.Unlock()\n\tif h.done {\n\t\treturn 0, io.EOF\n\t}\n\treturn h.buffer.Read(p)\n}", "title": "" }, { "docid": "1c7c17e70e6db0ee20f9189a6a8627ac", "score": "0.62695324", "text": "func (c *GryffClient) Read(key int64) (bool, int64) {\n opId := c.opCount\n c.opCount++\n doneChan := make(chan bool, 1)\n c.mtx.Lock()\n c.doneChans[opId] = doneChan\n c.mtx.Unlock()\n\n dlog.Printf(\"Starting Read(%d).\\n\", opId)\n\n if c.proxy {\n c.sendReadToNearest(opId, state.Key(key))\n } else {\n c.coord.StartRead(opId, c.id, state.Key(key), c.dep)\n }\n\n <-doneChan\n if c.sequential {\n c.dep = &gryffproto.Dep{state.Key(key),\n gryffproto.ValTag{state.Value(c.readValue), *c.readTag}}\n }\n dlog.Printf(\"Finished Read(%d).\\n\", opId)\n return c.success, c.readValue\n}", "title": "" }, { "docid": "6cca9031285729fa13668a29ee6a00e3", "score": "0.626873", "text": "func (d *Driver) Read(p []byte) (n int, err error) {\n\tif len(p) == 0 {\n\t\treturn 0, nil\n\t}\n\tnextw := d.waitRxData()\n\tnextr := int(d.nextr)\n\tif nextw == nextr {\n\t\treturn 0, ErrTimeout\n\t}\n\tif nextr <= nextw {\n\t\tn = copy(p, d.rxbuf[nextr:nextw])\n\t} else {\n\t\tn = copy(p, d.rxbuf[nextr:])\n\t\tif n < len(p) {\n\t\t\tn += copy(p[n:], d.rxbuf[:nextw])\n\t\t}\n\t}\n\treturn n, d.markDataRead(nextr + n)\n}", "title": "" }, { "docid": "d1322b47505858f042e5c730b090cc5c", "score": "0.6268417", "text": "func (c *Client) Read() {\n\t//for {\n\t//\tdata, err := receiveData(c.in, 4096)\n\t//\tif err != nil { // Client has disconnected\n\t//\t\tdebug(\"Client \" + strconv.Itoa(int(c.ID)) + \" disconnected\")\n\t//\t\tbreak\n\t//\t}\n\t//\n\t//\t// TODO save data to file\n\t//}\n\n\tfile, err := os.Create(dir + \"/\" + strconv.Itoa(int(c.ID)) + \".file\")\n\tcheckError(err)\n\tdefer file.Close()\n\n\tn, err := io.Copy(file, c.conn)\n\tif err != nil {\n\t\tif err.Error() == \"Client inactive for 10s\" {\n\t\t\tc.conn.Close()\n\t\t}\n\t}\n\n\tdebug(\"Received \" + strconv.Itoa(int(n)) + \" bytes from client \" + strconv.Itoa(int(c.ID)))\n\n\t//c.in = nil // Closing network stream\n}", "title": "" }, { "docid": "dceaceaeca7b9d8307ca2d8243de42c2", "score": "0.6266659", "text": "func (s *Socket) ReadData(timeout time.Duration) ([]byte, neffos.MessageType, error) {\n\tfor {\n\t\tif timeout > 0 {\n\t\t\ts.UnderlyingConn.SetReadDeadline(time.Now().Add(timeout))\n\t\t}\n\n\t\topCode, data, err := s.UnderlyingConn.ReadMessage()\n\t\tif err != nil {\n\t\t\treturn nil, 0, err\n\t\t}\n\n\t\tif opCode != gorilla.BinaryMessage && opCode != gorilla.TextMessage {\n\t\t\t// if gorilla.IsUnexpectedCloseError(err, gorilla.CloseGoingAway) ...\n\t\t\tcontinue\n\t\t}\n\n\t\treturn data, neffos.MessageType(opCode), err\n\t}\n}", "title": "" }, { "docid": "045b7ba3464e2c5540ac8d2e08eef3a0", "score": "0.6262681", "text": "func (c *Client) read() {\n\tdefer func() {\n\t\tc.hub.unregister <- c\n\t\tc.conn.Close()\n\t}()\n\n\tc.conn.SetReadLimit(maxMessageSize)\n\tc.conn.SetReadDeadline(time.Now().Add(pongWait))\n\tc.conn.SetPongHandler(func(string) error {\n\t\tc.conn.SetReadDeadline(time.Now().Add(pongWait))\n\t\treturn nil\n\t})\n\n\tfor {\n\t\tvar msg Message\n\t\terr := c.conn.ReadJSON(&msg)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error: %v\", err)\n\t\t\tbreak\n\t\t}\n\t\tmsg.UserID = c.user.UserID\n\t\tmsg.UserName = c.user.Name\n\n\t\tswitch (msg.Type) {\n\t\t\tcase \"message\":\n\t\t\t\tmsg.UserAvatar = c.user.AvatarURL\n\t\t\t\tmsg.Date = time.Now().UTC()\n\n\t\t\t\tc.hub.broadcast <- msg\n\n\t\t\tcase \"request\":\n\t\t\t\tmsg.Client = c\n\t\t\t\tc.hub.request <- msg\n\n\t\t\tdefault:\n\t\t\t\tlog.Printf(\"Error: unrecognised message %v\", msg)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e893d5eacc9c06ed24a6fda32178063b", "score": "0.6258233", "text": "func (c *Conn) Read(retBuf []byte) (int, error) {\n\tdebug.Println(\"Read called retlen:\", len(retBuf))\n\t//nextZero := []byte{}\n\tif c.readNextChunk != nil && len(c.readNextChunk) > 0 {\n\n\t\tdebug.Println(\"Read called readNextChunk != nil:\", len(retBuf))\n\t\t// if the return buffer is too small for the data,\n\t\t// snip it up and put the rest in the next chunk\n\t\tif len(c.readNextChunk) > len(retBuf) {\n\t\t\tdebug.Println(\"Read called len(c.readNextChunk) > len(retBuf)\", len(retBuf))\n\t\t\tcopy(retBuf, c.readNextChunk[:len(retBuf)])\n\n\t\t\tc.readNextChunk = c.readNextChunk[len(retBuf):]\n\n\t\t\tmet.BytesRead.Add(float64(len(retBuf)))\n\t\t\treturn len(retBuf), nil\n\n\t\t}\n\n\t\tdebug.Println(\"Read called else len(c.readNextChunk) > len(retBuf)\", len(retBuf), len(c.readNextChunk))\n\t\t// otherwise just copy the data to the return\n\t\tcopy(retBuf, c.readNextChunk)\n\t\tbytesWrittern := len(c.readNextChunk)\n\t\tc.readNextChunk = []byte{}\n\t\tmet.BytesRead.Add(float64(bytesWrittern))\n\t\treturn bytesWrittern, nil\n\n\t}\n\tc.reader.Timeout()\n\n\tdebug.Println(\"Read called reading:\", len(retBuf))\n\tselect {\n\tcase buff, ok := <-c.in:\n\n\t\tdebug.Println(\"Read called read status, len:\", ok, len(buff))\n\t\tif !ok {\n\t\t\tdebug.Println(\"Read called not ok:\", len(buff))\n\t\t\tc.reader.Finish()\n\t\t\treturn 0, os.ErrClosed\n\n\t\t}\n\n\t\t// if the return buffer is too small for the data,\n\t\t// snip it up and put the rest in the next chunk\n\t\tif len(buff) > len(retBuf) {\n\t\t\tdebug.Println(\"Read called read1:\", len(retBuf))\n\t\t\tcopy(retBuf, buff[:len(retBuf)])\n\t\t\tc.readNextChunk = buff[len(retBuf):]\n\t\t\tc.reader.Finish()\n\n\t\t\tmet.BytesRead.Add(float64(len(retBuf)))\n\t\t\treturn len(retBuf), nil\n\n\t\t}\n\n\t\t// otherwise just copy the data to the return\n\t\tdebug.Println(\"Read called read2:\", len(retBuf))\n\t\tcopy(retBuf, buff)\n\t\tc.reader.Finish()\n\t\tmet.BytesRead.Add(float64(len(buff)))\n\t\treturn len(buff), nil\n\n\tcase <-c.reader.SigTimout:\n\n\t\tdebug.Println(\"Read timeout\")\n\t\tc.reader.Finish()\n\t\treturn 0, os.ErrDeadlineExceeded\n\t}\n}", "title": "" }, { "docid": "3dc49dd1782dae3f3026ea9afcce1e64", "score": "0.6247813", "text": "func (r reader) Read(samples sdr.Samples) (int, error) {\n\treturn r.r.Read(samples)\n}", "title": "" }, { "docid": "53e955ee0976bfef2fee17ade659730b", "score": "0.62476236", "text": "func (c *Connection) readData() error {\n\tvar err error\n\tvar line []byte\n\tvar start time.Time\n\n\tif c.conf.GZip == true {\n\t\tz, err := gzip.NewReader(c.reader)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer z.Close()\n\t\tc.reader = bufio.NewReader(z)\n\t}\n\n\tstart = time.Now()\n\tfor err == nil {\n\t\tline, _, err = c.reader.ReadLine()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfmt.Println(string(line))\n\t\tif c.conf.TTL > 0 {\n\t\t\tif time.Now().Sub(start).Nanoseconds() > c.conf.TTL {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "7057d2190596c25e044ddf70299215b4", "score": "0.6246253", "text": "func (c *stdConn) Read() []byte {\n\tif c.inboundBuffer.IsEmpty() {\n\t\tif c.buffer.Len() == 0 {\n\t\t\treturn nil\n\t\t}\n\t\treturn c.buffer.Bytes()\n\t}\n\tc.byteBuffer = c.inboundBuffer.WithByteBuffer(c.buffer.Bytes())\n\treturn c.byteBuffer.Bytes()\n}", "title": "" }, { "docid": "008e5c4e1af9c239b32fb3e0f919ea61", "score": "0.62386525", "text": "func (erw *EmulatorReadWriteCloser) Read(p []byte) (int, error) {\n\t// Read is always the second operation in a Write/Read sequence.\n\tif erw.conn == nil {\n\t\treturn 0, fmt.Errorf(\"must call Write then Read in an alternating sequence\")\n\t}\n\tn, err := erw.conn.Read(p)\n\terw.conn.Close()\n\terw.conn = nil\n\treturn n, err\n}", "title": "" }, { "docid": "f6694588485e92370da77ba51e67b586", "score": "0.62381685", "text": "func (c *websocketConnector) Read(p []byte) (int, error) {\n\tc.rio.Lock()\n\tdefer c.rio.Unlock()\n\tfor {\n\t\tif c.r == nil {\n\t\t\t// Advance to next message.\n\t\t\tvar err error\n\t\t\t_, c.r, err = c.NextReader()\n\t\t\tif err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t\tn, err := c.r.Read(p)\n\t\tif err == io.EOF {\n\t\t\t// At end of message.\n\t\t\tc.r = nil\n\t\t\tif n > 0 {\n\t\t\t\treturn n, nil\n\t\t\t}\n\t\t\t// No data read, continue to next message.\n\t\t\tcontinue\n\t\t}\n\t\treturn n, err\n\t}\n}", "title": "" }, { "docid": "c5cf8d3a6ec35933d9adaa8ee30d0c7e", "score": "0.6235961", "text": "func (t *TCPClient) Read() ([]byte, error) {\n\tif t.Conn == nil {\n\t\treturn nil, ErrClosedConnection\n\t}\n\n\tt.Conn.SetReadDeadline(time.Now().Add(7 * time.Second))\n\n\tblock := make([]byte, 6085)\n\n\tn, err := t.reader.Read(block)\n\tif err != nil {\n\t\tt.Conn.SetReadDeadline(time.Time{})\n\t\treturn nil, err\n\t}\n\n\tt.Conn.SetReadDeadline(time.Time{})\n\n\treturn block[:n], nil\n}", "title": "" }, { "docid": "3ecf5261b59a0a21f9858c849d0b480b", "score": "0.62335825", "text": "func (c *client) read() {\n\n\t// Ensure the resource is closed by deferring a call to `Close()`\n\tdefer c.socket.Close()\n\n\t//Continuously read messages for the life of the function. If an error is encountered, break from the function\n\tfor {\n\t\t_, msg, err := c.socket.ReadMessage()\n\t\tif err != nil {\n\n\t\t\treturn\n\t\t}\n\t\tc.room.forward <- msg\n\t}\n}", "title": "" }, { "docid": "2e4787bb0ebef81a19a6709ee9fe7aa8", "score": "0.62325865", "text": "func (r *pipe) Read(p []byte) (n int, err error) {\n\tr.c.L.Lock()\n\tdefer r.c.L.Unlock()\n\tfor r.b.Len() == 0 && !r.b.closed {\n\t\tr.c.Wait()\n\t}\n\treturn r.b.Read(p)\n}", "title": "" }, { "docid": "2793b0aa29142b363bc92128928b2ad4", "score": "0.62293494", "text": "func (rd *Reader) Read() ([]byte, error) {\n\tvar dlen, xx32 uint32\n\tbuf := make([]byte, 4)\n\n\t// read 4 bytes length\n\tfor cnt := 0; cnt < 4; {\n\t\trx, err := rd.rd.Read(buf[cnt:])\n\t\tif err == io.EOF {\n\t\t\toffset, _ := rd.fp.Seek(0, os.SEEK_CUR)\n\t\t\t//TODO test this reader changing slab file code, seems brittle\n\t\t\t// issues with reader outpacing writer?? file locks? ugh?\n\t\t\trd.base += uint64(offset)\n\t\t\terr := rd.Seek(rd.topic, rd.base)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tcontinue\n\t\t} else if err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcnt += rx\n\t}\n\tdlen = binary.LittleEndian.Uint32(buf)\n\n\t// read 4 bytes crc\n\tfor cnt := 0; cnt < 4; {\n\t\trx, err := rd.rd.Read(buf[cnt:])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcnt += rx\n\t}\n\txx32 = binary.LittleEndian.Uint32(buf)\n\n\t// read data payload\n\tbuf = make([]byte, dlen)\n\tfor cnt := 0; uint32(cnt) < dlen; {\n\t\trx, err := rd.rd.Read(buf[cnt:])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcnt += rx\n\t}\n\n\t// check crc\n\tif xx32 != xxhash.Checksum32(buf) {\n\t\treturn buf, ErrBadChecksum\n\t}\n\n\treturn buf, nil\n}", "title": "" }, { "docid": "9ce801502e72c2ee2871c5888ec35c0e", "score": "0.6229007", "text": "func (rws *ReadWriteSeeker) Read(b []byte) (n int, err error) {\r\n\tif rws.pos >= len(rws.buf) {\r\n\t\treturn 0, io.EOF\r\n\t}\r\n\tn = copy(b, rws.buf[rws.pos:])\r\n\trws.pos += n\r\n\treturn\r\n}", "title": "" }, { "docid": "97be4706d273cbaed676f468437e0fe4", "score": "0.6226177", "text": "func (i *in) read(cb func([]byte, int64)) error {\n\tevents, err := i.stream.Read(i.driver.buffersizeRead)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, ev := range events {\n\t\tvar b = make([]byte, 3)\n\t\tb[0] = byte(ev.Status)\n\t\tb[1] = byte(ev.Data1)\n\t\tb[2] = byte(ev.Data2)\n\t\t// ev.Timestamp is in Milliseconds\n\t\t// we want deltaMicroseconds as int64\n\t\tcb(b, int64(ev.Timestamp-i.lastTimestamp)*1000)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "27a74743bfe2574284371599518af7e4", "score": "0.62228703", "text": "func (c *Connection) read() ([]byte, error) {\n\tif c.conn == nil {\n\t\treturn nil, errors.New(\"connection is nil\")\n\t}\n\n\tbuf := make([]byte, 1024)\n\tconn := c.conn\n\t_, err := conn.Read(buf)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, err\n\t}\n\treturn buf, nil\n}", "title": "" }, { "docid": "abb0c369a76fdcd7fbbb45105fadb35e", "score": "0.6222474", "text": "func (c *Client) ReadData() {\n\t// When the client dead.\n\tdefer func() {\n\t\tc.Hub.UnregistreChannel <- c\n\t\tc.Connection.Close()\n\t}()\n\t// Keep alive the connection.\n\tfor {\n\t\t// Wait for a message.\n\t\t_, messageBuffer, err := c.Connection.ReadMessage()\n\t\t// The connection has a problem.\n\t\t// It has to stop the connection.\n\t\tif err != nil { break }\n\n\t\tnewJob := Job {\n\t\t\tData:\tmessageBuffer,\n\t\t\tClient:\tc,\n\t\t}\n\n\t\tc.JobQueue <- newJob\n\t}\n}", "title": "" }, { "docid": "acb8414690404dc04c8acee20f28c792", "score": "0.622245", "text": "func (h *gqlWSConnectionHandler) readBlocking(ctx context.Context, dataCh chan []byte, errCh chan error) {\n\tfor {\n\t\tmsgType, data, err := h.conn.Read(ctx)\n\t\tif ctx.Err() != nil {\n\t\t\terrCh <- ctx.Err()\n\t\t\treturn\n\t\t}\n\t\tif err != nil {\n\t\t\terrCh <- err\n\t\t\treturn\n\t\t}\n\t\tif msgType != nhooyrwebsocket.MessageText {\n\t\t\tcontinue\n\t\t}\n\t\tselect {\n\t\tcase dataCh <- data:\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "58c16aa1e7f6f676b452a68e34b417ea", "score": "0.62200916", "text": "func (r *countingReadCloser) Read(p []byte) (int, error) {\n\tn, err := r.rc.Read(p)\n\tr.reqReporter.incByteRead(uint64(n))\n\treturn n, err\n}", "title": "" }, { "docid": "b3fa1a3492ec08c6b5f1f284d8ae3fcd", "score": "0.62181395", "text": "func (r *readSeeker) Read(p []byte) (int, error.Error) {\n\tr.Lock()\n\tdefer r.Unlock()\n\n\t// Let the cloner know how much we intend to read.\n\tr.buf = p\n\n\t// Noify the cloner.\n\tr.readCh <- struct{}{}\n\n\t// Wait for data to become ready.\n\t<-r.readyCh\n\tp = r.buf\n\n\t// Return number of bytes and error if any.\n\treturn r.n, r.e\n}", "title": "" }, { "docid": "baef2d8444249411f6e9fea8d23dadda", "score": "0.62143624", "text": "func (ocfr *OCFReader) Read() (interface{}, error) {\n\tif ocfr.err != nil {\n\t\treturn nil, ocfr.err\n\t}\n\n\t// decode one data item from block\n\tocfr.datum, ocfr.block, ocfr.err = ocfr.bd.BinaryDecode(ocfr.block)\n\tif ocfr.err != nil {\n\t\treturn false, ocfr.err\n\t}\n\tocfr.remainingItems--\n\n\treturn ocfr.datum, nil\n}", "title": "" }, { "docid": "83b1ce31f5cb091fab9f2b51a38a60f3", "score": "0.6209484", "text": "func (c *intcode) read() int {\n\tvalue, ok := <-c.in\n\tif !ok {\n\t\tlog.Fatalf(\"FATAL: Reading from closed channel: %v\", c.in)\n\t}\n\treturn value\n}", "title": "" }, { "docid": "71b85d3a829f8f8092853eb01461b244", "score": "0.6196374", "text": "func (rg *RouteGroup) read(p []byte) (int, error) {\n\t// first try the buffer for any already received data\n\trg.mu.Lock()\n\tif rg.readBuf.Len() > 0 {\n\t\tn, err := rg.readBuf.Read(p)\n\t\trg.mu.Unlock()\n\n\t\treturn n, err\n\t}\n\trg.mu.Unlock()\n\n\tselect {\n\tcase <-rg.readDeadline.Wait():\n\t\treturn 0, timeoutError{}\n\tcase <-rg.closed:\n\t\treturn 0, io.ErrClosedPipe\n\tcase data, ok := <-rg.readCh:\n\t\tif !ok || len(data) == 0 {\n\t\t\t// route group got closed or empty data received. Behavior on the empty\n\t\t\t// data is equivalent to the behavior of `read()` unix syscall as described here:\n\t\t\t// https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.4.0/com.ibm.zos.v2r4.bpxbd00/rtrea.htm\n\t\t\treturn 0, io.EOF\n\t\t}\n\n\t\trg.mu.Lock()\n\t\tdefer rg.mu.Unlock()\n\n\t\treturn ioutil.BufRead(&rg.readBuf, data, p)\n\t}\n}", "title": "" }, { "docid": "df7b381ec6386d5da240c5408ef1b47d", "score": "0.61927396", "text": "func reader(ch chan int) {\n\t// Method 1\n\tfor i := range ch {\n\t\tfmt.Println(i)\n\t}\n\tfmt.Println(\"Chanel is closed.\")\n\t// Method 2\n\t/* for {\n\t\tdata, ok := <-ch\n\t\tif ok {\n\t\t\tfmt.Println(data)\n\t\t} else {\n\t\t\tfmt.Println(\"Chanel is closed.\")\n\t\t\tbreak\n\t\t}\n\t} */\n}", "title": "" }, { "docid": "a7ce7965b5b5fe49383827224ce31df7", "score": "0.6190315", "text": "func (p *RpcClientPackageHandler) Read(ss getty.Session, data []byte) (interface{}, int, error) {\n\trsp, length, err := (p.client.codec).Decode(data)\n\tif err != nil {\n\t\terr = perrors.WithStack(err)\n\t}\n\tif rsp == ((*remoting.DecodeResult)(nil)) {\n\t\treturn nil, length, err\n\t}\n\tif rsp.Result == ((*remoting.Response)(nil)) || rsp.Result == ((*remoting.Request)(nil)) {\n\t\treturn nil, length, err\n\t}\n\treturn rsp, length, err\n}", "title": "" }, { "docid": "cc0e45e1c30144d5d5f470c65cd41ff4", "score": "0.6184889", "text": "func (srwc secureReadWriteCloser) Read(p []byte) (int, error) {\n\treturn srwc.r.Read(p)\n}", "title": "" }, { "docid": "6e7b5e21d7b212fa3f761e7be8a67cad", "score": "0.61819345", "text": "func (r *progressReader) Read(p []byte) (int, error) {\n\tn, err := r.source.Read(p)\n\tr.offset += uint64(n)\n\tr.offsetUpdate += uint64(n)\n\n\t// Fire the progress reader in the provided interval\n\tif time.Since(r.lastUpdate) > r.interval {\n\t\tr.channel <- types.ProgressProperties{\n\t\t\tEvent: types.ProgressEventRead,\n\t\t\tArtifact: r.artifact,\n\t\t\tOffset: r.offset,\n\t\t\tOffsetUpdate: r.offsetUpdate,\n\t\t}\n\t\tr.lastUpdate = time.Now()\n\t\tr.offsetUpdate = 0\n\t}\n\treturn n, err\n}", "title": "" }, { "docid": "b05596cb42ca5fc4f99b47ca394de0d0", "score": "0.6181208", "text": "func (s *sock) read(m *Message) error {\n\treturn s.dec.Decode(m)\n}", "title": "" } ]
f13e0222a3f4bc9ae61a466d73995cb2
EnterAlter_table is called when production alter_table is entered.
[ { "docid": "1249bdab00172597c44ba17c4e3968e8", "score": "0.8837235", "text": "func (s *BasetsqlListener) EnterAlter_table(ctx *Alter_tableContext) {}", "title": "" } ]
[ { "docid": "1cae959c18e0a8932091faf0e8a83392", "score": "0.8548495", "text": "func (s *BaseCQL3Listener) EnterAlter_table_instruction(ctx *Alter_table_instructionContext) {}", "title": "" }, { "docid": "e30346fbff48c34326093072b18dadab", "score": "0.8381057", "text": "func (s *BaseCQL3Listener) EnterAlter_table_stmt(ctx *Alter_table_stmtContext) {}", "title": "" }, { "docid": "bf7b8cf333868a5fcf946bc137460cfc", "score": "0.7699286", "text": "func (s *BaseHiveParserListener) EnterAlterStatement(ctx *AlterStatementContext) {}", "title": "" }, { "docid": "b281f3f71ba37b1ee5f07594e4cca5e0", "score": "0.75886136", "text": "func (s *BasetsqlListener) EnterChange_table(ctx *Change_tableContext) {}", "title": "" }, { "docid": "74e91eb6906d4c630e124564129fa961", "score": "0.75254875", "text": "func (s *BasetsqlListener) EnterAlter_database(ctx *Alter_databaseContext) {}", "title": "" }, { "docid": "32e0d839fe74f7456e211e5ef138ea7a", "score": "0.72914946", "text": "func (s *BasetsqlListener) EnterCreate_table(ctx *Create_tableContext) {}", "title": "" }, { "docid": "970f2cdfb039da0eb09b7282c29ebc30", "score": "0.7064638", "text": "func (s *BaseHiveParserListener) EnterAlterTriggerStatement(ctx *AlterTriggerStatementContext) {}", "title": "" }, { "docid": "ae55293cd2bdcf92303fb6dc6ea576c4", "score": "0.6994043", "text": "func (s *BasetsqlListener) ExitAlter_table(ctx *Alter_tableContext) {}", "title": "" }, { "docid": "02e36047dcec7c0d7964b9014247feb6", "score": "0.69627595", "text": "func (s *BaseHiveParserListener) EnterAlterColumnConstraint(ctx *AlterColumnConstraintContext) {}", "title": "" }, { "docid": "17b9599305c8322ea8d86c0182ba21d9", "score": "0.69584775", "text": "func (s *BaseCQL3Listener) EnterTable_option(ctx *Table_optionContext) {}", "title": "" }, { "docid": "046ddb118de15e322e7497bfa9e5739a", "score": "0.6936688", "text": "func (s *BaseHiveParserListener) EnterTableConstraint(ctx *TableConstraintContext) {}", "title": "" }, { "docid": "5eba8f2b0664821c25d85923ffade220", "score": "0.69340247", "text": "func (s *BaseCQL3Listener) EnterAlter_keyspace_stmt(ctx *Alter_keyspace_stmtContext) {}", "title": "" }, { "docid": "6d25d77c268b857c40cb0a384ed1109f", "score": "0.69334334", "text": "func (s *BaseHiveParserListener) EnterAlterColConstraint(ctx *AlterColConstraintContext) {}", "title": "" }, { "docid": "ffa96e69c587899d2fe22b3ac03fdfce", "score": "0.692669", "text": "func (s *BaseHiveParserListener) EnterAlterTableStatementSuffix(ctx *AlterTableStatementSuffixContext) {\n}", "title": "" }, { "docid": "babfc4d03beeb39a9d920757c77412a8", "score": "0.68611056", "text": "func (s *BasetsqlListener) EnterDrop_table(ctx *Drop_tableContext) {}", "title": "" }, { "docid": "8bc82ac2c4f4ffe30cf80ae6ba8d780b", "score": "0.6843716", "text": "func (s *BaseCQL3Listener) EnterCreate_table_stmt(ctx *Create_table_stmtContext) {}", "title": "" }, { "docid": "97e9266bd1398d8bd7420d8909c2f6a8", "score": "0.67903495", "text": "func (s *BaseHiveParserListener) EnterCreateTableStatement(ctx *CreateTableStatementContext) {}", "title": "" }, { "docid": "7fdba8f226287f7d5a4ea60c3224b098", "score": "0.67604715", "text": "func (s *BaseHiveParserListener) EnterAlterMappingStatement(ctx *AlterMappingStatementContext) {}", "title": "" }, { "docid": "c5f535410833025cb0697dc479eb56bf", "score": "0.67382276", "text": "func (s *BaseCQL3Listener) EnterTable_options(ctx *Table_optionsContext) {}", "title": "" }, { "docid": "1ae86da8ce046cf1d1b975022aa7d166", "score": "0.66765875", "text": "func (s *BasetsqlListener) EnterTable_constraint(ctx *Table_constraintContext) {}", "title": "" }, { "docid": "8c48ad083dc8bc34cad4a49a4337117d", "score": "0.66742766", "text": "func (s *BaseHiveParserListener) EnterTableName(ctx *TableNameContext) {}", "title": "" }, { "docid": "cd6f8ae9457391772674746b3beb2fdb", "score": "0.66599214", "text": "func (s *BaseCQL3Listener) EnterTable_name(ctx *Table_nameContext) {}", "title": "" }, { "docid": "2bdff5c6ba1dd29d108643ad694723c4", "score": "0.6646818", "text": "func (s *BaseHiveParserListener) EnterTableSource(ctx *TableSourceContext) {}", "title": "" }, { "docid": "8e2afb4bce8fd2d3dbf10a4c721554ea", "score": "0.66229725", "text": "func (s *BaseHiveParserListener) EnterTableOrColumn(ctx *TableOrColumnContext) {}", "title": "" }, { "docid": "0db1ab221b4c6f6898d067b1c2de9447", "score": "0.66151524", "text": "func (s *BaseCQL3Listener) ExitAlter_table_instruction(ctx *Alter_table_instructionContext) {}", "title": "" }, { "docid": "4dabe47762aadffb2f9972fd65293c50", "score": "0.66139805", "text": "func (s *BaseCQL3Listener) EnterDrop_table_stmt(ctx *Drop_table_stmtContext) {}", "title": "" }, { "docid": "7f14cb6d3f88ee100be600ad4418f36a", "score": "0.66059625", "text": "func (s *BasetsqlListener) EnterTable_name(ctx *Table_nameContext) {}", "title": "" }, { "docid": "ba6efe1b80b6c0b2bef8b2038705314a", "score": "0.6590108", "text": "func (s *BaseHiveParserListener) EnterAlterStatementChangeColPosition(ctx *AlterStatementChangeColPositionContext) {\n}", "title": "" }, { "docid": "a82dbf9a03214e8566792a71e3b3e336", "score": "0.65109813", "text": "func (s *BaseCLIFListener) EnterInterpretablename(ctx *InterpretablenameContext) {}", "title": "" }, { "docid": "2722fe2794520ba6df43bf3168aa5565", "score": "0.6488947", "text": "func (s *BaseHiveParserListener) EnterRollbackStatement(ctx *RollbackStatementContext) {}", "title": "" }, { "docid": "0514943847cb59ee88efc3fff0044787", "score": "0.640437", "text": "func (s *BaseHiveParserListener) EnterTableLevelConstraint(ctx *TableLevelConstraintContext) {}", "title": "" }, { "docid": "3ae5bbaccfba6b7e90852f0d8e422a47", "score": "0.63997644", "text": "func (s *BaseHiveParserListener) EnterDropTableStatement(ctx *DropTableStatementContext) {}", "title": "" }, { "docid": "13e865a243b3dacb51508dfc6247992d", "score": "0.6351127", "text": "func (s *BaseHiveParserListener) EnterConstraintOptsAlter(ctx *ConstraintOptsAlterContext) {}", "title": "" }, { "docid": "eba217b3dae6bbf713d47b91a8f5a85f", "score": "0.63424635", "text": "func (s *BaseCQL3Listener) ExitAlter_table_stmt(ctx *Alter_table_stmtContext) {}", "title": "" }, { "docid": "a46841340e0dd07f4e58ce9f125d980f", "score": "0.6320276", "text": "func (s *BaseHiveParserListener) EnterTableBuckets(ctx *TableBucketsContext) {}", "title": "" }, { "docid": "2780a4252a60cf57962a05838efb0d82", "score": "0.6314767", "text": "func (s *BasetsqlListener) EnterTable_hint(ctx *Table_hintContext) {}", "title": "" }, { "docid": "231d3a20cb9eb5a7c5255ab7c7ae80df", "score": "0.6288568", "text": "func (s *BaseHiveParserListener) EnterTruncateTableStatement(ctx *TruncateTableStatementContext) {}", "title": "" }, { "docid": "0cd8f835cc02f2c7f60b406f73923a47", "score": "0.62515587", "text": "func (s *BaseHiveParserListener) EnterVirtualTableSource(ctx *VirtualTableSourceContext) {}", "title": "" }, { "docid": "75edc338174b15cc460be3da5cc8f0da", "score": "0.62439704", "text": "func (s *BaseHiveParserListener) EnterTableConstraintType(ctx *TableConstraintTypeContext) {}", "title": "" }, { "docid": "dc4dc1336dcf4ae8ddef8f8cdf5b73e0", "score": "0.62427545", "text": "func (s *BaseHiveParserListener) EnterAlterResourcePlanStatement(ctx *AlterResourcePlanStatementContext) {\n}", "title": "" }, { "docid": "ce3e08e2f709ebdcf64548f0f724bf8e", "score": "0.62212634", "text": "func (s *BasetsqlListener) EnterColumn_def_table_constraint(ctx *Column_def_table_constraintContext) {}", "title": "" }, { "docid": "f1a0ff58e8b6dc6d9d4d139f0bbe6d54", "score": "0.6219552", "text": "func (s *BaseCQL3Listener) EnterTruncate_table_stmt(ctx *Truncate_table_stmtContext) {}", "title": "" }, { "docid": "e1b89c406cd11189b01027d92758ff72", "score": "0.62190586", "text": "func (s *BasetsqlListener) EnterColumn_def_table_constraints(ctx *Column_def_table_constraintsContext) {\n}", "title": "" }, { "docid": "4758610c3aa482a86ffd392f98881e6b", "score": "0.6212103", "text": "func (s *BaseHiveParserListener) EnterAlterDatabaseStatementSuffix(ctx *AlterDatabaseStatementSuffixContext) {\n}", "title": "" }, { "docid": "032aef1ee773e95916a26d84e965a275", "score": "0.6210948", "text": "func (s *BaseHiveParserListener) EnterPartitionedTableFunction(ctx *PartitionedTableFunctionContext) {\n}", "title": "" }, { "docid": "466c83b907796087fcfef21b8cc927f2", "score": "0.62086517", "text": "func (s *BasetsqlListener) EnterWith_table_hints(ctx *With_table_hintsContext) {}", "title": "" }, { "docid": "4d0c04832050b35d905c8d27857502fa", "score": "0.6154511", "text": "func (s *BaseHiveParserListener) EnterAlterForeignKeyConstraint(ctx *AlterForeignKeyConstraintContext) {\n}", "title": "" }, { "docid": "6f0be2393b5425ba5fb8032543b3ba1b", "score": "0.61380607", "text": "func (s *BaseHiveParserListener) EnterCreateDatabaseStatement(ctx *CreateDatabaseStatementContext) {}", "title": "" }, { "docid": "cbece227118f3efbe8f5ea5e17b3e73d", "score": "0.6136613", "text": "func (s *BaseHiveParserListener) EnterTableLocation(ctx *TableLocationContext) {}", "title": "" }, { "docid": "c39b7d1766ae31b022187457364eb1f5", "score": "0.6131373", "text": "func (s *BasetsqlListener) EnterTable_sources(ctx *Table_sourcesContext) {}", "title": "" }, { "docid": "0a894571405c5bf47a9aa639cb6248aa", "score": "0.61043936", "text": "func (s *BaseHiveParserListener) EnterTableOrPartition(ctx *TableOrPartitionContext) {}", "title": "" }, { "docid": "6941ce9684196620efbad3836d36004c", "score": "0.61043316", "text": "func (s *BaseHiveParserListener) EnterAlterTblPartitionStatementSuffix(ctx *AlterTblPartitionStatementSuffixContext) {\n}", "title": "" }, { "docid": "2f164b44551f444e2605ceaf2c1bedb2", "score": "0.60748893", "text": "func (s *BaseHiveParserListener) EnterTableProperties(ctx *TablePropertiesContext) {}", "title": "" }, { "docid": "1f53243005a1d7ee7b333a138faff674", "score": "0.6072213", "text": "func (s *BaseHiveParserListener) EnterAlterStatementPartitionKeyType(ctx *AlterStatementPartitionKeyTypeContext) {\n}", "title": "" }, { "docid": "8796aa39f3527894d1ff5d62089b6796", "score": "0.60432285", "text": "func (s *BasecreoleListener) EnterTableheader(ctx *TableheaderContext) {}", "title": "" }, { "docid": "0553c5794ffbe3fdd53b5def7b0a5f1c", "score": "0.60231996", "text": "func (s *BasetsqlListener) EnterCreate_database(ctx *Create_databaseContext) {}", "title": "" }, { "docid": "d25765da9d514852143684cf94246594", "score": "0.60195976", "text": "func (s *BasetsqlListener) EnterFull_table_name(ctx *Full_table_nameContext) {}", "title": "" }, { "docid": "ac3ade40bebcd6f09712b7db23011648", "score": "0.60139614", "text": "func (s *BasetsqlListener) EnterInsert_with_table_hints(ctx *Insert_with_table_hintsContext) {}", "title": "" }, { "docid": "1cf5d2006d0ad581c642dc335c305aff", "score": "0.601201", "text": "func (s *BaseHiveParserListener) EnterColumnConstraint(ctx *ColumnConstraintContext) {}", "title": "" }, { "docid": "14c6a20437621d452aa31b0a922b4077", "score": "0.598367", "text": "func (s *BaseHiveParserListener) EnterTableAllColumns(ctx *TableAllColumnsContext) {}", "title": "" }, { "docid": "7fbb0a8ea7eef96d3cdb104b5ab4434b", "score": "0.5978838", "text": "func (s *BaseHiveParserListener) EnterWithAdminOption(ctx *WithAdminOptionContext) {}", "title": "" }, { "docid": "16f22715d237e1c7c9b470f3e5c5ef7b", "score": "0.5971767", "text": "func (s *BaseHiveParserListener) EnterCommitStatement(ctx *CommitStatementContext) {}", "title": "" }, { "docid": "4b97679b9236af2f696006a4b8bca18b", "score": "0.59576064", "text": "func (s *BaseHiveParserListener) EnterDropDatabaseStatement(ctx *DropDatabaseStatementContext) {}", "title": "" }, { "docid": "3886a01200c38c31d29535c311b1820c", "score": "0.59570783", "text": "func (s *BaseHiveParserListener) EnterTableAlias(ctx *TableAliasContext) {}", "title": "" }, { "docid": "cb3fd36ae12dc98dae7bde0a7257316d", "score": "0.59272295", "text": "func (s *BasetsqlListener) EnterTable_alias(ctx *Table_aliasContext) {}", "title": "" }, { "docid": "e7f0341cc3d514939fdd2f001445e905", "score": "0.59186745", "text": "func (s *BasetsqlListener) EnterTable_type_definition(ctx *Table_type_definitionContext) {}", "title": "" }, { "docid": "892807753f998c61ab6cc57701b3eda1", "score": "0.5907497", "text": "func (s *BaseHiveParserListener) EnterDropTriggerStatement(ctx *DropTriggerStatementContext) {}", "title": "" }, { "docid": "348014f14a0c35a768eb079b970ff005", "score": "0.5900092", "text": "func (s *BaseHiveParserListener) EnterAlterPoolStatement(ctx *AlterPoolStatementContext) {}", "title": "" }, { "docid": "82000c7a70709b104b0874263bf630d2", "score": "0.5884817", "text": "func (s *BasetsqlListener) EnterDerived_table(ctx *Derived_tableContext) {}", "title": "" }, { "docid": "7160d5fc358724094854ce73ac750464", "score": "0.58735794", "text": "func (s *BasetsqlListener) EnterCreate_database_option(ctx *Create_database_optionContext) {}", "title": "" }, { "docid": "4e45c242b9cc5d7a401fd934f39510bf", "score": "0.5871361", "text": "func (s *BaseHiveParserListener) EnterUnlockDatabase(ctx *UnlockDatabaseContext) {}", "title": "" }, { "docid": "ea3b6fab290f27730e98ab9de15a8adf", "score": "0.5870828", "text": "func (s *BaseHiveParserListener) EnterTableComment(ctx *TableCommentContext) {}", "title": "" }, { "docid": "41d68bb9feb4f6c4cfcf86df778df83b", "score": "0.5864467", "text": "func (s *BaseHiveParserListener) EnterSwitchDatabaseStatement(ctx *SwitchDatabaseStatementContext) {}", "title": "" }, { "docid": "d242bad0e972fb428882ff45ca1fa571", "score": "0.58640885", "text": "func (s *BasetsqlListener) EnterTable_name_with_hint(ctx *Table_name_with_hintContext) {}", "title": "" }, { "docid": "7e5c0b8e3dfc1bdcb7b5ba0c82210989", "score": "0.5850283", "text": "func (s *BasetsqlListener) EnterColumn_constraint(ctx *Column_constraintContext) {}", "title": "" }, { "docid": "7b6251b248dbb7d0de212d61aca03896", "score": "0.5840357", "text": "func (s *BaseHiveParserListener) EnterTablePartition(ctx *TablePartitionContext) {}", "title": "" }, { "docid": "68f52eb5eef7a6150ff909fbede396ed", "score": "0.58309484", "text": "func (s *BaseHiveParserListener) EnterImportStatement(ctx *ImportStatementContext) {}", "title": "" }, { "docid": "fe9b031d21b0d76d51d5a34bc95e8ce3", "score": "0.58180326", "text": "func (s *BaseHiveParserListener) EnterTableSample(ctx *TableSampleContext) {}", "title": "" }, { "docid": "fdbdd8ccc3a0d91a360846b6b93062dd", "score": "0.5803806", "text": "func (s *BaseHiveParserListener) EnterFunction(ctx *FunctionContext) {}", "title": "" }, { "docid": "e80ef3e1f753f85abcd462ac8d2b47e8", "score": "0.5799964", "text": "func (s *BasetsqlListener) EnterBracket_table_source(ctx *Bracket_table_sourceContext) {}", "title": "" }, { "docid": "f8f5f9501e0cb135a0bbba1e2c0829ac", "score": "0.57908016", "text": "func (s *BaseCQL3Listener) EnterColumn_definition(ctx *Column_definitionContext) {}", "title": "" }, { "docid": "9cea76af22fc1c8b1a17998e2f57632d", "score": "0.5787269", "text": "func (s *BaseHiveParserListener) EnterColConstraint(ctx *ColConstraintContext) {}", "title": "" }, { "docid": "78fe7e4641383270e45e714ce36e8f54", "score": "0.5785965", "text": "func (s *BaseHiveParserListener) EnterAlterDatabaseSuffixProperties(ctx *AlterDatabaseSuffixPropertiesContext) {\n}", "title": "" }, { "docid": "8f32da51b591b511b666585f2caeefe9", "score": "0.5783747", "text": "func (s *BaseHiveParserListener) EnterUpdateStatement(ctx *UpdateStatementContext) {}", "title": "" }, { "docid": "08323102f3e47fc638186f239f4f9578", "score": "0.578296", "text": "func (s *Baseasm8086Listener) EnterDb(ctx *DbContext) {}", "title": "" }, { "docid": "4125708ef2a0586c633b5552a3cb15d8", "score": "0.575317", "text": "func (s *BaseHiveParserListener) EnterExecStatement(ctx *ExecStatementContext) {}", "title": "" }, { "docid": "6c8d80e773b41c0910265a57b317c36b", "score": "0.5752505", "text": "func (s *BaseHiveParserListener) EnterPartitionTableFunctionSource(ctx *PartitionTableFunctionSourceContext) {\n}", "title": "" }, { "docid": "d1a860ee43b84586860289fb0d83b392", "score": "0.574193", "text": "func (s *BasetsqlListener) EnterColumn_definition(ctx *Column_definitionContext) {}", "title": "" }, { "docid": "cdaea5fab2507f73369b26927ebbe1b6", "score": "0.5730399", "text": "func (s *BaseHiveParserListener) EnterSqlTransactionStatement(ctx *SqlTransactionStatementContext) {}", "title": "" }, { "docid": "1dc923ba664221896b282ed3b5be3bf1", "score": "0.5729777", "text": "func (s *BaseHiveParserListener) EnterStatement(ctx *StatementContext) {}", "title": "" }, { "docid": "6cc377c5fa3026923146917a5075e397", "score": "0.5721521", "text": "func (s *BasetsqlListener) EnterSql_option(ctx *Sql_optionContext) {}", "title": "" }, { "docid": "f787a4ed2508477d31818710f9a4f4fa", "score": "0.57166255", "text": "func (p *ThriftHiveMetastoreClient) AlterTable(dbname string, tbl_name string, new_tbl *Table) (o1 *InvalidOperationException, o2 *MetaException, err error) {\n err = p.SendAlterTable(dbname, tbl_name, new_tbl)\n if err != nil { return }\n return p.RecvAlterTable()\n}", "title": "" }, { "docid": "c96ef79b487f9e17dddb27792e43f2f1", "score": "0.57049966", "text": "func (s *BaseHiveParserListener) EnterTablePropertiesList(ctx *TablePropertiesListContext) {}", "title": "" }, { "docid": "81e2a1175b8d6dd7b6602b7febe9b983", "score": "0.5702105", "text": "func (s *BaseHiveParserListener) EnterAlterViewStatementSuffix(ctx *AlterViewStatementSuffixContext) {\n}", "title": "" }, { "docid": "2ec290967b922d21bab52e1381c37ca4", "score": "0.5694002", "text": "func (s *BaseHiveParserListener) EnterDropFunctionStatement(ctx *DropFunctionStatementContext) {}", "title": "" }, { "docid": "950cd4f810657fe1723ef1942b38d9b0", "score": "0.56902444", "text": "func (s *BasePowerBuilderParserListener) EnterSql_commit_statement(ctx *Sql_commit_statementContext) {\n}", "title": "" }, { "docid": "5efc205cc2a70c3979e26197c617f2a2", "score": "0.5686122", "text": "func (s *BaseHiveParserListener) EnterCreateFunctionStatement(ctx *CreateFunctionStatementContext) {}", "title": "" }, { "docid": "87565307b0c0dd9f5938d856f5249857", "score": "0.56826186", "text": "func (s *BaseHiveParserListener) EnterStartTransactionStatement(ctx *StartTransactionStatementContext) {\n}", "title": "" }, { "docid": "0694e14743dc80b7485d3ced9a043e9d", "score": "0.56721467", "text": "func (s *BasecreoleListener) EnterTablerow(ctx *TablerowContext) {}", "title": "" }, { "docid": "5e81a0ce09e03fcd3b3badff707c10da", "score": "0.5668541", "text": "func (s *BaseHiveParserListener) EnterTableFileFormat(ctx *TableFileFormatContext) {}", "title": "" } ]
616a591ce31deec41ef42b67241529b5
Set sets an Image to Memcache
[ { "docid": "985c000295b96fd12f6b704a82dd883f", "score": "0.80552846", "text": "func (cache *MemcacheCache) Set(key string, image *imageserver.Image, parameters imageserver.Parameters) error {\n\tdata, _ := image.MarshalBinary()\n\n\titem := &memcache_impl.Item{\n\t\tKey: key,\n\t\tValue: data,\n\t}\n\terr := cache.Memcache.Set(item)\n\n\treturn err\n}", "title": "" } ]
[ { "docid": "e02ecee5c7d8566aad94b0e2002366d2", "score": "0.7520424", "text": "func (c *MemcachedManager) Set(ami ami.AMI) error {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\tvalue, err := c.marshal(ami)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\titem := memcache.Item{Key: *ami.Image.ImageId, Value: value}\n\tif err = c.client.Set(&item); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9996b4deff862010abe6aa57871559e9", "score": "0.6624489", "text": "func (b *BlobCache) Set(c context.Context, key string, value []byte, exp time.Duration) error {\n\tif b.Err != nil {\n\t\treturn b.Err\n\t}\n\tb.LRU.Put(c, key, value, exp)\n\treturn nil\n}", "title": "" }, { "docid": "f4b126d53428cd048f99cce06e3df260", "score": "0.66175747", "text": "func (m *Mutator) Set(ctx context.Context, config ispec.ImageConfig, meta Meta, annotations map[string]string, history *ispec.History) error {\n\tif err := m.cache(ctx); err != nil {\n\t\treturn errors.Wrap(err, \"getting cache failed\")\n\t}\n\n\t// Ensure the mediatype is correct.\n\tm.manifest.MediaType = ispec.MediaTypeImageManifest\n\n\t// Set annotations.\n\tm.manifest.Annotations = annotations\n\n\t// Set configuration.\n\tm.config.Config = config\n\n\t// Set metadata.\n\tm.config.Created = timePtr(meta.Created)\n\tm.config.Author = meta.Author\n\tm.config.Architecture = meta.Architecture\n\tm.config.OS = meta.OS\n\n\t// Append history.\n\tif history != nil {\n\t\thistory.EmptyLayer = true\n\t\tm.config.History = append(m.config.History, *history)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a67148022a283c155205eadfa11ed3cc", "score": "0.65217024", "text": "func (r *ImageRef) setImage(image *C.VipsImage) {\n\tr.lock.Lock()\n\tdefer r.lock.Unlock()\n\n\tif r.image == image {\n\t\treturn\n\t}\n\n\tif r.image != nil {\n\t\tclearImage(r.image)\n\t}\n\n\tr.image = image\n}", "title": "" }, { "docid": "c289b2d65b2370202e428cbe40470a91", "score": "0.64656353", "text": "func (m *Memcache) Set(c context.Context, key string, value []byte, exp time.Duration) error {\n\tc = m.cacheContext(c)\n\n\titem := mc.NewItem(c, key).SetValue(value).SetExpiration(exp)\n\tif err := mc.Set(c, item); err != nil {\n\t\treturn errors.WrapTransient(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "58004a17d118171eec8925a6790ad0e2", "score": "0.6464565", "text": "func (j *Cache) Set(key string, value []byte) error {\n\treturn j.client.Set(&memcache.Item{Key: key, Value: value})\n}", "title": "" }, { "docid": "3c1919eb0827838579d35d1739c3f196", "score": "0.64510787", "text": "func (l *lru) Set(file, etag string, width, height int, data []byte) error {\n\tkey := getKey(file, etag, width, height)\n\treturn l.cache.SetWithExpire(key, data, time.Duration(l.config.Expiration)*time.Second)\n}", "title": "" }, { "docid": "7e649390e7fbd106f13f4f603a995c9e", "score": "0.6366317", "text": "func (c *Driver) Set(cacheName string, key interface{}, val []byte, ttl time.Duration) (err error) {\n\treturn c.inmemory.Set(cacheName, cachery.Key(key), val, ttl)\n}", "title": "" }, { "docid": "197b1ad216ba8a8f72b9b1492683c468", "score": "0.6306118", "text": "func (bitmaps *Bitmaps) SetImage(key model.ResourceKey, bmp image.Bitmap) (resultKey model.ResourceKey, err error) {\n\tif (key.Type == model.ResourceTypeMfdDataImages) && key.HasValidLanguage() {\n\t\tholder := bitmaps.mfdArt[key.Language.ToIndex()].Get(res.ResourceID(key.Type))\n\t\tinsertIndex := key.Index\n\t\tavailable := holder.BlockCount()\n\n\t\tif insertIndex >= available {\n\t\t\tinsertIndex = available\n\t\t}\n\t\twriter := bytes.NewBuffer(nil)\n\t\timage.Write(writer, bmp, image.CompressedBitmap, true, 0)\n\t\tholder.SetBlockData(insertIndex, writer.Bytes())\n\t\tresultKey = model.MakeLocalizedResourceKey(key.Type, key.Language, insertIndex)\n\t} else {\n\t\terr = fmt.Errorf(\"Unsupported resource key %v\", key)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "bb2ddd3622d7e05885b7ccba8de7fba1", "score": "0.62630856", "text": "func (m *mcache) Set(key string, val []byte, expiration time.Duration) (err error) {\n\terr = m.conn.Set(&memcache.Item{Key: key, Value: val})\n\tif err == nil {\n\t\tm.conn.Touch(key, int32(expiration*time.Second))\n\t}\n\tif err != nil {\n\t\tm.logError(\"Set\", err)\n\t\treturn\n\t}\n\tm.logInfo(\"Set \"+key, string(val))\n\treturn\n}", "title": "" }, { "docid": "4f5fbfbfce67c9672ae4afbe3948148b", "score": "0.6232537", "text": "func (c *layerCache) Set(key interface{}, value interface{}) (err error) {\n\terr = c.Storage.Add(key, value)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif c.next == nil {\n\t\t// This backend cache is final destination\n\t\treturn nil\n\t}\n\t// Queue to flush\n\tc.log <- log{key, &Message{Value: value, Message: MessageSet}}\n\treturn nil\n}", "title": "" }, { "docid": "94111820df0c62708d0224cfce4729bd", "score": "0.6215621", "text": "func memcacheSet(c appengine.Context, key string, value []byte) {\n\titem := &memcache.Item{\n\t\tKey: key,\n\t\tValue: value,\n\t}\n\tcheck(memcache.Set(c, item))\n}", "title": "" }, { "docid": "a0971415ac6b6b51340b6ac713005946", "score": "0.6192056", "text": "func (cache *FrameCache) SetTexture(key FrameCacheKey, width, height uint16, pixels []byte, palette *bitmap.Palette) {\n\tcache.DropTextureForKey(key)\n\ttex := NewBitmapTexture(cache.gl, int(width), int(height), pixels)\n\tcache.textures[key] = tex\n\tif palette == nil {\n\t\treturn\n\t}\n\tpal := NewPaletteTexture(cache.gl, palette)\n\tcache.palettes[key] = pal\n}", "title": "" }, { "docid": "ab6299509bb3de29cba7d133a7e15064", "score": "0.6162981", "text": "func (c cache) Set(key string, resp []byte) {\n\tc.conn.Set(c.key(key), resp, time.Duration(0))\n}", "title": "" }, { "docid": "65e3dd03392c2bd031c6f0e245fa518f", "score": "0.61624223", "text": "func (fc *fileCache) Set(key, value string, ttl int) {\n\tfc.cache.Set(key, &cacheObject{\n\t\tValue: value,\n\t\tTimestamp: time.Now().Unix(),\n\t\tTTL: ttl,\n\t})\n\tfc.dirty = true\n}", "title": "" }, { "docid": "754ebf9a5415e01c52b02c0dbb3754f3", "score": "0.6144896", "text": "func (c *memoryCache) Set(key string, value interface{}) {\n\tc.data[key] = value\n}", "title": "" }, { "docid": "28969f91ea21c77f1a4ca75aac4debcb", "score": "0.6114778", "text": "func (m *MinIO) SetCache(ctx context.Context, c goproxy.Cache) error {\n\tif m.loadOnce.Do(m.load); m.loadError != nil {\n\t\treturn m.loadError\n\t}\n\n\t_, err := m.client.PutObjectWithContext(\n\t\tctx,\n\t\tm.BucketName,\n\t\tpath.Join(m.Root, c.Name()),\n\t\tc,\n\t\tc.Size(),\n\t\tminio.PutObjectOptions{\n\t\t\tContentType: mimeTypeByExtension(path.Ext(c.Name())),\n\t\t},\n\t)\n\n\treturn err\n}", "title": "" }, { "docid": "7fccd0659f271a301563f12e87b27f9a", "score": "0.6109525", "text": "func (client *Client) SetImage(imagepath string) error {\n\n\tif client.api == nil {\n\t\treturn fmt.Errorf(\"TessBaseAPI is not constructed, please use `gosseract.NewClient`\")\n\t}\n\tif imagepath == \"\" {\n\t\treturn fmt.Errorf(\"image path cannot be empty\")\n\t}\n\tif _, err := os.Stat(imagepath); err != nil {\n\t\treturn fmt.Errorf(\"cannot detect the stat of specified file: %v\", err)\n\t}\n\n\tif client.pixImage != nil {\n\t\tC.DestroyPixImage(client.pixImage)\n\t\tclient.pixImage = nil\n\t}\n\n\tp := C.CString(imagepath)\n\tdefer C.free(unsafe.Pointer(p))\n\n\timg := C.CreatePixImageByFilePath(p)\n\tclient.pixImage = img\n\n\treturn nil\n}", "title": "" }, { "docid": "7b2eaa7933f2d027c2c308d4f0cc860e", "score": "0.6083004", "text": "func (c ByteMapCache) Set(key string, newBytes []byte, stats *tc.CRConfigStats) {\n\tc.m.Lock()\n\tdefer c.m.Unlock()\n\t(*c.cache)[key] = ByteTime{bytes: newBytes, stats: stats, time: time.Now()}\n}", "title": "" }, { "docid": "a0f9c0c8d93e0d61b2e1e30e70d384c4", "score": "0.6061748", "text": "func Set(ctx context.Context, client cache.CacheClient, key, value string) {\n\trequest := &cache.SetRequest{\n\t\tKey: key,\n\t\tValue: []byte(value),\n\t}\n\tresponse, err := client.Set(context.Background(), request)\n\n\tif err == nil && response.Ok {\n\t\tfmt.Printf(\"key \\\"%s\\\" added to the cache\\n\", request.GetKey())\n\t} else {\n\t\tfmt.Printf(\"could not set key \\\"%s\\\", \\\"%v\\\"\\n\", key, err)\n\t}\n}", "title": "" }, { "docid": "1790ec9aaef15212e4650746c2b77f14", "score": "0.604427", "text": "func (t *TimedCache) Set(key string, data interface{}) {\n\tt.Store.Add(&AzureCacheEntry{\n\t\tKey: key,\n\t\tData: data,\n\t\tCreatedOn: time.Now().UTC(),\n\t})\n}", "title": "" }, { "docid": "28c4e9319ac6c4640dd56b435cd42172", "score": "0.60227555", "text": "func (c *Cache) Set(ctx context.Context, key string, value interface{}) error {\n\treturn c.rdb.Do(ctx, \"set\", key, value).Err()\n}", "title": "" }, { "docid": "707b3461057249e7a18281af7010e6e2", "score": "0.6022224", "text": "func (o *OSS) SetCache(ctx context.Context, c goproxy.Cache) error {\n\tif o.loadOnce.Do(o.load); o.loadError != nil {\n\t\treturn o.loadError\n\t}\n\n\treturn o.bucket.PutObject(\n\t\tpath.Join(o.Root, c.Name()),\n\t\tc,\n\t\toss.ContentType(mimeTypeByExtension(path.Ext(c.Name()))),\n\t)\n}", "title": "" }, { "docid": "c59edeb5e4c8fd822f7806176cea0a26", "score": "0.60022384", "text": "func Set(key string, value interface{}) (err error) {\n\treturn DefaultCache.Set(key, value)\n}", "title": "" }, { "docid": "d73815b36c721fbb57c13cbba67f79ea", "score": "0.5974073", "text": "func (g *GCS) SetCache(ctx context.Context, c goproxy.Cache) error {\n\tif g.loadOnce.Do(g.load); g.loadError != nil {\n\t\treturn g.loadError\n\t}\n\n\tw := g.bucket.Object(path.Join(g.Root, c.Name())).NewWriter(ctx)\n\tw.ContentType = mimeTypeByExtension(path.Ext(c.Name()))\n\tif _, err := io.Copy(w, c); err != nil {\n\t\treturn err\n\t}\n\n\treturn w.Close()\n}", "title": "" }, { "docid": "78cdcf304e9536317675c91c989665c3", "score": "0.593181", "text": "func (c MemoryCache) Set(key string, bc *CacheEntity) error {\n\tc[key] = bc\n\treturn nil\n}", "title": "" }, { "docid": "74350d1f8a208a0869560ade1efe932e", "score": "0.5926067", "text": "func (c *FileCache) Set(key string, entity *CacheEntity) error {\n\tpath := c.GetCachePath(key)\n\tif err := os.MkdirAll(filepath.Dir(path), 0777); err != nil {\n\t\treturn errors.Wrap(err, \"failed to create directory for cache file\")\n\t}\n\n\t// Need to avoid race condition\n\tfile, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE, 0666)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to open/create a cache file\")\n\t}\n\tdefer file.Close()\n\n\tf := bufio.NewWriter(file)\n\tdefer f.Flush()\n\tenc := gob.NewEncoder(f)\n\tif err = enc.Encode(entity); err != nil {\n\t\treturn errors.Wrap(err, \"failed to encode Entity via gob\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cd1f197a746b3c37f273034c4462cbf4", "score": "0.59126335", "text": "func (c *Cache) Set(key string, value interface{}) {\n\tttl := time.Duration(c.Expiry) * time.Second\n\tc.Cache.Set(key, value, ttl)\n}", "title": "" }, { "docid": "e1789e0e63bfbd333644ba3791169133", "score": "0.59011954", "text": "func (c *Cache) Set(key string, v float64) {\n\terr := c.cache.Add(key, v, cache.DefaultExpiration)\n\t// ignore error for now, later check how to handle error\n\tif err != nil {\n\t}\n}", "title": "" }, { "docid": "7074964595656f3ad102a94f6da37976", "score": "0.5883241", "text": "func (c *LoadableCache[T]) Set(ctx context.Context, key any, object T, options ...store.Option) error {\n\treturn c.cache.Set(ctx, key, object, options...)\n}", "title": "" }, { "docid": "6823fa8500592cfb87f2f098aa4d4f06", "score": "0.5879438", "text": "func (cache *Cache) Set(key string, value []byte, ttl int64) error {\n\n\tconn := cache.Pool.Get()\n\tdefer conn.Close()\n\n\t_, err := conn.Do(\"SET\", key, value)\n\tif err != nil {\n\t\tv := string(value)\n\t\tif len(v) > 15 {\n\t\t\tv = v[0:12] + \"...\"\n\t\t}\n\t\treturn fmt.Errorf(\"error setting key %s to %s: %v\", key, v, err)\n\t}\n\t_, err = conn.Do(\"EXPIRE\", key, ttl)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error setting expire key %s to %d: %v\", key, ttl, err)\n\t}\n\treturn nil\n\n}", "title": "" }, { "docid": "0422cb15fa36422a4fb8466bb1291f94", "score": "0.5877061", "text": "func (rc *ResourceCacheMap) Set(key object.ObjMetadata, value *unstructured.Unstructured) {\n\trc.cache[key] = value\n}", "title": "" }, { "docid": "5eb03334f8b7079df548f266378ccbee", "score": "0.58566076", "text": "func (m *MySQL) Set(key string, th *Blob) error {\n\tstart := time.Now()\n\tgo func() {\n\t\tklog.Infof(\"set(%q) took %s\", key, time.Since(start))\n\t}()\n\n\tsetMem(m.memcache, key, th)\n\n\tgo func() {\n\t\tb := new(bytes.Buffer)\n\t\tge := gob.NewEncoder(b)\n\n\t\tif err := ge.Encode(th); err != nil {\n\t\t\tklog.Errorf(\"encode: %w\", err)\n\t\t}\n\n\t\t_, err := m.db.Exec(`\n\t\t\tINSERT INTO persist2 (k, v, saved) VALUES (?, ?, ?)\n\t\t\tON DUPLICATE KEY UPDATE k=VALUES(k), v=VALUES(v)`, key, b.Bytes(), time.Now())\n\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"insert failed: %v\", err)\n\t\t}\n\t}()\n\treturn nil\n}", "title": "" }, { "docid": "c0cb95af3a64df74956123d9be05e67b", "score": "0.5831696", "text": "func (s *CacheServer) Set(ctx context.Context, item *pb.CacheItem) (*pb.Success, error) {\n\texpire, _ := time.Parse(time.RFC3339, item.ExpireTime)\n\terr := cache.Set(item.Key, item.Value, expire)\n\tif err != nil {\n\t\treturn &pb.Success{\n\t\t\tSuccess: false,\n\t\t}, err\n\t}\n\tlog.Printf(\"set item: %v, %v, %v\", item.Key, item.Value, expire)\n\treturn &pb.Success{\n\t\tSuccess: true,\n\t}, nil\n}", "title": "" }, { "docid": "f8bcd447f44c3ad979c8e4bb42dbd79e", "score": "0.58266854", "text": "func (d *Dao) SetXMLSegCache(c context.Context, tp int32, oid, cnt, num int64, value []byte) (err error) {\n\tkey := keyXMLSeg(tp, oid, cnt, num)\n\tconn := d.dmMC.Get(c)\n\titem := memcache.Item{\n\t\tKey: key,\n\t\tValue: value,\n\t\tExpiration: d.dmExpire,\n\t\tFlags: memcache.FlagRAW,\n\t}\n\tif err = conn.Set(&item); err != nil {\n\t\tlog.Error(\"mc.Set(%v) error(%v)\", item, err)\n\t}\n\tconn.Close()\n\treturn\n}", "title": "" }, { "docid": "1606a687b559d2cb0932537f3c7eee43", "score": "0.58257437", "text": "func CacheSet(key string, val interface{}) {\n\tvar wait sync.WaitGroup\n\twait.Add(1)\n\tgo func() {\n\t\tdefer wait.Done()\n\t\tredisSet(key, val)\n\t\tfmt.Println(\"[cache] set redis\")\n\t}()\n\tgcacheSet(key, val)\n\tfmt.Println(\"[cache] set gcache\")\n\twait.Wait()\n}", "title": "" }, { "docid": "0dda64090b7f03d0ea5fad60ba607532", "score": "0.58032155", "text": "func (c *Cache) Set(ctx context.Context, prefix string, key interface{}, value string) error {\n\ts := prefixKey(prefix, c.hasher.ToString(key))\n\t_, err := c.cli.Set(ctx, s, value, time.Duration(c.expireMs*int(time.Millisecond))).Result()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fe9f17aab8bd21076dc549504a7f901f", "score": "0.58006054", "text": "func (m *MockCache) Set(key string, value int) error {\n\treturn nil\n}", "title": "" }, { "docid": "d508c53ea95f1dc4840f9db687782ec1", "score": "0.5800206", "text": "func (c *Client) Set(key string, value string, exp int32) {\n\terr := c.client.Set(&memcache.Item{Key: key, Value: []byte(value), Expiration: exp})\n\tif err != nil {\n\t\tfmt.Println(fmt.Sprintf(\"error seting key %v\", err))\n\t}\n}", "title": "" }, { "docid": "c83c0ca50052cc3bca0d3ab3a3038c4f", "score": "0.5799221", "text": "func (_m *CacheStore) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) {\n\t_m.Called(ctx, key, value, expiration)\n}", "title": "" }, { "docid": "6c84b7db2187acd66a4f11d413fa596e", "score": "0.5793223", "text": "func (mem *Memcache) Set(key string, val interface{}, timeout time.Duration) (err error) {\n\tvar data []byte\n\tif data, err = json.Marshal(val); err != nil {\n\t\treturn err\n\t}\n\n\titem := &memcache.Item{Key: key, Value: data, Expiration: int32(timeout / time.Second)}\n\treturn mem.conn.Set(item)\n}", "title": "" }, { "docid": "d97494ab609e6de6a676c0baf15fecfa", "score": "0.5772336", "text": "func (c *Card) SetImage(img *canvas.Image) {\n\tc.Image = img\n\n\tc.Refresh()\n}", "title": "" }, { "docid": "edf6ee5ee0ad9687daac699f07572b11", "score": "0.5763796", "text": "func (c *cache) Set(k string, x []byte, d time.Duration) {\n\tatomic.AddInt32(&c.Statistic.SetCount, 1)\n\tatomic.AddInt32(&c.Statistic.ItemsCount, 1)\n\tatomic.AddInt32(&c.Statistic.Size, int32(len(x)))\n\tc.set(k, x, d)\n}", "title": "" }, { "docid": "c19fb46322813ebed8fbfb3a31ecb7e3", "score": "0.5760286", "text": "func (c *cache) set(roleID string, value *settings.Bundle) {\n\tc.sc.Store(roleID, value, time.Now().Add(c.ttl))\n}", "title": "" }, { "docid": "48861c7a111e82b95a3e0996442a7cdd", "score": "0.5756043", "text": "func (cache *RedisCache) Set(key string, value interface{}, duration time.Duration) error {\n\tvalue = cache.encryptHandler(value)\n\treturn cache.client.Set(key, value, duration).Err()\n}", "title": "" }, { "docid": "44f1b94fedf9e79585e2f35fba5563e7", "score": "0.5755729", "text": "func set(ctx appengine.Context, key string, value []byte, expiry time.Duration) {\n\titem := &memcache.Item{\n\t\tKey: key,\n\t\tValue: value,\n\t\tExpiration: expiry,\n\t}\n\tif err := memcache.Set(ctx, item); err != nil {\n\t\tErrorMsg(ctx, fmt.Sprintf(\"Error setting key '%s': %v\", key, err))\n\t}\n}", "title": "" }, { "docid": "8db0a1e22c7314a8b9599d3f5fd71734", "score": "0.57508826", "text": "func (c *Cache[K, V]) Set(_ context.Context, key K, value dataloader.Thunk[V]) {\n\tk := fmt.Sprintf(\"%v\", key) // convert the key to string because the underlying library doesn't support Generics yet\n\tc.c.Set(k, value, 0)\n}", "title": "" }, { "docid": "d699984af95f60589df3e3930491b175", "score": "0.5746494", "text": "func (d *Dao) SetFigureCache(c context.Context, figure *model.Figure) (err error) {\n\tkey := keyFigure(figure.Mid)\n\tconn := d.redis.Get(c)\n\tdefer conn.Close()\n\tvalues, err := json.Marshal(figure)\n\tif err != nil {\n\t\treturn\n\t}\n\tif err = conn.Send(\"SET\", key, values); err != nil {\n\t\tlog.Error(\"conn.Send(SET, %s, %v) error(%v)\", key, values, err)\n\t\treturn\n\t}\n\tif err = conn.Send(\"EXPIRE\", key, d.redisExpire); err != nil {\n\t\tlog.Error(\"conn.Send(Expire, %s, %d) error(%v)\", key, d.redisExpire, err)\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "594a3684cfe76e0349670f8ef491ecf0", "score": "0.5727407", "text": "func (c *cache) Set(k string, value interface{}) {\n\tc.cache.Set(k, value, -1)\n}", "title": "" }, { "docid": "86cbf1116681b1e28bce58984966c0eb", "score": "0.5727356", "text": "func (cs *CacheWithSubcache) Set(key string, value interface{}) error {\n\tif err := cs.Subcache.Set(key, value); err != nil {\n\t\treturn err\n\t}\n\treturn cs.Cache.Set(key, value)\n}", "title": "" }, { "docid": "e869811d3c4f12c25b42672f97150f71", "score": "0.57254905", "text": "func (c *MQCache) Set(key string, value SizeComputer) {\n\tnow := time.Now().UnixNano()\n\tc.lock.Lock()\n\tc.store(key, value, now)\n\tc.lock.Unlock()\n\tc.adjust(now)\n}", "title": "" }, { "docid": "752f38926e39b8af4ec01a2b30ae51f9", "score": "0.5712918", "text": "func (c HTTPService) SetInCache(key, value string) error {\n\tc.rwMutex.Lock()\n\tdefer c.rwMutex.Unlock()\n\n\t/*\n\t Cache is at capacity.\n\t Remove the oldest to be able to insert a new one\n\t*/\n\tif c.lruIndex.IsAtCapacity() {\n\t\toldestItem := c.lruIndex.GetOldest()\n\n\t\tif oldestItem == nil {\n\t\t\treturn errors.New(\"Can not remove oldest item from cache\")\n\t\t}\n\n\t\tc.lruIndex.Remove(*oldestItem)\n\t\tc.cache.Remove(*oldestItem)\n\t}\n\n\tc.ttlWorker.Update(key)\n\tc.lruIndex.Update(key)\n\tc.cache.Set(key, value)\n\n\treturn nil\n}", "title": "" }, { "docid": "411e215c67e233f6cd9c66b5d78616d0", "score": "0.57086223", "text": "func (r *Connection) Set(key string, value []byte) error {\n\treturn r.cache.Set([]byte(key), value, r.expiry)\n}", "title": "" }, { "docid": "20a1ef47bd9727447e2156b17e07bdad", "score": "0.57018465", "text": "func (c *Cache) Set(key string, value interface{}, exp time.Duration) error {\n\t// By default, go-cache uses -1 for NoExpiration, but we expect 0 to be no expiration.\n\tif exp == 0 {\n\t\texp = -1\n\t}\n\tc.gc.Set(key, value, exp)\n\treturn nil\n}", "title": "" }, { "docid": "625d795df6eba31b839e0bf6b251c6b2", "score": "0.5696433", "text": "func (c *Cache) Set(key interface{}, item caching.Item) {\n\tc.store(key, item)\n}", "title": "" }, { "docid": "b99aa9eefacb3762cdab52650675a1eb", "score": "0.5687985", "text": "func (c *cacher) SetCache(ctx context.Context, item goproxy.Cache) (err error) {\n\tif c.readonly {\n\t\treturn nil\n\t}\n\tfilename := path.Join(c.root, item.Name())\n\tif err := os.MkdirAll(path.Dir(filename), 0755); err != nil {\n\t\treturn err\n\t}\n\tfile, err := os.Create(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\tdefer item.Close()\n\n\t_, err = io.Copy(file, item)\n\n\treturn err\n}", "title": "" }, { "docid": "04bfa188cb97177443f1de583255f769", "score": "0.56820786", "text": "func (pd *PlayData) SetImage(name string, minutes uint) {\n\tnewImage, _ := ebiten.NewImageFromImage(playDataImage, ebiten.FilterDefault)\n\ttime := getPlayTime(minutes)\n\tchar.RenderString(newImage, name, 64, 16)\n\n\tstart := 96 - 8*(len(time)-3) // プレイ時間によって\"xx:yy\"の長さが変わるので調節してやる必要がある\n\tchar.RenderString(newImage, time, float64(start), 64)\n\tpd.image = newImage\n}", "title": "" }, { "docid": "2a5fc22242878befc6c19949ced791d9", "score": "0.5681333", "text": "func setToCache(ctx context.Context, cacheService cache.Cache, key uuid.UUID, subKey cache.SubKey, value interface{}) error {\n\terr := cacheService.SetValue(ctx, key, subKey, value)\n\tif err != nil {\n\t\tlogger.Errorf(\"%s: cache.SetValue: %s\\n\", key, err.Error())\n\t}\n\treturn err\n}", "title": "" }, { "docid": "11b940c872054f95834b1ca706725ff4", "score": "0.5680057", "text": "func (c *SingleItemExpCache) Set(data interface{}) {\n\tc.mu.Lock()\n\tc.data = data\n\tc.expiredAt = Clock.GetUTCNow().Add(c.ttl)\n\tc.mu.Unlock()\n}", "title": "" }, { "docid": "3f68df900fb530837004066d46b2d058", "score": "0.567803", "text": "func (c *SimpleMemoryCache) Set(ctx *Context, next Next) {\n\tc.data[ctx.Key] = ctx.Value.(int64)\n\n\t// call next to make sure all memory cache ready\n\t// maybe you should check next is nil or not\n\tnext(ctx)\n}", "title": "" }, { "docid": "0b8ebd928cfb0ff4c90664ea2a90da97", "score": "0.5674473", "text": "func (s *MemcacheStore) Set(key interface{}, value interface{}, options *Options) error {\n\tif options == nil {\n\t\toptions = s.options\n\t}\n\n\titem := &memcache.Item{\n\t\tKey: key.(string),\n\t\tValue: value.([]byte),\n\t\tExpiration: int32(options.ExpirationValue().Seconds()),\n\t}\n\n\treturn s.client.Set(item)\n}", "title": "" }, { "docid": "d2986e11924ef6b6006c24fec84fe110", "score": "0.56688964", "text": "func (b *ImageButton) SetImage(state ButtonState, imgfile string) error {\n\n\ttex, err := texture.NewTexture2DFromImage(imgfile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif b.stateImages[state] != nil {\n\t\tb.stateImages[state].Dispose()\n\t}\n\tb.stateImages[state] = tex\n\tb.update()\n\n\treturn nil\n}", "title": "" }, { "docid": "b6487b82e9879a2e35d6e1d84767b35a", "score": "0.56676364", "text": "func (c *Noncache) Set(key string, val interface{}, timeout time.Duration) error {\n\treturn nil\n}", "title": "" }, { "docid": "06f4635f912517253db1a783ca2275a7", "score": "0.5662737", "text": "func (c *Cache) Set(key string, value interface{}) (err error) {\n\tdocument := &cache.Document{\n\t\tKey: key,\n\t\tValue: value,\n\t\tStoredTime: time.Now().Unix(),\n\t}\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\terr = c.repo.Set(document)\n\treturn\n}", "title": "" }, { "docid": "113c97c9acf446de3f7fae9e64c841f4", "score": "0.56546986", "text": "func (c *Cache) Set(key string, value []byte, ttl int64) error {\n\tvar err error\n\n\tif ttl > 0 {\n\t\t_, err = c.client.Do(\"SETEX\", key, ttl, value)\n\t} else if ttl == 0 {\n\t\t_, err = c.client.Do(\"SET\", key, value)\n\t} else {\n\t\treturn c.Delete(key)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "4b9000779593cb009810b3c4b452d24e", "score": "0.56546354", "text": "func Set(key interface{}, value interface{}, duration time.Duration) {\n\tdefaultCache.Set(key, value, duration)\n}", "title": "" }, { "docid": "a50e341d547f9a6079ad19b4604c61a3", "score": "0.56483454", "text": "func (c *Cache) Set(ctx Context, key string, data []byte) error {\n\n\tc.peersOnce.Do(c.initPeers)\n\n\tif c.shards == nil {\n\t\treturn errorf(shardsNotInitializedError, nil)\n\t}\n\n\tif c.peers != nil {\n\t\tif peer, ok := c.peers.PickPeer(key); ok {\n\n\t\t\terr_p := c.setToPeer(ctx, peer, key, data)\n\n\t\t\tif err_p != nil {\n\t\t\t\treturn err_p\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tshard, err := c.getShard(key)\n\tshard.Lock()\n\tdefer shard.Unlock()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif c.filter != nil {\n\t\t// filter is enabled. So we'll test first, add in filter if not there, then don't cache, assuming it's a one-hit-wonder\n\t\tif !c.filter.contains([]byte(key)) {\n\t\t\tc.filter.add([]byte(key))\n\t\t\treturn errorf(filterFirstInstanceError, key)\n\t\t}\n\t}\n\n\terr_s := shard.set(key, data)\n\n\tif err_s != nil {\n\t\treturn err_s\n\t}\n\n\tif c.peers != nil {\n\t\tc.peers.IncrementLoad()\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "de18d42c539c24ea9fd9a501a72c0f5b", "score": "0.5628695", "text": "func (c *Cache) Set(key uint32, msg *dns.Msg) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\tc.set(key, msg)\n}", "title": "" }, { "docid": "80f24635dd04effb83c7f9ce994f1424", "score": "0.5627162", "text": "func (x *ImgSpanner) SetImage(img interface{}) {\n\tswitch img := img.(type) {\n\tcase *xgraphics.Image:\n\t\tx.pix = img.Pix\n\t\tx.stride = img.Stride\n\t\tx.xpixel = true\n\t\tx.bounds = img.Bounds()\n\tcase *image.RGBA:\n\t\tx.pix = img.Pix\n\t\tx.stride = img.Stride\n\t\tx.xpixel = false\n\t\tx.bounds = img.Bounds()\n\t}\n}", "title": "" }, { "docid": "bbd16d3cde1c367bbc0a20c53ac9e148", "score": "0.56240946", "text": "func (c *cache) set(roleID string, value *settingsmsg.Bundle) {\n\tc.sc.Store(roleID, value, time.Now().Add(c.ttl))\n}", "title": "" }, { "docid": "8f650903fde9e8919edff1946995b24e", "score": "0.5613292", "text": "func (h *Handler) Set(key string, value interface{}, expiry time.Duration) error {\n\treturn h.codec.Set(&cache.Item{\n\t\tKey: key,\n\t\tObject: value,\n\t\tExpiration: expiry,\n\t})\n}", "title": "" }, { "docid": "1bf3cfa863e4e8280b2ab8b1be273f64", "score": "0.5608719", "text": "func (c *Cache) Set(key interface{}, value interface{}, duration time.Duration) error {\n\treturn c.adapter.Set(c.getCtx(), key, value, duration)\n}", "title": "" }, { "docid": "c89e471e9e81587063f3b9e8851a73bf", "score": "0.5607876", "text": "func (self *Graphics) UpdateCachedSpriteTexture() {\n self.Object.Call(\"updateCachedSpriteTexture\")\n}", "title": "" }, { "docid": "0834e95ccf6b8b5500c2a78ff3995131", "score": "0.5607418", "text": "func (s UserSet) SetImage(value string) {\n\ts.RecordCollection.Set(models.NewFieldName(\"Image\", \"image\"), value)\n}", "title": "" }, { "docid": "34f96ccb392ecc4b190f95e575a68af5", "score": "0.5605373", "text": "func (c *ETCDCache) Set(key, value string) (err error) {\n\tlogger := log.WithFields(log.Fields{\"class\": \"ETCDCache\", \"method\": \"Set\"})\n\tkapi := client.NewKeysAPI(c.client)\n\t_, err = kapi.Set(context.Background(), c.prefix+\"/\"+key, value, c.options)\n\n\tif _, ok := err.(*client.ClusterError); ok {\n\t\terr = ErrStorageConnectionFailed\n\t\tlogger.Errorf(\"%v\", err.Error())\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "4cca8e267756385fffa65aef3d1967b5", "score": "0.56025547", "text": "func (c *FileSystemCache) Set(data []byte, expire time.Duration, key ...string) error {\n\tif len(key) < 1 {\n\t\treturn fmt.Errorf(\"no key specified\")\n\t}\n\tfolder := c.keyPath(key[:len(key)-1]...)\n\t_, err := os.Stat(folder)\n\tif os.IsNotExist(err) {\n\t\tos.MkdirAll(folder, 0700)\n\t}\n\tif expire > 0 {\n\t\texpireTS := time.Now().Add(expire).UnixNano()\n\t\terr := ioutil.WriteFile(c.expirePath(key...), []byte(strconv.FormatInt(expireTS, 10)), 0600)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn ioutil.WriteFile(c.keyPath(key...), data, 0600)\n}", "title": "" }, { "docid": "a820c8a6972c01b0914018cdf30dcc1e", "score": "0.5592831", "text": "func (c *etcdCache) set(key string, rsp *etcdResponse) *etcdCacheEntry {\n e, ok := c.props[key]\n if ok {\n e.SetResponse(rsp)\n }else{\n e = newEtcdCacheEntry(key, rsp)\n c.props[key] = e\n }\n return e\n}", "title": "" }, { "docid": "e8f700bc4eab5a3a0591336a424204b4", "score": "0.5588357", "text": "func (cache *Cache) Set(key, data interface{}) {\n\tcache.mutex.Lock()\n\tdefer cache.mutex.Unlock()\n\titem := &Item{data: data}\n\tif cache.hasAutoExpire() {\n\t\titem.addTimeout(cache.ttl)\n\t}\n\tcache.items[key] = item\n}", "title": "" }, { "docid": "caf0dc5b65349af2866bfa183bb50794", "score": "0.55878985", "text": "func (c *cache) Set(key string, value string, duration time.Duration) (string, error) {\n\tresult, err := c.cacheConn.Set(key, value, duration).Result()\n\tif err != nil {\n\t\tlogger.Log().Error(\"Error while storing data to redis\", zap.String(\"key\", key), zap.Error(err))\n\t}\n\treturn result, err\n}", "title": "" }, { "docid": "0e8c4b535a41c02b6beb479ee2a93b80", "score": "0.55659986", "text": "func (c *BlockCache) Set(key string) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\tkey = strings.ToLower(key)\n\tc.m[key] = true\n}", "title": "" }, { "docid": "942018aef4546e278e132f461543118b", "score": "0.55584544", "text": "func (m *Mutator) cache(ctx context.Context) error {\n\t// We need the manifest\n\tif m.manifest == nil {\n\t\tblob, err := m.engine.FromDescriptor(ctx, m.source.Descriptor())\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"cache source manifest\")\n\t\t}\n\t\tdefer blob.Close()\n\n\t\tmanifest, ok := blob.Data.(ispec.Manifest)\n\t\tif !ok {\n\t\t\t// Should _never_ be reached.\n\t\t\treturn errors.Errorf(\"[internal error] unknown manifest blob type: %s\", blob.Descriptor.MediaType)\n\t\t}\n\n\t\t// Make a copy of the manifest.\n\t\tm.manifest = manifestPtr(manifest)\n\t}\n\n\tif m.config == nil {\n\t\tblob, err := m.engine.FromDescriptor(ctx, m.manifest.Config)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"cache source config\")\n\t\t}\n\t\tdefer blob.Close()\n\n\t\tconfig, ok := blob.Data.(ispec.Image)\n\t\tif !ok {\n\t\t\t// Should _never_ be reached.\n\t\t\treturn errors.Errorf(\"[internal error] unknown config blob type: %s\", blob.Descriptor.MediaType)\n\t\t}\n\n\t\t// Make a copy of the config and configDescriptor.\n\t\tm.config = configPtr(config)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "164a1f0628c3bdeba058bb45d069768c", "score": "0.55572605", "text": "func (c *Component) SetCache(key string, data interface{}) {\n\tc.cache[key] = data\n}", "title": "" }, { "docid": "57d639abbffe12e67374701d063bc43b", "score": "0.5538441", "text": "func (w *Watcher) setCache(key string, val string) {\n\tw.Lock()\n\tdefer w.Unlock()\n\tw.cache[key] = val\n}", "title": "" }, { "docid": "58bee480b29b5d6299a8f6b5ace61b55", "score": "0.5535488", "text": "func (s *GoCacheStore) Set(ctx context.Context, key any, value any, options ...lib_store.Option) error {\n\topts := lib_store.ApplyOptions(options...)\n\tif opts == nil {\n\t\topts = s.options\n\t}\n\n\ts.client.Set(key.(string), value, opts.Expiration)\n\n\tif tags := opts.Tags; len(tags) > 0 {\n\t\ts.setTags(ctx, key, tags)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "75c2fc5f218795217efb5c3f59122729", "score": "0.5533758", "text": "func (c *Cache) Set(ctx context.Context, item Item) error {\n\tif bypassFromContext(ctx) == BypassReadWriting {\n\t\treturn nil\n\t}\n\n\treturn c.storage.Set(ctx, item)\n}", "title": "" }, { "docid": "388aa9beb7d471249db303397ec427f0", "score": "0.55333984", "text": "func (c *ChainCache[T]) Set(ctx context.Context, key any, object T, options ...store.Option) error {\n\terrs := []error{}\n\tfor _, cache := range c.caches {\n\t\terr := cache.Set(ctx, key, object, options...)\n\t\tif err != nil {\n\t\t\tstoreType := cache.GetCodec().GetStore().GetType()\n\t\t\terrs = append(errs, fmt.Errorf(\"Unable to set item into cache with store '%s': %v\", storeType, err))\n\t\t}\n\t}\n\tif len(errs) > 0 {\n\t\terrStr := \"\"\n\t\tfor k, v := range errs {\n\t\t\terrStr += fmt.Sprintf(\"error %d of %d: %v\", k+1, len(errs), v.Error())\n\t\t}\n\t\treturn errors.New(errStr)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ff7d6e6be97d47a95e4500b39d42142d", "score": "0.55221355", "text": "func (lc *LRUCache) Set(key string, value interface{}) (err error) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\terr = fmt.Errorf(\"%v\", r)\n\t\t}\n\t}()\n\tif lc.compressionEngine == nil {\n\t\tlc.lru.Add(key, value)\n\t\treturn nil\n\t}\n\n\tmarshalledValue, err := lc.marshal(value)\n\tif err != nil {\n\t\tlc.logger.Error(\"lru: error marshaling data: \", err)\n\t\treturn err\n\t}\n\n\tinput, err := lc.compressionEngine.Compress(marshalledValue)\n\tif err != nil {\n\t\tlc.logger.Error(\"lru: error compressing data: \", err)\n\t\treturn err\n\t}\n\tlc.lru.Add(key, input)\n\treturn nil\n}", "title": "" }, { "docid": "1909de9be695a8248a7b38c3653338b7", "score": "0.5521352", "text": "func (cc cacheCluster) Set(key string, val any) error {\n\treturn cc.SetCtx(context.Background(), key, val)\n}", "title": "" }, { "docid": "c46263fa81b7e330c75cadc1594ca9c2", "score": "0.5519476", "text": "func (fs *FSCache) Set(key string, content []byte) error {\n\treturn ioutil.WriteFile(\n\t\tpath.Join(fs.Root, key),\n\t\tcontent,\n\t\t0600,\n\t)\n}", "title": "" }, { "docid": "bae6568366d6b15d39d4bda58996a026", "score": "0.55180025", "text": "func (c *cache) Set(key string, value interface{}) interface{} {\n\tc.mtx.Lock()\n\tc.data[key] = c.newCacheValue(value)\n\tc.mtx.Unlock()\n\treturn value\n}", "title": "" }, { "docid": "ff7e95f6b62ec4c5c674b860e212650b", "score": "0.551793", "text": "func setInterfaceCacheFile(path string) {\n\tinterfaceCacheFile = path\n}", "title": "" }, { "docid": "6aa699013fa4b61f0240351468216cd8", "score": "0.55163205", "text": "func (i *ImageBuf) ImageCache() *ImageCache {\n\tret := &ImageCache{C.ImageBuf_imagecache(i.ptr)}\n\truntime.KeepAlive(i)\n\treturn ret\n}", "title": "" }, { "docid": "47e569b15b45f683d041d9340f5ad92e", "score": "0.5511747", "text": "func (c *Cache) Set(key []byte, val []byte, db *pebble.DB) error {\n\tc.lock.Lock()\n\tc.moveItemToFront(key)\n\tc.hitCounter = c.hitCounter + 1\n\tc.lock.Unlock()\n\t// Manage clearing the cache only once every 20 sets\n\t// Adjust this number back to 20 after debugging for better\n\t// performance\n\tif c.hitCounter%1 == 0 {\n\t\ttableSize := getTableSize(db)\n\t\tif tableSize > c.MaxSizeInBytes {\n\t\t\terr := c.evictFromCache(db)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t}\n\t}\n\terr := db.Set(key, val, pebble.Sync)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b8950ac7ca7284aaff0c9232378605ba", "score": "0.5508272", "text": "func (c *etcdCache) Set(key string, rsp *etcdResponse) {\n c.Lock()\n defer c.Unlock()\n c.set(key, rsp)\n}", "title": "" }, { "docid": "4d6d2186e2043a54fba33556da2327d7", "score": "0.5506018", "text": "func (b *Bcache) Set(key, val string, expiredTimestamp int64) {\n\tb.peer.Set(key, val, expiredTimestamp)\n}", "title": "" }, { "docid": "cde6d5dee0c2db93a7fb7674bf4363a2", "score": "0.5505628", "text": "func (kcuo *K8sContainerUpdateOne) SetImage(s string) *K8sContainerUpdateOne {\n\tkcuo.mutation.SetImage(s)\n\treturn kcuo\n}", "title": "" }, { "docid": "1e4c6a30900d7efecd4bc811cd920dcd", "score": "0.54986167", "text": "func (s *SamplerateCache) Set(rtr net.IP, rate uint64) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\ts.cache[string(rtr)] = rate\n}", "title": "" }, { "docid": "88d436ba77f330ed2b538beec1fd10fa", "score": "0.54968065", "text": "func (p *Plugin) SetImage(context string, image string, target string) error {\n\treturn p.sendMessage(&SetImageEventMessage{\n\t\tEvent: \"setImage\",\n\t\tContext: context,\n\t\tPayload: SetImagePayload{\n\t\t\tImage: image,\n\t\t\tTarget: target,\n\t\t},\n\t})\n}", "title": "" }, { "docid": "df262fbbe82f39939b81a0d7abdae271", "score": "0.54943347", "text": "func (d *Dao) SetDMSegCache(c context.Context, tp int32, oid, total, num int64, dmSeg *model.DMSeg) (err error) {\n\tkey := keySegMC(tp, oid, total, num)\n\tconn := d.dmSegMC.Get(c)\n\titem := memcache.Item{\n\t\tKey: key,\n\t\tObject: dmSeg,\n\t\tExpiration: d.dmSegMCExpire,\n\t\tFlags: memcache.FlagProtobuf | memcache.FlagGzip,\n\t}\n\tif err = conn.Set(&item); err != nil {\n\t\tlog.Error(\"conn.Set(%v) error(%v)\", item, err)\n\t}\n\tconn.Close()\n\treturn\n}", "title": "" }, { "docid": "87d4d684b26755041bb8d233e987c80b", "score": "0.5494311", "text": "func (c nullCache) Set(k string, v interface{}, expire time.Duration) error {\n\treturn nil\n}", "title": "" } ]
8e09473d9b3c34c21082b65680387d66
TransferCreatorship is a paid mutator transaction binding the contract method 0x6d2e4b1b. Solidity: function transferCreatorship(address newCreator) returns()
[ { "docid": "e24b4c81c9b145e4b805eb4d51a12a36", "score": "0.82126707", "text": "func (_BaseContentSpace *BaseContentSpaceTransactor) TransferCreatorship(opts *bind.TransactOpts, newCreator common.Address) (*types.Transaction, error) {\n\treturn _BaseContentSpace.contract.Transact(opts, \"transferCreatorship\", newCreator)\n}", "title": "" } ]
[ { "docid": "836907b733580daed4022aaeefe8aef8", "score": "0.8481496", "text": "func (_BaseAccessWalletFactory *BaseAccessWalletFactoryTransactor) TransferCreatorship(opts *bind.TransactOpts, newCreator common.Address) (*types.Transaction, error) {\n\treturn _BaseAccessWalletFactory.contract.Transact(opts, \"transferCreatorship\", newCreator)\n}", "title": "" }, { "docid": "47bf504bb40930d222e816a7195550c0", "score": "0.83960986", "text": "func (_BaseFactory *BaseFactoryTransactor) TransferCreatorship(opts *bind.TransactOpts, newCreator common.Address) (*types.Transaction, error) {\n\treturn _BaseFactory.contract.Transact(opts, \"transferCreatorship\", newCreator)\n}", "title": "" }, { "docid": "ac14346c71ae832a012ce6be3dc7e7de", "score": "0.8389778", "text": "func (_BaseAccessWallet *BaseAccessWalletTransactor) TransferCreatorship(opts *bind.TransactOpts, newCreator common.Address) (*types.Transaction, error) {\n\treturn _BaseAccessWallet.contract.Transact(opts, \"transferCreatorship\", newCreator)\n}", "title": "" }, { "docid": "24940b84c1089015a6b26dfccda16537", "score": "0.8349967", "text": "func (_BaseContentFactory *BaseContentFactoryTransactor) TransferCreatorship(opts *bind.TransactOpts, newCreator common.Address) (*types.Transaction, error) {\n\treturn _BaseContentFactory.contract.Transact(opts, \"transferCreatorship\", newCreator)\n}", "title": "" }, { "docid": "7743d5bf9296134734fba26ab44a4295", "score": "0.83395284", "text": "func (_BaseLibraryFactory *BaseLibraryFactoryTransactor) TransferCreatorship(opts *bind.TransactOpts, newCreator common.Address) (*types.Transaction, error) {\n\treturn _BaseLibraryFactory.contract.Transact(opts, \"transferCreatorship\", newCreator)\n}", "title": "" }, { "docid": "ea615910ab344414f04b90a799de1ad9", "score": "0.8311376", "text": "func (_BaseGroupFactory *BaseGroupFactoryTransactor) TransferCreatorship(opts *bind.TransactOpts, newCreator common.Address) (*types.Transaction, error) {\n\treturn _BaseGroupFactory.contract.Transact(opts, \"transferCreatorship\", newCreator)\n}", "title": "" }, { "docid": "f242eeec70c3f97e4afa5f8a71ba8f43", "score": "0.8287115", "text": "func (_BaseContentFactoryExt *BaseContentFactoryExtTransactor) TransferCreatorship(opts *bind.TransactOpts, newCreator common.Address) (*types.Transaction, error) {\n\treturn _BaseContentFactoryExt.contract.Transact(opts, \"transferCreatorship\", newCreator)\n}", "title": "" }, { "docid": "b73d81640f2295da2227dab8b9ac3095", "score": "0.8257528", "text": "func (_BaseLibrary *BaseLibraryTransactor) TransferCreatorship(opts *bind.TransactOpts, newCreator common.Address) (*types.Transaction, error) {\n\treturn _BaseLibrary.contract.Transact(opts, \"transferCreatorship\", newCreator)\n}", "title": "" }, { "docid": "9fa14e106c78a48c7583b646f68cab3b", "score": "0.82503", "text": "func (_Ownable *OwnableTransactor) TransferCreatorship(opts *bind.TransactOpts, newCreator common.Address) (*types.Transaction, error) {\n\treturn _Ownable.contract.Transact(opts, \"transferCreatorship\", newCreator)\n}", "title": "" }, { "docid": "43400c836250454f327197e97f1ac95b", "score": "0.82305944", "text": "func (_MetaObject *MetaObjectTransactor) TransferCreatorship(opts *bind.TransactOpts, newCreator common.Address) (*types.Transaction, error) {\n\treturn _MetaObject.contract.Transact(opts, \"transferCreatorship\", newCreator)\n}", "title": "" }, { "docid": "6b90883afff0d07c2e79845f0cfec7c9", "score": "0.82290775", "text": "func (_BaseContent *BaseContentTransactor) TransferCreatorship(opts *bind.TransactOpts, newCreator common.Address) (*types.Transaction, error) {\n\treturn _BaseContent.contract.Transact(opts, \"transferCreatorship\", newCreator)\n}", "title": "" }, { "docid": "7703a42031d423e3e68c07a27c54f9ff", "score": "0.81686836", "text": "func (_LvStreamRightsHolder *LvStreamRightsHolderTransactor) TransferCreatorship(opts *bind.TransactOpts, newCreator common.Address) (*types.Transaction, error) {\n\treturn _LvStreamRightsHolder.contract.Transact(opts, \"transferCreatorship\", newCreator)\n}", "title": "" }, { "docid": "c808889fe7ce98df3719dd1646ef3996", "score": "0.8164276", "text": "func (_BaseContentType *BaseContentTypeTransactor) TransferCreatorship(opts *bind.TransactOpts, newCreator common.Address) (*types.Transaction, error) {\n\treturn _BaseContentType.contract.Transact(opts, \"transferCreatorship\", newCreator)\n}", "title": "" }, { "docid": "0fd5509bf368c4e8f580cef692a81b4e", "score": "0.813828", "text": "func (_Container *ContainerTransactor) TransferCreatorship(opts *bind.TransactOpts, newCreator common.Address) (*types.Transaction, error) {\n\treturn _Container.contract.Transact(opts, \"transferCreatorship\", newCreator)\n}", "title": "" }, { "docid": "11f92268aeece67e0d350ab34439cad4", "score": "0.81333405", "text": "func (_Content *ContentTransactor) TransferCreatorship(opts *bind.TransactOpts, newCreator common.Address) (*types.Transaction, error) {\n\treturn _Content.contract.Transact(opts, \"transferCreatorship\", newCreator)\n}", "title": "" }, { "docid": "0be8209b4bafc653e56c708e3342d2c0", "score": "0.8124232", "text": "func (_Node *NodeTransactor) TransferCreatorship(opts *bind.TransactOpts, newCreator common.Address) (*types.Transaction, error) {\n\treturn _Node.contract.Transact(opts, \"transferCreatorship\", newCreator)\n}", "title": "" }, { "docid": "392db4dc79f182e92f80ea4956d097cd", "score": "0.8116432", "text": "func (_NodeSpace *NodeSpaceTransactor) TransferCreatorship(opts *bind.TransactOpts, newCreator common.Address) (*types.Transaction, error) {\n\treturn _NodeSpace.contract.Transact(opts, \"transferCreatorship\", newCreator)\n}", "title": "" }, { "docid": "39b16a257dbc63b084b92e17228ef2e8", "score": "0.8089133", "text": "func (_AccessIndexor *AccessIndexorTransactor) TransferCreatorship(opts *bind.TransactOpts, newCreator common.Address) (*types.Transaction, error) {\n\treturn _AccessIndexor.contract.Transact(opts, \"transferCreatorship\", newCreator)\n}", "title": "" }, { "docid": "b013bd23d3a636dc5a9c3a946778adb6", "score": "0.80863863", "text": "func (_BaseAccessControlGroup *BaseAccessControlGroupTransactor) TransferCreatorship(opts *bind.TransactOpts, newCreator common.Address) (*types.Transaction, error) {\n\treturn _BaseAccessControlGroup.contract.Transact(opts, \"transferCreatorship\", newCreator)\n}", "title": "" }, { "docid": "d4f5fafbb43b3b32546c7c96115f18c3", "score": "0.8085633", "text": "func (_LvRecording *LvRecordingTransactor) TransferCreatorship(opts *bind.TransactOpts, newCreator common.Address) (*types.Transaction, error) {\n\treturn _LvRecording.contract.Transact(opts, \"transferCreatorship\", newCreator)\n}", "title": "" }, { "docid": "aedab3540ad896046d9d37f523109ab3", "score": "0.80786705", "text": "func (_LvRecordableStream *LvRecordableStreamTransactor) TransferCreatorship(opts *bind.TransactOpts, newCreator common.Address) (*types.Transaction, error) {\n\treturn _LvRecordableStream.contract.Transact(opts, \"transferCreatorship\", newCreator)\n}", "title": "" }, { "docid": "b738dbc25130764a65834c261a4f3c73", "score": "0.8065155", "text": "func (_Editable *EditableTransactor) TransferCreatorship(opts *bind.TransactOpts, newCreator common.Address) (*types.Transaction, error) {\n\treturn _Editable.contract.Transact(opts, \"transferCreatorship\", newCreator)\n}", "title": "" }, { "docid": "2538e06f5a8e785ff17aea3277935234", "score": "0.681427", "text": "func (_BaseAccessWallet *BaseAccessWalletCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseAccessWallet.contract.Call(opts, &out, \"creator\")\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": "e7f39108f2b38f5a23e98cff2e457a59", "score": "0.6752803", "text": "func (_BaseAccessWalletFactory *BaseAccessWalletFactoryCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseAccessWalletFactory.contract.Call(opts, &out, \"creator\")\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": "c2c0297904d4592968efe36112ee92d7", "score": "0.63775903", "text": "func (_Ownable *OwnableCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Ownable.contract.Call(opts, &out, \"creator\")\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": "c0faf7ab28fda00898906b707b6d0142", "score": "0.63507134", "text": "func (_NodeSpace *NodeSpaceCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _NodeSpace.contract.Call(opts, &out, \"creator\")\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": "625b5e5f3fb687d7248e771670df9140", "score": "0.6318444", "text": "func (_BaseFactory *BaseFactoryCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseFactory.contract.Call(opts, &out, \"creator\")\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": "5d94b296fea7e9bd9a47bd89d61d5d61", "score": "0.6266948", "text": "func (_BaseContentSpace *BaseContentSpaceCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseContentSpace.contract.Call(opts, &out, \"creator\")\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": "2ca5b04755780d6b401383262f66d508", "score": "0.6232769", "text": "func (_Editable *EditableCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Editable.contract.Call(opts, &out, \"creator\")\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": "2b63fd3d452459243d691a295242dff7", "score": "0.6231605", "text": "func (_Node *NodeCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Node.contract.Call(opts, &out, \"creator\")\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": "7494325c320c363cdb72808ac916d1eb", "score": "0.61959636", "text": "func (_MetaObject *MetaObjectCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _MetaObject.contract.Call(opts, &out, \"creator\")\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": "4f306c414ec922cdae920f77cb2179ea", "score": "0.6185375", "text": "func (_BaseContentFactory *BaseContentFactoryCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseContentFactory.contract.Call(opts, &out, \"creator\")\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": "8ab3770580eddbf75a75ec2571fa2786", "score": "0.6155517", "text": "func (_BaseContent *BaseContentCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseContent.contract.Call(opts, &out, \"creator\")\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": "fd516e9e4915db4146e27e7ba7e8c228", "score": "0.61366487", "text": "func (_BaseLibrary *BaseLibraryCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseLibrary.contract.Call(opts, &out, \"creator\")\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": "d5e0279296d33442151f817973076d38", "score": "0.61283016", "text": "func (_Content *ContentCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Content.contract.Call(opts, &out, \"creator\")\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": "936876ac543122b6e91b4dbdf346117c", "score": "0.61133254", "text": "func (_LvStreamRightsHolder *LvStreamRightsHolderCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _LvStreamRightsHolder.contract.Call(opts, &out, \"creator\")\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": "29a50bbde23e5df31d27db8b08d85a19", "score": "0.60972255", "text": "func (_BaseContentFactoryExt *BaseContentFactoryExtCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseContentFactoryExt.contract.Call(opts, &out, \"creator\")\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": "775590bea8237c2a303e33b6ffa688b8", "score": "0.6064288", "text": "func (_Container *ContainerCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Container.contract.Call(opts, &out, \"creator\")\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": "fc92aa561a4380591dbb0848b97ca297", "score": "0.6017095", "text": "func (_BaseLibraryFactory *BaseLibraryFactoryCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseLibraryFactory.contract.Call(opts, &out, \"creator\")\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": "416960e34c7b6b800851ec2c9a124044", "score": "0.60157037", "text": "func (_BaseGroupFactory *BaseGroupFactoryCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseGroupFactory.contract.Call(opts, &out, \"creator\")\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": "287beba9271c70ba7c9553334b3242d4", "score": "0.59894973", "text": "func (_BaseContentType *BaseContentTypeCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseContentType.contract.Call(opts, &out, \"creator\")\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": "0983a916c8ccc9a41d68582b8d145ead", "score": "0.59291273", "text": "func (_AccessIndexor *AccessIndexorCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _AccessIndexor.contract.Call(opts, &out, \"creator\")\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": "dbdb37b75f2bce97c783cb2e877e2c07", "score": "0.5911404", "text": "func (_BaseAccessControlGroup *BaseAccessControlGroupCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseAccessControlGroup.contract.Call(opts, &out, \"creator\")\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": "6963dc88a228c17aec2232f003e7a2e0", "score": "0.58171856", "text": "func (_LvRecordableStream *LvRecordableStreamCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _LvRecordableStream.contract.Call(opts, &out, \"creator\")\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": "a0863e70b7924c4b2a4c2a7610ba2b56", "score": "0.5720644", "text": "func (_LvRecording *LvRecordingCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _LvRecording.contract.Call(opts, &out, \"creator\")\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": "3a7eac56345bb0a01b9db4ea96aa8521", "score": "0.55865836", "text": "func (self *ResTransaction)GetCreator()utils.Addr{\n return self.Creator\n}", "title": "" }, { "docid": "dcd5e9a637f9e7066baa37c2399c5177", "score": "0.5401253", "text": "func (_SushiV2Factory *SushiV2FactoryCaller) Migrator(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _SushiV2Factory.contract.Call(opts, &out, \"migrator\")\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": "47e5e4c76661ffa3aaed026523e9f3d7", "score": "0.5332261", "text": "func (t *SimpleChaincode) toReadyForShipment(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {\n\n\tcontractid := args[0]\n\tcaller := args[1]\n\tcallerAffiliation := args[2]\n\tnewDocumentID := args[3]\n\t// check if the contract exists\n\tsc, err := getContractObject(stub, contractid)\n\tif err != nil {\n\t\tfmt.Println(\"sellerToTransporter() : failed to get contract object\")\n\t\treturn nil, errors.New(\"Failed to get contract object\")\n\t}\n\n\tif sc.Stage == STATE_OPEN &&\n\t\tsc.Seller == caller &&\n\t\tcallerAffiliation == SELLER {\n\t\tsc.Stage = STATE_READYFORSHIPMENT // and mark it in the state of ready for shipment\n\t\tsc.DocumentID = newDocumentID //attach the new document\n\t} else { // Otherwise if there is an error\n\t\tfmt.Printf(\"sellerToTransporter: Permission Denied\")\n\t\treturn nil, errors.New(fmt.Sprintf(\"Permission Denied. sellerToTransporter\"))\n\n\t}\n\n\tstatus, err := t.save_changes(stub, sc) // Write new state\n\tif err != nil {\n\t\tfmt.Printf(\"sellerToTransporter: Error saving changes: %s\", err)\n\t\treturn nil, errors.New(\"Error saving changes\")\n\t}\n\tfmt.Println(\"sellerToTransporter: Transfer complete : %s\", status)\n\treturn nil, nil // We are Done\n\n}", "title": "" }, { "docid": "c9788d438d3a8c696c5bce0fe555284a", "score": "0.5330902", "text": "func (w *Wallet) txCreator() {\n\tquit := w.quitChan()\nout:\n\tfor {\n\t\tselect {\n\t\tcase txr := <-w.createTxRequests:\n\t\t\theldUnlock, err := w.holdUnlock()\n\t\t\tif err != nil {\n\t\t\t\ttxr.resp <- createTxResponse{nil, err}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttx, err := w.txToOutputs(txr.req)\n\t\t\theldUnlock.release()\n\t\t\ttxr.resp <- createTxResponse{tx, err}\n\t\tcase <-quit:\n\t\t\tbreak out\n\t\t}\n\t}\n\tw.wg.Done()\n}", "title": "" }, { "docid": "4ed517cb7256c73b1a240bb2473874c7", "score": "0.5244276", "text": "func (t *TxCreate) CreateTransferTx(sender, receiver account.AccountType, floatValue float64) (string, string, error) {\n\ttargetAction := action.ActionTypeTransfer\n\n\t// validation account\n\tif receiver == account.AccountTypeClient || receiver == account.AccountTypeAuthorization {\n\t\treturn \"\", \"\", errors.New(\"invalid receiver account. client, authorization account is not allowed as receiver\")\n\t}\n\tif sender == receiver {\n\t\treturn \"\", \"\", errors.New(\"invalid account. sender and receiver is same\")\n\t}\n\n\t// check sernder's balance\n\tsenderAddr, err := t.addrRepo.GetOneUnAllocated(sender)\n\tif err != nil {\n\t\treturn \"\", \"\", errors.Wrap(err, \"fail to call addrRepo.GetOneUnAllocated(sender)\")\n\t}\n\tsenderBalance, err := t.xrp.GetBalance(senderAddr.WalletAddress)\n\tif err != nil {\n\t\treturn \"\", \"\", errors.Wrap(err, \"fail to call xrp.GetAccountInfo()\")\n\t}\n\tif senderBalance <= 20 {\n\t\treturn \"\", \"\", errors.New(\"sender balance is insufficient to send\")\n\t}\n\tif floatValue != 0 && senderBalance <= floatValue {\n\t\treturn \"\", \"\", errors.New(\"sender balance is insufficient to send\")\n\t}\n\n\tt.logger.Debug(\"amount\",\n\t\tzap.Float64(\"floatValue\", floatValue),\n\t\tzap.Float64(\"senderBalance\", senderBalance),\n\t)\n\n\t// get receiver address\n\treceiverAddr, err := t.addrRepo.GetOneUnAllocated(receiver)\n\tif err != nil {\n\t\treturn \"\", \"\", errors.Wrap(err, \"fail to call addrRepo.GetOneUnAllocated(receiver)\")\n\t}\n\n\t// call CreateRawTransaction\n\tinstructions := &pb.Instructions{\n\t\tMaxLedgerVersionOffset: xrp.MaxLedgerVersionOffset,\n\t}\n\ttxJSON, rawTxString, err := t.xrp.CreateRawTransaction(senderAddr.WalletAddress, receiverAddr.WalletAddress, floatValue, instructions)\n\tif err != nil {\n\t\treturn \"\", \"\", errors.Wrapf(err, \"fail to call xrp.CreateRawTransaction(), sender address: %s\", senderAddr.WalletAddress)\n\t}\n\tt.logger.Debug(\"txJSON\", zap.Any(\"txJSON\", txJSON))\n\tgrok.Value(txJSON)\n\n\t// generate UUID to trace transaction because unsignedTx is not unique\n\tuid := uuid.NewV4().String()\n\n\tserializedTxs := []string{fmt.Sprintf(\"%s,%s\", uid, rawTxString)}\n\n\t// create insert data for eth_detail_tx\n\ttxDetailItem := &models.XRPDetailTX{\n\t\tUUID: uid,\n\t\tCurrentTXType: tx.TxTypeUnsigned.Int8(),\n\t\tSenderAccount: sender.String(),\n\t\tSenderAddress: senderAddr.WalletAddress,\n\t\tReceiverAccount: receiver.String(),\n\t\tReceiverAddress: receiverAddr.WalletAddress,\n\t\tAmount: txJSON.Amount,\n\t\tXRPTXType: txJSON.TransactionType,\n\t\tFee: txJSON.Fee,\n\t\tFlags: txJSON.Flags,\n\t\tLastLedgerSequence: txJSON.LastLedgerSequence,\n\t\tSequence: txJSON.Sequence,\n\t\t// SigningPubkey: txJSON.SigningPubKey,\n\t\t// TXNSignature: txJSON.TxnSignature,\n\t\t// Hash: txJSON.Hash,\n\t}\n\ttxDetailItems := []*models.XRPDetailTX{txDetailItem}\n\n\treturn t.afterTxCreation(targetAction, sender, serializedTxs, txDetailItems, nil)\n}", "title": "" }, { "docid": "d7d5100f54f6d4afc116ee006a5b6a1f", "score": "0.52410316", "text": "func (th *TransactionHeader) Creator() []byte {\n\treturn th.creator\n}", "title": "" }, { "docid": "8bc6b4ead67c9fad8d9b7812c91973d3", "score": "0.5092011", "text": "func (_BaseFactory *BaseFactoryTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) {\n\treturn _BaseFactory.contract.Transact(opts, \"transferOwnership\", newOwner)\n}", "title": "" }, { "docid": "6bae634d6a86a95f2d8e7f64e46f081a", "score": "0.50886446", "text": "func (_IUniswapV2Factory *IUniswapV2FactoryRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\r\n\treturn _IUniswapV2Factory.Contract.IUniswapV2FactoryTransactor.contract.Transfer(opts)\r\n}", "title": "" }, { "docid": "d7a7db4708e6ce9a2aebed686a365725", "score": "0.5077321", "text": "func (t *Deliverys) createDelivery(stub shim.ChaincodeStubInterface, args []string) pb.Response {\r\n var err error\r\n\r\n if len(args) != 8 {\r\n return shim.Error(\"Incorrect number of arguments. Expecting 8\")\r\n\t}\r\n\t\r\n\txabln := args[0]\t\r\n\tmatnr := args[1]\t\r\n\tbstnr := args[2]\t\r\n\tqualf1 := args[3]\t\r\n\tbelnr1 := args[4]\t\r\n\tqualf2 := args[5]\t\r\n belnr2 := args[6]\r\n datestring := args[7]\r\n\r\n\t // ==== Check if Delivery already exists ====\r\n\t deliveryAsBytes, err := stub.GetState(bstnr)\r\n\t if err != nil {\r\n\t\t return shim.Error(\"Failed to get delivery: \" + err.Error())\r\n\t } else if deliveryAsBytes != nil {\r\n\t\t fmt.Println(\"This purchase order already exists: \" + bstnr)\r\n\t\t return shim.Error(\"This purchase order already exists: \" + bstnr)\r\n\t }\r\n transaction_date, _err := strconv.Atoi(datestring) //Date 1\r\n if _err != nil {\r\n return shim.Error(_err.Error())\r\n }\r\n\t \r\n // ====marshal to JSON ====\r\n\tdelivery := &Delivery{xabln,matnr,bstnr,qualf1,belnr1,qualf2,belnr2,transaction_date}\r\n\t\r\n\r\n\tdeliveryJSONasBytes, err := json.Marshal(delivery)\r\n if err != nil {\r\n return shim.Error(err.Error())\r\n }\r\n \r\n // === Save product to state ===\r\n err = stub.PutState(bstnr, deliveryJSONasBytes)\r\n if err != nil {\r\n return shim.Error(err.Error())\r\n }\r\n\r\n //get the delivery index\r\n deliveryIndexAsBytes, err := stub.GetState(DelIndexStr)\r\n if err != nil {\r\n return shim.Error(err.Error())\r\n }\r\n var deliveryIndex []string\r\n\r\n json.Unmarshal(deliveryIndexAsBytes, &deliveryIndex) //un stringify it aka JSON.parse()\r\n fmt.Print(\"deliveryIndex: \")\r\n fmt.Println(deliveryIndex)\r\n //append\r\n deliveryIndex = append(deliveryIndex, bstnr)\r\n fmt.Print(\"Delivery Index after appending == \",deliveryIndex)\r\n //add \"bstnr\" to index list\r\n jsonAsBytes, _ := json.Marshal(deliveryIndex)\r\n //store \"bstnr\" of Delivery\r\n err = stub.PutState(DelIndexStr, jsonAsBytes)\r\n if err != nil {\r\n return shim.Error(err.Error())\r\n }\r\n\r\n eventMessage := \"{ \\\"BSTNR\\\" : \\\"\"+bstnr+\"\\\", \\\"message\\\" : \\\"Delivery created succcessfully\\\", \\\"code\\\" : \\\"200\\\"}\"\r\n err = stub.SetEvent(\"evtsender\", []byte(eventMessage))\r\n if err != nil {\r\n return shim.Error(err.Error())\r\n }\r\n\t // ==== Delivery is saved and indexed. Return success ====\r\n\t\tfmt.Println(\"- end createDelivery\")\r\n\t\treturn shim.Success(deliveryJSONasBytes)\r\n}", "title": "" }, { "docid": "2f099274c697ca4513ba6e6ce7b5a28e", "score": "0.5075259", "text": "func (_IUniswapV2Factory *IUniswapV2FactoryTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\r\n\treturn _IUniswapV2Factory.Contract.contract.Transfer(opts)\r\n}", "title": "" }, { "docid": "d0dbab7c87f96c82d6ec5fe8c55de036", "score": "0.5065557", "text": "func (_BaseAccessWalletFactory *BaseAccessWalletFactoryTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) {\n\treturn _BaseAccessWalletFactory.contract.Transact(opts, \"transferOwnership\", newOwner)\n}", "title": "" }, { "docid": "1fcf16418d151887cdf3b3764b7d97e1", "score": "0.50357443", "text": "func (s *ship) generate() ship {\n\ts.name = generateShipName()\n\ts.origin = generateShipOrigin()\n\n\trndCondition := generateNumber(1, 6)\n\trndType := generateNumber(1, 6)\n\n\tshipType := \"\"\n\tquirkCount := 0\n\tperkCount := 0\n\n\tif rndCondition < 4 {\n\t\tshipType += \"Shiny \"\n\t\tquirkCount = 1\n\t} else {\n\t\tshipType += \"Scuffed \"\n\t\tquirkCount = 2\n\t}\n\n\tif rndType < 4 {\n\t\tshipType += \"Economy \"\n\t\tperkCount = 1\n\t} else {\n\t\tshipType += \"Luxury \"\n\t\tperkCount = 2\n\t}\n\tshipType += \"Starship\"\n\n\ts.shipType = shipType\n\n\tfor i := 0; i < quirkCount; i++ {\n\t\ts.quirks = append(s.quirks, generateShipQuirk())\n\t}\n\n\tfor i := 0; i < perkCount; i++ {\n\t\ts.perks = append(s.perks, generateShipPerk())\n\t}\n\n\treturn *s\n}", "title": "" }, { "docid": "0bf8e67481c651274fd0fe3d9d1f6690", "score": "0.50207996", "text": "func (t *ManageShipment) createShipment(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {\n\t//createShipment('shipmentId','description','sender','receiver','FAA_formNumber','quantity','shipmentDate')\n\tvar err error\n\tvar valIndex Form\n\tif len(args) != 22 {\n\t\treturn nil, errors.New(\"Incorrect number of arguments. Expecting 10\")\n\t}\n\tfmt.Println(\"Creating a new Shipment\")\n\tif len(args[0]) <= 0 {\n\t\treturn nil, errors.New(\"1st argument must be a non-empty string\")\n\t}\n\tif len(args[1]) <= 0 {\n\t\treturn nil, errors.New(\"2nd argument must be a non-empty string\")\n\t}\n\tif len(args[2]) <= 0 {\n\t\treturn nil, errors.New(\"3rd argument must be a non-empty string\")\n\t}\n\tif len(args[3]) <= 0 {\n\t\treturn nil, errors.New(\"4th argument must be a non-empty string\")\n\t}\n\tif len(args[4]) <= 0 {\n\t\treturn nil, errors.New(\"5th argument must be a non-empty string\")\n\t}\n\tif len(args[5]) <= 0 {\n\t\treturn nil, errors.New(\"6th argument must be a non-empty string\")\n\t}\n\tif len(args[6]) <= 0 {\n\t\treturn nil, errors.New(\"7th argument must be a non-empty string\")\n\t}\n\tif len(args[7]) <= 0 {\n\t\treturn nil, errors.New(\"8th argument must be a non-empty string\")\n\t}\n\tif len(args[8]) <= 0 {\n\t\treturn nil, errors.New(\"9th argument must be a non-empty string\")\n\t}\n\tif len(args[9]) <= 0 {\n\t\treturn nil, errors.New(\"10th argument must be a non-empty string\")\n\t}\n\tif len(args[10]) <= 0 {\n\t\treturn nil, errors.New(\"10th argument must be a non-empty string\")\n\t}\n\tif len(args[11]) <= 0 {\n\t\treturn nil, errors.New(\"10th argument must be a non-empty string\")\n\t}\n\tif len(args[12]) <= 0 {\n\t\treturn nil, errors.New(\"10th argument must be a non-empty string\")\n\t}\n\tif len(args[13]) <= 0 {\n\t\treturn nil, errors.New(\"10th argument must be a non-empty string\")\n\t}\n\tif len(args[14]) <= 0 {\n\t\treturn nil, errors.New(\"10th argument must be a non-empty string\")\n\t}\n\tif len(args[15]) <= 0 {\n\t\treturn nil, errors.New(\"10th argument must be a non-empty string\")\n\t}\n\tif len(args[16]) <= 0 {\n\t\treturn nil, errors.New(\"10th argument must be a non-empty string\")\n\t}\n\tif len(args[17]) <= 0 {\n\t\treturn nil, errors.New(\"10th argument must be a non-empty string\")\n\t}\n\tif len(args[18]) <= 0 {\n\t\treturn nil, errors.New(\"10th argument must be a non-empty string\")\n\t}\n\tif len(args[19]) <= 0 {\n\t\treturn nil, errors.New(\"10th argument must be a non-empty string\")\n\t}\n\tif len(args[20]) <= 0 {\n\t\treturn nil, errors.New(\"10th argument must be a non-empty string\")\n\t}\t\n\tif len(args[21]) <= 0 {\n\t\treturn nil, errors.New(\"10th argument must be a non-empty string\")\n\t}\t\n\n\tshipmentId := args[0]\n\tdescription := args[1]\n\tsender := args[2]\n\tsenderType := args[3]\n\treceiver := args[4] \n\treceiverType := args[5] \n\tFAA_formNumber := args[6]\n\tquantity := args[7]\n\tshipmentDate := args[8]\n\tstatus := \"Created\"\n\tchaincodeURL := args[9]\n\n\tshipFromCity := args[10]\n\tshipFromCountry := args[11]\n\tshipToCity := args[12]\n\tshipToCountry := args[13]\n\ttruckNum := args[14] \n\tlogisticAgencyID := args[15] \n\tairShipWayBillNum := args[16]\n\tflightVesselID := args[17]\n\tdepartingPort := args[18]\n\tarrivingPort := args[19]\n\tdepartureTime := args[20]\n\tarrivalTime := args[21]\n\n\t// Adding Rule for senderType and receiverType\n\tif(senderType == \"Tier-3\" && receiverType != \"Tier-2\"){\n\t\treturn nil,errors.New(\"Tier-3 can send shipment to Tier-2 only\")\n\t}else if(senderType == \"Tier-2\" && receiverType != \"Tier-1\"){\n\t\treturn nil,errors.New(\"Tier-2 can send shipment to Tier-1 only\")\n\t}else if(senderType == \"Tier-1\" && receiverType != \"OEM\"){\n\t\treturn nil,errors.New(\"Tier-1 can send shipment to OEM only\")\n\t}\n\tfmt.Print(\"senderType: \")\n\tfmt.Println(senderType)\n\tfmt.Print(\"receiverType: \")\n\tfmt.Println(receiverType)\n\n\t// calculating available quantity by fetching total approved quantity and quantity from 'manageForm' chaincode\n\tf := \"getForm_byID\"\n\tqueryArgs := util.ToChaincodeArgs(f, FAA_formNumber)\n\tvalueAsBytes, err := stub.QueryChaincode(chaincodeURL, queryArgs)\n\tif err != nil {\n\t\terrStr := fmt.Sprintf(\"Failed to query chaincode. Got error: %s\", err.Error())\n\t\tfmt.Printf(errStr)\n\t\treturn nil, errors.New(errStr)\n\t} \t\n\tfmt.Print(\"valueAsBytes : \")\n\tfmt.Println(valueAsBytes)\n\tjson.Unmarshal(valueAsBytes, &valIndex)\n\tfmt.Print(\"valIndex: \")\n\tfmt.Println(valIndex)\n\t\n\tqty,err := strconv.Atoi(quantity)\n\tif err != nil {\n\t\tfmt.Sprintf(\"Error while converting string 'quantity' to int : %s\", err.Error())\n\t\treturn nil, errors.New(\"Error while converting string 'quantity' to int \")\n\t}\n\tfmt.Print(\"qty: \")\n\tfmt.Println(qty)\n\t// Fetch quantity from form\n\tformQty,err := strconv.Atoi(valIndex.Quantity)\n\tif err != nil {\n\t\treturn nil, errors.New(\"Error while converting string 'form quantity' to int \")\n\t}\n\tfmt.Print(\"formQty: \")\n\tfmt.Println(formQty)\n\t// Fetch Total approved quantity from form\n\t/*approvedQty,err := strconv.Atoi(valIndex.Total_approvedQty)\n\tif err != nil {\n\t\treturn nil, errors.New(\"Error while converting string 'approvedQty' to int \")\n\t}*/\n\n\t//Shipped quantity cannot be greater than Form’s quantity\n\tif(qty > formQty){\n\t\treturn nil,errors.New(\"Shipped quantity cannot be greater than Form’s quantity\")\n\t}\t\n\n\t// fetching shipments from chaincode\n\tShipmentAsBytes, err := stub.GetState(shipmentId) \n\tif err != nil {\n\t\treturn nil, errors.New(\"Failed to get Shipment ID\")\n\t}\n\tfmt.Print(\"ShipmentAsBytes: \")\n\tfmt.Println(ShipmentAsBytes)\n\tres := Shipment{}\n\tjson.Unmarshal(ShipmentAsBytes, &res)\n\tfmt.Print(\"res: \")\n\tfmt.Println(res)\n\t\n\t// Shipments marked “Consumed” cannot be used for creating new Forms\n\tif res.Status == \"Consumed\"{\n\t\tfmt.Println(\"This Shipment is already consumed. New form cannot be created\")\n\t\treturn nil,errors.New(\"New form cannot be created as this Shipment is already consumed.\")\n\t}\n\t\n\t//build the Shipment json string manually\n\tinput := \t`{`+\n\t\t`\"shipmentId\": \"` + shipmentId + `\" , `+\n\t\t`\"description\": \"` + description + `\" , `+ \n\t\t`\"sender\": \"` + sender + `\" , `+\n\t\t`\"senderType\": \"` + senderType + `\" , `+\n\t\t`\"receiver\": \"` + receiver + `\" , `+\n\t\t`\"receiverType\": \"` + receiverType + `\" , `+\n\t\t`\"FAA_formNumber\": \"` + FAA_formNumber + `\" , `+\n\t\t`\"quantity\": \"` + quantity + `\" , `+ \n\t\t`\"shipmentDate\": \"` + shipmentDate + `\" , `+ \n\t\t`\"status\": \"` + status + `\" , `+\n\t\t`\"shipFromCity\": \"` + shipFromCity + `\" , `+\n\t\t`\"shipFromCountry\": \"` + shipFromCountry + `\" , `+\n\t\t`\"shipToCity\": \"` + shipToCity + `\" , `+\n\t\t`\"shipToCountry\": \"` + shipToCountry + `\" , `+\n\t\t`\"truckNum\": \"` + truckNum + `\" , `+\n\t\t`\"logisticAgencyID\": \"` + logisticAgencyID + `\" , `+\n\t\t`\"airShipWayBillNum\": \"` + airShipWayBillNum + `\" , `+\n\t\t`\"flightVesselID\": \"` + flightVesselID + `\" , `+\n\t\t`\"departingPort\": \"` + departingPort + `\" , `+\n\t\t`\"arrivingPort\": \"` + arrivingPort + `\" , `+\n\t\t`\"departureTime\": \"` + departureTime + `\" , `+\n\t\t`\"arrivalTime\": \"` + arrivalTime + `\"`+ \n\t `}`\n\tfmt.Println(\"input: \" + input)\n\tfmt.Print(\"input in bytes array: \")\n\tfmt.Println([]byte(input))\n\terr = stub.PutState(shipmentId, []byte(input))\t\t\t\t\t\t\t\t\t//store Shipment with FAA_FormNumber as key\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t//get the Shipment index\n\tShipmentIndexAsBytes, err := stub.GetState(ShipmentIndexStr)\n\tif err != nil {\n\t\treturn nil, errors.New(\"Failed to get Shipment index\")\n\t}\n\tvar ShipmentIndex []string\n\tfmt.Print(\"ShipmentIndexAsBytes: \")\n\tfmt.Println(ShipmentIndexAsBytes)\n\t\n\tjson.Unmarshal(ShipmentIndexAsBytes, &ShipmentIndex)\t\t\t\t\t\t\t//un stringify it aka JSON.parse()\n\tfmt.Print(\"ShipmentIndex after unmarshal..before append: \")\n\tfmt.Println(ShipmentIndex)\n\t//append\n\tShipmentIndex = append(ShipmentIndex, shipmentId)\t\t\t\t\t\t\t\t\t//add Shipment transID to index list\n\tfmt.Println(\"! Shipment index after appending shipmentId: \", ShipmentIndex)\n\tjsonAsBytes, _ := json.Marshal(ShipmentIndex)\n\tfmt.Print(\"jsonAsBytes: \")\n\tfmt.Println(jsonAsBytes)\n\terr = stub.PutState(ShipmentIndexStr, jsonAsBytes)\t\t\t\t\t\t//store name of Shipment\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfmt.Println(\"Shipment created successfully.\")\n\t// calculate quantity left after shipment creation\n\tvar remainingQty int\n\tremainingQty = formQty - qty\n\n\tfmt.Print(\"remainingQty : \")\n\tfmt.Println(remainingQty)\n\t// Forms should be updated to reflect the actual quantity left after shipment\n\tfunction := \"update_Form\"\n\tinvokeArgs := util.ToChaincodeArgs(function, FAA_formNumber,strconv.Itoa(remainingQty),senderType)\n\tvalAsBytes, err := stub.InvokeChaincode(chaincodeURL, invokeArgs)\n\tif err != nil {\n\t\terrStr := fmt.Sprintf(\"Failed to query chaincode. Got error: %s\", err.Error())\n\t\tfmt.Printf(errStr)\n\t\treturn nil, errors.New(errStr)\n\t}\n\tfmt.Print(\"valAsBytes : \")\n\tfmt.Println(valAsBytes)\n\tfmt.Printf(\"Form updated successfully after successful Shipment creation.\")\n\treturn nil, nil\n}", "title": "" }, { "docid": "3ec6556dc2a3b447d3affa265fd06655", "score": "0.49871752", "text": "func (f *FakeUtxoVM) Transfer(from string, to string, t *testing.T, amount string, preHash []byte, desc []byte, frozenHeight int64) (*pb.InternalBlock, []*pb.Transaction, *pb.Transaction, error) {\n\tledger := f.L\n\ttxlist, tx, ecdsdPk, err := f.GenerateTx(from, to, t, amount, preHash, desc, frozenHeight)\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\tt.Logf(\"txs after GenerateTx %d\", len(txlist))\n\tblock, _ := ledger.FormatBlock(txlist, []byte(\"miner-1\"), ecdsdPk, 123456789, 0, 0, preHash, f.U.GetTotal())\n\tconfirmStatus := ledger.ConfirmBlock(block, false)\n\tif !confirmStatus.Succ {\n\t\tt.Log(\"confirmStatus\", confirmStatus)\n\t\treturn nil, nil, nil, errors.New(\"fail to confirm block\")\n\t}\n\treturn block, txlist, tx, nil\n}", "title": "" }, { "docid": "d0a32713bbcb6e44bd17b5f72349a1c0", "score": "0.49554178", "text": "func (this *UserController) CreateShipper() {\n\tdefer this.ServeJSON()\n\tvar ship models.Shipper\n\ttypeid := this.Ctx.Request.Header.Get(\"Type\")\n\tif typeid != \"0\" {\n\t\tthis.Data[\"json\"] = responses.ResShipper{\n\t\t\tData: []models.Shipper{},\n\t\t\tError: responses.NewErr(responses.UnSuccess),\n\t\t}\n\t\treturn\n\t}\n\treq := requests.CreateShipper{}\n\terr := json.Unmarshal(this.Ctx.Input.RequestBody, &req)\n\tif err != nil {\n\t\tthis.Data[\"json\"] = \"\"\n\t\treturn\n\t}\n\t_, err = ship.CreateShipper(req)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tthis.Data[\"json\"] = responses.ResShipper{\n\t\t\tData: []models.Shipper{},\n\t\t\tError: responses.NewErr(responses.UnSuccess),\n\t\t}\n\t\treturn\n\t}\n\tthis.Data[\"json\"] = \"\"\n\treturn\n}", "title": "" }, { "docid": "8302939fcc42e1a1526d244fee5d4eaf", "score": "0.4934479", "text": "func (_BaseContentSpace *BaseContentSpaceCaller) WalletFactory(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseContentSpace.contract.Call(opts, &out, \"walletFactory\")\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": "c3c12734320ff830649390f5c6e93923", "score": "0.493409", "text": "func (_SushiV2Factory *SushiV2FactoryTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _SushiV2Factory.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "5100c3294c2af35d55309e43fcc347a3", "score": "0.4919762", "text": "func (_SushiV2Factory *SushiV2FactoryRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _SushiV2Factory.Contract.SushiV2FactoryTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "780d1a45c2ae6103089dc3b8dada9fb7", "score": "0.4894319", "text": "func (_BaseGroupFactory *BaseGroupFactoryTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) {\n\treturn _BaseGroupFactory.contract.Transact(opts, \"transferOwnership\", newOwner)\n}", "title": "" }, { "docid": "f3e002aa686f5e0c8636f824c69a247f", "score": "0.48903617", "text": "func (t *SimpleChaincode) addNewShipment(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {\n\tvar err error\n\tvar jsonResp string\n\t//,jsonResp string\n\t\n\t// 0 1 2 3\n\t// \"asdf\", \"blue\", \"35\", \"bob\"\n\tif len(args) != 3 {\n\t\treturn nil, errors.New(\"Incorrect number of arguments. Expecting 9\")\n\t}\n\tfmt.Println(\"- adding new Shipment\")\n\tfmt.Println(\"CurrentOwner-\"+args[0])\n\t\n\t\n\t/*if len(args[0]) <= 0 {\n\t\treturn nil, errors.New(\"1st argument must be a non-empty string\")\n\t}\n\tif len(args[1]) <= 0 {\n\t\treturn nil, errors.New(\"2nd argument must be a non-empty string\")\n\t}\n\tif len(args[2]) <= 0 {\n\t\treturn nil, errors.New(\"3rd argument must be a non-empty string\")\n\t}\n\tif len(args[3]) <= 0 {\n\t\treturn nil, errors.New(\"4th argument must be a non-empty string\")\n\t}*/\n\tNewShipment := Shipment{}\n\n\tNewShipment.CurrentOwner = args[0]\n\t\n\tNewShipment.MaximumTemperatureRecorded, err =strconv.Atoi(args[1])\n\t\n\tif err != nil {\n\t\treturn nil, errors.New(\"Maximum temperature Recorded must be a numeric string\")\n\t}\n\tNewShipment.TemperatureThreshold, err = strconv.Atoi(args[2])\n\t\n\tif err != nil {\n\t\treturn nil, errors.New(\"TemperatureThreshold must be a numeric string\")\n\t}\n\n\tfmt.Println(\"adding Shipment @ \" + NewShipment.CurrentOwner + \", \" + strconv.Itoa(NewShipment.MaximumTemperatureRecorded)+ \", \" + strconv.Itoa(NewShipment.TemperatureThreshold));\n\tfmt.Println(\"- end adding new Shipment\")\n\tjsonAsBytes, _ := json.Marshal(NewShipment)\n\n\tif err != nil {\n\t\treturn jsonAsBytes, err\n\t}\n\t//Added for test purpose\n\terr = stub.PutState(\"BlueShipment\", jsonAsBytes)\t//store shipment\n\t\n\tif err != nil {\t\n\t\tjsonResp = \"{\\\"Error\\\":\\\"Failed to Add new Shipment\" + \"\\\"}\"\n\t\treturn jsonAsBytes, errors.New(jsonResp)\n\t}\t\n\t\n\tfmt.Println(\"- end addShipment\")\n\treturn jsonAsBytes, nil\n}", "title": "" }, { "docid": "ab39008dec137b3f593fc5c2e690c2f2", "score": "0.48816088", "text": "func (_SushiV2Factory *SushiV2FactoryCallerSession) Migrator() (common.Address, error) {\n\treturn _SushiV2Factory.Contract.Migrator(&_SushiV2Factory.CallOpts)\n}", "title": "" }, { "docid": "22a8b6d0a3279028ce2f07e33cab2f02", "score": "0.48815957", "text": "func (t *Shipments) createShipment(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tvar err error\n\tif len(args) != 5 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting 5\")\n\t}\n\n\tfmt.Println(\" - start create shipment\")\n\t// ====== Input sanitation ======\n\tif len(args[0]) <= 0 {\n\t\treturn shim.Error(\"1st argument must be a non-empty string\")\n\t}\n\tif len(args[1]) <= 0 {\n\t\treturn shim.Error(\"2nd argument must be a non-empty string\")\n\t}\n\tif len(args[2]) <= 0 {\n\t\treturn shim.Error(\"3rd argument must be a non-empty string\")\n\t}\n\tif len(args[3]) <= 0 {\n\t\treturn shim.Error(\"4th argument must be a non-empty string\")\n\t}\n\tif len(args[4]) <= 0 {\n\t\treturn shim.Error(\"5th argument must be a non-empty string\")\n\t}\n\n\tshipment_id := args[0]\n\tstatus := \"New\"\n\tsupplier_load_flag := \"N\"\n\tsupplier_load_date := \"NA\"\n\tsupplier_supporting_doc_name := \"NA\"\n\tsupplier_load_quantity := \"NA\"\n\tcontainer_arrival_flag := \"N\"\n\tcontainer_arrival_date := \"NA\"\n\tcontainer_arrival_doc_name := \"NA\"\n\tload_to_ship_flag := \"N\"\n\tcontainer_load_date := \"NA\"\n\tcontainer_load_doc_name := \"NA\"\n\tship_arrival_flag := \"N\"\n\tship_arrival_date := \"NA\"\n\tship_arrival_doc_name := \"NA\"\n\tcontainer_offload_flag := \"N\"\n\tcontainer_offload_date := \"NA\"\n\tcontainer_offload_doc_name := \"NA\"\n\tbunkering_ready_flag := \"N\"\n\tbunkering_ready_date := \"NA\"\n\tbunkering_ready_doc_name := \"NA\"\n\tbunkering_complete_flag := \"N\"\n\tbunkering_complete_date := \"NA\"\n\tbunkering_complete_doc_name := \"NA\"\n\tcustomer_handover_flag := \"N\"\n\tcustomer_handover_date := \"NA\"\n\tcustomer_handover_doc_name := \"NA\"\n\tcustomer_quantity := args[2]\n\tctid := args[1]\n\tdrid := strings.Replace(ctid,\"CT\",\"DR\",1)\n\t// fetch Demand Request details from DRID\n\tf := \"getDemandRequestByID\"\n\tqueryArgs := util.ToChaincodeArgs(f, drid)\n\n\t// if chaincode being invoked is on the same channel,\n\t// then channel defaults to the current channel and args[2] can be \"\".\n\t// If the chaincode being called is on a different channel,\n\t// then you must specify the channel name in args[2]\n\n\tdemandRequestResponse := stub.InvokeChaincode(\"DemandRequestCC\", queryArgs, \"\")\n\tif demandRequestResponse.Status != shim.OK {\n\t\terrStr := fmt.Sprintf(\"Failed to query chaincode. Got error: %s\", demandRequestResponse.Payload)\n\t\tfmt.Printf(errStr)\n\t\treturn shim.Error(errStr)\n\t}\n\tdemandRequests := DemandRequest{}\n\tjson.Unmarshal(demandRequestResponse.Payload, &demandRequests)\n\tfmt.Print(\"demandRequests : \")\n\tfmt.Println(demandRequests)\n\tcustomer_id := demandRequests.Customer_Id\n\t// fetch confirmed Demand Request details from Customer Id\n\tf1 := \"getConfirmedTradeForCustomer\"\n\tquery_Args := util.ToChaincodeArgs(f1, ctid)\n\n\t// if chaincode being invoked is on the same channel,\n\t// then channel defaults to the current channel and args[2] can be \"\".\n\t// If the chaincode being called is on a different channel,\n\t// then you must specify the channel name in args[2]\n\n\tconfirmedTradeResponse := stub.InvokeChaincode(\"DemandRequestCC\", query_Args, \"\")\n\tif confirmedTradeResponse.Status != shim.OK {\n\t\terrStr := fmt.Sprintf(\"Failed to query chaincode. Got error: %s\", confirmedTradeResponse.Payload)\n\t\tfmt.Printf(errStr)\n\t\treturn shim.Error(errStr)\n\t}\n\tconfirmedTrade := ConfirmedTrade{}\n\tjson.Unmarshal(confirmedTradeResponse.Payload, &confirmedTrade)\n\tfmt.Print(\"confirmedTrade : \")\n\tfmt.Println(confirmedTrade)\n\ttransporter_id := confirmedTrade.Transporter_Name\n\tsupplier_id := confirmedTrade.Supplier_Name\n\tupdated_by := args[3]\n\tlast_update_date := args[4]\n\n\t// ==== Check if shipment already exists ====\n\tShipmentAsBytes, err := stub.GetState(shipment_id)\n\tif err != nil {\n\t\treturn shim.Error(\"Failed to get shipment: \" + err.Error())\n\t} else if ShipmentAsBytes != nil {\n\t\teventMessage := \"{ \\\"Shipment_ID\\\" : \\\"\"+shipment_id+\"\\\", \\\"message\\\" : \\\"This shipment already exists\\\", \\\"code\\\" : \\\"503\\\"}\"\n\t err = stub.SetEvent(\"errEvent\", []byte(eventMessage))\n\t if err != nil {\n\t return shim.Error(err.Error())\n\t }\n\t\tfmt.Println(\"This shipment already exists: \" + shipment_id)\n\t\treturn shim.Error(eventMessage)\n\t}\n\n\t// ==== marshal to JSON ====\n\tShipment := &Shipment{shipment_id, status, supplier_load_flag, supplier_load_date, supplier_supporting_doc_name, supplier_load_quantity, container_arrival_flag, container_arrival_date, container_arrival_doc_name, load_to_ship_flag, container_load_date, container_load_doc_name, ship_arrival_flag, ship_arrival_date, ship_arrival_doc_name, container_offload_flag, container_offload_date, container_offload_doc_name, bunkering_ready_flag, bunkering_ready_date, bunkering_ready_doc_name, bunkering_complete_flag, bunkering_complete_date, bunkering_complete_doc_name, customer_handover_flag, customer_handover_date, customer_handover_doc_name, customer_quantity, ctid, drid,customer_id, transporter_id, supplier_id, updated_by, last_update_date}\n\tShipmentJSONasBytes, err := json.Marshal(Shipment)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\tfmt.Println(Shipment)\n\n\t// === Save shipment to state ===\n\terr = stub.PutState(shipment_id, ShipmentJSONasBytes)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\t//get the shipment index\n ShipmentIndexAsBytes, err := stub.GetState(ShipmentIndexStr)\n if err != nil {\n return shim.Error(err.Error())\n }\n var ShipmentIndex []string\n\n json.Unmarshal(ShipmentIndexAsBytes, &ShipmentIndex) //un stringify it aka JSON.parse()\n fmt.Print(\"ShipmentIndex: \")\n fmt.Println(ShipmentIndex)\n //append\n ShipmentIndex = append(ShipmentIndex, shipment_id)\n //add \"standard shipment ID\" to index list\n jsonAsBytes, _ := json.Marshal(ShipmentIndex)\n //store \"standard shipment ID\" of shipment\n err = stub.PutState(ShipmentIndexStr, jsonAsBytes)\n if err != nil {\n return shim.Error(err.Error())\n }\n\n eventMessage := \"{ \\\"Shipment_ID\\\" : \\\"\"+shipment_id+\"\\\", \\\"message\\\" : \\\"Shipment created succcessfully\\\", \\\"code\\\" : \\\"200\\\"}\"\n err = stub.SetEvent(\"evtsender\", []byte(eventMessage))\n if err != nil {\n return shim.Error(err.Error())\n }\n\n // ==== shipment saved and indexed. Return success ====\n\tfmt.Println(\"- end create shipment\")\n\treturn shim.Success(nil)\n}", "title": "" }, { "docid": "6459b9d0c4dd48b6b538a08d40b1f1d2", "score": "0.48555005", "text": "func (_IUniswapV2Pair *IUniswapV2PairCaller) Factory(opts *bind.CallOpts) (common.Address, error) {\r\n\tvar out []interface{}\r\n\terr := _IUniswapV2Pair.contract.Call(opts, &out, \"factory\")\r\n\r\n\tif err != nil {\r\n\t\treturn *new(common.Address), err\r\n\t}\r\n\r\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\r\n\r\n\treturn out0, err\r\n\r\n}", "title": "" }, { "docid": "ff88e6d7b4e500d4c5d3725b0ee85fe1", "score": "0.48530623", "text": "func (_ProjectWalletAuthoriser *ProjectWalletAuthoriserTransactor) Transfer(opts *bind.TransactOpts, _sender common.Address, _receiver common.Address, _amt *big.Int) (*types.Transaction, error) {\n\treturn _ProjectWalletAuthoriser.contract.Transact(opts, \"transfer\", _sender, _receiver, _amt)\n}", "title": "" }, { "docid": "488f64ebbcde8cccc9a6c63f5db8819b", "score": "0.4830699", "text": "func RegisterCreator(name string, gc Creator) {\n\tif _, ok := creators[name]; ok {\n\t\tlog.Fatalf(\"Gateway %s already exists\", name)\n\t}\n\tcreators[name] = gc\n}", "title": "" }, { "docid": "41d39627925076c1cb602a930e983a56", "score": "0.48238698", "text": "func (_BaseLibraryFactory *BaseLibraryFactoryTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) {\n\treturn _BaseLibraryFactory.contract.Transact(opts, \"transferOwnership\", newOwner)\n}", "title": "" }, { "docid": "441a1d395204c43db1318a0d3525c81a", "score": "0.48027244", "text": "func (_ProjectWalletAuthoriser *ProjectWalletAuthoriserTransactorSession) Transfer(_sender common.Address, _receiver common.Address, _amt *big.Int) (*types.Transaction, error) {\n\treturn _ProjectWalletAuthoriser.Contract.Transfer(&_ProjectWalletAuthoriser.TransactOpts, _sender, _receiver, _amt)\n}", "title": "" }, { "docid": "16f58958edac588a3ab2c21093f514ea", "score": "0.47928596", "text": "func CreateSwapRequest(args *SwapArguments) []byte {\n\tlog.Debug(\"swap args\", \"args\", args)\n\n\tconv := convert.NewConvert()\n\n\tpartyKey := GetAccountKey(args.Party)\n\tcounterPartyKey := GetAccountKey(args.CounterParty)\n\n\tsigners := GetSigners()\n\n\tfee := conv.GetCoin(args.Fee, \"OLT\")\n\tgas := conv.GetCoin(args.Gas, \"OLT\")\n\tamount := conv.GetCoin(args.Amount, args.Currency)\n\texchange := conv.GetCoin(args.Exchange, args.Excurrency)\n\n\tif conv.HasErrors() {\n\t\tConsole.Error(conv.GetErrors())\n\t\tos.Exit(-1)\n\t}\n\taccount := make(map[data.ChainType]string)\n\tcounterAccount := make(map[data.ChainType]string)\n\t//todo: change the correct bitcoin address\n\t//account[data.BITCOIN] = string(partyKey)\n\t//account[data.ETHEREUM] = ethereum.GetAddress().String()\n\taccount[data.BITCOIN] = \"bitcoin\"\n\taccount[data.ETHEREUM] = \"ethereum\"\n\n\tparty := action.Party{Key: partyKey, Accounts: account}\n\tcounterParty := action.Party{Key: counterPartyKey, Accounts: counterAccount}\n\n\tswap := &action.Swap{\n\t\tBase: action.Base{\n\t\t\tType: action.SWAP,\n\t\t\tChainId: app.ChainId,\n\t\t\tSigners: signers,\n\t\t\tOwner: partyKey,\n\t\t\tSequence: global.Current.Sequence,\n\t\t},\n\t\tParty: party,\n\t\tCounterParty: counterParty,\n\t\tFee: fee,\n\t\tGas: gas,\n\t\tAmount: amount,\n\t\tExchange: exchange,\n\t\tNonce: args.Nonce,\n\t}\n\n\treturn SignAndPack(action.SWAP, action.Transaction(swap))\n}", "title": "" }, { "docid": "ade0d0125503a763e18c0fe4a376567d", "score": "0.47807834", "text": "func (_IUniswapV2Router01 *IUniswapV2Router01Caller) Factory(opts *bind.CallOpts) (common.Address, error) {\r\n\tvar out []interface{}\r\n\terr := _IUniswapV2Router01.contract.Call(opts, &out, \"factory\")\r\n\r\n\tif err != nil {\r\n\t\treturn *new(common.Address), err\r\n\t}\r\n\r\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\r\n\r\n\treturn out0, err\r\n\r\n}", "title": "" }, { "docid": "5b0390df59a5d6b5c7f62933b57c2ff7", "score": "0.47615048", "text": "func NewTransferCaller(address common.Address, caller bind.ContractCaller) (*TransferCaller, error) {\n\tcontract, err := bindTransfer(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &TransferCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "79703f41f1bf694cfe600715d6925c47", "score": "0.47565344", "text": "func (_BaseContentFactory *BaseContentFactoryTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) {\n\treturn _BaseContentFactory.contract.Transact(opts, \"transferOwnership\", newOwner)\n}", "title": "" }, { "docid": "a632656f699a3c2b54cd7b9c02af6833", "score": "0.47538453", "text": "func (_SushiV2Factory *SushiV2FactorySession) Migrator() (common.Address, error) {\n\treturn _SushiV2Factory.Contract.Migrator(&_SushiV2Factory.CallOpts)\n}", "title": "" }, { "docid": "31e172f45bb54c279eec4110bbb2514e", "score": "0.4745305", "text": "func (_BaseContentFactoryExt *BaseContentFactoryExtTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) {\n\treturn _BaseContentFactoryExt.contract.Transact(opts, \"transferOwnership\", newOwner)\n}", "title": "" }, { "docid": "416a8e1459121d53e4cbfe8e32313f4c", "score": "0.47374964", "text": "func TestUpdCreator(t *testing.T) {\n\tmeta := spdx.NewMeta(3, 4)\n\ta := spdx.NewValueCreator(\"\", nil)\n\tf := updCreator(&a)\n\terr := f(tk(\"Tool: spdx-go\", meta))\n\tif err != nil {\n\t\tt.Errorf(\"Unexpected error %s\", err)\n\t}\n\tsameSpdx(t, a, spdx.NewValueCreator(\"Tool: spdx-go\", meta))\n\terr = f(tk(\"Person: Mr. Tester\", nil))\n\tif err == nil || err.Error() != MsgAlreadyDefined {\n\t\tt.Errorf(\"Incorrect error %+v\", err)\n\t}\n}", "title": "" }, { "docid": "2bd3d783fc58dd56c14b2e7072d19b41", "score": "0.47310323", "text": "func (me TxsdContactRole) IsCreator() bool { return me.String() == \"creator\" }", "title": "" }, { "docid": "b5560be4924bf14cff8edf554e2f06e9", "score": "0.47309065", "text": "func (*instance) createTransfer(address trinary.Hash, message trinary.Trytes) bundle.Transfer {\n\treturn bundle.Transfer{\n\t\tAddress: address,\n\t\tMessage: message,\n\t\tValue: 0,\n\t}\n}", "title": "" }, { "docid": "d2aea092ffc53b2c4fd50c92eb8096f3", "score": "0.4720353", "text": "func (_ProjectWalletAuthoriser *ProjectWalletAuthoriserSession) Transfer(_sender common.Address, _receiver common.Address, _amt *big.Int) (*types.Transaction, error) {\n\treturn _ProjectWalletAuthoriser.Contract.Transfer(&_ProjectWalletAuthoriser.TransactOpts, _sender, _receiver, _amt)\n}", "title": "" }, { "docid": "91c5f5eea02201c9a79c749e76cb5036", "score": "0.469492", "text": "func (s *SmartContract) createShipment(APIstub shim.ChaincodeStubInterface, args []string) sc.Response {\n\tvar shipment = Shipment{Identity: \"4F30880E84638F3B4F2DCFE3CC53022CCAE10D491689E0DAC13B85C9C3A8F0E7\", Name: \"very expensive material 100098\", Latitude: \"50.936508\", Lognitude: \"6.939782\", Value: \"200.00\", Status: \"waiting for carrier\", ShipperId: \"awesome shipper\", CarrierId: \"\"}\n\n\tshipmentAsBytes, _ := json.Marshal(shipment)\n\n\tvar keyId = random(10, 999)\n\tAPIstub.PutState(\"SHIPMENT\"+strconv.Itoa(keyId), shipmentAsBytes)\n\n\treturn shim.Success(nil)\n}", "title": "" }, { "docid": "3e0c7b84eca8c0aed09334f507fc8d2b", "score": "0.46909812", "text": "func (_Univ2 *Univ2Caller) Factory(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Univ2.contract.Call(opts, &out, \"factory\")\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": "f4e24a4ef420eef40f1594cc80be0b94", "score": "0.46769884", "text": "func (_Caller *CallerRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Caller.Contract.CallerTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "462dd973fa2d113b817f09006d3d8612", "score": "0.46758166", "text": "func (_BaseContentSpace *BaseContentSpaceCaller) Factory(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseContentSpace.contract.Call(opts, &out, \"factory\")\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": "a2697cb54b9650394b8863fc9c807dff", "score": "0.46720928", "text": "func (_UniswapV2Router02 *UniswapV2Router02Caller) Factory(opts *bind.CallOpts) (common.Address, error) {\r\n\tvar out []interface{}\r\n\terr := _UniswapV2Router02.contract.Call(opts, &out, \"factory\")\r\n\r\n\tif err != nil {\r\n\t\treturn *new(common.Address), err\r\n\t}\r\n\r\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\r\n\r\n\treturn out0, err\r\n\r\n}", "title": "" }, { "docid": "433d2830aa10cd8305a6d726ce014d05", "score": "0.46575302", "text": "func (_DelegateProfile *DelegateProfileTransactor) TransferOwnership(opts *bind.TransactOpts, _newOwner common.Address) (*types.Transaction, error) {\n\treturn _DelegateProfile.contract.Transact(opts, \"transferOwnership\", _newOwner)\n}", "title": "" }, { "docid": "90193a0d39d8493bcdba1222dc2c7d3f", "score": "0.4655011", "text": "func (_IUniswapV2Router02 *IUniswapV2Router02Caller) Factory(opts *bind.CallOpts) (common.Address, error) {\r\n\tvar out []interface{}\r\n\terr := _IUniswapV2Router02.contract.Call(opts, &out, \"factory\")\r\n\r\n\tif err != nil {\r\n\t\treturn *new(common.Address), err\r\n\t}\r\n\r\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\r\n\r\n\treturn out0, err\r\n\r\n}", "title": "" }, { "docid": "e8e1e3678666cfedd0b5833e55cdefa3", "score": "0.46458524", "text": "func createNewUFA(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {\r\n\tlogger.Info(\"createNewUFA called\")\r\n\r\n\tufanumber := args[0]\r\n\twho := args[1]\r\n\tpayload := args[2]\r\n\tfmt.Println(\"new Payload is \" + payload)\r\n\t//If there is no error messages then create the UFA\r\n\tvalMsg := validateNewUFA(who, payload)\r\n\tif valMsg == \"\" {\r\n\t\tvar ufaDetails map[string]string\r\n\t\tjson.Unmarshal([]byte(payload), &ufaDetails)\r\n\t\tlineItem := ufaDetails[\"lineItems\"]\r\n\t\tdelete(ufaDetails, \"lineItems\")\r\n\t\tvar lineItems []map[string]string\r\n\t\tvar lineId []map[string]string\r\n\t\tjson.Unmarshal([]byte(lineItem), &lineItems)\r\n\t\tfor _, value := range lineItems {\r\n\t\t\tvar line map[string]string = value\r\n\t\t\tfor key, value := range line {\r\n\t\t\t\tif key == \"chargeLineId\" {\r\n\t\t\t\t\tm := make(map[string]string)\r\n\t\t\t\t\tm[\"chargeLineId\"] = value\r\n\t\t\t\t\tlineId = append(lineId, m)\r\n\r\n\t\t\t\t\tsrc_json, _ := json.Marshal(line)\r\n\t\t\t\t\tstub.PutState(value, []byte(src_json))\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t//fmt.Println(\"lineids are:\"+(string)(lineIdData))\r\n\t\tlineIdData, _ := json.Marshal(lineId)\r\n\t\tufaDetails[\"lineItemsId\"] = ((string)(lineIdData))\r\n\t\tfmt.Println(\"lineids are:\" + (string)(lineIdData))\r\n\t\tnew_json, _ := json.Marshal(ufaDetails)\r\n\t\tfmt.Println(\"new Json is\" + (string)(new_json))\r\n\t\tstub.PutState(ufanumber, []byte(new_json))\r\n\r\n\t\tupdateMasterRecords(stub, ufanumber)\r\n\t\tappendUFATransactionHistory(stub, ufanumber, payload)\r\n\t\tlogger.Info(\"Created the UFA after successful validation : \" + payload)\r\n\t} else {\r\n\t\treturn nil, errors.New(\"Validation failure: \" + valMsg)\r\n\t}\r\n\treturn nil, nil\r\n}", "title": "" }, { "docid": "372bcc4b2349da2b5cf44eacc626bcef", "score": "0.46438524", "text": "func Transfer(\n\tctx *vm.Context, db vm.StateDB, sender, recipient types.AddressHash, amount *big.Int,\n) {\n\t// NOTE: amount is a re-used pointer varaible\n\tdb.SubBalance(sender, amount)\n\tdb.AddBalance(recipient, amount)\n\tif db.IsContractAddr(sender) && amount.Uint64() > 0 {\n\t\ttransferInfo := vm.NewTransferInfo(sender, recipient, amount.Uint64())\n\t\tlogger.Debugf(\"new transfer info: sender: %x, recipient: %x, amount: %d\",\n\t\t\tsender[:], recipient[:], amount)\n\t\tif v, ok := ctx.Transfers[sender]; ok {\n\t\t\t// if sender and recipient already exists in Transfers, update it instead\n\t\t\t// of append to it\n\t\t\tfor _, w := range v {\n\t\t\t\tif w.To == recipient {\n\t\t\t\t\t// NOTE: cannot miss 'w.value = '\n\t\t\t\t\tw.Value += amount.Uint64()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tctx.Transfers[sender] = append(ctx.Transfers[sender], transferInfo)\n\t}\n}", "title": "" }, { "docid": "c84c08eaf5b38fa237b451c109227ea1", "score": "0.46423107", "text": "func (_Storage *StorageTransactor) TransferOwner(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) {\n\treturn _Storage.contract.Transact(opts, \"transferOwner\", newOwner)\n}", "title": "" }, { "docid": "3b7ff65b29580df09931a45296ba877d", "score": "0.46291205", "text": "func transfer(\n\ttrx storage.Transaction,\n\tpreviousTxId merkle.Digest,\n\ttransferTxId merkle.Digest,\n\ttransferBlockNumber uint64,\n\n\tcurrentOwner *account.Account,\n\tnewOwner *account.Account,\n\tquantity uint64,\n) {\n\t// get count for current owner record\n\tdKey := append(currentOwner.Bytes(), previousTxId[:]...)\n\tdCount := trx.Get(storage.Pool.OwnerTxIndex, dKey)\n\tif nil == dCount {\n\t\tlogger.Criticalf(\"ownership.Transfer: dKey: %x\", dKey)\n\t\tlogger.Criticalf(\"ownership.Transfer: block number: %d\", transferBlockNumber)\n\t\tlogger.Criticalf(\"ownership.Transfer: previous tx id: %#v\", previousTxId)\n\t\tlogger.Criticalf(\"ownership.Transfer: transfer tx id: %#v\", transferTxId)\n\t\tlogger.Criticalf(\"ownership.Transfer: current owner: %x %v\", currentOwner.Bytes(), currentOwner)\n\t\tif nil != newOwner {\n\t\t\tlogger.Criticalf(\"ownership.Transfer: new owner: %x %v\", newOwner.Bytes(), newOwner)\n\t\t}\n\n\t\t// ow, err := listBitmarksFor(currentOwner, 0, 999)\n\t\t// if nil != err {\n\t\t// \tlogger.Criticalf(\"lbf: error: %s\", err)\n\t\t// } else {\n\t\t// \tlogger.Criticalf(\"lbf: %#v\", ow)\n\t\t// }\n\n\t\tlogger.Panic(\"ownership.Transfer: OwnerTxIndex database corrupt\")\n\t}\n\n\t// delete the current owners records\n\townerData, err := GetOwnerData(trx, previousTxId, storage.Pool.OwnerData)\n\tif nil != err {\n\t\tlogger.Criticalf(\"ownership.Transfer: invalid owner data for tx id: %s error: %s\", previousTxId, err)\n\t\tlogger.Panic(\"ownership.Transfer: Ownership database corrupt\")\n\t}\n\n\toKey := append(currentOwner.Bytes(), dCount...)\n\ttrx.Delete(storage.Pool.OwnerList, oKey)\n\ttrx.Delete(storage.Pool.OwnerTxIndex, dKey)\n\n\t// and the old owner data\n\ttrx.Delete(storage.Pool.OwnerData, previousTxId[:])\n\n\t// if no new owner only above delete was needed\n\tif nil == newOwner && 0 == quantity {\n\t\treturn\n\t}\n\n\tswitch ownerData := ownerData.(type) {\n\n\tcase *AssetOwnerData:\n\n\t\t// create a share - only from an asset\n\t\tif 0 != quantity {\n\n\t\t\t// convert initial quantity to 8 byte big endian\n\t\t\tquantityBytes := make([]byte, 8)\n\t\t\tbinary.BigEndian.PutUint64(quantityBytes, quantity)\n\n\t\t\t// the ID of the share is the issue id of the bitmark\n\t\t\tshareId := ownerData.issueTxId\n\n\t\t\t// the total quantity of this type of share\n\t\t\tshareData := append(quantityBytes, transferTxId[:]...)\n\t\t\ttrx.Put(storage.Pool.Shares, shareId[:], shareData, []byte{})\n\n\t\t\t// initially total quantity goes to the creator\n\t\t\tfKey := append(currentOwner.Bytes(), shareId[:]...)\n\t\t\ttrx.Put(storage.Pool.ShareQuantity, fKey, quantityBytes, []byte{})\n\n\t\t\t// convert to share and update\n\t\t\tnewOwnerData := ShareOwnerData{\n\t\t\t\ttransferBlockNumber: transferBlockNumber,\n\t\t\t\tissueTxId: ownerData.issueTxId,\n\t\t\t\tissueBlockNumber: ownerData.issueBlockNumber,\n\t\t\t\tassetId: ownerData.assetId,\n\t\t\t}\n\t\t\tcreate(trx, transferTxId, newOwnerData, currentOwner)\n\t\t\treturn\n\t\t}\n\n\t\t// otherwise create new ownership record\n\t\townerData.transferBlockNumber = transferBlockNumber\n\t\tcreate(trx, transferTxId, ownerData, newOwner)\n\n\tcase *BlockOwnerData:\n\t\t// create a share - only from an asset\n\t\tif 0 != quantity {\n\n\t\t\t// panic if not an asset (this should have been checked earlier)\n\t\t\tlogger.Criticalf(\"ownership.Transfer: ownerData for key: %x is not an asset\", oKey)\n\t\t\tlogger.Panic(\"ownership.Transfer: Ownership database corrupt\")\n\t\t}\n\n\t\t// otherwise create new ownership record\n\t\townerData.transferBlockNumber = transferBlockNumber\n\t\tcreate(trx, transferTxId, ownerData, newOwner)\n\n\tcase *ShareOwnerData:\n\n\t\t// create a share - only from an asset\n\t\tif 0 != quantity {\n\n\t\t\t// panic if not an asset (this should have been checked earlier)\n\t\t\tlogger.Criticalf(\"ownership.Transfer: ownerData for key: %x is not an asset\", oKey)\n\t\t\tlogger.Panic(\"ownership.Transfer: Ownership database corrupt\")\n\t\t}\n\n\t\t// Note: only called on delete (block/store.go prevents share back to asset)\n\n\t\t// convert to transfer and update\n\t\tnewOwnerData := AssetOwnerData{\n\t\t\ttransferBlockNumber: transferBlockNumber,\n\t\t\tissueTxId: ownerData.issueTxId,\n\t\t\tissueBlockNumber: ownerData.issueBlockNumber,\n\t\t\tassetId: ownerData.assetId,\n\t\t}\n\t\tcreate(trx, transferTxId, newOwnerData, currentOwner)\n\n\tdefault:\n\t\t// panic if not an asset (this should have been checked earlier)\n\t\tlogger.Criticalf(\"ownership.Transfer: unhandled owner data type: %+v\", ownerData)\n\t\tlogger.Panic(\"ownership.Transfer: missing owner data handler\")\n\t}\n}", "title": "" }, { "docid": "680fe0e00cfdd2254c508eb15bfba5c0", "score": "0.46154764", "text": "func (_IUniswapV2Pair *IUniswapV2PairCallerSession) Factory() (common.Address, error) {\r\n\treturn _IUniswapV2Pair.Contract.Factory(&_IUniswapV2Pair.CallOpts)\r\n}", "title": "" }, { "docid": "d836fc24ee11cb2c3e55dbec24dc4286", "score": "0.46008056", "text": "func (k Keeper) PerformBuyCreatorCoin(\n\tctx sdk.Context,\n\tusername string,\n\tcreator sdk.AccAddress,\n\tbuyer sdk.AccAddress,\n\tvalAddr sdk.ValAddress,\n\tamount sdk.Int) error {\n\n\tcoin := sdk.NewCoin(fmt.Sprintf(\"cc/%s/%s\", username, creator.String()), amount)\n\n\tstake, found, err := k.GetStake(ctx, 0, curatingtypes.PostID{}, buyer)\n\tif err != nil {\n\t\treturn err\n\t}\n\tamt := amount\n\tif found {\n\t\tamt = stake.Amount.Add(amount)\n\t\t// shadow valAddr so we don't mix validators when adding stake\n\t\tvalAddr, err = sdk.ValAddressFromBech32(stake.Validator)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvalidator, found := k.stakingKeeper.GetValidator(ctx, valAddr)\n\tif !found {\n\t\treturn stakingtypes.ErrNoValidatorFound\n\t}\n\n\tstake = types.NewStake(0, curatingtypes.PostID{}, buyer, valAddr, amt)\n\tk.SetStake(ctx, buyer, stake)\n\n\t_, err = k.stakingKeeper.Delegate(ctx, buyer, amount, stakingtypes.Unbonded, validator, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := k.bankKeeper.MintCoins(\n\t\tctx, types.ModuleName, sdk.NewCoins(coin),\n\t); err != nil {\n\t\treturn err\n\t}\n\n\tif err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, buyer, sdk.NewCoins(coin)); err != nil {\n\t\tpanic(\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"unable to send coins from module to account despite previously minting coins to module account: %v\",\n\t\t\t\terr),\n\t\t)\n\t}\n\n\tctx.EventManager().EmitEvents(sdk.Events{\n\t\tsdk.NewEvent(\n\t\t\ttypes.EventTypeBuyCreatorCoin,\n\t\t\tsdk.NewAttribute(types.AttributeKeyUsername, username),\n\t\t\tsdk.NewAttribute(types.AttributeKeyCreator, creator.String()),\n\t\t\tsdk.NewAttribute(types.AttributeKeyBuyer, buyer.String()),\n\t\t\tsdk.NewAttribute(types.AttributeKeyValidator, valAddr.String()),\n\t\t\tsdk.NewAttribute(types.AttributeKeyAmount, amount.String()),\n\t\t),\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "379ff4eeb3185f977977a64736f3a874", "score": "0.45911348", "text": "func (c *RPC) CreateTransaction(recvAddr string, amount uint64) (*coin.Transaction, error) {\n\t// TODO -- this can support sending to multiple receivers at once,\n\t// which would be necessary if the exchange was busy\n\tsendAmount := cli.SendAmount{\n\t\tAddr: recvAddr,\n\t\tCoins: amount,\n\t}\n\n\tif err := validateSendAmount(sendAmount); err != nil {\n\t\treturn nil, err\n\t}\n\n\ttxn, err := cli.CreateRawTxFromWallet(c.rpcClient, c.walletFile, c.changeAddr, []cli.SendAmount{sendAmount})\n\tif err != nil {\n\t\treturn nil, RPCError{err}\n\t}\n\n\treturn txn, nil\n}", "title": "" }, { "docid": "e6cafec714570bee9cfa944cc823c02a", "score": "0.45807526", "text": "func (_DelegateProfile *DelegateProfileTransactorSession) TransferOwnership(_newOwner common.Address) (*types.Transaction, error) {\n\treturn _DelegateProfile.Contract.TransferOwnership(&_DelegateProfile.TransactOpts, _newOwner)\n}", "title": "" }, { "docid": "440a3b630742190a8d8893438cdac2fe", "score": "0.45781168", "text": "func (t *SimpleChaincode) creatorCredentials(APIstub shim.ChaincodeStubInterface, args []string) pb.Response {\n\n\tif len(args) != 2 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting 2\")\n\t}\n\tif len(args[0]) <= 0 {\n\t\treturn shim.Error(\"1 argument must be a non-empty string\")\n\t}\n\tif len(args[1]) <= 0 {\n\t\treturn shim.Error(\"2 argument must be a non-empty string\")\n\t}\n\n\tUsername := args[0]\n\tPassword := args[1]\n\n\t// ==== Check if credentials already exists ====\n\tcredentialAsBytes, err := APIstub.GetState(Username)\n\tif err != nil {\n\t\treturn shim.Error(\"Failed to get credentials: \" + err.Error())\n\t} else if credentialAsBytes != nil {\n\t\treturn shim.Error(\"This credentials already exists: \" + Username)\n\t}\n\n\t// ==== Create certificate object and marshal to JSON ====\n\tcreatorLogin := &user{Username, Password}\n\n\tcredentialJSONasBytes, err := json.Marshal(creatorLogin)\n\terr = APIstub.PutState(Username, credentialJSONasBytes)\n\tif err != nil {\n\t\treturn shim.Error(fmt.Sprintf(\"Failed to add creator credentials: %s\", Username))\n\t}\n\n\treturn shim.Success(nil)\n}", "title": "" }, { "docid": "c5ae6ad11ee0e26b72394a3b7e46b158", "score": "0.4576553", "text": "func getTxCreator(stub shim.ChaincodeStubInterface) (string, error) {\n\t// get the agent submitting the transaction\n\tbCreator, err := stub.GetCreator()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// get pem certificate only. This might be slightly dirty, but this is to avoid installing external packages\n\t// change it once github.com/hyperledger/fabric/core/chaincode/lib/cid is in fabric chaincode docker\n\tcert_prefix := \"-----BEGIN CERTIFICATE-----\"\n\tcert_suffix := \"-----END CERTIFICATE-----\\n\"\n\tvar creator string\n\tif sCreator := strings.Split(string(bCreator), cert_prefix); len(sCreator) > 1 {\n\t\tcreator = strings.Split(sCreator[1], cert_suffix)[0]\n\t} else {\n\t\tcreator = \"test\"\n\t}\n\tcreator = cert_prefix + creator + cert_suffix\n\ttt := sha256.Sum256([]byte(creator))\n\treturn hex.EncodeToString(tt[:]), nil\n}", "title": "" }, { "docid": "8fba044f68059d6dce4c2c7a1d6a460a", "score": "0.45655736", "text": "func (_DelegateProfile *DelegateProfileTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _DelegateProfile.Contract.contract.Transfer(opts)\n}", "title": "" } ]
e7299677cfee749aac10c9c4c2162a13
HandleUsersSetActive is the default handler method for the Slack users.setActive API
[ { "docid": "c48851c1fb0f31d413be350e53732820", "score": "0.8731384", "text": "func (h *Handler) HandleUsersSetActive(w http.ResponseWriter, r *http.Request) {\n\tif err := r.ParseForm(); err != nil {\n\t\thttp.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)\n\t\treturn\n\t}\n\tif !h.validateToken(r) {\n\t\thttp.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)\n\t\treturn\n\t}\n\tvar c slack.UsersSetActiveCall\n\tif err := c.FromValues(r.Form); err != nil {\n\t\thttp.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)\n\t\treturn\n\t}\n\tvar buf bytes.Buffer\n\tif err := json.NewEncoder(&buf).Encode(StockResponse(\"users.setActive\")); err != nil {\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Header().Set(`Content-Type`, `application/json; charset=utf-8`)\n\tw.WriteHeader(http.StatusOK)\n\tbuf.WriteTo(w)\n}", "title": "" } ]
[ { "docid": "b1fa6727f3d695a6f3b59e9d3931ddd5", "score": "0.6541613", "text": "func (s *ImmuServer) SetActiveUser(ctx context.Context, r *schema.SetActiveUserRequest) (*empty.Empty, error) {\n\ts.Logger.Debugf(\"SetActiveUser\")\n\n\tif s.Options.GetMaintenance() {\n\t\treturn nil, ErrNotAllowedInMaintenanceMode\n\t}\n\n\tif !s.Options.GetAuth() {\n\t\treturn nil, fmt.Errorf(\"this command is available only with authentication on\")\n\t}\n\n\tif len(r.Username) == 0 {\n\t\treturn nil, fmt.Errorf(\"username can not be empty\")\n\t}\n\n\t_, user, err := s.getLoggedInUserdataFromCtx(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !user.IsSysAdmin {\n\t\tif !user.HasAtLeastOnePermission(auth.PermissionAdmin) {\n\t\t\treturn nil, fmt.Errorf(\"user is not system admin nor admin in any of the databases\")\n\t\t}\n\t}\n\n\tif r.Username == user.Username {\n\t\treturn nil, fmt.Errorf(\"changing your own status is not allowed\")\n\t}\n\n\ttargetUser, err := s.getUser(ctx, []byte(r.Username))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"user %s not found\", r.Username)\n\t}\n\n\t//if the user is not sys admin then let's make sure the target was created from this admin\n\tif !user.IsSysAdmin && user.Username != targetUser.CreatedBy {\n\t\treturn nil, fmt.Errorf(\"%s was not created by you\", r.Username)\n\t}\n\n\ttargetUser.Active = r.Active\n\ttargetUser.CreatedBy = user.Username\n\ttargetUser.CreatedAt = time.Now()\n\n\tif err := s.saveUser(ctx, targetUser); err != nil {\n\t\treturn nil, err\n\t}\n\n\ts.Logger.Infof(\"user %s was %s by user %s\", targetUser.Username, map[bool]string{\n\t\ttrue: \"activated\",\n\t\tfalse: \"deactivated\",\n\t}[r.Active], user.Username)\n\n\t//remove user from loggedin users\n\ts.removeUserFromLoginList(targetUser.Username)\n\n\treturn new(empty.Empty), nil\n}", "title": "" }, { "docid": "7f7a612a7bf3104dbce592558516f699", "score": "0.60142946", "text": "func Activate(ctx *context.Context) {\n\tcode := ctx.Query(\"code\")\n\tif len(code) == 0 {\n\t\tctx.Data[\"IsActivatePage\"] = true\n\t\tif ctx.User.IsActive {\n\t\t\tctx.Error(404)\n\t\t\treturn\n\t\t}\n\t\t// Resend confirmation email.\n\t\tif setting.Service.RegisterEmailConfirm {\n\t\t\tif ctx.Cache.IsExist(\"MailResendLimit_\" + ctx.User.LowerName) {\n\t\t\t\tctx.Data[\"ResendLimited\"] = true\n\t\t\t} else {\n\t\t\t\tctx.Data[\"ActiveCodeLives\"] = timeutil.MinutesToFriendly(setting.Service.ActiveCodeLives, ctx.Locale.Language())\n\t\t\t\tmailer.SendActivateAccountMail(ctx.Locale, ctx.User)\n\n\t\t\t\tif err := ctx.Cache.Put(\"MailResendLimit_\"+ctx.User.LowerName, ctx.User.LowerName, 180); err != nil {\n\t\t\t\t\tlog.Error(\"Set cache(MailResendLimit) fail: %v\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tctx.Data[\"ServiceNotEnabled\"] = true\n\t\t}\n\t\tctx.HTML(200, TplActivate)\n\t\treturn\n\t}\n\n\t// Verify code.\n\tif user := models.VerifyUserActiveCode(code); user != nil {\n\t\tuser.IsActive = true\n\t\tvar err error\n\t\tif user.Rands, err = models.GetUserSalt(); err != nil {\n\t\t\tctx.ServerError(\"UpdateUser\", err)\n\t\t\treturn\n\t\t}\n\t\tif err := models.UpdateUserCols(user, \"is_active\", \"rands\"); err != nil {\n\t\t\tif models.IsErrUserNotExist(err) {\n\t\t\t\tctx.Error(404)\n\t\t\t} else {\n\t\t\t\tctx.ServerError(\"UpdateUser\", err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tlog.Trace(\"User activated: %s\", user.Name)\n\n\t\tif err := ctx.Session.Set(\"uid\", user.ID); err != nil {\n\t\t\tlog.Error(fmt.Sprintf(\"Error setting uid in session: %v\", err))\n\t\t}\n\t\tif err := ctx.Session.Set(\"uname\", user.Name); err != nil {\n\t\t\tlog.Error(fmt.Sprintf(\"Error setting uname in session: %v\", err))\n\t\t}\n\t\tif err := ctx.Session.Release(); err != nil {\n\t\t\tlog.Error(\"Error storing session: %v\", err)\n\t\t}\n\n\t\tctx.Flash.Success(ctx.Tr(\"auth.account_activated\"))\n\t\tctx.Redirect(setting.AppSubURL + \"/\")\n\t\treturn\n\t}\n\n\tctx.Data[\"IsActivateFailed\"] = true\n\tctx.HTML(200, TplActivate)\n}", "title": "" }, { "docid": "32dce5681a4afe906862007477f7e73d", "score": "0.57257366", "text": "func (rCalc *RulesCalculator) ActiveUsers() []string { return rCalc.userIDs }", "title": "" }, { "docid": "7a4d93bcedfd596edf045efdec7e7139", "score": "0.5678811", "text": "func (uc *UserCreate) SetActive(b bool) *UserCreate {\n\tuc.mutation.SetActive(b)\n\treturn uc\n}", "title": "" }, { "docid": "f35e21d7dffb8d6cb37dfa1154bc2f09", "score": "0.55804443", "text": "func (usu *UserStatusUpdate) SetActive(b bool) *UserStatusUpdate {\n\tusu.mutation.SetActive(b)\n\treturn usu\n}", "title": "" }, { "docid": "d63d74b21867c95101756917406d8a17", "score": "0.55628705", "text": "func (users Users) Activate(email string) string {\n\n\tlog.Debug(\n\t\t\"Activating User With Email\",\n\t\tzap.String(\"Email\", email),\n\t)\n\n\tuserData, msg := users.GetByUsernameOrEmail(\"\", email)\n\tif msg != \"\" {\n\t\treturn msg\n\t}\n\tuserID := userData.UserID\n\n\tlog.Debug(\n\t\t\"Activating User With ID\",\n\t\tzap.String(\"UserID\", userID),\n\t)\n\n\tupdate := config.UserMeta{AccountStatus: config.UserDataConfigAccountStatusActive}\n\tusers.Update(userID, update, config.DBConfigUserMetaDataCollection)\n\n\tlog.Info(\n\t\t\"Activated User\",\n\t\tzap.String(\"UserID\", userID),\n\t\tzap.String(\"Email\", email),\n\t)\n\n\treturn \"\"\n}", "title": "" }, { "docid": "9b9aed904989f41bfb8a1395c319524f", "score": "0.5553001", "text": "func (c *Client4) UpdateUserActive(userId string, active bool) (*Response, error) {\n\trequestBody := make(map[string]any)\n\trequestBody[\"active\"] = active\n\tr, err := c.DoAPIPut(c.userRoute(userId)+\"/active\", StringInterfaceToJSON(requestBody))\n\tif err != nil {\n\t\treturn BuildResponse(r), err\n\t}\n\tdefer closeBody(r)\n\n\treturn BuildResponse(r), nil\n}", "title": "" }, { "docid": "b5175ae0cd423023ff020f7d0501ac62", "score": "0.55408084", "text": "func (usuo *UserStatusUpdateOne) SetActive(b bool) *UserStatusUpdateOne {\n\tusuo.mutation.SetActive(b)\n\treturn usuo\n}", "title": "" }, { "docid": "abb06455c63c78552faae5a7de1174b1", "score": "0.55332655", "text": "func (h *Handler) HandleUsersSetPresence(w http.ResponseWriter, r *http.Request) {\n\tif err := r.ParseForm(); err != nil {\n\t\thttp.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)\n\t\treturn\n\t}\n\tif !h.validateToken(r) {\n\t\thttp.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)\n\t\treturn\n\t}\n\tvar c slack.UsersSetPresenceCall\n\tif err := c.FromValues(r.Form); err != nil {\n\t\thttp.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)\n\t\treturn\n\t}\n\tvar buf bytes.Buffer\n\tif err := json.NewEncoder(&buf).Encode(StockResponse(\"users.setPresence\")); err != nil {\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Header().Set(`Content-Type`, `application/json; charset=utf-8`)\n\tw.WriteHeader(http.StatusOK)\n\tbuf.WriteTo(w)\n}", "title": "" }, { "docid": "fccb3aced7e9873c7f8f8eba81c1d413", "score": "0.550077", "text": "func (u *User) isActive() bool {\n\tif u.guacUser.active != 0 {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "e8eb82e569c05bf246d3794fff3c436a", "score": "0.5477589", "text": "func (h *Handlers) ActivateUserHandler(c echo.Context) error {\n\tumail := c.FormValue(\"e\")\n\tcode := c.FormValue(\"code\")\n\n\terr := auth.ActivateUser(umail, code)\n\tif err != nil {\n\t\tc.Error(err)\n\t\treturn err\n\t}\n\n\tce, err := invalidateContext(c)\n\tif err != nil {\n\t\tlogger.Println(err)\n\t\t// c.Error(errServer)\n\t\t// return err\n\t}\n\n\tc = ce\n\n\treturn c.Redirect(http.StatusFound, fmt.Sprintf(\"%s/login?uactivated=_y\", APPRoot))\n}", "title": "" }, { "docid": "463200112cc7edf1a8de9a64544d2c48", "score": "0.5463217", "text": "func (u *UserService) UpdateActive(userID string, active bool) error {\n\tappErr := u.api.UpdateUserActive(userID, active)\n\n\treturn normalizeAppErr(appErr)\n}", "title": "" }, { "docid": "c75df68d4c940ef1e6dc2d3971c81e73", "score": "0.53405946", "text": "func (_OrgsData *OrgsDataFilterer) WatchOnSetActive(opts *bind.WatchOpts, sink chan<- *OrgsDataOnSetActive) (event.Subscription, error) {\n\n\tlogs, sub, err := _OrgsData.contract.WatchLogs(opts, \"onSetActive\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(OrgsDataOnSetActive)\n\t\t\t\tif err := _OrgsData.contract.UnpackLog(event, \"onSetActive\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "1143d18600ce750a59a2c31718ff0f68", "score": "0.5339742", "text": "func (fg *TemporaryScheduleCalculator) ActiveUsers() []string { return fg.usr.ActiveUsers() }", "title": "" }, { "docid": "a9909eb3e7aaf3941e34441b6c9c4b72", "score": "0.5306822", "text": "func (r User_Customer_OpenIdConnect) ActivateOpenIdConnectUser(verificationCode *string, userInfo *datatypes.User_Customer, iamId *string) (err error) {\n\tvar resp datatypes.Void\n\tparams := []interface{}{\n\t\tverificationCode,\n\t\tuserInfo,\n\t\tiamId,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_User_Customer_OpenIdConnect\", \"activateOpenIdConnectUser\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "1b4dea7625bb331bbd1c93559ef7d164", "score": "0.5279073", "text": "func AdminChangeActivation(c *gin.Context) {\n\tuserID, _ := strconv.ParseInt(c.PostForm(\"user_id\"), 10, 64)\n\tcompanyID, _ := strconv.ParseInt(c.PostForm(\"company_id\"), 10, 64)\n\n\tvar isEnabled bool\n\tpayloadStatus := c.PostForm(\"is_enabled\")\n\tif payloadStatus == \"true\" {\n\t\tisEnabled = true\n\t} else if payloadStatus == \"false\" {\n\t\tisEnabled = false\n\t} else {\n\t\tlog.Printf(\"func AdminChangeActivation error when parse status. payload: %v \\n\", payloadStatus)\n\t\tglobal.BadRequestResponse(c, \"invalid is_enable value\")\n\t\treturn\n\t}\n\n\t// Check user session\n\taccountResp, token, errGetResponse := getUserProfile(c)\n\tif errGetResponse != nil {\n\t\tglobal.Error.Println(errGetResponse)\n\t\tglobal.InternalServerErrorResponse(c, constErr.WORDING_ERROR_INTERNAL_SERVER)\n\t\treturn\n\t}\n\n\t// expire - we remove cookie and redirect it\n\tif accountResp.Error != nil {\n\t\tglobal.InternalServerErrorResponse(c, constErr.WORDING_ERROR_INTERNAL_SERVER)\n\t\treturn\n\t}\n\n\t// define service user\n\tuserService := global.GetServiceUser()\n\tparam := user.ChangeStatusAccParam{\n\t\tUserID: userID,\n\t\tCompanyID: companyID,\n\t\tIsEnabled: isEnabled,\n\t}\n\n\tresp, err := userService.ChangeStatusAccount(token, param)\n\tif err != nil {\n\t\tlog.Println(\"cannot update company. Err\", err)\n\t\tglobal.InternalServerErrorResponse(c, err.Error())\n\t\treturn\n\t}\n\n\tresponse := map[string]interface{}{\n\t\t\"error\": resp,\n\t}\n\n\tglobal.OKResponse(c, response)\n}", "title": "" }, { "docid": "f9a3354be45b9366e5e457219cb864e0", "score": "0.5276587", "text": "func (_OrgsData *OrgsDataTransactor) SetActive(opts *bind.TransactOpts, uuid [16]byte, active bool) (*types.Transaction, error) {\n\treturn _OrgsData.contract.Transact(opts, \"setActive\", uuid, active)\n}", "title": "" }, { "docid": "f9754b403bec2139b4f183ccead16750", "score": "0.5269145", "text": "func (s *SignupController) ActiveAccount() {\n\ttoken := s.GetString(\"token\")\n\tfmt.Println(\"token: \" + token)\n\tdata := map[string]interface{}{}\n\tif authEmail != nil {\n\t\tisAccess, email := authEmail.CheckEmailURL(token)\n\n\t\tif isAccess {\n\t\t\terr := controllers.Manager.ActiveAccount(email)\n\t\t\tif err != nil {\n\t\t\t\tglog.Errorf(\"active user by email error[%s]\\n\", err.Error())\n\t\t\t\tdata[\"error\"] = err.Error()\n\t\t\t\ts.ServerError(data, http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tdata[\"info\"] = fmt.Sprintf(\"Auth email[%s] status[%t]\", email, isAccess)\n\t\tglog.Infof(data[\"info\"].(string))\n\t\ts.ServerOk(data)\n\t\tauthEmail = nil\n\t\treturn\n\t}\n\terr := fmt.Errorf(\"AuthEmail always nil\")\n\tdata[\"error\"] = fmt.Sprintf(\"Auth emial url error[%s]\", err.Error())\n\ts.ServerError(data, http.StatusBadRequest)\n\treturn\n\n}", "title": "" }, { "docid": "c41b37631c3084ca2f0787bebc56f577", "score": "0.52555215", "text": "func SetActive(win C.MData) {\n\tC.set_active(win)\n}", "title": "" }, { "docid": "db4ae224a8c14a7078502c5bb7981788", "score": "0.52493346", "text": "func (u *User) SetActivated(activated bool) {\n\tif activated {\n\t\tu.IsActivated = true\n\t\tu.ActivationToken = types.UUID{}\n\t} else {\n\t\tu.IsActivated = false\n\t\tu.ActivationToken = types.NewRandomUUID()\n\t}\n}", "title": "" }, { "docid": "97f926497738cddbd75a0bbdf4c50a4a", "score": "0.52218187", "text": "func (u *Usernames) GetActiveUsernames() (value []string) {\n\tif u == nil {\n\t\treturn\n\t}\n\treturn u.ActiveUsernames\n}", "title": "" }, { "docid": "3633b57ff863e80af0ac7875262bba58", "score": "0.5217229", "text": "func (i *FlowIntegration) switchActiveAccount(_ protocol.Conn, args ...interface{}) (interface{}, error) {\n\n\terr := server.CheckCommandArgumentCount(args, 1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\taddrHex, ok := args[0].(string)\n\tif !ok {\n\t\treturn nil, errors.New(\"invalid argument\")\n\t}\n\taddr := flow.HexToAddress(addrHex)\n\n\t_, ok = i.accounts[addr]\n\tif !ok {\n\t\treturn nil, errors.New(\"cannot set active account that does not exist\")\n\t}\n\n\ti.activeAddress = addr\n\treturn nil, nil\n}", "title": "" }, { "docid": "63874e7ef19913f7c31a3470bf35fe11", "score": "0.51909655", "text": "func (t *svrTransHandler) OnActive(ctx context.Context, conn net.Conn) (context.Context, error) {\n\t// init rpcinfo\n\t_, ctx = t.opt.InitRPCInfoFunc(ctx, conn.RemoteAddr())\n\treturn ctx, nil\n}", "title": "" }, { "docid": "b41d7190fa9ee565e64b60e8795b42ae", "score": "0.517986", "text": "func (_OrgsData *OrgsDataTransactorSession) SetActive(uuid [16]byte, active bool) (*types.Transaction, error) {\n\treturn _OrgsData.Contract.SetActive(&_OrgsData.TransactOpts, uuid, active)\n}", "title": "" }, { "docid": "4078ee3a7b417fa5c5d53d1d21fac1c6", "score": "0.5169549", "text": "func (r *EmailTemplateRepo) SetActive(req *domSchema.ETSetActiveRequest, i identity.Identity) (*domSchema.ETSetActiveResponse, error) {\n\t// select db\n\tdbCon, err := r.handler.GetGormDB(r.dbConnectionName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar emailTplEtt domEntity.EmailTemplateEntity\n\tvar count int64\n\n\tif err := dbCon.Where(\"code = ? \", req.Keys.Code).Find(&emailTplEtt).Count(&count).Error; err != nil {\n\t\treturn nil, &sysError.SystemError{StatusCode: http.StatusInternalServerError, Err: err}\n\t}\n\tif count == 0 {\n\t\treturn nil, &sysError.SystemError{StatusCode: http.StatusNotFound, Err: fmt.Errorf(\"Invalid Email Template Code\")}\n\t}\n\n\t// update data\n\temailTplEtt.IsActive = req.Data.IsActive\n\temailTplEtt.UpdatedBy = fmt.Sprintf(\"%s@%s\", i.Claims.Username, i.ClientDevices.IPAddress)\n\n\tif err := dbCon.Save(&emailTplEtt).Error; err != nil {\n\t\treturn nil, &sysError.SystemError{StatusCode: http.StatusInternalServerError, Err: err}\n\t}\n\n\t// response\n\tresp := new(domSchema.ETSetActiveResponse)\n\tresp.Code = req.Keys.Code\n\tresp.IsActive = req.Data.IsActive\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "dd5b9d1dac01ecbe3540c405b3ce4346", "score": "0.51634496", "text": "func (_OrgsData *OrgsDataSession) SetActive(uuid [16]byte, active bool) (*types.Transaction, error) {\n\treturn _OrgsData.Contract.SetActive(&_OrgsData.TransactOpts, uuid, active)\n}", "title": "" }, { "docid": "a6bb82877d99bd1dd08279a1337d9c9c", "score": "0.5151923", "text": "func GetTraitActiveUser() []Customization {\n\treturn []Customization{\n\t\t{\n\t\t\tModel: models.User{\n\t\t\t\tActive: true,\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "cf42d3425cb2b03be3e3a9754cea5ad6", "score": "0.5148994", "text": "func (o *SelfServiceLoginFlow) SetActive(v IdentityCredentialsType) {\n\to.Active = &v\n}", "title": "" }, { "docid": "3d651fce79e4514608b2503ff9e4e9b6", "score": "0.5139838", "text": "func (o *CloudFoundryCredentials) SetActive(v bool) {\n\to.Active = &v\n}", "title": "" }, { "docid": "10e45bfc5fd08f3eaed09826e13cfb3b", "score": "0.5130871", "text": "func setPlayerToActive(name string) {\n\tactiveplayers[name] = true\n}", "title": "" }, { "docid": "757156da9961bcb02329f4e036bcb3ab", "score": "0.5117229", "text": "func (u User) IsActive() bool {\n\treturn u.loggedIn\n}", "title": "" }, { "docid": "d245790f6854f273bf901d55ebf1a55a", "score": "0.5105228", "text": "func (*UserServiceMock) UpdateUserActiveState(userId uint) (*domains.PublicUser, rest_errors.RestErr) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "6bfe3559403c5f870e6784ea7db99306", "score": "0.5097345", "text": "func (api *API) activatedUsersInCohort(start, finish time.Time) (ActiveUsers map[string][]gp.UserID, err error) {\n\tActiveUsers = make(map[string][]gp.UserID)\n\tactivities := []string{\"liked\", \"commented\", \"posted\", \"attended\", \"initiated\", \"messaged\"}\n\tfor _, activity := range activities {\n\t\tusers, err := api.usersActivityInCohort(activity, start, finish)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error getting active cohort:\", err)\n\t\t} else {\n\t\t\tActiveUsers[activity] = users\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "e886261b2243eab70754127e852bf4eb", "score": "0.50883555", "text": "func (_OrgsData *OrgsDataFilterer) FilterOnSetActive(opts *bind.FilterOpts) (*OrgsDataOnSetActiveIterator, error) {\n\n\tlogs, sub, err := _OrgsData.contract.FilterLogs(opts, \"onSetActive\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &OrgsDataOnSetActiveIterator{contract: _OrgsData.contract, event: \"onSetActive\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "9b2316a53c9805d73549ec27c0837dc1", "score": "0.5086914", "text": "func HandleUsers(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tusers := managers.GetUsers()\n\n\tjson.NewEncoder(w).Encode(users)\n}", "title": "" }, { "docid": "ed79c3d3c3f909403fbbd33fc6999ba2", "score": "0.50743484", "text": "func ChangeUserStatus(stub shim.ChaincodeStubInterface, args []string) peer.Response {\n\n\tif len(args) != 2 {\n\t\treturn createErrorResponse(\"Invalid number of arguments. Expected 2 arguments\", 422, nil)\n\t}\n\n\tshouldActive, boolConvError := strconv.ParseBool(args[1])\n\n\t//handle bool conversion error\n\tif boolConvError != nil {\n\t\treturn createErrorResponse(boolConvError.Error(), 500, nil)\n\t}\n\n\tidStruct := IdQuery{ID: args[0]}\n\tselectorStruct := QueryStruct{Selector: idStruct}\n\n\tqueryByte, byteErr := json.Marshal(selectorStruct)\n\n\t//handle json marshal error\n\tif byteErr != nil {\n\t\treturn createErrorResponse(byteErr.Error(), 500, nil)\n\t}\n\n\tqueryIterator, queryErr := stub.GetQueryResult(string(queryByte))\n\n\t//handle query error\n\tif queryErr != nil {\n\t\treturn createErrorResponse(queryErr.Error(), 500, nil)\n\t}\n\n\tif !queryIterator.HasNext() {\n\t\treturn createErrorResponse(\"Please enter a valid user id\", 422, nil)\n\t}\n\n\tqueryResult, _ := queryIterator.Next()\n\n\tvar user User\n\n\terr := json.Unmarshal(queryResult.Value, &user)\n\n\t//handle json unmarshal error\n\tif err != nil {\n\t\treturn createErrorResponse(queryErr.Error(), 500, nil)\n\t}\n\n\tuser.UpdatedAt = time.Now().UTC()\n\tuser.Status = 1\n\n\tif !shouldActive {\n\t\tuser.Status = 0\n\t}\n\n\t//after setting the user delete status convert the struct into []byte to be updated\n\t//into couchdb\n\tuserBytes, userByteConversionErr := json.Marshal(user)\n\n\tif userByteConversionErr != nil {\n\t\treturn createErrorResponse(userByteConversionErr.Error(), 0, nil)\n\t}\n\n\tupdateStateErr := stub.PutState(args[0], userBytes)\n\n\tif updateStateErr != nil {\n\t\treturn createErrorResponse(updateStateErr.Error(), 0, nil)\n\t}\n\n\treturn shim.Success(createSuccessResponse(\"The user active status has been changed successfully\",\n\t\t1,\n\t\tnil))\n}", "title": "" }, { "docid": "819c8f2d145c02e99b4f1b84d992c5e8", "score": "0.50481", "text": "func (s *User) SetActive(v bool) *User {\n\ts.Active = &v\n\treturn s\n}", "title": "" }, { "docid": "cd18dfb16301022de6b46aa04d64f9f8", "score": "0.50468755", "text": "func (r *mutationResolver) switchActiveUserFeed(user *model.User, feedID int64) (*model.User, error) {\n\tuser.ActiveUserFeedID = feedID\n\treturn r.DB.UpdateUser(user)\n}", "title": "" }, { "docid": "d60437c1859a031c7c7bb39169ebc731", "score": "0.50280535", "text": "func (recv *ToggleAction) SetActive(isActive bool) {\n\tc_is_active :=\n\t\tboolToGboolean(isActive)\n\n\tC.gtk_toggle_action_set_active((*C.GtkToggleAction)(recv.native), c_is_active)\n\n\treturn\n}", "title": "" }, { "docid": "bf9b953041c44d3f28cd8983473cddd7", "score": "0.50197303", "text": "func (recv *Switch) SetActive(isActive bool) {\n\tc_is_active :=\n\t\tboolToGboolean(isActive)\n\n\tC.gtk_switch_set_active((*C.GtkSwitch)(recv.native), c_is_active)\n\n\treturn\n}", "title": "" }, { "docid": "585e8f665d74ff0673af8eb9cc4199f1", "score": "0.5018689", "text": "func HandleGetUsers(\n\tuser *graylog.User, lgc *logic.Logic, r *http.Request, ps Params,\n) (interface{}, int, error) {\n\t// GET /users List all users\n\tusers, sc, err := lgc.GetUsers()\n\tfor i, u := range users {\n\t\tu.Password = \"\"\n\t\tusers[i] = u\n\t}\n\tif err != nil {\n\t\treturn nil, sc, err\n\t}\n\t// TODO authorization\n\treturn &graylog.UsersBody{Users: users}, sc, nil\n}", "title": "" }, { "docid": "9c0d2513992184d8dc3b075589031840", "score": "0.50181323", "text": "func (s *MemoryConversationStore) Active(user, channel, team string) (id, state string, err error) {\n\ti := user + \"_\" + channel + \"_\" + team\n\tc, ok := s.active[i]\n\n\tif !ok {\n\t\terr = ErrConversationNotFound\n\t\treturn\n\t}\n\n\tid, state = c.id, c.state\n\treturn\n}", "title": "" }, { "docid": "772367bcc4ebfee7735444846044fce2", "score": "0.5016737", "text": "func (c *Client) ToggleUsernameIsActive(ctx context.Context, request *ToggleUsernameIsActiveRequest) 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": "9f3b3356edb0755a247d75992f320ba1", "score": "0.5002388", "text": "func (vuo *VehicleUpdateOne) SetActive(b bool) *VehicleUpdateOne {\n\tvuo.mutation.SetActive(b)\n\treturn vuo\n}", "title": "" }, { "docid": "e77f341535b8cdec7ca1500a53022357", "score": "0.4990312", "text": "func ActiveUsers() ([]*User, error) {\n\tvar users []*User\n\tvar op = dbi.DB.Operation()\n\top.Select(\"users\", &User{}).Where(\"deactivated = ?\", false).AllObjects(&users)\n\n\tfor _, u := range users {\n\t\tu.deserialize()\n\t}\n\treturn users, op.Err()\n}", "title": "" }, { "docid": "4ef4e7a91e69df643f4b228837f4267e", "score": "0.49784628", "text": "func (this *Context) SetActive(active bool) {\n\tC.sfContext_setActive(this.cptr, goBool2C(active))\n}", "title": "" }, { "docid": "4a06462aa576d37ed635127a3dca32eb", "score": "0.49724528", "text": "func (c *client) TellActive(keys ...string) (infos []StatusInfo, err error) {\n\tparams := make([]interface{}, 0, 1)\n\tif c.token != \"\" {\n\t\tparams = append(params, \"token:\"+c.token)\n\t}\n\tif keys != nil {\n\t\tparams = append(params, keys)\n\t}\n\terr = c.Call(aria2TellActive, params, &infos)\n\treturn\n}", "title": "" }, { "docid": "d1abd2c51b0c333b4e8ee54a01bbb651", "score": "0.49672574", "text": "func activateAccount(t *UserTest, user *models.User) bool {\n\tvar accountActivations []models.AccountActivation\n\tcontrollers.Gdb.Where(\"user_id=?\", user.Id).Find(&accountActivations)\n\n\tt.AssertEqual(len(accountActivations), 1)\n\t\n\t//make sure expiry date is valid\n\tvar expiryDate = accountActivations[0].ExpiryDate;\n\tvar expectedExpiryDate = time.Now().AddDate(0, 0, 3)\n\tt.AssertEqual(int(math.Floor(math.Abs(expectedExpiryDate.Sub(expiryDate).Hours()))), 0)\n\n\t//then activate account\n\tgorequest.New().Post(endpoint + \"/api/user/activateAccount/\"+accountActivations[0].ActivationKey).End()\n\t\n\treturn true\n}", "title": "" }, { "docid": "2d8de236f9664326bc924f570664f8b4", "score": "0.4966642", "text": "func (p *Plugin) OnActivate() error {\n\tbot := &model.Bot{\n\t\tUsername: botUsername,\n\t\tDisplayName: botDisplayName,\n\t\tDescription: botDescription,\n\t}\n\toptions := []plugin.EnsureBotOption{\n\t\tplugin.ProfileImagePath(\"assets/headcoach.png\"),\n\t}\n\n\t//ProfileImagePath(botIcon)\n\tbotUserID, ensureBotError := p.Helpers.EnsureBot(bot, options...)\n\tif ensureBotError != nil {\n\t\treturn errors.Wrap(ensureBotError, \"failed to ensure bot user\")\n\t}\n\tp.botUserID = botUserID\n\n\tp.listManager = NewListManager(p.API)\n\n\terr := p.API.RegisterCommand(getCommand())\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to register command\")\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "a0fc9dd6dc116aacbf562de8d5b5aa62", "score": "0.49662817", "text": "func (h *Handler) HandleUsersProfileSet(w http.ResponseWriter, r *http.Request) {\n\tif err := r.ParseForm(); err != nil {\n\t\thttp.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)\n\t\treturn\n\t}\n\tif !h.validateToken(r) {\n\t\thttp.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)\n\t\treturn\n\t}\n\tvar c slack.UsersProfileSetCall\n\tif err := c.FromValues(r.Form); err != nil {\n\t\thttp.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)\n\t\treturn\n\t}\n\tvar buf bytes.Buffer\n\tif err := json.NewEncoder(&buf).Encode(StockResponse(\"users.profile.set\")); err != nil {\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Header().Set(`Content-Type`, `application/json; charset=utf-8`)\n\tw.WriteHeader(http.StatusOK)\n\tbuf.WriteTo(w)\n}", "title": "" }, { "docid": "9fbd09ed02d4f2d792145d7fdb8f489f", "score": "0.49620163", "text": "func CheckActive(w http.ResponseWriter, r *http.Request) {\n\tloginSess, _ := store.Get(r, \"uid-hostel-session\")\n\n\tif _, ok := loginSess.Values[\"uid-user\"]; !ok {\n\t\tlog.Println(\"User not logged in\")\n\t\thttp.Redirect(w, r, \"/signin\", 301)\n\t}\n}", "title": "" }, { "docid": "6e1a1f827ab69b0defa1160797e938de", "score": "0.49567923", "text": "func (v *vaultClient) SetActive(active bool) {\n\tif active {\n\t\tatomic.StoreInt32(&v.active, 1)\n\t} else {\n\t\tatomic.StoreInt32(&v.active, 0)\n\t}\n\n\t// Clear out the revoking tokens\n\tv.revLock.Lock()\n\tv.revoking = make(map[*structs.VaultAccessor]time.Time)\n\tv.revLock.Unlock()\n\n\treturn\n}", "title": "" }, { "docid": "5753211a75e206f02942b0c06ffc5830", "score": "0.49498308", "text": "func (mc *MembershipController) Activate(c *gin.Context) (int, gin.H, error) {\n\tconst errorWhere = \"MembershipController.Activate\"\n\tvar appErr *models.AppError\n\tvar err error\n\tvar jwt string\n\tvar ra models.ReporterAccount\n\tvar user models.User\n\n\temail := c.Query(\"email\")\n\ttoken := c.Query(\"token\")\n\n\t// get reporter account by email from reporter_account table\n\tif ra, err = mc.Storage.GetReporterAccountData(email); err != nil {\n\t\tappErr = err.(*models.AppError)\n\t\treturn 0, gin.H{}, models.NewAppError(errorWhere, fmt.Sprintf(\"Activating email %s occurs error\", email), err.Error(), appErr.StatusCode)\n\t}\n\n\t// check expire time\n\tif ra.ActExpTime.Sub(time.Now()) < time.Duration(0) {\n\t\treturn 0, gin.H{}, models.NewAppError(errorWhere, \"ActivateToken is expired\", \"\", http.StatusUnauthorized)\n\t}\n\n\t// check token\n\tif ra.ActivateToken == token {\n\t\t// set active expire time to now\n\t\t// which make sure the same token not be signed in again\n\t\tra.ActExpTime = time.Now()\n\n\t\t// handle internal server error - can't update the record in reporter_account table\n\t\tif err = mc.Storage.UpdateReporterAccount(ra); err != nil {\n\t\t\treturn 0, gin.H{}, models.NewAppError(errorWhere, \"Updating reporter_account occurs error\", err.Error(), http.StatusInternalServerError)\n\t\t}\n\n\t\t// handle internal server error - can't query the record from users table\n\t\tif user, err = mc.Storage.GetUserDataByReporterAccount(ra); err != nil {\n\t\t\treturn 0, gin.H{}, models.NewAppError(errorWhere, \"Querying reporter_account occurs error\", err.Error(), http.StatusInternalServerError)\n\t\t}\n\n\t\t// handle internal server error - cannot generate JWT\n\t\tif jwt, err = utils.RetrieveV1Token(user.ID, user.Email.String); err != nil {\n\t\t\treturn 0, gin.H{}, models.NewAppError(errorWhere, \"Generating JWT occurs error\", err.Error(), http.StatusInternalServerError)\n\t\t}\n\n\t\treturn 200, gin.H{\"status\": \"success\",\n\t\t\t\"id\": user.ID, \"privilege\": user.Privilege, \"firstname\": user.FirstName.String,\n\t\t\t\"lastname\": user.LastName.String, \"email\": user.Email.String, \"jwt\": jwt}, nil\n\t}\n\n\treturn 0, gin.H{}, models.NewAppError(errorWhere, \"Token is invalid\", \"\", http.StatusUnauthorized)\n}", "title": "" }, { "docid": "9c53bac5e59ee39adc8ff0de6169c5ba", "score": "0.49440572", "text": "func (m *UnifiedRoleManagementAlert) SetIsActive(value *bool)() {\n err := m.GetBackingStore().Set(\"isActive\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "0697e0a3553b78c9dc701f2d58b5d20d", "score": "0.49394032", "text": "func (s* Server) ActivateOnu(ctx context.Context, empty *pb.Empty) (*pb.Empty, error) {\n\tlog.Println(\"Info: ActivateOnu() called\")\n\t//TODO\n}", "title": "" }, { "docid": "235fb72c37cb6ab48847e0a9fdf7a50f", "score": "0.49330688", "text": "func (ftuo *FieldTypeUpdateOne) SetActive(s schema.Status) *FieldTypeUpdateOne {\n\tftuo.mutation.SetActive(s)\n\treturn ftuo\n}", "title": "" }, { "docid": "a77a30a7503eb3fccf818b59d3200c8d", "score": "0.49311727", "text": "func (s *UserService) HandleGetUsers(w http.ResponseWriter, r *http.Request) {\n\tlogrus.Tracef(\"handling incoming request: %v\\n\", r)\n\tlogrus.Infoln(\"HandleGetUsers Start\")\n\tdefer logrus.Infoln(\"HandleGetUsers End\")\n\n\tusers := []User{}\n\terr := s.db.GetAll(\"user\", &users)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tlogrus.Fatalf(\"failed to get an item from table uses, error: %s\", err)\n\t\treturn\n\t}\n\n\tbuf, err := json.Marshal(users)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tlogrus.Errorf(\"failed to marshal return value: %v\", err)\n\t\treturn\n\t}\n\n\tif _, err := w.Write(buf); err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tlogrus.Errorf(\"error writing response: %v\", err)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "2bf6a70675c82467141623dd51af8ac5", "score": "0.49295598", "text": "func (store *Store) SetActive(id string) bool {\n\tstate, err := store.backend.Read()\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tsuccess := false\n\tfor _, stream := range state.Streams {\n\t\tif stream.Id == id {\n\t\t\tstream.Active = true\n\t\t\tif err := store.backend.Write(state); err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t} else {\n\t\t\t\tsuccess = true\n\t\t\t}\n\t\t}\n\t}\n\treturn success\n}", "title": "" }, { "docid": "ad40048e58ce5c1d2dd8d7329d873d0c", "score": "0.49212667", "text": "func (o *Session) SetActive(v bool) {\n\to.Active = &v\n}", "title": "" }, { "docid": "2bd41230bd63d16f6fde0ed33fc143e9", "score": "0.49157935", "text": "func (m *VictorOpsNotificationConfig) SetActive(val *bool) {\n\tm.activeField = val\n}", "title": "" }, { "docid": "30686c2999e725a7842ab05d7258edd8", "score": "0.49080288", "text": "func UserActivation(on bool) func() {\n\treturn func() {\n\t\tisUserActivationRequired = on\n\t}\n}", "title": "" }, { "docid": "2ae5b07b5fb4927d1f4a6cf8800de936", "score": "0.49022952", "text": "func (kS *KeyboardSet) SetActive(key uint, active bool) {\n\tfor i, k := range kS.keyboardHandlers {\n\t\tif k.key == key {\n\t\t\t//only do something if different\n\t\t\tif (i < kS.numActive) != active {\n\t\t\t\tif !(i < kS.numActive) { //if active put it in the active part of the array\n\t\t\t\t\t//fmt.Println(\"hello\")\n\t\t\t\t\ttemp := kS.keyboardHandlers[kS.numActive]\n\t\t\t\t\tkS.keyboardHandlers[kS.numActive] = k\n\t\t\t\t\tkS.keyboardHandlers[i] = temp\n\t\t\t\t\tkS.numActive++\n\t\t\t\t} else { //inactive move to end of array\n\t\t\t\t\tkS.keyboardHandlers = append(kS.keyboardHandlers[:i], kS.keyboardHandlers[i+1:]...)\n\t\t\t\t\tkS.keyboardHandlers = append(kS.keyboardHandlers, k) //TODO there has to be a better way\n\t\t\t\t\tkS.numActive--\n\t\t\t\t\t//fmt.Println(kS.keyboardHandlers)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8e1ff941301019a97ec2b812975e0796", "score": "0.489231", "text": "func UsersHandler(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\n\t_, err := checkIsSuperuserAndGetUserFromJWT(w, r)\n\tif err != nil {\n\t\tformatUsersResponse(false, \"error-auth\", \"\", \"\", nil, w)\n\t\treturn\n\t}\n\n\tusers, err := datastore.Environ.DB.ListUsers()\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tformatUsersResponse(false, \"error-fetch-users\", \"\", err.Error(), nil, w)\n\t\treturn\n\t}\n\n\t// Return successful JSON response with the list of users\n\tw.WriteHeader(http.StatusOK)\n\tformatUsersResponse(true, \"\", \"\", \"\", users, w)\n}", "title": "" }, { "docid": "0ad979e136f4654a26462c69b7ede083", "score": "0.48802745", "text": "func (h *Handler) HandleUsersIdentity(w http.ResponseWriter, r *http.Request) {\n\tif err := r.ParseForm(); err != nil {\n\t\thttp.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)\n\t\treturn\n\t}\n\tif !h.validateToken(r) {\n\t\thttp.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)\n\t\treturn\n\t}\n\tvar c slack.UsersIdentityCall\n\tif err := c.FromValues(r.Form); err != nil {\n\t\thttp.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)\n\t\treturn\n\t}\n\tvar buf bytes.Buffer\n\tif err := json.NewEncoder(&buf).Encode(StockResponse(\"users.identity\")); err != nil {\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Header().Set(`Content-Type`, `application/json; charset=utf-8`)\n\tw.WriteHeader(http.StatusOK)\n\tbuf.WriteTo(w)\n}", "title": "" }, { "docid": "f192926364fb1b913e0ea2627816305c", "score": "0.48736188", "text": "func (m *UserStatusMutation) SetActive(b bool) {\n\tm.active = &b\n}", "title": "" }, { "docid": "6fc5c6a3b41cc3a57f73d904acb89062", "score": "0.48734504", "text": "func (o *SummaryColumnCardResponse) SetActive(v int32) {\n\to.Active = &v\n}", "title": "" }, { "docid": "656817b461d73bef309c16f2ec424875", "score": "0.4872685", "text": "func (u User) IsActive() bool {\n\tuser := GetSessionID(u.Meta[\"session\"])\n\tswitch u := user.(type) {\n\tcase User:\n\t\treturn u.Active\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a4874e3b8e30e84bc75cbc077d9059a0", "score": "0.48684534", "text": "func ActivateAccount(c echo.Context) error {\n\tdb := ToDB(c)\n\ttoken, password := c.Param(\"token\"), c.FormValue(\"password\")\n\tusr, err := db.GetAccountByToken(token)\n\tif err != nil {\n\t\treturn ErrInvalidActivationToken.Log(err)\n\t}\n\n\tusr.SetActive()\n\tif err := usr.SetPassword(password); err != nil {\n\t\treturn ErrPasswordSimple.Log(err)\n\t}\n\n\tif err := db.UpdateAccount(usr); err != nil {\n\t\treturn ErrSaving.Log(err)\n\t}\n\n\treturn c.JSON(http.StatusOK, usr)\n}", "title": "" }, { "docid": "2f10fc096403b616e93d6773f631135d", "score": "0.4868376", "text": "func (recv *CheckMenuItem) SetActive(isActive bool) {\n\tc_is_active :=\n\t\tboolToGboolean(isActive)\n\n\tC.gtk_check_menu_item_set_active((*C.GtkCheckMenuItem)(recv.native), c_is_active)\n\n\treturn\n}", "title": "" }, { "docid": "36c892154f29c0eef5cd9b0e31633002", "score": "0.48622686", "text": "func (lapi *API) SetActiveR(id string, active bool, startedAt time.Time) (bool, error) {\n\tapiTry := 1\n\tfor {\n\t\tok, err := lapi.SetActive(id, active, startedAt)\n\t\tif err != nil {\n\t\t\tif Timedout(err) && apiTry < 3 {\n\t\t\t\tapiTry++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tglog.Errorf(\"Fatal error calling API /setactive id=%s active=%t err=%v\", id, active, err)\n\t\t}\n\t\treturn ok, err\n\t}\n}", "title": "" }, { "docid": "ea0687fee1159facfbbdc47acf9bc9f0", "score": "0.48593098", "text": "func (vu *VehicleUpdate) SetActive(b bool) *VehicleUpdate {\n\tvu.mutation.SetActive(b)\n\treturn vu\n}", "title": "" }, { "docid": "689070bd59d065631353525b962cfc7c", "score": "0.4859137", "text": "func activeUsers(ctx context.Context, periodType db.PeriodType, periods int) ([]*types.SiteActivityPeriod, error) {\n\tif periods == 0 {\n\t\treturn []*types.SiteActivityPeriod{}, nil\n\t}\n\n\tuniqueUsers, err := db.EventLogs.CountUniqueUsersPerPeriod(ctx, periodType, timeNow().UTC(), periods, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tregisteredUniqueUsers, err := db.EventLogs.CountUniqueUsersPerPeriod(ctx, periodType, timeNow().UTC(), periods, &db.CountUniqueUsersOptions{\n\t\tRegisteredOnly: true,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tintegrationUniqueUsers, err := db.EventLogs.CountUniqueUsersPerPeriod(ctx, periodType, timeNow().UTC(), periods, &db.CountUniqueUsersOptions{\n\t\tIntegrationOnly: true,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar activeUsers []*types.SiteActivityPeriod\n\tfor i, u := range uniqueUsers {\n\t\t// Pull out data from each period. Note that CountUniqueUsersPerPeriod will\n\t\t// always return a slice of length `periods` due to the generate_series in\n\t\t// the base query, so it is safe to read the following indices.\n\t\tactPer := &types.SiteActivityPeriod{\n\t\t\tStartTime: u.Start,\n\t\t\tUserCount: int32(u.Count),\n\t\t\tRegisteredUserCount: int32(registeredUniqueUsers[i].Count),\n\t\t\tAnonymousUserCount: int32(u.Count - registeredUniqueUsers[i].Count),\n\t\t\tIntegrationUserCount: int32(integrationUniqueUsers[i].Count),\n\t\t\tStages: nil,\n\t\t}\n\t\tactiveUsers = append(activeUsers, actPer)\n\t}\n\n\t// Count stage unique users For the latest week and month only.\n\tswitch periodType {\n\tcase db.Weekly:\n\t\tfallthrough\n\tcase db.Monthly:\n\t\tactiveUsers[0].Stages, err = stageUniqueUsers(activeUsers[0].StartTime)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn activeUsers, nil\n}", "title": "" }, { "docid": "092ef811cdaee97e5141c9b8d896bf24", "score": "0.48585594", "text": "func UsersHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tc := appengine.NewContext(r)\n\tval, err := handleUsers(c, r)\n\n\tif err == nil {\n\t\terr = ffjson.NewEncoder(w).Encode(val)\n\t}\n\n\tif err != nil {\n\t\tnError.ReturnError(w, http.StatusInternalServerError, \"User handling error\", err.Error())\n\t}\n\treturn\n}", "title": "" }, { "docid": "c6002a54b4db773b9d8f6231d23cb1f3", "score": "0.48560968", "text": "func usersHandler(c *RequestContext, w http.ResponseWriter, r *http.Request) (int, error) {\n\tif r.URL.Path == \"/change-password\" {\n\t\treturn usersUpdatePassword(c, w, r)\n\t}\n\n\tif r.URL.Path == \"/change-css\" {\n\t\treturn usersUpdateCSS(c, w, r)\n\t}\n\n\t// If the user is admin and the HTTP Method is not\n\t// PUT, then we return forbidden.\n\tif !c.User.Admin {\n\t\treturn http.StatusForbidden, nil\n\t}\n\n\tswitch r.Method {\n\tcase http.MethodGet:\n\t\treturn usersGetHandler(c, w, r)\n\tcase http.MethodPost:\n\t\treturn usersPostHandler(c, w, r)\n\tcase http.MethodDelete:\n\t\treturn usersDeleteHandler(c, w, r)\n\tcase http.MethodPut:\n\t\treturn usersPutHandler(c, w, r)\n\t}\n\n\treturn http.StatusNotImplemented, nil\n}", "title": "" }, { "docid": "612de8ea7c715ccb51648faeaa87c09d", "score": "0.48552272", "text": "func HandleUsers(upd tgbotapi.Update, bot *tgbotapi.BotAPI) {\n\tfoundUser := models.ChatUserFromTGID(upd.Message.From.ID, upd.Message.From.UserName)\n\tmodels.UpdateAliases(upd.Message.From.FirstName, upd.Message.From.LastName, foundUser.ID)\n\t//fmt.Println(foundUser) //Debug\n}", "title": "" }, { "docid": "73b192d7ad065904474a3ed77b33cb71", "score": "0.4854539", "text": "func SetActive(r *http.Request, links []Link) []Link {\n\tnl := make([]Link, len(links))\n\tfor i := 0; i < len(links); i++ {\n\t\tnl[i] = links[i]\n\t\tif nl[i].Href == r.URL.Path {\n\t\t\tnl[i].IsActive = true\n\t\t}\n\t}\n\n\treturn nl\n}", "title": "" }, { "docid": "f21960cf3d2d90552b568fe74f139d60", "score": "0.48541808", "text": "func (o *Account) SetActive(v bool) {\n\to.Active = &v\n}", "title": "" }, { "docid": "ef37342ea371a2559f769c645ade022a", "score": "0.48504645", "text": "func (t *AccountToggleUsernameRequest) GetActive() (value bool) {\n\tif t == nil {\n\t\treturn\n\t}\n\treturn t.Active\n}", "title": "" }, { "docid": "905498033b5bb901c3bccce6a971c1b3", "score": "0.4844956", "text": "func (hardware HardwareState) SetActive(on bool) {\n\tif !hardware.isValid() {\n\t\treturn\n\t}\n\tvar newValue byte\n\tif on {\n\t\tnewValue = 1\n\t}\n\n\thardware.State.Raw()[hardwareStatusStartOffset+hardware.Index] = newValue\n}", "title": "" }, { "docid": "237690b9bef140b757eb2ef6df64d91b", "score": "0.48396176", "text": "func ActivateAppUser(token string) error {\n\tvar user, err = identity.GetUserByActivationToken(token)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif user.AccountStatus == identity.AccountStatusActivated {\n\t\treturn ErrAccountAlreadyActivated\n\t}\n\n\tif dateutil.IsDateExpiredFromNow(user.ActivateAccountTokenExpireDate) {\n\t\treturn ErrActivationTokenExpired\n\t}\n\n\tuser.AccountStatus = identity.AccountStatusActivated\n\n\treturn identity.UpdateUser(user)\n}", "title": "" }, { "docid": "fc2cbb583c425cd2d9c6d33713b09ced", "score": "0.48383388", "text": "func (recv *Menu) SetActive(index uint32) {\n\tc_index := (C.guint)(index)\n\n\tC.gtk_menu_set_active((*C.GtkMenu)(recv.native), c_index)\n\n\treturn\n}", "title": "" }, { "docid": "7df1550a07dcb009c46e28e1766f9807", "score": "0.4833195", "text": "func (svr *ServerType) ChangeActive(id int, name string, resp http.ResponseWriter, req *http.Request) error {\r\n\tvar todo types.TodoData\r\n\terr := decodeBody(req, &todo)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\terr = svr.DAO.UpdateActive(id, todo.Active, name)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\trespond(resp, req, http.StatusOK, &types.ListStatus{\r\n\t\tStatus: \"Success\",\r\n\t\tInfo: fmt.Sprintf(\"Active changed to '%t' for id %d\", todo.Active, id),\r\n\t})\r\n\treturn nil\r\n}", "title": "" }, { "docid": "eb0cb384c810018a8c52d2bc2cd953ec", "score": "0.48313054", "text": "func (u *User) IsActive() bool{\n\t// expiration occurs 3 minutes after the time user was last active\n\texpirationLimit := u.LastActive.Add(time.Minute*time.Duration(3));\n\t\n\t// if expiration time has passed return user is inactive\n\tif expirationLimit.Before(time.Now()){\n\t\treturn false\n\t}\n\n\t// user is active\n\treturn true\n}", "title": "" }, { "docid": "b373d82b0824ddc015de57366d554bec", "score": "0.48288798", "text": "func (m *MBTA) SetActiveHours(from, until time.Time, days []int) {\n\tif m.from != from {\n\t\tm.from = from\n\t}\n\tif m.until != until {\n\t\tm.until = until\n\t}\n\tm.days = days\n\n}", "title": "" }, { "docid": "52974d96279ad1c5cca960f79926e301", "score": "0.48284638", "text": "func (s *LoginSystem) GetAllActiveUsers() []User {\n\ts.cachedUserDataMutex.RLock()\n\tdefer s.cachedUserDataMutex.RUnlock()\n\n\tvar lockedUsers []User\n\tfor _, storedUser := range s.cachedUserData {\n\t\tif storedUser.State == Active {\n\t\t\tuser := User{Mail: storedUser.Mail, UserId: storedUser.UserId,\n\t\t\t\tFirstName: storedUser.FirstName, LastName: storedUser.LastName,\n\t\t\t\tRole: storedUser.Role, State: storedUser.State}\n\t\t\tlockedUsers = append(lockedUsers, user.Copy())\n\t\t}\n\t}\n\n\treturn lockedUsers\n}", "title": "" }, { "docid": "b34c5dcb514d0aace031f2261a65b67d", "score": "0.4821136", "text": "func (ctx *Context) UsersAllHandler(w http.ResponseWriter, r *http.Request) {\r\n\r\n\t// get the session state\r\n\tsessionState := &SessionState{}\r\n\r\n\t// get the state of the browser that is accessing their page\r\n\t_, err := sessions.GetState(r, ctx.SessionKey, ctx.SessionStore, sessionState)\r\n\tif err != nil {\r\n\t\thttp.Error(w, \"Error cannot get session state: \"+err.Error(), http.StatusUnauthorized)\r\n\t\treturn\r\n\t}\r\n\r\n\tswitch r.Method {\r\n\tcase \"GET\":\r\n\t\tusers, err := ctx.UserStore.GetAll()\r\n\t\tif err != nil {\r\n\t\t\thttp.Error(w, \"Error cannot retrieve users \"+err.Error(), http.StatusInternalServerError)\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\trespond(w, users)\r\n\tdefault:\r\n\t\thttp.Error(w, \"method must be GET or PATCH\", http.StatusMethodNotAllowed)\r\n\t\treturn\r\n\t}\r\n}", "title": "" }, { "docid": "0f4020d49b18a2c73c029728bc6bfa28", "score": "0.4819343", "text": "func (ec *EntityCreate) SetActive(b bool) *EntityCreate {\n\tec.mutation.SetActive(b)\n\treturn ec\n}", "title": "" }, { "docid": "390d0e68d84651a4bddf8c284833ef23", "score": "0.48129782", "text": "func (s *GetSessionOutput) SetActiveContexts(v []*ActiveContext) *GetSessionOutput {\n\ts.ActiveContexts = v\n\treturn s\n}", "title": "" }, { "docid": "5b286d6896d0fe1105d645190fab1c33", "score": "0.4811675", "text": "func (mS *MouseButtonSet) SetActive(key uint, active bool) {\n\tfor i, k := range mS.buttonHandlers {\n\t\tif k.key == key {\n\t\t\t//only do something if different\n\t\t\tif (i < mS.numActive) != active {\n\t\t\t\tif !(i < mS.numActive) { //if active put it in the active part of the array\n\t\t\t\t\t//fmt.Println(\"hello\")\n\t\t\t\t\ttemp := mS.buttonHandlers[mS.numActive]\n\t\t\t\t\tmS.buttonHandlers[mS.numActive] = k\n\t\t\t\t\tmS.buttonHandlers[i] = temp\n\t\t\t\t\tmS.numActive++\n\t\t\t\t} else { //inactive move to end of array\n\t\t\t\t\tmS.buttonHandlers = append(mS.buttonHandlers[:i], mS.buttonHandlers[i+1:]...)\n\t\t\t\t\tmS.buttonHandlers = append(mS.buttonHandlers, k) //TODO there has to be a better way\n\t\t\t\t\tmS.numActive--\n\t\t\t\t\t//fmt.Println(mS.buttonHandlers)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9381163e6b68cb6351600d66bd7996bc", "score": "0.48100376", "text": "func SendActiveMail(locale i18n.Locale, user *model.User) {\n\tcode := CreateUserActiveCode(user, nil)\n\n\tsubject := locale.Tr(\"mail.verify_your_email_subject\")\n\n\tdata := mail.GetMailTmplData(locale.Lang, user)\n\tdata[\"Code\"] = code\n\tbody := utils.RenderTemplate(\"mail/auth/active_email.html\", data)\n\n\tmsg := mail.NewMailMessage([]string{user.Email}, subject, body)\n\tmsg.Info = fmt.Sprintf(\"UID: %d, send email verify mail\", user.Id)\n\n\t// async send mail\n\tmail.SendAsync(msg)\n}", "title": "" }, { "docid": "48b676db4f2138513eaaa5536edfde52", "score": "0.48079705", "text": "func (o *AccountStore) SetActive(v bool) {\n\to.Active = &v\n}", "title": "" }, { "docid": "7ff4e838b9e31ea53987970a93989e71", "score": "0.47983807", "text": "func HandleGetUsers(w http.ResponseWriter, r *http.Request, Db *gorm.DB) {\n\n\t// db := config.DBInit()\n\t// objDB := &ObjDB{DB: db}\n\n\tvar (\n\t\tusers []models.User\n\t\tcode int\n\t\tmessage interface{}\n\t)\n\n\terr := Db.Find(&users).Error\n\tif err != nil {\n\t\tcode = http.StatusBadRequest\n\t\tmessage = map[string]string{\n\t\t\t\"message\": err.Error(),\n\t\t\t\"code\": strconv.Itoa(http.StatusBadRequest),\n\t\t}\n\t} else {\n\t\tcode = http.StatusOK\n\t\tmessage = map[string][]models.User{\n\t\t\t\"result\": users,\n\t\t}\n\t}\n\n\thelper.ResponseCallback(w, code, message)\n}", "title": "" }, { "docid": "ec746b010389c83557d00eb9981b2b15", "score": "0.4796962", "text": "func (o *RegistrationFlow) SetActive(v string) {\n\to.Active = &v\n}", "title": "" }, { "docid": "23c4b2ea2a57a4d6015e537c97af9975", "score": "0.47948295", "text": "func (c *Client4) GetActiveUsersInTeam(teamId string, page int, perPage int, etag string) ([]*User, *Response, error) {\n\tquery := fmt.Sprintf(\"?active=true&in_team=%v&page=%v&per_page=%v\", teamId, page, perPage)\n\tr, err := c.DoAPIGet(c.usersRoute()+query, etag)\n\tif err != nil {\n\t\treturn nil, BuildResponse(r), err\n\t}\n\tdefer closeBody(r)\n\tvar list []*User\n\tif r.StatusCode == http.StatusNotModified {\n\t\treturn list, BuildResponse(r), nil\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&list); err != nil {\n\t\treturn nil, nil, NewAppError(\"GetActiveUsersInTeam\", \"api.unmarshal_error\", nil, \"\", http.StatusInternalServerError).Wrap(err)\n\t}\n\treturn list, BuildResponse(r), nil\n}", "title": "" }, { "docid": "89a250ee7ef7301dabb536248c591514", "score": "0.47940782", "text": "func (m *UserMutation) SetActive(b bool) {\n\tm.active = &b\n}", "title": "" }, { "docid": "4848919d4f157d64ad15ba6330c5aeab", "score": "0.47890025", "text": "func (m *Office365GroupsActivityGroupCounts) SetActive(value *int64)() {\n err := m.GetBackingStore().Set(\"active\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "5ec0a6b62b263a8617a1866f72de7bf6", "score": "0.47885695", "text": "func (s *PutSessionOutput) SetActiveContexts(v string) *PutSessionOutput {\n\ts.ActiveContexts = &v\n\treturn s\n}", "title": "" }, { "docid": "ed7928c0c74cadea5038805c5f904d5a", "score": "0.47881228", "text": "func (m *TrelloNotificationConfig) SetActive(val *bool) {\n\tm.activeField = val\n}", "title": "" }, { "docid": "75b8073b2819cc11d1c1b685407f93b0", "score": "0.47855514", "text": "func (m *notificationConfig) SetActive(val *bool) {\n\tm.activeField = val\n}", "title": "" }, { "docid": "f23b85643595d4c08ddcb36dbf25c79b", "score": "0.4771716", "text": "func HandleUserActivity(env *env.Env, w http.ResponseWriter, r *http.Request) error {\n\tp := struct {\n\t\tDeviceID string `json:\"device_id\"`\n\t\tActivityType string `json:\"activity_type\"`\n\t}{}\n\n\tif err := decodeJSON(r.Body, &p); err != nil {\n\t\treturn err\n\t}\n\tdefer r.Body.Close()\n\n\tif p.DeviceID == \"\" && p.ActivityType == \"\" {\n\t\treturn serror.NewBadRequest(fmt.Errorf(\"device_id / activity_type name required\"), \"HandleCreteUser\", \"device_id / activity_type required\")\n\t}\n\n\t// Create axctivity\n\terr := domain.CreateActivity(env.DB, p.DeviceID, p.ActivityType)\n\tif err != nil {\n\t\treturn serror.Error{\n\t\t\tCode: http.StatusBadRequest,\n\t\t\tErr: err,\n\t\t\tContext: \"user.Activity\",\n\t\t\tMsg: err.Error(),\n\t\t}\n\t}\n\n\treturn nil\n\n}", "title": "" } ]
a52238f6318635a40fc3330a038f2263
/ watch for jobs completing. Record finish times. When all the jobs have finished put the finished times on an all done channel
[ { "docid": "1e4f3baff8a905deb3fa6c14591cd6cb", "score": "0.7547096", "text": "func (st *SchedulingAlgTester) watchForAllDone(allJobsStartedCh chan bool,\n\tallJobsDoneCh chan bool, endTime time.Time, sc saga.SagaCoordinator) {\n\tfinishedJobs := make(map[string]bool) // if the job is in this map, it has finished\n\tfinalCnt := -1\n\tfor true {\n\t\tjobIds := st.getComparisonMapKeys()\n\t\tselect {\n\t\tcase <-allJobsStartedCh:\n\t\t\tfinalCnt = len(jobIds)\n\t\tdefault:\n\t\t}\n\t\t// look for newly completed jobs, record their finish times\n\t\tallDone := false\n\t\tfor _, id := range jobIds {\n\t\t\tif _, ok := finishedJobs[id]; !ok {\n\t\t\t\t// we haven't seen the job finish yet, check its state\n\t\t\t\ts, _ := sc.GetSagaState(id)\n\t\t\t\tif s.IsSagaCompleted() || s.IsSagaAborted() {\n\t\t\t\t\t// the job is newly finished, record its time\n\t\t\t\t\tfinishedJobs[id] = true\n\t\t\t\t\terr := st.recordJobEndTime(id, false)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Errorf(\"error writing comparison time for %s: %s\", id, err.Error())\n\t\t\t\t\t\tallDone = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif finalCnt > 0 && len(finishedJobs) == finalCnt {\n\t\t\t\tallDone = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif allDone {\n\t\t\tallJobsDoneCh <- true\n\t\t\treturn\n\t\t}\n\t\tif !time.Now().Before(endTime) {\n\t\t\t// the sim duration is up, discard all jobs still running, their timings will not be accurate since\n\t\t\t// the simulation is not adding any more real load to the workers\n\t\t\tfor _, id := range jobIds {\n\t\t\t\tif _, ok := finishedJobs[id]; !ok {\n\t\t\t\t\ttimeSummary := st.getComparisonMapEntry(id)\n\t\t\t\t\tlog.Warnf(\"timing out job %s\", timeSummary.buildUrl)\n\t\t\t\t\tfinishedJobs[id] = true\n\t\t\t\t\tst.recordJobEndTime(id, true)\n\t\t\t\t}\n\t\t\t}\n\t\t\tallJobsDoneCh <- true\n\t\t\treturn\n\t\t}\n\t\ttime.Sleep(3 * time.Second)\n\t}\n}", "title": "" } ]
[ { "docid": "a9ccf6b3d2bfb1d8e4732792fdfcf576", "score": "0.62765247", "text": "func closeChan(jobs <-chan int, done chan<- bool) {\n\tfor {\n\t\tj, more := <-jobs\n\t\tif more {\n\t\t\tfmt.Println(\"Receive job \", j)\n\t\t} else {\n\t\t\tfmt.Println(\"All job received\")\n\t\t\tdone <- true\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4d09aa99689d7f88343b83df62206ffa", "score": "0.59435576", "text": "func worker(id int, jobs <-chan int, results chan<- int) {\n for j := range jobs {\n fmt.Println(\"worker\", id, \"started job\", j)\n time.Sleep(time.Second)\n fmt.Println(\"worker\", id, \"finished job\", j)\n results <- j * 2\n }\n}", "title": "" }, { "docid": "bd52c51b3a415e0d513cbdc98c1fd1f1", "score": "0.5924912", "text": "func (t Timer) Done() {\n\tfmt.Printf(\"< %v %s\\n\", t.name, time.Since(t.start))\n}", "title": "" }, { "docid": "d732aac74e408e029fe7a0ea4020d732", "score": "0.5918567", "text": "func (w *Worker) Work() {\n\tfor {\n\t\tselect {\n\t\tcase <-w.stopping:\n\t\t\tclose(w.done)\n\t\t\treturn\n\t\tdefault:\n\t\t}\n\t\tjob, err := w.jobs.NextJob(w.queues)\n\t\tif err == ErrNoJobAvailable {\n\t\t\ttime.Sleep(pollingPeriod)\n\t\t\tcontinue // normal\n\t\t}\n\t\tif err != nil {\n\t\t\tw.logger.Log(\"err\", errors.Wrap(err, \"fetch job\")) // abnormal\n\t\t\ttime.Sleep(pollingPeriod)\n\t\t\tcontinue\n\t\t}\n\t\tlogger := log.NewContext(w.logger).With(\"job\", job.ID)\n\t\tlogger.Log(\"method\", job.Method)\n\n\t\tcancel, done := make(chan struct{}), make(chan struct{})\n\t\tgo heartbeat(job.ID, w.jobs, time.Second, cancel, done, logger)\n\n\t\tjob.Status = \"Executing...\"\n\t\tif err := w.jobs.UpdateJob(job); err != nil {\n\t\t\tlogger.Log(\"err\", errors.Wrap(err, \"updating job\"))\n\t\t}\n\n\t\tbegin := time.Now().UTC()\n\t\tvar followUps []Job\n\t\tif handler, ok := w.handlers[job.Method]; !ok {\n\t\t\terr = ErrNoHandlerForJob\n\t\t} else {\n\t\t\tfollowUps, err = handler.Handle(&job, w.jobs)\n\t\t}\n\t\tjobDuration.With(\n\t\t\tfluxmetrics.LabelMethod, job.Method,\n\t\t\tfluxmetrics.LabelSuccess, fmt.Sprint(err == nil),\n\t\t).Observe(time.Since(begin).Seconds())\n\t\tlogger.Log(\"took\", time.Since(begin))\n\t\tjob.Done = true\n\t\tif err != nil {\n\t\t\tjob.Success = false\n\t\t\tstatus := fmt.Sprintf(\"Failed: %s\", err)\n\t\t\tjob.Status = status\n\t\t\tjob.Log = append(job.Log, status)\n\t\t\t// Find the underlying, \"helpful\" error. We get the base\n\t\t\t// error because we don't care about dispatching on the\n\t\t\t// kind of error, just the help message.\n\t\t\terr = errors.Cause(err)\n\t\t\tif baseErr, ok := err.(flux.HelpfulError); ok {\n\t\t\t\tjob.Error = baseErr.Base()\n\t\t\t} else {\n\t\t\t\tjob.Error = flux.CoverAllError(err)\n\t\t\t}\n\t\t} else {\n\t\t\tjob.Success = true\n\t\t\tjob.Status = \"Complete.\"\n\t\t}\n\t\tif err := w.jobs.UpdateJob(job); err != nil {\n\t\t\tlogger.Log(\"err\", errors.Wrap(err, \"updating job\"))\n\t\t}\n\n\t\t// Schedule any follow-up jobs\n\t\tfor _, followUp := range followUps {\n\t\t\tif _, err := w.jobs.PutJob(job.Instance, followUp); err != nil && err != ErrJobAlreadyQueued {\n\t\t\t\tlogger.Log(\"err\", errors.Wrap(err, \"putting follow-up job\"))\n\t\t\t}\n\t\t}\n\n\t\tclose(cancel)\n\t\t<-done\n\t}\n}", "title": "" }, { "docid": "97c2671fc127309d3546e24f4fed622e", "score": "0.58641726", "text": "func (mp *MiniPinger) checkFinish(wg *sync.WaitGroup){\n\tdefer wg.Done()\n\n\tstartTime := time.Now()\n\tmp.startTime = startTime\n\tendTime := startTime.Add(mp.deadline)\n\tfor {\n\t\tcurrTime := time.Now()\n\t\tselect{\n\t\tcase <-mp.finished:\n\t\t\treturn\n\t\tdefault:\n\t\t\tif currTime.After(endTime) {\n\t\t\t\tclose(mp.finished)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif mp.packetsSent>mp.count {\n\t\t\t\tclose(mp.finished)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "403b8a2f71bda112ecfdd6521a11ed50", "score": "0.5768963", "text": "func (t *Tube) Watch() {\n\n\tfor {\n\t\tjobs, err := t.Head.Poll()\n\t\tif err != nil {\n\t\t\t// TODO: recover\n\t\t}\n\n\t\tfor _, job := range jobs {\n\t\t\tgo func(job adapters.AJob) {\n\t\t\t\terror := t.Tail.Post(job)\n\t\t\t\tif error != nil {\n\t\t\t\t\t// push the job back to the queue\n\t\t\t\t\tt.Head.Post(job)\n\t\t\t\t} else {\n\t\t\t\t\t// job is done, delete from the queue\n\t\t\t\t\tt.Head.Delete(job)\n\t\t\t\t}\n\t\t\t}(job)\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "e5136572630b540892c8920875360c17", "score": "0.5764947", "text": "func (q *Q) Done() {\n\tq.delJob()\n\t// if channel buffer reaches to the max.\n\t// replace this with a new channel\n\tif len(q.waitSignal) == q.max {\n\t\tq.waitSignal = make(chan bool, q.max)\n\t}\n\tq.waitSignal <- true\n}", "title": "" }, { "docid": "ea87f29fe672874a43c31af02d92639f", "score": "0.57409936", "text": "func (p *Pool) JobDone() {\n\tp.wg.Done()\n}", "title": "" }, { "docid": "d2dc6de8aecb13edf4d89bfc646b656e", "score": "0.57167244", "text": "func (q *Q) waitForEnd() {\n\tfor {\n\t\tif len(q.hasJob) == 0 {\n\t\t\treturn\n\t\t}\n\t\t<-q.waitSignal\n\t}\n}", "title": "" }, { "docid": "47cbf156aa5350ef573bd827c2e803fd", "score": "0.5709559", "text": "func (o *Orchestrator) checkFinished() {\n\t// there are no tasks being Processed\n\tif o.inProcess == 0 {\n\t\to.doneCh <- struct{}{}\n\t}\n}", "title": "" }, { "docid": "7e64598d9618f50d9f806ea7a575ae5d", "score": "0.56848246", "text": "func WhenAllFinished(closeHandler func()) func(*executor) {\n\treturn func(e *executor) {\n\t\te.closeHandler = closeHandler\n\t}\n}", "title": "" }, { "docid": "6decc1772c4809c113b11688b842d59b", "score": "0.5678912", "text": "func (m *PrintJobConfiguration) GetFinishings()([]PrintFinishing) {\n return m.finishings\n}", "title": "" }, { "docid": "809db52892a9ef2912cfa2c889567d94", "score": "0.56470066", "text": "func (w *Watchable) Done() chan error {\n\treturn w.Finished\n}", "title": "" }, { "docid": "7dff455ab4a0ba8001d8fd5d7240d193", "score": "0.561859", "text": "func (w *Worker) Done() {\n\tw.Count--\n\tw.CountChan <- w.Count\n}", "title": "" }, { "docid": "ca8eba0eed76c7f9faa4bbd5ec3bb6ad", "score": "0.55907744", "text": "func (wa *Watcher) wgDone() {\n\tatomic.AddInt64(wa.count, -1)\n\twa.wg.Done()\n}", "title": "" }, { "docid": "f4ad03c08abc85a96908e6095e52d697", "score": "0.5589332", "text": "func worker() {\n\tfor work := range workChannel {\n\t\twork.run()\n\t\t// work done, send it to the finishedChannel\n\t\tfinishedChannel <- work\n\t}\n}", "title": "" }, { "docid": "879aa0e8ea708e575e9d4653e7cb291f", "score": "0.55832416", "text": "func (cnt *counter) worker(jobs chan string) {\n\tdefer cnt.waitGroup.Done()\n\tfor job := range jobs {\n\t\tfor _, rune := range job {\n\t\t\tcnt.mutex.Lock()\n\t\t\tcnt.frequency[string(rune)]++\n\t\t\tcnt.mutex.Unlock()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "04a46238c5d557c479237bf430bddebf", "score": "0.5554467", "text": "func (s *Step) Done(timedOut bool, err error, watchers map[string]*Step) {\n\tif !s.EndTime.IsZero() {\n\t\treturn\n\t}\n\ts.Mutex.Lock()\n\tdefer s.Mutex.Unlock()\n\tif !s.EndTime.IsZero() { // double check now that we hold the mutex\n\t\treturn\n\t}\n\n\ts.EndTime = time.Now()\n\tif err != nil {\n\t\ts.Err = err\n\t} else if timedOut {\n\t\t// This step never completed. Was it because a prerequisite never completed?\n\t\tvar incompletePrereq []string\n\t\tfor _, prereqKey := range s.Prereqs {\n\t\t\tif prereq, ok := watchers[prereqKey]; ok && prereq.EndTime.IsZero() || prereq.Err != nil {\n\t\t\t\tincompletePrereq = append(incompletePrereq, prereqKey)\n\t\t\t}\n\t\t}\n\t\tif len(incompletePrereq) > 0 {\n\t\t\ts.Err = fmt.Errorf(\"Unable to complete due to failed prerequisite(s): %v\", incompletePrereq)\n\t\t} else {\n\t\t\ts.Err = fmt.Errorf(\"Timed out prior to completion\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4d2c1d198135db7b74e91da1ea4a8734", "score": "0.55462795", "text": "func (j *job) run() {\n\tj.history.Value = fmt.Sprintf(\"%s:started\\n\", time.Now().String())\n\tj.history = j.history.Next()\n\tfor {\n\t\tnow := time.Now()\n\t\te, err := cronexpr.Parse(j.defn.schedule)\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"Can't parse %s [%s]\", j.defn.schedule, err)\n\t\t\treturn\n\t\t}\n\n\t\tselect {\n\t\tcase <-time.After(e.Next(now).Sub(now)):\n\t\t\tglog.V(3).Infof(\"running `%s`\", j.defn.cmd)\n\t\t\tvar out bytes.Buffer\n\t\t\tk := exec.Command(\"/bin/bash\", \"-c\", j.defn.cmd)\n\t\t\tk.Stdout = &out\n\t\t\tif err := k.Run(); err != nil {\n\t\t\t\tglog.Errorf(\"%s failed: %v\", j.defn.cmd, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tglog.V(3).Infof(\"%s returned: %s\", j.defn.name, out.String())\n\t\t\tj.history.Value = fmt.Sprintf(\"%s:%s\", time.Now().String(), out.String())\n\t\t\tj.history = j.history.Next()\n\t\tcase <-j.done:\n\t\t\tglog.V(3).Infof(\"completed\")\n\t\t\tj.history.Value = fmt.Sprintf(\"%s:completed\\n\", time.Now().String())\n\t\t\tj.history = j.history.Next()\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "379297a7e8640b8dd765f84cc57da3d1", "score": "0.5528757", "text": "func (manager *ProjectUpdateManager) waitingForJobToComplete() {\n\tfor manager.stage.State == config.RunningState {\n\t\ttime.Sleep(time.Second * sleepTimeBetweenStatusChecksSec)\n\t\terr := manager.updateStage(\n\t\t\tfunc(stage config.ProjectUpdateStage) (config.ProjectUpdateStage, error) {\n\t\t\t\treturn manager.checkedDomainServices(stage)\n\t\t\t})\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"checked Domain Services. %v\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "da4859fe04d45e7ff7955a22da4636e7", "score": "0.55232316", "text": "func (tm *TorrentQueue) JobDone(hash string) {\n\ttm.Lock()\n\tdefer tm.Unlock()\n\tif t, ok := tm.data[hash]; ok {\n\t\tt.status = tsDefault\n\t}\n}", "title": "" }, { "docid": "4a39c3b445abc6729c6b0066a907a3f2", "score": "0.5495404", "text": "func (sdt *streamDurationTrace) Done() {\n\tduration := time.Now().Sub(sdt.startTime)\n\n\tif sdt.success {\n\t\tsdt.traceListener.TraceMessage(fmt.Sprintf(\"%v, Duration: %vms, Success\", sdt.output, duration.Milliseconds()), telemetry.Information)\n\t} else {\n\t\tsdt.traceListener.TraceMessage(fmt.Sprintf(\"%v, Duration: %vms, Failed: %v\", sdt.output, duration.Milliseconds(), sdt.statusCode), telemetry.Error)\n\t}\n}", "title": "" }, { "docid": "783756459b6e968aa518c49426c1a669", "score": "0.5487694", "text": "func main() {\n\n\tstarTime := time.Now()\n\n\tjobCount := 10\n\tjobQueue := make(chan string, jobCount)\n\n\t// make 100 job\n\tfor i := 1; i <= jobCount; i++ {\n\t\tjobQueue <- fmt.Sprintf(\"job-%d\", i)\n\t}\n\n\tclose(jobQueue)\n\n\truntime.GOMAXPROCS(4)\n\n\tworkerCount := 10\n\twg := sync.WaitGroup{}\n\n\twg.Add(workerCount)\n\n\tresult := make(chan string, jobCount)\n\n\n\tfor i := 0; i < workerCount; i++ {\n\t\tgo worker(i, &wg, jobQueue, result)\n\t}\n\n\tfmt.Println(\"Wait group\")\n\twg.Wait()\n\tclose(result)\n\n\tfor r := range result {\n\n\t\tfmt.Println(r)\n\t}\n\n\tduration := time.Since(starTime)\n\n\tfmt.Println(duration)\n\n}", "title": "" }, { "docid": "a3e346ed5b82597ff7deba65f5af42a0", "score": "0.54670304", "text": "func (w *drainingJobWatcher) watch() {\n\twaitIndex := uint64(1)\n\tfor {\n\t\tw.logger.Printf(\"[TRACE] nomad.drain.job_watcher: getting job allocs at index %d\", waitIndex)\n\t\tjobAllocs, index, err := w.getJobAllocs(w.getQueryCtx(), waitIndex)\n\t\tw.logger.Printf(\"[TRACE] nomad.drain.job_watcher: got allocs for %d jobs at index %d: %v\", len(jobAllocs), index, err)\n\t\tif err != nil {\n\t\t\tif err == context.Canceled {\n\t\t\t\t// Determine if it is a cancel or a shutdown\n\t\t\t\tselect {\n\t\t\t\tcase <-w.ctx.Done():\n\t\t\t\t\tw.logger.Printf(\"[TRACE] nomad.drain.job_watcher: shutting down\")\n\t\t\t\t\treturn\n\t\t\t\tdefault:\n\t\t\t\t\t// The query context was cancelled;\n\t\t\t\t\t// reset index so we don't miss past\n\t\t\t\t\t// updates to newly registered jobs\n\t\t\t\t\twaitIndex = 1\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tw.logger.Printf(\"[ERR] nomad.drain.job_watcher: error watching job allocs updates at index %d: %v\", waitIndex, err)\n\t\t\tselect {\n\t\t\tcase <-w.ctx.Done():\n\t\t\t\tw.logger.Printf(\"[TRACE] nomad.drain.job_watcher: shutting down\")\n\t\t\t\treturn\n\t\t\tcase <-time.After(stateReadErrorDelay):\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tlastHandled := waitIndex\n\t\twaitIndex = index\n\n\t\t// Snapshot the state store\n\t\tsnap, err := w.state.Snapshot()\n\t\tif err != nil {\n\t\t\tw.logger.Printf(\"[WARN] nomad.drain.job_watcher: failed to snapshot statestore: %v\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tcurrentJobs := w.drainingJobs()\n\t\tvar allDrain, allMigrated []*structs.Allocation\n\t\tfor jns, allocs := range jobAllocs {\n\t\t\t// Check if the job is still registered\n\t\t\tif _, ok := currentJobs[jns]; !ok {\n\t\t\t\tw.logger.Printf(\"[TRACE] nomad.drain.job_watcher: skipping job %v as it is no longer registered for draining\", jns)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tw.logger.Printf(\"[TRACE] nomad.drain.job_watcher: handling job %v\", jns)\n\n\t\t\t// Lookup the job\n\t\t\tjob, err := snap.JobByID(nil, jns.Namespace, jns.ID)\n\t\t\tif err != nil {\n\t\t\t\tw.logger.Printf(\"[WARN] nomad.drain.job_watcher: failed to lookup job %v: %v\", jns, err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Ignore purged jobs\n\t\t\tif job == nil {\n\t\t\t\tw.logger.Printf(\"[TRACE] nomad.drain.job_watcher: ignoring garbage collected job %q\", jns)\n\t\t\t\tw.deregisterJob(jns.ID, jns.Namespace)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Ignore any system jobs\n\t\t\tif job.Type == structs.JobTypeSystem {\n\t\t\t\tw.deregisterJob(job.ID, job.Namespace)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tresult, err := handleJob(snap, job, allocs, lastHandled)\n\t\t\tif err != nil {\n\t\t\t\tw.logger.Printf(\"[ERR] nomad.drain.job_watcher: handling drain for job %v failed: %v\", jns, err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tw.logger.Printf(\"[TRACE] nomad.drain.job_watcher: result for job %v: %v\", jns, result)\n\n\t\t\tallDrain = append(allDrain, result.drain...)\n\t\t\tallMigrated = append(allMigrated, result.migrated...)\n\n\t\t\t// Stop tracking this job\n\t\t\tif result.done {\n\t\t\t\tw.deregisterJob(job.ID, job.Namespace)\n\t\t\t}\n\t\t}\n\n\t\tif len(allDrain) != 0 {\n\t\t\t// Create the request\n\t\t\treq := NewDrainRequest(allDrain)\n\t\t\tw.logger.Printf(\"[TRACE] nomad.drain.job_watcher: sending drain request for %d allocs\", len(allDrain))\n\n\t\t\tselect {\n\t\t\tcase w.drainCh <- req:\n\t\t\tcase <-w.ctx.Done():\n\t\t\t\tw.logger.Printf(\"[TRACE] nomad.drain.job_watcher: shutting down\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Wait for the request to be committed\n\t\t\tselect {\n\t\t\tcase <-req.Resp.WaitCh():\n\t\t\tcase <-w.ctx.Done():\n\t\t\t\tw.logger.Printf(\"[TRACE] nomad.drain.job_watcher: shutting down\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// See if it successfully committed\n\t\t\tif err := req.Resp.Error(); err != nil {\n\t\t\t\tw.logger.Printf(\"[ERR] nomad.drain.job_watcher: failed to transition allocations: %v\", err)\n\t\t\t}\n\n\t\t\t// Wait until the new index\n\t\t\tif index := req.Resp.Index(); index > waitIndex {\n\t\t\t\twaitIndex = index\n\t\t\t}\n\t\t}\n\n\t\tif len(allMigrated) != 0 {\n\t\t\tw.logger.Printf(\"[TRACE] nomad.drain.job_watcher: sending migrated for %d allocs\", len(allMigrated))\n\t\t\tselect {\n\t\t\tcase w.migratedCh <- allMigrated:\n\t\t\tcase <-w.ctx.Done():\n\t\t\t\tw.logger.Printf(\"[TRACE] nomad.drain.job_watcher: shutting down\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "078f7c452596b874e793f40e3f33e8f8", "score": "0.54454935", "text": "func (con *Controller) waitForFinish(done chan<- bool) {\n\tticker := time.NewTicker(1 * time.Millisecond)\n\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\tvar finished bool\n\t\t\tcon.client.Call(\"Game.IsFinished\", \"\", &finished)\n\t\t\tif finished {\n\t\t\t\tdone <- true\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ab6ef7072aba26ed86910b6ec82a7cd3", "score": "0.544029", "text": "func (q *Queue) WaitForJobsToFinish() error {\n\tq.unfinished.Wait()\n\treturn nil\n}", "title": "" }, { "docid": "b90a72403eb0c790c4f7701056bda420", "score": "0.54259634", "text": "func (j *Job) Done() error {\n\tagent := j.bc.NewAgent()\n\tdefer j.bc.RemoveAgent(agent.ID)\n\tagent.Send(protocol.WORKDONE, j.Handle)\n\treturn nil\n}", "title": "" }, { "docid": "511903dab67800ada6846e558bb1fb90", "score": "0.5380685", "text": "func (m *PrintJobConfiguration) SetFinishings(value []PrintFinishing)() {\n m.finishings = value\n}", "title": "" }, { "docid": "8ef0f9763f9fd4e3471123aeeda9dea9", "score": "0.53755337", "text": "func (w *WorkQueue) Complete() {\n\tw.done <- true\n}", "title": "" }, { "docid": "395bd86d5cae1ccaa71d1fc6458ab5b9", "score": "0.53632677", "text": "func (d *driverInternal) JobStats(ctx context.Context) <-chan amboy.JobStatusInfo {\n\td.jobs.RLock()\n\tdefer d.jobs.RUnlock()\n\tout := make(chan amboy.JobStatusInfo, len(d.jobs.m))\n\tdefer close(out)\n\n\tfor _, job := range d.jobs.m {\n\t\tif ctx.Err() != nil {\n\t\t\treturn out\n\t\t}\n\n\t\tstatus := job.Status()\n\t\tstatus.ID = job.ID()\n\t\tout <- status\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "8db4f2c7f43dd8b70e17b1c625d3c3cb", "score": "0.5360249", "text": "func main() {\n\tjob := make(chan int, 3)\n\tdone := make(chan bool)\n\n\tgo func() {\n\t\tfor {\n\t\t\t// item and more is waiting for an input 'job'.\n\t\t\titem, more := <-job\n\t\t\tif more == true {\n\t\t\t\tfmt.Println(\"there is more. \", item)\n\t\t\t} else {\n\t\t\t\tfmt.Println(\"no more\")\n\t\t\t\t// assigned 'done'\n\t\t\t\tdone <- true\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\tfor ix := 0; ix < 3; ix++ {\n\t\t// 'job' is assigned here.\n\t\tjob <- ix\n\t\tfmt.Println(\"times: \", ix)\n\t}\n\t// close channel on 'job'. item, more := <-job (nil, true)\n\tclose(job)\n\tfmt.Println(\"complete sent\")\n\t// waiting for the 'done' to be assigned\n\t<-done\n\n}", "title": "" }, { "docid": "6a1f29253de7197d0ec0a0924167b50f", "score": "0.53489995", "text": "func (c *Custodian) watchPegOuts(ctx context.Context, pegouts <-chan pegOut) {\n\tdefer log.Print(\"watchPegOuts exiting\")\n\n\tticker := time.NewTicker(time.Minute)\n\tdefer ticker.Stop()\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tcase <-ticker.C:\n\t\t\tconst q = `SELECT txid, pegout_json FROM exports WHERE pegged_out IN ($1, $2)`\n\t\t\tvar txids, refs [][]byte\n\t\t\terr := sqlutil.ForQueryRows(ctx, c.DB, q, pegOutOK, pegOutFail, func(txid, ref []byte) {\n\t\t\t\ttxids = append(txids, txid)\n\t\t\t\trefs = append(refs, ref)\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalf(\"querying peg-outs: %s\", err)\n\t\t\t}\n\t\t\tfor i, txid := range txids {\n\t\t\t\tvar p pegOut\n\t\t\t\terr = json.Unmarshal(refs[i], &p)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatalf(\"unmarshaling reference: %s\", err)\n\t\t\t\t}\n\t\t\t\tp.TxID = txid\n\t\t\t\terr = c.doPostPegOut(ctx, p)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatalf(\"doing post-peg-out: %s\", err)\n\t\t\t\t}\n\t\t\t}\n\t\tcase p, ok := <-pegouts:\n\t\t\tif !ok {\n\t\t\t\tlog.Fatalf(\"peg-outs channel closed\")\n\t\t\t}\n\t\t\terr := c.doPostPegOut(ctx, p)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalf(\"doing post-peg-out: %s\", err)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9884ece6374c924a9aa93b103787dc40", "score": "0.53330505", "text": "func watchProgress(ctx context.Context, comms *Comms, oid string, size int, c progress.Counter) {\n\n var last int\n t := progress.NewTicker(ctx, c, int64(size), time.Millisecond * 250)\n for p := range t {\n\n total := int(p.N())\n inc := total - last\n last = total\n\n comms.Send(&ProgressMessage{\n Event: \"progress\",\n Oid: oid,\n BytesSoFar: total,\n BytesSinceLast: inc,\n })\n }\n}", "title": "" }, { "docid": "c27d95ce60fb9538e95bda6cd8419fa1", "score": "0.53048855", "text": "func (r *Result) Done() {\n\tif r.Duration == 0 {\n\t\tr.Duration = time.Since(r.Start)\n\t}\n}", "title": "" }, { "docid": "e68fdf94b34a352a0c715334ca775b97", "score": "0.52966076", "text": "func waitForDone(done chan struct{}, waitTime time.Duration) int {\n\tcount := 0\n\ttimer := time.NewTimer(waitTime)\nDONE:\n\tfor {\n\t\tselect {\n\t\tcase <-done:\n\t\t\tcount++\n\t\tcase <-timer.C:\n\t\t\tbreak DONE\n\t\t}\n\t}\n\ttimer.Stop()\n\n\treturn count\n}", "title": "" }, { "docid": "555c516f1e2bf958281aca3b804dd6e5", "score": "0.528766", "text": "func (m *Master) Done() bool {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\n\tif os.Getenv(\"MR_DEBUG\") == \"YES\" {\n\t\tfmt.Fprintf(os.Stderr,\n\t\t\t\"\\n===============\\nFile count: %v\\nMap count: %v\\nReduce count: %v\\n\",\n\t\t\tlen(m.fileStats),\n\t\t\tlen(m.mapJobs),\n\t\t\tlen(m.reduceJobs))\n\t}\n\n\tif len(m.fileStats) == 0 {\n\t\tfmt.Fprintf(os.Stderr, \"Don't have jobs\\n\")\n\t\treturn false\n\t}\n\n\tif len(m.reduceJobs) < m.nReduce {\n\t\treturn false\n\t}\n\n\tfor _, jobInfo := range m.reduceJobs {\n\t\tif jobInfo.status != \"finished\" {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tfmt.Printf(\"ALL DONE!\\n\")\n\treturn true\n}", "title": "" }, { "docid": "fa326cc7b775532503c7e825de2abb64", "score": "0.52752453", "text": "func (b *Requester) Finish() *Report {\n\tclose(b.results)\n\ttotal := time.Now().Sub(b.start)\n\n\t// Wait until the reporter is done.\n\t<-b.reporter.done\n\n\treturn b.reporter.Finalize(b.stopReason, total)\n}", "title": "" }, { "docid": "1f1104ccc4945ae77e001114178df7dc", "score": "0.5271977", "text": "func (obj *Workers) processJobs() {\n\tfor job := range obj.In {\n\t\tjob.DoJob(obj.Arg)\n\t\tobj.Out <- job\n\t}\n\n\tobj.Lock()\n\tdefer obj.Unlock()\n\n\tobj.wg.Done()\n\tobj.CurrentWorkers--\n}", "title": "" }, { "docid": "927911198e1a28a5a61e06123020db47", "score": "0.52601975", "text": "func (b *MetricsCollector) Collect(ch chan<- prometheus.Metric) {\n\tvar mTime time.Time\n\tfor bucketID, data := range mc.Buckets {\n\t\tif data.Status == closed {\n\t\t\tfor _, mf := range data.CaFetchedData {\n\t\t\t\tallLabelNames := map[string]struct{}{}\n\t\t\t\tfor _, metric := range mf.Metric {\n\t\t\t\t\tlabels := metric.GetLabel()\n\t\t\t\t\tfor _, label := range labels {\n\t\t\t\t\t\tif _, ok := allLabelNames[label.GetName()]; !ok {\n\t\t\t\t\t\t\tallLabelNames[label.GetName()] = struct{}{}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfor _, metric := range mf.Metric {\n\t\t\t\t\tmTime = data.TimeStamp\n\t\t\t\t\ttm := metric.GetTimestampMs()\n\t\t\t\t\tif tm != 0 {\n\t\t\t\t\t\tmTime = time.Unix(tm, 0)\n\t\t\t\t\t}\n\t\t\t\t\texecute(mf, metric, ch, allLabelNames, mTime, bucketID)\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tmc.Buckets[bucketID].Status = open\n\t\t\tsuccess = 1\n\t\t\tch <- prometheus.MustNewConstMetric(scrapeSuccessDesc, prometheus.CounterValue, success, \"metric\")\n\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "0522029728eac1d020ac8ed2bfceb50b", "score": "0.5256262", "text": "func (wg *WorkerGroup) Done() {\n\tatomic.AddUint32(&wg.workers, ^uint32(0))\n}", "title": "" }, { "docid": "5cd8c88b2de0d4f1b42d009f05957d9b", "score": "0.52518684", "text": "func (w *Pool) work() {\n\tfor job := range w.JobsInChan {\n\t\tjob.Perform()\n\t\tw.ResultOutChan <- job\n\t}\n}", "title": "" }, { "docid": "040094ece690c9ca01cdcdf958732646", "score": "0.524454", "text": "func TestResult_Merge_Finished(t *testing.T) { // use this delay to prevent timeout failures if our chans fail to close\n\tdelay, _ := time.ParseDuration(\"1s\")\n\ttimeout := time.After(delay)\n\tnow := time.Now()\n\n\tres := base.NewResult()\n\n\tmerge1 := base.NewResult()\n\tmerge2 := base.NewResult()\n\n\tres.Merge(merge1.Result())\n\tres.Merge(merge2.Result())\n\n\tfin := res.Finished()\n\n\tmerge1.MarkFinished()\n\tmerge2.MarkFinished()\n\n\tselect {\n\tcase <-fin:\n\t\tt.Log(\"Channel closed properly\")\n\tcase <-timeout:\n\t\tt.Error(\"Our opened finished channel failed to close after we finished all of the merged results.\", time.Since(now))\n\t}\n\n}", "title": "" }, { "docid": "40863b6d0329855278e65fefaaba5527", "score": "0.52420586", "text": "func (prod *ProdSync) Done() {\n\tprod.wg.Done()\n}", "title": "" }, { "docid": "b338d61a1111aa385d625ab3aeea098b", "score": "0.52126896", "text": "func (t *tracker) Done() {\n\tt.mu.Lock()\n\tt.c--\n\tt.mu.Unlock()\n\tt.cond.Broadcast()\n}", "title": "" }, { "docid": "21b69dd985a8e947f5fb241777adfae6", "score": "0.5209112", "text": "func isJobFinished(j *batchv1.Job) bool {\n\tfor _, c := range j.Status.Conditions {\n\t\tif (c.Type == batchv1.JobComplete || c.Type == batchv1.JobFailed) && c.Status == corev1.ConditionTrue {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "bc0114058cbaa7861beb1d8662e55df8", "score": "0.5194526", "text": "func (p *AsyncAppend) Done() <-chan struct{} { return p.op.Done() }", "title": "" }, { "docid": "5f233eaa04e0ac6e0210ef27b96fac25", "score": "0.51931685", "text": "func result(done chan bool) {\n\tfor result := range results {\n\t\tfmt.Println(\"Job id , input random no corresponding to the request received and the location obtained corresponding to request \", result.job.id, result.job.randomno, result.location)\n\t}\n\tdone <- true\n}", "title": "" }, { "docid": "ef040232909116610a289c27e1d40273", "score": "0.51833314", "text": "func Watch(files ...string) (<-chan TrulyFullInfo, <-chan string) {\n\tfileQueue := make(chan TrulyFullInfo)\n\tlogs := make(chan string)\n\n\tvar wg sync.WaitGroup\n\n\twg.Add(len(files))\n\n\tfor _, fname := range files {\n\t\tgo func(fname string) {\n\t\t\tsizeCounter := &sizeCounter{0, 0}\n\n\t\t\ttk := time.NewTicker(CheckInterval)\n\t\t\tdefer func() {\n\t\t\t\ttk.Stop()\n\n\t\t\t\twg.Done()\n\t\t\t}()\n\n\t\t\tfor range tk.C {\n\t\t\t\tfile, err := os.Open(fname)\n\t\t\t\tif err != nil {\n\t\t\t\t\tif os.IsNotExist(err) || os.IsPermission(err) {\n\t\t\t\t\t\tfileQueue <- TrulyFullInfo{fname, nil}\n\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tlogs <- fmt.Sprint(err)\n\t\t\t\t}\n\n\t\t\t\tif fi, err := file.Stat(); err == nil {\n\t\t\t\t\tif fi.IsDir() {\n\t\t\t\t\t\tfileQueue <- TrulyFullInfo{fname, nil}\n\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tcsize := fi.Size()\n\n\t\t\t\t\tlogs <- fmt.Sprintf(\"Current size (attempt %d) of %s is %d\", sizeCounter.attemps, fname, csize)\n\n\t\t\t\t\tif csize == sizeCounter.size {\n\t\t\t\t\t\tsizeCounter.attemps++\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsizeCounter.attemps = 0\n\t\t\t\t\t}\n\n\t\t\t\t\tif sizeCounter.attemps > CheckAttempts {\n\t\t\t\t\t\tfileQueue <- TrulyFullInfo{fname, file}\n\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tsizeCounter.size = csize\n\t\t\t\t} else {\n\t\t\t\t\tlogs <- fmt.Sprint(err)\n\t\t\t\t}\n\n\t\t\t\tif err := file.Close(); err != nil {\n\t\t\t\t\tlogs <- fmt.Sprint(err)\n\t\t\t\t}\n\t\t\t}\n\t\t}(fname)\n\t}\n\n\tgo func() {\n\t\twg.Wait()\n\n\t\tclose(fileQueue)\n\t\tclose(logs)\n\t}()\n\n\treturn fileQueue, logs\n}", "title": "" }, { "docid": "bd1c2e2e6286b3711c88119bda7ec44f", "score": "0.5172456", "text": "func (s *DurationRatioStat) Done(k interface{}) {\n\ts.m.Lock()\n\tdefer s.m.Unlock()\n\tif !s.isStarted {\n\t\treturn\n\t}\n\ts.d += time.Now().Sub(s.startedAt[k])\n\tdelete(s.startedAt, k)\n}", "title": "" }, { "docid": "e66d5ca2bea60337b0eb323addadef0c", "score": "0.5171611", "text": "func (group *DnsJobs) Wait() {\n\tfor _, job := range group.jobs {\n\t\tjob.Wait()\n\t}\n}", "title": "" }, { "docid": "2df3f95759fc410e3acb7b2633397529", "score": "0.51654106", "text": "func (c *jobCache) expireJobs() {\n\texpiredUnfinishedCount := 0\n\tfor _, job := range c.jobs {\n\t\tif !c.timeWindow.TestTime(job.Repo, c.getJobTimestamp(job)) {\n\t\t\tdelete(c.jobs, job.Id)\n\t\t\tdelete(c.unfinished, job.Id)\n\t\t\tif !job.Done() {\n\t\t\t\texpiredUnfinishedCount++\n\t\t\t}\n\t\t}\n\t}\n\tif expiredUnfinishedCount > 0 {\n\t\tsklog.Infof(\"Expired %d unfinished jobs created before window.\", expiredUnfinishedCount)\n\t}\n\tfor repo, revMap := range c.triggeredForCommit {\n\t\tfor rev := range revMap {\n\t\t\tts, err := c.getRevisionTimestamp(repo, rev)\n\t\t\tif err != nil {\n\t\t\t\tsklog.Error(err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !c.timeWindow.TestTime(repo, ts) {\n\t\t\t\tdelete(revMap, rev)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "835127fc831b1b479f53c01aae928846", "score": "0.5165046", "text": "func (c *concurrencyManager) Done() {\n\t// Decrease the number of running count\n\tatomic.AddInt32(&c.runningCount, -1)\n\tc.doneCh <- true\n}", "title": "" }, { "docid": "ccad78359be0a6ac2bb86da78be5d83d", "score": "0.5147503", "text": "func ticker(mutexDone *sync.Mutex, done *bool, mutexControllers *sync.Mutex, mutexTurnsWorld *sync.Mutex,\n\tcompletedTurns *int, controllers *[]net.Conn, numAliveCells *int) {\n\tticker := time.NewTicker(2 * time.Second)\n\tfor {\n\t\t<-ticker.C\n\t\tmutexDone.Lock()\n\t\tif !*done {\n\t\t\tmutexControllers.Lock()\n\t\t\tmutexTurnsWorld.Lock()\n\t\t\tfmt.Printf(\"%d Turns Completed\\n\", *completedTurns)\n\t\t\tsendToAll(*controllers, fmt.Sprintf(\"REPORT_ALIVE\\n%d\\n%d\\n\", *completedTurns, *numAliveCells))\n\t\t\tmutexTurnsWorld.Unlock()\n\t\t\tmutexControllers.Unlock()\n\t\t} else {\n\t\t\tticker.Stop()\n\t\t\tbreak\n\t\t}\n\t\tmutexDone.Unlock()\n\t}\n}", "title": "" }, { "docid": "a81d9cbb8bf9604e15d3ef4e5d390fdf", "score": "0.51431626", "text": "func jobCallback(job *workout.Job, err error, dur time.Duration) {\n\tif err != nil {\n\t\tfmt.Printf(\"job %d encountered an error: %s (took %v)\\n\", job.Id, err, dur)\n\t} else {\n\t\tfmt.Printf(\"job %d succeeded (took %v)\\n\", job.Id, dur)\n\t}\n\treturn\n}", "title": "" }, { "docid": "8f7ee96e4f862333e0bbdd6802a7602f", "score": "0.5135196", "text": "func (wg *WaitGroup) Done() {\n\tatomic.AddInt32(&wg.counter, -1)\n}", "title": "" }, { "docid": "3609aa63944f3847499576330ea1c653", "score": "0.5127664", "text": "func (r *RealTimer) Done() <-chan Ack {\n\tgo func() {\n\t\tfor {\n\t\t\tif atomic.LoadInt32(&r.stopped) != 0 {\n\t\t\t\treturn\n\t\t\t}\n\t\t\trecvT := <-r.timer.C\n\t\t\tr.doneCh <- Ack{Time: recvT, Fn: r.ackFn}\n\t\t}\n\t}()\n\treturn r.doneCh\n}", "title": "" }, { "docid": "9f8c91a954ac67f4baad7fce2e378f87", "score": "0.512758", "text": "func (j *Jobs) Done() bool {\n\treturn j.response.Done\n}", "title": "" }, { "docid": "3623595eb7ddbd3a420ee7077d81ebc3", "score": "0.51229906", "text": "func (jl *Clock) WaitJobs() uint64 {\r\n\tjobs := atomic.LoadUint64(&jl.waitJobsNum) - 1\r\n\treturn jobs\r\n}", "title": "" }, { "docid": "4b5b00bd459fc049214e92f33e039c89", "score": "0.51187307", "text": "func (reg *etcdRegister) waitForReady(count int) {\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\tfor count < reg.clusterSize {\n\t\tif _, ok := <- watchFileChange(ctx, reg.regPath); !ok {\n\t\t\tlog.Fatalln(\"watch file change is closed without reaching cluster size\")\n\t\t}\n\t\tvar err error\n\t\tcount, err = countFileLines(reg.regPath)\n\t\tif err != nil {\n\t\t\tlog.Fatalln(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5c18e87c543c6812bbbf40d510434de8", "score": "0.5112581", "text": "func watchOver(j Job) {\n\tjh := j.JobHeader\n\n\tvar jsr messages.JobStatusRequest\n\tjsr.JobHeader = jh\n\n\tstatusMessages := make(chan messages.JobStatus)\n\tstatusSubscriber := func(msg messages.Message, src messages.Line) (keepgoing bool) {\n\t\ttyp := string(msg.Payload[\"type\"])\n\t\tif typ != messages.JobStatusType {\n\t\t\tkeepgoing = true\n\t\t\treturn\n\t\t}\n\t\tjs, _ := messages.JobStatusFromMessage(msg)\n\t\tjsh := js.JobHeader\n\t\tif jsh == jh {\n\t\t\tstatusMessages <- js\n\t\t}\n\t\t//resubscribe to get the next status\n\t\tkeepgoing = false\n\t\treturn\n\t}\n\n\tmsg := jsr.Message()\n\tmsg.Broadcast = true\n\n\tisMyJob := jobClaims.isMyJob(jh)\n\n\tbroadcast := func() {\n\t\tstatusWatcher.clearWatchStatus(jh)\t\n\t\tbroadcastMessage(msg)\n\t}\n\n\tif true {\n\t\t// new hotness\n\t\tfor {\n\t\t\tlog.Printf(\"checking on %v\", j)\n\t\t\tif !jobClaims.isMyJob(jh) {\n\t\t\t\tbroadcast()\n\n\t\t\t\tgo subscribe(statusSubscriber)\n\n\t\t\t\ttimeout := time.NewTimer(1e9)\n\t\t\t\tdefer timeout.Stop() // so if we don't pick it up, the goroutine attached to it can die\n\n\t\t\t\t//log.Printf(\"awaiting status\")\n\n\t\t\t\tselect {\n\t\t\t\tcase js := <-statusMessages:\n\t\t\t\t\tlog.Printf(\"%v is remote, %d\", j, js.Status)\n\t\t\t\t\tif js.Status == messages.JobCompleted {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\tcase <-timeout.C:\n\t\t\t\t\tlog.Printf(\"lost track of %v\", j)\n\t\t\t\t\t// no status came back in time, so reclaim and requeue\n\t\t\t\t\tjobClaims.claimJob(jh)\n\t\t\t\t\t//purgatory.AddJob(j)\n\t\t\t\t\tgo prepareJobForQueue(j)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// it's my job\n\t\t\t\tstatus, ok := jobClaims.getJobStatus(jh)\n\t\t\t\tlog.Printf(\"%v is here, %d\", j, status)\n\t\t\t\t// it's my job and completed at the same time\n\t\t\t\tif ok && status == messages.JobCompleted {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\ttime.Sleep(5e9)\n\t\t}\n\t} else {\n\t\t// old and busted\n\t\tif !isMyJob {\n\t\t\tbroadcast()\n\t\t}\n\n\t\tfor {\n\t\t\t// do this once every 5 seconds\n\t\t\ttime.Sleep(5e9)\n\n\t\t\tlog.Printf(\"checking on %v\", j)\n\n\t\t\t// if it was my job and now isn't, send out a status request and go to sleep\n\t\t\tif isMyJob && !jobClaims.isMyJob(jh) {\n\t\t\t\tisMyJob = false\n\t\t\t\tbroadcast()\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tisMyJob = jobClaims.isMyJob(jh)\n\n\t\t\t// if it's now my job, go back to sleep\n\t\t\tif isMyJob {\n\t\t\t\tstatus, ok := jobClaims.getJobStatus(jh)\n\t\t\t\tif ok && status == messages.JobCompleted {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// if it's not my job, check the last status report we got\n\t\t\tif status, set := statusWatcher.getWatchStatus(jh); set {\n\t\t\t\tif status == messages.JobCompleted {\n\t\t\t\t\t// job is done, stop watching\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t// someone, in the last sleep cycle, broadcasted a status message about this job\n\t\t\t\tbroadcast()\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tlog.Printf(\"lost track of %v\", j)\n\t\t\t\n\t\t\t// no one sent anything back, so let's send it to purgatory where it can await a worker\n\t\t\tjobClaims.claimJob(jh)\n\t\t\tisMyJob = true\n\t\t\tpurgatory.AddJob(j)\n\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b816c576ca5c2f7303815da7fcf683ed", "score": "0.5106215", "text": "func (b *Bar) end() {\n\n\tif b.isFinished {\n\t\treturn\n\t}\n\n\tb.update(b.maxVal)\n\tb.isFinished = true\n\n\telapsed := time.Since(b.startTime)\n\tfmt.Printf(\"\\nWall time: %f\\n\", elapsed.Seconds())\n}", "title": "" }, { "docid": "38814dc7080bc60fd702c39d956ee2aa", "score": "0.5102847", "text": "func (td *testData) threadFinished() {\n\ttd.mu.Lock()\n\ttd.finishedThreads++\n\tif td.finishedThreads == td.nThreads {\n\t\ttd.done.Broadcast()\n\t}\n\ttd.mu.Unlock()\n}", "title": "" }, { "docid": "7c7eedc4c597f3c1a9f40bd00c1912b0", "score": "0.5099559", "text": "func (o *Operation) finished(symbol string, color string, format string, a ...interface{}) {\n\to.channel <- true\n\n\tfmt.Printf(\"\\033[2K\")\n\tfmt.Printf(\"\\r%s %s%s%s \\n\", symbol, color, fmt.Sprintf(format, a...), reset)\n}", "title": "" }, { "docid": "34bc25e93425552a49a9a206d9bb59b6", "score": "0.5094828", "text": "func (client JobsClient) ListComplete(top *int32, filter string, cancel <-chan struct{}) (<-chan Job, <-chan error) {\n\tresultChan := make(chan Job)\n\terrChan := make(chan error, 1)\n\tgo func() {\n\t\tdefer func() {\n\t\t\tclose(resultChan)\n\t\t\tclose(errChan)\n\t\t}()\n\t\tlist, err := client.List(top, filter)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t\treturn\n\t\t}\n\t\tif list.Value != nil {\n\t\t\tfor _, item := range *list.Value {\n\t\t\t\tselect {\n\t\t\t\tcase <-cancel:\n\t\t\t\t\treturn\n\t\t\t\tcase resultChan <- item:\n\t\t\t\t\t// Intentionally left blank\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor list.NextLink != nil {\n\t\t\tlist, err = client.ListNextResults(list)\n\t\t\tif err != nil {\n\t\t\t\terrChan <- err\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif list.Value != nil {\n\t\t\t\tfor _, item := range *list.Value {\n\t\t\t\t\tselect {\n\t\t\t\t\tcase <-cancel:\n\t\t\t\t\t\treturn\n\t\t\t\t\tcase resultChan <- item:\n\t\t\t\t\t\t// Intentionally left blank\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\treturn resultChan, errChan\n}", "title": "" }, { "docid": "9fbef0bea6847c5c897cb13528b71940", "score": "0.5086184", "text": "func worker2(id int, jobs <-chan int, results chan<- int) {\n\tfor j := range jobs {\n\t\tfmt.Println(\"Worker: \", id, \"started job - \", j)\n\t\ttime.Sleep(time.Second)\n\t\tfmt.Println(\"Worker: \", id, \"finished job - \", j)\n\t\tresults <- j * 2\n\t}\n}", "title": "" }, { "docid": "62757e3d9c5e50ee99f9e5e17ca7e628", "score": "0.5085593", "text": "func (k *Keepalive) Done() {\n\tvar v interface{}\n\tk.doneChan <- v\n}", "title": "" }, { "docid": "4505bf60f786b8fe6a0113a0f63c59b1", "score": "0.5073548", "text": "func (wg *WaitGroup) Done() {}", "title": "" }, { "docid": "ca62d0e8fab0af3cbe0e5f217ad2cf46", "score": "0.506508", "text": "func (r *JobRunner) finishJob(finishedAt time.Time, exitStatus string, failedChunkCount int) error {\n\tr.job.FinishedAt = finishedAt.UTC().Format(time.RFC3339Nano)\n\tr.job.ExitStatus = exitStatus\n\tr.job.ChunksFailedCount = failedChunkCount\n\n\treturn retry.Do(func(s *retry.Stats) error {\n\t\tresponse, err := r.apiClient.FinishJob(r.job)\n\t\tif err != nil {\n\t\t\t// If the API returns with a 422, that means that we\n\t\t\t// succesfully tried to finish the job, but Buildkite\n\t\t\t// rejected the finish for some reason. This can\n\t\t\t// sometimes mean that Buildkite has cancelled the job\n\t\t\t// before we get a chance to send the final API call\n\t\t\t// (maybe this agent took too long to kill the\n\t\t\t// process). In that case, we don't want to keep trying\n\t\t\t// to finish the job forever so we'll just bail out and\n\t\t\t// go find some more work to do.\n\t\t\tif response != nil && response.StatusCode == 422 {\n\t\t\t\tr.logger.Warn(\"Buildkite rejected the call to finish the job (%s)\", err)\n\t\t\t\ts.Break()\n\t\t\t} else {\n\t\t\t\tr.logger.Warn(\"%s (%s)\", err, s)\n\t\t\t}\n\t\t}\n\n\t\treturn err\n\t}, &retry.Config{Forever: true, Interval: 1 * time.Second})\n}", "title": "" }, { "docid": "d6a45c212623e737baccbf45687cab78", "score": "0.5052963", "text": "func (xctn *Base) onFinished(err error) {\n\t// notifications\n\tif xctn.notif != nil {\n\t\tnl.OnFinished(xctn.notif, err)\n\t}\n\txactRecord := Table[xctn.kind]\n\tif xactRecord.RefreshCap {\n\t\tif cs, _ := fs.CapRefresh(nil, nil); cs.Err != nil {\n\t\t\tnlog.Errorln(cs.Err) // log warning\n\t\t}\n\t}\n\n\tIncFinished() // in re: HK cleanup long-time finished\n}", "title": "" }, { "docid": "3b4ed68620c7c89cbba725a18498eab5", "score": "0.50521845", "text": "func (gs *Gs) done() {\n\tgs.recvFinish <- struct{}{}\n}", "title": "" }, { "docid": "e2b08f705a9ef330f264a7a229069c45", "score": "0.5047014", "text": "func scheduleJobs(scheduler *JobsScheduler) {\n\tcounter := int64(0)\n\tvar jobUnit Task\n\n\tscheduleNextJobs := func() {\n\t\tfor k, job := range scheduler.jobsScheduled {\n\t\t\tscheduler.processorsChannel <- job\n\t\t\tcounter++\n\t\t\tdelete(scheduler.jobsScheduled, k)\n\t\t\tscheduler.jobsSent[k] = job\n\t\t\tif counter >= scheduler.config.processorsNum {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\t// Read saved jobs\n\tfor {\n\t\tselect {\n\t\tcase <-scheduler.jobsDone:\n\t\t\tscheduler.loggerChannel <- fmt.Sprintf(\"scheduler: exit signal received\")\n\t\t\t// Save jobs to the file\n\t\t\tfor k, v := range scheduler.jobsSent {\n\t\t\t\tscheduler.jobsScheduled[k] = v\n\t\t\t}\n\n\t\t\tscheduler.jobsDone <- struct{}{}\n\t\t\treturn\n\t\tcase job := <-scheduler.jobsChannel:\n\t\t\t// Try to put job to processor channel (ch)\n\t\t\tscheduler.jobsScheduled[job.ID] = job\n\t\t\tscheduler.loggerChannel <- fmt.Sprintf(\"scheduler: %s added to the queue\", job.ID)\n\t\t\tif counter < scheduler.config.processorsNum {\n\t\t\t\tscheduleNextJobs()\n\t\t\t}\n\t\tcase jobResultUnit := <-scheduler.resultsChannel:\n\t\t\tscheduler.loggerChannel <- fmt.Sprintf(\"scheduler: %s result received\", jobResultUnit.taskID)\n\t\t\tcounter--\n\t\t\tjobUnit = scheduler.jobsSent[jobResultUnit.taskID]\n\t\t\tjobUnit.tries++\n\t\t\tdelete(scheduler.jobsSent, jobResultUnit.taskID)\n\t\t\tif (jobResultUnit.jobResult != nil && jobResultUnit.jobResult.IsDone() && !jobResultUnit.jobResult.IsCorrupted()) || jobUnit.tries >= scheduler.config.maxTries {\n\t\t\t\tif scheduler.resultOutputs != nil {\n\t\t\t\t\tfor _, fn := range scheduler.resultOutputs {\n\t\t\t\t\t\tgo fn(jobResultUnit.jobResult) // fire and forget (needs refactoring)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tscheduler.jobsScheduled[jobResultUnit.taskID] = jobUnit\n\t\t\t\tscheduler.loggerChannel <- fmt.Sprintf(\"scheduler: %s rescheduled\", jobResultUnit.taskID)\n\t\t\t}\n\t\t\tif counter < scheduler.config.processorsNum {\n\t\t\t\tscheduleNextJobs()\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5607a5bd723052c7fa90f2cb2e714aad", "score": "0.5046696", "text": "func (px *Paxos) Done(seq int) {\n // update Done\n px.UpdateDone(seq, px.me)\n}", "title": "" }, { "docid": "6dcbc8f09cd648803deade406632115c", "score": "0.5042605", "text": "func (queue *JobQueue) WaitForAllJobs() {\n\tqueue.Wg.Wait()\n}", "title": "" }, { "docid": "889656207676646bc9025c5a3debfe21", "score": "0.504238", "text": "func (q *Queue) stats(c chan *QueueStatus, startTime time.Time) {\n\tgo func() {\n\t\ts := &QueueStatus{\n\t\t\tUptime: int(time.Since(startTime) / time.Second),\n\t\t\t//Uptime: int(time.Now().Sub(startTime) / time.Second),\n\t\t\tHosts: map[string]*HostStatus{},\n\t\t}\n\t\tfor n, h := range q.hosts {\n\t\t\ts.Hosts[n] = h.Status()\n\t\t}\n\t\tc <- s\n\t\tclose(c)\n\t}()\n}", "title": "" }, { "docid": "697b5e15cd616c1895d1c93816bea740", "score": "0.5042014", "text": "func (p *testInput) Finish(outputChan chan data.JSON, killChan chan error) {\n\n}", "title": "" }, { "docid": "ab40002b35edacb0d8bfa4268a83b079", "score": "0.50399333", "text": "func (q *Queue) Now(job func() error) {\n\t// Do the job immediately\n\tq.unfinished.Add(1)\n\tgo func() {\n\t\t// Create a status and record the start time\n\t\t// TODO How to record the original job?\n\t\ts := Status{\n\t\t\tStart: time.Now(),\n\t\t}\n\n\t\t// TODO Should tasks all implement a Job interface\n\t\t// In that case, this operation must return an error\n\t\ts.Error = job()\n\t\ts.End = time.Now()\n\t\tif s.Error == nil {\n\t\t\ts.OK = true\n\t\t}\n\n\t\t// Send the status to the logger\n\t\tq.logger.Log(s)\n\n\t\t// Decrement the job counter\n\t\tq.unfinished.Done()\n\t}()\n}", "title": "" }, { "docid": "7aefe2d7ba5c46f4e9edcf71aa0bb05f", "score": "0.50187916", "text": "func (p *ReplicationJobsClientExportPoller) Done() bool {\n\treturn p.pt.Done()\n}", "title": "" }, { "docid": "3eb67c97c6e058035db51e52213c0ac8", "score": "0.5010812", "text": "func (w *Worker) Work(i int) {\n\tif w.Jobs[i].Status == 0 {\n\t\tfor ; true; <-w.Jobs[i].Ticker.C {\n\t\t\tw.Jobs[i].Status = 1\n\t\t\tfmt.Println(\"Started working on job\", i)\n\n\t\t\tw.Jobs[i].Do()\n\n\t\t\tif w.Jobs[i].Status == 1 {\n\t\t\t\tfmt.Printf(\"Job %v is waiting\\n\", i)\n\t\t\t\tw.Jobs[i].Status = 2\n\t\t\t} else {\n\t\t\t\tfmt.Println(\"Finished working on job\", i)\n\t\t\t\tw.Wg.Done()\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8ff343be1609a7386b376e27db60baa6", "score": "0.50093275", "text": "func (m *Master) Done() bool {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\tfor _, rm := range m.ReduceMonitor {\n\t\tif rm.State != completed {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "81f1626b42ebc956afe6b511138ca66c", "score": "0.49988443", "text": "func (c *Chain) IncrementFinishedJobs(delta int) {\n\tc.jobsMux.Lock()\n\tdefer c.jobsMux.Unlock()\n\t// delta can be negative (on seq retry), but FinishedJobs is unsigned,\n\t// so get int of FinishedJobs to add int delta, then set back and return.\n\tcur := int(c.jobChain.FinishedJobs)\n\tif cur+delta < 0 { // shouldn't happen\n\t\tpanic(fmt.Sprintf(\"IncrementFinishedJobs cur %d + delta %d < 0\", cur, delta))\n\t}\n\tc.jobChain.FinishedJobs = uint(cur + delta)\n\treturn\n}", "title": "" }, { "docid": "338108e77c0ac720444b2aa065aec57a", "score": "0.4996938", "text": "func worker(done chan bool) {\n fmt.Print(\"working...\")\n time.Sleep(time.Second)\n fmt.Println(\"done\")\n\n // We send a value to done to notify we're finished\n done <- true\n}", "title": "" }, { "docid": "ccde8801adae1d7b53a3b506ac301d11", "score": "0.49966118", "text": "func (db *DB) watch(ch clientv3.WatchChan) error {\n\tfor res := range ch {\n\t\tif err := res.Err(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := db.watchResult(&res); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn fmt.Errorf(\"etcd.watch: [unexpected] watchchan closed\")\n}", "title": "" }, { "docid": "4b0547e449699abd84394ae1fcdb8f52", "score": "0.4996165", "text": "func (p *WorkspacesClientResyncKeysPoller) Done() bool {\n\treturn p.pt.Done()\n}", "title": "" }, { "docid": "0ba45a88d1c659fd7d17fc4b4e42e0d6", "score": "0.49932978", "text": "func (p *ClustersUpdatePoller) Done() bool {\n\treturn p.pt.Done()\n}", "title": "" }, { "docid": "ca0535681cb42b144bd577862b279cbc", "score": "0.49895376", "text": "func Worker(wg *sync.WaitGroup) {\n\tfor job := range jobs {\n\t\toutput := Result{job, Doubles(job.randomNo)}\n\t\ttime.Sleep(time.Second * 1)\n\t\tresults <- output\n\t}\n\twg.Done() // Only return when Done...! Means when \"results\" channel will receive Value!!\n}", "title": "" }, { "docid": "d2f3318711511d33740481711c5e0cd9", "score": "0.498447", "text": "func (m *Manager) Finish(hash meta.Hash, status *DownloadStatus) ([]string, error) {\n\treturn m.announce(hash, status, EventComplete)\n}", "title": "" }, { "docid": "7361afa538a722d91db9e89cd5f7faff", "score": "0.4983543", "text": "func (s *SubmitQueue) completeWrite() {\n\tfor {\n\t\twrites := atomic.LoadUint32(s.writes)\n\t\tif writes == 0 {\n\t\t\tpanic(\"invalid number of sq write completions\")\n\t\t}\n\t\tif atomic.CompareAndSwapUint32(s.writes, writes, writes-1) {\n\t\t\treturn\n\t\t}\n\t\truntime.Gosched()\n\t}\n}", "title": "" }, { "docid": "de2378c96168c52c94ebf7ecbe78481f", "score": "0.49833393", "text": "func (rwg *RepeatedWaitGroup) Done() {\n\trwg.Add(-1)\n}", "title": "" }, { "docid": "a36839f1f5af14709f9de095aff52bdc", "score": "0.4981574", "text": "func (o *operation) registerCompletedStageFinished(bq *InMemoryBuildQueue) {\n\to.platformQueue.operationsCompletedDurationSeconds.Observe(bq.now.Sub(o.currentStageStartTime).Seconds())\n\to.currentStageStartTime = bq.now\n}", "title": "" }, { "docid": "df926ac6df57fdfe5878e0ced313ffd7", "score": "0.4981532", "text": "func (cnt *counter) getCount() {\n\tjobs := make(chan string, 3)\n\tfor i := 0; i < cnt.workers; i++ {\n\t\tcnt.waitGroup.Add(1)\n\t\tgo cnt.worker(jobs)\n\t}\n\tfor _, val := range cnt.input {\n\t\tjobs <- val\n\t}\n\tclose(jobs)\n\tcnt.waitGroup.Wait()\n}", "title": "" }, { "docid": "1dc3c25e0ff1cdb65e0075cd5936b076", "score": "0.498008", "text": "func (j *Job) Done() error {\n\tdefer j.topic.queue.putChannel(j.ch)\n\terr := j.ch.Ack(j.del.DeliveryTag, false)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error acknowledging delivery\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5a665a3cb54ff0464d5a938182e40827", "score": "0.49785522", "text": "func jobs(db *bacula.DB, errs chan error, ms chan machine.Machine, cs chan bacula.Client) {\n\tfor c := range cs {\n\t\tincJobs, err := db.LevelJobs(\"I\", c)\n\n\t\tif err != nil {\n\t\t\terrs <- err\n\t\t\tcontinue\n\t\t}\n\n\t\tdiffJobs, err := db.LevelJobs(\"D\", c)\n\n\t\tif err != nil {\n\t\t\terrs <- err\n\t\t\tcontinue\n\t\t}\n\n\t\tfullJobs, err := db.LevelJobs(\"F\", c)\n\n\t\tif err != nil {\n\t\t\terrs <- err\n\t\t\tcontinue\n\t\t}\n\n\t\tvar m machine.Machine\n\n\t\tvar timeFull time.Time\n\t\tvar timeInc time.Time\n\t\tvar timeDiff time.Time\n\n\t\tif len(fullJobs) > 0 {\n\t\t\ttimeFull = fullJobs[len(fullJobs)-1].RealEndTime\n\t\t}\n\n\t\tif len(incJobs) > 0 {\n\t\t\ttimeInc = incJobs[len(incJobs)-1].RealEndTime\n\t\t}\n\n\t\tif len(diffJobs) > 0 {\n\t\t\ttimeDiff = diffJobs[len(diffJobs)-1].RealEndTime\n\t\t}\n\n\t\tvar sizeFull int64\n\t\tfor _, v := range fullJobs {\n\t\t\tsizeFull += v.Bytes\n\t\t}\n\n\t\tvar sizeInc int64\n\t\tfor _, v := range incJobs {\n\t\t\tsizeInc += v.Bytes\n\t\t}\n\n\t\tvar sizeDiff int64\n\t\tfor _, v := range diffJobs {\n\t\t\tsizeDiff += v.Bytes\n\t\t}\n\n\t\tm.Backup(strings.TrimRight(c.Name, \"-fd\"), machine.BackupBrandBacula, timeFull, timeInc, timeDiff, sizeFull, sizeInc, sizeDiff)\n\n\t\tms <- m\n\t}\n\n\tclose(ms)\n}", "title": "" }, { "docid": "2aee1b69e0871cd282b1d09a2ba395fa", "score": "0.49755105", "text": "func (p *jobLifecycleLatencyMeasurement) gather(c clientset.Interface, identifier string, timeout time.Duration) ([]measurement.Summary, error) {\n\tklog.V(2).Infof(\"%s: gathering job lifecycle latency measurement...\", p)\n\tif !p.isRunning {\n\t\treturn nil, fmt.Errorf(\"metric %s has not been started\", jobLifecycleLatencyMeasurementName)\n\t}\n\tcondition := func() (bool, error) {\n\t\treturn p.jobStateEntries.Count(jobCreated) == p.jobStateEntries.Count(jobCompleted), nil\n\t}\n\tif err := wait.Poll(checkCompletedJobsInterval, timeout, condition); err != nil {\n\t\tklog.V(2).Infof(\"Timed out waiting for all jobs to complete: %v\", err)\n\t}\n\tp.stop()\n\tjobLifecycleLatency := p.jobStateEntries.CalculateTransitionsLatency(jobLifecycleTransitions, measurementutil.MatchAll)\n\tcontent, jsonErr := util.PrettyPrintJSON(measurementutil.LatencyMapToPerfData(jobLifecycleLatency))\n\tif jsonErr != nil {\n\t\treturn nil, jsonErr\n\t}\n\tsummaryName := fmt.Sprintf(\"%s_%s\", jobLifecycleLatencyMeasurementName, identifier)\n\tsummaries := []measurement.Summary{measurement.CreateSummary(summaryName, \"json\", content)}\n\treturn summaries, nil\n}", "title": "" }, { "docid": "4b4ea0853bac234bd392c10cf72e97ef", "score": "0.49742198", "text": "func (s *Schedulable) Done() {\n\tatomic.StoreUint32(&s.status, statusScheduled)\n}", "title": "" }, { "docid": "a39c028da104f02986352807fd4abc5e", "score": "0.49738988", "text": "func (s *Service) jobproc() {\n\tdefer s.wg.Done()\n\n\tfor {\n\t\tf, ok := <-s.jobCh\n\t\tif !ok {\n\t\t\tlog.Info(\"Stop job proc due to job channel is closed\")\n\t\t\treturn\n\t\t}\n\t\tf()\n\t}\n}", "title": "" }, { "docid": "1e91ea0bd485c8d8b240e813f0e91ff9", "score": "0.49733642", "text": "func (c *concurrencyManager) WaitAllDone() {\n\t// Close the manager automatic\n\tc.Close()\n\n\t// This will block until allDoneCh was marked\n\t<-c.allDoneCh\n}", "title": "" }, { "docid": "7fa9c3df43d81f97a49125cb62e4dd28", "score": "0.4965246", "text": "func Collector(reporting chan Result, command chan string, timestamps bool) {\n\n\tfor {\n\t\tselect {\n\n\t\tcase message := <-reporting:\n\t\t\tprettyString := format(message, timestamps)\n\t\t\tfmt.Println(prettyString)\n\n\t\tcase <-command:\n\t\t\t// there is no actual clean up for this collector\n\t\t\tlog.Println(\"Collector is done.\")\n\t\t\tcommand <- \"done\"\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "75930dde161f92b72f1fefa3eb6c2f7c", "score": "0.49590266", "text": "func (lj *LongJob) Perform() { time.Sleep(15 * time.Second) }", "title": "" }, { "docid": "ef6ab908c01a43bfb2cdb3bf6875f7db", "score": "0.49582845", "text": "func (c *JobController) Run(stop <-chan struct{}) {\n\tvar wg sync.WaitGroup\n\n\tdefer func() {\n\t\t// make sure the work queue is shut down which will trigger workers to end\n\t\tlog.Print(\"shutting down queue\")\n\t\tc.queue.ShutDown()\n\n\t\t// wait on the workers\n\t\tlog.Print(\"shutting down workers\")\n\t\twg.Wait()\n\n\t\tlog.Print(\"workers are all done\")\n\t}()\n\n\tlog.Print(\"waiting for cache sync\")\n\tif !cache.WaitForCacheSync(\n\t\tstop,\n\t\tc.jobListerSynced) {\n\t\tlog.Print(\"timed out waiting for cache sync\")\n\t\treturn\n\t}\n\tlog.Print(\"caches are synced\")\n\n\tgo func() {\n\t\t// runWorker will loop until \"something bad\" happens. wait.Until will\n\t\t// then rekick the worker after one second.\n\t\twait.Until(c.runWorker, time.Second, stop)\n\t\t// tell the WaitGroup this worker is done\n\t\tlog.Print(\"worker done\")\n\t\twg.Done()\n\t}()\n\n\t// wait until we're told to stop\n\tlog.Print(\"waiting for stop signal\")\n\t<-stop\n\tlog.Print(\"received stop signal\")\n}", "title": "" }, { "docid": "ee589b5c54d800db0d2903d51ceb5406", "score": "0.49569297", "text": "func (r *ReporterTestGrid) SpecSuiteDidEnd(summary *types.SuiteSummary) {\n\tr.EndTime = time.Now()\n\n\treportJSON := TestGridFinished{\n\t\tTimestamp: r.StartTime.Unix(),\n\t\tPassed: true,\n\t\tResult: resultSuccess,\n\t}\n\n\tfailed := summary.NumberOfFailedSpecs\n\tif failed > 0 {\n\t\treportJSON.Passed = false\n\t\treportJSON.Result = resultFailure\n\t}\n\n\tr.WriteJSONFile(\"finished.json\", &reportJSON)\n\n\t/*\n\t\tr.SpecNames = []string{}\n\t\tfor k := range r.SpecFailures {\n\t\t\tr.SpecNames = append(r.SpecNames, k)\n\t\t}\n\t\tsort.Strings(r.SpecNames)\n\t\tdata := SpecResults{}\n\n\t\treportJSON.Passed = true\n\t\tfor _, i := range r.SpecNames {\n\t\t\tresult := SpecResult{Name: i}\n\t\t\tif Contains(r.SpecFailures[i], true) {\n\t\t\t\tresult.Fail = true\n\t\t\t} else {\n\t\t\t\tresult.Fail = false\n\t\t\t\treportJSON.Passed = false\n\t\t\t}\n\t\t\tdata.Results = append(data.Results, result)\n\t\t}\n\n\t*/\n\n\t/*\tti := time.Now().UTC()\n\t\ttime := ti.Format(\"2 Jan 2006 15:04 UTC\")\n\t\tdata.TimeCompleted = time\n\t\ttmpl := template.Must(template.ParseFiles(\"./templates/layout.html\"))\n\n\t\tf, err := os.Create(\"./reports/build-status.html\")\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Execute: \", err)\n\t\t\treturn\n\t\t}\n\t\tw := bufio.NewWriter(f)\n\t\terr = tmpl.Execute(w, data)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Execute: \", err)\n\t\t\treturn\n\t\t}\n\t\tw.Flush()\n\t\tf.Close()\n\t*/\n}", "title": "" } ]
99221b1f2df924003e0dde4e4ea30d78
Put function stores key value pair in db/kvstore
[ { "docid": "d718a7162022fbe3c97af797e882ee00", "score": "0.7459474", "text": "func Put(ctx context.Context, key string, val string) error {\n\tif kvClient != nil {\n\t\tlogger.Debugw(ctx, \"Storing-key-value-pair-in-kv-store\", log.Fields{\"key\": key, \"value\": val})\n\t\treturn kvClient.Put(ctx, key, val)\n\t}\n\tlogger.Errorw(ctx, \"Storing-key-value-pair-in-kv-store-failed-because-kvstore-not-initialised\", log.Fields{\"key\": key, \"value\": val})\n\treturn errors.New(\"kvstore not initialised\")\n}", "title": "" } ]
[ { "docid": "80ae65b39bdc3ebe82610cac1c13b51d", "score": "0.80364925", "text": "func (s *Store) Put(ctx context.Context, k []byte, v []byte) error {\n if err := kvstore.CheckKey(k); err != nil {\n return err\n }\n\n err := s.db.Update(func(tx *bolt.Tx) error {\n b := tx.Bucket([]byte(s.bucketName))\n return b.Put(k, v)\n })\n if err != nil {\n return err\n }\n return nil\n}", "title": "" }, { "docid": "f11c34afb715bea0326619a00a5b8673", "score": "0.756435", "text": "func (s *StoreClient) Put(key []byte, value []byte) error {\n\tif len(key) == 0 {\n\t\treturn def.KeyEmpty\n\t}\n\n\ttxn := s.DB.NewTransaction(true)\n\tdefer txn.Discard()\n\terr := txn.Set(key, value)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := txn.Commit(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "617fce10f71e2549cf3ad83b39fd04ea", "score": "0.7476951", "text": "func (s *LevelDBStore) Put(key, value []byte) error {\n\treturn s.db.Put(key, value, nil)\n}", "title": "" }, { "docid": "0a367a69ab2b31f4aa461e390dcd75c4", "score": "0.74747604", "text": "func (r *RepoStore) put(key, value []byte) error {\n\treturn r.store.db.Put(r.formatKey(key), value, nil)\n}", "title": "" }, { "docid": "08eea7ca590715391719cbc5e82780df", "score": "0.73638916", "text": "func (db *LevelDB) Put(key, value string) (err error) {\n\n\topt := C.leveldb_writeoptions_create() // write option\n\tdefer C.leveldb_free(unsafe.Pointer(opt))\n\n\tk := C.CString(key) // copy\n\tdefer C.leveldb_free(unsafe.Pointer(k))\n\n\tv := C.CString(value)\n\tdefer C.leveldb_free(unsafe.Pointer(v))\n\n\tvar cerr *C.char\n\tC.leveldb_put(db.CLevelDB, opt, k, C.size_t(len(key)), v, C.size_t(len(value)), &cerr)\n\n\tif cerr != nil {\n\t\tdefer C.leveldb_free(unsafe.Pointer(cerr))\n\t\treturn errors.New(C.GoString(cerr))\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "5f5e1f960ba5d0bf9a8e8669bc2c24ee", "score": "0.7319563", "text": "func (s *MockStore) Put(key string, value []byte) error {\n\tmData := s.db[key]\n\tif mData == nil {\n\t\tmData = &MockData{value, 0}\n\t}\n\tmData.Index = mData.Index + 1\n\ts.db[key] = mData\n\treturn nil\n}", "title": "" }, { "docid": "6eb8b5a3bbbb2909348be9021de448bc", "score": "0.72784466", "text": "func (s *store) Put(key string, value []byte, tags ...storage.Tag) error {\n\terr := validatePutInput(key, value, tags)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdata := generateDataWrapper(key, value, tags)\n\n\treturn s.executeUpdateOneCommand(key, data)\n}", "title": "" }, { "docid": "32eca33cf0333c2f70474f07fea321b2", "score": "0.72721624", "text": "func (kv *KV) Put(key, value string) error {\n\treturn kv.db.Put(key, value)\n}", "title": "" }, { "docid": "67dde3ad74de6243265777100e5ff5b8", "score": "0.7251364", "text": "func (kv *KVStorage) Put(key, value string) error {\n\tkv.mutex.Lock()\n\tdefer kv.mutex.Unlock()\n\n\tkv.data[key] = value\n\treturn nil\n}", "title": "" }, { "docid": "beef28cf3f8c4fa933fc21e2c9b3775d", "score": "0.72483516", "text": "func (s *Store) put(key []byte, b interface{}) (err error) {\n\tvar data []byte\n\tdata, err = s.marshal(b)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn s.db.Update(func(tx *bolt.Tx) error {\n\t\tobjects, err := s.bucket.createOrGet(tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn objects.Put(key, data)\n\t})\n}", "title": "" }, { "docid": "e56e8a96c430666330c676477b7f0ff1", "score": "0.7217251", "text": "func (db *BoltDB) Put(key []byte, value []byte) error {\n\tlog.Printf(\"[DEBUG] [shiva] Put : %v %v\", string(key), string(value))\n\tdb.DB.Update(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(bucketName))\n\t\tb.Put(key, value)\n\t\treturn nil\n\t})\n\treturn nil\n}", "title": "" }, { "docid": "3faf60a7d527305e1679d73507e716fa", "score": "0.72152793", "text": "func (database *Database) Put(key string, value interface{}) {\n\tdatabase.db.Put(key, value)\n}", "title": "" }, { "docid": "9817279c8c57cb38b2c5a708442cc830", "score": "0.71902835", "text": "func (s *kvStoreImpl) Put(key, value []byte) error {\n\t_trieKeystoreMtc.WithLabelValues(\"put\").Inc()\n\treturn s.dao.Put(s.bucket, key, value)\n}", "title": "" }, { "docid": "87185d03252092282bc83b23d4f2ae60", "score": "0.7140625", "text": "func (db *GromDB) Put(key uint32, value []byte) error {\n\tvar lastMapIndex = len(db.m) - 1\n\t\n\tif db.m[lastMapIndex].FillStage() >= 0.75 {\n\t\tvar lastDbSlotsCount = db.m[lastMapIndex].SlotsCount()\n\t\tvar err = db.createFileMap(db.getNextSlotsCount(lastDbSlotsCount))\n\t\tif err != nil { lastDbSlotsCount++ }\n\t}\n\n\tvar kv = filemap.KeyValue12b{Key: key, DataSize: uint32(len(value)), DataIndex: uint32(db.cfg.DataLen)}\n\n\tvar err1 = db.m[lastMapIndex].Insert(&kv)\n\tif err1 != nil { return err1 }\n\n\tvar _, err2 = db.data.WriteAt(value, int64(db.cfg.DataLen))\n\tif err2 != nil { return err2 }\n\n\tdb.cfg.DataLen += uint64(len(value))\n\n\treturn nil\n}", "title": "" }, { "docid": "89a5734d5f3f086fde9f7ff41cd118b1", "score": "0.7124916", "text": "func (s *kvStore)PutValue(e *Entry){\n value := ValueWrapper{e.Value}\n s.lock()\n defer s.unlock()\n s.store[e.Key] = value\n}", "title": "" }, { "docid": "0754d56055f4e6b5bc08f490a8a7e007", "score": "0.7090019", "text": "func (s *storage) Put(key []byte, value []byte) error {\n\told, err := s.db.Get(key, nil)\n\tif err != nil {\n\t\tif err != leveldb.ErrNotFound {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tif bytes.Equal(old, value) {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn s.db.Put(key, value, nil)\n}", "title": "" }, { "docid": "b79e1bcb986439d051a3a82be2c72aec", "score": "0.7088912", "text": "func (sm MemoryDataStore) Put(key string, value string) error {\n\tsm.values[key] = value\n\treturn nil\n}", "title": "" }, { "docid": "ea17fb3b1a8a1a4b218412e9ae342645", "score": "0.7060731", "text": "func (e EmptyKVStore) Set(key, value []byte) error { return nil }", "title": "" }, { "docid": "372e5ded9698f529dacdffbccf466e2f", "score": "0.7055345", "text": "func (*dryRunDB) Set(bucket, key, value []byte) error { return nil }", "title": "" }, { "docid": "c4ef402a783454302681b53ce0681de6", "score": "0.7053286", "text": "func (h *DBHandle) Put(key []byte, value []byte, sync bool) error {\n\treturn h.db.Put(constructLevelKey(h.dbName, key), value, sync)\n}", "title": "" }, { "docid": "b37e2a675b953189cb7ed242ba7d957a", "score": "0.7048961", "text": "func (db *BadgerDB) Put(ctx storage.Context, tk storage.TKey, v []byte) error {\n\tif db == nil {\n\t\treturn fmt.Errorf(\"Can't call Put on nil BadgerDB\")\n\t}\n\tif ctx == nil {\n\t\treturn fmt.Errorf(\"Received nil context in Put()\")\n\t}\n\n\tvar err error\n\tkey := ctx.ConstructKey(tk)\n\tif ctx.Versioned() {\n\t\tvctx, ok := ctx.(storage.VersionedCtx)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"Non-versioned context that says it's versioned received in Put(): %v\", ctx)\n\t\t}\n\t\ttombstoneKey := vctx.TombstoneKey(tk)\n\t\terr = db.bdp.Update(func(txn *badger.Txn) error {\n\t\t\tif err := txn.Set(key, v); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := txn.Delete(tombstoneKey); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t} else {\n\t\terr = db.bdp.Update(func(txn *badger.Txn) error {\n\t\t\treturn txn.Set(key, v)\n\t\t})\n\t}\n\tstorage.StoreKeyBytesWritten <- len(key)\n\tstorage.StoreValueBytesWritten <- len(v)\n\treturn err\n}", "title": "" }, { "docid": "45be93452e35d5e6c550714627cb8749", "score": "0.7032276", "text": "func (s *Store) Put(key string, value []byte) error {\n\tsize := len([]byte(key)) + len(value)\n\tif size > s.maxRecordSize {\n\t\tmsg := fmt.Sprintf(\"key-value too big, max size: %d\", s.maxRecordSize)\n\t\treturn kvdb.NewBadRequestError(msg)\n\t}\n\ts.Lock()\n\ts.table[key] = value\n\ts.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "3b0111909cdc6518fe6d522f632e2280", "score": "0.7027609", "text": "func (d *Database) Set(key string, value interface{}) (err error) {\n\tvar b []byte\n\tb, err = json.Marshal(value)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttx, err := d.db.Begin()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Set\")\n\t}\n\tstmt, err := tx.Prepare(\"insert or replace into keystore(key,value) values (?, ?)\")\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Set\")\n\t}\n\tdefer stmt.Close()\n\n\t_, err = stmt.Exec(key, string(b))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Set\")\n\t}\n\n\terr = tx.Commit()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Set\")\n\t}\n\n\t// d.logger.Log.Debugf(\"set '%s' to '%s'\", key, string(b))\n\treturn\n}", "title": "" }, { "docid": "e4cfdc839f5249ce394777f553381d2a", "score": "0.70248055", "text": "func (dbInst *DB) Put(key []byte, value []byte, sync bool) error {\n\tdbInst.mutex.RLock()\n\tdefer dbInst.mutex.RUnlock()\n\two := dbInst.writeOptsNoSync\n\tif sync {\n\t\two = dbInst.writeOptsSync\n\t}\n\terr := dbInst.db.Put(key, value, wo)\n\tif err != nil {\n\t\tlogger.Errorf(\"Error writing leveldb key [%#v]\", key)\n\t\treturn errors.Wrapf(err, \"error writing leveldb key [%#v]\", key)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4cc7020ace5a87833f07c9ab230d3248", "score": "0.7020099", "text": "func (s *certStoreBackedByKVStore) Put(ctx context.Context, key string, data []byte) error {\n\t_, err := s.serviceOwner.KeybaseService().GetKVStoreClient().PutKVEntry(ctx,\n\t\tkeybase1.PutKVEntryArg{\n\t\t\tNamespace: certKVStoreNamespace,\n\t\t\tEntryKey: key,\n\t\t\tEntryValue: encodeData(data),\n\t\t})\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"kvstore put error\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6312096ea93a1a492c73e5b794223741", "score": "0.6967289", "text": "func (db *LDBDatabase) Put(key []byte, value []byte) error {\n\treturn db.db.Put(key, value, nil)\n}", "title": "" }, { "docid": "d8e9743bdf9d6dcbb24ed26387c8c9df", "score": "0.6957668", "text": "func (ls *libstore) Put(key, value string) error {\n\tclient := ls.GetClient(key)\n\tif client == nil {\n\t\treturn errors.New(\"cannot connect to a nil client\")\n\t}\n\n\targs := &storagerpc.PutArgs{Key: key, Value: value}\n\tvar reply storagerpc.PutReply\n\n\terr := client.Call(\"StorageServer.Put\", args, &reply)\n\n\tif reply.Status != storagerpc.OK {\n\t\terr = errors.New(\"put not ok\")\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "087f50cf1545226bd44161bad7df2962", "score": "0.6942888", "text": "func (s Store) Set(ctx context.Context, k string, v []byte) error {\n\tif err := s.db.Set(k, string(v), 0).Err(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9afdd74f0293a069d88bf543ebebf8e4", "score": "0.69358885", "text": "func Put(bucket []byte, key []byte, value []byte) error {\n\terr := db.Update(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket(bucket)\n\t\terr := b.Put(key, value)\n\t\treturn err\n\t})\n\n\treturn err\n}", "title": "" }, { "docid": "f036f37598d3d98b474e192a441607be", "score": "0.6928702", "text": "func (world *World) Put(key []byte, value []byte) error {\n\terr := world.db.Put(key, value, nil)\n\treturn err\n}", "title": "" }, { "docid": "0a3b787301d892d05dadeaa1ddb39716", "score": "0.6918282", "text": "func (s *Service) Put(kv KV, _ *int) error {\n\treturn s.DB.Update(func(tx *bolt.Tx) error {\n\t\tb, err := tx.CreateBucketIfNotExists(bucket)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = b.Put(kv.Key, kv.Value)\n\t\treturn err\n\t})\n}", "title": "" }, { "docid": "f9b19bf46bf6a205016b73a24e5f435d", "score": "0.69089794", "text": "func (d *Database) Put(key string, value string) error {\n\treturn d.PutBytes(key, []byte(value))\n}", "title": "" }, { "docid": "12da2d46ba6bf2bd50973e4f3e3bda61", "score": "0.6908141", "text": "func (r *RocksDB) Put(key MVCCKey, value []byte) error {\n\treturn dbPut(r.rdb, key, value)\n}", "title": "" }, { "docid": "ad3c284aff72c44f0a4b890fd326bcc8", "score": "0.68929875", "text": "func (db *DB) Put(opt *WriteOptions, key, value []byte) Status {\n\tbatch := NewWriteBatch()\n\tbatch.Put(key, value)\n\treturn db.Write(opt, batch)\n}", "title": "" }, { "docid": "b9e56882fc0a1250a4ae0faadf42aac0", "score": "0.6881021", "text": "func (db *DB) Put(key, value []byte, opts *WriteOptions) error {\n\treturn db.db.Put(key, value, convertWriteOptions(opts))\n}", "title": "" }, { "docid": "e34807a46ea72b5d980ed1b23c956f6b", "score": "0.6879417", "text": "func (m *MapDatastore) Put(key string, content []byte) error {\n\tm.values[key] = content\n\treturn nil\n}", "title": "" }, { "docid": "d5bacd5bfe6de3c0a90896795642de84", "score": "0.6876105", "text": "func (db *Database) Put(key []byte, value []byte) error {\n\tif err := db.corrupted(); err != nil {\n\t\treturn err\n\t}\n\treturn db.handleError(db.Database.Put(key, value))\n}", "title": "" }, { "docid": "cbdf30a8b4447c95362202ac4d4336e9", "score": "0.68720114", "text": "func (ck *Clerk) Put(key string, value string) {\n ck.PutAppend(key, value, \"Put\")\n}", "title": "" }, { "docid": "ae1d27a8c93c923b30f27f7c4717ae05", "score": "0.6867693", "text": "func (c *connectionType) Put(key string, value string) error {\n\tkvPair := &api.KVPair{Key: key, Value: ([]byte)(value)}\n\t_, err := c.kv.Put(kvPair, nil)\n\treturn err\n}", "title": "" }, { "docid": "3b2bd1a4d95b9a5f85366f438f1329ec", "score": "0.68650204", "text": "func (s *LinearizableStore) Put(key string, value []byte, trackVisibility bool) (string, error) {\n\ts.Lock()\n\tdefer s.Unlock()\n\n\t// Create the new version\n\ts.current++\n\tversion := &Version{s.current, s.pid}\n\n\t// Create the new entry\n\tentry := &Entry{\n\t\tKey: &key,\n\t\tVersion: version,\n\t\tParent: s.lastWrite,\n\t\tValue: value,\n\t\tTrackVisibility: trackVisibility,\n\t}\n\n\t// Update the namespace, versions, and last write\n\ts.namespace[key] = entry\n\ts.history.Append(entry.Key, entry.Parent, entry.Version)\n\ts.lastWrite = version\n\n\t// Return the version and no error for this method\n\treturn version.String(), nil\n}", "title": "" }, { "docid": "7dfdf303a21e536af6dc883f86cd4cb5", "score": "0.68605053", "text": "func (s *SequentialStore) Put(key string, value []byte, trackVisibility bool) (string, error) {\n\t// Attempt to get the write-locked version from the store\n\tentry := s.get(key, true)\n\n\t// Make an empty entry if there was no entry already in the store\n\tif entry == nil {\n\t\tentry = s.make(key)\n\t} else {\n\t\t// Update the parent of the entry to the old entry\n\t\tentry.Parent = entry.Version\n\t}\n\n\t// Ensure that the entry is unlocked when done\n\tdefer entry.Unlock()\n\n\t// Create the version for the new entry\n\tentry.Current++\n\tentry.Version = &Version{entry.Current, s.pid}\n\n\t// Update the value\n\tentry.Value = value\n\tentry.TrackVisibility = trackVisibility\n\n\t// Store the version in the version history and return it\n\ts.history.Append(entry.Key, entry.Parent, entry.Version)\n\treturn entry.Version.String(), nil\n}", "title": "" }, { "docid": "ca5eb8f2ded9318b5d8bd9f5372cb4f9", "score": "0.68452936", "text": "func (store *DeviceStore) Put(key Key, value Value) error {\n\terr := store.DB.Update(func(tx *bolt.Tx) error {\n\t\tbkt := tx.Bucket([]byte(BucketDevices))\n\t\tif bkt == nil {\n\t\t\treturn fmt.Errorf(\"bucket not exist\")\n\t\t}\n\n\t\tif err := bkt.Put([]byte(key), value); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "134904aeb5d1a9cc0ffdc63b3578edbd", "score": "0.68392473", "text": "func (db *Database) Put(key, value []byte) error {\n\tdb.lock.Lock()\n\tdefer db.lock.Unlock()\n\n\tif db.db == nil {\n\t\treturn database.ErrClosed\n\t}\n\tprefixedKey := db.prefix(key)\n\terr := db.db.Put(prefixedKey, value)\n\tdb.bufferPool.Put(prefixedKey)\n\treturn err\n}", "title": "" }, { "docid": "740bb1490c4995f015b3343dfe1560a4", "score": "0.6839085", "text": "func (db *DB) Put(opts *WriteOptions, key, value []byte) error {\n\tvar (\n\t\tcErr *C.char\n\t\tcKey = byteToChar(key)\n\t\tcValue = byteToChar(value)\n\t)\n\tC.rdb_put(db.c, opts.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value)), &cErr)\n\tif cErr != nil {\n\t\tdefer C.free(unsafe.Pointer(cErr))\n\t\treturn errors.New(C.GoString(cErr))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "32bdb46914abf13691e07e5d98ef0691", "score": "0.68384624", "text": "func (r RedisDB) Put(key string, value []byte) error {\n\treturn r.client.Set(key, value, 0).Err()\n}", "title": "" }, { "docid": "7685d935316a92fcf0ba7470f247c788", "score": "0.68309605", "text": "func (db *DB) Put(ctx context.Context, key string, body []byte) error {\n\tif db.storage == nil {\n\t\treturn errors.Wrap(ErrInvalidDBProvided, \"storage == nil\")\n\t}\n\n\treturn db.storage.Write(ctx, key, body, nil)\n}", "title": "" }, { "docid": "cfd5f0483dadda29bd26e047bb39889c", "score": "0.68159205", "text": "func (s SessionStorer) Put(key, value string) {\n\tsession, err := s.manager.Store.Get(s.r, s.manager.Name)\n\tif err != nil {\n\t\tlog.Error(err.Error())\n\t\treturn\n\t}\n\n\tsession.Values[key] = value\n\tsession.Save(s.r, s.w)\n}", "title": "" }, { "docid": "52eb68396d1e099a7c4ed7b3596f914d", "score": "0.68011606", "text": "func (txn *Txn) Put(dbi DBI, key []byte, val []byte, flags uint) error {\n\tkn := len(key)\n\tif kn == 0 {\n\t\treturn txn.putNilKey(dbi, flags)\n\t}\n\tvn := len(val)\n\tif vn == 0 {\n\t\tval = []byte{0}\n\t}\n\n\tret := C.lmdbgo_mdb_put2(\n\t\ttxn._txn, C.MDB_dbi(dbi),\n\t\t(*C.char)(unsafe.Pointer(&key[0])), C.size_t(kn),\n\t\t(*C.char)(unsafe.Pointer(&val[0])), C.size_t(vn),\n\t\tC.uint(flags),\n\t)\n\treturn operrno(\"mdb_put\", ret)\n}", "title": "" }, { "docid": "03d201741f95f9f929e6c1b8ce48c518", "score": "0.68004763", "text": "func (db AerospikeDBClient) Put(policy *as.WritePolicy, key *as.Key, binMap as.BinMap) error {\n\treturn db.client.Put(policy, key, binMap)\n}", "title": "" }, { "docid": "131f428586f75ae08fe0c394187df581", "score": "0.67920357", "text": "func (self *DB) Put(opts *WriteOptions, key, value []byte) error {\n\tcKey := ByteToChar(key)\n\tcValue := ByteToChar(value)\n\n\tvar cErr *C.char\n\tC.rocksdb_put(self.c, opts.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value)), &cErr)\n\tif cErr != nil {\n\t\tdefer C.free(unsafe.Pointer(cErr))\n\n\t\treturn errors.New(C.GoString(cErr))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ee0660c29caea096d0b1c8a5abe47073", "score": "0.6788135", "text": "func (s *levelStore) Put(key, json string) error {\n\treturn s.op(key, \"put\", json)\n}", "title": "" }, { "docid": "48191478725232c9a2035f82514e655d", "score": "0.67777574", "text": "func (db *GBucket) Put(ctx storage.Context, tkey storage.TKey, value []byte) error {\n\t// use buffer interface\n\tbuffer := db.NewBuffer(ctx)\n\n\terr := buffer.Put(ctx, tkey, value)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// commit changes\n\terr = buffer.Flush()\n\n\treturn err\n}", "title": "" }, { "docid": "b8a00829e406a590411f7ff5334b7f86", "score": "0.6770379", "text": "func (m *Manager) Put(key datastore.Key, v []byte) error {\n\treturn m.crdt.Put(key, v)\n}", "title": "" }, { "docid": "2c1831c9addacf31ef517a506c471d20", "score": "0.67695725", "text": "func (r *mongodbStore) Put(k string, v []byte) error {\n\tif k == \"\" || v == nil {\n\t\treturn errors.New(\"key and value are mandatory\")\n\t}\n\n\topts := &options.UpdateOptions{}\n\t_, err := r.coll.UpdateOne(context.Background(), bson.M{\"_id\": k}, bson.M{\"$set\": Data{Key: k, Value: v}},\n\t\topts.SetUpsert(true))\n\n\treturn err\n}", "title": "" }, { "docid": "add10ef853ea773b922612419c88b7ae", "score": "0.67642367", "text": "func (db *Db) Set(key, value interface{}) error {\n\tdb.Lock()\n\tdefer db.Unlock()\n\tk, err := KeyToBinary(key)\n\tif err != nil {\n\t\treturn err\n\t}\n\tv, err := ValToBinary(value)\n\tif err != nil {\n\t\treturn err\n\t}\n\t//log.Println(\"Set:\", k, v)\n\toldCmd, exists := db.vals[string(k)]\n\t//fmt.Println(\"StoreMode\", db.config.StoreMode)\n\tif db.storemode == 2 {\n\t\tcmd := &Cmd{}\n\t\tcmd.Size = uint32(len(v))\n\t\tcmd.Val = make([]byte, len(v))\n\t\tcopy(cmd.Val, v)\n\t\tdb.vals[string(k)] = cmd\n\t} else {\n\t\tcmd, err := writeKeyVal(db.fk, db.fv, k, v, exists, oldCmd)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdb.vals[string(k)] = cmd\n\t}\n\tif !exists {\n\t\tdb.appendKey(k)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "66b4575d13a81d066241561f6c57f1e7", "score": "0.67628455", "text": "func (s *Store) Put(c appengine.Context, key *datastore.Key, src interface{}) (*datastore.Key, error) {\n\tk, err := s.PutMulti(c, []*datastore.Key{key}, []interface{}{src})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn k[0], nil\n}", "title": "" }, { "docid": "cd556c2b8c72bdc5e3cbd5e8994087d8", "score": "0.6739169", "text": "func (s *Store) Put(key interface{}, b interface{}) error {\n\tkeyBytes, err := s.toBytes(key)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn s.put(keyBytes, b)\n}", "title": "" }, { "docid": "28a1a95f7787d5283cb6201c61ae9487", "score": "0.67352915", "text": "func (t *transaction) Put(key, value []byte) error {\n\told, err := t.t.Get(key, nil)\n\tif err != nil {\n\t\tif err != leveldb.ErrNotFound {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tif bytes.Equal(old, value) {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn t.t.Put(key, value, nil)\n}", "title": "" }, { "docid": "2167cac49e89516daa301c1793191dc5", "score": "0.67045325", "text": "func (c *Client) Put(key kv_store.Key, value kv_store.Value, table string) {\n\tc.RESTPut(key, value, table)\n}", "title": "" }, { "docid": "681493e9e15cd1c84f142fb8354f0f45", "score": "0.6703886", "text": "func (kv *store) PutHandler(w http.ResponseWriter, r *http.Request) {\n\n\tlog.Printf(\"\\nPUT request received\\n\")\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Header().Set(\"Connection\", \"close\")\n\n\tw.WriteHeader(http.StatusAccepted)\n\n\tif err := r.ParseForm(); err != nil {\n\t\tfmt.Fprintf(w, \"ParseForm() err: %v\", err)\n\t\treturn\n\t}\n\n\tkv.mu.Lock()\n\n\tvalue := r.FormValue(\"value\")\n\tparams := mux.Vars(r)\n\tkey := params[\"key\"]\n\tok := kv.Put(key, value)\n\n\tif ok == true {\n\t\tfmt.Fprintf(w, \"Key = %s\\n\", key)\n\t\tfmt.Fprintf(w, \"Value = %s\\n\", value)\n\t\tkv.db_temp[key] = value\n\t} else {\n\t\tfmt.Fprintf(w, \"Invalid key value pair\\n\")\n\t}\n\n\tkv.Persist()\n\tkv.mu.Unlock()\n}", "title": "" }, { "docid": "f34951c297bbbe074afb7c7bbcd426c7", "score": "0.6686933", "text": "func (a *AerospikeBackend) Put(ctx context.Context, key string, value string, ttlSeconds int) error {\n\tasKey, err := a.client.NewUUIDKey(a.namespace, key)\n\tif err != nil {\n\t\treturn classifyAerospikeError(err)\n\t}\n\n\tbins := as.BinMap{binValue: value}\n\tpolicy := &as.WritePolicy{\n\t\tExpiration: uint32(ttlSeconds),\n\t\tRecordExistsAction: as.CREATE_ONLY,\n\t}\n\n\tif err := a.client.Put(policy, asKey, bins); err != nil {\n\t\treturn classifyAerospikeError(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c5471cc8f0665606f9ca7c6b2d46f26a", "score": "0.6676239", "text": "func DBPut(ctx context.Context, client Client, actionID, family, key, val string) (Response, error) {\n\treturn send(ctx, client, \"DBPut\", actionID, dbData{\n\t\tFamily: family,\n\t\tKey: key,\n\t\tValue: val,\n\t})\n}", "title": "" }, { "docid": "71f8bfcfd5992a2b6cae5a06f77ca8bc", "score": "0.6675572", "text": "func(ws *WasmService)db_put(proc *exec.Process, key, k_len, value, v_len int32)int32{\n\tk_msg := make([]byte, k_len)\n\tv_msg := make([]byte, v_len)\n\terr := proc.ReadAt(k_msg, int(key), int(k_len))\n\tif err != nil{\n\t\treturn -1\n\t}\n\terr = proc.ReadAt(v_msg, int(value), int(v_len))\n\tif err != nil{\n\t\treturn -1\n\t}\n\terr = ws.state.StoreSet(ws.action.ContractAccount,k_msg,v_msg)\n\tif err != nil{\n\t\treturn -1\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "13228664f6d98f367a3fa9343f51ad5e", "score": "0.6672497", "text": "func (l *Backend) Put(ctx context.Context, i backend.Item) (*backend.Lease, error) {\n\tif i.Key == nil {\n\t\treturn nil, trace.BadParameter(\"missing parameter key\")\n\t}\n\terr := l.inTransaction(ctx, func(tx *sql.Tx) error {\n\t\tcreated := l.clock.Now().UTC()\n\t\trecordID := i.ID\n\t\tif !l.Mirror {\n\t\t\trecordID = id(created)\n\t\t}\n\t\tif !l.EventsOff {\n\t\t\tstmt, err := tx.PrepareContext(ctx, \"INSERT INTO events(type, created, kv_key, kv_modified, kv_expires, kv_value) values(?, ?, ?, ?, ?, ?)\")\n\t\t\tif err != nil {\n\t\t\t\treturn trace.Wrap(err)\n\t\t\t}\n\t\t\tdefer stmt.Close()\n\n\t\t\tif _, err := stmt.ExecContext(ctx, types.OpPut, created, string(i.Key), recordID, expires(i.Expires), i.Value); err != nil {\n\t\t\t\treturn trace.Wrap(err)\n\t\t\t}\n\t\t}\n\t\tstmt, err := tx.PrepareContext(ctx, \"INSERT OR REPLACE INTO kv(key, modified, expires, value) values(?, ?, ?, ?)\")\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tdefer stmt.Close()\n\n\t\tif _, err := stmt.ExecContext(ctx, string(i.Key), recordID, expires(i.Expires), i.Value); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\treturn l.newLease(i), nil\n}", "title": "" }, { "docid": "f5b592df8ba32b98fb87d7b9fc28fbb1", "score": "0.66578025", "text": "func (s *Store) set(table kvdb.KeyValueStore, key []byte, val interface{}) {\n\tbuf, err := rlp.EncodeToBytes(val)\n\tif err != nil {\n\t\ts.Log.Crit(\"Failed to encode rlp\", \"err\", err)\n\t}\n\n\tif err := table.Put(key, buf); err != nil {\n\t\ts.Log.Crit(\"Failed to put key-value\", \"err\", err)\n\t}\n}", "title": "" }, { "docid": "26b5fdd10ed38331a8871021bbd94414", "score": "0.6654542", "text": "func (d *DB) Put(key, value []byte) error {\n\treturn d.PutWithOptions(key, value, d.defaultWriteOpts)\n}", "title": "" }, { "docid": "88bc4c97a7de2fe08997375b250420e1", "score": "0.6640822", "text": "func (s *Store) Put(element storage.Element) error {\n\treturn s.db.Update(func(txn *badger.Txn) error {\n\t\terr := txn.Set(element.Key, element.Value)\n\t\treturn err\n\t})\n}", "title": "" }, { "docid": "28507acaf17d4ac1029a180255326aaa", "score": "0.6614414", "text": "func (m *Manager) Put(key []byte, value []byte) error {\n\tvar err error\n\n\tif m.raftEngine == nil {\n\t\t// No raft cluster, put key-value locally.\n\t\terr = m.shards[0].Put(store.Key(key), store.Value(value))\n\t} else {\n\t\terr = m.raftEngine.Persist(raft.NewPutLog(key, value))\n\t}\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Put key to shard failed | err=[%w]\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7201cfe0b061f7d650d19f3ea27d046e", "score": "0.6614066", "text": "func (s *server) Put(_ context.Context, req *cachely.PutRequest) (*cachely.PutResponse, error) {\n\tlog.Printf(\"storing key %q\\n\", req.GetKey())\n\ts.data.Store(req.GetKey(), req.GetValue())\n\treturn &cachely.PutResponse{\n\t\tKey: req.GetKey(),\n\t}, status.New(codes.OK, \"\").Err()\n}", "title": "" }, { "docid": "69d4d50a65f4f9838067bf99b6b7cfc7", "score": "0.6608392", "text": "func PutKey(db storage.DB) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tkey := r.URL.Query().Get(\"key\")\n\t\tif key == \"\" {\n\t\t\thttp.Error(w, \"missing key name in path\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tdefer r.Body.Close()\n\t\tval, err := ioutil.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"error reading PUT body\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tif err := db.Set(key, val); err != nil {\n\t\t\thttp.Error(w, \"error setting value in DB\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t})\n}", "title": "" }, { "docid": "0a223c2da5d7b9d0e6c44cb44bd3c60d", "score": "0.660773", "text": "func (s *KeyValueServer) Put(ctx context.Context, pr *pb.PutRequest) (*pb.PutResponse, error) {\n\tpeer, ok := peer.FromContext(ctx)\n\tif !ok {\n\t\tfmt.Println(\"Error getting peer \")\n\t}\n\t// injected at the unary interceptor after call to authservice\n\tai := ctx.Value(\"authinfo\").(auth.AuthInfo)\n\tfmt.Printf(\"%s@%s called put %s=%s\\n\", ai.UserID, peer.Addr, pr.Key, pr.Value)\n\tve := find(ai.UserID, pr.Key)\n\tif ve == nil {\n\t\tfmt.Printf(\"Creating new key %s with value %s for user \\\"%s\\\"\\n\", pr.Key, pr.Value, ai.UserID)\n\t\tobjectStore.PushFront(&ValueEntry{Key: pr.Key,\n\t\t\tValue: pr.Value,\n\t\t\tOwner: ai.UserID,\n\t\t})\n\t}\n\tresp := pb.PutResponse{}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "568214305f65883b46a4252fd83e16c8", "score": "0.6605105", "text": "func (m *HashMap) Put(key string, value []byte) (err error){\n\tif m.name == nil {\n\t\treturn ErrDoesNotExists\n\t}\n\treturn m.db.View(func(tx *bolt.Tx) error {\n\t\tbucket := tx.Bucket(m.name)\n\t\tif bucket == nil {\n\t\t\treturn ErrBucketNotFound\n\t\t}\n\t\treturn bucket.Put([]byte(key),value)\n\t})\n}", "title": "" }, { "docid": "c4514adb682663f53da63288ecbed541", "score": "0.65916145", "text": "func (t *TestKV) Put(ctx context.Context, key, value string) error {\n\tif key == \"\" {\n\t\treturn errors.New(\"key is empty\")\n\t}\n\tif err := ctx.Err(); err != nil {\n\t\treturn err\n\t}\n\tt.mu.Lock()\n\tt.Data[key] = value\n\tt.mu.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "edee32bfdb88fe7fc3efd244c9da7aaa", "score": "0.6591028", "text": "func setItem(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tkv := &keyval{}\n\terr := codec.NewDecoder(r.Body, msgpack).Decode(kv)\n\tif err != nil {\n\t\tfailErr(w, err)\n\t\treturn\n\t}\n\n\terr = db.Put([]byte(kv.Key), []byte(kv.Value), nil)\n\tif err != nil {\n\t\tfailErr(w, err)\n\t} else {\n\t\tw.WriteHeader(http.StatusNoContent)\n\t}\n}", "title": "" }, { "docid": "e3f44ad7dc79b602e3976abd5323c581", "score": "0.6573117", "text": "func (db *GBucket) putV(ctx storage.Context, k storage.Key, value []byte) (err error) {\n\t// retrieve repo bucket\n\tvar bucket *api.BucketHandle\n\tif ctx == nil {\n\t\t// use default buckert\n\t\tbucket = db.bucket\n\t} else {\n\t\tif bucket, err = db.bucketHandle(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// gets handle (no network op)\n\tobj_handle := bucket.Object(hex.EncodeToString(k))\n\treturn db.putVhandle(obj_handle, value)\n\n}", "title": "" }, { "docid": "339d98d4ad16a90ef4b779b911de9560", "score": "0.65730524", "text": "func (c *context) Store(key interface{}, v interface{}) {\n\tc.KV.store(key, v)\n}", "title": "" }, { "docid": "12c022fa2ff40a762278a5064acaacd2", "score": "0.65629643", "text": "func (db *goBuffer) Put(ctx storage.Context, tkey storage.TKey, value []byte) error {\n\tif db == nil {\n\t\treturn fmt.Errorf(\"Can't call Put() on nil Google Bucket\")\n\t}\n\tif ctx == nil {\n\t\treturn fmt.Errorf(\"Received nil context in Put()\")\n\t}\n\n\tvar err error\n\tkey := ctx.ConstructKey(tkey)\n\tif !ctx.Versioned() {\n\t\tdb.mutex.Lock()\n\t\tdb.ops = append(db.ops, dbOp{op: putOp, key: key, value: value})\n\t\tdb.mutex.Unlock()\n\t} else {\n\t\tvctx, ok := ctx.(storage.VersionedCtx)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"Non-versioned context that says it's versioned received in Put(): %v\", ctx)\n\t\t}\n\t\tdb.mutex.Lock()\n\t\tif db.db.version < VALUEVERSION || !ctx.Versioned() {\n\t\t\t// only use tombstones in old versioning\n\t\t\ttombstoneKey := vctx.TombstoneKey(tkey)\n\t\t\tdb.ops = append(db.ops, dbOp{op: delOpIgnoreExists, key: tombstoneKey})\n\t\t}\n\t\tdb.ops = append(db.ops, dbOp{op: putOp, key: key, value: value})\n\t\tdb.mutex.Unlock()\n\t\tif err != nil {\n\t\t\tdvid.Criticalf(\"Error on data put: %v\\n\", err)\n\t\t\terr = fmt.Errorf(\"Error on data put: %v\", err)\n\t\t}\n\t}\n\n\treturn err\n\n}", "title": "" }, { "docid": "90bf060b32eee09a423a14c8533d5384", "score": "0.6561593", "text": "func (d *datastore) Put(key ds.Key, value interface{}) (err error) {\n\tks := keySync{putKey, key, value}\n\tvs, found := d.sync(ks)\n\tif !found {\n\t\tvs.err = d.child.Put(key, value)\n\t\td.syncDone(ks)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "2e05a9bf2a9a2a3451a4cd67403c817d", "score": "0.65330577", "text": "func (c *Conn) Set(key string, value []byte) error {\n\t_, err := c.db.Exec(\n\t\t\"INSERT INTO kvstore (`key`, `key_md5`, `value`) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE `value` = ?\",\n\t\tkey, md5of(key), value, value,\n\t)\n\treturn err\n}", "title": "" }, { "docid": "9d717c14e1f4f94bdc0f28aecaa42d4a", "score": "0.6532784", "text": "func put(bucket *bbolt.Bucket, key, value []byte) error {\n\treturn bucket.Put(key, value)\n}", "title": "" }, { "docid": "5a94797e31563654e10347261e524900", "score": "0.6532516", "text": "func (m *PostgreSQLBackend) Put(ctx context.Context, entry *physical.Entry) error {\n\tdefer metrics.MeasureSince([]string{\"postgres\", \"put\"}, time.Now())\n\n\tm.permitPool.Acquire()\n\tdefer m.permitPool.Release()\n\n\tparentPath, path, key := m.splitKey(entry.Key)\n\n\t_, err := m.client.Exec(m.put_query, parentPath, path, key, entry.Value)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "62079b049a8afafd1b291678d8002883", "score": "0.650952", "text": "func (k *KeyStorage) Store(ctx context.Context, address string, keyPair *keys.KeyPair) error {\n\ttransaction := k.db.NewDatabaseTransaction(ctx, true)\n\tdefer transaction.Discard(ctx)\n\n\texists, _, err := transaction.Get(ctx, getAddressKey(address))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%w: unable to check if address %s exists\", err, address)\n\t}\n\n\tif exists {\n\t\treturn fmt.Errorf(\"%w: address %s already exists\", ErrAddrExists, address)\n\t}\n\n\tval, err := serializeKey(&Key{\n\t\tAddress: address,\n\t\tKeyPair: keyPair,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%w: unable to serialize key\", err)\n\t}\n\n\terr = transaction.Set(ctx, getAddressKey(address), val)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%w: unable to store key\", err)\n\t}\n\n\tif err := transaction.Commit(ctx); err != nil {\n\t\treturn fmt.Errorf(\"%w: unable to commit new key to db\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8a5926adcc55db5d7356537ddbad8dc4", "score": "0.64829355", "text": "func (c Config) Store(key string, value interface{}) error {\n\tif value == nil {\n\t\tpanic(\"config: Store value is nil\")\n\t}\n\n\t// encode the value first, if it errors we don't need to touch the\n\t// database for writing.\n\tb, err := json.Marshal(value)\n\tif err != nil {\n\t\treturn err\n\t} else if len(b) == 0 {\n\t\t// nothing to store in this case\n\t\treturn nil\n\t}\n\n\tdb, err := Database(c.name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn db.Update(func(tx *bolt.Tx) error {\n\t\tbuck, err := tx.CreateBucketIfNotExists([]byte(BucketName))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn buck.Put([]byte(key), b)\n\t})\n}", "title": "" }, { "docid": "bdf22c80368a2db07fa4da450c0dbe17", "score": "0.6482605", "text": "func (r *RedisStore) Put(key string, data []byte) error {\n\treturn r.client.Set(key, data, r.expiration).Err()\n}", "title": "" }, { "docid": "384a6a90b9ff1b011c6cc333e4ee775c", "score": "0.6478316", "text": "func (c *ContentStore) Put(data string) string {\n\th := sha256.New()\n\th.Write([]byte(fmt.Sprintf(\"%v\", data)))\n\n\thash := fmt.Sprintf(\"%x\", h.Sum(nil))\n\tc.kv[hash] = data\n\treturn hash\n}", "title": "" }, { "docid": "ceb27afad4f1e15962d59daeb7c7deef", "score": "0.647245", "text": "func Put(dbName string, bucket string, key string, data []byte) error {\n\tvar err error\n\tif openDBs[dbName] == nil {\n\t\topenDBs[dbName] = new(bolt.DB)\n\t\topenDBs[dbName], err = bolt.Open(config.DB_DIR+dbName+\".db\", config.READWRITE, &bolt.Options{Timeout: 1 * time.Second})\n\t\tif err != nil {\n\t\t\tlog.Printf(\"-- Put() cannot open %s \\n\", dbName)\n\t\t}\n\t}\n\n\treturn openDBs[dbName].Update(func(tx *bolt.Tx) error {\n\t\tb, err := tx.CreateBucketIfNotExists([]byte(bucket))\n\t\tif err != nil {\n\t\t\tlog.Println(err.Error())\n\t\t\treturn err\n\t\t}\n\n\t\tif err = b.Put([]byte(key), data); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlog.Printf(\"-- saved %s to %s.db \\n\", key, dbName )\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "d2920758bf29a87e9a78fce1ca403d89", "score": "0.646816", "text": "func (db *DB) set(k string, val []byte) {\n\tdb.lock.Lock()\n\tdb.dict[k] = val\n\tdb.lock.Unlock()\n}", "title": "" }, { "docid": "d2920758bf29a87e9a78fce1ca403d89", "score": "0.646816", "text": "func (db *DB) set(k string, val []byte) {\n\tdb.lock.Lock()\n\tdb.dict[k] = val\n\tdb.lock.Unlock()\n}", "title": "" }, { "docid": "f95f8521b1a738ee5dd522ef1b2028b3", "score": "0.64559317", "text": "func (s *Storage) Set(key string, value string) {\n\tdb, _ := buntdb.Open(s.path)\n\n\terr := db.Update(func(tx *buntdb.Tx) error {\n\t\tif _, _, err := tx.Set(key, value, nil); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\tlog.Println(\"BuntDB update error:\", err.Error())\n\t}\n\n\tdefer func() {\n\t\terr := db.Close()\n\t\tif err != nil {\n\t\t\tlog.Println(\"BuntDB error:\", err.Error())\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "9e1205883c2107fb4f38695ea499c8de", "score": "0.6452956", "text": "func (kvs *KVStore) Set(key string, value interface{}, ttl time.Duration) {\n\tstoreNum := qhash([]byte(key), kvs.numStores)\n\n\tkvs.getStore(storeNum).set(key, value, ttl)\n}", "title": "" }, { "docid": "1c06928f8e841898c9803e83e7e29855", "score": "0.64520895", "text": "func (db *DB) Put(ctx context.Context, key multiraftbase.Key, value multiraftbase.Value) error {\n\tb := &Batch{}\n\tb.Put(key, value)\n\treturn getOneErr(db.Run(ctx, b), b)\n}", "title": "" }, { "docid": "4d71ef949286a4f94cb1998ff2a5ff31", "score": "0.64301336", "text": "func StoreData(db *bolt.DB, key []byte, value []byte) {\n\terr := db.Update(func(tx *bolt.Tx) error {\n\t\tbucket, err := tx.CreateBucketIfNotExists(bucket)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Error creating bucket in DB %v\", err)\n\t\t}\n\n\t\terr = bucket.Put(key, value)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Error while storing key-value pair [%s-%s] from DB %v\", key, value, err)\n\t\t}\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error while updating DB with key-value pair [%s-%s] %v\", key, value, err)\n\t}\n}", "title": "" }, { "docid": "7367166d96cee193b74169e320d4dd98", "score": "0.6430013", "text": "func (b *batch) Put(key, value []byte) error {\n\tprefixedKey := b.db.prefix(key)\n\tb.writes = append(b.writes, keyValue{prefixedKey, value, false})\n\treturn b.Batch.Put(prefixedKey, value)\n}", "title": "" }, { "docid": "61dfdaab281a400d67637a4c48efd266", "score": "0.6424206", "text": "func (kv *KV) Put(key string, data map[string]interface{}) error {\n\td := make(map[string]interface{})\n\td[\"data\"] = data\n\n\tout, err := kv.Logical().Write(\n\t\tkey,\n\t\td,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlogdata, _ := json.Marshal(out.Data)\n\tlog.Infof(\"[vault/kv] wrote secret %s %s\", key, string(logdata))\n\treturn nil\n}", "title": "" }, { "docid": "6db5579d249b34c8253fdb53772ce0c5", "score": "0.6423835", "text": "func (db *GBucket) putVTKey(ctx storage.Context, tk storage.TKey, value []byte) error {\n\t// retrieve repo bucket\n\tvar bucket *api.BucketHandle\n\tvar err error\n\tif ctx == nil {\n\t\t// use default buckert\n\t\tbucket = db.bucket\n\t} else {\n\t\tif bucket, err = db.bucketHandle(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// try a speculative write\n\tbasekey := ctx.ConstructKeyVersion(tk, dvid.VersionID(0))\n\tobj_handle := bucket.Object(hex.EncodeToString(basekey))\n\tvar conditions api.Conditions\n\tconditions.DoesNotExist = true\n\tobj_handle = obj_handle.If(conditions)\n\n\t// add versionid, versionid, 0 to val\n\tvalue2 := db.initValueVersion(ctx.VersionID(), value)\n\n\terr = db.putVhandle(obj_handle, value2)\n\tif err != ErrCondFail {\n\t\treturn err\n\t}\n\n\tfor true {\n\t\t// retrieve current valueversion (need entire value to re-post data)\n\t\tbaseval, genid, err := db.getValueGen(ctx, basekey)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\toffversion := dvid.VersionID(0)\n\t\tvar offval []byte\n\n\t\t// modify the valueversion header and return data to be posted as necessary\n\t\tbaseval, offval, offversion, err = db.updateValueVersion(ctx, baseval, value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// either old data (if new version data has been posted) or\n\t\t// new data if old data is master and new data is not\n\t\tif offval != nil {\n\t\t\t// evicted data should not exist beforehand in most cases\n\t\t\tobj_handle := bucket.Object(hex.EncodeToString(ctx.ConstructKeyVersion(tk, offversion)))\n\t\t\tif err := db.putVhandle(obj_handle, offval); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\t// post base data if overwritten, caused eviction, or if there is a prefix change\n\t\t// this is only nil if non-master data is directly posting to already existing data\n\t\tif baseval != nil {\n\t\t\tobj_handle := bucket.Object(hex.EncodeToString(basekey))\n\t\t\tvar conditions api.Conditions\n\t\t\tconditions.GenerationMatch = genid\n\t\t\tobj_handle_temp := obj_handle.If(conditions)\n\t\t\terr = db.putVhandle(obj_handle_temp, baseval)\n\t\t\tif err == nil {\n\t\t\t\tbreak\n\t\t\t} else if err != ErrCondFail {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5a66933a47cedc636ccf319a9931fb8d", "score": "0.6422885", "text": "func Set(key string, val []byte) error {\n\tif err := db.Update(func(txn *badger.Txn) error {\n\t\treturn txn.Set([]byte(key), val)\n\t}); err != nil {\n\t\treturn errors.Wrap(err, \"set error\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b755821e2f029e86e24f9c1e8b7609e7", "score": "0.64179695", "text": "func Put(key string, val string) bool {\n\tstorage[key] = val\n\t_, ok := storage[key]\n\treturn ok\n}", "title": "" }, { "docid": "c2ef8ce4f530e852425c457eb26ef753", "score": "0.64167935", "text": "func (d *ktds) Put(key ds.Key, value interface{}) (err error) {\n\treturn d.child.Put(d.Transform(key), value)\n}", "title": "" }, { "docid": "14f03133e37f09a90b02e74a3719eac6", "score": "0.6411737", "text": "func (c *ConsulBackend) Put(ctx context.Context, entry *physical.Entry) error {\n\tdefer metrics.MeasureSince([]string{\"consul\", \"put\"}, time.Now())\n\n\tc.permitPool.Acquire()\n\tdefer c.permitPool.Release()\n\n\tpair := &api.KVPair{\n\t\tKey: c.path + entry.Key,\n\t\tValue: entry.Value,\n\t}\n\n\twriteOpts := &api.WriteOptions{}\n\twriteOpts = writeOpts.WithContext(ctx)\n\n\t_, err := c.kv.Put(pair, writeOpts)\n\treturn err\n}", "title": "" }, { "docid": "9931148db7747adb093f7ca8daa9f4f8", "score": "0.64068526", "text": "func (this *MyHashMap) Put(key int, value int) {\n t := this.GetBucket(key, true)\n if t.Data == nil {\n t.Data = new(Unit)\n t.Data.Key = key\n t.Data.Val = value\n } else {\n d := t.Data\n for d.Next != nil && d.Key != key {\n d = d.Next\n }\n if d.Next == nil && d.Key != key {\n d.Next = new(Unit)\n d.Next.Key = key\n d.Next.Val = value\n }\n if d.Key == key {\n d.Val = value\n }\n }\n}", "title": "" } ]
a915a06b6c3efdcd6357a13daec72336
Adjust9221Cal function as declared in nidaqmx\NIDAQmx.h:3228
[ { "docid": "bbcb937961b2996a3fb111665f5d41da", "score": "0.7532522", "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": "5e6cdc176cc6138007d095ac1d581ee9", "score": "0.72768414", "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": "39664cf959f528e4f02395bfe910105d", "score": "0.7272831", "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": "5fc35f8b5f385fcef9481dcf38b03134", "score": "0.72582203", "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": "ecd84184c18ed11c7678801528fe219e", "score": "0.7229253", "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": "267c7314ebac9dbeaf6c9caa6ebfd5fb", "score": "0.71966743", "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": "3eb658db4332b6141ac23df59487c954", "score": "0.71693224", "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": "3d429258b939c2f2b07afaee17a0395f", "score": "0.71239775", "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": "b74c48edc033db00405a9943a830a3e7", "score": "0.71182925", "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": "d2f5705fb78e5b52d5ad455b19e7e2ab", "score": "0.7117142", "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": "9572718998b63a6f7bdd06ef081428cc", "score": "0.71115434", "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": "c98e7ada00bf54a68f69ba3f95126fa9", "score": "0.7094368", "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": "170c9aaf1ca37d5b87090ef56119418a", "score": "0.7066901", "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": "f02f5f226f76d9ab321f479cb564700e", "score": "0.7058996", "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": "380ccb27b8197ba54cf444035e9d46ad", "score": "0.7055607", "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": "6602b2669986bb1009bb51888bfb71c3", "score": "0.7030452", "text": "func Adjust9209OffsetCal(CalHandle uint32, ChannelNames string) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\t__ret := C.DAQmxAdjust9209OffsetCal(cCalHandle, cChannelNames)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "27d34630e265620242a48253dee8c6ea", "score": "0.7029539", "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": "9178f2285a28b502ea04eb0af390d4bb", "score": "0.7010632", "text": "func Adjust9247Cal(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.DAQmxAdjust9247Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "43ca682f04d2ec2cbf52d54bd4742ed9", "score": "0.70019835", "text": "func Adjust9263Cal(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.DAQmxAdjust9263Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "b1be6a9d4036949e7f58830c4fbdd2ac", "score": "0.6999248", "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": "a574519c41c90147db0c6b8b8996fca0", "score": "0.69911087", "text": "func Adjust9207OffsetCal(CalHandle uint32, ChannelNames string) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\t__ret := C.DAQmxAdjust9207OffsetCal(cCalHandle, cChannelNames)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "8b5b33dfa04146dfbac223f8da440138", "score": "0.69676334", "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": "9a06f60c5d65b2f68fe187b349064f07", "score": "0.69547564", "text": "func Adjust9203OffsetCal(CalHandle uint32, ChannelNames string, RangeMin float64, RangeMax float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcRangeMin, _ := (C.float64)(RangeMin), cgoAllocsUnknown\n\tcRangeMax, _ := (C.float64)(RangeMax), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9203OffsetCal(cCalHandle, cChannelNames, cRangeMin, cRangeMax)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "10c9801fd6e244829740cb63ad40c5ad", "score": "0.69510597", "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": "d652e89cc0b52553ddca4bc88a6b4f5a", "score": "0.69367963", "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": "7ba12f6d6511f09185f70e020cf1fc54", "score": "0.6926176", "text": "func Adjust9239Cal(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.DAQmxAdjust9239Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "0f647df8be2f62c80259e597507f7ce3", "score": "0.68943214", "text": "func Adjust9213Cal(CalHandle uint32, ChannelNames string, RangeMin float64, RangeMax float64, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcRangeMin, _ := (C.float64)(RangeMin), cgoAllocsUnknown\n\tcRangeMax, _ := (C.float64)(RangeMax), cgoAllocsUnknown\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9213Cal(cCalHandle, cChannelNames, cRangeMin, cRangeMax, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "94d8c1c9ad53958104eb6bff0d4e53b1", "score": "0.68748236", "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": "233ff48a3f9f0525b6aeb0583d50c862", "score": "0.6804773", "text": "func Adjust1124Cal(CalHandle uint32, MeasOutput float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcMeasOutput, _ := (C.float64)(MeasOutput), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust1124Cal(cCalHandle, cMeasOutput)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "d3bf597c68b55f82a68a54fbb956234e", "score": "0.67609054", "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": "7e6b322287c7837c4eaf005f55646bb1", "score": "0.6746268", "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": "af37861498711bfd38c731ec5d9a51fe", "score": "0.6745326", "text": "func Adjust9208OffsetCal(CalHandle uint32, ChannelNames string) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\t__ret := C.DAQmxAdjust9208OffsetCal(cCalHandle, cChannelNames)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "7da43a13a81cd20c04cf16d46fc8e5a3", "score": "0.67075497", "text": "func Adjust9265Cal(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.DAQmxAdjust9265Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "8c86d08d3b55fc412fa7a7cbeffdf3c3", "score": "0.67009884", "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": "" }, { "docid": "983996a55f39825fcc481e34e1314064", "score": "0.6686886", "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": "2ed1894a0d33380675bd6a465b96d706", "score": "0.6601869", "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": "f2154d05463a71be9fd09f4491d0b8e9", "score": "0.6582035", "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": "76a8939815beccba2a59c5ad9dee89c5", "score": "0.6579586", "text": "func Adjust1142Cal(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.DAQmxAdjust1142Cal(cCalHandle, cRefVoltage, cMeasOutput)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "d4d17faff1a4a6e21c9ad158e161526f", "score": "0.6573314", "text": "func Adjust9225Cal(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.DAQmxAdjust9225Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "b32aceb0a3253f7b15badb0dd6ee6310", "score": "0.6562297", "text": "func Adjust9209GainCal(CalHandle uint32, ChannelNames string, TerminalConfig int32, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcTerminalConfig, _ := (C.int32)(TerminalConfig), cgoAllocsUnknown\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9209GainCal(cCalHandle, cChannelNames, cTerminalConfig, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "6742f713b508f6bc2edee2211a648981", "score": "0.65515614", "text": "func Adjust4610Cal(CalHandle uint32, ChannelName string, Gain float64, Offset float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelName, _ := unpackPCharString(ChannelName)\n\tcGain, _ := (C.float64)(Gain), cgoAllocsUnknown\n\tcOffset, _ := (C.float64)(Offset), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust4610Cal(cCalHandle, cChannelName, cGain, cOffset)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "01b080d423ac4da52e3bbe41861c73a0", "score": "0.6537039", "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": "adafdf68f17b0e6eb145a7a73cc2991e", "score": "0.6522638", "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": "ea59d6e486b19e7c721e7fc94dccf174", "score": "0.6502784", "text": "func Adjust1112Cal(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.DAQmxAdjust1112Cal(cCalHandle, cRefVoltage, cMeasOutput)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "ac80292d52eb0dd6ff904c862a93dcae", "score": "0.6483766", "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": "4d8e21c116a1524415dc83341e89f5ad", "score": "0.6482683", "text": "func Adjust1122Cal(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.DAQmxAdjust1122Cal(cCalHandle, cRefVoltage, cMeasOutput)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "c5175dc014191daf068774969d7412eb", "score": "0.647436", "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": "7569686800433ccbba22d0b1694693f7", "score": "0.6468379", "text": "func Adjust1503CurrentCal(CalHandle uint32, ChannelName string, MeasCurrent float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelName, _ := unpackPCharString(ChannelName)\n\tcMeasCurrent, _ := (C.float64)(MeasCurrent), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust1503CurrentCal(cCalHandle, cChannelName, cMeasCurrent)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "ff19d62c502d4a8c57ca7bf788d8d1d2", "score": "0.6461042", "text": "func Adjust9234OffsetCal(CalHandle uint32, ChannelNames string) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\t__ret := C.DAQmxAdjust9234OffsetCal(cCalHandle, cChannelNames)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "187ef1a235ace0e317dfd3b0ac2b6a34", "score": "0.64572626", "text": "func Adjust9214Cal(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.DAQmxAdjust9214Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "2fe7ea08828c2f46fb6165d85ba34bad", "score": "0.6456438", "text": "func Adjust4225Cal(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.DAQmxAdjust4225Cal(cCalHandle, cChannelNames, cGain, cInputVal)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "d9be15caf43b25bc06c864ed68e8c903", "score": "0.64139616", "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": "6cb043da18110540a701325c2f4d4a8b", "score": "0.63883233", "text": "func Adjust4224Cal(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.DAQmxAdjust4224Cal(cCalHandle, cChannelNames, cGain, cInputVal)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "d1fe94e7234be609337265f08e13f4dc", "score": "0.6387567", "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": "2712c8e04813e47ec758a1d6dda67e34", "score": "0.63754636", "text": "func Adjust1143Cal(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.DAQmxAdjust1143Cal(cCalHandle, cRefVoltage, cMeasOutput)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "0c819f8041d671987a7b8ae6f954bf25", "score": "0.6362974", "text": "func Adjust1141Cal(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.DAQmxAdjust1141Cal(cCalHandle, cRefVoltage, cMeasOutput)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "60bcf2157cc8f63732616753642fdd2d", "score": "0.63371074", "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": "c41c5b0f2af57804f4d4cc081d49a47a", "score": "0.63294643", "text": "func Adjust1503Cal(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.DAQmxAdjust1503Cal(cCalHandle, cRefVoltage, cMeasOutput)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "22131befc7e042f383585812840c6e3b", "score": "0.63212997", "text": "func Adjust9207GainCal(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.DAQmxAdjust9207GainCal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "6987928038a6f56f40328c260677680a", "score": "0.6284064", "text": "func Adjust4357Cal(CalHandle uint32, ChannelNames string, RefVals []float64, NumRefVals int32) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcRefVals, _ := (*C.float64)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&RefVals)).Data)), cgoAllocsUnknown\n\tcNumRefVals, _ := (C.int32)(NumRefVals), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust4357Cal(cCalHandle, cChannelNames, cRefVals, cNumRefVals)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "942964ad681021e10f11b99581cb06c0", "score": "0.6280758", "text": "func Adjust9208GainCal(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.DAQmxAdjust9208GainCal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "8bfba13e54f3d7d337c69a65f4ca8bec", "score": "0.6250142", "text": "func Adjust9203GainCal(CalHandle uint32, ChannelNames string, RangeMin float64, RangeMax float64, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcRangeMin, _ := (C.float64)(RangeMin), cgoAllocsUnknown\n\tcRangeMax, _ := (C.float64)(RangeMax), cgoAllocsUnknown\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9203GainCal(cCalHandle, cChannelNames, cRangeMin, cRangeMax, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "f2487574a8613918a5ffd6072cd50717", "score": "0.6211565", "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": "cc9b21d3ae32eb28190806e596f3411e", "score": "0.61945003", "text": "func Adjust4353Cal(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.DAQmxAdjust4353Cal(cCalHandle, cChannelNames, cRefVal)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "74ffe0acd810f48418335fca276a23a1", "score": "0.61883724", "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": "12472862267a9122a6329f6dd0bb2468", "score": "0.61302525", "text": "func Adjust4339Cal(CalHandle uint32, RefVoltage float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcRefVoltage, _ := (C.float64)(RefVoltage), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust4339Cal(cCalHandle, cRefVoltage)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "a3e49f0bcf6b0186c0c9947190a40615", "score": "0.61151475", "text": "func Adjust1104Cal(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.DAQmxAdjust1104Cal(cCalHandle, cRefVoltage, cMeasOutput)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "335e78da1d4b38b1462a123e62e70040", "score": "0.6075831", "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": "2713eebfd1aeb6ccc40c95f6a9e5ac37", "score": "0.6065709", "text": "func Adjust4302Cal(CalHandle uint32, RefVoltage float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcRefVoltage, _ := (C.float64)(RefVoltage), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust4302Cal(cCalHandle, cRefVoltage)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "3566ef5d8bd1a94a434b42754da31058", "score": "0.6047379", "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": "896088e2871831770f5db826511d49f7", "score": "0.596886", "text": "func Adjust4300Cal(CalHandle uint32, RefVoltage float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcRefVoltage, _ := (C.float64)(RefVoltage), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust4300Cal(cCalHandle, cRefVoltage)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "0b9cad18783ea9adad121b801243ab9f", "score": "0.59319395", "text": "func Adjust4305Cal(CalHandle uint32, RefVoltage float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcRefVoltage, _ := (C.float64)(RefVoltage), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust4305Cal(cCalHandle, cRefVoltage)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "dce6d7bfc5da7f664ecbfece4cd29e1f", "score": "0.588454", "text": "func Adjust4303Cal(CalHandle uint32, RefVoltage float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcRefVoltage, _ := (C.float64)(RefVoltage), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust4303Cal(cCalHandle, cRefVoltage)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "b7302cc0f49f4f761d81f19c5a28ed13", "score": "0.5879303", "text": "func Adjust4304Cal(CalHandle uint32, RefVoltage float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcRefVoltage, _ := (C.float64)(RefVoltage), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust4304Cal(cCalHandle, cRefVoltage)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "0b056eb6474459591fe7d3c1f296002e", "score": "0.58535635", "text": "func Adjust4204Cal(CalHandle uint32, ChannelNames string, LowPassFreq float64, TrackHoldEnabled uint32, InputVal float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcLowPassFreq, _ := (C.float64)(LowPassFreq), cgoAllocsUnknown\n\tcTrackHoldEnabled, _ := (C.bool32)(TrackHoldEnabled), cgoAllocsUnknown\n\tcInputVal, _ := (C.float64)(InputVal), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust4204Cal(cCalHandle, cChannelNames, cLowPassFreq, cTrackHoldEnabled, cInputVal)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "9091ce0caf422c4e81dbc099427800a3", "score": "0.57987", "text": "func AdjustDSATimebaseCal(CalHandle uint32, ReferenceFrequency float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcReferenceFrequency, _ := (C.float64)(ReferenceFrequency), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjustDSATimebaseCal(cCalHandle, cReferenceFrequency)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "bab71baa567c879c9ed2595c17a3dcc3", "score": "0.5794029", "text": "func Adjust1125Cal(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.DAQmxAdjust1125Cal(cCalHandle, cRefVoltage, cMeasOutput)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "1625eccb5cc9ba41b24a2cb1abd6db46", "score": "0.5784777", "text": "func Adjust153xCal(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.DAQmxAdjust153xCal(cCalHandle, cRefVoltage, cMeasOutput)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "0019acd49446afacb6ea5325778d531f", "score": "0.5784342", "text": "func Adjust9234GainCal(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.DAQmxAdjust9234GainCal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "cc79e7c479657ac0d6411e987f3ff3e1", "score": "0.5781451", "text": "func XSeriesCalAdjust(CalHandle uint32, ReferenceVoltage float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcReferenceVoltage, _ := (C.float64)(ReferenceVoltage), cgoAllocsUnknown\n\t__ret := C.DAQmxXSeriesCalAdjust(cCalHandle, cReferenceVoltage)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "c0536e0756834a17b118aaecd57f4720", "score": "0.5720452", "text": "func MSeriesCalAdjust(CalHandle uint32, ReferenceVoltage float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcReferenceVoltage, _ := (C.float64)(ReferenceVoltage), cgoAllocsUnknown\n\t__ret := C.DAQmxMSeriesCalAdjust(cCalHandle, cReferenceVoltage)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "cac8b86b25bde05b8ee64651137e3fe5", "score": "0.56941175", "text": "func Adjust4463Cal(CalHandle uint32, ChannelNames string, ReferenceVoltage float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcReferenceVoltage, _ := (C.float64)(ReferenceVoltage), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust4463Cal(cCalHandle, cChannelNames, cReferenceVoltage)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "011b21584074f007d72f6c24e565dae3", "score": "0.56777143", "text": "func Adjust1540Cal(CalHandle uint32, RefVoltage float64, MeasOutput float64, InputCalSource int32) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcRefVoltage, _ := (C.float64)(RefVoltage), cgoAllocsUnknown\n\tcMeasOutput, _ := (C.float64)(MeasOutput), cgoAllocsUnknown\n\tcInputCalSource, _ := (C.int32)(InputCalSource), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust1540Cal(cCalHandle, cRefVoltage, cMeasOutput, cInputCalSource)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "2d193370b77e65a17d57e080b7c94474", "score": "0.5551587", "text": "func AOSeriesCalAdjust(CalHandle uint32, ReferenceVoltage float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcReferenceVoltage, _ := (C.float64)(ReferenceVoltage), cgoAllocsUnknown\n\t__ret := C.DAQmxAOSeriesCalAdjust(cCalHandle, cReferenceVoltage)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "0cf6727dcafd0f9ee8d192a2258f65a2", "score": "0.5537122", "text": "func ResetAIChanCalEnableCal(TaskHandle unsafe.Pointer, Channel string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcChannel, _ := unpackPCharString(Channel)\n\t__ret := C.DAQmxResetAIChanCalEnableCal(cTaskHandle, cChannel)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "8848724b67649c40d4bd2362b00d1476", "score": "0.5481171", "text": "func ESeriesCalAdjust(CalHandle uint32, ReferenceVoltage float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcReferenceVoltage, _ := (C.float64)(ReferenceVoltage), cgoAllocsUnknown\n\t__ret := C.DAQmxESeriesCalAdjust(cCalHandle, cReferenceVoltage)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "ca584e1b5229e3cdb4ef7921e50b4f05", "score": "0.5443387", "text": "func SSeriesCalAdjust(CalHandle uint32, ReferenceVoltage float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcReferenceVoltage, _ := (C.float64)(ReferenceVoltage), cgoAllocsUnknown\n\t__ret := C.DAQmxSSeriesCalAdjust(cCalHandle, cReferenceVoltage)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "9a7be8ce5b4359f3f3df099e769f9ae0", "score": "0.5372793", "text": "func TestDCOffset(){\n\n}", "title": "" }, { "docid": "47ce5a274c3f179880de41541010ff9c", "score": "0.5359455", "text": "func CalAs(pesi float64) float64 {\n\treturn math.Abs(pesi * PKGb * PKGα1 * FC * FY / math.Pow(10, 6))\n}", "title": "" }, { "docid": "57cd289f51ca8b50ed9fdbf15947b7fc", "score": "0.53165686", "text": "func ResetAIChanCalApplyCalIfExp(TaskHandle unsafe.Pointer, Channel string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcChannel, _ := unpackPCharString(Channel)\n\t__ret := C.DAQmxResetAIChanCalApplyCalIfExp(cTaskHandle, cChannel)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "aad3b44148d74ff2c5abba94c3c0ed71", "score": "0.5256041", "text": "func AdjustDSAAOCal(CalHandle uint32, Channel uint32, RequestedLowVoltage float64, ActualLowVoltage float64, RequestedHighVoltage float64, ActualHighVoltage float64, GainSetting float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannel, _ := (C.uInt32)(Channel), cgoAllocsUnknown\n\tcRequestedLowVoltage, _ := (C.float64)(RequestedLowVoltage), cgoAllocsUnknown\n\tcActualLowVoltage, _ := (C.float64)(ActualLowVoltage), cgoAllocsUnknown\n\tcRequestedHighVoltage, _ := (C.float64)(RequestedHighVoltage), cgoAllocsUnknown\n\tcActualHighVoltage, _ := (C.float64)(ActualHighVoltage), cgoAllocsUnknown\n\tcGainSetting, _ := (C.float64)(GainSetting), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjustDSAAOCal(cCalHandle, cChannel, cRequestedLowVoltage, cActualLowVoltage, cRequestedHighVoltage, cActualHighVoltage, cGainSetting)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "7d91648dc7770e982560fd1d98849792", "score": "0.5228677", "text": "func AdjustTIOTimebaseCal(CalHandle uint32, ReferenceFrequency float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcReferenceFrequency, _ := (C.float64)(ReferenceFrequency), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjustTIOTimebaseCal(cCalHandle, cReferenceFrequency)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "fda64a388f2c94ecf33402061f7f7ce4", "score": "0.5214511", "text": "func SelfCal(DeviceName string) int32 {\n\tcDeviceName, _ := unpackPCharString(DeviceName)\n\t__ret := C.DAQmxSelfCal(cDeviceName)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "1f8ee5c13f251c209fe2cb55f733cadc", "score": "0.5106022", "text": "func Calper(perdayhour float64,hour float64,min float64) map[string]string{\n\tarrmap :=make(map[string]string)\n\tdiffhour := hour-perdayhour\n\tdiffmin := min\n\tif diffhour<0 && min>0 {\n\t\tdiffhour = diffhour+1\n\t\tdiffmin = 60-min\n\t}\n\n\t//arrmap[\"diffhour\"] = fmt.Sprintf(\"%0.2f\", diffhour)\n\t//arrmap[\"diffmin\"] = fmt.Sprintf(\"%0.2f\", diffmin)\n\tarrmap[\"diffhour\"] = strconv.Itoa(int(diffhour))\n\tarrmap[\"diffmin\"] = strconv.Itoa(int(diffmin))\n\treturn arrmap\n}", "title": "" }, { "docid": "abe18764118644fbdd6bfd23b5dcdd7f", "score": "0.50950086", "text": "func _1700getDigits(tls crt.TLS, _zDate uintptr /* *int8 */, _zFormat uintptr /* *int8 */, ap ...interface{}) (r int32) {\n\tvar (\n\t\t_ap *[]interface{} // Tva_list = T__gnuc_va_list = T__...a_list = *struct{X_ [2]uintptr;}\n\t\t_cnt int32\n\t\t_nextC int8\n\t\t_N int8\n\t\t_min int8\n\t\t_val int32\n\t\t_max uint16\n\t)\n\t_cnt = int32(0)\n\t{\n\t\tx := ap\n\t\t_ap = &x\n\t}\n_1:\n\t_N = int8(int32(*(*int8)(unsafe.Pointer(_zFormat))) - int32('0'))\n\t_min = int8(int32(*(*int8)(unsafe.Pointer(_zFormat + 1))) - int32('0'))\n\t_val = int32(0)\n\n\t_max = *(*uint16)(unsafe.Pointer(_1857aMx + 2*uintptr(int32(*(*int8)(unsafe.Pointer(_zFormat + 2)))-int32('a'))))\n\t_nextC = *(*int8)(unsafe.Pointer(_zFormat + 3))\n\t_val = int32(0)\n_4:\n\tif postinc145(&_N) == 0 {\n\t\tgoto _5\n\t}\n\n\tif int32(*(*uint8)(unsafe.Pointer(_180sqlite3CtypeMap + uintptr(uint8(*(*int8)(unsafe.Pointer(_zDate)))))))&int32(0x4) != 0 {\n\t\tgoto _6\n\t}\n\n\tgoto _end_getDigits\n\n_6:\n\t_val = ((_val * int32(10)) + int32(*(*int8)(unsafe.Pointer(_zDate)))) - int32('0')\n\t_zDate++\n\tgoto _4\n\n_5:\n\tif _val >= int32(_min) && _val <= int32(_max) && (int32(_nextC) == int32(0) || int32(_nextC) == int32(*(*int8)(unsafe.Pointer(_zDate)))) {\n\t\tgoto _7\n\t}\n\n\tgoto _end_getDigits\n\n_7:\n\t*(*int32)(unsafe.Pointer(crt.VAuintptr(_ap))) = _val\n\t_zDate++\n\t_cnt++\n\t_zFormat += uintptr(4)\n\tif _nextC != 0 {\n\t\tgoto _1\n\t}\n\n\tgoto _end_getDigits\n_end_getDigits:\n\t_ap = nil\n\treturn _cnt\n}", "title": "" }, { "docid": "fdcd9e1dc1830c2612573237141cf318", "score": "0.5082584", "text": "func (this *ftpAdjustment) calcAdjustRate(tf *CalcFTP, val acctInfo, m busizMethod, ftpRate string) map[string]string {\n\n\trst := make(map[string]string)\n\n\tfor key, f := range adjustFunc {\n\n\t\trst[key] = f(this, tf, val, m, ftpRate)\n\n\t}\n\treturn rst\n}", "title": "" }, { "docid": "73e2f7106aa44175519f488a11326fec", "score": "0.50616825", "text": "func ResetAIChanCalPolyForwardCoeff(TaskHandle unsafe.Pointer, Channel string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcChannel, _ := unpackPCharString(Channel)\n\t__ret := C.DAQmxResetAIChanCalPolyForwardCoeff(cTaskHandle, cChannel)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "3817257667cde5df5bc7c166d751e08c", "score": "0.5052297", "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": "d53c068c02559a6e6a61a2dfb2e7ab01", "score": "0.5039569", "text": "func _1568updateAccumulator(tls crt.TLS, _pParse uintptr /* *TParse = SParse */, _pAggInfo uintptr /* *TAggInfo = SAggInfo */) {\n\tvar (\n\t\t_v uintptr // *TVdbe = SVdbe\n\t\t_i int32\n\t\t_regHit int32\n\t\t_addrHitTest int32\n\t\t_pF uintptr // *SAggInfo_func\n\t\t_pC uintptr // *SAggInfo_col\n\t\t_nArg int32\n\t\t_addrNext int32\n\t\t_regAgg int32\n\t\t_pList uintptr // *TExprList = SExprList\n\t\t_pColl uintptr // *TCollSeq = SCollSeq\n\t\t_pItem uintptr // *SExprList_item\n\t\t_j int32\n\t)\n\t_v = *(*uintptr)(unsafe.Pointer(_pParse + 16))\n\t_regHit = int32(0)\n\t_addrHitTest = int32(0)\n\t*(*uint8)(unsafe.Pointer(_pAggInfo)) = uint8(1)\n\t_i = int32(0)\n\t_pF = *(*uintptr)(unsafe.Pointer(_pAggInfo + 48))\n_1:\n\tif _i >= (*(*int32)(unsafe.Pointer(_pAggInfo + 56))) {\n\t\tgoto _3\n\t}\n\n\t_addrNext = int32(0)\n\t_pList = *(*uintptr)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(_pF))) + 32))\n\n\tif _pList == 0 {\n\t\tgoto _4\n\t}\n\n\t_nArg = *(*int32)(unsafe.Pointer(_pList))\n\t_regAgg = _1558sqlite3GetTempRange(tls, _pParse, _nArg)\n\t_1560sqlite3ExprCodeExprList(tls, _pParse, _pList, _regAgg, int32(0), uint8(0x1))\n\tgoto _5\n\n_4:\n\t_nArg = int32(0)\n\t_regAgg = int32(0)\n_5:\n\tif (*(*int32)(unsafe.Pointer(_pF + 20))) < int32(0) {\n\t\tgoto _6\n\t}\n\n\t_addrNext = _1541sqlite3VdbeMakeLabel(tls, _v)\n\t_1790codeDistinct(tls, _pParse, *(*int32)(unsafe.Pointer(_pF + 20)), _addrNext, int32(1), _regAgg)\n_6:\n\tif (int32(*(*uint16)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(_pF + 8))) + 2))) & int32(0x20)) == 0 {\n\t\tgoto _7\n\t}\n\n\t_pColl = 0\n\n\t_j = int32(0)\n\t_pItem = _pList + 8\n_8:\n\tif _pColl != 0 || _j >= _nArg {\n\t\tgoto _10\n\t}\n\n\t_pColl = _1789sqlite3ExprCollSeq(tls, _pParse, *(*uintptr)(unsafe.Pointer(_pItem)))\n\t_j++\n\t_pItem += 32\n\tgoto _8\n\n_10:\n\tif _pColl != 0 {\n\t\tgoto _11\n\t}\n\n\t_pColl = *(*uintptr)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(_pParse))) + 16))\n_11:\n\tif _regHit != int32(0) || (*(*int32)(unsafe.Pointer(_pAggInfo + 44))) == 0 {\n\t\tgoto _12\n\t}\n\n\t_regHit = preinc2(&(*(*int32)(unsafe.Pointer(_pParse + 56))))\n_12:\n\t_1475sqlite3VdbeAddOp4(tls, _v, int32(79), _regHit, int32(0), int32(0), _pColl, int32(-2))\n_7:\n\t_1241sqlite3VdbeAddOp3(tls, _v, int32(148), int32(0), _regAgg, *(*int32)(unsafe.Pointer(_pF + 16)))\n\t_1802sqlite3VdbeAppendP4(tls, _v, *(*uintptr)(unsafe.Pointer(_pF + 8)), int32(-8))\n\t_1072sqlite3VdbeChangeP5(tls, _v, uint16(uint8(_nArg)))\n\t_1792sqlite3ExprCacheAffinityChange(tls, _pParse, _regAgg, _nArg)\n\t_1564sqlite3ReleaseTempRange(tls, _pParse, _regAgg, _nArg)\n\tif _addrNext == 0 {\n\t\tgoto _13\n\t}\n\n\t_1569sqlite3VdbeResolveLabel(tls, _v, _addrNext)\n\t_1559sqlite3ExprCacheClear(tls, _pParse)\n_13:\n\t_i++\n\t_pF += 24\n\tgoto _1\n\n_3:\n\tif _regHit == 0 {\n\t\tgoto _14\n\t}\n\n\t_addrHitTest = _1489sqlite3VdbeAddOp1(tls, _v, int32(21), _regHit)\n_14:\n\t_1559sqlite3ExprCacheClear(tls, _pParse)\n\t_i = int32(0)\n\t_pC = *(*uintptr)(unsafe.Pointer(_pAggInfo + 32))\n_15:\n\tif _i >= (*(*int32)(unsafe.Pointer(_pAggInfo + 44))) {\n\t\tgoto _17\n\t}\n\n\t_1478sqlite3ExprCode(tls, _pParse, *(*uintptr)(unsafe.Pointer(_pC + 24)), *(*int32)(unsafe.Pointer(_pC + 20)))\n\t_i++\n\t_pC += 32\n\tgoto _15\n\n_17:\n\t*(*uint8)(unsafe.Pointer(_pAggInfo)) = uint8(0)\n\t_1559sqlite3ExprCacheClear(tls, _pParse)\n\tif _addrHitTest == 0 {\n\t\tgoto _18\n\t}\n\n\t_1474sqlite3VdbeJumpHere(tls, _v, _addrHitTest)\n_18:\n}", "title": "" }, { "docid": "e8e818b84af2c3ac498ca6dc2cb94e0b", "score": "0.5034998", "text": "func ResetAIChanCalTablePreScaledVals(TaskHandle unsafe.Pointer, Channel string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcChannel, _ := unpackPCharString(Channel)\n\t__ret := C.DAQmxResetAIChanCalTablePreScaledVals(cTaskHandle, cChannel)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "51c45da45a3df53e362a6791153294e2", "score": "0.50303984", "text": "func InitExtCal(DeviceName string, Password string, CalHandle []uint32) int32 {\n\tcDeviceName, _ := unpackPCharString(DeviceName)\n\tcPassword, _ := unpackPCharString(Password)\n\tcCalHandle, _ := (*C.CalHandle)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&CalHandle)).Data)), cgoAllocsUnknown\n\t__ret := C.DAQmxInitExtCal(cDeviceName, cPassword, cCalHandle)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" } ]
54b57a7301d9bbdc4f461400fd016fb4
SetVirtualMachine adds the virtualMachine to the ipam ip addresses read params
[ { "docid": "35f95782bc8b15e11413ccae034e4636", "score": "0.7458206", "text": "func (o *IPAMIPAddressesReadParams) SetVirtualMachine(virtualMachine *string) {\n\to.VirtualMachine = virtualMachine\n}", "title": "" } ]
[ { "docid": "ae0f82a29ee950cb76a9dc4de5e34777", "score": "0.72302395", "text": "func (o *IPAMIPAddressesListParams) SetVirtualMachine(virtualMachine *string) {\n\to.VirtualMachine = virtualMachine\n}", "title": "" }, { "docid": "4e619d7c565a6edc1c77919261c260e9", "score": "0.6897876", "text": "func (o *VirtualizationInterfacesReadParams) SetVirtualMachine(virtualMachine *string) {\n\to.VirtualMachine = virtualMachine\n}", "title": "" }, { "docid": "606c3fd9017567d79ce56bdf12b5086f", "score": "0.6717111", "text": "func (o *VirtualizationInterfacesListParams) SetVirtualMachine(virtualMachine *string) {\n\to.VirtualMachine = virtualMachine\n}", "title": "" }, { "docid": "a1352039084ecb963a67cdcba496fdc4", "score": "0.6338916", "text": "func (o *IPAMIPAddressesListParams) WithVirtualMachine(virtualMachine *string) *IPAMIPAddressesListParams {\n\to.SetVirtualMachine(virtualMachine)\n\treturn o\n}", "title": "" }, { "docid": "d7d20771a8c8e919959a47a9628242d5", "score": "0.632955", "text": "func (o *IPAMIPAddressesReadParams) WithVirtualMachine(virtualMachine *string) *IPAMIPAddressesReadParams {\n\to.SetVirtualMachine(virtualMachine)\n\treturn o\n}", "title": "" }, { "docid": "525fa38664b64d5de95c56cd680749c7", "score": "0.5947994", "text": "func (o *VirtualizationInterfacesReadParams) WithVirtualMachine(virtualMachine *string) *VirtualizationInterfacesReadParams {\n\to.SetVirtualMachine(virtualMachine)\n\treturn o\n}", "title": "" }, { "docid": "50c102e61ed3606c1cdd0cfb9e599e74", "score": "0.5928134", "text": "func (o *IPAMIPAddressesReadParams) SetVirtualMachineID(virtualMachineID *string) {\n\to.VirtualMachineID = virtualMachineID\n}", "title": "" }, { "docid": "75269e6218d570891e3f21891c260f04", "score": "0.57447386", "text": "func (o *IPAMIPAddressesListParams) SetVirtualMachineID(virtualMachineID *string) {\n\to.VirtualMachineID = virtualMachineID\n}", "title": "" }, { "docid": "495f36cece4a279f4dac1c4f1d31fec8", "score": "0.55449367", "text": "func (o *VirtualizationInterfacesReadParams) SetVirtualMachineID(virtualMachineID *string) {\n\to.VirtualMachineID = virtualMachineID\n}", "title": "" }, { "docid": "fb92801ccd3dd68e17597d872c0c5e97", "score": "0.5479539", "text": "func (o *VirtualizationInterfacesListParams) WithVirtualMachine(virtualMachine *string) *VirtualizationInterfacesListParams {\n\to.SetVirtualMachine(virtualMachine)\n\treturn o\n}", "title": "" }, { "docid": "fecbde7d09f23c8ee08639b858de048f", "score": "0.54732096", "text": "func (m *CloudPcOnPremisesConnection) SetVirtualNetworkLocation(value *string)() {\n err := m.GetBackingStore().Set(\"virtualNetworkLocation\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "3da3a93142cf9fb22d8a254a2a77683b", "score": "0.536088", "text": "func setVM(cmd *cobra.Command) {\n\t// check if --vm-ram or --vm-cpu changed from default value\n\tfor _, flagName := range []string{\"vm-ram\", \"vm-cpu\"} {\n\t\tif flag := cmd.Flag(flagName); flag != nil && flag.Changed {\n\t\t\t// this option requires the VM setting to be enabled\n\t\t\tcmd.Flags().Set(\"vm\", \"true\")\n\t\t\treturn\n\t\t}\n\t}\n\n\t// since --syos is a boolean, it cannot be added to the above list\n\tif IsSyOS && !VM {\n\t\t// let the user know that passing --syos implictly enables --vm\n\t\tsylog.Warningf(\"The --syos option requires a virtual machine, automatically enabling --vm option.\")\n\t\tcmd.Flags().Set(\"vm\", \"true\")\n\t}\n}", "title": "" }, { "docid": "3c13c4cfb762ba0282483468a57a2e34", "score": "0.5350156", "text": "func (_class VMClass) SetPVArgs(sessionID SessionRef, self VMRef, value string) (_err error) {\n\t_method := \"VM.set_PV_args\"\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 := convertStringToXen(fmt.Sprintf(\"%s(%s)\", _method, \"value\"), value)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg)\n\treturn\n}", "title": "" }, { "docid": "d7dbceacbfc45eb13a9a84ccf9dc9ddc", "score": "0.53387314", "text": "func (o *CostEstimationItem) SetVirtualMachineId(v string) {\n\to.VirtualMachineId = v\n}", "title": "" }, { "docid": "53981e95110416a2bfe49759e3a3b0f5", "score": "0.530017", "text": "func NewVirtualMachine() *VirtualMachine {\n\treader := bufio.NewReader(os.Stdin)\n\t\n\t//get VM name from user input\t\n\tfmt.Print(\"Enter VM Name: \")\n\tvmName, _, err := reader.ReadLine()\n\tcheckErr(err)\n\tvirtualMachineName := string(vmName)\n\n\t//get VM OSType from user input\t\t\n\tfmt.Print(\"Enter VM OSType: \")\n\tvmOSType, _, err := reader.ReadLine()\n\tcheckErr(err)\n\tvirtualMachineOSType := string(vmOSType)\n\t\n\t//get VM Ip from user input\t\n\tfmt.Print(\"Enter VM Ip: \")\n\tvmIp, _, err := reader.ReadLine()\n\tcheckErr(err)\n\tvirtualMachineIp := string(vmIp)\n\t\n\t//get VM Enviornment from user input\t\n\tfmt.Print(\"Enter VM Enviornment: \")\n\tvmEnviornment, _, err := reader.ReadLine()\n\tcheckErr(err)\n\tvirtualMachineEnviornment := string(vmEnviornment)\n\t\n\t//initialize VM with user input values\n\tvirtualMachine := VirtualMachine{virtualMachineName, virtualMachineOSType, virtualMachineIp, virtualMachineEnviornment}\n\t\n\treturn &virtualMachine\n\n}", "title": "" }, { "docid": "7b661aa81ab1ec3b7535dbd644b772af", "score": "0.5296508", "text": "func (_class VMClass) SetMemoryTargetLive(sessionID SessionRef, self VMRef, target int) (_err error) {\n\t_method := \"VM.set_memory_target_live\"\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_targetArg, _err := convertIntToXen(fmt.Sprintf(\"%s(%s)\", _method, \"target\"), target)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _targetArg)\n\treturn\n}", "title": "" }, { "docid": "0ef7f0ed360f21731ec69fde9ebb2699", "score": "0.5285846", "text": "func (o *VirtualizationInterfacesListParams) SetVirtualMachineID(virtualMachineID *string) {\n\to.VirtualMachineID = virtualMachineID\n}", "title": "" }, { "docid": "3cb62993403c00b8cd5fddcc157cf061", "score": "0.5258667", "text": "func (m *IpEvidence) SetIpAddress(value *string)() {\n err := m.GetBackingStore().Set(\"ipAddress\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "0abfc35af86e43db5ebc7f726d176f56", "score": "0.5233768", "text": "func (_class VMClass) SetMemoryLimits(sessionID SessionRef, self VMRef, staticMin int, staticMax int, dynamicMin int, dynamicMax int) (_err error) {\n\t_method := \"VM.set_memory_limits\"\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_staticMinArg, _err := convertIntToXen(fmt.Sprintf(\"%s(%s)\", _method, \"static_min\"), staticMin)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_staticMaxArg, _err := convertIntToXen(fmt.Sprintf(\"%s(%s)\", _method, \"static_max\"), staticMax)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_dynamicMinArg, _err := convertIntToXen(fmt.Sprintf(\"%s(%s)\", _method, \"dynamic_min\"), dynamicMin)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_dynamicMaxArg, _err := convertIntToXen(fmt.Sprintf(\"%s(%s)\", _method, \"dynamic_max\"), dynamicMax)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _staticMinArg, _staticMaxArg, _dynamicMinArg, _dynamicMaxArg)\n\treturn\n}", "title": "" }, { "docid": "a9bde7a86e4ac7a83c58ffb51bfedda1", "score": "0.5220886", "text": "func (m *SignIn) SetIpAddress(value *string)() {\n err := m.GetBackingStore().Set(\"ipAddress\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "c985054ea4d3a39011ba2cd8349afaba", "score": "0.5195894", "text": "func (vm *VM) SetMem(addr, value int) {\n\tvm.memory.poke(uint64(addr), int64(value))\n}", "title": "" }, { "docid": "239c2ce1a3468913ece017ba2e65937c", "score": "0.516618", "text": "func setTestVirtualMachines(c *Cloud, vmList map[string]string) {\n\tvirtualMachineClient := c.VirtualMachinesClient.(*fakeAzureVirtualMachinesClient)\n\tstore := map[string]map[string]compute.VirtualMachine{\n\t\t\"rg\": make(map[string]compute.VirtualMachine),\n\t}\n\n\tfor nodeName, powerState := range vmList {\n\t\tinstanceID := fmt.Sprintf(\"/subscriptions/subscription/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/%s\", nodeName)\n\t\tvm := compute.VirtualMachine{\n\t\t\tName: &nodeName,\n\t\t\tID: &instanceID,\n\t\t\tLocation: &c.Location,\n\t\t}\n\t\tif powerState != \"\" {\n\t\t\tstatus := []compute.InstanceViewStatus{\n\t\t\t\t{\n\t\t\t\t\tCode: to.StringPtr(powerState),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tCode: to.StringPtr(\"ProvisioningState/succeeded\"),\n\t\t\t\t},\n\t\t\t}\n\t\t\tvm.VirtualMachineProperties = &compute.VirtualMachineProperties{\n\t\t\t\tInstanceView: &compute.VirtualMachineInstanceView{\n\t\t\t\t\tStatuses: &status,\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\n\t\tstore[\"rg\"][nodeName] = vm\n\t}\n\n\tvirtualMachineClient.setFakeStore(store)\n}", "title": "" }, { "docid": "0fa35e6dec9b6fd0a60d54f719dd78be", "score": "0.51560843", "text": "func (self ip) SetVip(vip core.Vip) error {\n\t// for idempotency\n\t// todo: readlock\n\tfor i := range virtIps {\n\t\t// if ip or alias is already added...\n\t\tif virtIps[i].Ip == vip.Ip || virtIps[i].Alias == vip.Alias {\n\t\t\t// check if the vip exists...\n\t\t\tif virtIps[i].Ip == vip.Ip && virtIps[i].Interface == vip.Interface && virtIps[i].Alias == vip.Alias {\n\t\t\t\t// and be idempotent...\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\t// otherwise, return an error...\n\t\t\treturn fmt.Errorf(\"Ip or alias already in use\")\n\t\t}\n\t}\n\n\t// add vip to host\n\tout, err := exec.Command(\"ip\", \"addr\", \"add\", vip.Ip, \"dev\", vip.Interface, \"label\", vip.Alias).CombinedOutput()\n\tif err != nil {\n\t\t// if portal exited uncleanly and interface is still up, \"change\" addr\n\t\tout2, err2 := exec.Command(\"ip\", \"addr\", \"change\", vip.Ip, \"dev\", vip.Interface, \"label\", vip.Alias).CombinedOutput()\n\t\tif err2 != nil {\n\t\t\treturn fmt.Errorf(\"Failed to add vip '%s' - %s - %s\", vip.Ip, out, out2)\n\t\t}\n\t}\n\n\t// update vip cache\n\tmutex.Lock()\n\tvirtIps = append(virtIps, vip)\n\tmutex.Unlock()\n\tconfig.Log.Trace(\"Vip '%s' added\", vip.Ip)\n\n\t// arp vip to neighbors, takes time goroutine\n\tgo func() {\n\t\tout, err = exec.Command(\"arping\", \"-A\", \"-c\", \"10\", \"-I\", vip.Interface, vip.Ip).CombinedOutput()\n\t\tif err != nil {\n\t\t\t// log rather than return\n\t\t\tconfig.Log.Error(\"Failed to arp vip '%s' - %s\", vip.Ip, out)\n\t\t}\n\t\tconfig.Log.Trace(\"Arped vip - '%s'\", vip.Ip)\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "ca039fcfb8acf86ce05d1283e5fed14d", "score": "0.5121564", "text": "func (r *InstancesService) SetMachineType(project string, zone string, instance string, instancessetmachinetyperequest *InstancesSetMachineTypeRequest) *InstancesSetMachineTypeCall {\n\tc := &InstancesSetMachineTypeCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.project = project\n\tc.zone = zone\n\tc.instance = instance\n\tc.instancessetmachinetyperequest = instancessetmachinetyperequest\n\treturn c\n}", "title": "" }, { "docid": "8bc7733062040c15c5b595482ddf4a55", "score": "0.5096783", "text": "func (vm *Vm) setinstancevariable() {}", "title": "" }, { "docid": "ae1c113a2ff0f7419a5675ca981309a8", "score": "0.50729525", "text": "func configureVM(buildEnv *buildenv.Environment, hconf *dashboard.HostConfig, vmName, hostType string, opts *VMOpts) *cloud.EC2VMConfiguration {\n\treturn &cloud.EC2VMConfiguration{\n\t\tDescription: opts.Description,\n\t\tImageID: hconf.VMImage,\n\t\tName: vmName,\n\t\tSSHKeyID: \"ec2-go-builders\",\n\t\tSecurityGroups: []string{buildEnv.AWSSecurityGroup},\n\t\tTags: make(map[string]string),\n\t\tType: hconf.MachineType(),\n\t\tUserData: vmUserDataSpec(buildEnv, hconf, vmName, hostType, opts),\n\t\tZone: opts.Zone,\n\t}\n}", "title": "" }, { "docid": "76c03246be5f5bf2857e624ed73f45a0", "score": "0.50424874", "text": "func (o *IPAMIPAddressesListParams) WithVirtualMachineID(virtualMachineID *string) *IPAMIPAddressesListParams {\n\to.SetVirtualMachineID(virtualMachineID)\n\treturn o\n}", "title": "" }, { "docid": "76438f740448ddcffb0de43089921d96", "score": "0.50418687", "text": "func (r *InstancesService) SetMachineResources(project string, zone string, instance string, instancessetmachineresourcesrequest *InstancesSetMachineResourcesRequest) *InstancesSetMachineResourcesCall {\n\tc := &InstancesSetMachineResourcesCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.project = project\n\tc.zone = zone\n\tc.instance = instance\n\tc.instancessetmachineresourcesrequest = instancessetmachineresourcesrequest\n\treturn c\n}", "title": "" }, { "docid": "51440649df1acece70a0dc34b638a82c", "score": "0.5032748", "text": "func (o *IPAMIPAddressesReadParams) WithVirtualMachineID(virtualMachineID *string) *IPAMIPAddressesReadParams {\n\to.SetVirtualMachineID(virtualMachineID)\n\treturn o\n}", "title": "" }, { "docid": "0a60cdfdddc6523d1e9c1231c6f233ed", "score": "0.5012404", "text": "func (_class VMClass) SetMemoryDynamicRange(sessionID SessionRef, self VMRef, min int, max int) (_err error) {\n\t_method := \"VM.set_memory_dynamic_range\"\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_minArg, _err := convertIntToXen(fmt.Sprintf(\"%s(%s)\", _method, \"min\"), min)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_maxArg, _err := convertIntToXen(fmt.Sprintf(\"%s(%s)\", _method, \"max\"), max)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _minArg, _maxArg)\n\treturn\n}", "title": "" }, { "docid": "be447c85e6da01b51cd45aec0f364322", "score": "0.49654117", "text": "func (in *VirtualMachine) DeepCopy() *VirtualMachine {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualMachine)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d15559e65a233ee17886be07115cc5bf", "score": "0.4960153", "text": "func SetDevIP(iName string, localAddr net.IP, addr *net.IPNet, debug bool) error {\n sargs := fmt.Sprintf(\"set %s MANUAL %s 0x%s\", iName, localAddr.String(), addr.Mask)\n\treturn commandExec(\"ipconfig\", strings.Split(sargs, \" \"), debug)\n}", "title": "" }, { "docid": "1f81703bbd0e05bc78025aee51db4fdf", "score": "0.49569762", "text": "func (mr *MockMNEDCServerMockRecorder) SetVirtualIP(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetVirtualIP\", reflect.TypeOf((*MockMNEDCServer)(nil).SetVirtualIP), arg0)\n}", "title": "" }, { "docid": "79f65f9ce5e8e58d5cb3abd7e7c4320c", "score": "0.49522588", "text": "func (m *MockMNEDCServer) SetVirtualIP(arg0 string) string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetVirtualIP\", arg0)\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "396c7b47188726a112ead51376b33186", "score": "0.49425182", "text": "func (v *Virt) VirtualizationAttach(ctx context.Context, ID string, stream, openStdin bool) (stdout, stderr io.ReadCloser, stdin io.WriteCloser, err error) {\n\tflags := virttypes.AttachGuestFlags{Safe: true, Force: true}\n\tattachGuest, err := v.client.AttachGuest(ctx, ID, []string{}, flags)\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\treturn ioutil.NopCloser(attachGuest), nil, attachGuest, nil\n}", "title": "" }, { "docid": "e11fd9e14796c5014df15f41cdb3efd9", "score": "0.49259114", "text": "func (_class VMClass) SetPVRamdisk(sessionID SessionRef, self VMRef, value string) (_err error) {\n\t_method := \"VM.set_PV_ramdisk\"\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 := convertStringToXen(fmt.Sprintf(\"%s(%s)\", _method, \"value\"), value)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg)\n\treturn\n}", "title": "" }, { "docid": "236078fca49fea315badf8edee304b2e", "score": "0.4920885", "text": "func (v *Virtual) SetVirtualAddress(bindAddr string, port int32) {\n\tv.Destination = \"\"\n\tif bindAddr == \"\" && port == 0 {\n\t\tv.VirtualAddress = nil\n\t} else {\n\t\tv.VirtualAddress = &virtualAddress{\n\t\t\tBindAddr: bindAddr,\n\t\t\tPort: port,\n\t\t}\n\t\t// Validate the IP address, and create the destination\n\t\tip, rd := split_ip_with_route_domain(bindAddr)\n\t\tif len(rd) > 0 {\n\t\t\trd = \"%\" + rd\n\t\t}\n\t\taddr := net.ParseIP(ip)\n\t\tif nil != addr {\n\t\t\tvar format string\n\t\t\tif nil != addr.To4() {\n\t\t\t\tformat = \"/%s/%s%s:%d\"\n\t\t\t} else {\n\t\t\t\tformat = \"/%s/%s%s.%d\"\n\t\t\t}\n\t\t\tv.Destination = fmt.Sprintf(format, v.Partition, ip, rd, port)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a4eb7c04e53b80eb943d6df6f0b15136", "score": "0.48999992", "text": "func (client *Client) AttachVM(containerID string, options *AttachVMOptions) (*AttachVMReturn, error) {\n\tpayload := api.AttachVM{\n\t\tContainerID: containerID,\n\t}\n\n\tif options != nil {\n\t\tpayload.NumIOStreams = options.NumIOStreams\n\t}\n\n\tresp, err := client.sendCommand(api.CmdAttachVM, &payload)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := errorFromResponse(resp); err != nil {\n\t\treturn nil, err\n\t}\n\n\tdecoded := AttachVMReturn{}\n\terr = unmarshalResponse(resp, &decoded)\n\treturn &decoded, err\n}", "title": "" }, { "docid": "06f2d6c8c5ce7171dd8bb7a83e7a903d", "score": "0.48876294", "text": "func (_class VMClass) SetMemoryStaticRange(sessionID SessionRef, self VMRef, min int, max int) (_err error) {\n\t_method := \"VM.set_memory_static_range\"\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_minArg, _err := convertIntToXen(fmt.Sprintf(\"%s(%s)\", _method, \"min\"), min)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_maxArg, _err := convertIntToXen(fmt.Sprintf(\"%s(%s)\", _method, \"max\"), max)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _minArg, _maxArg)\n\treturn\n}", "title": "" }, { "docid": "0a975ff61318acec24503dea9ca128ae", "score": "0.48752302", "text": "func NewVirtualMachine() VirtualMachine {\n\tvm := new(virtualMachine)\n\tvm.values = make([]interface{}, 0)\n\tvm.frames = make([]ExecutionFrame, 0)\n\t// Construct an artificial code object to which all closures \"return\" when\n\t// they are finished, so the Run() will terminate appropriately.\n\tvm.empty = emptyCodeObject(\"closure\")\n\treturn vm\n}", "title": "" }, { "docid": "181b5fca5f68bf147e3e81a06f80ea96", "score": "0.48690784", "text": "func (d DevfileObj) SetMemory(memory string) error {\n\tcomponents, err := d.Data.GetComponents(common.DevfileOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, component := range components {\n\t\tif component.Container != nil {\n\t\t\tcomponent.Container.MemoryLimit = memory\n\t\t\t_ = d.Data.UpdateComponent(component)\n\t\t}\n\t}\n\treturn d.WriteYamlDevfile()\n}", "title": "" }, { "docid": "0e62ced93df2bcd67c5d7633d6cbdfcd", "score": "0.48689753", "text": "func (_class VMClass) SetHVMBootParams(sessionID SessionRef, self VMRef, value map[string]string) (_err error) {\n\t_method := \"VM.set_HVM_boot_params\"\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 := convertStringToStringMapToXen(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": "e2e98d7524f1379cd8d9b56e9551c4ee", "score": "0.48658687", "text": "func getIpFromVmMo(vmMo *mo.VirtualMachine) []net.IP {\n\t// Lazy initialized when there is an IP address later.\n\tips := make([]net.IP, 0)\n\tif vmMo.Guest == nil {\n\t\treturn ips\n\t}\n\tfor _, nic := range vmMo.Guest.Net {\n\t\tfor _, ip := range nic.IpAddress {\n\t\t\tnetIP := net.ParseIP(ip)\n\t\t\tif netIP == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tips = append(ips, netIP)\n\t\t}\n\t}\n\tif len(ips) == 0 && vmMo.Guest.IpAddress != \"\" {\n\t\tip := net.ParseIP(vmMo.Guest.IpAddress)\n\t\tif ip != nil {\n\t\t\tips = append(ips, ip)\n\t\t}\n\t}\n\treturn ips\n}", "title": "" }, { "docid": "b32e388613f045fbde29b29b85a07fb7", "score": "0.48649195", "text": "func (_class VMClass) SetPVKernel(sessionID SessionRef, self VMRef, value string) (_err error) {\n\t_method := \"VM.set_PV_kernel\"\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 := convertStringToXen(fmt.Sprintf(\"%s(%s)\", _method, \"value\"), value)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg)\n\treturn\n}", "title": "" }, { "docid": "46e366fea5a3328fa608407a194493ef", "score": "0.48395595", "text": "func (p *Manager) prepVirtualMachine(\n\tctx context.Context,\n\tcloudImage string,\n\timageInfo FListInfo,\n\tmachine *pkg.VM,\n\tconfig *zos.ZMachine,\n\tdeployment *gridtypes.Deployment,\n\twl *gridtypes.WorkloadWithID,\n) error {\n\n\tvar storage = stubs.NewStorageModuleStub(p.zbus)\n\t// if a VM the vm has to have at least one mount\n\tif len(config.Mounts) == 0 {\n\t\treturn fmt.Errorf(\"at least one mount has to be attached for Vm mode\")\n\t}\n\n\tmachine.KernelImage = filepath.Join(cloudImage, \"hypervisor-fw\")\n\tdisk, err := deployment.Get(config.Mounts[0].Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif disk.Type != zos.ZMountType {\n\t\treturn fmt.Errorf(\"mount is not a valid disk workload\")\n\t}\n\n\tif disk.Result.State != gridtypes.StateOk {\n\t\treturn fmt.Errorf(\"boot disk was not deployed correctly\")\n\t}\n\n\tinfo, err := storage.DiskLookup(ctx, disk.ID.String())\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"disk does not exist\")\n\t}\n\n\t//TODO: DiskWrite will not override the disk if it already has a partition table\n\t// or a filesystem. this means that if later the disk is assigned to a new VM with\n\t// a different flist it will have the same old operating system copied from previous\n\t// setup.\n\tif err = storage.DiskWrite(ctx, disk.ID.String(), imageInfo.ImagePath); err != nil {\n\t\treturn errors.Wrap(err, \"failed to write image to disk\")\n\t}\n\n\tmachine.Boot = pkg.Boot{\n\t\tType: pkg.BootDisk,\n\t\tPath: info.Path,\n\t}\n\n\treturn p.vmMounts(ctx, deployment, config.Mounts[1:], false, machine)\n}", "title": "" }, { "docid": "6ab8f23766f6831c97715d3b35721f79", "score": "0.4839022", "text": "func (ag *NMD) SetVeniceIPs(veniceIPs []string) {\n\n}", "title": "" }, { "docid": "7a36db42c23399e17149f99dc5034440", "score": "0.4824425", "text": "func ReplaceVMFromVMgroup(ip, name, vmName string) (string, error) {\n\tlog.Printf(\"Replacing VM [%s] from a vmgroup [%s] on esx [%s] \\n\", vmName, name, ip)\n\treturn ssh.InvokeCommand(ip, admincli.ReplaceVMFromVMgroup+name+admincli.VMlist+vmName)\n}", "title": "" }, { "docid": "dc6c43fd377dd7a2efb414a99eb701b0", "score": "0.48032427", "text": "func (_class VMClass) SetTags(sessionID SessionRef, self VMRef, value []string) (_err error) {\n\t_method := \"VM.set_tags\"\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 := convertStringSetToXen(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": "403adb915531cceb8f1a712f3871549e", "score": "0.48015827", "text": "func (m *Windows10DeviceFirmwareConfigurationInterface) SetVirtualizationOfCpuAndIO(value *Enablement)() {\n err := m.GetBackingStore().Set(\"virtualizationOfCpuAndIO\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "31e6702f5a92cf7f64e5ebc40d6aa708", "score": "0.47984424", "text": "func NewVM(host, key, hash string) *VirtualMachine {\n\treturn &VirtualMachine{\n\t\thost: host + \"/api/client/command.php\",\n\t\tkey: key,\n\t\thash: hash,\n\t}\n}", "title": "" }, { "docid": "6f04ca79080cb68f9521eb6e0273a44e", "score": "0.47975966", "text": "func (hvvmd HyperVVirtualMachineDetails) AsVmmVirtualMachineDetails() (*VmmVirtualMachineDetails, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e6147cc90eb0ffd5624deafb2b161063", "score": "0.47909245", "text": "func (_class VMClass) SetPlatform(sessionID SessionRef, self VMRef, value map[string]string) (_err error) {\n\t_method := \"VM.set_platform\"\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 := convertStringToStringMapToXen(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": "df83a70616093a616409af2d501cbf4a", "score": "0.47878543", "text": "func (_class VMClass) SetVCPUsParams(sessionID SessionRef, self VMRef, value map[string]string) (_err error) {\n\t_method := \"VM.set_VCPUs_params\"\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 := convertStringToStringMapToXen(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": "9e73711068d32ac74b01f273ae8e417e", "score": "0.4785321", "text": "func Add(s *webhookserver.Server, poolManager *pool_manager.PoolManager) error {\n\tvirtualMachineAnnotator := &virtualMachineAnnotator{poolManager: poolManager}\n\ts.UpdateOpts(webhookserver.WithHook(\"/mutate-virtualmachines\", &webhook.Admission{Handler: virtualMachineAnnotator}))\n\treturn nil\n}", "title": "" }, { "docid": "b5540549c6cc929ce2fe3b2c4e7112eb", "score": "0.47802263", "text": "func (m *IpAddress) SetValue(value *string)() {\n err := m.GetBackingStore().Set(\"value\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "e5d5139a18a737711d0d351ce31ec870", "score": "0.47788653", "text": "func (o *VirtualizationInterfacesListParams) SetVirtualMachinen(virtualMachinen *string) {\n\to.VirtualMachinen = virtualMachinen\n}", "title": "" }, { "docid": "bc94babad4bcb9c05f46770066638535", "score": "0.4768319", "text": "func (sp *ServiceProfile) SetVirtualGemPort(id int) {\r\n\tif id < 1 || id > 32 {\r\n\t\tid = 1\r\n\t}\r\n\tsp.OnuVirtGemPortID = id\r\n}", "title": "" }, { "docid": "40cfdb1102763a5c2128aa30ae5759f8", "score": "0.47678715", "text": "func (a *virtualMachineAnnotator) Handle(ctx context.Context, req admission.Request) admission.Response {\n\tvirtualMachine := &kubevirt.VirtualMachine{}\n\n\terr := a.decoder.Decode(req, virtualMachine)\n\tif err != nil {\n\t\treturn admission.Errored(http.StatusBadRequest, err)\n\t}\n\n\tif virtualMachine.Annotations == nil {\n\t\tvirtualMachine.Annotations = map[string]string{}\n\t}\n\tif virtualMachine.Namespace == \"\" {\n\t\tvirtualMachine.Namespace = req.AdmissionRequest.Namespace\n\t}\n\n\tlog.V(1).Info(\"got a create virtual machine event\", \"virtualMachineName\", virtualMachine.Name, \"virtualMachineNamespace\", virtualMachine.Namespace)\n\tif req.AdmissionRequest.Operation == admissionv1beta1.Create {\n\t\terr = a.mutateCreateVirtualMachinesFn(ctx, virtualMachine)\n\t\tif err != nil {\n\t\t\treturn admission.Errored(http.StatusInternalServerError,\n\t\t\t\tfmt.Errorf(\"Failed to create virtual machine allocation error: %v\", err))\n\t\t}\n\t} else if req.AdmissionRequest.Operation == admissionv1beta1.Update {\n\t\terr = a.mutateUpdateVirtualMachinesFn(ctx, virtualMachine)\n\t\tif err != nil {\n\t\t\treturn admission.Errored(http.StatusInternalServerError,\n\t\t\t\tfmt.Errorf(\"Failed to update virtual machine allocation error: %v\", err))\n\t\t}\n\t}\n\n\tmarshaledVirtualMachine, _ := json.Marshal(virtualMachine)\n\tif err != nil {\n\t\treturn admission.Errored(http.StatusInternalServerError, err)\n\t}\n\n\t// admission.PatchResponse generates a Response containing patches.\n\treturn admission.PatchResponseFromRaw(req.Object.Raw, marshaledVirtualMachine)\n}", "title": "" }, { "docid": "ce89c20a5dd05b71bef87c4c9123384c", "score": "0.47571287", "text": "func (o *Workloadv1Instance) SetVirtualMachines(v map[string]V1VirtualMachineSpec) {\n\to.VirtualMachines = &v\n}", "title": "" }, { "docid": "1f23c4bfd3b65c8f74886428b7f6218f", "score": "0.4749325", "text": "func (_class VMClass) SetMemoryDynamicMin(sessionID SessionRef, self VMRef, value int) (_err error) {\n\t_method := \"VM.set_memory_dynamic_min\"\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": "71a9b3513354befccedc76543448138c", "score": "0.4739896", "text": "func (o *VirtualizationInterfacesReadParams) WithVirtualMachineID(virtualMachineID *string) *VirtualizationInterfacesReadParams {\n\to.SetVirtualMachineID(virtualMachineID)\n\treturn o\n}", "title": "" }, { "docid": "5cb19a94bcf5f12f1d42fc9e9228fbf5", "score": "0.47237554", "text": "func (r *Registry) SetMachineAddrs(machine *machine.Machine, addrs []machine.IPAddress, ttl time.Duration) {\n\t//TODO: Handle the error generated by marshal\n\tjson, _ := marshal(addrs)\n\tkey := path.Join(keyPrefix, machinePrefix, machine.BootId, \"addrs\")\n\tr.etcd.Set(key, json, uint64(ttl.Seconds()))\n}", "title": "" }, { "docid": "e15f19207d24245f140e417a983a4829", "score": "0.4723523", "text": "func (c *Client) UpdateVM(i string, n string, d string, p int, m int) (*MyVm, error) {\n\tvar buffer bytes.Buffer\n\t// there prepare the body request\n\trequest, err := json.Marshal(map[string]int{\n\t\t\"processors\": p,\n\t\t\"memory\": m,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbuffer.Write(request)\n\tlog.Printf(\"[WSAPICLI] Fi: wsapivm.go Fu: UpdateVM Obj: Request Body %#v\\n\", buffer.String())\n\t_, err = c.httpRequest(\"vms/\"+i, \"PUT\", buffer)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvm, err := GetVM(c, i)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlog.Printf(\"[WSAPICLI] Fi: wsapivm.go Fu: UpdateVM Obj: VM before %#v\\n\", vm)\n\terr = SetNameDescription(vm.Path, n, d)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvm, err = GetVM(c, i)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlog.Printf(\"[WSAPICLI] Fi: wsapivm.go Fu: UpdateVM Obj: VM after %#v\\n\", vm)\n\treturn vm, err\n}", "title": "" }, { "docid": "e53c972f9f5294f7ff8113deeba6f66d", "score": "0.47219542", "text": "func (o *VirtualizationVmwareKernelNetworkAllOf) SetIpAddress(v []string) {\n\to.IpAddress = v\n}", "title": "" }, { "docid": "b706a9380a78d70f54267d07c5583197", "score": "0.47216076", "text": "func (vmvmd VMwareVirtualMachineDetails) AsVmmVirtualMachineDetails() (*VmmVirtualMachineDetails, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "a0d2e61b55900b4cd3aaa4e4fa7fcce9", "score": "0.47189832", "text": "func (_class VMClass) SetMemoryDynamicMax(sessionID SessionRef, self VMRef, value int) (_err error) {\n\t_method := \"VM.set_memory_dynamic_max\"\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": "9b6e992e191830b49ce04bd28f4af896", "score": "0.4712589", "text": "func (a *InstancesApiService) VirtualMachines(ctx _context.Context) ApiVirtualMachinesRequest {\n\treturn ApiVirtualMachinesRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "c0001225fe7dbda970c76f7a1144a1e5", "score": "0.4691494", "text": "func (o *HyperflexHypervisorVirtualMachineAllOf) SetIp(v NetworkHyperFlexNetworkAddress) {\n\to.Ip.Set(&v)\n}", "title": "" }, { "docid": "6bd2f363f4eede3ff6b5f5681119906c", "score": "0.46647716", "text": "func (m *OnlineMeeting) SetVirtualAppointment(value VirtualAppointmentable)() {\n err := m.GetBackingStore().Set(\"virtualAppointment\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "699bf88caabc5163d4e4e0ad46325b00", "score": "0.46596104", "text": "func (vm *Vm) setspecial() {}", "title": "" }, { "docid": "89f231af945d4bcdd5d1e38b1a503ca8", "score": "0.46547416", "text": "func (vm *Vm) setlocal() {}", "title": "" }, { "docid": "83ad7ef7b2faff7f33369754377bdeac", "score": "0.46516818", "text": "func TestVM(t *testing.T) {\n\to := &vmtest.Options{\n\t\tQEMUOpts: qemu.Options{\n\t\t\tDevices: []qemu.Device{\n\t\t\t\t// CONFIG_ATA_PIIX is required for this option to work.\n\t\t\t\tqemu.ArbitraryArgs{\"-hda\", \"testdata/mbrdisk\"},\n\t\t\t\tqemu.ArbitraryArgs{\"-hdb\", \"../testdata/12Kzeros\"},\n\t\t\t\tqemu.ArbitraryArgs{\"-hdc\", \"../testdata/gptdisk\"},\n\t\t\t\tqemu.ArbitraryArgs{\"-hdd\", \"testdata/gptdisk_label\"},\n\t\t\t\tqemu.ArbitraryArgs{\"-drive\", \"file=../testdata/gptdisk2,if=none,id=NVME1\"},\n\t\t\t\t// use-intel-id uses the vendor=0x8086 and device=0x5845 ids for NVME\n\t\t\t\tqemu.ArbitraryArgs{\"-device\", \"nvme,drive=NVME1,serial=nvme-1,use-intel-id\"},\n\n\t\t\t\t// With NVMe devices enabled, kernel crashes when not using q35 machine model.\n\t\t\t\tqemu.ArbitraryArgs{\"-machine\", \"q35\"},\n\t\t\t},\n\t\t},\n\t}\n\tvmtest.GolangTest(t, []string{\"github.com/u-root/u-root/pkg/mount/block\"}, o)\n}", "title": "" }, { "docid": "8dceb521cd1d71daa138dddf2d09032d", "score": "0.4651233", "text": "func (a *virtualMachineAnnotator) Handle(ctx context.Context, req admission.Request) admission.Response {\n\tvirtualMachine := &kubevirt.VirtualMachine{}\n\n\terr := a.decoder.Decode(req, virtualMachine)\n\tif err != nil {\n\t\treturn admission.Errored(http.StatusBadRequest, err)\n\t}\n\toriginalVirtualMachine := virtualMachine.DeepCopy()\n\n\thandleRequestId := rand.Intn(100000)\n\tlogger := log.WithName(\"Handle\").WithValues(\"RequestId\", handleRequestId, \"virtualMachineFullName\", pool_manager.VmNamespaced(virtualMachine))\n\n\tif virtualMachine.Annotations == nil {\n\t\tvirtualMachine.Annotations = map[string]string{}\n\t}\n\tif virtualMachine.Namespace == \"\" {\n\t\tvirtualMachine.Namespace = req.AdmissionRequest.Namespace\n\t}\n\n\tlogger.V(1).Info(\"got a virtual machine event\")\n\n\tisNotDryRun := (req.DryRun == nil || *req.DryRun == false)\n\tif req.AdmissionRequest.Operation == admissionv1.Create {\n\t\terr = a.mutateCreateVirtualMachinesFn(virtualMachine, isNotDryRun, logger)\n\t\tif err != nil {\n\t\t\treturn admission.Errored(http.StatusInternalServerError,\n\t\t\t\tfmt.Errorf(\"Failed to create virtual machine allocation error: %v\", err))\n\t\t}\n\t} else if req.AdmissionRequest.Operation == admissionv1.Update {\n\t\terr = a.mutateUpdateVirtualMachinesFn(virtualMachine, isNotDryRun, logger)\n\t\tif err != nil {\n\t\t\treturn admission.Errored(http.StatusInternalServerError,\n\t\t\t\tfmt.Errorf(\"Failed to update virtual machine allocation error: %v\", err))\n\t\t}\n\t}\n\n\t// admission.PatchResponse generates a Response containing patches.\n\treturn patchVMChanges(originalVirtualMachine, virtualMachine, logger)\n}", "title": "" }, { "docid": "964f8eb334127d1a5f91f4580889db97", "score": "0.46371868", "text": "func setHostIPOnPodSpec(podSpec *v1.PodSpec) {\n\tenvVar := v1.EnvVar{\n\t\tName: \"HOST_IP\",\n\t\tValueFrom: &v1.EnvVarSource{\n\t\t\tFieldRef: &v1.ObjectFieldSelector{\n\t\t\t\tFieldPath: \"status.hostIP\",\n\t\t\t},\n\t\t},\n\t}\n\n\tpodSpec.Containers[0].Env = append(podSpec.Containers[0].Env, envVar)\n\n\tfor i := range podSpec.Containers[0].Command {\n\t\tif strings.Contains(podSpec.Containers[0].Command[i], \"advertise-address\") {\n\t\t\tpodSpec.Containers[0].Command[i] = \"--advertise-address=$(HOST_IP)\"\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a45717ddeedae3bb897adc3cc48660b5", "score": "0.46186933", "text": "func (k *Kex) SetIPAddress(r *http.Request) {\n\tk.SetIPAddressString(r.RemoteAddr)\n}", "title": "" }, { "docid": "e8cf29461a310c6b9910e07c6f34a5ac", "score": "0.46177018", "text": "func (manager *GceManager) SetMachineType(projectId, zone, vmName, machineType string) (*compute.Operation, error) {\n\tlog.Debugf(\"SetMachineType: project[%s], zone[%s], vmName[%s], type[%s]\",\n\t\tprojectId, zone, vmName, machineType)\n\n\tinstanceService := compute.NewInstancesService(manager.Service)\n\tmachineTypeUri := fmt.Sprintf(\"zones/%s/machineTypes/%s\", zone, machineType)\n\trequest := compute.InstancesSetMachineTypeRequest{MachineType: machineTypeUri}\n\n\treturn instanceService.SetMachineType(projectId, zone, vmName, &request).Do()\n}", "title": "" }, { "docid": "66d0960784493f4ed444f8e8a4602641", "score": "0.4616073", "text": "func (o AzureIaaSComputeVMProtectedItemOutput) VirtualMachineId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AzureIaaSComputeVMProtectedItem) *string { return v.VirtualMachineId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "08ab0f6ed96f0f1eea6716aff8000842", "score": "0.46073744", "text": "func (o AzureIaaSVMProtectedItemOutput) VirtualMachineId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AzureIaaSVMProtectedItem) *string { return v.VirtualMachineId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "0d4a7d7061e1e25c896e16618e7eccd7", "score": "0.4596895", "text": "func (router *Router) setIP(ip string){\n router.IP = ip\n}", "title": "" }, { "docid": "be8dfde010e293c2468548f9f952368f", "score": "0.4593444", "text": "func (o VMwareCbtEnableMigrationInputPtrOutput) VmwareMachineId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *VMwareCbtEnableMigrationInput) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.VmwareMachineId\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "cade689890e5f3a521b5117fe5322408", "score": "0.45907632", "text": "func (o *VirtualizationInterfacesListParams) SetVirtualMachineIDn(virtualMachineIDn *string) {\n\to.VirtualMachineIDn = virtualMachineIDn\n}", "title": "" }, { "docid": "3a137a632071e2c5c59eaa22acf7c57f", "score": "0.45906413", "text": "func (o AzureIaaSVMProtectedItemResponseOutput) VirtualMachineId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AzureIaaSVMProtectedItemResponse) *string { return v.VirtualMachineId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "28e086952d1a3135b6f5e707b7c0a00c", "score": "0.45793724", "text": "func (self ip) SetVips(vips []core.Vip) error {\n\toldVips := virtIps\n\t// remove old vips from system and cache (upon success)\n\tfor i := range oldVips {\n\t\terr := self.DeleteVip(oldVips[i])\n\t\tif err != nil {\n\t\t\t// try rolling back\n\t\t\tconfig.Log.Trace(\"Trying to roll back for old vip - %s...\", err)\n\t\t\terr2 := self.SetVip(oldVips[i])\n\t\t\treturn fmt.Errorf(\"Failed to remove old vip - %s %s\", err, err2)\n\t\t}\n\t\tconfig.Log.Trace(\"Removed old vip '%s'\", oldVips[i].Ip)\n\t}\n\n\tfor i := range vips {\n\t\terr := self.SetVip(vips[i])\n\t\tif err != nil {\n\t\t\t// rather than attempting to roll back, avoid loop issues and just return the error\n\t\t\treturn fmt.Errorf(\"Failed to add new vip - %s\", err)\n\t\t}\n\t\tconfig.Log.Trace(\"Added new vip '%s'\", vips[i].Ip)\n\t}\n\n\tmutex.Lock()\n\tvirtIps = vips\n\tmutex.Unlock()\n\tconfig.Log.Trace(\"Vips updated\")\n\treturn nil\n}", "title": "" }, { "docid": "d3c26321f41f5f3cc8713bfbe4ad9e97", "score": "0.45617232", "text": "func (o VMwareCbtMigrationDetailsResponsePtrOutput) VmwareMachineId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *VMwareCbtMigrationDetailsResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.VmwareMachineId\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8942ad623e82b9d03e46c15094a32faa", "score": "0.4553027", "text": "func (o AzureIaaSClassicComputeVMProtectedItemOutput) VirtualMachineId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AzureIaaSClassicComputeVMProtectedItem) *string { return v.VirtualMachineId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "fe572f05b268f830fc0a992d0665c146", "score": "0.45524442", "text": "func (a *MachinePool) Set(required *MachinePool) {\n\tif required == nil || a == nil {\n\t\treturn\n\t}\n\n\tif required.InstanceType != \"\" {\n\t\ta.InstanceType = required.InstanceType\n\t}\n\n\tif len(required.Zones) > 0 {\n\t\ta.Zones = required.Zones\n\t}\n\n\tif required.BootVolume != nil {\n\t\tif a.BootVolume == nil {\n\t\t\ta.BootVolume = &BootVolume{}\n\t\t}\n\t\tif required.BootVolume.EncryptionKey != \"\" {\n\t\t\ta.BootVolume.EncryptionKey = required.BootVolume.EncryptionKey\n\t\t}\n\t}\n\n\tif len(required.DedicatedHosts) > 0 {\n\t\ta.DedicatedHosts = required.DedicatedHosts\n\t}\n}", "title": "" }, { "docid": "03ff21c857f3ad146f6b9e8c285a2879", "score": "0.4551178", "text": "func (o AzureIaaSComputeVMProtectedItemResponseOutput) VirtualMachineId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AzureIaaSComputeVMProtectedItemResponse) *string { return v.VirtualMachineId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b99cb09cd9768fbc43676a18c7169540", "score": "0.45484918", "text": "func (o *VirtualizationInterfacesListParams) WithVirtualMachinen(virtualMachinen *string) *VirtualizationInterfacesListParams {\n\to.SetVirtualMachinen(virtualMachinen)\n\treturn o\n}", "title": "" }, { "docid": "2b3a53b273bee32c352319e7265641fb", "score": "0.45477453", "text": "func (vmMgr *VMManager) RegisterVM(module string, vm VirtualMachine) error {\n\tvmMgr.lock.Lock()\n\tdefer vmMgr.lock.Unlock()\n\tvmMgr.vms[module] = vm\n\treturn nil\n}", "title": "" }, { "docid": "b3637f233c0bb74ce42bdc9696054129", "score": "0.45441514", "text": "func (c CloudstackClient) DeployVirtualMachine(serviceofferingid string, templateid string, zoneid string, account string, diskofferingid string, displayname string, networkids []string, keypair string, projectid string, userdata string, hypervisor string) (DeployVirtualMachineResponse, error) {\n\tvar resp DeployVirtualMachineResponse\n\n\tparams := url.Values{}\n\tparams.Set(\"serviceofferingid\", serviceofferingid)\n\tparams.Set(\"templateid\", templateid)\n\tparams.Set(\"zoneid\", zoneid)\n\t//\tparams.Set(\"account\", account)\n\tif diskofferingid != \"\" {\n\t\tparams.Set(\"diskofferingid\", diskofferingid)\n\t}\n\tparams.Set(\"displayname\", displayname)\n\tparams.Set(\"hypervisor\", hypervisor)\n\tif len(networkids) > 0 {\n\t\tparams.Set(\"networkids\", strings.Join(networkids, \",\"))\n\t}\n\tparams.Set(\"keypair\", keypair)\n\t//\tparams.Set(\"projectid\", projectid)\n\tif userdata != \"\" {\n\t\tparams.Set(\"userdata\", base64.StdEncoding.EncodeToString([]byte(userdata)))\n\t}\n\tresponse, err := NewRequest(c, \"deployVirtualMachine\", params)\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\tresp = response.(DeployVirtualMachineResponse)\n\treturn resp, nil\n}", "title": "" }, { "docid": "5830ebc74d3ccfec536e9b08995448f6", "score": "0.4543623", "text": "func (g *GCloud) SetMetadata(vm *Instance, md map[string]string) error {\n\titems := make([]*compute.MetadataItems, 0, len(md))\n\tfor k, v := range md {\n\t\tv := v\n\t\titems = append(items, &compute.MetadataItems{\n\t\t\tKey: k,\n\t\t\tValue: &v,\n\t\t})\n\t}\n\t// Retrieve the existing instance metadata fingerprint, which is\n\t// required in order to update the metadata.\n\tinst, err := g.service.Instances.Get(g.project, g.zone, vm.Name).Do()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to retrieve instance before setting metadata: %s\", err)\n\t}\n\tm := &compute.Metadata{\n\t\tItems: items,\n\t}\n\tif inst.Metadata != nil {\n\t\tm.Fingerprint = inst.Metadata.Fingerprint\n\t}\n\t// Set the metadata.\n\terr = g.CheckOperation(g.service.Instances.SetMetadata(g.project, g.zone, vm.Name, m).Do())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to set instance metadata: %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7b59a3ccc561cda49b53c04db2f95f65", "score": "0.45345885", "text": "func (o *PolicyBackupItems) SetVirtualMachineIds(v []string) {\n\to.VirtualMachineIds = &v\n}", "title": "" }, { "docid": "44e681c1267dcaa36225c02cfb3f52ae", "score": "0.4531698", "text": "func (m *KubernetesServiceEvidence) SetClusterIP(value IpEvidenceable)() {\n err := m.GetBackingStore().Set(\"clusterIP\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "042ad732bc059e9144f13ae46a2a062c", "score": "0.45305705", "text": "func (_class VMClass) SetPVLegacyArgs(sessionID SessionRef, self VMRef, value string) (_err error) {\n\t_method := \"VM.set_PV_legacy_args\"\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 := convertStringToXen(fmt.Sprintf(\"%s(%s)\", _method, \"value\"), value)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg)\n\treturn\n}", "title": "" }, { "docid": "9e500e633a9a002b96a35568c340e1da", "score": "0.45252368", "text": "func WithVMLocalUser(user string) oci.SpecOpts {\n\treturn func(ctx context.Context, client oci.Client, container *containers.Container, spec *oci.Spec) error {\n\t\t// This is technically an LCOW specific field, but we piggy back\n\t\t// to get the string user into the VM where will will do the uid/gid mapping\n\t\tspec.Process.User.Username = user\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "90bff70353a12e90fe056088409ac2f0", "score": "0.4521751", "text": "func NewVirtualMachine(ctx *pulumi.Context,\n\tname string, args *VirtualMachineArgs, opts ...pulumi.ResourceOption) (*VirtualMachine, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.VirtualMachineId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'VirtualMachineId'\")\n\t}\n\tif args.SqlConnectivityUpdatePassword != nil {\n\t\targs.SqlConnectivityUpdatePassword = pulumi.ToSecret(args.SqlConnectivityUpdatePassword).(pulumi.StringPtrInput)\n\t}\n\tif args.SqlConnectivityUpdateUsername != nil {\n\t\targs.SqlConnectivityUpdateUsername = pulumi.ToSecret(args.SqlConnectivityUpdateUsername).(pulumi.StringPtrInput)\n\t}\n\tsecrets := pulumi.AdditionalSecretOutputs([]string{\n\t\t\"sqlConnectivityUpdatePassword\",\n\t\t\"sqlConnectivityUpdateUsername\",\n\t})\n\topts = append(opts, secrets)\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource VirtualMachine\n\terr := ctx.RegisterResource(\"azure:mssql/virtualMachine:VirtualMachine\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "adf054c3a0e14a30e29b58a0ef6ad9a3", "score": "0.45112783", "text": "func (a *InstancesApiService) VirtualMachineById(ctx _context.Context, virtualMachineId string) ApiVirtualMachineByIdRequest {\n\treturn ApiVirtualMachineByIdRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tvirtualMachineId: virtualMachineId,\n\t}\n}", "title": "" }, { "docid": "fc684b3f4dbcc56fa47e2290664f44e4", "score": "0.45083898", "text": "func (_class VMClass) SetSuspendVDI(sessionID SessionRef, self VMRef, value VDIRef) (_err error) {\n\t_method := \"VM.set_suspend_VDI\"\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 := convertVDIRefToXen(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": "eae8619d01c4822d78ceca0064478e11", "score": "0.450099", "text": "func (v *VmmVirtualMachineDetails) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"diskDetails\":\n\t\t\terr = unpopulate(val, \"DiskDetails\", &v.DiskDetails)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"generation\":\n\t\t\terr = unpopulate(val, \"Generation\", &v.Generation)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"hasFibreChannelAdapter\":\n\t\t\terr = unpopulate(val, \"HasFibreChannelAdapter\", &v.HasFibreChannelAdapter)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"hasPhysicalDisk\":\n\t\t\terr = unpopulate(val, \"HasPhysicalDisk\", &v.HasPhysicalDisk)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"hasSharedVhd\":\n\t\t\terr = unpopulate(val, \"HasSharedVhd\", &v.HasSharedVhd)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"hyperVHostId\":\n\t\t\terr = unpopulate(val, \"HyperVHostID\", &v.HyperVHostID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"instanceType\":\n\t\t\terr = unpopulate(val, \"InstanceType\", &v.InstanceType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"osDetails\":\n\t\t\terr = unpopulate(val, \"OSDetails\", &v.OSDetails)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sourceItemId\":\n\t\t\terr = unpopulate(val, \"SourceItemID\", &v.SourceItemID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "12c7fd7f5413d139650f4c2557d39ae9", "score": "0.44955495", "text": "func (cs ConfigurationSettings) AsVmmVirtualMachineDetails() (*VmmVirtualMachineDetails, bool) {\n\treturn nil, false\n}", "title": "" } ]
ee325c7e176711d877ff71bb4ec1535a
CreatedAtLTE applies the LTE predicate on the "created_at" field.
[ { "docid": "4a4f3527ea393a9ac577bcf37937ab26", "score": "0.77731514", "text": "func CreatedAtLTE(v time.Time) predicate.Item {\n\treturn predicate.Item(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" } ]
[ { "docid": "c3c0785dcecd3283aface1d3ff5ddc0a", "score": "0.8087228", "text": "func CreatedAtLTE(v time.Time) predicate.Screenshot {\n\treturn predicate.Screenshot(sql.FieldLTE(FieldCreatedAt, v))\n}", "title": "" }, { "docid": "45e35939aa2800036583a4630747aa91", "score": "0.8075113", "text": "func CreatedAtLTE(v time.Time) predicate.Tag {\n\treturn predicate.Tag(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "7fd05e21b3b155bae4b83bd424b69205", "score": "0.80216295", "text": "func CreatedAtLTE(v time.Time) predicate.Task {\n\treturn predicate.Task(sql.FieldLTE(FieldCreatedAt, v))\n}", "title": "" }, { "docid": "b94c5ad2bf878ac8d02e75c98aec48f6", "score": "0.79713994", "text": "func CreatedAtLTE(v time.Time) predicate.SysLogging {\n\treturn predicate.SysLogging(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "5a1ae656f5663cdc20767e1b0fb26bf1", "score": "0.7954285", "text": "func CreatedAtLTE(v time.Time) predicate.Profile {\n\treturn predicate.Profile(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "2d48ac4b9a0d2bf273615a653063d797", "score": "0.7845629", "text": "func CreatedAtLTE(v time.Time) predicate.Experience {\n\treturn predicate.Experience(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "311310f6815628f2f0adb9d9a8e2918c", "score": "0.7824704", "text": "func CreatedAtLTE(v time.Time) predicate.Demo {\n\treturn predicate.Demo(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "944e75db0666355348f39cf89630ea05", "score": "0.78101873", "text": "func CreatedAtLTE(v time.Time) predicate.GithubAsset {\n\treturn predicate.GithubAsset(sql.FieldLTE(FieldCreatedAt, v))\n}", "title": "" }, { "docid": "e31a50e632baee99976b682264b4b38b", "score": "0.77245003", "text": "func CreatedAtLTE(v time.Time) predicate.Person {\n\treturn predicate.Person(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "1f43a2eafeee986b5bdc8276475dad67", "score": "0.77203757", "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": "dc5c56c29fc6c3303d6e9e1d0b78408c", "score": "0.74717605", "text": "func CreatedAtLTE(v time.Time) predicate.GoodsSku {\n\treturn predicate.GoodsSku(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "cbd8cbc24af5f77dd8130028ed28cf3a", "score": "0.7119741", "text": "func (qs TaskQuerySet) CreatedAtLte(createdAt time.Time) TaskQuerySet {\n\treturn qs.w(qs.db.Where(\"created_at <= ?\", createdAt))\n}", "title": "" }, { "docid": "d4e9870bb7db2164655b3f4111e41296", "score": "0.70984477", "text": "func (qs ArticleQuerySet) CreatedAtLte(createdAt time.Time) ArticleQuerySet {\n\treturn qs.w(qs.db.Where(\"created_at <= ?\", createdAt))\n}", "title": "" }, { "docid": "404994b1b8b0bc45164a0cb91986fcb5", "score": "0.7087632", "text": "func (qs UserQuerySet) CreatedAtLte(createdAt time.Time) UserQuerySet {\n\treturn qs.w(qs.db.Where(\"created_at <= ?\", createdAt))\n}", "title": "" }, { "docid": "9f5fd3e278ec3b13849117eaa3bbe7fc", "score": "0.70689106", "text": "func (qs AccountQuerySet) CreatedAtLte(createdAt time.Time) AccountQuerySet {\n\treturn qs.w(qs.db.Where(\"created_at <= ?\", createdAt))\n}", "title": "" }, { "docid": "a0db763e6d06f43fe2d502555c9b740b", "score": "0.70539093", "text": "func (qs PlanQuerySet) CreatedAtLte(createdAt time.Time) PlanQuerySet {\n\treturn qs.w(qs.db.Where(\"created_at <= ?\", createdAt))\n}", "title": "" }, { "docid": "f1544be53270fb76b1c4dbb84f884fef", "score": "0.6979841", "text": "func CreatedAt(v time.Time) predicate.Tag {\n\treturn predicate.Tag(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "34f8abaa213cf85ad7fa8113f45b67a9", "score": "0.69633895", "text": "func CreateAtLTE(v time.Time) predicate.File {\n\treturn predicate.File(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreateAt), v))\n\t})\n}", "title": "" }, { "docid": "00845f5691ec3b1df9547a4c20b46f07", "score": "0.69520146", "text": "func CreatedAtLT(v time.Time) predicate.Tag {\n\treturn predicate.Tag(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "d409d87fc39957934693f48cade88a00", "score": "0.6920251", "text": "func (qs CurrencyQuerySet) CreatedAtLte(createdAt time.Time) CurrencyQuerySet {\n\treturn qs.w(qs.db.Where(\"created_at <= ?\", createdAt))\n}", "title": "" }, { "docid": "bfa571632737cad236636aa39b63b3be", "score": "0.6911324", "text": "func CreatedAtLT(v time.Time) predicate.Demo {\n\treturn predicate.Demo(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "945698fc105a1c8761404898ad7bcf9a", "score": "0.6904247", "text": "func CreatedAtLT(v time.Time) predicate.Screenshot {\n\treturn predicate.Screenshot(sql.FieldLT(FieldCreatedAt, v))\n}", "title": "" }, { "docid": "79a1b6a34348f9a6e1b20f8ebbbad0cc", "score": "0.6900157", "text": "func CreatedAtLT(v time.Time) predicate.SysLogging {\n\treturn predicate.SysLogging(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "436b4b2e31b90ab003af71d6ff74d7e0", "score": "0.6825091", "text": "func CreatedAtLT(v time.Time) predicate.Task {\n\treturn predicate.Task(sql.FieldLT(FieldCreatedAt, v))\n}", "title": "" }, { "docid": "74f591427420e5706f5a91cf0e02cca3", "score": "0.6820684", "text": "func CreatedAtLT(v time.Time) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "a392213cd09801da3ef516b5fff02f9f", "score": "0.6788224", "text": "func CreatedAtLT(v time.Time) predicate.Profile {\n\treturn predicate.Profile(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "0c198fcad93af783ef686c99187af81e", "score": "0.67074984", "text": "func CreatedAtLT(v time.Time) predicate.Experience {\n\treturn predicate.Experience(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "8c549d943c5e92c6d8875f28dbed743a", "score": "0.6700751", "text": "func CreatedAtLT(v time.Time) predicate.Item {\n\treturn predicate.Item(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "9669f09492be01e392790eba478ba796", "score": "0.66801083", "text": "func CreatedAt(v time.Time) predicate.Demo {\n\treturn predicate.Demo(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "ccf1731858edcc648e7dcd2502837b8e", "score": "0.66759884", "text": "func CreatedAtLT(v time.Time) predicate.Person {\n\treturn predicate.Person(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "6ebf4488d107e53b935e2650bbd52c30", "score": "0.66739875", "text": "func CreatedAtGTE(v time.Time) predicate.Screenshot {\n\treturn predicate.Screenshot(sql.FieldGTE(FieldCreatedAt, v))\n}", "title": "" }, { "docid": "b3799fcc0efb1cb5e8af54dc4f6c0501", "score": "0.6628683", "text": "func CreateAtLT(v time.Time) predicate.File {\n\treturn predicate.File(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreateAt), v))\n\t})\n}", "title": "" }, { "docid": "6d00f0c48941203b56c7d07cd351cf0a", "score": "0.6624686", "text": "func CreatedAtLT(v time.Time) predicate.GithubAsset {\n\treturn predicate.GithubAsset(sql.FieldLT(FieldCreatedAt, v))\n}", "title": "" }, { "docid": "9e9d8fdaae8381c15291ad80bc5d68c1", "score": "0.6602741", "text": "func CreatedAtGTE(v time.Time) predicate.Tag {\n\treturn predicate.Tag(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "a13f18e753557b05685807019976c4a0", "score": "0.65770113", "text": "func CreatedAt(v time.Time) predicate.Experience {\n\treturn predicate.Experience(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "b8bc0bff7579740ffc1f43dc6762123b", "score": "0.65760505", "text": "func CreatedAt(v time.Time) predicate.Task {\n\treturn predicate.Task(sql.FieldEQ(FieldCreatedAt, v))\n}", "title": "" }, { "docid": "2942cfe19bc2d26d3a0d81d6c3272185", "score": "0.65730643", "text": "func CreatedAt(v time.Time) predicate.Item {\n\treturn predicate.Item(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "42bc73236ff68ab5a72319e250614ce7", "score": "0.654924", "text": "func CreatedAt(v time.Time) predicate.SysLogging {\n\treturn predicate.SysLogging(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "2ccf0d91f37a2815ce4e2b3a3f674972", "score": "0.6521306", "text": "func CreatedAt(v time.Time) predicate.Screenshot {\n\treturn predicate.Screenshot(sql.FieldEQ(FieldCreatedAt, v))\n}", "title": "" }, { "docid": "d9cd9a241d808497151d15ec4984c1ba", "score": "0.65050244", "text": "func CreatedAtGTE(v time.Time) predicate.Task {\n\treturn predicate.Task(sql.FieldGTE(FieldCreatedAt, v))\n}", "title": "" }, { "docid": "8faaeab9f891490a768375e418ce5fdb", "score": "0.6462392", "text": "func (qs ArticleQuerySet) CreatedAtLt(createdAt time.Time) ArticleQuerySet {\n\treturn qs.w(qs.db.Where(\"created_at < ?\", createdAt))\n}", "title": "" }, { "docid": "2678287d4f59c15c6da95a1249041586", "score": "0.64413184", "text": "func CreatedAt(v time.Time) predicate.Profile {\n\treturn predicate.Profile(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "8853ad02e144227a1665814aa845aeb5", "score": "0.6434963", "text": "func (qs UserQuerySet) CreatedAtLt(createdAt time.Time) UserQuerySet {\n\treturn qs.w(qs.db.Where(\"created_at < ?\", createdAt))\n}", "title": "" }, { "docid": "3955e5b897f3147793253cbf53d80ab2", "score": "0.64254683", "text": "func CreatedAtGTE(v time.Time) predicate.SysLogging {\n\treturn predicate.SysLogging(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "cf9da203dcbc257ec0c90657d14207de", "score": "0.6401605", "text": "func CreatedAtGTE(v time.Time) predicate.Profile {\n\treturn predicate.Profile(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "f4ea04e713ff782c48074228f4466510", "score": "0.63793135", "text": "func (qs PlanQuerySet) CreatedAtLt(createdAt time.Time) PlanQuerySet {\n\treturn qs.w(qs.db.Where(\"created_at < ?\", createdAt))\n}", "title": "" }, { "docid": "2fd88651ec0d6e9a9ecb211f520328a7", "score": "0.6377077", "text": "func CreatedAtGTE(v time.Time) predicate.Demo {\n\treturn predicate.Demo(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "21176d0c5c115c7211bfd8c5acefc277", "score": "0.6371854", "text": "func CreatedAt(v time.Time) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "de74baed7b4be74059bd76099b458685", "score": "0.63692665", "text": "func CreatedAtGTE(v time.Time) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "2b4e24e783e41b59a7dde431aabc56c7", "score": "0.63671243", "text": "func CreatedWithLTE(v string) predicate.Person {\n\treturn predicate.Person(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreatedWith), v))\n\t})\n}", "title": "" }, { "docid": "5887cf39cf2d3eaee0e8b2f1f16bc51a", "score": "0.6334996", "text": "func (qs TaskQuerySet) CreatedAtLt(createdAt time.Time) TaskQuerySet {\n\treturn qs.w(qs.db.Where(\"created_at < ?\", createdAt))\n}", "title": "" }, { "docid": "3359fb82df9a48183dccaa462314477d", "score": "0.6317329", "text": "func CreatedAtGTE(v time.Time) predicate.Item {\n\treturn predicate.Item(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "bfce9ab0df4f9c67b53041d59cf5e2c1", "score": "0.63073784", "text": "func CreatedAtGTE(v time.Time) predicate.GithubAsset {\n\treturn predicate.GithubAsset(sql.FieldGTE(FieldCreatedAt, v))\n}", "title": "" }, { "docid": "93e28d61723ae563a0787314c9f6f9d8", "score": "0.6284454", "text": "func CreatedAt(v time.Time) predicate.Person {\n\treturn predicate.Person(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "65228d48014372ea582c4a6cc926268d", "score": "0.62637824", "text": "func (qs AccountQuerySet) CreatedAtLt(createdAt time.Time) AccountQuerySet {\n\treturn qs.w(qs.db.Where(\"created_at < ?\", createdAt))\n}", "title": "" }, { "docid": "b81716db7b819a686cc1e87e3f75ee6a", "score": "0.62519264", "text": "func CreatedAtGTE(v time.Time) predicate.Experience {\n\treturn predicate.Experience(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "73a401be21ef674cb851e23064fb0c6a", "score": "0.6235612", "text": "func CreatedAtLT(v time.Time) predicate.GoodsSku {\n\treturn predicate.GoodsSku(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "5801e5751fd2734dc0060b771bc250b2", "score": "0.6178591", "text": "func (qs CurrencyQuerySet) CreatedAtLt(createdAt time.Time) CurrencyQuerySet {\n\treturn qs.w(qs.db.Where(\"created_at < ?\", createdAt))\n}", "title": "" }, { "docid": "413a7bb6b64483756bb5fb6ec21298de", "score": "0.6157318", "text": "func CreatedAtGTE(v time.Time) predicate.Person {\n\treturn predicate.Person(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "4ed2903680b9cd1b22cabc82b13be9c8", "score": "0.60538656", "text": "func CreatedAt(v time.Time) predicate.GithubAsset {\n\treturn predicate.GithubAsset(sql.FieldEQ(FieldCreatedAt, v))\n}", "title": "" }, { "docid": "0b1acdc2c8243eec2571ebbe6dbf2c7b", "score": "0.60459614", "text": "func (d Descriptor) CreatedAt() time.Time { return time.Unix(d.raw.CreatedAt, 0) }", "title": "" }, { "docid": "25dc00529a95ee302ac54fb22f5224c8", "score": "0.6006256", "text": "func CreatedLTE(v time.Time) predicate.Playlist {\n\treturn predicate.Playlist(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreated), v))\n\t})\n}", "title": "" }, { "docid": "d831dd41366c75fe624aa84e2514761b", "score": "0.58730316", "text": "func CreatedByLTE(v int) predicate.Person {\n\treturn predicate.Person(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreatedBy), v))\n\t})\n}", "title": "" }, { "docid": "c33e82950ed24226320f6a538b98e85a", "score": "0.58580065", "text": "func (o *TrialPlThreeYearsResponseTrialPlThreeYears) SetCreatedAt(v string) {\n\to.CreatedAt = &v\n}", "title": "" }, { "docid": "be73284eb13bbe141266542564a8d728", "score": "0.58575046", "text": "func CreatedAtGT(v time.Time) predicate.Tag {\n\treturn predicate.Tag(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "ae8bd274acecd5872795c1f8a3f62ce8", "score": "0.5844871", "text": "func CreateTimeLTE(v time.Time) predicate.Post {\n\treturn predicate.Post(sql.FieldLTE(FieldCreateTime, v))\n}", "title": "" }, { "docid": "9bd2e17cc40af0084c9fb7b06e568682", "score": "0.58426726", "text": "func (m *VacUserMutation) 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": "21dee8ee6c1c6b726a758098ca667b4a", "score": "0.5836439", "text": "func CreatedAtGTE(v time.Time) predicate.GoodsSku {\n\treturn predicate.GoodsSku(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "5d7e746d8790c7c60e3321e3d22685d7", "score": "0.5829092", "text": "func CreateTimeLTE(v time.Time) predicate.DUser {\n\treturn predicate.DUser(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreateTime), v))\n\t})\n}", "title": "" }, { "docid": "d5bce0b6924f0575a3ff35c4a3caa326", "score": "0.5827371", "text": "func (m *FactTypeMutation) 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": "7c88f8142b3d5de685be824e007957a9", "score": "0.5821756", "text": "func PublishedAtLTE(v time.Time) predicate.Post {\n\treturn predicate.Post(sql.FieldLTE(FieldPublishedAt, v))\n}", "title": "" }, { "docid": "0c29ac7edcb5f0ddd1adc1988a585297", "score": "0.5820772", "text": "func (m *TagMutation) 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": "c08484b4bd6ad350a595e8e96c125a03", "score": "0.5820227", "text": "func (m *VacDepartmentMutation) 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": "b953d7b8c4a5866dd801c489d47a723c", "score": "0.58080333", "text": "func (o *ViewTimelog) SetCreatedAt(v string) {\n\to.CreatedAt = &v\n}", "title": "" }, { "docid": "5d5c4eb61b2d63d09f270b41e47be415", "score": "0.58052665", "text": "func CreatedAtEQ(v time.Time) predicate.Tag {\n\treturn predicate.Tag(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "71958c76a855642805badb0fd255b2ea", "score": "0.58034503", "text": "func (v *UpdateLabelUpdateLabelUpdateLabelPayloadLabel) GetCreatedAt() time.Time { return v.CreatedAt }", "title": "" }, { "docid": "a016142eebf309d66fe49feac8bdbc47", "score": "0.57996905", "text": "func CreatedAtGT(v time.Time) predicate.Demo {\n\treturn predicate.Demo(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "2d6e40e0f385f8cf90eb2bf35e4a819f", "score": "0.57922643", "text": "func CreatedAtGT(v time.Time) predicate.Screenshot {\n\treturn predicate.Screenshot(sql.FieldGT(FieldCreatedAt, v))\n}", "title": "" }, { "docid": "8760bf5622250778d9de02cc57b8c160", "score": "0.57904965", "text": "func (o *ResourceQuotaAllOf) SetCreatedAt(v time.Time) {\n\to.CreatedAt = &v\n}", "title": "" }, { "docid": "1086b94080b2d45e521c531331b2a0e0", "score": "0.5787372", "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": "166c4f1eaedde643c18204a2c3aeea34", "score": "0.5784316", "text": "func (v *CreateLabelCreateLabelCreateLabelPayloadLabel) GetCreatedAt() time.Time { return v.CreatedAt }", "title": "" }, { "docid": "db3d36028eb996091dfaea3f5e661947", "score": "0.5782046", "text": "func (m *FactTypeMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldCreatedAt is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldCreatedAt 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 OldCreatedAt: %w\", err)\n\t}\n\treturn oldValue.CreatedAt, nil\n}", "title": "" }, { "docid": "1c051b4c8129415a7bbacfe1ef74f71a", "score": "0.57638055", "text": "func CreateTimeLTE(v time.Time) predicate.Transfer {\n\treturn predicate.Transfer(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreateTime), v))\n\t})\n}", "title": "" }, { "docid": "5fb0298cf97988093d0acf00374dd4d3", "score": "0.57610935", "text": "func (m *TransactionDetailMutation) 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": "8dcaf019846047661f82362d806f185c", "score": "0.5742091", "text": "func CreateTimeLTE(v time.Time) predicate.Recommendations {\n\treturn predicate.Recommendations(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreateTime), v))\n\t})\n}", "title": "" }, { "docid": "c07f018a7f545cd132ec32a956dcd263", "score": "0.5737218", "text": "func (o FirewallOutput) CreatedAt() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Firewall) pulumi.StringOutput { return v.CreatedAt }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "47330be2df498e3b3306841932d241d3", "score": "0.5736948", "text": "func (o *TransactionsCategoryRule) SetCreatedAt(v time.Time) {\n\to.CreatedAt = &v\n}", "title": "" }, { "docid": "ecc8789a27707efd556fbf18079e6c43", "score": "0.5736397", "text": "func CreatedAt(v time.Time) predicate.GoodsSku {\n\treturn predicate.GoodsSku(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "e06564f9b1b5e739443044cdce0bd461", "score": "0.57230914", "text": "func (o ListenerOutput) CreatedAt() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Listener) pulumi.StringOutput { return v.CreatedAt }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "06b88ef09af9fe38bff62316013e3d5c", "score": "0.57221556", "text": "func CreatedAtGT(v time.Time) predicate.Task {\n\treturn predicate.Task(sql.FieldGT(FieldCreatedAt, v))\n}", "title": "" }, { "docid": "6329ce85217c565a34ad0e687ccae815", "score": "0.5721821", "text": "func (l *LatestEntry) SetCreatedAt(t time.Time) {\n\tl.CreatedAt = t\n}", "title": "" }, { "docid": "a5927019dbb52ea310adafb6fe47bc52", "score": "0.571552", "text": "func (m *VacUserMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldCreatedAt is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldCreatedAt 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 OldCreatedAt: %w\", err)\n\t}\n\treturn oldValue.CreatedAt, nil\n}", "title": "" }, { "docid": "72b4ff14ebebf8c8bf38cdc2bd269cdc", "score": "0.5710681", "text": "func (m *APIAuditMutation) 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": "604e7e5f090f45684dcbfbb1aeaa2665", "score": "0.5709994", "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": "19c4727cebf560d2d2d0137752b081aa", "score": "0.57078594", "text": "func (m *FactMutation) 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": "1e19f3e950aaf4e36f6fb694ae8692e8", "score": "0.57049704", "text": "func (m *TenantMutation) OldCreateAt(ctx context.Context) (v time.Time, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldCreateAt is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldCreateAt 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 OldCreateAt: %w\", err)\n\t}\n\treturn oldValue.CreateAt, nil\n}", "title": "" }, { "docid": "b56bbd9cd94869be7c79070b03f0d690", "score": "0.57021403", "text": "func CreatedAtGT(v time.Time) predicate.Profile {\n\treturn predicate.Profile(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "00fe80d54cf378324dda0c77a707f5f9", "score": "0.5697905", "text": "func (m *GroupBudgetMutation) 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": "a98fd71264ef250ba3ebfe43144c6516", "score": "0.5696476", "text": "func (m *TagMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, errors.New(\"OldCreatedAt is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, errors.New(\"OldCreatedAt 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 OldCreatedAt: %w\", err)\n\t}\n\treturn oldValue.CreatedAt, nil\n}", "title": "" }, { "docid": "03288dcbe894aa1091739c944577599b", "score": "0.569589", "text": "func (m *RequestStatusMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, errors.New(\"OldCreatedAt is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, errors.New(\"OldCreatedAt 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 OldCreatedAt: %w\", err)\n\t}\n\treturn oldValue.CreatedAt, nil\n}", "title": "" } ]
9ab96203a93bffbdf7162a9a2f99fb58
Deprecated: Use ListDisksResponse.ProtoReflect.Descriptor instead.
[ { "docid": "f31544c1e8f5c6ebce2ebc2c239501e3", "score": "0.81074697", "text": "func (*ListDisksResponse) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_compute_v1_disk_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" } ]
[ { "docid": "2c8f440d83ec16404d1c0f047be03d8e", "score": "0.7815653", "text": "func (*ListDisksRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_compute_v1_disk_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "e4a39dac6240b9af3105600392ed45f1", "score": "0.71182007", "text": "func (*ListDiskOperationsResponse) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_compute_v1_disk_service_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "3a1a822dae7e73e521f0886b356da83b", "score": "0.680661", "text": "func (*ListDiskOperationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_compute_v1_disk_service_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "60f6440f1d55a5e15bd2ddbf183a1f34", "score": "0.67716956", "text": "func (*DeleteDiskRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_compute_v1_disk_service_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "76ba8c015df1227b90e8382a7de9f0cc", "score": "0.661522", "text": "func (*DeleteDiskMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_compute_v1_disk_service_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "256e9b1fba5adf06f1ca1cf1b08dc484", "score": "0.66108423", "text": "func (*GetDiskRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_compute_v1_disk_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "7a5be9522b37c1a9a2eff4e0307d3e3a", "score": "0.65042084", "text": "func (*UpdateDiskRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_compute_v1_disk_service_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "f55d63c293de6fc7e941988b0bb0fa76", "score": "0.65005535", "text": "func (*ListDeletionResponse) Descriptor() ([]byte, []int) {\n\treturn file_dps_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "4da46010df317ad47e7a76f6e2b107d8", "score": "0.641493", "text": "func (*UpdateDiskMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_compute_v1_disk_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "431e20aba7c3832421533ccbfd504a5a", "score": "0.62793165", "text": "func (m *MockClients) ListDisks(_, _, _ string) (*cs.DiskList, error) {\n return m.fakeListDisks, nil\n}", "title": "" }, { "docid": "f771ba2eb5b6159d064c9093d03a5ae3", "score": "0.6276175", "text": "func (*ListDimensionKeysResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_api_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "4b570c482a1295b57e34b5efac7e8199", "score": "0.6275247", "text": "func (*ListStorageClassResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_storage_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "b79ec740b120eb3fac24af9818fb2bf0", "score": "0.6275096", "text": "func (*ListDevicesResponse) Descriptor() ([]byte, []int) {\n\treturn file_device_service_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "752206aa9b4ea2a22dd1fccf59f376d4", "score": "0.6250427", "text": "func (*ListDeletionRequest) Descriptor() ([]byte, []int) {\n\treturn file_dps_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "0f1a1f3b8d034eecf9f6cc9605296ada", "score": "0.62501657", "text": "func (*DeleteServiceResponse) Descriptor() ([]byte, []int) {\n\treturn file_k8s_v1_k8s_proto_rawDescGZIP(), []int{38}\n}", "title": "" }, { "docid": "00ed103da5faaf672a2fdf5cfd9aee5a", "score": "0.62339574", "text": "func (*ListInstancesResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_datafusion_v1beta1_v1beta1_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "e3eca628f26a41d5fc2d525f8a7318ef", "score": "0.62309426", "text": "func (*ListPodsResponse) Descriptor() ([]byte, []int) {\n\treturn file_k8s_v1_k8s_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "008befbfa988ec5e4f95380a4f6dbbad", "score": "0.6230542", "text": "func (*RemoveDnsPeeringResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_datafusion_v1beta1_v1beta1_proto_rawDescGZIP(), []int{26}\n}", "title": "" }, { "docid": "262c347d27dd95bf57f654bc59d58b53", "score": "0.6204741", "text": "func (*ListDnsZonesResponse) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_dns_v1_dns_zone_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "0baba9217be666bb83d50560e2118cd5", "score": "0.61862355", "text": "func (*CreateDiskRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_compute_v1_disk_service_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "bced07a448f5b2b58229b4e2b3e0740c", "score": "0.61678493", "text": "func (*ListResourcesResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_discovery_discovery_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "9bf682d738ab71cdcc1faedb0cb3e7c8", "score": "0.61599463", "text": "func (*ListDnsPeeringsResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_datafusion_v1beta1_v1beta1_proto_rawDescGZIP(), []int{28}\n}", "title": "" }, { "docid": "1e318ddef7afec48ccfcb1b702bb77f2", "score": "0.61594677", "text": "func (*GetDeviceListResponse) Descriptor() ([]byte, []int) {\n\treturn file_m2m_m2mserver_device_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "7960261ff6ae0c5a3d995c2b733de794", "score": "0.61565673", "text": "func (*ListResourcesRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_discovery_discovery_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "4f22c684f2ae0683e9fa10f2ab006325", "score": "0.6155155", "text": "func (*DeleteDeviceResponse) Descriptor() ([]byte, []int) {\n\treturn file_device_service_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "76e1efc7f325f6b7e11fcb780c28d2ad", "score": "0.6143918", "text": "func (*ListDevicesRequest) Descriptor() ([]byte, []int) {\n\treturn file_device_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "b0a0bdf2dcbe396d04747b834816b736", "score": "0.61409646", "text": "func (*ListDnsZoneOperationsResponse) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_dns_v1_dns_zone_service_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "120c8756791aba8baa5abe86f6db356d", "score": "0.61362433", "text": "func (*ListNetworkUsageResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_baremetalsolution_v2_network_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "a81c1765c1867e00609644cdf7741b6d", "score": "0.6129247", "text": "func (*ListNetworksResponse) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_routing_v1_service_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "2961c3d9b547fcbbe0132270ab96155a", "score": "0.6127713", "text": "func (*DeleteK8SClusterReq) Descriptor() ([]byte, []int) {\n\treturn file_proto_resource_manager_proto_rawDescGZIP(), []int{61}\n}", "title": "" }, { "docid": "e0ee6f0d99242f2967dd88ca8cdf775b", "score": "0.6127152", "text": "func (*NotifyInterfaceDownResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_daemon_v1_daemon_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "ab1e0fe973826db487f47c10536ba6b0", "score": "0.612129", "text": "func (*DiskType) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_compute_v1_disk_type_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "74c24167832437bed18f0294d4b1d0b2", "score": "0.61135095", "text": "func (*ListStorageResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_storage_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "c5a89f819162dcae9913bd824852c520", "score": "0.6113487", "text": "func (*PrivateCloud) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_vmwareengine_v1_vmwareengine_resources_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "c9b4ef3b398c6c9e36124ef0fc6844b5", "score": "0.6108866", "text": "func (*CreateDiskMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_compute_v1_disk_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "879047fba02abfa2f80fc5ee1fd815b8", "score": "0.6096189", "text": "func (*ListVolumeBackupsResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_gkebackup_v1_gkebackup_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "44aeba3f263d63b0fc92080835b5d0c4", "score": "0.6076869", "text": "func (*DeleteK8SClusterRes) Descriptor() ([]byte, []int) {\n\treturn file_proto_resource_manager_proto_rawDescGZIP(), []int{62}\n}", "title": "" }, { "docid": "f5449330237f6297b057592351b4dcf0", "score": "0.6075676", "text": "func (*RemoveFromBlockListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_api_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "4266ffa0db0c0089d625f154df22b0ef", "score": "0.6075256", "text": "func (*EsxiDisksConnectionInfo) Descriptor() ([]byte, []int) {\n\treturn file_deploy_proto_rawDescGZIP(), []int{21}\n}", "title": "" }, { "docid": "0b33c4ca17abda6e823c354c1efdbf48", "score": "0.6074805", "text": "func (*ListNetworksResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_baremetalsolution_v2_network_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "267e6074742dfc634915946cc0e30d1a", "score": "0.60730904", "text": "func (*ListClustersResponse) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_mongodb_v1_cluster_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "b12b5195d2f293c04ad3dfc5581b9456", "score": "0.6071481", "text": "func (*ListStorageClassRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_storage_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "ecaad6fb3b09a6fc1ba123092bce08e6", "score": "0.6069046", "text": "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_gce_api_projects_v1_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "3364202538f87df59b6a3752899947ab", "score": "0.6066027", "text": "func (*ListDnsZonesRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_dns_v1_dns_zone_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "50740ee85f95c39571ac9c9168a08060", "score": "0.6064339", "text": "func (*ListPodsRequest) Descriptor() ([]byte, []int) {\n\treturn file_k8s_v1_k8s_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "28727eac07ef4a699d92145eacca5689", "score": "0.6062884", "text": "func (*Disk) Descriptor() ([]byte, []int) {\n\treturn file_machine_status_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "9c831cee5e73a53b8e24a40c86304845", "score": "0.60596335", "text": "func (x *fastReflection_ResponseListSnapshots) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ResponseListSnapshots\n}", "title": "" }, { "docid": "33c57c97b512e9f3a91ddd14a9a3508a", "score": "0.6054331", "text": "func (*DeleteMonitoredModel_Response) Descriptor() ([]byte, []int) {\n\treturn file_monitoring_MonitoredModel_proto_rawDescGZIP(), []int{4, 0}\n}", "title": "" }, { "docid": "7be952f8bc0fd90f966d0f7721bf274b", "score": "0.6054164", "text": "func (*DeleteCollectionResponse) Descriptor() ([]byte, []int) {\n\treturn file_filer_proto_rawDescGZIP(), []int{34}\n}", "title": "" }, { "docid": "15f77fc71b8ee20ca0df295ade697586", "score": "0.6053134", "text": "func (*ListFailedResponse) Descriptor() ([]byte, []int) {\n\treturn file_dps_proto_rawDescGZIP(), []int{24}\n}", "title": "" }, { "docid": "72c0a950aca9a8356c52f401e75b986a", "score": "0.60525286", "text": "func (*DiskInfo) Descriptor() ([]byte, []int) {\n\treturn file_deploy_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "55dc03498ee5a48152770691d7104264", "score": "0.604435", "text": "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_micro_go_micro_store_service_proto_store_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "b70c0573d7cf26885a382e33fe5bacf6", "score": "0.6043855", "text": "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_account_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "f36be077e468b9cbb1700fafe6df4f0d", "score": "0.6041842", "text": "func (*GetSpaceQuotaSnapshotsResponse) Descriptor() ([]byte, []int) {\n\treturn file_Quota_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "2370043a383e5e4a975fbf23fb1eb56c", "score": "0.6041585", "text": "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_banking_linked_card_service_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "73b5b85de95d9e3348b6196ea2fd8021", "score": "0.6033701", "text": "func (*ListClustersReq) Descriptor() ([]byte, []int) {\n\treturn file_proto_resource_manager_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "cbf13419b6150fdb2ce56ab3efc0e87b", "score": "0.6033446", "text": "func (*ListDimensionKeysRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_api_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "a7ab7d82d4411383447d2f55fc45b658", "score": "0.6032382", "text": "func (*ListBackupsResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_gkebackup_v1_gkebackup_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "86b27e82b78103894c9e5db70a0deac0", "score": "0.60321", "text": "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_sketchit_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "afd7df2838a1c615fcd3c87d2b0cb669", "score": "0.6029795", "text": "func (*ListDimensionKeysResponse_Result) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_api_proto_rawDescGZIP(), []int{11, 0}\n}", "title": "" }, { "docid": "92947be5f2afdf72b5c7ca24ca347a08", "score": "0.60275424", "text": "func (*DeleteAkSkResponse) Descriptor() ([]byte, []int) {\n\treturn file_aksk_proto_aksk_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "1bd2abfc88f374d2f1ea378000e02c9a", "score": "0.60255474", "text": "func (*DelNetworkReply) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "8d5e57167d8160b67fb9d8afce6d22d1", "score": "0.60211116", "text": "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_micro_go_micro_store_service_proto_store_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "b5cb108a14f5f623025c0465858d3ff2", "score": "0.601217", "text": "func (*ListMachinesResponse) Descriptor() ([]byte, []int) {\n\treturn file_machine_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "603c8a0df8d271636ef24c3ab4b5b0fa", "score": "0.6009399", "text": "func (*StopDHCPRequest) Descriptor() ([]byte, []int) {\n\treturn file_ddi_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "66a843ecf4b988d398c4eaeeaa48c1ea", "score": "0.6000208", "text": "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_user_center_user_center_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "12fae6f95dbcf64a83d5abe48e99e088", "score": "0.59966487", "text": "func (*DeleteInfo) Descriptor() ([]byte, []int) {\n\treturn file_dns_service_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "c06bcb98c83e31a5d2f8cb6bb9d34fe9", "score": "0.5995894", "text": "func (x *fastReflection_RequestListSnapshots) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_RequestListSnapshots\n}", "title": "" }, { "docid": "a3111353a06006b7e88c5712205ce651", "score": "0.5995425", "text": "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_server_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "6fb917673e52e431b20527178c0765c9", "score": "0.59943795", "text": "func (*ListDetectorsResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_securitycenter_settings_v1beta1_securitycenter_settings_service_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "4cdab3450882c7cde71c3d277301c0f5", "score": "0.5993704", "text": "func (*ListHostGroupInstancesResponse) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_compute_v1_host_group_service_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "ec4d852f7a42bad12cfabd59d9834e29", "score": "0.59928244", "text": "func (*CreateK8SClusterResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_resource_manager_proto_rawDescGZIP(), []int{23}\n}", "title": "" }, { "docid": "d9642c08dd15e5102c7132deb9c384b8", "score": "0.59928006", "text": "func (*DelNetworkRequest) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "c6891f5c4cfe25eabe6f078a36a0d1a5", "score": "0.5992265", "text": "func (*ListOptions) Descriptor() ([]byte, []int) {\n\treturn file_k8s_v1_k8s_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "c1ae443705635e5a67d3fdb89df981eb", "score": "0.59911776", "text": "func (*ListGroupsResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_monitoring_v3_group_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "8709f4bbb2911f95484ed8709f284799", "score": "0.5987778", "text": "func (*ListClustersRes) Descriptor() ([]byte, []int) {\n\treturn file_proto_resource_manager_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "b95c78006fafc29cb15917ea7f6832ad", "score": "0.5986565", "text": "func (*DeleteDNSZoneRequest) Descriptor() ([]byte, []int) {\n\treturn file_ddi_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "b4fd770e773a568a40bf36ba3a248c34", "score": "0.59859806", "text": "func (*ListInstancesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_datafusion_v1beta1_v1beta1_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "fa206886b70670035fd2cd9d602a2694", "score": "0.5985566", "text": "func (*ListServiceAccountKeysResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_iam_admin_v1_iam_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "d747705b97b28f60ab88d247e5c9c119", "score": "0.5983312", "text": "func (*ListInstructionsResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_datalabeling_v1beta1_data_labeling_service_proto_rawDescGZIP(), []int{29}\n}", "title": "" }, { "docid": "7d8a54dc913f1a69ef2e3fcfb42ade95", "score": "0.598248", "text": "func (*NotifyInterfaceDownRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_daemon_v1_daemon_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "93e0c4b481c01a54442c9772641d26ad", "score": "0.59809035", "text": "func (*ListFailedRequest) Descriptor() ([]byte, []int) {\n\treturn file_dps_proto_rawDescGZIP(), []int{23}\n}", "title": "" }, { "docid": "3b9ccb694259c5a9ecff565327eded27", "score": "0.59777355", "text": "func (*ListKeysRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{101}\n}", "title": "" }, { "docid": "0815c3b873a4e5ebbc21d67ba2a88430", "score": "0.59717196", "text": "func (*ListDriversResponse) Descriptor() ([]byte, []int) {\n\treturn file_bess_msg_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "ae1f310ae12d46caeeb17dce83855afb", "score": "0.59710485", "text": "func (*DeleteDeviceRequest) Descriptor() ([]byte, []int) {\n\treturn file_device_service_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "78f75a669d42c530dcc30594b56d9c67", "score": "0.59686273", "text": "func (*ListDataItemsResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_datalabeling_v1beta1_data_labeling_service_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "e9df70cf66c9e5bd52fe0682c65b2c3f", "score": "0.5966113", "text": "func (*ListDnsZoneOperationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_dns_v1_dns_zone_service_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "e24c5baac28b3bef2abaed1bb8fe4bd3", "score": "0.59654635", "text": "func (*DeleteDatasetVersions_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_DatasetVersionService_proto_rawDescGZIP(), []int{10, 0}\n}", "title": "" }, { "docid": "9637b0fbe252a475dff213beb200b56c", "score": "0.59589756", "text": "func (*Disk) Descriptor() ([]byte, []int) {\n\treturn file_deploy_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "08a995f86fceebc54126bf0cff69bde3", "score": "0.59555835", "text": "func (*ListVolumeSnapshotsResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_baremetalsolution_v2_volume_snapshot_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "8899b0ea25da787a33bd01dd06e59b1d", "score": "0.59544206", "text": "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_messages_messages_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "1d8899af44f58829e4690cd831cbfc47", "score": "0.5953951", "text": "func (*ListVersionsResponse) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_k8s_v1_version_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "a3457b57471495aff6b6b2037707a80f", "score": "0.5950034", "text": "func (*DeleteServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_k8s_v1_k8s_proto_rawDescGZIP(), []int{37}\n}", "title": "" }, { "docid": "535f2def55b49e700ef8031be4e2721c", "score": "0.5947913", "text": "func (*ListInstancesResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_baremetalsolution_v2_instance_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "14269b0c346ee1b2bc288ba31cad0871", "score": "0.5947822", "text": "func (*DeleteDatasetVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{90}\n}", "title": "" }, { "docid": "b76c38652e1b9c642f8314e5f9a04c21", "score": "0.59475225", "text": "func (*DeleteEntryResponse) Descriptor() ([]byte, []int) {\n\treturn file_filer_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "9dfab5504ccb41dc164d49dc1d1ae4b5", "score": "0.59463185", "text": "func (*StartDiscoveryResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_discovery_discovery_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "99ec92c0baa6be96db2f439ef245f2d0", "score": "0.59434474", "text": "func (*ListFoldersResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_resourcemanager_v2_folders_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "bb8621a4e41608b204c7b725cc78b79e", "score": "0.5940883", "text": "func (*AttachedDisk) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_compute_v1_instance_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "9567e0646627b6abc27d2c92be15b8ab", "score": "0.5939666", "text": "func (*ListHostGroupsResponse) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_compute_v1_host_group_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" } ]
5e2abda9fb133e2ede90d866887ef3c8
Specifies the disk interface to use for attaching this disk, which is either SCSI or NVME.
[ { "docid": "cc60c6ead6d8b8c7f05c64befd5bf21b", "score": "0.0", "text": "func (o SavedAttachedDiskResponseOutput) Interface() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SavedAttachedDiskResponse) string { return v.Interface }).(pulumi.StringOutput)\n}", "title": "" } ]
[ { "docid": "990b6ad00dcf71b663f3adb937d9f6dc", "score": "0.66100454", "text": "func (p *Disk) SetInterface(attr DiskInterface) {\n\tp.interface_ = &attr\n}", "title": "" }, { "docid": "209229d75fd26807d0640395aeffabb3", "score": "0.63840324", "text": "func (p *DiskAttachment) SetInterface(attr DiskInterface) {\n\tp.interface_ = &attr\n}", "title": "" }, { "docid": "9ad566fb708908134fc307b18b7b5196", "score": "0.60354596", "text": "func (p *DiskSnapshot) SetInterface(attr DiskInterface) {\n\tp.interface_ = &attr\n}", "title": "" }, { "docid": "35d15c105fa184e7ce2b4d1b902194ed", "score": "0.5955009", "text": "func NetworkAttachInterface(netName string, devName string) error {\n\tif shared.PathExists(fmt.Sprintf(\"/sys/class/net/%s/bridge\", netName)) {\n\t\t_, err := shared.RunCommand(\"ip\", \"link\", \"set\", \"dev\", devName, \"master\", netName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\t_, err := shared.RunCommand(\"ovs-vsctl\", \"port-to-br\", devName)\n\t\tif err != nil {\n\t\t\t_, err := shared.RunCommand(\"ovs-vsctl\", \"add-port\", netName, devName)\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": "ff1ebd96915dbc927f92472962f00ad9", "score": "0.5784421", "text": "func (nics *NetworkInterfaceService) Attach(ctx context.Context, vm resources.VirtualMachine, nic resources.NIC) error {\n\tvmID, err := vm.ID()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnicText, err := resources.RenderInterfaceToXMLString(templateNIC{Nic: &nic})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = nics.call(ctx, \"one.vm.attachnic\", vmID, nicText)\n\n\treturn err\n}", "title": "" }, { "docid": "8260dc3baf838918fb5467597e6962ca", "score": "0.5736163", "text": "func (cli *HostWrapper) SetDisk(disk int64) error {\n\treturn cli.host.SetValue(fieldDisk, disk)\n}", "title": "" }, { "docid": "9fce80f6afb786f35efcaa3c61397997", "score": "0.56645864", "text": "func (c *Client) AttachENI(index int, eniID, instanceID, eniMac string) (*cloudv1.NetworkInterfaceAttachment, error) {\n\treq := &ec2.AttachNetworkInterfaceInput{}\n\treq.SetNetworkInterfaceId(eniID)\n\treq.SetInstanceId(instanceID)\n\treq.SetDeviceIndex(int64(index))\n\n\tblog.V(2).Infof(\"aws AttachNetworkInterface request %+v\", req)\n\n\tresp, err := c.ec2client.AttachNetworkInterface(req)\n\tif err != nil {\n\t\tblog.Errorf(\"aws AttachNetworkInterface failed, err %s\", err.Error())\n\t\treturn nil, err\n\t}\n\n\tblog.V(2).Infof(\"aws AttachNetworkInterface response %+v\", resp)\n\n\tif resp.AttachmentId == nil {\n\t\tblog.Errorf(\"aws AttachNetworkInterface, AttachmentId in resp is empty\")\n\t\treturn nil, fmt.Errorf(\"aws AttachNetworkInterface, AttachmentId in resp is empty\")\n\t}\n\n\t// wait for real attachment\n\terr = c.waitForENIAttached(eniMac)\n\tif err != nil {\n\t\tblog.Errorf(\"wait for eni attached failed, err %s\", err.Error())\n\t\treturn nil, fmt.Errorf(\"wait for eni attached failed, err %s\", err.Error())\n\t}\n\n\treturn &cloudv1.NetworkInterfaceAttachment{\n\t\tIndex: index,\n\t\tAttachmentID: aws.StringValue(resp.AttachmentId),\n\t\tInstanceID: instanceID,\n\t}, nil\n}", "title": "" }, { "docid": "e585631fba2562bb651f0d27ed51115f", "score": "0.55018383", "text": "func ShowInterface(iface string) (string, error) {\n\tklog.V(2).Infof(\"Begin ShowInterface...\")\n\tout, err := iscsiCmd(\"-m\", \"iface\", \"-o\", \"show\", \"-I\", iface)\n\treturn out, err\n}", "title": "" }, { "docid": "970a3f0691893d96a46faa6ef05d1b04", "score": "0.5379416", "text": "func WithInterface(name string) ControllerOption {\n\treturn func(c *Controller) {\n\t\tc.iface = name\n\t}\n}", "title": "" }, { "docid": "448f998561f06f1d92d854c95ff263a5", "score": "0.5352928", "text": "func (p *DiskAttachment) Interface() (DiskInterface, bool) {\n\tif p.interface_ != nil {\n\t\treturn *p.interface_, true\n\t}\n\tvar zero DiskInterface\n\treturn zero, false\n}", "title": "" }, { "docid": "2e7bfe9b55bf76dda9f9088f42fdb977", "score": "0.5349329", "text": "func (m *kubeGenericRuntimeManager) AttachNetworkInterface(pod *v1.Pod, vmName string, nic *v1.Nic) error {\n\tklog.V(4).Infof(\"Attaching NIC %v to Pod-VM %s-%s\", nic, pod.Name, vmName)\n\n\truntimeService, _ := m.GetRuntimeServiceByPod(pod)\n\treturn runtimeService.AttachNetworkInterface(pod.Name, vmName, KubeNicToRuntimeNic(nic))\n}", "title": "" }, { "docid": "66a0bf640ce825b18b092d638c0a2290", "score": "0.5323759", "text": "func (h *NetLinkHandler) SetInterfaceAlias(ifName, alias string) error {\n\tlink, err := h.GetLinkByName(ifName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := h.LinkSetAlias(link, alias); err != nil {\n\t\treturn errors.Wrapf(err, \"LinkSetAlias %s\", alias)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3357b2522b74e6d8f2e071dd7801cbdb", "score": "0.5297756", "text": "func (p *Nic) SetInterface(attr NicInterface) {\n\tp.interface_ = &attr\n}", "title": "" }, { "docid": "926edbc803e61d178d8078ca919313fc", "score": "0.52913857", "text": "func (o *NiatelemetryNiaInventory) SetDisk(v NiatelemetryDiskinfo) {\n\to.Disk.Set(&v)\n}", "title": "" }, { "docid": "654ee4e39ffd0dddac2499dac044cdf6", "score": "0.5230558", "text": "func SetOptimalIOMode(disk *api.Disk) error {\n\tvar path string\n\n\t// If the user explicitly set the io mode do nothing\n\tif v1.DriverIO(disk.Driver.IO) != \"\" {\n\t\treturn nil\n\t}\n\n\tif disk.Source.File != \"\" {\n\t\tpath = disk.Source.File\n\t} else if disk.Source.Dev != \"\" {\n\t\tpath = disk.Source.Dev\n\t} else {\n\t\treturn nil\n\t}\n\n\t// O_DIRECT is needed for io=\"native\"\n\tif v1.DriverCache(disk.Driver.Cache) == v1.CacheNone {\n\t\t// set native for block device or pre-allocateed image file\n\t\tif (disk.Source.Dev != \"\") || IsPreAllocated(disk.Source.File) {\n\t\t\tdisk.Driver.IO = v1.IONative\n\t\t}\n\t}\n\t// For now we don't explicitly set io=threads even for sparse files as it's\n\t// not clear it's better for all use-cases\n\tif v1.DriverIO(disk.Driver.IO) != \"\" {\n\t\tlog.Log.Infof(\"Driver IO mode for %s set to %s\", path, disk.Driver.IO)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "889c5e8c7e45ce2e31459b6476b08646", "score": "0.52104", "text": "func (uvm *UtilityVM) AddSCSI(ctx context.Context, hostPath string, uvmPath string, readOnly bool, guestOptions []string, vmAccess VMAccessType) (*SCSIMount, error) {\n\treturn uvm.addSCSIActual(ctx, hostPath, uvmPath, \"VirtualDisk\", readOnly, guestOptions, vmAccess)\n}", "title": "" }, { "docid": "a3d95aab733c8c939bd3d7b0ab0c66cd", "score": "0.5206047", "text": "func (i *Interfaces) SetExternalNIC() {\n\tParseTmpl(i, externalNIC, \"external\", \"/etc/network/interfaces.d/\"+i.ExternalNIC+\".cfg\", 0644)\n}", "title": "" }, { "docid": "4af76bfedf83856e5be2f472a0221616", "score": "0.51995546", "text": "func (mgr *VolumeManager) Attach(options api.AttachVolumeOptions) (*api.VolumeAttachment, api.AttachVolumeError) {\n\tva, err := volumeattach.Create(mgr.Provider.BaseServices.Compute, options.ServerID, volumeattach.CreateOpts{\n\t\tDevice: options.DevicePath,\n\t\tVolumeID: options.VolumeID,\n\t}).Extract()\n\tif err != nil {\n\t\treturn nil, api.NewAttachVolumeError(UnwrapOpenStackError(err), options)\n\t}\n\treturn &api.VolumeAttachment{\n\t\tID: va.ID,\n\t\tVolumeID: va.VolumeID,\n\t\tServerID: va.ServerID,\n\t\tDevice: va.Device,\n\t}, nil\n}", "title": "" }, { "docid": "e6a7e63b68230cb8c7a1927605db6849", "score": "0.5193191", "text": "func (rs *Rackspace) AttachDisk(instanceID, volumeID string) (string, error) {\n\tvolume, err := rs.getVolume(volumeID)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif volume.Status != VolumeAvailableStatus {\n\t\terrmsg := fmt.Sprintf(\"volume %s status is %s, not %s, can not be attached to instance %s.\", volume.Name, volume.Status, VolumeAvailableStatus, instanceID)\n\t\tglog.Errorf(errmsg)\n\t\treturn \"\", errors.New(errmsg)\n\t}\n\n\tcompute, err := rs.getComputeClient()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif len(volume.Attachments) > 0 {\n\t\tif instanceID == volume.Attachments[0][\"server_id\"] {\n\t\t\tglog.V(4).Infof(\"Volume: %q is already attached to compute: %q\", volumeID, instanceID)\n\t\t\treturn volume.ID, nil\n\t\t}\n\n\t\terrMsg := fmt.Sprintf(\"Volume %q is attached to a different compute: %q, should be detached before proceeding\", volumeID, volume.Attachments[0][\"server_id\"])\n\t\tglog.Errorf(errMsg)\n\t\treturn \"\", errors.New(errMsg)\n\t}\n\n\t_, err = volumeattach.Create(compute, instanceID, &osvolumeattach.CreateOpts{\n\t\tVolumeID: volume.ID,\n\t}).Extract()\n\tif err != nil {\n\t\tglog.Errorf(\"Failed to attach %s volume to %s compute\", volumeID, instanceID)\n\t\treturn \"\", err\n\t}\n\tglog.V(2).Infof(\"Successfully attached %s volume to %s compute\", volumeID, instanceID)\n\treturn volume.ID, nil\n}", "title": "" }, { "docid": "b8617519b02f2e6e1a38dd02c4f821ea", "score": "0.51845306", "text": "func (self *TraitDBusMessage) SetInterface(value string) {\n\t__cgo__value := (*C.gchar)(unsafe.Pointer(C.CString(value)))\n\tC.g_dbus_message_set_interface(self.CPointer, __cgo__value)\n\tC.free(unsafe.Pointer(__cgo__value))\n\treturn\n}", "title": "" }, { "docid": "c153f952f24de079fe861b326d837a4c", "score": "0.51679015", "text": "func (ebs *EBSUtil) AttachDisk(volumeID string, nodeName string) error {\n\tinstance, err := findInstanceByNodeName(nodeName, ebs.client)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error finding node %s: %v\", nodeName, err)\n\t}\n\terr = ebs.waitForAvailable(volumeID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error waiting volume %s to be available: %v\", volumeID, err)\n\t}\n\n\tdevice, err := ebs.findFreeDevice(instance)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error finding free device on node %s: %v\", nodeName, err)\n\t}\n\thostDevice := \"/dev/xvd\" + string(device)\n\tattachInput := &ec2.AttachVolumeInput{\n\t\tVolumeId: &volumeID,\n\t\tInstanceId: instance.InstanceId,\n\t\tDevice: &hostDevice,\n\t}\n\t_, err = ebs.client.AttachVolume(attachInput)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error attaching volume %s to node %s: %v\", volumeID, nodeName, err)\n\t}\n\treturn ebs.waitForAttach(volumeID)\n}", "title": "" }, { "docid": "feb206afa5d6da5cd54bd1ab6653e474", "score": "0.5124968", "text": "func (h *NetLinkHandler) SetInterfaceMTU(ifName string, mtu int) error {\n\tlink, err := h.GetLinkByName(ifName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := h.LinkSetMTU(link, mtu); err != nil {\n\t\treturn errors.Wrapf(err, \"LinkSetMTU %v\", mtu)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ba04ffe57be8e8767e20b4e411feedd4", "score": "0.5105224", "text": "func (d OCIFlexvolumeDriver) Attach(opts flexvolume.Options, nodeName string) flexvolume.DriverStatus {\n\tc, err := client.New(GetConfigPath())\n\tif err != nil {\n\t\treturn flexvolume.Fail(err)\n\t}\n\n\tinstance, err := c.GetInstanceByNodeName(nodeName)\n\tif err != nil {\n\t\treturn flexvolume.Fail(err)\n\t}\n\n\tvolumeOCID := deriveVolumeOCID(c.GetConfig().Auth.RegionKey, opts[\"kubernetes.io/pvOrVolumeName\"])\n\n\tlog.Printf(\"Attaching volume %s -> instance %s\", volumeOCID, *instance.Id)\n\n\tattachment, statusCode, err := c.AttachVolume(*instance.Id, volumeOCID)\n\tif err != nil {\n\t\tif statusCode != 409 {\n\t\t\tlog.Printf(\"AttachVolume: %+v\", err)\n\t\t\treturn flexvolume.Fail(err)\n\t\t}\n\t\t// If we get a 409 conflict response when attaching we\n\t\t// presume that the device is already attached.\n\t\tlog.Printf(\"Attach(): Volume %q already attached.\", volumeOCID)\n\t\tattachment, err = c.FindVolumeAttachment(volumeOCID)\n\t\tif err != nil {\n\t\t\treturn flexvolume.Fail(err)\n\t\t}\n\t\tif *attachment.GetInstanceId() != *instance.Id {\n\t\t\treturn flexvolume.Fail(\"Already attached to instance: \", *instance.Id)\n\t\t}\n\t}\n\n\tattachment, err = c.WaitForVolumeAttached(*attachment.GetId())\n\tif err != nil {\n\t\treturn flexvolume.Fail(err)\n\t}\n\n\tlog.Printf(\"attach: %s attached\", *attachment.GetId())\n\tiscsiAttachment, ok := attachment.(core.IScsiVolumeAttachment)\n\tif !ok {\n\t\treturn flexvolume.Fail(\"Only ISCSI volume attachments are currently supported\")\n\t}\n\n\treturn flexvolume.DriverStatus{\n\t\tStatus: flexvolume.StatusSuccess,\n\t\tDevice: fmt.Sprintf(diskIDByPathTemplate, *iscsiAttachment.Ipv4, *iscsiAttachment.Port, *iscsiAttachment.Iqn),\n\t}\n}", "title": "" }, { "docid": "d051e1b4e2940529b9d00b8648b8dc3c", "score": "0.509948", "text": "func (m *MockMachine) AttachStorage(ctlName string, medium virtualbox.StorageMedium) error {\n\treturn nil\n}", "title": "" }, { "docid": "f002ff94ce0646735b474616e2b3f288", "score": "0.5090447", "text": "func (vm *VolumeManager) Attach(ctx context.Context, name string, options map[string]string) (*types.Volume, error) {\n\tid := types.VolumeID{\n\t\tName: name,\n\t}\n\n\tv, err := vm.Get(ctx, name)\n\tif err != nil {\n\t\treturn nil, errors.Errorf(\"failed to get volume: %s\", name)\n\t}\n\n\tif options == nil {\n\t\toptions = make(map[string]string)\n\t}\n\n\tcid, ok := options[types.OptionRef]\n\tif ok && cid != \"\" {\n\t\tref := v.Option(types.OptionRef)\n\t\tif ref == \"\" {\n\t\t\toptions[types.OptionRef] = cid\n\t\t} else if !strings.Contains(ref, cid) {\n\t\t\toptions[types.OptionRef] = strings.Join([]string{ref, cid}, \",\")\n\t\t}\n\t}\n\n\treturn vm.core.AttachVolume(id, options)\n}", "title": "" }, { "docid": "63dcb5ac996891c479946d4cd650cba7", "score": "0.5086718", "text": "func (s *SvmEndpoints) SetIscsi(v *SvmEndpoint) *SvmEndpoints {\n\ts.Iscsi = v\n\treturn s\n}", "title": "" }, { "docid": "c15362c1171ae2f0a35eb401942a57cc", "score": "0.5076263", "text": "func (uvm *UtilityVM) AddSCSIPhysicalDisk(ctx context.Context, hostPath, uvmPath string, readOnly bool, guestOptions []string) (*SCSIMount, error) {\n\treturn uvm.addSCSIActual(ctx, hostPath, uvmPath, \"PassThru\", readOnly, guestOptions, VMAccessTypeIndividual)\n}", "title": "" }, { "docid": "72726ceb2e232ee0747af0f3761fe0e7", "score": "0.5047241", "text": "func (o AttachedDiskOutput) Interface() AttachedDiskInterfacePtrOutput {\n\treturn o.ApplyT(func(v AttachedDisk) *AttachedDiskInterface { return v.Interface }).(AttachedDiskInterfacePtrOutput)\n}", "title": "" }, { "docid": "5091788e65f3d8055469d598a00dad4f", "score": "0.50372297", "text": "func (p *Disk) Interface() (DiskInterface, bool) {\n\tif p.interface_ != nil {\n\t\treturn *p.interface_, true\n\t}\n\tvar zero DiskInterface\n\treturn zero, false\n}", "title": "" }, { "docid": "a4bb40e5b58da873f9e837af419fd17f", "score": "0.5031225", "text": "func attachDisk(tenantUserUID, diskID, nodeID string, isSharedDisk bool) (string, error) {\n\tlog.Log.Infof(\"AttachDisk: Starting Do AttachDisk: DiskId: %s, InstanceId: %s, Region: %v\", diskID, nodeID, GlobalConfigVar.Region)\n\n\tecsClient, err := getEcsClientByID(\"\", tenantUserUID)\n\t// Step 1: check disk status\n\tdisk, err := findDiskByID(diskID, ecsClient)\n\tif err != nil {\n\t\tlog.Log.Errorf(\"AttachDisk: find disk: %s with error: %s\", diskID, err.Error())\n\t\treturn \"\", status.Errorf(codes.Internal, \"AttachDisk: find disk: %s with error: %s\", diskID, err.Error())\n\t}\n\tif disk == nil {\n\t\treturn \"\", status.Errorf(codes.Internal, \"AttachDisk: csi can't find disk: %s in region: %s, Please check if the cloud disk exists, if the region is correct, or if the csi permissions are correct\", diskID, GlobalConfigVar.Region)\n\t}\n\n\tif !GlobalConfigVar.ADControllerEnable {\n\t\t// NodeStageVolume should be called by sequence\n\t\t// In order no to block to caller, use boolean canAttach to check whether to continue.\n\t\tGlobalConfigVar.AttachMutex.Lock()\n\t\tif !GlobalConfigVar.CanAttach {\n\t\t\tGlobalConfigVar.AttachMutex.Unlock()\n\t\t\tlog.Log.Errorf(\"NodeStageVolume: Previous attach action is still in process, VolumeId: %s\", diskID)\n\t\t\treturn \"\", status.Error(codes.Aborted, \"NodeStageVolume: Previous attach action is still in process: \"+diskID)\n\t\t}\n\t\tGlobalConfigVar.CanAttach = false\n\t\tGlobalConfigVar.AttachMutex.Unlock()\n\t\tdefer func() {\n\t\t\tGlobalConfigVar.AttachMutex.Lock()\n\t\t\tGlobalConfigVar.CanAttach = true\n\t\t\tGlobalConfigVar.AttachMutex.Unlock()\n\t\t}()\n\t}\n\n\t// tag disk as k8s.aliyun.com=true\n\tif GlobalConfigVar.DiskTagEnable {\n\t\ttagDiskAsK8sAttached(diskID, ecsClient)\n\t}\n\n\tif isSharedDisk {\n\t\tattachedToLocal := false\n\t\tfor _, instance := range disk.MountInstances.MountInstance {\n\t\t\tif instance.InstanceId == nodeID {\n\t\t\t\tattachedToLocal = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif attachedToLocal {\n\t\t\tdetachRequest := ecs.CreateDetachDiskRequest()\n\t\t\tdetachRequest.InstanceId = nodeID\n\t\t\tdetachRequest.DiskId = diskID\n\t\t\tfor key, value := range GlobalConfigVar.RequestBaseInfo {\n\t\t\t\tdetachRequest.AppendUserAgent(key, value)\n\t\t\t}\n\t\t\t_, err = ecsClient.DetachDisk(detachRequest)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", status.Errorf(codes.Aborted, \"AttachDisk: Can't attach disk %s to instance %s: %v\", diskID, disk.InstanceId, err)\n\t\t\t}\n\n\t\t\tif err := waitForSharedDiskInStatus(10, time.Second*3, diskID, nodeID, DiskStatusDetached, ecsClient); err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// disk is attached, means disk_ad_controller env is true, disk must be created after 2020.06\n\t\tif disk.Status == DiskStatusInuse {\n\t\t\tif disk.InstanceId == nodeID {\n\t\t\t\tif GlobalConfigVar.ADControllerEnable {\n\t\t\t\t\tlog.Log.Infof(\"AttachDisk: Disk %s is already attached to Instance %s, skipping\", diskID, disk.InstanceId)\n\t\t\t\t\treturn \"\", nil\n\t\t\t\t}\n\t\t\t\tdevicePaths := GetVolumeDeviceName(diskID)\n\t\t\t\trootDevice, subDevice, err := GetRootSubDevicePath(devicePaths)\n\t\t\t\tlog.Log.Infof(\"attachDisk: rootDevice: %s, subDevice: %s, err: %+v\", rootDevice, subDevice, err)\n\t\t\t\tdeviceName := ChooseDevice(rootDevice, subDevice)\n\t\t\t\tif err == nil && deviceName != \"\" && IsFileExisting(deviceName) {\n\t\t\t\t\tif used, err := IsDeviceUsedOthers(deviceName, diskID); err == nil && used == false {\n\t\t\t\t\t\tlog.Log.Infof(\"AttachDisk: Disk %s is already attached to self Instance %s, and device is: %s\", diskID, disk.InstanceId, deviceName)\n\t\t\t\t\t\treturn deviceName, nil\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// wait for pci attach ready\n\t\t\t\t\ttime.Sleep(5 * time.Second)\n\t\t\t\t\tlog.Log.Infof(\"AttachDisk: find disk dev after 5 seconds\")\n\t\t\t\t\tdevicePaths := GetVolumeDeviceName(diskID)\n\t\t\t\t\trootDevice, subDevice, err := GetRootSubDevicePath(devicePaths)\n\t\t\t\t\tdeviceName = ChooseDevice(rootDevice, subDevice)\n\t\t\t\t\tif err == nil && deviceName != \"\" && IsFileExisting(deviceName) {\n\t\t\t\t\t\tif used, err := IsDeviceUsedOthers(deviceName, diskID); err == nil && used == false {\n\t\t\t\t\t\t\tlog.Log.Infof(\"AttachDisk: Disk %s is already attached to self Instance %s, and device is: %s\", diskID, disk.InstanceId, deviceName)\n\t\t\t\t\t\t\treturn deviceName, nil\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\terr = fmt.Errorf(\"AttachDisk: disk device cannot be found in node, diskid: %s, devicenName: %s, err: %+v\", diskID, deviceName, err)\n\t\t\t\t\treturn \"\", err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif GlobalConfigVar.DiskBdfEnable {\n\t\t\t\tif allowed, err := forceDetachAllowed(ecsClient, disk, nodeID); err != nil {\n\t\t\t\t\terr = perrors.Wrapf(err, \"forceDetachAllowed\")\n\t\t\t\t\treturn \"\", status.Errorf(codes.Aborted, err.Error())\n\t\t\t\t} else if !allowed {\n\t\t\t\t\terr = perrors.Errorf(\"AttachDisk: Disk %s is already attached to instance %s, and depend bdf, reject force detach\", disk.DiskId, disk.InstanceId)\n\t\t\t\t\tlog.Log.Error(err)\n\t\t\t\t\treturn \"\", status.Errorf(codes.Aborted, err.Error())\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !GlobalConfigVar.DetachBeforeAttach {\n\t\t\t\terr = perrors.Errorf(\"AttachDisk: Disk %s is already attached to instance %s, env DISK_FORCE_DETACHED is false reject force detach\", diskID, disk.InstanceId)\n\t\t\t\tlog.Log.Error(err)\n\t\t\t\treturn \"\", status.Errorf(codes.Aborted, err.Error())\n\t\t\t}\n\t\t\tlog.Log.Infof(\"AttachDisk: Disk %s is already attached to instance %s, will be detached\", diskID, disk.InstanceId)\n\t\t\tdetachRequest := ecs.CreateDetachDiskRequest()\n\t\t\tdetachRequest.InstanceId = disk.InstanceId\n\t\t\tdetachRequest.DiskId = disk.DiskId\n\t\t\tfor key, value := range GlobalConfigVar.RequestBaseInfo {\n\t\t\t\tdetachRequest.AppendUserAgent(key, value)\n\t\t\t}\n\t\t\t_, err = ecsClient.DetachDisk(detachRequest)\n\t\t\tif err != nil {\n\t\t\t\tlog.Log.Errorf(\"AttachDisk: Can't Detach disk %s from instance %s: with error: %v\", diskID, disk.InstanceId, err)\n\t\t\t\treturn \"\", status.Errorf(codes.Aborted, \"AttachDisk: Can't Detach disk %s from instance %s: with error: %v\", diskID, disk.InstanceId, err)\n\t\t\t}\n\t\t} else if disk.Status == DiskStatusAttaching {\n\t\t\treturn \"\", status.Errorf(codes.Aborted, \"AttachDisk: Disk %s is attaching %v\", diskID, disk)\n\t\t}\n\t\t// Step 2: wait for Detach\n\t\tif disk.Status != DiskStatusAvailable {\n\t\t\tlog.Log.Infof(\"AttachDisk: Wait for disk %s is detached\", diskID)\n\t\t\tif err := waitForDiskInStatus(15, time.Second*3, diskID, DiskStatusAvailable, ecsClient); err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t}\n\t}\n\t// Step 3: Attach Disk, list device before attach disk\n\tbefore := []string{}\n\tif !GlobalConfigVar.ADControllerEnable {\n\t\tbefore = getDevices()\n\t}\n\n\tattachRequest := ecs.CreateAttachDiskRequest()\n\tattachRequest.InstanceId = nodeID\n\tattachRequest.DiskId = diskID\n\tfor key, value := range GlobalConfigVar.RequestBaseInfo {\n\t\tattachRequest.AppendUserAgent(key, value)\n\t}\n\tresponse, err := ecsClient.AttachDisk(attachRequest)\n\tif err != nil {\n\t\tif strings.Contains(err.Error(), DiskLimitExceeded) {\n\t\t\treturn \"\", status.Error(codes.Internal, err.Error()+\", Node(\"+nodeID+\")exceed the limit attachments of disk\")\n\t\t} else if strings.Contains(err.Error(), DiskNotPortable) {\n\t\t\treturn \"\", status.Error(codes.Internal, err.Error()+\", Disk(\"+diskID+\") should be \\\"Pay by quantity\\\", not be \\\"Annual package\\\", please check and modify the charge type, and refer to: https://help.aliyun.com/document_detail/134767.html\")\n\t\t} else if strings.Contains(err.Error(), NotSupportDiskCategory) {\n\t\t\treturn \"\", status.Error(codes.Internal, err.Error()+\", Disk(\"+diskID+\") is not supported by instance, please refer to: https://help.aliyun.com/document_detail/25378.html\")\n\t\t}\n\t\treturn \"\", status.Errorf(codes.Aborted, \"NodeStageVolume: Error happens to attach disk %s to instance %s, %v\", diskID, nodeID, err)\n\t}\n\n\t// Step 4: wait for disk attached\n\tlog.Log.Infof(\"AttachDisk: Waiting for Disk %s is Attached to instance %s with RequestId: %s\", diskID, nodeID, response.RequestId)\n\tif isSharedDisk {\n\t\tif err := waitForSharedDiskInStatus(20, time.Second*3, diskID, nodeID, DiskStatusAttached, ecsClient); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t} else {\n\t\tif err := waitForDiskInStatus(20, time.Second*3, diskID, DiskStatusInuse, ecsClient); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\t// devices indicated the volume devices associated with specific volumeid\n\tvar devicePaths []string\n\t// step 5: diff device with previous files under /dev\n\tif !GlobalConfigVar.ADControllerEnable {\n\t\tdevicePaths, _ = GetDeviceByVolumeID(diskID)\n\t\trootDevice, subDevice, err := GetRootSubDevicePath(devicePaths)\n\t\tif err == nil {\n\t\t\tlog.Log.Infof(\"AttachDisk: Successful attach disk %s to node %s device %s by DiskID/Device\", diskID, nodeID, devicePaths)\n\t\t\treturn ChooseDevice(rootDevice, subDevice), nil\n\t\t}\n\t\tafter := getDevices()\n\t\tdevicePaths := calcNewDevices(before, after)\n\n\t\t// BDF Disk Logical\n\t\tif IsVFNode() && len(devicePaths) == 0 {\n\t\t\tvar bdf string\n\t\t\tif bdf, err = bindBdfDisk(disk.DiskId); err != nil {\n\t\t\t\tif err := unbindBdfDisk(disk.DiskId); err != nil {\n\t\t\t\t\treturn \"\", status.Errorf(codes.Aborted, \"NodeStageVolume: failed to detach bdf: %v\", err)\n\t\t\t\t}\n\t\t\t\treturn \"\", status.Errorf(codes.Aborted, \"NodeStageVolume: failed to attach bdf: %v\", err)\n\t\t\t}\n\n\t\t\tdevicePaths, err = GetDeviceByVolumeID(diskID)\n\t\t\tdeviceName := \"\"\n\t\t\tif len(devicePaths) == 0 && bdf != \"\" {\n\t\t\t\tdeviceName, err = GetDeviceByBdf(bdf, true)\n\t\t\t}\n\t\t\tif err == nil && deviceName != \"\" {\n\t\t\t\tlog.Log.Infof(\"AttachDisk: Successful attach bdf disk %s to node %s device %s by DiskID/Device mapping\", diskID, nodeID, deviceName)\n\t\t\t\treturn deviceName, nil\n\t\t\t}\n\t\t\tafter = getDevices()\n\t\t\tdevicePaths = calcNewDevices(before, after)\n\t\t}\n\n\t\tif len(devicePaths) == 2 {\n\t\t\tif strings.HasPrefix(devicePaths[1], devicePaths[0]) {\n\t\t\t\tsubDevicePath := makeDevicePath(devicePaths[1])\n\t\t\t\trootDevicePath := makeDevicePath(devicePaths[0])\n\t\t\t\tif err := checkRootAndSubDeviceFS(rootDevicePath, subDevicePath); err != nil {\n\t\t\t\t\tlog.Log.Errorf(\"AttachDisk: volume %s get device with diff, and check partition error %s\", diskID, err.Error())\n\t\t\t\t\treturn \"\", err\n\t\t\t\t}\n\t\t\t\tlog.Log.Infof(\"AttachDisk: get 2 devices and select 1 device, list with: %v for volume: %s\", devicePaths, diskID)\n\t\t\t\treturn subDevicePath, nil\n\t\t\t} else if strings.HasPrefix(devicePaths[0], devicePaths[1]) {\n\t\t\t\tsubDevicePath := makeDevicePath(devicePaths[0])\n\t\t\t\trootDevicePath := makeDevicePath(devicePaths[1])\n\t\t\t\tif err := checkRootAndSubDeviceFS(rootDevicePath, subDevicePath); err != nil {\n\t\t\t\t\tlog.Log.Errorf(\"AttachDisk: volume %s get device with diff, and check partition error %s\", diskID, err.Error())\n\t\t\t\t\treturn \"\", err\n\t\t\t\t}\n\t\t\t\tlog.Log.Infof(\"AttachDisk: get 2 devices and select 0 device, list with: %v for volume: %s\", devicePaths, diskID)\n\t\t\t\treturn subDevicePath, nil\n\t\t\t}\n\t\t}\n\t\tif len(devicePaths) == 1 {\n\t\t\tlog.Log.Infof(\"AttachDisk: Successful attach disk %s to node %s device %s by diff\", diskID, nodeID, devicePaths[0])\n\t\t\treturn devicePaths[0], nil\n\t\t}\n\t\t// device count is not expected, should retry (later by detaching and attaching again)\n\t\treturn \"\", status.Error(codes.Aborted, \"AttachDisk: after attaching to disk, but fail to get mounted device, will retry later\")\n\t}\n\n\tlog.Log.Infof(\"AttachDisk: Successful attach disk %s to node %s\", diskID, nodeID)\n\treturn \"\", nil\n}", "title": "" }, { "docid": "c76dd7ab1ddeb87a4fb2f9cdb629c983", "score": "0.50158685", "text": "func (r *RK11) Attach(drive int, path string) error {\n\tbuf, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tunit := &RK05{\n\t\trdisk: buf,\n\t}\n\n\tif drive >= len(r.unit) {\n\t\treturn errors.New(\"tried to mount disk to unit > 7\")\n\t}\n\n\tr.unit[drive] = unit\n\n\t// r.unibus.controlConsole.WriteConsole(\"disk mounted\")\n\n\treturn nil\n}", "title": "" }, { "docid": "f61c8e93f9013e1b71593183d6964152", "score": "0.5006773", "text": "func (p *DiskAttachment) SetDisk(attr *Disk) {\n\tp.disk = attr\n}", "title": "" }, { "docid": "806a2aa39244bdc7bf364b2387014435", "score": "0.5006326", "text": "func (a *Management1) Interface() string {\n\treturn a.client.Config.Iface\n}", "title": "" }, { "docid": "21ff93b6f954462b0e3abe5ea0a5a60a", "score": "0.50038856", "text": "func (p *Action) SetDisk(attr *Disk) {\n\tp.disk = attr\n}", "title": "" }, { "docid": "dd6d70a09c2cedfb469a00ae283ba98a", "score": "0.4989746", "text": "func newDefDisk(i int) libvirtxml.DomainDisk {\n\treturn libvirtxml.DomainDisk{\n\t\tDevice: \"disk\",\n\t\tTarget: &libvirtxml.DomainDiskTarget{\n\t\t\tBus: \"virtio\",\n\t\t\tDev: fmt.Sprintf(\"vd%s\", diskLetterForIndex(i)),\n\t\t},\n\t\tDriver: &libvirtxml.DomainDiskDriver{\n\t\t\tName: \"qemu\",\n\t\t\tType: \"qcow2\",\n\t\t},\n\t}\n}", "title": "" }, { "docid": "265ea42b045a90cd029937d0c74432f9", "score": "0.4976918", "text": "func (d *Service) SetInterface(iface string) {\n\td.iface = iface\n}", "title": "" }, { "docid": "99bfcfc00a5961cc49a3a8494cdf36c9", "score": "0.49725077", "text": "func (dh *DeviceHandle) SetInterfaceAltSetting(\n\tinterfaceNum int,\n\talternateSetting int,\n) error {\n\terr := C.libusb_set_interface_alt_setting(\n\t\tdh.libusbDeviceHandle,\n\t\tC.int(interfaceNum),\n\t\tC.int(alternateSetting),\n\t)\n\tif err != 0 {\n\t\treturn ErrorCode(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4739928f14a70e94a92920df8bdd86c3", "score": "0.49663177", "text": "func SetInterfaceMTU(ifName string, mtu int) error {\n\treturn nil\n}", "title": "" }, { "docid": "f281517015dbcf03f1e9ddd4f427bc06", "score": "0.49628633", "text": "func setAttachedDevice(ad machine.AttachedDevice, in machine.Description) machine.Description {\n\tret := in.Copy()\n\tret.AttachedDevice = ad\n\treturn ret\n}", "title": "" }, { "docid": "0e8426faffe361cae09835bfe73158bb", "score": "0.4959264", "text": "func (v VirtualMachine) AttachDisk(ctx context.Context, id string, datastore *Datastore, controllerKey int32, unitNumber int32) error {\n\treq := types.AttachDisk_Task{\n\t\tThis: v.Reference(),\n\t\tDiskId: types.ID{Id: id},\n\t\tDatastore: datastore.Reference(),\n\t\tControllerKey: controllerKey,\n\t\tUnitNumber: &unitNumber,\n\t}\n\n\tres, err := methods.AttachDisk_Task(ctx, v.c, &req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttask := NewTask(v.c, res.Returnval)\n\treturn task.Wait(ctx)\n}", "title": "" }, { "docid": "471a6248a99e7ad89389504f65920c5b", "score": "0.49485967", "text": "func InitIO() {\n\t// Empty slots that aren't yet implemented\n\temptySlot(3)\n\temptySlot(4)\n\temptySlot(7)\n\n\t// Initialize slot 6 drive\n\tsystem.DriveState.Drive = 1\n\tsystem.DriveState.Spinning = false\n\tsystem.DriveState.Phase = 0\n\tsystem.DriveState.BytePosition = 0\n\tsystem.DriveState.Q6 = false\n\tsystem.DriveState.Q7 = false\n\n\t// Initialize video\n\tVideoState.TextMode = true\n\tVideoState.HiresMode = false\n\tVideoState.Mixed = false\n\n\tdisk.InitDiskImage()\n}", "title": "" }, { "docid": "d5bac558a43b0df93dc2460ef2d28065", "score": "0.4945467", "text": "func (dh *DeviceHandle) AttachKernelDriver(interfaceNum int) error {\n\terr := C.libusb_attach_kernel_driver(\n\t\tdh.libusbDeviceHandle, C.int(interfaceNum))\n\tif err != 0 {\n\t\treturn ErrorCode(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "805dd424ca272b688a2401a1abb87f69", "score": "0.49415013", "text": "func (o *BankConnectionInterface) SetInterface(v BankingInterface) {\n\to.Interface = v\n}", "title": "" }, { "docid": "bb6125c5ba2de60baef60123e5cd4aa8", "score": "0.4933886", "text": "func (p *VmBase) SetVirtioScsi(attr *VirtioScsi) {\n\tp.virtioScsi = attr\n}", "title": "" }, { "docid": "320f892ba7641c659b0d15fbb3ddb25f", "score": "0.49227402", "text": "func WithDevEUI(devEUI lorawan.EUI64) DeviceOption {\n\treturn func(d *Device) error {\n\t\td.devEUI = devEUI\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "63f0b80bf7961245b2b0b66f00b5bc98", "score": "0.491866", "text": "func (p *ImageTransfer) SetDisk(attr *Disk) {\n\tp.disk = attr\n}", "title": "" }, { "docid": "b194f8f1de75dbf6b0fe3e68731ca033", "score": "0.4905022", "text": "func (a *LEAdvertisement1) Interface() string {\n\treturn a.client.Config.Iface\n}", "title": "" }, { "docid": "71119a17a6254dae433efcd7cec5795c", "score": "0.48991564", "text": "func setInterface(storage map[string]interface{}) error {\n\tlog.WithField(\"type\", \"raspi\").Debug(\"SetInterface\")\n\tdevice := []string{\"eth0\", \"wlan0\"}\n\ti := config.Interfaces{\n\t\tAddress: \"192.168.0.254\",\n\t\tNetmask: \"255.255.255.0\",\n\t\tGateway: \"192.168.0.1\",\n\t\tDNS: \"192.168.0.1\",\n\t}\n\n\tif dialogs.YesNoDialog(\"Would you like to assign static IP address for your device?\") {\n\t\tfmt.Println(\"[+] Available network interface: \")\n\t\tnum := dialogs.SelectOneDialog(\"Please select a network interface: \", device)\n\t\tfmt.Println(\"[+] ********NOTE: ADJUST THESE VALUES ACCORDING TO YOUR LOCAL NETWORK CONFIGURATION********\")\n\n\t\tfmt.Printf(\"[+] Current values are:\\n \\t[+] Address:%s\\n\\t[+] Gateway:%s\\n\\t[+] Netmask:%s\\n\\t[+] DNS:%s\\n\",\n\t\t\ti.Address, i.Gateway, i.Netmask, i.DNS)\n\n\t\tif dialogs.YesNoDialog(\"Change values?\") {\n\t\t\tconfig.AskInterfaceParams(&i)\n\t\t}\n\n\t\tmask, _ := net.IPMask(net.ParseIP(i.Netmask).To4()).Size()\n\n\t\tstorage[config.Interface] = fmt.Sprintf(interfaceConfig, device[num], i.Address+\"/\"+strconv.Itoa(mask), i.Gateway, i.DNS)\n\n\t\tswitch device[num] {\n\t\tcase \"eth0\":\n\t\t\tfmt.Println(\"[+] Ethernet interface configuration was updated\")\n\t\tcase \"wlan0\":\n\t\t\tfmt.Println(\"[+] wifi interface configuration was updated\")\n\t\t}\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3a526045d3a3df1a559a7be5e6179da9", "score": "0.48811233", "text": "func (m *MockMachine) SetNIC(n int, nic virtualbox.NIC) error {\n\treturn nil\n}", "title": "" }, { "docid": "ed065e8c0e16d9071c4d57e813cd30f7", "score": "0.48425114", "text": "func (p *Vm) SetVirtioScsi(attr *VirtioScsi) {\n\tp.virtioScsi = attr\n}", "title": "" }, { "docid": "828336cac800bef96cc5148a05465580", "score": "0.48411834", "text": "func (d *SCSIDev) fillDiskInfoUsingSI(diskDetails DiskAttr) (DiskAttr, error) {\n\t// Standard SCSI INQUIRY command\n\tInqRes, err := d.scsiInquiry()\n\tif err != nil {\n\t\treturn diskDetails, err\n\t}\n\tdiskDetails.Compliance = InqRes.getValue()[Compliance]\n\tdiskDetails.Vendor = InqRes.getValue()[Vendor]\n\tdiskDetails.ModelNumber = InqRes.getValue()[ModelNumber]\n\tdiskDetails.FirmwareRevision = InqRes.getValue()[FirmwareRev]\n\tdiskDetails.SerialNumber = InqRes.getValue()[SerialNumber]\n\n\treturn diskDetails, nil\n}", "title": "" }, { "docid": "4ec9ed741f1d373be174228136bbc2b1", "score": "0.48411617", "text": "func (p *Permission) SetDisk(attr *Disk) {\n\tp.disk = attr\n}", "title": "" }, { "docid": "5f00743309fc971637959054862608ed", "score": "0.4815663", "text": "func (p *Disk) SetSgio(attr ScsiGenericIO) {\n\tp.sgio = &attr\n}", "title": "" }, { "docid": "468ea3fdc3edeedb46eb495381e159e7", "score": "0.48090568", "text": "func attachSharedDisk(tenantUserUID, diskID, nodeID string) (string, error) {\n\tlog.Log.Infof(\"AttachDisk: Starting Do AttachSharedDisk: DiskId: %s, InstanceId: %s, Region: %v\", diskID, nodeID, GlobalConfigVar.Region)\n\n\tecsClient, err := getEcsClientByID(\"\", tenantUserUID)\n\t// Step 1: check disk status\n\tdisk, err := findDiskByID(diskID, ecsClient)\n\tif err != nil {\n\t\tlog.Log.Errorf(\"AttachDisk: find disk: %s with error: %s\", diskID, err.Error())\n\t\treturn \"\", status.Errorf(codes.Internal, \"AttachSharedDisk: find disk: %s with error: %s\", diskID, err.Error())\n\t}\n\tif disk == nil {\n\t\treturn \"\", status.Errorf(codes.Internal, \"AttachSharedDisk: can't find disk: %s, check the disk region, disk exist or not, and the csi access auth\", diskID)\n\t}\n\n\tfor _, instance := range disk.MountInstances.MountInstance {\n\t\tif instance.InstanceId == nodeID {\n\t\t\tlog.Log.Infof(\"AttachSharedDisk: Successful attach disk %s to node %s\", diskID, nodeID)\n\t\t\treturn \"\", nil\n\t\t}\n\t}\n\n\t// Step 3: Attach Disk, list device before attach disk\n\tattachRequest := ecs.CreateAttachDiskRequest()\n\tattachRequest.InstanceId = nodeID\n\tattachRequest.DiskId = diskID\n\tresponse, err := ecsClient.AttachDisk(attachRequest)\n\tif err != nil {\n\t\tif strings.Contains(err.Error(), DiskLimitExceeded) {\n\t\t\treturn \"\", status.Error(codes.Internal, err.Error()+\", Node(\"+nodeID+\")exceed the limit attachments of disk\")\n\t\t} else if strings.Contains(err.Error(), DiskNotPortable) {\n\t\t\treturn \"\", status.Error(codes.Internal, err.Error()+\", Disk(\"+diskID+\") should be \\\"Pay by quantity\\\", not be \\\"Annual package\\\", please check and modify the charge type, and refer to: https://help.aliyun.com/document_detail/134767.html\")\n\t\t} else if strings.Contains(err.Error(), NotSupportDiskCategory) {\n\t\t\treturn \"\", status.Error(codes.Internal, err.Error()+\", Disk(\"+diskID+\") is not supported by instance, please refer to: https://help.aliyun.com/document_detail/25378.html\")\n\t\t}\n\t\treturn \"\", status.Errorf(codes.Aborted, \"AttachSharedDisk: Error happens to attach disk %s to instance %s, %v\", diskID, nodeID, err)\n\t}\n\n\t// Step 4: wait for disk attached\n\tlog.Log.Infof(\"AttachSharedDisk: Waiting for Disk %s is Attached to instance %s with RequestId: %s\", diskID, nodeID, response.RequestId)\n\tif err := waitForSharedDiskInStatus(20, time.Second*3, diskID, nodeID, DiskStatusAttached, ecsClient); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tlog.Log.Infof(\"AttachSharedDisk: Successful attach disk %s to node %s\", diskID, nodeID)\n\treturn \"\", nil\n}", "title": "" }, { "docid": "ad29c93de2994e5a8ef48b1604af7c60", "score": "0.48064268", "text": "func setupInterface() (string, error) {\n\tlo, err := discoverLoopback()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tlog.Debugf(\"LOOPBACK INTERFACE: %s\", lo)\n\n\tif err := addAddress(lo, EC2MetadataAddress); err != nil {\n\t\tif err := removeAddress(lo, EC2MetadataAddress); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tif err := addAddress(lo, EC2MetadataAddress); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\treturn lo, err\n}", "title": "" }, { "docid": "fbc78b81fbf4a55387e5c841c7942a54", "score": "0.47961918", "text": "func (f *DirectIO) IOAttach(set *FIFOSet) (IO, error) {\n\treturn f, nil\n}", "title": "" }, { "docid": "3b8f24cdf6603c8ab8e8f1973f0cb98c", "score": "0.47866935", "text": "func (s *GattDescriptor1) Interface() string {\n\treturn gatt.GattDescriptor1Interface\n}", "title": "" }, { "docid": "29c520170048d2a7b7931955b2d955b0", "score": "0.4782083", "text": "func (in *ActionNodeUpdateInput) SetNetInterface(value string) *ActionNodeUpdateInput {\n\tin.NetInterface = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"NetInterface\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "5ed042d3863bddfbb99ce6902b780d85", "score": "0.47812206", "text": "func (o LocalDiskOutput) Interface() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LocalDisk) *string { return v.Interface }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "72a927041c7473bfe1e987791ca502d3", "score": "0.47774807", "text": "func Attach(jsonOpts string, nodeName string) (internal.Response, error) {\n\tovirt, err := newOvirt()\n\tif err != nil {\n\t\treturn internal.FailedResponseFromError(err), err\n\t}\n\tr, e := internal.AttachRequestFrom(jsonOpts)\n\tif e != nil {\n\t\treturn internal.FailedResponse, e\n\t}\n\n\tvmId, err := getSystemUUIDByNodeName(nodeName)\n\tif err != nil {\n\t\treturn internal.FailedResponseFromError(err), err\n\t}\n\n\tvm, err := ovirt.GetVMById(vmId)\n\t// 0. validation - Attach size is legal?\n\t// 1. query if the disk exists\n\t// 2. if it exist, is it already attached to a VM (perhaps a detach is in progress)\n\t// 3. if it is attached, is this vm is this node? if not return error.\n\t// 4. not? create it and attach to the vm\n\n\tif err != nil {\n\t\treturn internal.FailedResponseFromError(err), err\n\t}\n\t// vm exist?\n\tif vm.Id == \"\" {\n\t\te := fmt.Errorf(\"VM %s doesn't exist\", nodeName)\n\t\treturn internal.FailedResponseFromError(e), e\n\t}\n\n\tdiskResult, err := ovirt.GetDiskByName(fromk8sNameToOvirt(r.VolumeName))\n\tif err != nil {\n\t\treturn internal.FailedResponseFromError(err), err\n\t}\n\n\tif len(diskResult.Disks) == 0 {\n\t\treturn internal.FailedResponseFromError(fmt.Errorf(\"disk %s doesn't exist\", r.VolumeName)), err\n\t}\n\n\t// fetch the disk attachment on the VM\n\tattachment, err := ovirt.GetDiskAttachment(vm.Id, diskResult.Disks[0].Id)\n\tif err != nil {\n\t\t_, noAttachment := err.(internal.NotFound)\n\t\tif noAttachment {\n\t\t\tattachment, err =\n\t\t\t\tovirt.CreateDisk(fromk8sNameToOvirt(r.VolumeName), r.StorageDomain, r.Mode == \"ro\", vm.Id, diskResult.Disks[0].Id, \"virtio_scsi\")\n\t\t\tif err != nil {\n\t\t\t\treturn internal.FailedResponseFromError(err), err\n\t\t\t}\n\t\t} else {\n\t\t\treturn internal.FailedResponseFromError(err), err\n\t\t}\n\t}\n\treturn responseFromDiskAttachment(attachment.Id, attachment.Interface), err\n}", "title": "" }, { "docid": "c3ee64e6b54b9835778bc8511572e2a3", "score": "0.47763103", "text": "func (o *OpenStack) AttachVolume(config *Config, image, name, mount string) error {\n\tcomputeClient, err := o.getComputeClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvolumesClient, err := o.getVolumesClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvolume, err := o.getVolumeByName(volumesClient, name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserver, err := o.findInstance(image)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcreateOpts := volumeattach.CreateOpts{\n\t\tDevice: \"/dev/\" + mount,\n\t\tVolumeID: volume.ID,\n\t}\n\n\t_, err = volumeattach.Create(computeClient, server.ID, createOpts).Extract()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3003c6389fedf03a9d6d0f307c0898c6", "score": "0.47598833", "text": "func (h *NetLinkHandler) SetInterfaceDown(ifName string) error {\n\tlink, err := h.GetLinkByName(ifName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := h.LinkSetDown(link); err != nil {\n\t\treturn errors.Wrapf(err, \"LinkSetDown %v\", link)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "94f889e4e910b87c058626a4915d2730", "score": "0.4757764", "text": "func (p *Template) SetVirtioScsi(attr *VirtioScsi) {\n\tp.virtioScsi = attr\n}", "title": "" }, { "docid": "f7b73ffd9e640508794008c72ab5b823", "score": "0.47523144", "text": "func (p *InstanceType) SetVirtioScsi(attr *VirtioScsi) {\n\tp.virtioScsi = attr\n}", "title": "" }, { "docid": "3f8ba4a84a7ba58a8bdc39d063ff4053", "score": "0.47438064", "text": "func setupDisk(ctx context.Context, disk *types.Disk, diskIndex int, imageSize int64, tmpDirectory string) (err error) {\n\t// attempt to create the file, will leave already existing files alone.\n\t// os.Truncate requires the file to already exist\n\tvar (\n\t\tout *os.File\n\t\ttmp []byte\n\t)\n\tif out, err = os.Create(disk.ImageFile); err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\t// Delete the image file if this function exits with an error\n\t\tif err != nil {\n\t\t\tos.Remove(disk.ImageFile)\n\t\t}\n\t}()\n\tout.Close()\n\n\t// Truncate the file to the given size\n\tif err = os.Truncate(disk.ImageFile, imageSize); err != nil {\n\t\treturn err\n\t}\n\n\t// Attach the file to a loopback device\n\ttmp, err = run(ctx, \"losetup\", \"-Pf\", \"--show\", disk.ImageFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdisk.Device = strings.TrimSpace(string(tmp))\n\tloopdev := disk.Device\n\tdefer func() {\n\t\tif err != nil {\n\t\t\t_ = destroyDevice(loopdev)\n\t\t}\n\t}()\n\n\t// Avoid race with kernel by waiting for loopDevice creation to complete\n\tif _, err = run(ctx, \"udevadm\", \"settle\"); err != nil {\n\t\treturn fmt.Errorf(\"settling devices: %v\", err)\n\t}\n\n\tif err = createPartitionTable(ctx, disk.Device, disk.Partitions); err != nil {\n\t\treturn err\n\t}\n\n\tfor _, partition := range disk.Partitions {\n\t\tif partition.TypeCode == \"blank\" || partition.FilesystemType == \"\" || partition.FilesystemType == \"swap\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tpartition.MountPath = filepath.Join(tmpDirectory, fmt.Sprintf(\"hd%dp%d\", diskIndex, partition.Number))\n\t\tif err = os.Mkdir(partition.MountPath, 0777); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tmountPath := partition.MountPath\n\t\tdefer func() {\n\t\t\t// Delete the mount path if this function exits with an error\n\t\t\tif err != nil {\n\t\t\t\tos.RemoveAll(mountPath)\n\t\t\t}\n\t\t}()\n\n\t\tpartition.Device = fmt.Sprintf(\"%sp%d\", disk.Device, partition.Number)\n\t\tif err = formatPartition(ctx, partition); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "059f3c2055af036293d7375698f131f7", "score": "0.47394183", "text": "func (do *DigitalOcean) AttachVolume(ctx *Context, image, name, mount string) error {\n\treturn nil\n}", "title": "" }, { "docid": "1d3c9956ece222665e9c43aaef37bb4b", "score": "0.47155684", "text": "func (h *NetLinkHandler) SetInterfaceMac(ifName string, macAddress string) error {\n\tlink, err := h.GetLinkByName(ifName)\n\tif err != nil {\n\t\treturn err\n\t}\n\thwAddr, err := net.ParseMAC(macAddress)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := h.LinkSetHardwareAddr(link, hwAddr); err != nil {\n\t\treturn errors.Wrapf(err, \"LinkSetHardwareAddr %v\", hwAddr)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9753659a90e8ae5abdaa6ad2681c72a2", "score": "0.47088233", "text": "func (*NetworkInterface) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_vmmigration_v1_vmmigration_proto_rawDescGZIP(), []int{58}\n}", "title": "" }, { "docid": "6ce2d53adb64a1e0e75def0a2a96131a", "score": "0.47065237", "text": "func (q *qemu) addNetDevice(devType, ifaceName, mac string, hostPorts []string, udpPorts []string) {\n\tif OPSD != \"\" {\n\t\tdv := device{\n\t\t\tdriver: \"virtio-net-pci\",\n\t\t\tdevtype: \"netdev=vmnet\",\n\t\t}\n\n\t\tndv := netdev{\n\t\t\tnettype: \"vmnet-bridged\",\n\t\t\tid: \"vmnet\",\n\t\t}\n\n\t\tdv.mac = generateMac()\n\t\tndv.ifname = \"en0\"\n\n\t\tq.devices = append(q.devices, dv)\n\t\tq.ifaces = append(q.ifaces, ndv)\n\n\t} else {\n\t\ti := len(q.ifaces)\n\t\tsi := strconv.Itoa(i)\n\n\t\tid := fmt.Sprintf(\"n%d\", i)\n\t\tdv := device{\n\t\t\tdriver: \"virtio-net\",\n\t\t\tdevtype: \"netdev\",\n\t\t\tdevid: id,\n\t\t\taddr: \"0x\" + si,\n\t\t}\n\t\tndv := netdev{\n\t\t\tnettype: devType,\n\t\t\tid: id,\n\t\t}\n\n\t\tif mac == \"\" {\n\t\t\tdv.mac = generateMac()\n\t\t}\n\n\t\tif devType != \"user\" {\n\t\t\tndv.ifname = ifaceName\n\t\t} else {\n\t\t\t// hack - FIXME\n\t\t\t// this is user-mode\n\t\t\tif i == 0 {\n\t\t\t\tfor _, p := range hostPorts {\n\t\t\t\t\tndv.hports = append(ndv.hports, portfwd{port: p, proto: \"tcp\"})\n\t\t\t\t}\n\t\t\t\tfor _, p := range udpPorts {\n\t\t\t\t\tndv.hports = append(ndv.hports, portfwd{port: p, proto: \"udp\"})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tq.devices = append(q.devices, dv)\n\t\tq.ifaces = append(q.ifaces, ndv)\n\t}\n}", "title": "" }, { "docid": "07a8daa040f3f7d85a28605cb4f6938d", "score": "0.4705892", "text": "func (a *MediaFolder1) Interface() string {\n\treturn a.client.Config.Iface\n}", "title": "" }, { "docid": "f30292c6964f1094f570bedc14197125", "score": "0.4702098", "text": "func AttachNvme(pciAddr pciaddr.PCIAddress) (nvme *Nvme, e error) {\n\tnvme = &Nvme{pciAddr: pciAddr}\n\n\tvar trid C.struct_spdk_nvme_transport_id\n\ttrid.trtype = C.SPDK_NVME_TRANSPORT_PCIE\n\tcopy(cptr.AsByteSlice(trid.traddr[:]), pciAddr.String())\n\tctrlr := C.spdk_nvme_connect(&trid, nil, 0)\n\tif ctrlr == nil {\n\t\treturn nil, errors.New(\"spdk_nvme_connect error\")\n\t}\n\tnvme.flags = uint64(C.spdk_nvme_ctrlr_get_flags(ctrlr))\n\tC.spdk_nvme_detach(ctrlr)\n\n\tinitBdevLib()\n\targs := struct {\n\t\tName string `json:\"name\"`\n\t\tTrType string `json:\"trtype\"`\n\t\tTrAddr string `json:\"traddr\"`\n\t}{\n\t\tName: nvme.ControllerName(),\n\t\tTrType: \"pcie\",\n\t\tTrAddr: pciAddr.String(),\n\t}\n\n\tvar namespaces []string\n\tif e = spdkenv.RPC(\"bdev_nvme_attach_controller\", args, &namespaces); e != nil {\n\t\treturn nil, e\n\t}\n\n\tfor _, nn := range namespaces {\n\t\tnvme.Namespaces = append(nvme.Namespaces, &NvmeNamespace{\n\t\t\tinfo: mustFind(nn),\n\t\t\tnvme: nvme,\n\t\t})\n\t}\n\treturn nvme, nil\n}", "title": "" }, { "docid": "8da9d63a9119679dfb1d5cd8ad471e5d", "score": "0.46931595", "text": "func (p *DiskSnapshot) SetDisk(attr *Disk) {\n\tp.disk = attr\n}", "title": "" }, { "docid": "f3844cb6553965f03392112298e33e27", "score": "0.46889424", "text": "func (p *Snapshot) SetVirtioScsi(attr *VirtioScsi) {\n\tp.virtioScsi = attr\n}", "title": "" }, { "docid": "8f0c2d9c1ff9d7fca5b2ff7a71e9790a", "score": "0.46792644", "text": "func WaitNetworkInterface(interfaceName string) Option {\n\treturn func(sf *ServiceDefinition) {\n\t\tinterfaceDeviceUnit := fmt.Sprintf(\"sys-subsystem-net-devices-%s.device\", interfaceName)\n\n\t\t// https://unix.stackexchange.com/a/417839\n\t\t// *BindsTo* makes the *After* even stronger. bind means that if the bound dependency goes\n\t\t// down, so should us go too. which is desirable with networked dependencies.\n\t\tBindsTo(interfaceDeviceUnit)(sf)\n\t\tAfter(interfaceDeviceUnit)(sf)\n\t}\n}", "title": "" }, { "docid": "e0d0917f2da53eff0ed21c5ca2c994ab", "score": "0.46784407", "text": "func SetInterfaceMac(ifName string, macAddress string) error {\n\treturn nil\n}", "title": "" }, { "docid": "f569613f944a701b895ce276c19afd54", "score": "0.4669825", "text": "func AttachNetwork(name string, bridge string, nic1 string, nic2 string, remote Remote) error {\n\tlxdServer, err := GetLXDServer(remote.key, remote.cert, remote.remoteURL)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnetwork, _, err := lxdServer.GetNetwork(bridge)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdevice := map[string]string{\n\t\t\"type\": \"nic\",\n\t\t\"nictype\": \"macvlan\",\n\t\t\"parent\": bridge,\n\t}\n\n\tif network.Type == \"bridge\" {\n\t\tdevice[\"nictype\"] = \"bridged\"\n\t}\n\n\tdevice[\"name\"] = nic2\n\n\tinst, etag, err := lxdServer.GetInstance(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, ok := inst.Devices[nic1]\n\tif ok {\n\t\treturn errors.New(\"Device already exists: \" + nic1)\n\t}\n\n\tinst.Devices[nic1] = device\n\n\top, err := lxdServer.UpdateInstance(name, inst.Writable(), etag)\n\n\terr = op.Wait()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "67a23ec289e93c56d9393cb2e04f10d6", "score": "0.46685576", "text": "func (c *CLIClient) Attach(id string) error {\n\tcmd := append(c.baseCmd, \"attach\", id)\n\treturn silentRun(cmd)\n}", "title": "" }, { "docid": "744166f928e3df20f484872d410ad1ed", "score": "0.4668456", "text": "func (dh *DeviceHandle) ClaimInterface(interfaceNum int) error {\n\terr := C.libusb_claim_interface(dh.libusbDeviceHandle, C.int(interfaceNum))\n\tif err != 0 {\n\t\treturn ErrorCode(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c702bcc333af9e92cddb26952a7b90ff", "score": "0.465568", "text": "func (c *Client) SetBootSourceByType(ctx context.Context) error {\n\tlog.Debug(\"Setting boot device to 'VCD-DVD'.\")\n\tmanagerID, err := redfish.GetManagerID(\n\t\tredfish.SetAuth(ctx, c.username, c.password),\n\t\tc.RedfishAPI, c.NodeID())\n\tif err != nil {\n\t\tlog.Debugf(\"Failed to retrieve manager ID for node '%s'.\", c.NodeID())\n\t\treturn err\n\t}\n\n\t// NOTE(drewwalters96): Setting the boot device to a virtual media type requires an API request to the iDRAC\n\t// actions API. The request is made below using the same HTTP client used by the Redfish API and exposed by the\n\t// standard airshipctl Redfish client. Only iDRAC 9 >= 3.3 is supports this endpoint.\n\n\turl := fmt.Sprintf(endpointImportSysCFG, c.RedfishCFG.Servers[0].URL, managerID)\n\treq, err := http.NewRequest(http.MethodPost, url, bytes.NewBufferString(vCDBootRequestBody))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Accept\", \"application/json\")\n\tif len(c.password+c.username) != 0 {\n\t\treq.SetBasicAuth(c.username, c.password)\n\t}\n\n\thttpResp, err := c.RedfishCFG.HTTPClient.Do(req)\n\tif httpResp.StatusCode != http.StatusAccepted {\n\t\tbody, ok := ioutil.ReadAll(httpResp.Body)\n\t\tif ok != nil {\n\t\t\tlog.Debugf(\"Malformed iDRAC response: %s\", body)\n\t\t\treturn redfish.ErrRedfishClient{Message: \"Unable to set boot device. Malformed iDRAC response.\"}\n\t\t}\n\n\t\tvar iDRACResp iDRACAPIRespErr\n\t\tok = json.Unmarshal(body, &iDRACResp)\n\t\tif ok != nil {\n\t\t\tlog.Debugf(\"Malformed iDRAC response: %s\", body)\n\t\t\treturn redfish.ErrRedfishClient{Message: \"Unable to set boot device. Malformed iDrac response.\"}\n\t\t}\n\n\t\treturn redfish.ErrRedfishClient{\n\t\t\tMessage: fmt.Sprintf(\"Unable to set boot device. %s\", iDRACResp.Err.ExtendedInfo[0]),\n\t\t}\n\t} else if err != nil {\n\t\treturn redfish.ErrRedfishClient{Message: fmt.Sprintf(\"Unable to set boot device. %v\", err)}\n\t}\n\n\tlog.Debug(\"Successfully set boot device.\")\n\tdefer httpResp.Body.Close()\n\n\treturn nil\n}", "title": "" }, { "docid": "ec6bd2386737da81ca90659453ad94ca", "score": "0.46506846", "text": "func AttachVolume(ip, volName, containerName string) (string, error) {\n\tlog.Printf(\"Attaching volume [%s] on VM [%s]\\n\", volName, ip)\n\treturn ssh.InvokeCommand(ip, dockercli.RunContainer+\" --volume-driver vsphere -d -v \"+volName+\n\t\t\":\"+dockercli.ContainerMountPoint+\" --name \"+containerName+dockercli.TestContainer)\n}", "title": "" }, { "docid": "31f412b455b6a5f2f208c2c6849cc729", "score": "0.46458218", "text": "func (*PartitionDiskRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_kubernetes_csi_csi_proxy_client_api_disk_v1beta3_api_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "76f168e2649cb1ef77c41376a6e9ac6f", "score": "0.46396258", "text": "func WithVHostSCSI() Option {\n\treturn func(o *opts) {\n\t\to.controller = true\n\t}\n}", "title": "" }, { "docid": "3167c67b1573e107cf7f3f1d3d5a334b", "score": "0.46324494", "text": "func (handler *NetLinkHandler) SetInterfaceDown(ifName string) error {\n\tlink, err := handler.GetLinkByName(ifName)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn netlink.LinkSetDown(link)\n}", "title": "" }, { "docid": "e7b4792fd837db5e31c0c7dfd85a8b9c", "score": "0.4621563", "text": "func EthernetInterface(node *goeapi.Node) *EthernetInterfaceEntity {\n\treturn &EthernetInterfaceEntity{&BaseInterfaceEntity{&AbstractBaseEntity{node}}}\n}", "title": "" }, { "docid": "a32d3e3c56dcd84e95d7a88ccc890058", "score": "0.4620022", "text": "func (macvln *MacVlanLink) MasterNetInterface() *net.Interface {\n\treturn nil\n}", "title": "" }, { "docid": "489fc37db81fb5f9db4947ef3cc1c641", "score": "0.46182343", "text": "func (ec2i *FakeEC2Impl) AttachVolume(request *ec2.AttachVolumeInput) (resp *ec2.VolumeAttachment, err error) {\n\tpanic(\"Not implemented\")\n}", "title": "" }, { "docid": "ac544901ec3792487ad583c2f354f081", "score": "0.46117184", "text": "func (r *NetworkInterfaceSubresource) Create(l object.VirtualDeviceList) ([]types.BaseVirtualDeviceConfigSpec, error) {\n\tlog.Printf(\"[DEBUG] %s: Running create\", r)\n\tvar spec []types.BaseVirtualDeviceConfigSpec\n\tctlr, err := r.ControllerForCreateUpdate(l, SubresourceControllerTypePCI, 0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// govmomi has helpers that allow the easy fetching of a network's backing\n\t// info, once we actually know what that backing is. Set all of that stuff up\n\t// now.\n\tnet, err := network.FromID(r.client, r.Get(\"network_id\").(string))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbctx, bcancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout)\n\tdefer bcancel()\n\tbacking, err := net.EthernetCardBackingInfo(bctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdevice, err := l.CreateEthernetCard(r.Get(\"adapter_type\").(string), backing)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// CreateEthernetCard does not attach stuff, however, assuming that you will\n\t// let vSphere take care of the attachment and what not, as there is usually\n\t// only one PCI device per virtual machine and their tools don't really care\n\t// about state. Terraform does though, so we need to not only set but also\n\t// track that stuff.\n\tif err := r.assignEthernetCard(l, device, ctlr); err != nil {\n\t\treturn nil, err\n\t}\n\t// Ensure the device starts connected\n\terr = l.Connect(device)\n\tif err != nil && !strings.Contains(err.Error(), \"is not connectable\") {\n\t\treturn nil, err\n\t}\n\n\t// Set base-level card bits now\n\tcard := device.(types.BaseVirtualEthernetCard).GetVirtualEthernetCard()\n\tcard.Key = l.NewKey()\n\n\t// Set the rest of the settings here.\n\tif r.Get(\"use_static_mac\").(bool) {\n\t\tcard.AddressType = string(types.VirtualEthernetCardMacTypeManual)\n\t\tcard.MacAddress = r.Get(\"mac_address\").(string)\n\t}\n\tversion := viapi.ParseVersionFromClient(r.client)\n\tif version.Newer(viapi.VSphereVersion{Product: version.Product, Major: 6}) {\n\t\talloc := &types.VirtualEthernetCardResourceAllocation{\n\t\t\tLimit: structure.Int64Ptr(int64(r.Get(\"bandwidth_limit\").(int))),\n\t\t\tReservation: structure.Int64Ptr(int64(r.Get(\"bandwidth_reservation\").(int))),\n\t\t\tShare: types.SharesInfo{\n\t\t\t\tShares: int32(r.Get(\"bandwidth_share_count\").(int)),\n\t\t\t\tLevel: types.SharesLevel(r.Get(\"bandwidth_share_level\").(string)),\n\t\t\t},\n\t\t}\n\t\tcard.ResourceAllocation = alloc\n\t}\n\n\t// Done here. Save ID, push the device to the new device list and return.\n\tif err := r.SaveDevIDs(device, ctlr); err != nil {\n\t\treturn nil, err\n\t}\n\tdspec, err := object.VirtualDeviceList{device}.ConfigSpec(types.VirtualDeviceConfigSpecOperationAdd)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tspec = append(spec, dspec...)\n\tlog.Printf(\"[DEBUG] %s: Device config operations from create: %s\", r, DeviceChangeString(spec))\n\tlog.Printf(\"[DEBUG] %s: Create finished\", r)\n\treturn spec, nil\n}", "title": "" }, { "docid": "fdf1cf01a5f53f8759f2122fa2f00f01", "score": "0.46049932", "text": "func EnableHID(callback func()) {\n\tusbDescriptor = descriptorCDCHID\n\tendPoints = []uint32{usb_ENDPOINT_TYPE_CONTROL,\n\t\t(usb_ENDPOINT_TYPE_INTERRUPT | usbEndpointIn),\n\t\t(usb_ENDPOINT_TYPE_BULK | usbEndpointOut),\n\t\t(usb_ENDPOINT_TYPE_BULK | usbEndpointIn),\n\t\t(usb_ENDPOINT_TYPE_INTERRUPT | usbEndpointIn)}\n\n\thidCallback = callback\n}", "title": "" }, { "docid": "e6e018c43cd9015cd2d382deb74c9341", "score": "0.4599537", "text": "func (i *Interfaces) SetInternalNIC() {\n\tParseTmpl(i, internalNIC, \"internal\", \"/etc/network/interfaces.d/\"+i.InternalNIC+\".cfg\", 0644)\n}", "title": "" }, { "docid": "1155d592b85f9ff0d9d6de395b199d6b", "score": "0.45948774", "text": "func (cl *Client) VolumeAttach(ctx context.Context, vaa *csp.VolumeAttachArgs) (*csp.Volume, error) {\n\tgroupName := cl.getResourceGroup(vaa.ProvisioningAttributes)\n\tdc := cl.newDisksClient()\n\tvmc := cl.newVMClient()\n\tvar d compute.Disk\n\tvar vm compute.VirtualMachine\n\t// TBD: Handle VM Scaleable Sets\n\top := func() (bool, error) {\n\t\tvar err error\n\t\tcl.csp.dbgF(\"AZURE fetching disk[%s] in group[%s]\", vaa.VolumeIdentifier, groupName)\n\t\td, err = dc.Get(ctx, groupName, vaa.VolumeIdentifier)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tcl.csp.dbgF(\"AZURE fetching node[%s] in group[%s]\", vaa.NodeIdentifier, groupName)\n\t\tvm, err = vmc.Get(ctx, groupName, vaa.NodeIdentifier, compute.InstanceView)\n\t\tif err == nil {\n\t\t\t// TBD: handle case of disk already attached to\n\t\t\t// - this host: error or consider done? if latter must get lun\n\t\t\t// - other host\n\t\t\tdisks := *vm.StorageProfile.DataDisks\n\t\t\t// Find the next available lun (adapted from K8s)\n\t\t\tused := make([]bool, MaxLunsPerVM)\n\t\t\tfor _, disk := range disks {\n\t\t\t\tif disk.Lun != nil {\n\t\t\t\t\tused[*disk.Lun] = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tlun := int32(-1)\n\t\t\tfor k, v := range used {\n\t\t\t\tif !v {\n\t\t\t\t\tlun = int32(k)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif lun == -1 {\n\t\t\t\treturn false, fmt.Errorf(\"no more LUNs available\")\n\t\t\t}\n\t\t\tcl.csp.dbgF(\"AZURE attaching disk[%s] to node[%s] in group[%s]: lun[%d]\", vaa.VolumeIdentifier, vaa.NodeIdentifier, groupName, lun)\n\t\t\tdd := compute.DataDisk{\n\t\t\t\tName: d.Name,\n\t\t\t\tLun: to.Int32Ptr(lun),\n\t\t\t\tCreateOption: compute.DiskCreateOptionTypesAttach,\n\t\t\t\tDiskSizeGB: d.DiskSizeGB,\n\t\t\t\tManagedDisk: &compute.ManagedDiskParameters{\n\t\t\t\t\tID: d.ID,\n\t\t\t\t},\n\t\t\t}\n\t\t\tdisks = append(disks, dd)\n\t\t\tvm.StorageProfile.DataDisks = &disks\n\t\t\tvar future azuresdk.VMCreateOrUpdateFuture\n\t\t\tfuture, err = vmc.CreateOrUpdate(ctx, groupName, vaa.NodeIdentifier, vm)\n\t\t\tif err == nil {\n\t\t\t\terr = future.WaitForCompletionRef(ctx, vmc)\n\t\t\t\tif err == nil {\n\t\t\t\t\tvm, err = future.Result(vmc)\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\treturn false, nil\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false, err // TBD: retry cases\n\t}\n\tif err := cl.doWithRetry(op); err != nil {\n\t\treturn nil, err\n\t}\n\t// refresh the disk\n\tcl.csp.dbgF(\"AZURE fetching disk[%s] in group[%s]\", vaa.VolumeIdentifier, groupName)\n\td, err := dc.Get(ctx, groupName, vaa.VolumeIdentifier)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn azureDiskToVolume(&d, &vm), nil\n}", "title": "" }, { "docid": "c189357fa971e6302a612128cfac9fa6", "score": "0.45911694", "text": "func SetupGlusterDiskFile(serverconf *hummingbird.IniFile, logger *syslog.Writer) (map[string]interface{}, error) {\n\thashPathPrefix, hashPathSuffix, _ := hummingbird.GetHashPrefixAndSuffix()\n\tobjRing, _ := hummingbird.GetRing(\"object\", hashPathPrefix, hashPathSuffix)\n\tbindPort := int(serverconf.GetInt(\"app:object-server\", \"bind_port\", 6000))\n\tlocalDevices, _ := objRing.LocalDevices(bindPort)\n\n\tglobals := make(map[string]interface{})\n\tglobals[\"disableFallocate\"] = serverconf.GetBool(\"app:object-server\", \"disable_fallocate\", false)\n\tglobals[\"glusterVolumes\"] = make(map[string]*gfapi.Volume)\n\n\tvar ret int\n\tvar err error\n\tfor _, dev := range localDevices {\n\t\tglobals[\"glusterVolumes\"].(map[string]*gfapi.Volume)[dev.Device] = new(gfapi.Volume)\n\n\t\tret = globals[\"glusterVolumes\"].(map[string]*gfapi.Volume)[dev.Device].Init(\"localhost\", dev.Device)\n\t\tif ret < 0 {\n\t\t\treturn nil, errors.New(fmt.Sprintf(\"Volume %s: Init() failed with ret = %d\", dev.Device, ret))\n\t\t}\n\n\t\tret, err = globals[\"glusterVolumes\"].(map[string]*gfapi.Volume)[dev.Device].SetLogging(\"\", gfapi.LogDebug)\n\t\tif ret < 0 {\n\t\t\t//FIXME: There's a bug in SetLogging: err != nil even when ret = 0\n\t\t\treturn nil, errors.New(fmt.Sprintf(\"Volume %s: SetLogging() failed with ret = %d, error = %s\", dev.Device, ret, err.Error()))\n\t\t}\n\n\t\tret = globals[\"glusterVolumes\"].(map[string]*gfapi.Volume)[dev.Device].Mount()\n\t\tif ret < 0 {\n\t\t\treturn nil, errors.New(fmt.Sprintf(\"Volume %s: Mount() failed with ret = %d\", dev.Device, ret))\n\t\t}\n\n\t\tlogger.Info(fmt.Sprintf(\"GlusterFS volume %s sucessfully virtual mounted.\", dev.Device))\n\t}\n\n\treturn globals, nil\n}", "title": "" }, { "docid": "dabd8139097a013badf7a640c186c619", "score": "0.45803", "text": "func (s *BaseCadenceListener) EnterInterfaceDeclaration(ctx *InterfaceDeclarationContext) {}", "title": "" }, { "docid": "aa49460176c584dd747294bbd475b263", "score": "0.45659047", "text": "func (ni *netstackImpl) SetInterfaceAddress(nicid uint32, address nsfidl.NetAddress, prefixLen uint8) (result nsfidl.NetErr, endService error) {\n\tlog.Printf(\"net address %+v\", address)\n\tvar protocol tcpip.NetworkProtocolNumber\n\tswitch address.Family {\n\tcase nsfidl.NetAddressFamilyIpv4:\n\t\tprotocol = ipv4.ProtocolNumber\n\tcase nsfidl.NetAddressFamilyIpv6:\n\t\treturn nsfidl.NetErr{nsfidl.StatusIpv4Only, \"IPv6 not yet supported for SetInterfaceAddress\"}, nil\n\t}\n\n\tnic := tcpip.NICID(nicid)\n\taddr := toTCPIPAddress(address)\n\tsn, err := toSubnet(address, prefixLen)\n\tif err != nil {\n\t\tresult = nsfidl.NetErr{nsfidl.StatusParseError, \"Error applying subnet mask to interface address\"}\n\t\treturn result, nil\n\t}\n\n\tif err = ns.setInterfaceAddress(nic, protocol, addr, sn); err != nil {\n\t\treturn nsfidl.NetErr{nsfidl.StatusUnknownError, err.Error()}, nil\n\t}\n\treturn nsfidl.NetErr{nsfidl.StatusOk, \"\"}, nil\n}", "title": "" }, { "docid": "950aaa5e57c0b01b33bbad3108f5cfd4", "score": "0.45654792", "text": "func (mr *MockEC2MockRecorder) AttachNetworkInterface(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AttachNetworkInterface\", reflect.TypeOf((*MockEC2)(nil).AttachNetworkInterface), arg0)\n}", "title": "" }, { "docid": "e741313497f2d5bdeed92f8c0cbb6979", "score": "0.45527127", "text": "func BindToInterface(fd int, ifname string) error {\n\treturn errors.New(\"not implemented on Windows\")\n}", "title": "" }, { "docid": "61fcc8a2c715a21da6aadf8424c37b90", "score": "0.4544809", "text": "func (handler *NetLinkHandler) SetInterfaceMac(ifName string, macAddress string) error {\n\tlink, err := handler.GetLinkByName(ifName)\n\tif err != nil {\n\t\treturn err\n\t}\n\thwAddr, err := net.ParseMAC(macAddress)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn netlink.LinkSetHardwareAddr(link, hwAddr)\n}", "title": "" }, { "docid": "5927e216471c2a26240ecfa36a8ff0ea", "score": "0.454141", "text": "func (d *Device) AttachVolume(ctx context.Context, portgroupName, hostname, iqn string, lunID int) error {\n\t// wrapper function for client.AttachVolume\n\tportgroups, err := d.GetPortGroups(ctx, NewSearchQueryName(portgroupName))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get portgroup: %w\", err)\n\t}\n\tif len(portgroups) != 1 {\n\t\treturn errors.New(\"found multiple portgroup in same PortGroup name\")\n\t}\n\tportgroup := portgroups[0]\n\n\thostgroup, host, err := d.GetHostGroupForce(ctx, hostname)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get hostgroup: %w\", err)\n\t}\n\t_, err = d.GetInitiatorForce(ctx, iqn)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get initiator: %w\", err)\n\t}\n\tinitiatorUpdateParam := UpdateInitiatorParam{\n\t\tID: iqn,\n\t\tTYPE: strconv.Itoa(TypeInitiator),\n\t\tUSECHAP: \"false\",\n\t\tPARENTID: strconv.Itoa(host.ID),\n\t\tPARENTTYPE: strconv.Itoa(TypeHost),\n\t}\n\t_, err = d.UpdateInitiator(ctx, iqn, initiatorUpdateParam) // set PARENTID (= host.ID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to set parameter for initiator: %w\", err)\n\t}\n\n\tlungroup, err := d.GetLunGroupForce(ctx, hostname)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get lungroup: %w\", err)\n\t}\n\n\terr = d.AssociateLun(ctx, lungroup.ID, lunID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to associate lun to lungroup: %w\", err)\n\t}\n\n\tmappingview, err := d.GetMappingViewForce(ctx, hostname)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get mappingview: %w\", err)\n\t}\n\n\terr = d.DoMapping(ctx, mappingview, hostgroup, lungroup, portgroup.ID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to associate object to mappingview: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "29da71643c806187637eccd40abda09b", "score": "0.45399487", "text": "func (v *veth) attach(n *configs.Network) (err error) {\n\tbrl, err := netlink.LinkByName(n.Bridge)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbr, ok := brl.(*netlink.Bridge)\n\tif !ok {\n\t\treturn fmt.Errorf(\"Wrong device type %T\", brl)\n\t}\n\thost, err := netlink.LinkByName(n.HostInterfaceName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := netlink.LinkSetMaster(host, br); err != nil {\n\t\treturn err\n\t}\n\tif err := netlink.LinkSetMTU(host, n.Mtu); err != nil {\n\t\treturn err\n\t}\n\tif n.HairpinMode {\n\t\tif err := netlink.LinkSetHairpin(host, true); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err := netlink.LinkSetUp(host); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a1c0fc2c432e5df3bc0d0cb69ca52403", "score": "0.45367205", "text": "func (o *NiatelemetryNiaInventory) SetInterface(v []NiatelemetryInterfaceElement) {\n\to.Interface = v\n}", "title": "" }, { "docid": "855f3aec60c0a4d8993921535cd0ed3c", "score": "0.45307606", "text": "func (p *PeerToPeer) AssignInterface(ip, mac, mask, device string) error {\n\tvar err error\n\n\tp.IP = ip\n\tp.Mac = mac\n\tp.Mask = mask\n\tp.DeviceName = device\n\n\t// Extract necessary information from config file\n\t// TODO: Remove hard-coded path\n\tyamlFile, err := ioutil.ReadFile(ConfigDir + \"/p2p/config.yaml\")\n\tif err != nil {\n\t\tLog(Warning, \"Failed to load config: %v\", err)\n\t\tp.IPTool = \"/sbin/ip\"\n\t\tp.AddTap = \"C:\\\\Program Files\\\\TAP-Windows\\\\bin\\\\tapinstall.exe\"\n\t\tp.InfFile = \"C:\\\\Program Files\\\\TAP-Windows\\\\driver\\\\OemVista.inf\"\n\t}\n\terr = yaml.Unmarshal(yamlFile, p)\n\tif err != nil {\n\t\tLog(Error, \"Failed to parse config: %v\", err)\n\t\treturn err\n\t}\n\n\tp.Device, err = Open(p.DeviceName, DevTap)\n\tif p.Device == nil {\n\t\tLog(Error, \"Failed to open TAP device %s: %v\", device, err)\n\t\treturn err\n\t}\n\tLog(Info, \"%v TAP Device created\", p.DeviceName)\n\n\t// Windows returns a real mac here. However, other systems should return empty string\n\tmac = ExtractMacFromInterface(p.Device)\n\tif mac != \"\" {\n\t\tp.Mac = mac\n\t\tp.HardwareAddr, _ = net.ParseMAC(mac)\n\t}\n\n\terr = ConfigureInterface(p.Device, p.IP, p.Mac, p.DeviceName, p.IPTool)\n\tLog(Info, \"Interface has been configured\")\n\treturn err\n}", "title": "" }, { "docid": "b4305aa3d90e56ea967b077925ec510d", "score": "0.4527215", "text": "func (o LocalDiskPtrOutput) Interface() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *LocalDisk) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Interface\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" } ]
4030ec97dc365f8deb4fbe0590b6e429
NewMockDependenciesServiceFrom creates a new mock of the MockDependenciesService interface. All methods delegate to the given implementation, unless overwritten.
[ { "docid": "2dacf050a460550d880916c417c13101", "score": "0.79853255", "text": "func NewMockDependenciesServiceFrom(i DependenciesService) *MockDependenciesService {\n\treturn &MockDependenciesService{\n\t\tInsertPackageRepoRefsFunc: &DependenciesServiceInsertPackageRepoRefsFunc{\n\t\t\tdefaultHook: i.InsertPackageRepoRefs,\n\t\t},\n\t}\n}", "title": "" } ]
[ { "docid": "607e41879b07a0d68c55426488119c7a", "score": "0.7117972", "text": "func NewMockDependenciesService() *MockDependenciesService {\n\treturn &MockDependenciesService{\n\t\tInsertPackageRepoRefsFunc: &DependenciesServiceInsertPackageRepoRefsFunc{\n\t\t\tdefaultHook: func(context.Context, []shared.MinimalPackageRepoRef) (r0 []shared.PackageRepoReference, r1 []shared.PackageRepoRefVersion, r2 error) {\n\t\t\t\treturn\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "ede844b43668e8c17a78ef2976d1c239", "score": "0.62417495", "text": "func NewStrictMockDependenciesService() *MockDependenciesService {\n\treturn &MockDependenciesService{\n\t\tInsertPackageRepoRefsFunc: &DependenciesServiceInsertPackageRepoRefsFunc{\n\t\t\tdefaultHook: func(context.Context, []shared.MinimalPackageRepoRef) ([]shared.PackageRepoReference, []shared.PackageRepoRefVersion, error) {\n\t\t\t\tpanic(\"unexpected invocation of MockDependenciesService.InsertPackageRepoRefs\")\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "9d22d66cc159a1ece22215849a650ec9", "score": "0.5970725", "text": "func newTestService(t *testing.T) *mockTestService {\n\treturn &mockTestService{test.NewMock(t)}\n}", "title": "" }, { "docid": "fb6ca35bb57206dd8fcf059f57e431c7", "score": "0.59692144", "text": "func NewService(t interface {\n\tmock.TestingT\n\tCleanup(func())\n}) *Service {\n\tmock := &Service{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "f1fa5776bcc9a02731124d25b47bf23c", "score": "0.5927467", "text": "func NewService(t mockConstructorTestingTNewService) *Service {\n\tmock := &Service{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "f1fa5776bcc9a02731124d25b47bf23c", "score": "0.5927467", "text": "func NewService(t mockConstructorTestingTNewService) *Service {\n\tmock := &Service{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "219ce36c22c62f9de3e031f0d0e3287b", "score": "0.58454573", "text": "func (s *PluginRPCServer) NewMockFrom(args *ArgsNewMockFrom, resp *RespNewMockFrom) error {\n\tfmt.Printf(\"s.Impl=%p\\n\", s.Impl)\n\tfmt.Fprintf(os.Stderr, \"s.Impl=%p\\n\", s.Impl)\n\ttag, err := s.Impl.NewMockFrom(args.Name, args.Version, args.Snapshot)\n\tif err != nil {\n\t\tresp.Err = s.newError(err)\n\t\treturn nil\n\t}\n\tresp.Tag = tag\n\treturn nil\n}", "title": "" }, { "docid": "ac90749b9c7dbdcc9fb2358a8335eab4", "score": "0.5646021", "text": "func NewMockClientFrom(i gitserver.Client) *MockClient {\n\treturn &MockClient{\n\t\tArchiveFunc: &ClientArchiveFunc{\n\t\t\tdefaultHook: i.Archive,\n\t\t},\n\t\tCommitGraphFunc: &ClientCommitGraphFunc{\n\t\t\tdefaultHook: i.CommitGraph,\n\t\t},\n\t\tDirectoryChildrenFunc: &ClientDirectoryChildrenFunc{\n\t\t\tdefaultHook: i.DirectoryChildren,\n\t\t},\n\t\tFileExistsFunc: &ClientFileExistsFunc{\n\t\t\tdefaultHook: i.FileExists,\n\t\t},\n\t\tHeadFunc: &ClientHeadFunc{\n\t\t\tdefaultHook: i.Head,\n\t\t},\n\t\tTagsFunc: &ClientTagsFunc{\n\t\t\tdefaultHook: i.Tags,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "1b77db21c927722708d4b642f3e9143c", "score": "0.5628657", "text": "func createMockServiceWithRealTransformer(productMap *config.ProductMap,\n\tmockPayment *payment.MockFetcher,\n\tmockDao *dao.MockDAO) *Service {\n\n\treturn &Service{\n\t\tProducer: createMockProducer(),\n\t\tPpSchema: getDefaultSchema(),\n\t\tPayments: mockPayment,\n\t\tTransformer: transformer.New(),\n\t\tDAO: mockDao,\n\t\tPaymentsAPIURL: paymentsAPIUrl,\n\t\tAPIKey: apiKey,\n\t\tProductMap: productMap,\n\t\tClient: &http.Client{},\n\t\tStopAtOffset: int64(-1),\n\t\tTopic: \"test\",\n\t}\n}", "title": "" }, { "docid": "9353bd1bbc4f5c2f0e3722a9937719c0", "score": "0.56282806", "text": "func NewMockUploadServiceFrom(i UploadService) *MockUploadService {\n\treturn &MockUploadService{\n\t\tGetDirtyRepositoriesFunc: &UploadServiceGetDirtyRepositoriesFunc{\n\t\t\tdefaultHook: i.GetDirtyRepositories,\n\t\t},\n\t\tGetRecentUploadsSummaryFunc: &UploadServiceGetRecentUploadsSummaryFunc{\n\t\t\tdefaultHook: i.GetRecentUploadsSummary,\n\t\t},\n\t\tGetRepoNameFunc: &UploadServiceGetRepoNameFunc{\n\t\t\tdefaultHook: i.GetRepoName,\n\t\t},\n\t\tGetRepositoriesForIndexScanFunc: &UploadServiceGetRepositoriesForIndexScanFunc{\n\t\t\tdefaultHook: i.GetRepositoriesForIndexScan,\n\t\t},\n\t\tGetUploadByIDFunc: &UploadServiceGetUploadByIDFunc{\n\t\t\tdefaultHook: i.GetUploadByID,\n\t\t},\n\t\tGetUploadsByIDsFunc: &UploadServiceGetUploadsByIDsFunc{\n\t\t\tdefaultHook: i.GetUploadsByIDs,\n\t\t},\n\t\tReferencesForUploadFunc: &UploadServiceReferencesForUploadFunc{\n\t\t\tdefaultHook: i.ReferencesForUpload,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "1e57d11fd2372126e95aea7832818b2f", "score": "0.5625563", "text": "func NewMockUploadServiceFrom(i UploadService) *MockUploadService {\n\treturn &MockUploadService{\n\t\tDeleteOldAuditLogsFunc: &UploadServiceDeleteOldAuditLogsFunc{\n\t\t\tdefaultHook: i.DeleteOldAuditLogs,\n\t\t},\n\t\tDeleteSourcedCommitsFunc: &UploadServiceDeleteSourcedCommitsFunc{\n\t\t\tdefaultHook: i.DeleteSourcedCommits,\n\t\t},\n\t\tDeleteUploadsStuckUploadingFunc: &UploadServiceDeleteUploadsStuckUploadingFunc{\n\t\t\tdefaultHook: i.DeleteUploadsStuckUploading,\n\t\t},\n\t\tDeleteUploadsWithoutRepositoryFunc: &UploadServiceDeleteUploadsWithoutRepositoryFunc{\n\t\t\tdefaultHook: i.DeleteUploadsWithoutRepository,\n\t\t},\n\t\tGetStaleSourcedCommitsFunc: &UploadServiceGetStaleSourcedCommitsFunc{\n\t\t\tdefaultHook: i.GetStaleSourcedCommits,\n\t\t},\n\t\tHardDeleteExpiredUploadsFunc: &UploadServiceHardDeleteExpiredUploadsFunc{\n\t\t\tdefaultHook: i.HardDeleteExpiredUploads,\n\t\t},\n\t\tSoftDeleteExpiredUploadsFunc: &UploadServiceSoftDeleteExpiredUploadsFunc{\n\t\t\tdefaultHook: i.SoftDeleteExpiredUploads,\n\t\t},\n\t\tUpdateSourcedCommitsFunc: &UploadServiceUpdateSourcedCommitsFunc{\n\t\t\tdefaultHook: i.UpdateSourcedCommits,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "e39be1bf4f574b637e5c63497273edcf", "score": "0.5589191", "text": "func NewMockAutoIndexingServiceFrom(i AutoIndexingService) *MockAutoIndexingService {\n\treturn &MockAutoIndexingService{\n\t\tDeleteIndexesWithoutRepositoryFunc: &AutoIndexingServiceDeleteIndexesWithoutRepositoryFunc{\n\t\t\tdefaultHook: i.DeleteIndexesWithoutRepository,\n\t\t},\n\t\tDeleteSourcedCommitsFunc: &AutoIndexingServiceDeleteSourcedCommitsFunc{\n\t\t\tdefaultHook: i.DeleteSourcedCommits,\n\t\t},\n\t\tGetStaleSourcedCommitsFunc: &AutoIndexingServiceGetStaleSourcedCommitsFunc{\n\t\t\tdefaultHook: i.GetStaleSourcedCommits,\n\t\t},\n\t\tUpdateSourcedCommitsFunc: &AutoIndexingServiceUpdateSourcedCommitsFunc{\n\t\t\tdefaultHook: i.UpdateSourcedCommits,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "a37dd6449c16d37ab93ea77a82c1d673", "score": "0.54849696", "text": "func NewMockClientFrom(i iface.Client) *MockClient {\n\treturn &MockClient{\n\t\tCloseFunc: &ClientCloseFunc{\n\t\t\tdefaultHook: i.Close,\n\t\t},\n\t\tDoFunc: &ClientDoFunc{\n\t\t\tdefaultHook: i.Do,\n\t\t},\n\t\tPipelineFunc: &ClientPipelineFunc{\n\t\t\tdefaultHook: i.Pipeline,\n\t\t},\n\t\tReadReplicaFunc: &ClientReadReplicaFunc{\n\t\t\tdefaultHook: i.ReadReplica,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "6b56858f82dbf2037ee17d51acf7b51f", "score": "0.5473585", "text": "func CreateMockDependencyClient(data *TestDependencyData, api cli.CommonAPIClient, pullImages bool, removeVolumes bool) MockClientDependency {\n\treturn MockClientDependency{\n\t\tdata,\n\t\tapi,\n\t\tpullImages,\n\t\tremoveVolumes,\n\t}\n}", "title": "" }, { "docid": "d0def8878fa3e63a413a7c29f5414573", "score": "0.54472125", "text": "func NewFormService(t mockConstructorTestingTNewFormService) *FormService {\n\tmock := &FormService{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "abd1ac223695772586470aef21c505f7", "score": "0.53613055", "text": "func (g *PluginRPC) NewMockFrom(name string, version string, snapshot []byte) (string, error) {\n\tvar resp RespNewMockFrom\n\terr := g.client.Call(\"Plugin.NewMockFrom\", &ArgsNewMockFrom{Name: name, Version: version, Snapshot: snapshot}, &resp)\n\tif err != nil {\n\t\treturn \"\", errRPC\n\t}\n\tif resp.Err != nil {\n\t\treturn \"\", resp.Err\n\t}\n\treturn resp.Tag, nil\n}", "title": "" }, { "docid": "2927991b6f876416f157dc2f1702ab75", "score": "0.5330068", "text": "func newService(config *Config, dasRepo *DASRepo) *Service {\n\treturn &Service{\n\t\tconfig: config,\n\t\tdasRepo: dasRepo,\n\t}\n}", "title": "" }, { "docid": "7c9695b167add7787e6b86e86253d034", "score": "0.53283954", "text": "func NewService() Service {\n\tdeps := make(map[string]DepService)\n\treturn Service{DependsOn: deps}\n}", "title": "" }, { "docid": "f02a4025d8fcffe20dc7278e99eff02c", "score": "0.5318444", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Analyzerfinding = NewAnalyzerfindingService(s)\n\ts.Analyzerresult = NewAnalyzerresultService(s)\n\ts.Branch = NewBranchService(s)\n\ts.Bughash = NewBughashService(s)\n\ts.Build = NewBuildService(s)\n\ts.Buildartifact = NewBuildartifactService(s)\n\ts.Buildattempt = NewBuildattemptService(s)\n\ts.Buildid = NewBuildidService(s)\n\ts.Buildrequest = NewBuildrequestService(s)\n\ts.Change = NewChangeService(s)\n\ts.Changesetspec = NewChangesetspecService(s)\n\ts.Deviceblob = NewDeviceblobService(s)\n\ts.Externaldisk = NewExternaldiskService(s)\n\ts.Imagerequest = NewImagerequestService(s)\n\ts.Label = NewLabelService(s)\n\ts.Machine = NewMachineService(s)\n\ts.Message = NewMessageService(s)\n\ts.Metric = NewMetricService(s)\n\ts.Prebuiltfile = NewPrebuiltfileService(s)\n\ts.Schedulingpool = NewSchedulingpoolService(s)\n\ts.Software = NewSoftwareService(s)\n\ts.Target = NewTargetService(s)\n\ts.Testartifact = NewTestartifactService(s)\n\ts.Testresult = NewTestresultService(s)\n\ts.Worknode = NewWorknodeService(s)\n\ts.Workplan = NewWorkplanService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "501a0411f24c32257112b0be65e15ff9", "score": "0.526151", "text": "func NewControlService(t mockConstructorTestingTNewControlService) *ControlService {\n\tmock := &ControlService{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "287c659f266b9d18a1b0f0f777458166", "score": "0.5240428", "text": "func NewMockDataRegistryServiceClient(t mockConstructorTestingTNewMockDataRegistryServiceClient) *MockDataRegistryServiceClient {\n\tmock := &MockDataRegistryServiceClient{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "4cdece207a1a3958e8a7e9273ccee593", "score": "0.52278614", "text": "func NewDeviceServiceClient(t mockConstructorTestingTNewDeviceServiceClient) *DeviceServiceClient {\n\tmock := &DeviceServiceClient{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "937bfc4f8040f8b0a9b91a099fca9bef", "score": "0.5171981", "text": "func NewProxyDependencyService(client *client.Client) *ProxyDependencyService {\n\treturn &ProxyDependencyService{client: client,\n\t\tcommandFactory: command.Factory{}}\n}", "title": "" }, { "docid": "b77f52d645ffe5031bb2e1bdb2671481", "score": "0.5159842", "text": "func (kc *knativeClient) newService(funcSpec *spec.Spec) *servingv1.Service {\n\tservice := &servingv1.Service{\n\t\tObjectMeta: k8sapisv1.ObjectMeta{\n\t\t\tName: funcSpec.Name,\n\t\t\tNamespace: kc.namespace,\n\t\t},\n\t}\n\n\tservice.Spec.Template = servingv1.RevisionTemplateSpec{\n\t\tSpec: servingv1.RevisionSpec{\n\t\t\tPodSpec: corev1.PodSpec{\n\t\t\t\tContainers: []corev1.Container{container(funcSpec)},\n\t\t\t},\n\t\t},\n\t\tObjectMeta: k8sapisv1.ObjectMeta{\n\t\t\tAnnotations: annotation(funcSpec),\n\t\t},\n\t}\n\treturn service\n}", "title": "" }, { "docid": "fbeb9c025c4de889178f0b47a4885589", "score": "0.513616", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Folders = NewFoldersService(s)\n\ts.Organizations = NewOrganizationsService(s)\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "fbeb9c025c4de889178f0b47a4885589", "score": "0.513616", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Folders = NewFoldersService(s)\n\ts.Organizations = NewOrganizationsService(s)\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "ab766cf63e6856b1f1515bc0a8ef96b6", "score": "0.5083436", "text": "func NewService(\n\trepository Repository,\n\tlinkService links.Service,\n\ttrService transfer_mined_link.Service,\n) Service {\n\tadapter := NewAdapter()\n\treturn createService(adapter, repository, linkService, trService)\n}", "title": "" }, { "docid": "aa0de15564b9bda5866d4d23aa360b8a", "score": "0.50821483", "text": "func NewService(\n\tproductStorage Storage,\n\torderStorage StorageOrderHistory,\n) *Service {\n\treturn &Service{\n\t\tproductStorage: productStorage,\n\t\torderStorage: orderStorage,\n\t}\n}", "title": "" }, { "docid": "319d2d2549e9f7ff50c0f96d8b6591ce", "score": "0.5081959", "text": "func NewMockServiceMrg(serviceName, rolloutId string, serviceConfig *confpb.Service) *MockServiceMrg {\n\tm := &MockServiceMrg{\n\t\tserviceName: serviceName,\n\t\tServiceConfig: serviceConfig,\n\t\trolloutId: rolloutId,\n\t}\n\tm.ConfigsHandler = &configsHandler{m: m}\n\tm.rolloutsHandler = &rolloutsHandler{m: m}\n\treturn m\n}", "title": "" }, { "docid": "14cff96c7815b5847db5a9397535887c", "score": "0.50746965", "text": "func makeMocks(t *testing.T) (*cacheService.MockCacheService, *cs.MockCabService) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tmockCacheService := cacheService.NewMockCacheService(ctrl)\n\tmockCabService := cs.NewMockCabService(ctrl)\n\n\treturn mockCacheService, mockCabService\n}", "title": "" }, { "docid": "24a20d2b28ad485e88253082617f694a", "score": "0.5066703", "text": "func newPlatformDependencies() platformDependencies {\n\treturn nil\n}", "title": "" }, { "docid": "30477a91b88681d56c4e7eb64fbd6b17", "score": "0.5065468", "text": "func NewMockExternalServiceStoreFrom(i ExternalServiceStore) *MockExternalServiceStore {\n\treturn &MockExternalServiceStore{\n\t\tListFunc: &ExternalServiceStoreListFunc{\n\t\t\tdefaultHook: i.List,\n\t\t},\n\t\tUpsertFunc: &ExternalServiceStoreUpsertFunc{\n\t\t\tdefaultHook: i.Upsert,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "40c29039c03df142c2129c87911bea5a", "score": "0.5047561", "text": "func NewProxyService(cnf *config.Config) *Service {\n\tproxy := &Service{\n\t\tConfig: cnf,\n\t\tCommandHandler: cmd.NewCommandHandler(),\n\t\tHostsLock: &sync.RWMutex{},\n\t}\n\tproxy.LoadHosts()\n\n\treturn proxy\n}", "title": "" }, { "docid": "ebc596362e0ecc7a3c8be5ae77dea3fc", "score": "0.50303537", "text": "func newServiceGetter(api *API) *serviceGetter {\n\treturn &serviceGetter{\n\t\tapi: api,\n\t}\n}", "title": "" }, { "docid": "d661a8b2cc16d39a7b61553e8d4c7d96", "score": "0.502367", "text": "func NewMockHandlerFrom(i Handler) *MockHandler {\n\treturn &MockHandler{\n\t\tHandleFunc: &HandlerHandleFunc{\n\t\t\tdefaultHook: i.Handle,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "b21aa752355bf7a93c719c637097c310", "score": "0.5010996", "text": "func New(pubsub Broker, auth mainflux.ThingsServiceClient, responses <-chan string) Service {\n\tas := &adapterService{\n\t\tauth: auth,\n\t\tpubsub: pubsub,\n\t\tobs: make(map[string]*Observer),\n\t\tobsLock: sync.Mutex{},\n\t}\n\n\tgo as.listenResponses(responses)\n\treturn as\n}", "title": "" }, { "docid": "a71233225492c5399111ba38b0a80483", "score": "0.49991596", "text": "func TestingService(ctx context.Context, t *testing.T, opts Opts) (Service, func()) {\n\tt.Helper()\n\n\tif opts.Logger == nil {\n\t\topts.Logger = zap.NewNop()\n\t}\n\n\tcleanupNode := func() {}\n\n\tif opts.IpfsCoreAPI == nil {\n\t\tvar mn ipfsutil.CoreAPIMock\n\t\tmn, cleanupNode = ipfsutil.TestingCoreAPI(ctx, t)\n\t\topts.IpfsCoreAPI = mn.API()\n\t}\n\n\tservice, err := New(ctx, opts)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to initialize client: %v\", err)\n\t}\n\n\tcleanup := func() {\n\t\tservice.Close()\n\t\tcleanupNode()\n\t}\n\n\treturn service, cleanup\n}", "title": "" }, { "docid": "a73e02a3d52342c627141a9240506f5b", "score": "0.49980626", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Folders = NewFoldersService(s)\n\ts.Liens = NewLiensService(s)\n\ts.Operations = NewOperationsService(s)\n\ts.Organizations = NewOrganizationsService(s)\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "d5c0e2d7bedf32d917930ca667a94131", "score": "0.4997048", "text": "func NewService(repo TargetRepo, cache common.Cache) TargetService {\n\treturn TargetService{repo, cache}\n}", "title": "" }, { "docid": "4bb147d2fc39cc23d7166da3093b516f", "score": "0.4995804", "text": "func newMockClientForTest(namespaces map[string]v1.NamespacePhase) *fake.Clientset {\n\tmockClient := &fake.Clientset{}\n\tmockClient.AddReactor(\"list\", \"namespaces\", func(action core.Action) (bool, runtime.Object, error) {\n\t\tnamespaceList := &v1.NamespaceList{\n\t\t\tListMeta: metav1.ListMeta{\n\t\t\t\tResourceVersion: fmt.Sprintf(\"%d\", len(namespaces)),\n\t\t\t},\n\t\t}\n\t\tindex := 0\n\t\tfor name, phase := range namespaces {\n\t\t\tnamespaceList.Items = append(namespaceList.Items, v1.Namespace{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: name,\n\t\t\t\t\tResourceVersion: fmt.Sprintf(\"%d\", index),\n\t\t\t\t},\n\t\t\t\tStatus: v1.NamespaceStatus{\n\t\t\t\t\tPhase: phase,\n\t\t\t\t},\n\t\t\t})\n\t\t\tindex++\n\t\t}\n\t\treturn true, namespaceList, nil\n\t})\n\treturn mockClient\n}", "title": "" }, { "docid": "246a6fa74a9644bc6a1fd565e2b30cf4", "score": "0.499394", "text": "func New() endly.Service {\n\tvar result = &service{\n\t\tAbstractService: endly.NewAbstractService(ServiceID),\n\t}\n\tresult.AbstractService.Service = result\n\tresult.registerRoutes()\n\treturn result\n}", "title": "" }, { "docid": "246a6fa74a9644bc6a1fd565e2b30cf4", "score": "0.499394", "text": "func New() endly.Service {\n\tvar result = &service{\n\t\tAbstractService: endly.NewAbstractService(ServiceID),\n\t}\n\tresult.AbstractService.Service = result\n\tresult.registerRoutes()\n\treturn result\n}", "title": "" }, { "docid": "246a6fa74a9644bc6a1fd565e2b30cf4", "score": "0.499394", "text": "func New() endly.Service {\n\tvar result = &service{\n\t\tAbstractService: endly.NewAbstractService(ServiceID),\n\t}\n\tresult.AbstractService.Service = result\n\tresult.registerRoutes()\n\treturn result\n}", "title": "" }, { "docid": "246a6fa74a9644bc6a1fd565e2b30cf4", "score": "0.499394", "text": "func New() endly.Service {\n\tvar result = &service{\n\t\tAbstractService: endly.NewAbstractService(ServiceID),\n\t}\n\tresult.AbstractService.Service = result\n\tresult.registerRoutes()\n\treturn result\n}", "title": "" }, { "docid": "246a6fa74a9644bc6a1fd565e2b30cf4", "score": "0.499394", "text": "func New() endly.Service {\n\tvar result = &service{\n\t\tAbstractService: endly.NewAbstractService(ServiceID),\n\t}\n\tresult.AbstractService.Service = result\n\tresult.registerRoutes()\n\treturn result\n}", "title": "" }, { "docid": "2f5dd3b6d32487dfdd9303c91969bea3", "score": "0.49926168", "text": "func New(ps messaging.PubSub, log logger.Logger, auth mainflux.ThingsServiceClient, responses <-chan string) Service {\n\tas := &adapterService{\n\t\tauth: auth,\n\t\tps: ps,\n\t\tlog: log,\n\t\tobs: make(map[string]*Observer),\n\t\tobsLock: sync.Mutex{},\n\t}\n\n\tgo as.listenResponses(responses)\n\treturn as\n}", "title": "" }, { "docid": "e5c71793f2f4182f806e3915f6d33423", "score": "0.4977317", "text": "func NewService(\n\trepository Repository,\n\ttrService transfer_genesis.Service,\n) Service {\n\tadapter := NewAdapter()\n\treturn createService(adapter, repository, trService)\n}", "title": "" }, { "docid": "b4f46da28f8f3aa20d200649e7b34a05", "score": "0.49755397", "text": "func (f *Fake) AddMockedUnstructuredKnativeService(name string, matchLabels map[string]string) {\n\trequire.NoError(f.t, knativev1.AddToScheme(f.S))\n\td, err := UnstructuredKnativeServiceMock(f.ns, name, matchLabels)\n\trequire.NoError(f.t, err)\n\tf.S.AddKnownTypes(knativev1.SchemeGroupVersion, &knativev1.Service{})\n\tf.objs = append(f.objs, d)\n}", "title": "" }, { "docid": "b690b8ab7fe98d168ff4ec541aa75f01", "score": "0.49650097", "text": "func New(sync *contract.Sync, partition *core.Partition, dao dao.Service, mutex *shared.Mutex, jobService jobs.Service, transferService transfer.Service) Service {\n\treturn &service{\n\t\tpartition: partition,\n\t\tService: diff.New(sync, dao),\n\t\tdao: dao,\n\t\tStrategy: &sync.Strategy,\n\t\tMerger: merge.New(sync, dao, mutex),\n\t\tTransfer: transferService,\n\t\tjob: jobService,\n\t}\n}", "title": "" }, { "docid": "e78fe31bcee85b1bf409a6627668a520", "score": "0.49614042", "text": "func NewServiceImpl(r Repository) Service {\n\treturn &ServiceImpl{Repository: r}\n}", "title": "" }, { "docid": "087019a8400aab7a521c546d51a16bb3", "score": "0.49604252", "text": "func NewService(repository todo.Repository) Service {\n\treturn &service{repository}\n}", "title": "" }, { "docid": "997599d4f55653708f0b9a30aca1a274", "score": "0.49562404", "text": "func newMockClient(tlsConfig *tls.Config, doer func(*http.Request) (*http.Response, error)) transport.Client {\n\tif tlsConfig != nil {\n\t\tpanic(\"this actually gets set!\")\n\t}\n\n\treturn &mockClient{\n\t\tdo: doer,\n\t}\n}", "title": "" }, { "docid": "c79caceac30649058d591e1de57b7cf8", "score": "0.49554738", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Accounts = NewAccountsService(s)\n\ts.Bidders = NewBiddersService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.49441248", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.49441248", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.49441248", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.49441248", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.49441248", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.49441248", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.49441248", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.49441248", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.49441248", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.49441248", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "c5930e7a65d629dbd9bdc1cd129866b4", "score": "0.49441248", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "bdb670328fc590ec72230191f088c7cb", "score": "0.49433964", "text": "func NewMockSoftcopyAdminClientFrom(i proto.SoftcopyAdminClient) *MockSoftcopyAdminClient {\n\treturn &MockSoftcopyAdminClient{\n\t\tAllFilesFunc: &SoftcopyAdminClientAllFilesFunc{\n\t\t\tdefaultHook: i.AllFiles,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "52b98df4f1ff01b35d7757c14c443402", "score": "0.4935681", "text": "func NewMockToDoListService(ctrl *gomock.Controller) *MockToDoListService {\n\tmock := &MockToDoListService{ctrl: ctrl}\n\tmock.recorder = &MockToDoListServiceMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "e599117f08b1e9ca83ddee98b52d4304", "score": "0.492706", "text": "func New(config Config) (*Service, error) {\n\tvar err error\n\n\tvar awsService *aws.Service\n\t{\n\t\tawsConfig := aws.DefaultConfig()\n\n\t\tawsConfig.Logger = config.Logger\n\t\tawsConfig.RestClient = config.RestClient\n\t\tawsConfig.URL = config.URL\n\n\t\tawsService, err = aws.New(awsConfig)\n\t\tif err != nil {\n\t\t\treturn nil, microerror.Mask(err)\n\t\t}\n\t}\n\n\tvar azureService *azure.Service\n\t{\n\t\tazureConfig := azure.DefaultConfig()\n\n\t\tazureConfig.Logger = config.Logger\n\t\tazureConfig.RestClient = config.RestClient\n\t\tazureConfig.URL = config.URL\n\n\t\tazureService, err = azure.New(azureConfig)\n\t\tif err != nil {\n\t\t\treturn nil, microerror.Mask(err)\n\t\t}\n\t}\n\n\tvar kvmService *kvm.Service\n\t{\n\t\tkvmConfig := kvm.DefaultConfig()\n\n\t\tkvmConfig.Logger = config.Logger\n\t\tkvmConfig.RestClient = config.RestClient\n\t\tkvmConfig.URL = config.URL\n\n\t\tkvmService, err = kvm.New(kvmConfig)\n\t\tif err != nil {\n\t\t\treturn nil, microerror.Mask(err)\n\t\t}\n\t}\n\n\tnewService := &Service{\n\t\tAWS: awsService,\n\t\tAzure: azureService,\n\t\tKVM: kvmService,\n\t}\n\n\treturn newService, nil\n}", "title": "" }, { "docid": "5a5eac3c851e935438390831c4f4351d", "score": "0.492506", "text": "func NewService(\n\tchunksService chunks.Service,\n\trepository Repository,\n\ttrService transfer_file.Service,\n) Service {\n\tadapter := NewAdapter()\n\treturn createService(adapter, repository, chunksService, trService)\n}", "title": "" }, { "docid": "08581e65b8aac3558dc00b87dab61566", "score": "0.49217045", "text": "func NewService(logger log.Logger) Service {\n return &service{\n logger: logger,\n }\n}", "title": "" }, { "docid": "a1f0e3643c5b19fc926d18ba31523b22", "score": "0.4919358", "text": "func newFakeCreateServiceClassFunc(retErr error) (CreateServiceClassFunc, *[]*data.ServiceClass) {\n\tcreatedClasses := []*data.ServiceClass{}\n\tretFn := func(sClass *data.ServiceClass) error {\n\t\tif retErr != nil {\n\t\t\treturn retErr\n\t\t}\n\t\tcreatedClasses = append(createdClasses, sClass)\n\t\treturn nil\n\t}\n\treturn retFn, &createdClasses\n}", "title": "" }, { "docid": "e06a8b257f13fb938c21224494d1b4b3", "score": "0.49056855", "text": "func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {\n\tscopesOption := internaloption.WithDefaultScopes(\n\t\t\"https://www.googleapis.com/auth/cloud-platform\",\n\t\t\"https://www.googleapis.com/auth/firebase\",\n\t)\n\t// NOTE: prepend, so we don't override user-specified scopes.\n\topts = append([]option.ClientOption{scopesOption}, opts...)\n\topts = append(opts, internaloption.WithDefaultEndpoint(basePath))\n\topts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))\n\tclient, endpoint, err := htransport.NewClient(ctx, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts, err := New(client)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif endpoint != \"\" {\n\t\ts.BasePath = endpoint\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "dc28308f6a9c9a8bc366b8837edb7464", "score": "0.4890515", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.AccessPolicies = NewAccessPoliciesService(s)\n\ts.Operations = NewOperationsService(s)\n\ts.Organizations = NewOrganizationsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "cfa94fa0422c0e04490a1754b176b66c", "score": "0.48813865", "text": "func NewServiceImpl(health bool, runtime bool, metrics bool, seconds int) *ServiceImpl {\n\treturn &ServiceImpl{\n\t\tmetrics: metrics,\n\t\truntime: runtime,\n\t\thealth: health,\n\t\tlastSnapshot: time.Time{},\n\t\trefreshTime: time.Duration(seconds) * time.Second,\n\t}\n}", "title": "" }, { "docid": "c761b3234b8aeb527f7eaf5716060cbb", "score": "0.48769057", "text": "func NewStrictMockUploadService() *MockUploadService {\n\treturn &MockUploadService{\n\t\tDeleteOldAuditLogsFunc: &UploadServiceDeleteOldAuditLogsFunc{\n\t\t\tdefaultHook: func(context.Context, time.Duration, time.Time) (int, error) {\n\t\t\t\tpanic(\"unexpected invocation of MockUploadService.DeleteOldAuditLogs\")\n\t\t\t},\n\t\t},\n\t\tDeleteSourcedCommitsFunc: &UploadServiceDeleteSourcedCommitsFunc{\n\t\t\tdefaultHook: func(context.Context, int, string, time.Duration, time.Time) (int, int, error) {\n\t\t\t\tpanic(\"unexpected invocation of MockUploadService.DeleteSourcedCommits\")\n\t\t\t},\n\t\t},\n\t\tDeleteUploadsStuckUploadingFunc: &UploadServiceDeleteUploadsStuckUploadingFunc{\n\t\t\tdefaultHook: func(context.Context, time.Time) (int, error) {\n\t\t\t\tpanic(\"unexpected invocation of MockUploadService.DeleteUploadsStuckUploading\")\n\t\t\t},\n\t\t},\n\t\tDeleteUploadsWithoutRepositoryFunc: &UploadServiceDeleteUploadsWithoutRepositoryFunc{\n\t\t\tdefaultHook: func(context.Context, time.Time) (map[int]int, error) {\n\t\t\t\tpanic(\"unexpected invocation of MockUploadService.DeleteUploadsWithoutRepository\")\n\t\t\t},\n\t\t},\n\t\tGetStaleSourcedCommitsFunc: &UploadServiceGetStaleSourcedCommitsFunc{\n\t\t\tdefaultHook: func(context.Context, time.Duration, int, time.Time) ([]shared1.SourcedCommits, error) {\n\t\t\t\tpanic(\"unexpected invocation of MockUploadService.GetStaleSourcedCommits\")\n\t\t\t},\n\t\t},\n\t\tHardDeleteExpiredUploadsFunc: &UploadServiceHardDeleteExpiredUploadsFunc{\n\t\t\tdefaultHook: func(context.Context) (int, error) {\n\t\t\t\tpanic(\"unexpected invocation of MockUploadService.HardDeleteExpiredUploads\")\n\t\t\t},\n\t\t},\n\t\tSoftDeleteExpiredUploadsFunc: &UploadServiceSoftDeleteExpiredUploadsFunc{\n\t\t\tdefaultHook: func(context.Context) (int, error) {\n\t\t\t\tpanic(\"unexpected invocation of MockUploadService.SoftDeleteExpiredUploads\")\n\t\t\t},\n\t\t},\n\t\tUpdateSourcedCommitsFunc: &UploadServiceUpdateSourcedCommitsFunc{\n\t\t\tdefaultHook: func(context.Context, int, string, time.Time) (int, error) {\n\t\t\t\tpanic(\"unexpected invocation of MockUploadService.UpdateSourcedCommits\")\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "049610733f40baa3564a06520b778384", "score": "0.4866641", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.BillingAccounts = NewBillingAccountsService(s)\n\ts.SkuGroups = NewSkuGroupsService(s)\n\ts.Skus = NewSkusService(s)\n\ts.V1beta = NewV1betaService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "1e25377af90ae4d79d8c50f000cf7432", "score": "0.48619267", "text": "func New() Service {\n\treturn &impl{}\n}", "title": "" }, { "docid": "0ec957145912a4e7995827dcbba1e36e", "score": "0.48577785", "text": "func NewService(\n\thttpManager *hosts.HTTPManager,\n\tredisManager *redis.Client,\n) *Service {\n\treturn &Service{\n\t\thttpManager: httpManager,\n\t\tredisManager: redisManager,\n\t}\n}", "title": "" }, { "docid": "8243368f7424c6cea5d301988a023506", "score": "0.48564494", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Advertisers = NewAdvertisersService(s)\n\ts.CombinedAudiences = NewCombinedAudiencesService(s)\n\ts.CustomBiddingAlgorithms = NewCustomBiddingAlgorithmsService(s)\n\ts.CustomLists = NewCustomListsService(s)\n\ts.FirstAndThirdPartyAudiences = NewFirstAndThirdPartyAudiencesService(s)\n\ts.FloodlightGroups = NewFloodlightGroupsService(s)\n\ts.GoogleAudiences = NewGoogleAudiencesService(s)\n\ts.GuaranteedOrders = NewGuaranteedOrdersService(s)\n\ts.InventorySourceGroups = NewInventorySourceGroupsService(s)\n\ts.InventorySources = NewInventorySourcesService(s)\n\ts.Media = NewMediaService(s)\n\ts.Partners = NewPartnersService(s)\n\ts.Sdfdownloadtasks = NewSdfdownloadtasksService(s)\n\ts.TargetingTypes = NewTargetingTypesService(s)\n\ts.Users = NewUsersService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "4bb610fe923287c3685f0a697359ef07", "score": "0.48476994", "text": "func NewService(store Store) *ServiceImpl {\n\treturn &ServiceImpl{\n\t\tstore,\n\t\tNewFileKeyCrawler(),\n\t\tNewRandomKeyService(),\n\t}\n}", "title": "" }, { "docid": "8e185c71a3d8be5941b40d6acd8d895c", "score": "0.48443204", "text": "func (b ProxyServiceFactory) DependencyService() service_abstract.AbsDependencyService {\n\treturn NewProxyDependencyService(b.client)\n}", "title": "" }, { "docid": "b5daccaba6881f7283a29e56be6191b0", "score": "0.48426038", "text": "func NewService(storage Storage) *Service {\n\treturn &Service{\n\t\tplatformFinders: make(map[platform.ID]platform.GameFinder),\n\t\tstorage: storage,\n\t}\n}", "title": "" }, { "docid": "2a260a78ce77b1acbb84b834c1d47135", "score": "0.48365766", "text": "func NewService(\n\tfileService files.Service,\n\trepository Repository,\n\ttrService transfer_bucket.Service,\n) Service {\n\tadapter := NewAdapter()\n\treturn createService(adapter, repository, fileService, trService)\n}", "title": "" }, { "docid": "b4300bb99e94f4e06afc386281346597", "score": "0.48357058", "text": "func (v *VerificationService) NewService(args []string) Service {\n\tlog.Printf(\"[DEBUG] starting verification service with args: %v\\n\", args)\n\n\tv.Args = args\n\tv.Cmd = getVerifierCommandPath()\n\treturn v\n}", "title": "" }, { "docid": "03f5dea02ba56d1792d9023824844ff4", "score": "0.48306865", "text": "func New(src, packageName string) (*Mocker, error) {\n\tsrcPkg, err := pkgInfoFromPath(src, packages.LoadSyntax)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Couldn't load source package: %s\", err)\n\t}\n\tpkgPath := srcPkg.PkgPath\n\n\tif len(packageName) == 0 {\n\t\tpackageName = srcPkg.Name\n\t} else {\n\t\tmockPkgPath := filepath.Join(src, packageName)\n\t\tif _, err := os.Stat(mockPkgPath); os.IsNotExist(err) {\n\t\t\tos.Mkdir(mockPkgPath, os.ModePerm)\n\t\t}\n\t\tmockPkg, err := pkgInfoFromPath(mockPkgPath, packages.LoadFiles)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Couldn't load mock package: %s\", err)\n\t\t}\n\t\tpkgPath = mockPkg.PkgPath\n\t}\n\n\ttmpl, err := template.New(\"moq\").Funcs(templateFuncs).Parse(moqTemplate)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Mocker{\n\t\ttmpl: tmpl,\n\t\tsrcPkg: srcPkg,\n\t\tpkgName: packageName,\n\t\tpkgPath: pkgPath,\n\t\timportByPath: make(map[string]string),\n\t\timportByAlias: make(map[string]string),\n\t}, nil\n}", "title": "" }, { "docid": "70a40743ec1f797391f479c74eaf52c9", "score": "0.48277315", "text": "func NewService(todos planner.TodoRepo) Service {\n\treturn &service{\n\t\ttodos: todos,\n\t}\n}", "title": "" }, { "docid": "e78954f0034e5d4122a8ef531ea1f0b6", "score": "0.48269987", "text": "func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {\n\tscopesOption := internaloption.WithDefaultScopes(\n\t\t\"https://www.googleapis.com/auth/drive\",\n\t\t\"https://www.googleapis.com/auth/drive.file\",\n\t\t\"https://www.googleapis.com/auth/drive.readonly\",\n\t\t\"https://www.googleapis.com/auth/forms.body\",\n\t\t\"https://www.googleapis.com/auth/forms.body.readonly\",\n\t\t\"https://www.googleapis.com/auth/forms.responses.readonly\",\n\t)\n\t// NOTE: prepend, so we don't override user-specified scopes.\n\topts = append([]option.ClientOption{scopesOption}, opts...)\n\topts = append(opts, internaloption.WithDefaultEndpoint(basePath))\n\topts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))\n\tclient, endpoint, err := htransport.NewClient(ctx, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts, err := New(client)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif endpoint != \"\" {\n\t\ts.BasePath = endpoint\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "dc1c861ca46a918c8ac0399413584ed4", "score": "0.4824644", "text": "func NewService(awsSession *session.Session, signaturesBucketName string, v1ProjectService service.Service,\n\tv1CompanyService company.IService,\n\tv1SignatureService signatures.SignatureService,\n\tpcgRepo projects_cla_groups.Repository, v1SignatureRepo signatures.SignatureRepository, usersService users.Service) *Service {\n\treturn &Service{\n\t\tv1ProjectService: v1ProjectService,\n\t\tv1CompanyService: v1CompanyService,\n\t\tv1SignatureService: v1SignatureService,\n\t\tv1SignatureRepo: v1SignatureRepo,\n\t\tusersService: usersService,\n\t\tprojectsClaGroupsRepo: pcgRepo,\n\t\ts3: s3.New(awsSession),\n\t\tsignaturesBucket: signaturesBucketName,\n\t}\n}", "title": "" }, { "docid": "8e661ec99016946cf88434485a7e9938", "score": "0.48201174", "text": "func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {\n\tscopesOption := option.WithScopes(\n\t\t\"https://www.googleapis.com/auth/androidbuild.internal\",\n\t)\n\t// NOTE: prepend, so we don't override user-specified scopes.\n\topts = append([]option.ClientOption{scopesOption}, opts...)\n\tclient, endpoint, err := htransport.NewClient(ctx, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts, err := New(client)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif endpoint != \"\" {\n\t\ts.BasePath = endpoint\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "43296c660cdedbf233995c8f8e7c9ea7", "score": "0.48171535", "text": "func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {\n\tscopesOption := internaloption.WithDefaultScopes(\n\t\t\"https://www.googleapis.com/auth/cloud-billing\",\n\t\t\"https://www.googleapis.com/auth/cloud-billing.readonly\",\n\t\t\"https://www.googleapis.com/auth/cloud-platform\",\n\t)\n\t// NOTE: prepend, so we don't override user-specified scopes.\n\topts = append([]option.ClientOption{scopesOption}, opts...)\n\topts = append(opts, internaloption.WithDefaultEndpoint(basePath))\n\topts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))\n\tclient, endpoint, err := htransport.NewClient(ctx, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts, err := New(client)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif endpoint != \"\" {\n\t\ts.BasePath = endpoint\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "d3386200c31b865918a2be12118ce466", "score": "0.48148403", "text": "func newService(c *onet.Context) (onet.Service, error) {\n\ts := &testService{\n\t\tServiceProcessor: onet.NewServiceProcessor(c),\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "e29ada7ba66feef0ea83ab5841a7ee4d", "score": "0.4812382", "text": "func newService(ip *InternalWavefrontProxy) *corev1.Service {\n\tsvc := &corev1.Service{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: ip.instance.Name,\n\t\t\tNamespace: ip.instance.Namespace,\n\t\t},\n\t\tSpec: svcSpec(ip),\n\t}\n\treturn svc\n}", "title": "" }, { "docid": "1cf141e60836c345701469414da1801a", "score": "0.48077765", "text": "func NewService(repo v1GithubOrg.Repository, ghRepository v1Repositories.Repository) Service {\n\treturn service{\n\t\trepo: repo,\n\t\tghRepository: ghRepository,\n\t}\n}", "title": "" }, { "docid": "436c0f086b1fd459169c137618c36d45", "score": "0.48062825", "text": "func newTravelService(svc *Service) contract.TravelService {\n\treturn &travelService{\n\t\tsvc: svc,\n\t}\n}", "title": "" }, { "docid": "6eeec48ccf694ed5421c57ac903b18dc", "score": "0.48049724", "text": "func NewTokenService(t mockConstructorTestingTNewTokenService) *TokenService {\n\tmock := &TokenService{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "d47544efb18c57c5b08e14c14a10fd0e", "score": "0.48003384", "text": "func NewMockDIC() *di.Container {\n\tmsgClient, _ := messaging.NewMessageClient(msgTypes.MessageBusConfig{\n\t\tPublishHost: msgTypes.HostInfo{\n\t\t\tHost: \"*\",\n\t\t\tProtocol: \"tcp\",\n\t\t\tPort: 5563,\n\t\t},\n\t\tType: \"zero\",\n\t})\n\n\treturn di.NewContainer(di.ServiceConstructorMap{\n\t\tdataContainer.ConfigurationName: func(get di.Get) interface{} {\n\t\t\treturn &config.ConfigurationStruct{\n\t\t\t\tWritable: config.WritableInfo{\n\t\t\t\t\tPersistData: true,\n\t\t\t\t},\n\t\t\t\tService: bootstrapConfig.ServiceInfo{\n\t\t\t\t\tMaxResultCount: 20,\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t\tcontainer.LoggingClientInterfaceName: func(get di.Get) interface{} {\n\t\t\treturn logger.NewMockClient()\n\t\t},\n\t\tcontainer.MessagingClientName: func(get di.Get) interface{} {\n\t\t\treturn msgClient\n\t\t},\n\t})\n}", "title": "" }, { "docid": "e2ec4271155907ce4d2d6eea7f5961e5", "score": "0.47979912", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Accounts = NewAccountsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "e2ec4271155907ce4d2d6eea7f5961e5", "score": "0.47979912", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Accounts = NewAccountsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "eacd760aeafc1c3b082004a19c952528", "score": "0.47948557", "text": "func NewMockPackageReferenceScannerFrom(i shared1.PackageReferenceScanner) *MockPackageReferenceScanner {\n\treturn &MockPackageReferenceScanner{\n\t\tCloseFunc: &PackageReferenceScannerCloseFunc{\n\t\t\tdefaultHook: i.Close,\n\t\t},\n\t\tNextFunc: &PackageReferenceScannerNextFunc{\n\t\t\tdefaultHook: i.Next,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "eeeef184fdc6e9ade05a11c3266de25e", "score": "0.479389", "text": "func NewService(fileService file.Service, filePathWithName string) Service {\n\tadapter := NewAdapter()\n\treturn createService(adapter, fileService, filePathWithName)\n}", "title": "" }, { "docid": "f9dce04391eaa692e1ce2992317423e0", "score": "0.47921634", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.EffectiveTags = NewEffectiveTagsService(s)\n\ts.Folders = NewFoldersService(s)\n\ts.Liens = NewLiensService(s)\n\ts.Operations = NewOperationsService(s)\n\ts.Organizations = NewOrganizationsService(s)\n\ts.Projects = NewProjectsService(s)\n\ts.TagBindings = NewTagBindingsService(s)\n\ts.TagKeys = NewTagKeysService(s)\n\ts.TagValues = NewTagValuesService(s)\n\treturn s, nil\n}", "title": "" } ]
f404f2187d5ca4648b0cb078e878cd07
SetIDGte adds the idGte to the users permissions list params
[ { "docid": "be75c1de1779a2c6979c7e61fe4ec4e5", "score": "0.7675159", "text": "func (o *UsersPermissionsListParams) SetIDGte(iDGte *string) {\n\to.IDGte = iDGte\n}", "title": "" } ]
[ { "docid": "50a22741a4c974b31ee663156736e684", "score": "0.78487456", "text": "func (o *UsersPermissionsListParams) WithIDGte(iDGte *string) *UsersPermissionsListParams {\n\to.SetIDGte(iDGte)\n\treturn o\n}", "title": "" }, { "docid": "9693b99874c527fdebc1e37a8713534f", "score": "0.64210844", "text": "func (o *IpamPrefixesListParams) SetIDGte(iDGte *string) {\n\to.IDGte = iDGte\n}", "title": "" }, { "docid": "c364dd361bf91966ef378b8de238fca0", "score": "0.6399878", "text": "func (o *ExtrasObjectChangesListParams) SetIDGte(iDGte *string) {\n\to.IDGte = iDGte\n}", "title": "" }, { "docid": "6d0cc0ffa1ddb0509288a7f6edf4aac5", "score": "0.6389805", "text": "func (o *TenancyContactsListParams) SetIDGte(iDGte *string) {\n\to.IDGte = iDGte\n}", "title": "" }, { "docid": "c6a336b17cf7c8c25566e736ed129e63", "score": "0.63368016", "text": "func (qs AccountQuerySet) UserIdGte(userId string) AccountQuerySet {\n\treturn qs.w(qs.db.Where(\"user_id >= ?\", userId))\n}", "title": "" }, { "docid": "1dc1a282ce97238c0e72f2dac02bcaf7", "score": "0.59843147", "text": "func (o *UsersPermissionsListParams) WithIDGt(iDGt *string) *UsersPermissionsListParams {\n\to.SetIDGt(iDGt)\n\treturn o\n}", "title": "" }, { "docid": "8e1574fa37315731720bc34fb3f72d1e", "score": "0.56293523", "text": "func (qs AccountQuerySet) IdGte(id int32) AccountQuerySet {\n\treturn qs.w(qs.db.Where(\"id >= ?\", id))\n}", "title": "" }, { "docid": "074dcc62b1ab0da85900478a5c35861f", "score": "0.5561495", "text": "func (o *IpamPrefixesListParams) WithIDGte(iDGte *string) *IpamPrefixesListParams {\n\to.SetIDGte(iDGte)\n\treturn o\n}", "title": "" }, { "docid": "cea0fba8fa7f2abe7f566fe7ec4e1504", "score": "0.5497251", "text": "func (qs GroupQuerySet) IDGte(ID uint) GroupQuerySet {\n\treturn qs.w(qs.db.Where(\"id >= ?\", ID))\n}", "title": "" }, { "docid": "920296476584bd340c2f48d90636f1cb", "score": "0.5452237", "text": "func (o *TenancyContactsListParams) WithIDGte(iDGte *string) *TenancyContactsListParams {\n\to.SetIDGte(iDGte)\n\treturn o\n}", "title": "" }, { "docid": "aa12d3e4adf8a43275df31c733ebcc1e", "score": "0.5336723", "text": "func UserIDGTE(v uuid.UUID) predicate.Share {\n\treturn predicate.Share(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldUserID), v))\n\t})\n}", "title": "" }, { "docid": "2951ac92d206a90f0ee5b3c0ff29e46a", "score": "0.53348905", "text": "func (qs SpriteStyleQuerySet) IDGte(ID uint) SpriteStyleQuerySet {\n\treturn qs.w(qs.db.Where(\"id >= ?\", ID))\n}", "title": "" }, { "docid": "892078fbf221aab740b008ea5b991ec1", "score": "0.53276986", "text": "func IDGTE(id int) predicate.UserGroup {\n\treturn predicate.UserGroup(sql.FieldGTE(FieldID, id))\n}", "title": "" }, { "docid": "b4d8ba5be80f1ba5a43fc14309226c22", "score": "0.5262918", "text": "func (o *ExtrasObjectChangesListParams) WithIDGte(iDGte *string) *ExtrasObjectChangesListParams {\n\to.SetIDGte(iDGte)\n\treturn o\n}", "title": "" }, { "docid": "1f6f49f4c6dd79ad2f4581023dfef420", "score": "0.51787126", "text": "func (qs ProfitQuerySet) IDGte(ID uint) ProfitQuerySet {\n\treturn qs.w(qs.db.Where(\"id >= ?\", ID))\n}", "title": "" }, { "docid": "a26ccad57c4a04fde21180023176d298", "score": "0.5120919", "text": "func (qs GroupQuerySet) OwnerIDGte(ownerID uint) GroupQuerySet {\n\treturn qs.w(qs.db.Where(\"owner_id >= ?\", ownerID))\n}", "title": "" }, { "docid": "7e66aee75355d00f4508b4219b825036", "score": "0.5078013", "text": "func (qs SpriteStyleQuerySet) SpriteIDGte(spriteID uint) SpriteStyleQuerySet {\n\treturn qs.w(qs.db.Where(\"sprite_id >= ?\", spriteID))\n}", "title": "" }, { "docid": "75b543b43ebd6a414120f7be0d8aa692", "score": "0.50619245", "text": "func setGid() (string, error) {\n\tfor i := 0; i <= maxGID; i++ {\n\t\tgid := strconv.Itoa(i)\n\t\tgroup, err := user.LookupGroupId(gid)\n\t\tif err == nil && group.Name != currName {\n\t\t\treturn gid, nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"setGid: could not set gid\")\n}", "title": "" }, { "docid": "e93a64804d18055f8f12c36e7c62ed23", "score": "0.5036529", "text": "func (o *UsersPermissionsListParams) SetIDGt(iDGt *string) {\n\to.IDGt = iDGt\n}", "title": "" }, { "docid": "0283054b455724f92ec5df641278858c", "score": "0.50196683", "text": "func setFakeGid() (string, error) {\n\tfor i := minGID; i <= maxGID; i++ {\n\t\tgid := strconv.Itoa(i)\n\t\t_, err := user.LookupGroupId(gid)\n\t\tif err != nil {\n\t\t\treturn gid, nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"setFakeGid: could not set gid\")\n}", "title": "" }, { "docid": "cfba048c9a4c93e4bb02278fa15e3554", "score": "0.5003048", "text": "func IDGTE(id string) predicate.SysUser {\n\treturn predicate.SysUser(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "c0746f57da5b72cfb2f98278ef12311b", "score": "0.49904245", "text": "func IDGTE(id int) predicate.UserTweet {\n\treturn predicate.UserTweet(sql.FieldGTE(FieldID, id))\n}", "title": "" }, { "docid": "29f4c62221a07a80f0e98225a2f66439", "score": "0.49635258", "text": "func (o *ExtrasObjectChangesListParams) SetChangedObjectIDGte(changedObjectIDGte *string) {\n\to.ChangedObjectIDGte = changedObjectIDGte\n}", "title": "" }, { "docid": "694c9a0636c15cd52d50117255ab73c5", "score": "0.49205223", "text": "func IDGTE(id int) predicate.Role {\n\treturn predicate.Role(sql.FieldGTE(FieldID, id))\n}", "title": "" }, { "docid": "e74754fd4a40fea8d59b4064d19840ba", "score": "0.49177667", "text": "func (o *IpamPrefixesListParams) SetDepthGte(depthGte *string) {\n\to.DepthGte = depthGte\n}", "title": "" }, { "docid": "241bddddb372dc3a5895daca809219b0", "score": "0.4914869", "text": "func WithIDGTE(id string) FilterReactionsOption {\n\treturn FilterReactionsOption{makeRequestOption(\"id_gte\", id)}\n}", "title": "" }, { "docid": "df3de07d1d89d8114b9e332bcc76a312", "score": "0.4909694", "text": "func (o *UsersPermissionsListParams) WithIDLt(iDLt *string) *UsersPermissionsListParams {\n\to.SetIDLt(iDLt)\n\treturn o\n}", "title": "" }, { "docid": "6765f3918d170934302aceb852da08c7", "score": "0.48924845", "text": "func AuthIDGTE(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldAuthID), v))\n\t})\n}", "title": "" }, { "docid": "15b8e8f6d61f17ebea3275a9b12e57cf", "score": "0.48600858", "text": "func IDGTE(id int) predicate.User {\n\treturn predicate.User(\n\t\tfunc(s *sql.Selector) {\n\t\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t\t},\n\t)\n}", "title": "" }, { "docid": "42c86caeef46d079626ae241449c9ac2", "score": "0.48384473", "text": "func (qs ProfitQuerySet) ObjectIDGte(objectID uint) ProfitQuerySet {\n\treturn qs.w(qs.db.Where(\"object_id >= ?\", objectID))\n}", "title": "" }, { "docid": "57df2a62e60e077aea1ebb196462d2d5", "score": "0.48278603", "text": "func IDGTE(id int) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "57df2a62e60e077aea1ebb196462d2d5", "score": "0.48278603", "text": "func IDGTE(id int) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "57df2a62e60e077aea1ebb196462d2d5", "score": "0.48278603", "text": "func IDGTE(id int) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "96c8a5a4a2332ea2afd135ccdb002503", "score": "0.48132735", "text": "func IDGTE(id int64) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "4aea37316885c33e42580e004cc0ad00", "score": "0.48038068", "text": "func (qs AccountQuerySet) PasswordGte(password string) AccountQuerySet {\n\treturn qs.w(qs.db.Where(\"password >= ?\", password))\n}", "title": "" }, { "docid": "4412551767f702d716c136834bee6fba", "score": "0.47605768", "text": "func IDGTE(id int) predicate.Friendship {\n\treturn predicate.Friendship(sql.FieldGTE(FieldID, id))\n}", "title": "" }, { "docid": "c364f0a18ffbc204b13b42fc8345e8eb", "score": "0.47405997", "text": "func (o *UsersPermissionsListParams) WithIDLte(iDLte *string) *UsersPermissionsListParams {\n\to.SetIDLte(iDLte)\n\treturn o\n}", "title": "" }, { "docid": "d80b1d60846bc7da450c4053c9b36f37", "score": "0.47196212", "text": "func IDGTE(id int64) predicate.AccessControl {\n\treturn predicate.AccessControl(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "179af0ae734d126a01b8b0eb76b3de7b", "score": "0.47120938", "text": "func c_setgroups(size Size_t, list *Gid_t) _C_int", "title": "" }, { "docid": "6bcdc59b0223db5132560973217c2d3e", "score": "0.4710105", "text": "func IDGTE(id uint64) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "d507ec9c65ae81bc673b4ef96d2d493d", "score": "0.46934655", "text": "func GistIDGTE(v string) predicate.GithubGist {\n\treturn predicate.GithubGist(sql.FieldGTE(FieldGistID, v))\n}", "title": "" }, { "docid": "86bc97d8208b5488d99a18848ac4e222", "score": "0.46887612", "text": "func IDGTE(id int) predicate.Url {\n\treturn predicate.Url(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "f50b9a84594dc13dd59f00614c7f261a", "score": "0.46663463", "text": "func (o *IpamPrefixesListParams) SetChildrenGte(childrenGte *string) {\n\to.ChildrenGte = childrenGte\n}", "title": "" }, { "docid": "8b727dddbfc9a33afc16fcd4091c3cb1", "score": "0.4627013", "text": "func c_setgid(gid Gid_t) _C_int", "title": "" }, { "docid": "83a72b207a1817da18396e914f55f88c", "score": "0.46209714", "text": "func ItemIDGTE(v uuid.UUID) predicate.Share {\n\treturn predicate.Share(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldItemID), v))\n\t})\n}", "title": "" }, { "docid": "16eb1fd455d97ee4bb14f60d73bb625e", "score": "0.462007", "text": "func IDGT(id int) predicate.UserGroup {\n\treturn predicate.UserGroup(sql.FieldGT(FieldID, id))\n}", "title": "" }, { "docid": "ee8d716a1e58f34297029ab76b96c7ff", "score": "0.4596434", "text": "func IDGTE(id uuid.UUID) predicate.Share {\n\treturn predicate.Share(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "4bf719b2726f577e5f72bcee8c1711b5", "score": "0.45782375", "text": "func SetUserID(r *http.Request, id string) {\n\t*r = *r.WithContext(context.WithValue(r.Context(), UserIDKey, id))\n}", "title": "" }, { "docid": "e95e0f1f9f44ee67d4a5b74f0bce2ef5", "score": "0.45585114", "text": "func WithIDGT(id string) FilterReactionsOption {\n\treturn FilterReactionsOption{makeRequestOption(\"id_gt\", id)}\n}", "title": "" }, { "docid": "a7220f070524ef456b761a0be6f2d4ae", "score": "0.4556372", "text": "func (fs *owncloudsqlfs) permissionSet(ctx context.Context, owner *userpb.UserId) *provider.ResourcePermissions {\n\tif owner == nil {\n\t\treturn &provider.ResourcePermissions{\n\t\t\tStat: true,\n\t\t}\n\t}\n\tu, ok := ctxpkg.ContextGetUser(ctx)\n\tif !ok {\n\t\treturn &provider.ResourcePermissions{\n\t\t\t// no permissions\n\t\t}\n\t}\n\tif u.Id == nil {\n\t\treturn &provider.ResourcePermissions{\n\t\t\t// no permissions\n\t\t}\n\t}\n\tif u.Id.OpaqueId == owner.OpaqueId && u.Id.Idp == owner.Idp {\n\t\treturn &provider.ResourcePermissions{\n\t\t\t// owner has all permissions\n\t\t\tAddGrant: true,\n\t\t\tCreateContainer: true,\n\t\t\tDelete: true,\n\t\t\tGetPath: true,\n\t\t\tGetQuota: true,\n\t\t\tInitiateFileDownload: true,\n\t\t\tInitiateFileUpload: true,\n\t\t\tListContainer: true,\n\t\t\tListFileVersions: true,\n\t\t\tListGrants: true,\n\t\t\tListRecycle: true,\n\t\t\tMove: true,\n\t\t\tPurgeRecycle: true,\n\t\t\tRemoveGrant: true,\n\t\t\tRestoreFileVersion: true,\n\t\t\tRestoreRecycleItem: true,\n\t\t\tStat: true,\n\t\t\tUpdateGrant: true,\n\t\t}\n\t}\n\t// TODO fix permissions for share recipients by traversing reading acls up to the root? cache acls for the parent node and reuse it\n\treturn &provider.ResourcePermissions{\n\t\tAddGrant: true,\n\t\tCreateContainer: true,\n\t\tDelete: true,\n\t\tGetPath: true,\n\t\tGetQuota: true,\n\t\tInitiateFileDownload: true,\n\t\tInitiateFileUpload: true,\n\t\tListContainer: true,\n\t\tListFileVersions: true,\n\t\tListGrants: true,\n\t\tListRecycle: true,\n\t\tMove: true,\n\t\tPurgeRecycle: true,\n\t\tRemoveGrant: true,\n\t\tRestoreFileVersion: true,\n\t\tRestoreRecycleItem: true,\n\t\tStat: true,\n\t\tUpdateGrant: true,\n\t}\n}", "title": "" }, { "docid": "7d3dacdf7418d24ee5eeb918d1dfe4e2", "score": "0.45275718", "text": "func (qs AccountQuerySet) UsernameGte(username string) AccountQuerySet {\n\treturn qs.w(qs.db.Where(\"username >= ?\", username))\n}", "title": "" }, { "docid": "31214d5b712f0b6dcf201af089bc8f41", "score": "0.45146072", "text": "func (qs AccountQuerySet) UserIdLte(userId string) AccountQuerySet {\n\treturn qs.w(qs.db.Where(\"user_id <= ?\", userId))\n}", "title": "" }, { "docid": "d28f089c44d9a17013e1702d42d1035e", "score": "0.44875878", "text": "func (o *IpamPrefixesListParams) SetLastUpdatedGte(lastUpdatedGte *string) {\n\to.LastUpdatedGte = lastUpdatedGte\n}", "title": "" }, { "docid": "cbb7a313d0cc1f626e505c2f2200626d", "score": "0.4458226", "text": "func IDGTE(id uuid.UUID) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "cbb7a313d0cc1f626e505c2f2200626d", "score": "0.4458226", "text": "func IDGTE(id uuid.UUID) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "cbb7a313d0cc1f626e505c2f2200626d", "score": "0.4458226", "text": "func IDGTE(id uuid.UUID) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "2ce29d3351877ac7e2861f6d5f90cc7d", "score": "0.44525173", "text": "func (r *Relay) adjustGTID(ctx context.Context, gset gtid.Set) (gtid.Set, error) {\n\t// setup a TCP binlog reader (because no relay can be used when upgrading).\n\tsyncCfg := r.syncerCfg\n\t// always use a new random serverID\n\trandomServerID, err := utils.GetRandomServerID(ctx, r.db.DB)\n\tif err != nil {\n\t\treturn nil, terror.Annotate(err, \"fail to get random server id when relay adjust gtid\")\n\t}\n\tsyncCfg.ServerID = randomServerID\n\ttcpReader := binlogReader.NewTCPReader(syncCfg)\n\tresultGs, err := binlogReader.GetPreviousGTIDFromGTIDSet(ctx, tcpReader, gset)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdbConn, err2 := r.db.DB.Conn(ctx)\n\tif err2 != nil {\n\t\treturn nil, err2\n\t}\n\tdefer dbConn.Close()\n\treturn utils.AddGSetWithPurged(ctx, resultGs, dbConn)\n}", "title": "" }, { "docid": "be4b55e42005df198fcc607898c0dab1", "score": "0.44524342", "text": "func (qs AccountQuerySet) UpdateTimeGte(updateTime int32) AccountQuerySet {\n\treturn qs.w(qs.db.Where(\"update_time >= ?\", updateTime))\n}", "title": "" }, { "docid": "39ba9a8bbbcb63ecdf36dc20585d6541", "score": "0.4442874", "text": "func StudentIDGTE(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldStudentID), v))\n\t})\n}", "title": "" }, { "docid": "dec16625f7c8cd5432e38d52d9471c16", "score": "0.44415903", "text": "func IDGTE(id int) predicate.Systemmember {\n\treturn predicate.Systemmember(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "5740617f4c78b5febbaaff7dfd1990bc", "score": "0.44173637", "text": "func IDGTE(id int) predicate.StudyEligibility {\n\treturn predicate.StudyEligibility(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "35737f32ff0199b52b49c84d5f97a362", "score": "0.4412975", "text": "func (o *ExtrasObjectChangesListParams) WithChangedObjectIDGte(changedObjectIDGte *string) *ExtrasObjectChangesListParams {\n\to.SetChangedObjectIDGte(changedObjectIDGte)\n\treturn o\n}", "title": "" }, { "docid": "db390ab097266a288880c0f3159fe9e2", "score": "0.44097528", "text": "func IDGTE(id int) predicate.GithubGist {\n\treturn predicate.GithubGist(sql.FieldGTE(FieldID, id))\n}", "title": "" }, { "docid": "06c882a8e8d216990b4a994623513ec5", "score": "0.43969932", "text": "func (b *SecurityUserSecurityProfilesCollectionRequestBuilder) ID(id string) *UserSecurityProfileRequestBuilder {\n\tbb := &UserSecurityProfileRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/\" + id\n\treturn bb\n}", "title": "" }, { "docid": "8c4c3785328db3b44f06f4d70677ebe5", "score": "0.4386391", "text": "func (o *IpamPrefixesListParams) SetCreatedGte(createdGte *string) {\n\to.CreatedGte = createdGte\n}", "title": "" }, { "docid": "9ef7b6c65ef6a7300cd0bc79cc92877b", "score": "0.43536004", "text": "func (o *IpamPrefixesListParams) SetMaskLengthGte(maskLengthGte *float64) {\n\to.MaskLengthGte = maskLengthGte\n}", "title": "" }, { "docid": "fc7f2efdc17d38dfd248d97195084a05", "score": "0.4351318", "text": "func (ft *firewallTweaker) set(cidrs []string) {\n\tft.mu.Lock()\n\tdefer ft.mu.Unlock()\n\n\tif len(cidrs) == 0 {\n\t\tft.logf(\"marking for removal\")\n\t} else {\n\t\tft.logf(\"marking allowed %v\", cidrs)\n\t}\n\tft.want = cidrs\n\tif ft.running {\n\t\t// The doAsyncSet goroutine will check ft.want\n\t\t// before returning.\n\t\treturn\n\t}\n\tft.logf(\"starting netsh goroutine\")\n\tft.running = true\n\tgo ft.doAsyncSet()\n}", "title": "" }, { "docid": "04f0b17209a6454bce2d63b462859052", "score": "0.43457747", "text": "func (b *RoleScopeTagAssignmentsCollectionRequestBuilder) ID(id string) *RoleScopeTagAutoAssignmentRequestBuilder {\n\tbb := &RoleScopeTagAutoAssignmentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/\" + id\n\treturn bb\n}", "title": "" }, { "docid": "04f0b17209a6454bce2d63b462859052", "score": "0.43457747", "text": "func (b *RoleScopeTagAssignmentsCollectionRequestBuilder) ID(id string) *RoleScopeTagAutoAssignmentRequestBuilder {\n\tbb := &RoleScopeTagAutoAssignmentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/\" + id\n\treturn bb\n}", "title": "" }, { "docid": "3e46e4f30ea4b5073f551adb4dc6735a", "score": "0.4320577", "text": "func (b *GovernanceResourceRoleAssignmentsCollectionRequestBuilder) ID(id string) *GovernanceRoleAssignmentRequestBuilder {\n\tbb := &GovernanceRoleAssignmentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/\" + id\n\treturn bb\n}", "title": "" }, { "docid": "46a7095117c776d76873437e9b3e54c1", "score": "0.4299765", "text": "func IDGTE(id int) predicate.Training {\n\treturn predicate.Training(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "b3066f0ff8b59178d633bff137bf8be5", "score": "0.42910293", "text": "func IDGTE(id int) predicate.Remedy {\n\treturn predicate.Remedy(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "bc294f9cdd2b789054bf60da283ca5a4", "score": "0.42869362", "text": "func (o *PullRequest) SetIdlers(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*User) error {\n\tquery := \"delete from \\\"idlers\\\" where \\\"pull_request_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.ExecContext(ctx, query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to remove relationships before set\")\n\t}\n\n\tremoveIdlersFromIdledPullRequestsSlice(o, related)\n\tif o.R != nil {\n\t\to.R.Idlers = nil\n\t}\n\treturn o.AddIdlers(ctx, exec, insert, related...)\n}", "title": "" }, { "docid": "96e6919684ff7aaabd0d693f88db63ac", "score": "0.42850778", "text": "func IDGTE(id int) predicate.StatusOpinion {\n\treturn predicate.StatusOpinion(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "4b1cdffe1a215f20d4a00edb060989ac", "score": "0.42830944", "text": "func (o *UsersPermissionsListParams) SetIDLte(iDLte *string) {\n\to.IDLte = iDLte\n}", "title": "" }, { "docid": "409f12cd92ab762815baaf92581345a7", "score": "0.42796847", "text": "func (b *EntitlementManagementAccessPackageResourceRoleScopesCollectionRequestBuilder) ID(id string) *AccessPackageResourceRoleScopeRequestBuilder {\n\tbb := &AccessPackageResourceRoleScopeRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/\" + id\n\treturn bb\n}", "title": "" }, { "docid": "2ea798e74a624a26e1eb2edd873622ec", "score": "0.4270735", "text": "func (qs GroupQuerySet) UpdatedAtGte(updatedAt time.Time) GroupQuerySet {\n\treturn qs.w(qs.db.Where(\"updated_at >= ?\", updatedAt))\n}", "title": "" }, { "docid": "3cfa21d5712ea5fed9b5883f0125f71b", "score": "0.4268679", "text": "func (o *ExtrasObjectChangesListParams) SetIDGt(iDGt *string) {\n\to.IDGt = iDGt\n}", "title": "" }, { "docid": "9ef1d0e22ae2a37ff8aaec63a91c4d6a", "score": "0.42665297", "text": "func (b *SecurityProviderTenantSettingsCollectionRequestBuilder) ID(id string) *ProviderTenantSettingRequestBuilder {\n\tbb := &ProviderTenantSettingRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/\" + id\n\treturn bb\n}", "title": "" }, { "docid": "d95464afd1ba802693a1c46e550830ae", "score": "0.4261183", "text": "func setUidGid(uid int, gid int, t *testing.T) {\n\t// The quantumfs tests are run as root because some tests require\n\t// root privileges. However, root can read or write any file\n\t// irrespective of the file permissions. Obviously if we want to\n\t// test permissions then we cannot run as root.\n\t//\n\t// To accomplish this we lock this goroutine to a particular OS\n\t// thread, then we change the EUID of that thread to something which\n\t// isn't root. Finally at the end we need to restore the EUID of the\n\t// thread before unlocking ourselves from that thread. If we do not\n\t// follow this precise cleanup order other tests or goroutines may\n\t// run using the other UID incorrectly.\n\truntime.LockOSThread()\n\tif gid != -1 {\n\t\terr := syscall.Setregid(-1, gid)\n\t\tif err != nil {\n\t\t\truntime.UnlockOSThread()\n\t\t\tt.Fatal(err.Error())\n\t\t}\n\t}\n\n\tif uid != -1 {\n\t\terr := syscall.Setreuid(-1, uid)\n\t\tif err != nil {\n\t\t\tsyscall.Setregid(-1, 0)\n\t\t\truntime.UnlockOSThread()\n\t\t\tt.Fatal(err.Error())\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "0724f6adfe7d31baaae9d9979c011846", "score": "0.42604813", "text": "func IDGTE(id int) predicate.GithubRepository {\n\treturn predicate.GithubRepository(sql.FieldGTE(FieldID, id))\n}", "title": "" }, { "docid": "230e9be06b4ebbb73a0ae700cca83fd0", "score": "0.42524227", "text": "func (m *AccessReviewsRequestBuilder) ByAccessReviewId(accessReviewId string)(*AccessReviewItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.BaseRequestBuilder.PathParameters {\n urlTplParams[idx] = item\n }\n if accessReviewId != \"\" {\n urlTplParams[\"accessReview%2Did\"] = accessReviewId\n }\n return NewAccessReviewItemRequestBuilderInternal(urlTplParams, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "fadd9253e599715fe70ce9f62c6e815f", "score": "0.42475832", "text": "func (m *EdiscoveryCaseItemRequestBuilder) ReviewSetsById(id string)(*id47c4ed6a666e7b18c72bc095983bb1369ae6f56786b1801b7900b6fca3206c3.EdiscoveryReviewSetItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"ediscoveryReviewSet%2Did\"] = id\n }\n return id47c4ed6a666e7b18c72bc095983bb1369ae6f56786b1801b7900b6fca3206c3.NewEdiscoveryReviewSetItemRequestBuilderInternal(urlTplParams, m.requestAdapter);\n}", "title": "" }, { "docid": "14424ff159eb737f5d57744a75389d66", "score": "0.42474422", "text": "func IDGTE(id int64) predicate.Item {\n\treturn predicate.Item(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "59dcfe773d616d66e352a781b2ac7941", "score": "0.4245782", "text": "func (qs AccountQuerySet) CreateTimeGte(createTime int32) AccountQuerySet {\n\treturn qs.w(qs.db.Where(\"create_time >= ?\", createTime))\n}", "title": "" }, { "docid": "13b2eea120553076e960b88bd5c5a5be", "score": "0.42361668", "text": "func (b *EntitlementManagementAccessPackageAssignmentResourceRolesCollectionRequestBuilder) ID(id string) *AccessPackageAssignmentResourceRoleRequestBuilder {\n\tbb := &AccessPackageAssignmentResourceRoleRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/\" + id\n\treturn bb\n}", "title": "" }, { "docid": "2f9de9267a4fa06238592a9266dc1c1a", "score": "0.42333734", "text": "func IDGTE(id int) predicate.Club {\n\treturn predicate.Club(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "85f625a706d19920944b51d7c6d89fca", "score": "0.42255813", "text": "func IDGTE(id int) predicate.Pendingloanbinding {\n\treturn predicate.Pendingloanbinding(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "258744f314e0c4de78ab0ecccfa27476", "score": "0.42244223", "text": "func pthread_setugid_np(uid uint32, gid uint32) error {\n\t// syscall.RawSyscall blocks, while Syscall does not. Since we\n\t// don't think this blocks, we can use the _slightly_ more\n\t// performant RawSyscall\n\tif _, _, errno := syscall.RawSyscall(syscall.SYS_SETTID, uintptr(uid), uintptr(gid), 0); errno != 0 {\n\t\tif errno == 1 {\n\t\t\treturn &NoPermissionsError{Errno: errno}\n\t\t}\n\n\t\t// It's not clear when this can happen. It's probably\n\t\t// not indicative of a permissions error. But it's\n\t\t// unclear what it means.\n\t\treturn fmt.Errorf(\"calling pthread_setugid_np: %w\", errno)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d512d3c2dd31b0d1df3cb7093f95a0da", "score": "0.42241746", "text": "func (b *GovernanceResourceRoleSettingsCollectionRequestBuilder) ID(id string) *GovernanceRoleSettingRequestBuilder {\n\tbb := &GovernanceRoleSettingRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/\" + id\n\treturn bb\n}", "title": "" }, { "docid": "5765b7bd8e2ce83fb5139a1c24e5e9b9", "score": "0.42235166", "text": "func (s *span) setUser(id string, cfg UserMonitoringConfig) {\n\ttrace := s.context.trace\n\ts.Lock()\n\tdefer s.Unlock()\n\tif cfg.propagateID {\n\t\t// Delete usr.id from the tags since _dd.p.usr.id takes precedence\n\t\tdelete(s.Meta, keyUserID)\n\t\tidenc := base64.StdEncoding.EncodeToString([]byte(id))\n\t\ttrace.setPropagatingTag(keyPropagatedUserID, idenc)\n\t} else {\n\t\t// Unset the propagated user ID so that a propagated user ID coming from upstream won't be propagated anymore.\n\t\ttrace.unsetPropagatingTag(keyPropagatedUserID)\n\t\tdelete(s.Meta, keyPropagatedUserID)\n\t\t// setMeta is used since the span is already locked\n\t\ts.setMeta(keyUserID, id)\n\t}\n\tfor k, v := range map[string]string{\n\t\tkeyUserEmail: cfg.email,\n\t\tkeyUserName: cfg.name,\n\t\tkeyUserScope: cfg.scope,\n\t\tkeyUserRole: cfg.role,\n\t\tkeyUserSessionID: cfg.sessionID,\n\t} {\n\t\tif v != \"\" {\n\t\t\ts.setMeta(k, v)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "adea115c8ae624b075ae40636ae009b2", "score": "0.42183134", "text": "func (n *TxMinedNtfn) SetId(id interface{}) {}", "title": "" }, { "docid": "3acea5d1fff7b0305dcea644031462a3", "score": "0.42116448", "text": "func IDGTE(id int) predicate.Comment {\n\treturn predicate.Comment(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "3bb6a746d87212251d56138bbfe2093b", "score": "0.4211565", "text": "func IDGTE(id int) predicate.Sprint {\n\treturn predicate.Sprint(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t},\n\t)\n}", "title": "" }, { "docid": "7b93258c8cdcdfc3306b79969a741b12", "score": "0.42083475", "text": "func IDGTE(id uuid.UUID) predicate.Revision {\n\treturn predicate.Revision(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "3d48f2be2cbd4493dbd8a80328388bb9", "score": "0.41991457", "text": "func (b *GovernanceResourceRoleAssignmentRequestsCollectionRequestBuilder) ID(id string) *GovernanceRoleAssignmentRequestObjectRequestBuilder {\n\tbb := &GovernanceRoleAssignmentRequestObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/\" + id\n\treturn bb\n}", "title": "" }, { "docid": "66188ace668c4c9db3393e4dc27dd975", "score": "0.41970712", "text": "func IDGTE(id uuid.UUID) predicate.Question {\n\treturn predicate.Question(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "6fce200fc005a3de026d9a99dd92e2af", "score": "0.41927245", "text": "func c_setregid(rgid Gid_t, egid Gid_t) _C_int", "title": "" }, { "docid": "10ad633293e6b50c3c5f7e50d42a1d43", "score": "0.41910672", "text": "func WalletIDGTE(v string) predicate.Pendingloanbinding {\n\treturn predicate.Pendingloanbinding(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldWalletID), v))\n\t})\n}", "title": "" }, { "docid": "6f7dec5529620c2f19127e9ea7810263", "score": "0.41866216", "text": "func (qs GroupQuerySet) CreatedAtGte(createdAt time.Time) GroupQuerySet {\n\treturn qs.w(qs.db.Where(\"created_at >= ?\", createdAt))\n}", "title": "" } ]
948709a9e8343f2ed39f46c7bd18a428
Convenience for simple printing of keys & tree structure
[ { "docid": "d3639950cc81797251814821d2ccab48", "score": "0.0", "text": "func P(n *Node) string {\n\tif n.subtreeHeight == 0 {\n\t\treturn fmt.Sprintf(\"%v\", b2i(n.key))\n\t}\n\treturn fmt.Sprintf(\"(%v %v)\", P(n.leftNode), P(n.rightNode))\n}", "title": "" } ]
[ { "docid": "14a3d6cd25279e14734a6818ea1bee16", "score": "0.74969447", "text": "func (m *tree) String() string {\n\tkeys := m.Keys()\n\tbuf := bytes.NewBufferString(\"{\")\n\tfor _, key := range keys {\n\t\tval, _ := m.Lookup(key)\n\t\tfmt.Fprintf(buf, \"%s: %s, \", key, val)\n\t}\n\tfmt.Fprintf(buf, \"}\\n\")\n\treturn buf.String()\n}", "title": "" }, { "docid": "12c4766c839664d69f4ceff235dd45c6", "score": "0.7146028", "text": "func printTree(v pdf.Value, indent int) {\n\t// Avoid too much recursion.\n\tif indent > 7 {\n\t\tfmt.Println(\"<max depth exceeded>\")\n\t\treturn\n\t}\n\n\tswitch v.Kind() {\n\tcase pdf.Dict:\n\t\tfmt.Println()\n\t\tfor _, key := range v.Keys() {\n\t\t\tfor i := 0; i < indent; i++ {\n\t\t\t\tfmt.Printf(\" \")\n\t\t\t}\n\t\t\tfmt.Printf(\"%s: \", key)\n\t\t\tprintTree(v.Key(key), indent+1)\n\t\t}\n\tcase pdf.Array:\n\t\tfmt.Println()\n\t\tfor i := 0; i < v.Len(); i++ {\n\t\t\tfor i := 0; i < indent; i++ {\n\t\t\t\tfmt.Printf(\" \")\n\t\t\t}\n\t\t\tfmt.Printf(\"- \")\n\t\t\tprintTree(v.Index(i), indent+1)\n\t\t}\n\tcase pdf.Integer:\n\t\tfmt.Println(v.Int64())\n\tcase pdf.String:\n\t\tfmt.Printf(\"%#v\\n\", v.Text())\n\tcase pdf.Name:\n\t\tfmt.Println(v.Name())\n\tdefault:\n\t\tfmt.Println(\"??\")\n\t}\n}", "title": "" }, { "docid": "87082b775969098dd422547f1295e788", "score": "0.70029444", "text": "func dump(tree rtree) string {\n\tvar b strings.Builder\n\ttree.Inspect(func(link, prefix, key string, depth, children int, value interface{}) error {\n\t\tfor ; depth > 0; depth-- {\n\t\t\tb.WriteString(\" \")\n\t\t}\n\t\tb.WriteString(fmt.Sprintf(\"%s-> (%q, %v) key: %q children: %d\\n\", link, prefix, value, key, children))\n\t\treturn nil\n\t})\n\treturn b.String()\n}", "title": "" }, { "docid": "6529b5d98c06e52400b451070d542ec0", "score": "0.69354844", "text": "func (tree *Tree) Print() string {\n\tvar b strings.Builder\n\tfor _, entry := range tree.Entries {\n\t\t// Prepend 0 in front of mode to make it 6 char long.\n\t\tentryMode := strings.Repeat(\"0\", 6-len(entry.mode)) + entry.mode\n\n\t\tfmt.Fprintf(&b, \"%s %s %s\\t%s\\n\",\n\t\t\tentryMode, entry.objType, entry.hash, entry.name)\n\t}\n\n\treturn b.String()\n}", "title": "" }, { "docid": "dfb1f2ddea272f4eb4ef953722706d77", "score": "0.6774998", "text": "func (t *Treap) Print() {\n\tt.Each(func(x *Node) {\n\t\tfmt.Printf(\"%v:%v, \", x.Key, x.Val)\n\t})\n\tfmt.Println()\n}", "title": "" }, { "docid": "7a7423f9bc7e46d90eab3b17f239d405", "score": "0.67673856", "text": "func PrintKeys(l KVList) {\n\tfor _, kv := range l {\n\t\tfmt.Print(kv.Key, \" \")\n\t}\n\tfmt.Println(\" \")\n}", "title": "" }, { "docid": "97fb4bec4d402ba2538565002848a2a1", "score": "0.6677878", "text": "func PrintTree(t *Tree, prefix string) {\n\tif len(t.Nodes) == 0 {\n\t\tfmt.Println(prefix, t.Name, t.Value)\n\t} else {\n\t\tif t.Name != nil {\n\t\t\tfmt.Println(prefix, t.Name)\n\t\t}\n\t\tfor _, st := range t.Nodes {\n\t\t\tPrintTree(st, prefix+\"-\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9e4504f21571f1659fafd7db008b99af", "score": "0.66659796", "text": "func printNode(prefix string, n Node) {\n\tswitch tn := n.(type) {\n\tcase EmptyNode:\n\t\tfmt.Printf(\"%s empty\\n\", prefix)\n\t\treturn\n\tcase *HashNode:\n\t\tfmt.Printf(\"%s %s\\n\", prefix, tn.Hash().StringLE())\n\tcase *BranchNode:\n\t\tfor i, c := range tn.Children {\n\t\t\tif isEmpty(c) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfmt.Printf(\"%s [%2d] ->\\n\", prefix, i)\n\t\t\tprintNode(prefix+\" \", c)\n\t\t}\n\tcase *ExtensionNode:\n\t\tfmt.Printf(\"%s extension-> %s\\n\", prefix, hex.EncodeToString(tn.key))\n\t\tprintNode(prefix+\" \", tn.next)\n\tcase *LeafNode:\n\t\tfmt.Printf(\"%s leaf-> %s\\n\", prefix, hex.EncodeToString(tn.value))\n\t}\n}", "title": "" }, { "docid": "fd979d90c2183320021929a635373328", "score": "0.6602206", "text": "func PrintTree(r *Node) {\n m := make(map[Value]int)\n InOrder(r, m)\n\n //do level-order traversal\n var treeBuffer *list.List\n var treeBNBuffer *list.List\n\n treeBNBuffer =list.New()\n treeBNBuffer.PushBack(r)\n var preindent int;\n for true{\n //We do double buffer here: all the child pointers in the backend buffer (named with BN)\n //and then swap it when we go to a new iteration.\n treeBuffer = treeBNBuffer\n treeBNBuffer =list.New()\n preindent =0\n for b := treeBuffer.Front(); b != nil; b =b.Next(){\n bt := b.Value.(*Node)\n if bt == nil {\n continue\n }\n //The position in the map is the number of white space we want to print\n indent := m[bt.val]\n for i:=0; i < indent - preindent -1; i++ {\n fmt.Print(\",\")\n }\n fmt.Print(fmt.Sprintf(\"%c\",bt.val))\n preindent = indent\n treeBNBuffer.PushBack(bt.left)\n treeBNBuffer.PushBack(bt.right)\n }\n fmt.Println()\n //break when there is no more element\n if treeBNBuffer.Len() ==0 {\n break;\n }\n }\n}", "title": "" }, { "docid": "acc94061ff26c5244289f5f24a5521f3", "score": "0.65820056", "text": "func (n *node) print(w io.Writer, level int) {\n\tfmt.Fprintf(w, \"%sNODE:%v\\n\", strings.Repeat(\" \", level), n.items)\n\tfor _, c := range n.children {\n\t\tc.print(w, level+1)\n\t}\n}", "title": "" }, { "docid": "84f004d1a582b488c0b6e8d640f2ad3c", "score": "0.65606695", "text": "func PrintInorder(n *Node) {\n\tif n != nil {\n\t\tPrintInorder(n.Left)\n\t\tfmt.Print(n.Key)\n\t\tPrintInorder(n.Right)\n\t}\n}", "title": "" }, { "docid": "a0ada704e229191cfcdaa61037f7f92d", "score": "0.6548502", "text": "func (m *Matcher) PrintTree() {}", "title": "" }, { "docid": "e63d828450b891cb44b24c8ce60a89b8", "score": "0.6478127", "text": "func test_printTree() {\n\tfmt.Println(\"test_printTree: BEGIN\")\n\n\t// create tree\n\tn := new(FHeapNode)\n\tn.key = 1\n\n\t// level 1 children\n\tl1n1 := new(FHeapNode)\n\tl1n1.key = 2\n\tl1n1.parent = n\n\tn.child = l1n1\n\n\tl1n2 := new(FHeapNode)\n\tl1n2.key = 3\n\tl1n2.parent = n\n\n\tl1n1.prev = l1n2\n\tl1n1.next = l1n2\n\tl1n2.prev = l1n1\n\tl1n2.next = l1n1\n\t// level 2 children\n\n\tl2n1 := new(FHeapNode)\n\tl2n1.key = 4\n\n\tl2n2 := new(FHeapNode)\n\tl2n2.key = 5\n\n\tl2n1.prev = l2n2\n\tl2n1.next = l2n2\n\tl2n2.prev = l2n1\n\tl2n2.next = l2n1\n\tl1n1.child = l2n1\n\tl2n1.parent = l1n1\n\tl2n2.parent = l1n1\n\n\n\tl2n3 := new(FHeapNode)\n\tl2n3.key = 6\n\n\tl2n4 := new(FHeapNode)\n\tl2n4.key = 7\n\n\tl2n3.prev = l2n4\n\tl2n3.next = l2n4\n\tl2n4.prev = l2n3\n\tl2n4.next = l2n3\n\tl1n2.child = l2n3\n\tl2n3.parent = l1n2\n\tl2n4.parent = l1n2\n\n\t// print\n\tn.printTree()\n\t\n\tfmt.Println()\n\tfmt.Println(\"test_printTree: SUCCESS\")\n}", "title": "" }, { "docid": "327e30683e3d37159565f8cfe8d42c58", "score": "0.6453825", "text": "func (m *Map[K, V]) String() string {\n\tstr := \"RedBlackTree\\n\"\n\tif !m.Empty() {\n\t\toutput(m.Root, \"\", true, &str)\n\t}\n\treturn str\n}", "title": "" }, { "docid": "11e13326848fff207bafe9d1f81cbf93", "score": "0.64274055", "text": "func printTree(t *api.Tree, w io.Writer) {\n\tname := colorizeByStatus(t.RootDir.Status, t.RootDir.Name)\n\tfmt.Fprintf(w, \"%s/\\n\", name)\n\n\tprintDirContentsRecursively(t.RootDir, \"\", w)\n\n\tfmt.Fprintf(w,\n\t\t\"\\n%s, %s\\n\",\n\t\tpluralize(\"directory\", \"directories\", t.DirCount()),\n\t\tpluralize(\"secret\", \"secrets\", t.SecretCount()),\n\t)\n}", "title": "" }, { "docid": "944fa1b8198268059cbf9e92ffa168aa", "score": "0.6393188", "text": "func (it *Iterator) printLevel(i int) {\n\tif ni, ok := it.stack[i].(*nodeIter); ok {\n\t\tfmt.Print(i, \" | \")\n\t\tni2 := ni.node.iter()\n\t\tfor ni2.next() {\n\t\t\tif ni2.pos == ni.pos {\n\t\t\t\tfmt.Print(\"(\")\n\t\t\t}\n\t\t\tif i == 0 {\n\t\t\t\tfmt.Print(it.bt.getLeafKey(ni2.offset), \" \")\n\t\t\t} else if len(ni2.known) == 0 {\n\t\t\t\tfmt.Print(\"'' \")\n\t\t\t} else {\n\t\t\t\tfmt.Print(string(ni2.known), \" \")\n\t\t\t}\n\t\t}\n\t\tif ni.pos >= ni2.pos {\n\t\t\tfmt.Print(\"(\")\n\t\t}\n\t} else {\n\t\tfmt.Print(i, \" + \")\n\t\tci := it.stack[i].(*chunkIter)\n\t\tfor j, s := range ci.c {\n\t\t\tif j == ci.i {\n\t\t\t\tfmt.Print(\"(\")\n\t\t\t}\n\t\t\tfmt.Print(s.key, \" \")\n\t\t}\n\t\tif ci.i >= len(ci.c) {\n\t\t\tfmt.Print(\"(\")\n\t\t}\n\t}\n\tfmt.Println()\n}", "title": "" }, { "docid": "0b16ec27485f88335c7db8686e3cce36", "score": "0.6391893", "text": "func print_leaves(root *node) {\n\tvar i int\n\tvar c *node = root\n\tif root == nil {\n\t\tfmt.Printf(\"Empty tree.\\n\")\n\t\treturn\n\t}\n\tfor !c.is_leaf {\n\t\tc = c.ptrs[0].(*node)\n\t}\n\tfor {\n\t\tfor i = 0; i < c.num_keys; i++ {\n\t\t\tfmt.Printf(\"%s \", c.keys[i])\n\t\t}\n\t\tif c.ptrs[ORDER-1] != nil {\n\t\t\tfmt.Printf(\" | \")\n\t\t\tc = c.ptrs[ORDER-1].(*node)\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\tfmt.Printf(\"\\n\")\n}", "title": "" }, { "docid": "e3f17f51cfeac1de24fe840615996450", "score": "0.63745284", "text": "func printTree(c Completer, w io.Writer) {\n\tvar hasSibling []bool\n\tdoPrintTree(c, w, 0, hasSibling)\n}", "title": "" }, { "docid": "4a1ec270ec0d364bdfbda41f549447d7", "score": "0.6364768", "text": "func (n *node) printTree(pfx string, tail bool) {\n\tp := prefix(tail, pfx, \"└── \", \"├── \")\n\tfmt.Printf(\"%s%s, %p: type=%d, parent=%p, resource=%v\\n\", p, n.prefix, n, n.typ, n.parent, n.resource.Cors.GetAllowMethods())\n\n\tchildren := n.children\n\tl := len(children)\n\tp = prefix(tail, pfx, \" \", \"│ \")\n\tfor i := 0; i < l-1; i++ {\n\t\tchildren[i].printTree(p, false)\n\t}\n\tif l > 0 {\n\t\tchildren[l-1].printTree(p, true)\n\t}\n}", "title": "" }, { "docid": "4f3c728db347b1e7a03610b174d69776", "score": "0.6332925", "text": "func (c *Chain) PrintKey() {\n\tfmt.Println(c.conf.ElectionKey.Lambda)\n\tfmt.Println(c.conf.ElectionKey.Mu)\n}", "title": "" }, { "docid": "46cb5fbbc6893f3c6704356cbb9f725a", "score": "0.63199806", "text": "func (tree *AVLTree) Print() {\n\tfmt.Println(tree.String())\n}", "title": "" }, { "docid": "eba52a4bb70129dc23f56935b0531a2b", "score": "0.631805", "text": "func print1(depth int, nd *FooNode) {\n\tindent := strings.Repeat(\" \", depth)\n\n\tif depth > 6 {\n\t\tfmt.Print(indent + \"overflow\")\n\t\tfor i := range nd.vals {\n\t\t\tfmt.Printf(\" %#x\", nd.vals[i].key)\n\t\t}\n\t\tfmt.Println()\n\t\treturn\n\t}\n\n\tif nd.bmVal != 0 {\n\t\tfmt.Printf(indent+\"vals %032b \", nd.bmVal)\n\t\tfor i := range nd.vals {\n\t\t\tfmt.Printf(\"%#x \", nd.vals[i].key)\n\t\t}\n\t\tfmt.Println()\n\t}\n\tif nd.bmPtr != 0 {\n\t\tfmt.Printf(indent+\"ptrs %032b\\n\", nd.bmPtr)\n\t\tfor _, p := range nd.ptrs {\n\t\t\tprint1(depth+1, p)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "806e555365239c44a6dfb1fca4e769b7", "score": "0.63151944", "text": "func PrintKeyValue(kv storage.MVCCKeyValue) {\n\tfmt.Println(SprintKeyValue(kv, true /* printKey */))\n}", "title": "" }, { "docid": "6deb98c3128c0b550553780851969f62", "score": "0.6307372", "text": "func print(ht FooHamt) {\n\tprint1(0, ht.root)\n}", "title": "" }, { "docid": "9cff1b6278c50492eefce20c9a2a6b0e", "score": "0.6291814", "text": "func (bst *DualTree) Print() {\n\tbst.lock.Lock()\n\tdefer bst.lock.Unlock()\n\tfmt.Println(\"------------------------------------------------\")\n\tstringify(bst.root, 0)\n\tfmt.Println(\"------------------------------------------------\")\n}", "title": "" }, { "docid": "73d4059350fdeed951ac6717a25bb1e5", "score": "0.6288409", "text": "func (T *Tree) TreePrint() string {\n\tif T == nil {\n\t\treturn \"()\"\n\t}\n\ts := \"\"\n\tif T.Left != nil {\n\t\ts += T.Left.TreePrint() + \" \"\n\t}\n\ts += fmt.Sprintf(\"%v\", T.Value)\n\tif T.Right != nil {\n\t\ts += \" \" + T.Right.TreePrint()\n\t}\n\treturn \"(\" + s + \")\"\n}", "title": "" }, { "docid": "ca3b80c23dccc5f07ebf676da9e024fc", "score": "0.62602705", "text": "func (k *Key) String() string { return fmt.Sprintf(\"%#v\", k) }", "title": "" }, { "docid": "36da94b1a97564a2fca39ee06e3f5545", "score": "0.62567115", "text": "func (n *Node) printTree() {\n\tif (n == nil){ return }\n\n\tn.Left.printTree()\n\tfmt.Printf(\"%d \", n.Data)\n\tn.Right.printTree()\n}", "title": "" }, { "docid": "c831dfb1a09aad5b43cf99bd655dd03b", "score": "0.62477875", "text": "func (tree *Tree) printInOrder(node *Node) {\n if node == nil {\n return\n }\n tree.printInOrder(node.leftchild)\n fmt.Printf(\"%d\\n\", node.value)\n tree.printInOrder(node.rightchild)\n}", "title": "" }, { "docid": "c6aeb331b9e3d37b47394b66eb257ac9", "score": "0.62399", "text": "func printTree(size int) {\n\tfmt.Printf(\"%*s\\n\", size + 1, \"*\")\n\tmidSpace := 2\n\tfor i := size; i > 0; i-- {\n\t\tfmt.Printf(\"%*s \", i, \"/\")\n\t\tfmt.Printf(\"%*s\", midSpace, \"\\\\\\n\")\n\t\tmidSpace += 2\n\t}\n\tprintln(strings.Repeat(\"-\", ((size * 2) + 1)))\n\tfmt.Printf(\"%*s\\n\", size + 1, \"#\")\n}", "title": "" }, { "docid": "df972ac4696a4eaedc2e69f8d8c3ac02", "score": "0.6224074", "text": "func (n *Node) String() string {\n\tids := make([]string, 0, 5) // overestimate\n\n\t// Traverse the (kind, id) list starting from tail.\n\tp := n.Key\n\tkind := \"\"\n\tfor p != nil {\n\t\tif kind = p.Kind(); !strings.HasPrefix(kind, \"_\") {\n\t\t\tids = append(ids, p.ID())\n\t\t}\n\t\tp = p.Container()\n\t}\n\n\t// Reverse the result to get head-to-tail order.\n\tfor l, r := 0, len(ids)-1; l < r; l, r = l+1, r-1 {\n\t\tids[l], ids[r] = ids[r], ids[l]\n\t}\n\n\t// Deal with namespaced keys. Their root container kind (last visited) has\n\t// form \"@...\".\n\tpfx := \"\"\n\tif strings.HasPrefix(kind, \"@\") {\n\t\tif ns := ids[0]; ns != \"\" {\n\t\t\tpfx = ns + \":\"\n\t\t}\n\t\tids = ids[1:]\n\t}\n\n\treturn fmt.Sprintf(\"%s(%q)\", n.Key.Kind(), pfx+strings.Join(ids, \"/\"))\n}", "title": "" }, { "docid": "ddfec42f980c496144942752d6d4e679", "score": "0.6223847", "text": "func (cli *DockerCli) printTreeNode(noTrunc bool, image *engine.Env, prefix string) {\n\tvar imageID string\n\tif noTrunc {\n\t\timageID = image.Get(\"Id\")\n\t} else {\n\t\timageID = utils.TruncateID(image.Get(\"Id\"))\n\t}\n\n\tfmt.Fprintf(cli.out, \"%s%s Virtual Size: %s\", prefix, imageID, units.HumanSize(float64(image.GetInt64(\"VirtualSize\"))))\n\tif image.GetList(\"RepoTags\")[0] != \"<none>:<none>\" {\n\t\tfmt.Fprintf(cli.out, \" Tags: %s\\n\", strings.Join(image.GetList(\"RepoTags\"), \", \"))\n\t} else {\n\t\tfmt.Fprint(cli.out, \"\\n\")\n\t}\n}", "title": "" }, { "docid": "8d18b1ecb257130028c585b082e35123", "score": "0.6216451", "text": "func stringify(n *DualTreeNode, level int) {\n\tif n != nil {\n\t\tformat := \"\"\n\t\tfor i := 0; i < level; i++ {\n\t\t\tformat += \" \"\n\t\t}\n\t\tformat += \"---[ \"\n\t\tlevel++\n\t\tstringify(n.right, level)\n\t\tfmt.Printf(format+\"%s\\n\", n.value)\n\t\tstringify(n.left, level)\n\t}\n}", "title": "" }, { "docid": "b8fc11b39d465165e7f759c720213471", "score": "0.619358", "text": "func (n *Namespace) print() {\n\tfmt.Println(\"\\tprotected: \", n.Protected)\n\tfmt.Println(\"\\tdisabled: \", n.disabled)\n\tfmt.Println(\"\\tlabels:\")\n\tprintMap(n.Labels, 2)\n\tfmt.Println(\"\\tannotations:\")\n\tprintMap(n.Annotations, 2)\n\tfmt.Println(\"-------------------\")\n}", "title": "" }, { "docid": "8f26b6d828c6e5f87bc63d66bdc8cb63", "score": "0.6187512", "text": "func stringify(n *Node, level int) {\n\tif n != nil {\n\t\tformat := \"\"\n\t\tfor i := 0; i < level; i++ {\n\t\t\tformat += \" \"\n\t\t}\n\t\tformat += \"---[ \"\n\t\tlevel++\n\t\tstringify(n.left, level)\n\t\tfmt.Printf(format+\"%v\\n\", n.data)\n\t\tstringify(n.right, level)\n\t}\n}", "title": "" }, { "docid": "5a3830c840033420a6a49de506364dd9", "score": "0.6169554", "text": "func (t *simpleTrie) Print() {\n\tprintTrie(&simpleNode{ v : \"\", n : t })\n}", "title": "" }, { "docid": "c972c5e61bed96ff0d5b1b16967138cd", "score": "0.6167428", "text": "func stringify(n *btNode, level int) {\n\tif n != nil {\n\t\tformat := \"\"\n\t\tfor i := 0; i < level; i++ {\n\t\t\tformat += \" \"\n\t\t}\n\t\tformat += \"---[ \"\n\t\tlevel++\n\t\tstringify(n.left, level)\n\t\tfmt.Printf(format+\"%d\\n\", n.val)\n\t\tstringify(n.right, level)\n\t}\n}", "title": "" }, { "docid": "b66c47b0e304e463232409cf4ec4e1bd", "score": "0.61662346", "text": "func (o *OIDTrie) DebugPrint() {\n\to.debugPrintRecursive(\"\")\n}", "title": "" }, { "docid": "6ee9a629f2e7754dc0abb25e24e171a7", "score": "0.616189", "text": "func TreePrint(root Node) string {\n\ttree := tp.New()\n\n\tp(root, tree)\n\treturn tree.String()\n}", "title": "" }, { "docid": "73247721200d82cd2239c4c2684bbd4b", "score": "0.61605394", "text": "func (t *KDTree) String() string {\n\treturn fmt.Sprintf(\"[%s]\", printTreeNode(t.root))\n}", "title": "" }, { "docid": "4cfae7ad502233d39b6aceb3b9953d62", "score": "0.61497074", "text": "func (t *Trie) Print() {\n\tt.root.print(\"\", 0, false)\n}", "title": "" }, { "docid": "de1c12d4e64eb5fa5a1c0ab3e706825e", "score": "0.6118682", "text": "func (k Key) String() string {\n\tvar buf bytes.Buffer\n\tfor i := 0; i < k.Length(); i++ {\n\t\tfmt.Fprintf(&buf, \"/%s\", k.Value(i))\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "6af6817524d592391dc2ac98a63be3f3", "score": "0.6103569", "text": "func (t *Btree) PrintInfo() {\n\tfmt.Println(\"Root\", t.GetRoot())\n\tfmt.Println(\"IndexCursor\", t.GetIndexCursor())\n}", "title": "" }, { "docid": "a0bc39e76aed6b449562ce81df0af1a9", "score": "0.6089299", "text": "func showInOrder(root *Node) {\n\tif root != nil {\n\t\tshowInOrder(root.left)\n\t\tfmt.Println(root.value)\n\t\tshowInOrder(root.right)\n\t}\n}", "title": "" }, { "docid": "0f241cbeb02811f2c33814abc2f8c563", "score": "0.60878223", "text": "func printKey(key *servers.Key, name string) {\n\tfmt.Println()\n\tfmt.Printf(\"Name: %s (%s)\\n\", name, key.Type)\n\n\tif key.Type == \"dns\" {\n\t\tfmt.Printf(\"Hostname: %s\\n\", key.Data[\"Hostname\"].Value)\n\t\tfmt.Printf(\"Record Type: %s\\n\", key.Data[\"RecordType\"].Value)\n\t\tfmt.Printf(\"Response: %s\\n\", key.Data[\"Response\"].Value)\n\t\tfmt.Printf(\"TTL: %s\\n\", key.Data[\"TTL\"].Value)\n\t} else if key.Type == \"http\" {\n\t\tfmt.Printf(\"URL: %s\\n\", key.Data[\"URL\"].Value)\n\t\tfmt.Printf(\"FilePath: %s\\n\", key.Data[\"FilePath\"].Value)\n\t} else {\n\t\tfmt.Printf(\"[!] Unknown key type: %s\\n\", key.Type)\n\t\treturn\n\t}\n\n\tfmt.Println()\n\tfmt.Println(\"Hashes of response:\")\n\tfor k, v := range key.Hashes {\n\t\tfmt.Printf(\"%s: '%s'\\n\", k, v)\n\t}\n\n\tfmt.Println()\n\tconstraints := servers.AlphabetizeConstraints(key.Constraints)\n\tfmt.Println(\"Constraints:\")\n\tfor _, name := range constraints {\n\t\tfmt.Printf(\" %s '%s'\\n\", columnString(name), key.Constraints[name].Constraint)\n\t}\n\tfmt.Println()\n}", "title": "" }, { "docid": "363b4886d347ea223289cfc29980502d", "score": "0.6074894", "text": "func PrintTree(w io.Writer, ml Model) {\n\tprintWithPrefix(w,ml,\"\")\n}", "title": "" }, { "docid": "f83286f5c94aee0ae0897402d932660a", "score": "0.6059242", "text": "func (c *DescribeCommand) print(out io.Writer, r *fastly.PrivateKey) error {\n\tfmt.Fprintf(out, \"\\nID: %s\\n\", r.ID)\n\tfmt.Fprintf(out, \"Name: %s\\n\", r.Name)\n\tfmt.Fprintf(out, \"Key Length: %d\\n\", r.KeyLength)\n\tfmt.Fprintf(out, \"Key Type: %s\\n\", r.KeyType)\n\tfmt.Fprintf(out, \"Public Key SHA1: %s\\n\", r.PublicKeySHA1)\n\n\tif r.CreatedAt != nil {\n\t\tfmt.Fprintf(out, \"Created at: %s\\n\", r.CreatedAt)\n\t}\n\n\tfmt.Fprintf(out, \"Replace: %t\\n\", r.Replace)\n\n\treturn nil\n}", "title": "" }, { "docid": "0a37c948fdddf9942803082349ba8632", "score": "0.6054696", "text": "func (n *Node) String() string {\n\treturn \"[\" + strconv.Itoa(n.Key) + \"] \" + n.Data\n}", "title": "" }, { "docid": "f9c629b3e9175c38979ad2dbcbe28c66", "score": "0.6051145", "text": "func (pf PlainTextFormatter) Print(facts map[string]interface{}, keyfilters [][]string, level int) error {\n\tif len(keyfilters) > 0 {\n\t\tPrintFilteredFacts(keyfilters, facts)\n\t} else {\n\t\tb, err := json.MarshalIndent(facts, \"\", \" \")\n\t\tif err == nil {\n\t\t\tos.Stdout.Write(b)\n\t\t\tfmt.Println(\"\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ce090dbc33314acea9678d37d2a3244f", "score": "0.6034838", "text": "func (t *Tree) ToString(ctx context.Context) string {\n\tstr := fmt.Sprintf(\"\\nroot: %s depth: %v\\n\", base64.StdEncoding.EncodeToString(t.GetRootHash()), t.Depth)\n\tfor i := 0; i < t.Depth; i++ {\n\t\tstr += fmt.Sprintf(\"Depth: %v\", i)\n\t\tfor _, l := range t.Layers[i] {\n\t\t\tstr = str + fmt.Sprintf(\" - H: %s T: %v L: %v\", base64.StdEncoding.EncodeToString(l.Hash), l.Type, l.IsLeft)\n\t\t}\n\t\tstr += \"\\n\"\n\t}\n\n\treturn str\n}", "title": "" }, { "docid": "d7dc00f40e0951d745170dcd97ebc3bd", "score": "0.60315114", "text": "func (n Node) String() string {\n\tvar w strings.Builder\n\tw.WriteString(\"DUMP: Node info\\n\\n\")\n\tw.WriteString(fmt.Sprintf(\"Predecessor: %s\\n\\n\", n.Predecessor))\n\tw.WriteString(fmt.Sprintf(\"Address: %s\\n\\n\", n.Address))\n\tfor i, successor := range n.Successors {\n\t\tw.WriteString(fmt.Sprintf(\"Sucessor[%d]: %s\\n\", i, successor))\n\t}\n\n\t// Print only unique finger table entries\n\tunique := make(map[Address]int)\n\tfor i, address := range n.Fingers {\n\t\tunique[address] = i\n\t}\n\n\ttype fingerEntry struct {\n\t\tentry int\n\t\taddress Address\n\t}\n\torderedUnique := []fingerEntry{}\n\tfor address, entry := range unique {\n\t\tif address != \"\" {\n\t\t\torderedUnique = append(orderedUnique, fingerEntry{entry, address})\n\t\t}\n\t}\n\tsort.Slice(orderedUnique, func(i, j int) bool {\n\t\treturn orderedUnique[i].entry < orderedUnique[j].entry\n\t})\n\tw.WriteString(\"\\nFinger table:\\n\")\n\tfor _, finger := range orderedUnique {\n\t\tw.WriteString(fmt.Sprintf(\" %-5s: %s\\n\", fmt.Sprintf(\"[%d]\", finger.entry), finger.address))\n\t}\n\n\tif len(n.Data) > 0 {\n\t\tw.WriteString(\"\\nData items:\\n\")\n\t\t// Order keys in map by hash\n\t\tordered := []KeyValue{}\n\t\tfor key, value := range n.Data {\n\t\t\tordered = append(ordered, KeyValue{key, value})\n\t\t}\n\t\tsort.Slice(ordered, func(i, j int) bool {\n\t\t\treturn ordered[i].Key.hashed().Cmp(ordered[j].Key.hashed()) < 0\n\t\t})\n\t\tfor _, kv := range ordered {\n\t\t\tw.WriteString(fmt.Sprintf(\" %s\\n\", kv))\n\t\t}\n\t} else {\n\t\tw.WriteString(\"\\nNo data items\\n\")\n\t}\n\n\treturn w.String()\n}", "title": "" }, { "docid": "a7339473d625254d9e61f881cdd67a02", "score": "0.6030992", "text": "func (t *Btree) PrintTree() {\n\tfmt.Println(\"-----------Tree-------------\")\n\tfor i := 0; i < int(t.GetIndexCursor()); i++ {\n\t\tif node, err := t.getTreeNode(int64(i)); err == nil {\n\t\t\tif node.GetIsDirt() == 0 {\n\t\t\t\tnode.printNode()\n\t\t\t\tfmt.Println(\"--------\")\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "64f9973641def1b3bbc0e988dcc947f6", "score": "0.60275835", "text": "func (n *Node) OrderPrint() {\n\tif n.Left != nil {\n\t\tn.Left.OrderPrint()\n\t}\n\tfmt.Printf(\"%d \", n.Value)\n\tif n.Right != nil {\n\t\tn.Right.OrderPrint()\n\t}\n}", "title": "" }, { "docid": "0a126bf631f6b6db22f9358c69adc2e3", "score": "0.60123163", "text": "func (s *State) print() {\n\tfmt.Println(\"\\nMetadata: \")\n\tfmt.Println(\"--------- \")\n\tprintMap(s.Metadata, 0)\n\tfmt.Println(\"\\nContext: \")\n\tfmt.Println(\"--------- \")\n\tfmt.Println(s.Context)\n\tfmt.Println(\"\\nCertificates: \")\n\tfmt.Println(\"--------- \")\n\tprintMap(s.Certificates, 0)\n\tfmt.Println(\"\\nSettings: \")\n\tfmt.Println(\"--------- \")\n\tfmt.Printf(\"%+v\\n\", s.Settings)\n\tfmt.Println(\"\\nNamespaces: \")\n\tfmt.Println(\"------------- \")\n\tprintNamespacesMap(s.Namespaces)\n\tfmt.Println(\"\\nRepositories: \")\n\tfmt.Println(\"------------- \")\n\tprintMap(s.HelmRepos, 0)\n\tfmt.Println(\"\\nApplications: \")\n\tfmt.Println(\"--------------- \")\n\tfor _, r := range s.Apps {\n\t\tr.print()\n\t}\n\tfmt.Println(\"\\nTargets: \")\n\tfmt.Println(\"--------------- \")\n\tfor t := range s.targetMap {\n\t\tfmt.Println(t)\n\t}\n}", "title": "" }, { "docid": "b7f7848fd80b46ff30c3f84cd51608f7", "score": "0.60116625", "text": "func (starMap StarMapType) Print() {\n\tif Debug {\n\t\tdefer debug.TimeMe(time.Now())\n\t}\n\t\n\tstarMap.Summary()\n\tfor _, star := range starMap.Keys() {\n\t\tstarMap[star].Print()\n\t}\n\tfmt.Println(\"\\n=== Summary ===\\n\")\n\tstarMap.Summary()\n}", "title": "" }, { "docid": "ad3f6cd8fb18cd9c9db1946459b21749", "score": "0.6005547", "text": "func (stack *Stack) Print() {\n\tfor node := stack.root; node != nil; {\n\t\tfmt.Println(node.v)\n\t\tnode = node.next\n\t}\n}", "title": "" }, { "docid": "a34dcdf645f531e5a65b64da5ab0ebe1", "score": "0.5997156", "text": "func (m *Matcher) PrintOrdered() {\n\tfmt.Println(\"Ordered:\")\n\tprintOrdered(m.root, 0)\n}", "title": "" }, { "docid": "d62183d80b910e5872e08de81aed50aa", "score": "0.5987973", "text": "func printDepTree(buf *bufio.Writer, depTree *DependencyTree, level int, skipDuplicates bool) {\n\tfor idx := 0; idx < level; idx++ {\n\t\tio.WriteString(buf, \"\\t\")\n\t}\n\n\tio.WriteString(buf, fmt.Sprintf(\"- %s@%s\\n\", depTree.Mod.Path, depTree.Mod.Version))\n\tfor _, depSubtree := range depTree.Dependencies {\n\t\tprintDepTree(buf, &depSubtree, level+1, skipDuplicates)\n\t}\n}", "title": "" }, { "docid": "551ae5c78604e779d7a911cf0d9bf29b", "score": "0.5980693", "text": "func (node *Node) debug_print() {\n fmt.Println(node.inspect())\n}", "title": "" }, { "docid": "bcd35ec0464093a3489d2d6e33bdd53f", "score": "0.5947713", "text": "func (e *Engine) DebugPrint(indent string) string {\n\tvar buf strings.Builder\n\te.Iterate(func(key storage.MVCCKey, value []byte, err error) {\n\t\tif buf.Len() > 0 {\n\t\t\tbuf.WriteString(\"\\n\")\n\t\t}\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(&buf, \"(err:%s)\", err)\n\t\t} else {\n\t\t\tfmt.Fprintf(&buf, \"%s%s %s -> %s\",\n\t\t\t\tindent, key.Key, key.Timestamp, roachpb.Value{RawBytes: value}.PrettyPrint())\n\t\t}\n\t})\n\treturn buf.String()\n}", "title": "" }, { "docid": "10122bd964d7c846198f6001e13312f2", "score": "0.593688", "text": "func print_nodes(nodes []Node, itr int) {\n\tfor _, n := range nodes {\n\t\tfmt.Printf(\"nodes() %s : %s - %d \\n\", n.XMLName.Local, n.Key, itr)\n\t\tprint_nodes(n.Nodes, itr+1)\n\t}\n}", "title": "" }, { "docid": "7acec973b657a844d4967ce44f0833e5", "score": "0.592961", "text": "func PrintTree(node api.INode) {\n\tfmt.Println(\"---------- Tree ---------------\")\n\tprintBranch(0, node)\n\n\tchildren := node.Children()\n\tif children != nil {\n\t\tprintSubTree(children, 1)\n\t}\n\n\tfmt.Println(\"-------------------------------\")\n}", "title": "" }, { "docid": "e98ea5c14ea195163d0e17ae44728330", "score": "0.5926147", "text": "func test_FHeapNode_print() {\n\tfmt.Println(\"test_FHeapNode_print: BEGIN\")\n\n\tn := new(FHeapNode)\n\tn.key = 1\n\tn.prev = n\n\tn.next = n\n\n\tn.print()\n\tfmt.Println()\n\tfmt.Println(\"test_FHeapNode_print: SUCCESS\")\n}", "title": "" }, { "docid": "ce529502422faf44e106062cbda28b68", "score": "0.5920698", "text": "func (n *Node) Dump(w io.Writer, d int, full bool) {\n\tfmt.Fprint(w, strings.Repeat(\" \", d), n.Name, \":\")\n\tvar arrayReplacer = strings.NewReplacer(\"[\", \"{\\n a:\", \"]\", \"\\n\"+strings.Repeat(\" \", d)+\"}\", \" \", \", \")\n\tfor i, p := range n.Attributes {\n\t\tif !full && p.Len() > 16 {\n\t\t\tfmt.Fprintf(w, \" *%d { SKIPPED }\", p.Len())\n\t\t\tcontinue\n\t\t}\n\t\ts := p.String()\n\t\tif p.Len() > 0 {\n\t\t\ts = fmt.Sprint(\"*\", p.Len(), \" \", arrayReplacer.Replace(s))\n\t\t}\n\t\tif i == 0 {\n\t\t\tfmt.Fprint(w, \" \", s)\n\t\t} else {\n\t\t\tfmt.Fprint(w, \", \", s)\n\t\t}\n\t}\n\tif len(n.Children) > 0 || len(n.Attributes) == 0 {\n\t\tfmt.Fprintln(w, \" {\")\n\t\tfor _, c := range n.Children {\n\t\t\tc.Dump(w, d+1, full)\n\t\t}\n\t\tfmt.Fprintln(w, strings.Repeat(\" \", d)+\"}\")\n\t} else {\n\t\tfmt.Fprintln(w, \"\")\n\t}\n}", "title": "" }, { "docid": "702dfd3f7d83ccc690e46d318835cfc7", "score": "0.592046", "text": "func printTree(arr []*lib.SearchResult, i int) {\n\tfor _, c := range arr {\n\t\tvar t string\n\t\tif c.IsDir {\n\t\t\tt = \"folder\"\n\t\t} else {\n\t\t\tt = \"file\"\n\t\t}\n\t\tfmt.Printf(\"%s> %s (TYPE: %s ID: %s PATH: %s)\\n\", strings.Repeat(\"| \", i), c.Name, t, c.InternalID, c.Path)\n\t\tif len(c.Children) > 0 {\n\t\t\tprintTree(c.Children, i+1)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f6048732f17cb27847a93284dd1a7903", "score": "0.5919529", "text": "func (n *Node) Print(depth int) {\n\tif n == nil {\n\t\treturn\n\t}\n\n\tn.right.Print(depth + 1)\n\tfor tabs := depth; tabs > 0; tabs-- {\n\t\tfmt.Print(\"\\t\")\n\t}\n\tfmt.Println(\"data: \", n.data, \"height: \", n.Height())\n\tn.left.Print(depth + 1)\n}", "title": "" }, { "docid": "41e12822c1d2753c2785d5559f1b381d", "score": "0.590856", "text": "func (o *OIDTrie) debugPrintRecursive(prefix string) {\n\tlog.Infof(\"Print OIDTrie\")\n\tif len(o.Children) == 0 {\n\t\tlog.Infof(\"OID: %s\", prefix)\n\t}\n\tfor oid, child := range o.Children {\n\t\tchild.debugPrintRecursive(fmt.Sprintf(\"%s.%d\", prefix, oid))\n\t}\n}", "title": "" }, { "docid": "239a5572d99f9539c8ac63cb991c8b40", "score": "0.5897339", "text": "func PreOrderPrint(Root *Node) {\n\tfmt.Printf(\"\\n\")\n\tvar traverse func(node *Node, ns int, ch rune)\n\ttraverse = func(node *Node, ns int, ch rune) {\n\t\tif node == nil {\n\t\t\treturn\n\t\t}\n\t\tfor i := 0; i < ns; i++ {\n\t\t\tfmt.Print(\" \")\n\t\t}\n\t\tfmt.Printf(\"%c:%v\\n\", ch, node.val)\n\t\ttraverse(node.left, ns+2, 'L')\n\t\ttraverse(node.right, ns+2, 'R')\n\t}\n\ttraverse(Root, 0, 'M')\n}", "title": "" }, { "docid": "80d2847a0a97787d7ac4063f67e70113", "score": "0.5888451", "text": "func (n *Node) Print(layer int) string {\n\tif nil == n {\n\t\treturn \"\"\n\t}\n\tnode := n.next[layer]\n\tvar info = []string{\"head\"}\n\n\tfor ; node != nil; node = node.next[layer] {\n\t\tv := node.value.String()\n\t\tinfo = append(info, v)\n\t}\n\n\treturn fmt.Sprintf(\"layer %d: %s\", layer, strings.Join(info, \"->\"))\n}", "title": "" }, { "docid": "d93d540e9c71a6437433f6c1c2752915", "score": "0.5888243", "text": "func PreOrderPrint(root *Node) {\n\tfmt.Printf(\"\\n\")\n\tvar traverse func(node *Node, ns int, ch rune)\n\ttraverse = func(node *Node, ns int, ch rune) {\n\t\tif node == nil {\n\t\t\treturn\n\t\t}\n\t\tfor i := 0; i < ns; i++ {\n\t\t\tfmt.Print(\" \")\n\t\t}\n\t\tfmt.Printf(\"%c:%d\\n\", ch, node.val)\n\t\ttraverse(node.left, ns+2, 'L')\n\t\ttraverse(node.right, ns+2, 'R')\n\t}\n\ttraverse(root, 0, 'M')\n}", "title": "" }, { "docid": "5313a1a36d034032e01f81d5db752097", "score": "0.5882355", "text": "func (meta MetaInfo) Print() {\n\tfmt.Println(meta.ID, meta.Rev, meta.Key)\n}", "title": "" }, { "docid": "4f74dbb62547bd27b6536d9767ccda1f", "score": "0.58695304", "text": "func stringify1(n *Node, level int) {\n\tif n != nil {\n\t\tformat := \"\"\n\t\tfor i := 0; i < level; i++ {\n\t\t\tformat += \" \"\n\t\t}\n\t\tformat += \"---[ \"\n\t\tlevel++\n\t\tstringify(n.left, level)\n\t\tfmt.Printf(format+\"%d\\n\", n.value)\n\t\tstringify(n.right, level)\n\t}\n}", "title": "" }, { "docid": "55ddaf65421b5f3c958a995a697cf65f", "score": "0.5868137", "text": "func (root *FHeapNode) printTree() {\t\n\tq := list.New()\t\n\tmarker := new(FHeapNode)\n\tmarker.degree = -1\n\tq.PushBack(marker)\n\tq.PushBack(root)\n\n\tprevNode := root.parent\n\tfor e := q.Front(); e != nil; e = e.Next() {\n\t\ttreeNode := e.Value.(*FHeapNode)\n\t\n\t\tif treeNode.degree == -1 {\t\t// marker node\n\t\t\t// requeue at the end to indicate end of next level\n\t\t\tif prevNode != nil && prevNode.degree == -1 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t\n\t\t\tfmt.Println(\"\")\n\t\t\tq.PushBack(treeNode)\n\t\t\tprevNode = treeNode\n\t\t\tcontinue\n\t\t} \t\n\n\t\tif prevNode != nil && prevNode.parent != nil && prevNode.parent.degree != -1 && prevNode.parent != treeNode.parent {\n\t\t\tfmt.Print(\", \")\n\t\t} else {\n \t\t\tfmt.Print(\" \")\n\t\t}\n\t\t\t\t\n\t\ttreeNode.print()\n\t\t\n\n\t\tmainchild := treeNode.child\n\t\tif mainchild != nil {\n\t\t\tq.PushBack(mainchild)\n\n\t\t\tfor c := mainchild.next; c != mainchild; c = c.next {\n\t\t\t\t// add all children to queue\n\t\t\t\tq.PushBack(c)\n\t\t\t}\n\n\t\t}\n\t\t\n\t\tprevNode = treeNode\n\t}\n}", "title": "" }, { "docid": "72fb28db00b4a94ddb37a1c17f77946e", "score": "0.586536", "text": "func printKeyMenuStatus(k *servers.Key, name string) {\n\tfmt.Println()\n\tfmt.Println(\"Key: \")\n\tfmt.Printf(\" %s '%s'\\n\", columnString(\"Name:\"), name)\n\n\tkeyData := servers.AlphabetizeKeyData(k.Data)\n\tfor _, name := range keyData {\n\t\tfmt.Printf(\" %s '%s'\\n\", columnString(name+\":\"), k.Data[name].Value)\n\t\tfmt.Printf(\" %s\\n\", k.Data[name].Description)\n\t}\n\tfmt.Println(\"\\nConstraints:\")\n\tconstraints := servers.AlphabetizeConstraints(k.Constraints)\n\tfor _, name := range constraints {\n\t\tfmt.Printf(\" %s '%s'\\n\", columnString(name+\":\"), k.Constraints[name].Constraint)\n\t\tfmt.Printf(\" %s\\n\", k.Constraints[name].Description)\n\t}\n\tfmt.Println()\n}", "title": "" }, { "docid": "a3d4cc9de7c77b4f3cc64827b9492c57", "score": "0.5858348", "text": "func (o *object) dump() string {\n\tbuf := bytes.NewBuffer(nil)\n\tfor k, v := range o.m {\n\t\tbuf.WriteString(fmt.Sprintf(\" %s: %s, \", k.dump(), v.dump()))\n\t}\n\treturn fmt.Sprintf(\"{%s} (Object)\", buf)\n}", "title": "" }, { "docid": "665fec7969f80b742d230673b9736107", "score": "0.5857174", "text": "func (rdd *RDD) println() {\n\tstr := \"[\"\n\trddLen := len(rdd.data) - 1\n\tfor i, v := range rdd.data {\n\t\tv2, okay := v.(KeyValuePair)\n\t\tif okay {\n\t\t\tv = fmt.Sprintf(\"(%v, %v)\", v2.key, v2.value)\n\t\t}\n\t\tif i == rddLen {\n\t\t\tstr = str + fmt.Sprintf(\"%v]\", v)\n\t\t} else {\n\t\t\tstr = str + fmt.Sprintf(\"%v, \", v)\n\t\t}\n\n\t}\n\tfmt.Println(str)\n}", "title": "" }, { "docid": "90a123220fee91b482b7acfa9296cc4b", "score": "0.58177876", "text": "func (r *RunOutput) Print() error {\n\tif r.err != nil {\n\t\treturn r.err\n\t}\n\tkey, value, err := r.GetKV()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k := range key {\n\t\tfmt.Printf(\"%s: %s\\n\", string(key[k]), value[k])\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7df5b77b66fa98ce7e5dd0ff035cec8b", "score": "0.58095294", "text": "func PrintInOrder(tree *BinaryTree) {\n\tif tree == nil {\n\t\treturn\n\t} else {\n\t\tPrintInOrder(tree.Left)\n\t\tfmt.Printf(\"%d \", tree.Val)\n\t\tPrintInOrder(tree.Right)\n\t}\n}", "title": "" }, { "docid": "04a6b2016f9300c9b12b876075c433ee", "score": "0.58065677", "text": "func (bst *BST) String() {\n\tfmt.Println(\"------------------------------------------------\")\n\tstringify(bst.root, 0)\n\tfmt.Println(\"------------------------------------------------\")\n}", "title": "" }, { "docid": "7c4d911c45515b9294c84b9b035be22e", "score": "0.58046937", "text": "func PrintNodeRecursively(node *client.Node) {\n\tif node.Dir {\n\t\tlog.Infof(\"%q key is a dir\\n\", node.Key)\n\t\tPrintNodesRecursively(node.Nodes)\n\t} else {\n\t\tlog.Infof(\"%q key has %q value\\n\", node.Key, node.Value)\n\t}\n}", "title": "" }, { "docid": "b7fb546afa38596155c6d2e3dd084e8f", "score": "0.5796479", "text": "func printNode(node *Node) {\n\tif node == nil {\n\t\treturn\n\t}\n\n\tpval := -1\n\tif node.Parent != nil {\n\t\tpval = node.Parent.Val\n\t}\n\tfmt.Printf(\"%v (p=%v): \", node.Val, pval)\n\tif node.Left != nil {\n\t\tfmt.Printf(\"%v \", node.Left.Val)\n\t}\n\tif node.Right != nil {\n\t\tfmt.Printf(\"%v \", node.Right.Val)\n\t}\n\tfmt.Println()\n\tprintNode(node.Left)\n\tprintNode(node.Right)\n}", "title": "" }, { "docid": "c1ab7abf77e0cfcc8aa47cb9aef6956c", "score": "0.57928425", "text": "func (nvt *NameValueType) Pprint(depth int) string {\n\toutput := bytes.Buffer{}\n\toutput.WriteString(strings.Repeat(\"\\u00a0\", depth*2))\n\toutput.WriteString(fmt.Sprintf(\"%s [%s]: \", nvt.Name, nvt.Typ))\n\tif nvts, ok := nvt.Value.([]*NameValueType); ok {\n\t\toutput.WriteString(\"\\n\")\n\t\tfor _, next := range nvts {\n\t\t\tsublevel := next.Pprint(depth + 1)\n\t\t\toutput.WriteString(sublevel)\n\t\t}\n\t} else {\n\t\tif nvt.Value != nil {\n\t\t\toutput.WriteString(fmt.Sprintf(\"%q\\n\", nvt.Value))\n\t\t} else {\n\t\t\toutput.WriteString(\"\\n\")\n\t\t}\n\t}\n\treturn output.String()\n}", "title": "" }, { "docid": "f41d22dd4061c9fda1868fc28ff44d57", "score": "0.5788044", "text": "func printInOrderHelper(node *Node) {\n\tif node != nil {\n\t\tprintInOrderHelper(node.left)\n\t\t// heights are printed to verify that the tree structure\n\t\t// is changing to maintain balance\n\t\tfmt.Printf(\"Node Value: %v, Node Height: %v\\n\", node.value, node.height)\n\t\tprintInOrderHelper(node.right)\n\t}\n}", "title": "" }, { "docid": "f8db8736953fa58ff8835f7da8f050f0", "score": "0.5783949", "text": "func (bts *Tree) ShowAllLeft() {\n\n\ttree := bts.root\n\n\tfor tree != nil {\n\t\tfmt.Printf(\"%+s ->\", string(tree.Key))\n\t\ttree = tree.Left\n\t}\n\tfmt.Println()\n}", "title": "" }, { "docid": "525dd96ba2ff4373f529be08552171a2", "score": "0.5774934", "text": "func (pth *KeyPath) String() string {\n\tres := \"\"\n\tfor _, key := range pth.Keys {\n\t\tswitch key.enc {\n\t\tcase URL:\n\t\t\tres += \"/\" + url.PathEscape(string(key.name))\n\t\tcase HEX:\n\t\t\tres += \"/x:\" + fmt.Sprintf(\"%X\", key.name)\n\t\tdefault:\n\t\t\tpanic(\"unexpected key encoding type\")\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "40b81817ccbc2743fc0cb0cba9665c21", "score": "0.576743", "text": "func (w *WowInstall) PrintAccountTree(includeTimes bool) {\n\tlog.Logger.Println(\"##########################################################\")\n\n\ttotals := w.CalculateTotals()\n\n\tlog.Logger.Printf(\"%d Account(s), %d Server(s) and %d Character(s):\",\n\t\ttotals.Accounts, totals.Servers, totals.Characters)\n\n\tfor iAccount, account := range w.Accounts {\n\t\tisLastAccount := iAccount == totals.Accounts-1\n\t\taccountSep := determineTreeSeparator(isLastAccount)\n\t\tlog.Logger.Printf(\"%s-- %-15s\", accountSep, account.Name)\n\n\t\tiServer := 1\n\t\tfor serverName, characters := range account.Servers {\n\t\t\tserverSep := determineTreeSeparator(iServer == len(account.Servers))\n\n\t\t\tif isLastAccount {\n\t\t\t\taccountSep = \" \"\n\t\t\t}\n\n\t\t\tlog.Logger.Printf(\"%s%4s-- %-15s\", accountSep, serverSep, serverName)\n\n\t\t\tiServer++\n\n\t\t\tfor iCharacter, character := range characters {\n\t\t\t\tcharSep := determineTreeSeparator(iCharacter == len(characters)-1)\n\n\t\t\t\tif iServer > len(account.Servers) {\n\t\t\t\t\tserverSep = \" \"\n\t\t\t\t}\n\n\t\t\t\tif includeTimes {\n\t\t\t\t\tlog.Logger.Printf(\"%s%4s%4s-- %s - %-2d%10s | %11s\",\n\t\t\t\t\t\taccountSep,\n\t\t\t\t\t\tserverSep,\n\t\t\t\t\t\tcharSep,\n\t\t\t\t\t\tcharacter.Name,\n\t\t\t\t\t\tlen(character.Times),\n\t\t\t\t\t\t\"Level\",\n\t\t\t\t\t\t\"Played\")\n\n\t\t\t\t\tfor levelNum := 1; levelNum <= len(character.Times); levelNum++ {\n\t\t\t\t\t\tlevelSep := determineTreeSeparator(levelNum == len(character.Times))\n\n\t\t\t\t\t\t// clear charSep if on last char\n\t\t\t\t\t\tif iCharacter == len(characters)-1 {\n\t\t\t\t\t\t\tcharSep = \" \"\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlog.Logger.Printf(\"%s%4s%4s%4s-- %-2d = %11s | %11s\",\n\t\t\t\t\t\t\taccountSep,\n\t\t\t\t\t\t\tserverSep,\n\t\t\t\t\t\t\tcharSep,\n\t\t\t\t\t\t\tlevelSep,\n\t\t\t\t\t\t\tcharacter.Times[levelNum].Level,\n\t\t\t\t\t\t\tcharacter.Times[levelNum].ToReadableLevelTime(),\n\t\t\t\t\t\t\tcharacter.Times[levelNum].ToReadableAggregateTime())\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tlog.Logger.Printf(\"%s%4s%4s-- %s - Level %-2d\",\n\t\t\t\t\t\taccountSep,\n\t\t\t\t\t\tserverSep,\n\t\t\t\t\t\tcharSep,\n\t\t\t\t\t\tcharacter.Name,\n\t\t\t\t\t\tlen(character.Times))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tlog.Logger.Println(\"##########################################################\")\n}", "title": "" }, { "docid": "0c06f68b772d4398eb92606c4aa1fc2e", "score": "0.5766027", "text": "func (t *BinaryTree) Print() {\n\tvar queue []depthNode = []depthNode{}\n\tqueue = append(queue, depthNode{depth: 0, node: t.Root})\n\tcurrentDepth := 0\n\n\tfor len(queue) > 0 {\n\t\tvar first depthNode\n\t\t// queue pop\n\t\tfirst, queue = queue[0], queue[1:]\n\n\t\tif first.depth != currentDepth {\n\t\t\tfmt.Println()\n\t\t\tcurrentDepth = first.depth\n\t\t}\n\n\t\tfmt.Print(first.node.Val, \" \")\n\n\t\t/* 최하위 node 는 정보가 없어 패스 (BFS) */\n\t\tif first.node.left != nil {\n\t\t\tqueue = append(queue, depthNode{depth: currentDepth + 1, node: first.node.left})\n\t\t}\n\n\t\tif first.node.right != nil {\n\t\t\tqueue = append(queue, depthNode{depth: currentDepth + 1, node: first.node.right})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a0fa6c17528ad03ccaef70074cfc45d0", "score": "0.5744503", "text": "func (cmd *pageItemCommand) PrintLeafItemKey(w io.Writer, pageBytes []byte, index uint16, format string) error {\n\tk, _, err := cmd.leafPageElement(pageBytes, index)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn writelnBytes(w, k, format)\n}", "title": "" }, { "docid": "9501911b397031fb9477b830be7c5441", "score": "0.57327783", "text": "func (ifd *Ifd) PrintTagTree(populateValues bool) {\n\tifd.printTagTree(populateValues, 0, 0, false)\n}", "title": "" }, { "docid": "153f78a006b9e0657e696ca3e99d7251", "score": "0.57288367", "text": "func (cli *DockerCli) printVizNode(noTrunc bool, image *engine.Env, prefix string) {\n\tvar (\n\t\timageID string\n\t\tparentID string\n\t)\n\tif noTrunc {\n\t\timageID = image.Get(\"Id\")\n\t\tparentID = image.Get(\"ParentId\")\n\t} else {\n\t\timageID = utils.TruncateID(image.Get(\"Id\"))\n\t\tparentID = utils.TruncateID(image.Get(\"ParentId\"))\n\t}\n\tif parentID == \"\" {\n\t\tfmt.Fprintf(cli.out, \" base -> \\\"%s\\\" [style=invis]\\n\", imageID)\n\t} else {\n\t\tfmt.Fprintf(cli.out, \" \\\"%s\\\" -> \\\"%s\\\"\\n\", parentID, imageID)\n\t}\n\tif image.GetList(\"RepoTags\")[0] != \"<none>:<none>\" {\n\t\tfmt.Fprintf(cli.out, \" \\\"%s\\\" [label=\\\"%s\\\\n%s\\\",shape=box,fillcolor=\\\"paleturquoise\\\",style=\\\"filled,rounded\\\"];\\n\",\n\t\t\timageID, imageID, strings.Join(image.GetList(\"RepoTags\"), \"\\\\n\"))\n\t}\n}", "title": "" }, { "docid": "f4c2c17e54a04632d3ead9a08f214424", "score": "0.57279825", "text": "func deepPrettyPrint(nbt map[string]nbt.Tag) {\n\tdeepPrettyPrintRecur(0, nbt)\n}", "title": "" }, { "docid": "b355dd1dc73a7af198b63232889e3960", "score": "0.5724031", "text": "func (p *Pmap) Print(title string) {\n\tvar ss []string\n\t// make slice of keys\n\tfor k, _ := range p.Pm {\n\t\tss = append(ss, k)\n\t}\n\t// sort keys\n\tsort.Strings(ss)\n\t// print sorted keys and their values\n\tfmt.Printf(\"%sPmap name: %s path: %s ...\\n\", title, p.Name, p.Path)\n\tfor _, k := range ss {\n\t\tv := p.Pm[k]\n\t\tfmt.Printf(\" %s: %v\\n\", k, v)\n\t}\n\tfmt.Printf(\"Len: %d Size: %d \\n\", p.Len(), p.Size())\n}", "title": "" }, { "docid": "14271bd4a97a0b2ee352b67170450b89", "score": "0.57222", "text": "func (p *printer) print(n cst.Node) {\n\t// emit any beforePrefix injections.\n\tif s, ok := p.injections[injectKey{n, beforePrefix}]; ok {\n\t\tp.write(s)\n\t}\n\n\t// print the prefix comments.\n\tp.separator(n.Prefix())\n\n\t// emit any afterPrefix injections.\n\tif s, ok := p.injections[injectKey{n, afterPrefix}]; ok {\n\t\tp.write(s)\n\t}\n\n\tswitch n := n.(type) {\n\tcase *cst.Branch:\n\t\t// if this node should align the children, push a new tabber.\n\t\t_, align := p.aligns[n]\n\t\tif align {\n\t\t\tp.pushTabber()\n\t\t}\n\t\t// print the child CST nodes.\n\t\tfor _, c := range n.Children {\n\t\t\tp.print(c)\n\t\t}\n\t\tif align {\n\t\t\tp.popTabber()\n\t\t}\n\tcase *cst.Leaf:\n\t\tp.write(n.Token.String())\n\n\tdefault:\n\t\tpanic(\"Unknown parse node type\")\n\t}\n\n\t// emit any beforeSuffix injections.\n\tif s, ok := p.injections[injectKey{n, beforeSuffix}]; ok {\n\t\tp.write(s)\n\t}\n\n\t// print the suffix comments.\n\tp.separator(n.Suffix())\n\n\t// emit any afterSuffix injections.\n\tif s, ok := p.injections[injectKey{n, afterSuffix}]; ok {\n\t\tp.write(s)\n\t}\n}", "title": "" }, { "docid": "da3c3e5651f5d0a6fda7ffd523a17bf3", "score": "0.57159954", "text": "func (t *context) printNode(node interface{}) string {\n\tb := &strings.Builder{}\n\tprinter.Fprint(b, t.fileSet, node)\n\treturn b.String()\n}", "title": "" }, { "docid": "bf14197bfd288ad149cac005de93d1f3", "score": "0.57100916", "text": "func (o *KvsOptions) Print() {\n\tt := reflect.TypeOf(*o)\n\tv := reflect.ValueOf(*o)\n\toptionsFieldNum := v.NumField()\n\n\tfor k := 0; k < optionsFieldNum; k++ {\n\t\tlogger.Infof(\"\\t%s: %v\", t.Field(k).Name, v.Field(k).Interface())\n\t}\n}", "title": "" }, { "docid": "7431f449041f2801e254d90a47fb6a85", "score": "0.57063466", "text": "func (setGroup *setGroup) FPrint() {\n\tsetGroup.mutex.RLock()\n\tdefer setGroup.mutex.RUnlock()\n\tfmt.Println(\"----------- memberIntMap -----------\")\n\tfor k, v := range setGroup.memberIntMap {\n\t\tfmt.Println(k, v)\n\t}\n\tfmt.Println(\"----------- indexMemberSlice -----------\")\n\tfor k, v := range setGroup.indexMemberSlice {\n\t\tfmt.Println(\"index:\", k, \"member:\", v.member, \"used times:\", v.usedTimes)\n\t}\n\tfmt.Println(\"----------- groupSetRelationalMap -----------\")\n\tfor k, v := range setGroup.groupSetRelationalMap {\n\t\tfmt.Println(\"set:\", k, \"bitmap:\", v[0][0])\n\t}\n\tfmt.Println(\"----------- indexProduceCounter -----------\", setGroup.indexProduceCounter)\n\tfmt.Println(\"----------- deleteIndexLinkedList -----------\")\n\tfor element := setGroup.deleteIndexLinkedList.Front(); element != nil; element = element.Next() {\n\t\tfmt.Println(element.Value)\n\t}\n}", "title": "" }, { "docid": "b8fd0887f378fb2ab5459863c7426b66", "score": "0.56990784", "text": "func (t *Tree) Print() {\n\troot := t.node(1)\n\tt.print(root, 0)\n}", "title": "" }, { "docid": "b8fd0887f378fb2ab5459863c7426b66", "score": "0.56990784", "text": "func (t *Tree) Print() {\n\troot := t.node(1)\n\tt.print(root, 0)\n}", "title": "" }, { "docid": "13f720d6fe91a6a7f76f41e0838f58e9", "score": "0.5690969", "text": "func (m *Matcher) PrintTree() {\n\tfmt.Println(\"root:\")\n\ttrees = append(trees, layer{root: m.root})\n\tfor {\n\t\tif len(trees) == 0 {\n\t\t\treturn\n\t\t}\n\t\tvar tree layer\n\t\ttree, trees = trees[0], trees[1:]\n\t\tprintTree(tree.root, tree.name, 0)\n\t}\n}", "title": "" }, { "docid": "53fb0633af755d10c410c36d749656ff", "score": "0.5687022", "text": "func printStringMap(value reflect.Value, tabVal int) string {\n\tout := &bytes.Buffer{}\n\n\tvar sortedKeys []string\n\tstringToKeyMap := make(map[string]reflect.Value)\n\tfor _, k := range value.MapKeys() {\n\t\tsortedKeys = append(sortedKeys, k.String())\n\t\tstringToKeyMap[k.String()] = k\n\t}\n\n\tsort.Strings(sortedKeys)\n\n\tfor _, keyString := range sortedKeys {\n\t\tkey := stringToKeyMap[keyString]\n\t\tval := value.MapIndex(key)\n\t\tif newVal, ok := val.Interface().(map[string]interface{}); !ok {\n\t\t\tfmt.Fprintf(out, \"%s\", strings.Repeat(\"\\t\", tabVal))\n\t\t\tfmt.Fprintf(out, \"%v: \\\"%v\\\"\\n\", key.Interface(), val.Interface())\n\t\t} else {\n\t\t\tfmt.Fprintf(out, \"%s\", strings.Repeat(\"\\t\", tabVal))\n\t\t\tfmt.Fprintf(out, \"%v:\\n\", key.Interface())\n\t\t\t// going one level in, increase the tab\n\t\t\ttabVal++\n\t\t\tfmt.Fprintf(out, \"%s\", printStringMap(reflect.ValueOf(newVal), tabVal))\n\t\t\t// coming back one level, decrease the tab\n\t\t\ttabVal--\n\t\t}\n\t}\n\n\treturn out.String()\n}", "title": "" }, { "docid": "53c32baf516be6a170149e1e8e8203e1", "score": "0.56857103", "text": "func (t Tree) String() string {\n\ts := bytes.Buffer{}\n\ts.WriteString(\"(\")\n\tfor _, n := range t.Sequence {\n\t\ts.WriteString(n.String())\n\t}\n\tfor _, c := range t.Collection {\n\t\ts.WriteString(c.String())\n\t}\n\ts.WriteString(\")\")\n\treturn s.String()\n}", "title": "" } ]
d08e070da1d9338487067409c1acd747
public native String intern(); ()Ljava/lang/String;
[ { "docid": "48408bdc6c856aecde2159632ff6bc1d", "score": "0.67280203", "text": "func intern(frame *rtda.Frame) {\n\tjStr := frame.GetThis()\n\n\tgoStr := jStr.JSToGoStr()\n\tinternedStr := frame.GetRuntime().JSIntern(goStr, jStr)\n\n\tframe.PushRef(internedStr)\n}", "title": "" } ]
[ { "docid": "f183cd54c8e402df4d8aadf4df55ca01", "score": "0.72664785", "text": "func Intern(s string) string {\n\treturn globalStringPool.Intern(s)\n}", "title": "" }, { "docid": "7a83968038d86aa6cb14f5c17ffe952a", "score": "0.6759906", "text": "func (is store) intern(s string) string {\n\tif s == \"\" {\n\t\treturn \"\"\n\t}\n\tt, ok := is[s]\n\tif ok {\n\t\treturn t\n\t}\n\tis[s] = s\n\treturn s\n}", "title": "" }, { "docid": "3ae84b10e9f3d067f0e191b955225f6f", "score": "0.62977606", "text": "func (s *interner) internString(x *string) {\n\tif val, ok := s.dict[*x]; ok {\n\t\t*x = val\n\t} else {\n\t\ts.dict[*x] = *x\n\t}\n}", "title": "" }, { "docid": "cbfe15067383f8aac9e7c59702759ada", "score": "0.62892604", "text": "func (p *stringPool) Intern(s string) string {\n\t// quick try if its already in the table\n\tp.RLock()\n\tresult, found := p.strings[s]\n\tp.RUnlock()\n\n\tif !found {\n\t\t// look again under a serializing r/w lock\n\t\tp.Lock()\n\t\tif result, found = p.strings[s]; !found {\n\t\t\tif len(s) > p.maxSize-p.currentSize {\n\t\t\t\tp.strings = make(map[string]string, p.maxSize/averageStringLength)\n\t\t\t\tp.currentSize = 0\n\t\t\t}\n\n\t\t\tp.strings[s] = s\n\t\t\tp.currentSize += len(s)\n\t\t\tresult = s\n\t\t}\n\t\tp.Unlock()\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "70799a325791e2dad98e106af9227f09", "score": "0.5858004", "text": "func (sp *StringSpace) Intern(str string) int {\n\tif id, ok := sp.m[str]; ok {\n\t\treturn id\n\t}\n\tid := len(sp.s)\n\tsp.s = append(sp.s, str)\n\tsp.m[str] = id\n\treturn id\n}", "title": "" }, { "docid": "f8055a14fa63f7376334637f3d349788", "score": "0.553274", "text": "func (e Env) Intern(s Symbol) (Value, error) {\n\t// See\n\t// https://www.gnu.org/software/emacs/manual/html_node/elisp/Module-Misc.html#index-intern-1.\n\tif isNonNullASCII(string(s)) {\n\t\treturn e.internASCII(s)\n\t}\n\treturn e.Call(\"intern\", s)\n}", "title": "" }, { "docid": "00c5428edc2154ccf2abcb56b6b8e5e1", "score": "0.5501642", "text": "func (sym *Symbol) Intern() (*Symbol) {\n\tvar i int\n\tfor i = 0; i < len(Symbol_vt.space) ; i += SYMBOL_LENGTH {\n\t\tnext_symbol := Symbol_vt.space[i:i+SYMBOL_LENGTH]\n\n\t\t\n\t\tif bytes.Equal([]byte(sym.name), next_symbol[0:len(sym.name)]) {\n\t\t\tsym.offset = i\n\t\t\treturn sym\n\t\t}\n\t}\n\n\tsym_bytes := append([]byte(sym.name), make([]byte, SYMBOL_LENGTH - len(sym.name))...)\n\tSymbol_vt.space = append(Symbol_vt.space, sym_bytes...)\n\tsym.offset = i\n\treturn sym\n}", "title": "" }, { "docid": "5d8e7896c99231f60d4a6758a617224e", "score": "0.51688665", "text": "func DoString(lib string, function string, signature string, args ...jni.Value) (s string, err error) {\n\terr = jni.Do(jni.JVMFor(app.JavaVM()), func(env jni.Env) error {\n\t\tclass, err := jni.LoadClass(env, jni.ClassLoaderFor(env, jni.Object(app.AppContext())), lib)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\to, err := jni.CallStaticObjectMethod(env, class, jni.GetStaticMethodID(env, class, function, signature), args...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\ts = jni.GoString(env, jni.String(o))\n\t\treturn nil\n\t})\n\n\treturn s, err\n}", "title": "" }, { "docid": "1e5cfaf14af0728ba1ceb7929fe9d407", "score": "0.51295334", "text": "func (b *Buffer) String() string {\n return C.GoStringN((*C.char)(b.ptr), C.int(b.sz))\n}", "title": "" }, { "docid": "22c0988d3ab08039b5a51c155c88274f", "score": "0.51249546", "text": "func BenchmarkStringsCompareSame(b *testing.B) {\n\n\ts1 := \"string to compare\"\n\ts2 := \"string to compare\"\n\n\tb.ResetTimer()\n\tb.ReportAllocs()\n\tvar r int\n\tfor n := 0; n < b.N; n++ {\n\t\tr = strings.Compare(s1, s2)\n\t}\n\n\tresult = r\n}", "title": "" }, { "docid": "f36d674df146b2f7c66f77cdfd9eb187", "score": "0.50973576", "text": "func (sym *Sym) String() string {\n\tif sym.IsInterned() {\n\t\treturn sym.Name\n\t} else {\n\t\treturn \"#:\" + sym.Name\n\t}\n}", "title": "" }, { "docid": "7eed01c423b4eb13ce5df9496d8afaee", "score": "0.50894076", "text": "func (sp *StringSpace) TryIntern(str string) (int, bool) {\n\tid, ok := sp.m[str]\n\treturn id, ok\n}", "title": "" }, { "docid": "4ed40e22230b66f385900341b9ac74a1", "score": "0.5074427", "text": "func stringCompare() {\n\ts1, s2 := \"abc\", \"abc\"\n\tfmt.Println(s1 == s2) //\"true\"\n\ts3 := new(string)\n\t*s3 = \"abc\"\n\ts4 := new(string)\n\t*s4 = \"abc\"\n\tfmt.Println(s3 == s4) // \"false\"\n\n}", "title": "" }, { "docid": "5bd79e6ecad07d0d101f1942b9b99fb2", "score": "0.5052038", "text": "func PtrString(v string) *string { return &v }", "title": "" }, { "docid": "f2fd67d1e4405bb6e5b3f95debaff914", "score": "0.5045529", "text": "func (vm *Vm) opt_str_freeze() {}", "title": "" }, { "docid": "48b07aa48812032647d126fb8d298752", "score": "0.50404", "text": "func STR(rm interface{}) {\n\tunsafe.Asm(\"STR\", rm)\n}", "title": "" }, { "docid": "7b6a9869ba5fa784e39d6f682ecab1a0", "score": "0.50172234", "text": "func (e *Encoder) UseInternedStrings(on bool) {\n\tif on {\n\t\te.flags |= useInternedStringsFlag\n\t} else {\n\t\te.flags &= ^useInternedStringsFlag\n\t}\n}", "title": "" }, { "docid": "48bd4a5a2dc358507cbadd36df282bc1", "score": "0.4985403", "text": "func GetString(b []byte) string {\n\treturn *(*string)(unsafe.Pointer(&b))\n}", "title": "" }, { "docid": "413fd3f7855e86f26aa0c64661772339", "score": "0.49837503", "text": "func String(b []byte) MutableString {\n\treturn *(*MutableString)(unsafe.Pointer(&b))\n}", "title": "" }, { "docid": "9db980b98e371565b1e5165d0ea43bfe", "score": "0.4977013", "text": "func (sf *StackFrame) Intern() *StackFrame {\n\tif sf == nil {\n\t\treturn nil\n\t}\n\tif sf, ok := internedStackFrames[*sf]; ok {\n\t\treturn sf\n\t}\n\tnsf := sf.parent.Intern().Extend(sf.call)\n\tif nsf, ok := internedStackFrames[*nsf]; ok {\n\t\treturn nsf\n\t}\n\tinternedStackFrames[*nsf] = nsf\n\treturn nsf\n}", "title": "" }, { "docid": "da6f9cf29d91a9f0d39ee1dfc05616e9", "score": "0.49744788", "text": "func UnsafeString(b []byte) string {\n\treturn *(*string)(unsafe.Pointer(&b))\n}", "title": "" }, { "docid": "e58b7615f651a716b57a4814b0c7328b", "score": "0.49580622", "text": "func (e Env) internASCII(s Symbol) (Value, error) {\n\treturn e.checkValue(C.phst_emacs_intern(e.raw(), string(s)+\"\\x00\"))\n}", "title": "" }, { "docid": "44bc1fdca016013c41a15309cbb57216", "score": "0.49506867", "text": "func StringFromBytes(v []byte) string {\n\t// In Go 1.3, this string conversion in the map lookup does not allocate\n\t// to make a new string. We depend on Go 1.3, so this is always free:\n\tif s, ok := internStr[string(v)]; ok {\n\t\treturn s\n\t}\n\treturn string(v)\n}", "title": "" }, { "docid": "e0440262001f59a473c156fc2194ccbc", "score": "0.49291787", "text": "func String(v *uint8) string {\n\treturn C.GoString((*C.char)(unsafe.Pointer(v)))\n}", "title": "" }, { "docid": "6da0e608c2c29ef510238eedf49f5707", "score": "0.49151233", "text": "func Intern(x ...interface{}) {\n\tmyinterner := interner{\n\t\tdict: make(map[string]string),\n\t\tlocMap: make(map[addressAndType]struct{}),\n\t}\n\tfor _, val := range x {\n\t\tvalue := reflect.ValueOf(val)\n\t\tif value.Kind() != reflect.Ptr {\n\t\t\tpanic(\"input kind must be a pointer\")\n\t\t}\n\t\tmyinterner.intern(value)\n\t}\n}", "title": "" }, { "docid": "59984d1f79dc7c350f7f8209464d14ff", "score": "0.4898023", "text": "func BenchmarkUnsafeStrings(b *testing.B) {\n\tb.ReportAllocs()\n\tdst := make([]Value, 100)\n\tsrc := make([]Value, len(dst))\n\tb.Logf(\"Value size = %d\", unsafe.Sizeof(Value{}))\n\tfor i := range src {\n\t\tsrc[i] = StringValue(fmt.Sprintf(\"string#%d\", i))\n\t}\n\tb.ResetTimer()\n\tvar d string\n\tfor i := 0; i < b.N; i++ {\n\t\tcopy(dst, src)\n\t\tfor _, a := range dst {\n\t\t\td = a.String()\n\t\t}\n\t}\n\t_ = d\n}", "title": "" }, { "docid": "e642ba616115080832f658d53acef5cd", "score": "0.48937574", "text": "func PyStringAsString(s *C.PyObject) string {\n\treturn C.GoString(C.PyString_AsString(s))\n}", "title": "" }, { "docid": "70968755dda08f8a5cb3c6416fb28869", "score": "0.48748818", "text": "func ByteString(v *byte) string {\n\treturn C.GoString((*C.char)(unsafe.Pointer(v)))\n}", "title": "" }, { "docid": "1b460fb6f25ddef27aa50fa2f5dbed16", "score": "0.4872784", "text": "func AvStrdup(s string) string {\n\treturn C.GoString(C.av_strdup(C.CString(s)))\n}", "title": "" }, { "docid": "c0b5522f6d188dbcaea2cd770904cbda", "score": "0.48695713", "text": "func String(s string) *string { return Ptr(s) }", "title": "" }, { "docid": "37680c4f3161675779a23e01482a8f5b", "score": "0.48582754", "text": "func String(v string) *string { return &v }", "title": "" }, { "docid": "37680c4f3161675779a23e01482a8f5b", "score": "0.48582754", "text": "func String(v string) *string { return &v }", "title": "" }, { "docid": "37680c4f3161675779a23e01482a8f5b", "score": "0.48582754", "text": "func String(v string) *string { return &v }", "title": "" }, { "docid": "37680c4f3161675779a23e01482a8f5b", "score": "0.48582754", "text": "func String(v string) *string { return &v }", "title": "" }, { "docid": "37680c4f3161675779a23e01482a8f5b", "score": "0.48582754", "text": "func String(v string) *string { return &v }", "title": "" }, { "docid": "37680c4f3161675779a23e01482a8f5b", "score": "0.48582754", "text": "func String(v string) *string { return &v }", "title": "" }, { "docid": "4034c3d056b23d2b3bc7f1a216cf199d", "score": "0.4847907", "text": "func BenchmarkStringsCompareDifferent(b *testing.B) {\n\n\ts1 := \"string to compare A\"\n\ts2 := \"string to compare B\"\n\n\tb.ResetTimer()\n\tb.ReportAllocs()\n\tvar r int\n\tfor n := 0; n < b.N; n++ {\n\t\tr = strings.Compare(s1, s2)\n\t}\n\n\tresult = r\n}", "title": "" }, { "docid": "120e8c3f3e665c3280f4c6dddfe1fd17", "score": "0.4846111", "text": "func (w *WasmString) String() string {\n\tcstr := (*C.char)(unsafe.Pointer(*w))\n\tslen := int(C.strlen(cstr))\n\tsbuf := make([]byte, slen)\n\n\tcopy(sbuf, (*[1 << 28]byte)(unsafe.Pointer(*w))[:slen:slen])\n\n\treturn string(sbuf)\n}", "title": "" }, { "docid": "af220e95200419e576cba56a1ab190b9", "score": "0.48460108", "text": "func unionStrdup(tls *libc.TLS, pRc uintptr, zIn uintptr) uintptr { /* unionvtab.c:276:13: */\n\tvar zRet uintptr = uintptr(0)\n\tif zIn != 0 {\n\t\tvar nByte sqlite3_int64 = (sqlite3_int64(libc.Xstrlen(tls, zIn) + uint64(1)))\n\t\tzRet = unionMalloc(tls, pRc, nByte)\n\t\tif zRet != 0 {\n\t\t\tlibc.Xmemcpy(tls, zRet, zIn, size_t(nByte))\n\t\t}\n\t}\n\treturn zRet\n}", "title": "" }, { "docid": "1ae6a8a019a042109c0c8182653cb828", "score": "0.48268712", "text": "func (f *File) GetObjCMethodNames() (map[uint64]string, error) {\n\tmeth2vmaddr := make(map[uint64]string)\n\n\tif sec := f.Section(\"__TEXT\", \"__objc_methname\"); sec != nil { // Method names for locally implemented methods\n\t\tif err := f.cr.SeekToAddr(sec.Addr); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to seek to %s addr %#x: %v\", sec.Name, sec.Addr, err)\n\t\t}\n\n\t\tdat := make([]byte, sec.Size)\n\t\tif err := binary.Read(f.cr, f.ByteOrder, dat); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to read %s.%s data: %v\", sec.Seg, sec.Name, err)\n\t\t}\n\n\t\tr := bytes.NewBuffer(dat)\n\n\t\tfor {\n\t\t\ts, err := r.ReadString('\\x00')\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to read from method name string pool: %v\", err)\n\t\t\t}\n\n\t\t\tif len(strings.Trim(s, \"\\x00\")) > 0 && types.IsASCII(strings.Trim(s, \"\\x00\")) {\n\t\t\t\tmeth2vmaddr[sec.Addr+(sec.Size-uint64(r.Len()+len(s)))] = strings.Trim(s, \"\\x00\")\n\t\t\t}\n\t\t}\n\t}\n\n\treturn meth2vmaddr, nil\n}", "title": "" }, { "docid": "881fbbf4e5e3bc4630bf34d5133a3f81", "score": "0.48197106", "text": "func unsafeToString(bs []byte) string {\n\treturn *(*string)(unsafe.Pointer(&bs))\n}", "title": "" }, { "docid": "b7f20ef021e3808bf2d89610aae354e6", "score": "0.48123863", "text": "func String(v string) *string {\n\treturn &v\n}", "title": "" }, { "docid": "b7f20ef021e3808bf2d89610aae354e6", "score": "0.48123863", "text": "func String(v string) *string {\n\treturn &v\n}", "title": "" }, { "docid": "b7f20ef021e3808bf2d89610aae354e6", "score": "0.48123863", "text": "func String(v string) *string {\n\treturn &v\n}", "title": "" }, { "docid": "b7f20ef021e3808bf2d89610aae354e6", "score": "0.48123863", "text": "func String(v string) *string {\n\treturn &v\n}", "title": "" }, { "docid": "b7f20ef021e3808bf2d89610aae354e6", "score": "0.48123863", "text": "func String(v string) *string {\n\treturn &v\n}", "title": "" }, { "docid": "b7f20ef021e3808bf2d89610aae354e6", "score": "0.48123863", "text": "func String(v string) *string {\n\treturn &v\n}", "title": "" }, { "docid": "b7f20ef021e3808bf2d89610aae354e6", "score": "0.48123863", "text": "func String(v string) *string {\n\treturn &v\n}", "title": "" }, { "docid": "b7f20ef021e3808bf2d89610aae354e6", "score": "0.48123863", "text": "func String(v string) *string {\n\treturn &v\n}", "title": "" }, { "docid": "863e48dc4db1d463476f607c57e7161a", "score": "0.4809252", "text": "func pStr(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "6cbfd180b8e784016bb8a2395ac1f34e", "score": "0.47916174", "text": "func (b *Buffer) StringUnsafe() string {\n\treturn unsafeheader.BytesToString(b.buf)\n}", "title": "" }, { "docid": "9bb9f97ebf1da8eca0bf1ad6e0831273", "score": "0.47887984", "text": "func BenchmarkCodeStringSwitch(b *testing.B) {\n\tfor i := 0; i < b.N; i++ {\n\t\tc := codes.Code(uint32(i % 17))\n\t\t_ = c.String()\n\t}\n}", "title": "" }, { "docid": "e1325aaa347cd9eddd622133007eadb1", "score": "0.47876686", "text": "func gostring(s *C.char) string {\n\tslen := int(C.strlen(s))\n\tsbuf := make([]byte, slen)\n\tcopy(sbuf, (*[1 << 28]byte)(unsafe.Pointer(s))[:slen:slen])\n\treturn string(sbuf)\n}", "title": "" }, { "docid": "d8038065b619586f4ddce9371ec7aa7c", "score": "0.47838342", "text": "func commonString(b0, b1 string) string {\n\tif len(b0) != len(b1) {\n\t\treturn \"\"\n\t}\n\tvar result []byte\n\tfor i, c := range b0 {\n\t\tif b1[i] == uint8(c) {\n\t\t\tresult = append(result, uint8(c))\n\t\t}\n\t}\n\treturn string(result)\n}", "title": "" }, { "docid": "c18c399a75336914b6ae2e4e880ecc03", "score": "0.47707865", "text": "func String(str string) *string {\n\treturn &str\n}", "title": "" }, { "docid": "c18c399a75336914b6ae2e4e880ecc03", "score": "0.47707865", "text": "func String(str string) *string {\n\treturn &str\n}", "title": "" }, { "docid": "5d939665c88385d3a88a7b0d1bfce2cd", "score": "0.47589022", "text": "func cstring(s string) *C.char {\n\tptr := C.malloc(C.size_t(len(s) + 1))\n\tbuf := (*[1 << 28]byte)(ptr)[: len(s)+1 : len(s)+1]\n\tcopy(buf, s)\n\tbuf[len(s)] = 0\n\treturn (*C.char)(ptr)\n}", "title": "" }, { "docid": "4a29177180ce4a47df5ac4576f19b03d", "score": "0.4742815", "text": "func amatchStrcpy(tls *libc.TLS, dest uintptr, src uintptr) { /* amatch.c:1005:13: */\n\tfor (int32(libc.AssignPtrInt8(libc.PostIncUintptr(&dest, 1), *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&src, 1)))))) != 0 {\n\t}\n}", "title": "" }, { "docid": "bf7ad7becbca413b2eb525898496bc73", "score": "0.4715628", "text": "func toStringPtr(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "7cb4dbd5db7f362f9952f1d8c3aaca2b", "score": "0.47127834", "text": "func CMPSB() {\n\tunsafe.Asm(\"CMPSB\", nil)\n}", "title": "" }, { "docid": "eeb4d9012d28a85e4e5c92d74e3688c0", "score": "0.47113386", "text": "func RegisterCommonString(s ...string) {\n\tfor _, v := range s {\n\t\tinternStr[v] = v\n\t}\n}", "title": "" }, { "docid": "1c5c2a0688d7aea4e8ec5bf063268ad3", "score": "0.47078738", "text": "func (env Native) String(name string) string {\n\treturn os.Getenv(name)\n}", "title": "" }, { "docid": "eb1e29ea0e44fd7e5013de8968060a26", "score": "0.47048998", "text": "func allocCStrPtr() *C.str {\n return (*C.str)(C.malloc(C.size_t(unsafe.Sizeof(C.str{}))))\n}", "title": "" }, { "docid": "0a4f466cf3229c6d00f8f135dcad3614", "score": "0.47035217", "text": "func allocJSStringRefMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfJSStringRefValue))\n\tif mem == nil {\n\t\tpanic(fmt.Sprintln(\"memory alloc error: \", err))\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "affac2e70cdb2aaaed2366bb282e5e2e", "score": "0.46962664", "text": "func newEmptyBuffer() *C.str {\n value := allocCStrPtr()\n value.data = nil\n value.size = 0\n\n return value\n}", "title": "" }, { "docid": "8d5c232e24ed9b3e22231d0c1f6551cb", "score": "0.46937767", "text": "func getString() *string {\n\tvar s string\n\ts = \"nemowen\"\n\treturn &s\n}", "title": "" }, { "docid": "a0d3fd70580287391ce879c932486762", "score": "0.4689879", "text": "func f(s1 string) {\n\t//s0 = s1[:50]\n\ts0 = (\" \" + s1[:50])[1:]\n\t//time.Sleep(time.Second * 1000000)\n\t// Now, s0 shares the same underlying memory block with s1.\n\t// Although s1 is not alive now, but s0 is still alive, so\n\t// the memory block they share couldn't be collected,\n\t// though there are only 50 bytes used in the block and\n\t// all other bytes in the block become unavailable.\n}", "title": "" }, { "docid": "d952d468232e3ac3f4a4358d3022bd78", "score": "0.46874446", "text": "func PtrStr(i string) *string {\n\treturn &i\n}", "title": "" }, { "docid": "05cd21c1a46349f8e0e8b821d0d908ca", "score": "0.46871462", "text": "func string_concat(tls *libc.TLS, pzStr uintptr, zAppend uintptr, doFree int32, pRc uintptr) { /* test8.c:727:13: */\n\tbp := tls.Alloc(24)\n\tdefer tls.Free(24)\n\n\tvar zIn uintptr = *(*uintptr)(unsafe.Pointer(pzStr))\n\tif (!(zAppend != 0) && (doFree != 0)) && (*(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK) {\n\t\t*(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM\n\t}\n\tif *(*int32)(unsafe.Pointer(pRc)) != SQLITE_OK {\n\t\tsqlite3.Xsqlite3_free(tls, zIn)\n\t\tzIn = uintptr(0)\n\t} else {\n\t\tif zIn != 0 {\n\t\t\tvar zTemp uintptr = zIn\n\t\t\tzIn = sqlite3.Xsqlite3_mprintf(tls, ts+27620 /* \"%s%s\" */, libc.VaList(bp, zIn, zAppend))\n\t\t\tsqlite3.Xsqlite3_free(tls, zTemp)\n\t\t} else {\n\t\t\tzIn = sqlite3.Xsqlite3_mprintf(tls, ts /* \"%s\" */, libc.VaList(bp+16, zAppend))\n\t\t}\n\t\tif !(zIn != 0) {\n\t\t\t*(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM\n\t\t}\n\t}\n\t*(*uintptr)(unsafe.Pointer(pzStr)) = zIn\n\tif doFree != 0 {\n\t\tsqlite3.Xsqlite3_free(tls, zAppend)\n\t}\n}", "title": "" }, { "docid": "0d7b2f76c6157ad8969bdbf60b029102", "score": "0.46869892", "text": "func stringPtr(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "42aa86eb1cbb2c55ea290843387ed16c", "score": "0.46835867", "text": "func JvString(str string) C.jv {\n\treturn C.jv_string(C.CString(str))\n}", "title": "" }, { "docid": "1787f1c824712695e5bbcf0a08fc7337", "score": "0.46710968", "text": "func Constant(source []byte) []byte { return dup(source) }", "title": "" }, { "docid": "2289b8b9fd3c558ec93fb74889c6905c", "score": "0.46561489", "text": "func symbolToStringPrimitive(args Pair) interface{} {\n\treturn string(symbolConstraint(First(args)))\n}", "title": "" }, { "docid": "9667d1d6b6de03e191a3b1f57908c669", "score": "0.4653904", "text": "func toString(b *[]byte) string {\r\n\treturn *(*string)(unsafe.Pointer(b))\r\n}", "title": "" }, { "docid": "a132c811083a23223eb9938c61128b09", "score": "0.46525213", "text": "func stringPtr(a string) *string {\n\treturn &a\n}", "title": "" }, { "docid": "dd77e2a1c3cc4ed4d57c2406dbdeaaf1", "score": "0.4649814", "text": "func String(s string) *string { return &s }", "title": "" }, { "docid": "dd77e2a1c3cc4ed4d57c2406dbdeaaf1", "score": "0.4649814", "text": "func String(s string) *string { return &s }", "title": "" }, { "docid": "dd77e2a1c3cc4ed4d57c2406dbdeaaf1", "score": "0.4649814", "text": "func String(s string) *string { return &s }", "title": "" }, { "docid": "1429703f852cceb1c0ea6ac5933a928b", "score": "0.46405083", "text": "func String(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "f88e3a395990c1a9142968c7bb16167c", "score": "0.46310216", "text": "func (b *Bitfinex) nativePair(pair string) string {\n\treturn strings.ToLower(strings.Replace(pair, \"_\", \"\", 1))\n}", "title": "" }, { "docid": "ead614504d28d7af0c6d05c0cdcc3fc0", "score": "0.46239308", "text": "func (ps *privateStorage) internFuncOpDef(def *FuncOpDef) PrivateID {\n\t// The below code is carefully constructed to not allocate in the case where\n\t// the value is already in the map. Be careful when modifying.\n\t// The Overload field is already interned, because it's the address of one\n\t// of the Builtin structs in the builtins package.\n\tif id, ok := ps.privatesMap[privateKey{iface: def.Overload}]; ok {\n\t\treturn id\n\t}\n\treturn ps.addValue(privateKey{iface: def.Overload}, def)\n}", "title": "" }, { "docid": "878cd8515b29e0c528ec990131baee53", "score": "0.46134394", "text": "func stringPointer(s string) *string { return &s }", "title": "" }, { "docid": "de3686e29ef641d032fb90cdb7f46736", "score": "0.46021625", "text": "func closureValueOfKey(tls *libc.TLS, zKey uintptr, zStr uintptr) uintptr { /* closure.c:483:19: */\n\tvar nKey int32 = int32(libc.Xstrlen(tls, zKey))\n\tvar nStr int32 = int32(libc.Xstrlen(tls, zStr))\n\tvar i int32\n\tif nStr < (nKey + 1) {\n\t\treturn uintptr(0)\n\t}\n\tif libc.Xmemcmp(tls, zStr, zKey, uint64(nKey)) != 0 {\n\t\treturn uintptr(0)\n\t}\n\tfor i = nKey; __sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(zStr + uintptr(i))))), uint64(X_CTYPE_S)) != 0; i++ {\n\t}\n\tif int32(*(*int8)(unsafe.Pointer(zStr + uintptr(i)))) != '=' {\n\t\treturn uintptr(0)\n\t}\n\ti++\n\tfor __sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(zStr + uintptr(i))))), uint64(X_CTYPE_S)) != 0 {\n\t\ti++\n\t}\n\treturn (zStr + uintptr(i))\n}", "title": "" }, { "docid": "e3041d72d3a8b5a6b668c7893f28513e", "score": "0.4597739", "text": "func StringPtr(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "e3041d72d3a8b5a6b668c7893f28513e", "score": "0.4597739", "text": "func StringPtr(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "e3041d72d3a8b5a6b668c7893f28513e", "score": "0.4597739", "text": "func StringPtr(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "a6802ba8d3e991ae3f602db40644e491", "score": "0.45969746", "text": "func StringP(val string) *string {\n\treturn &val\n}", "title": "" }, { "docid": "a6802ba8d3e991ae3f602db40644e491", "score": "0.45969746", "text": "func StringP(val string) *string {\n\treturn &val\n}", "title": "" }, { "docid": "bbc8ea369e80c4d70441cace775c8537", "score": "0.4586957", "text": "func unsafeString(data []byte) (s string) {\n\tif len(data) == 0 {\n\t\treturn\n\t}\n\n\t(*reflect.StringHeader)(unsafe.Pointer(&s)).Data = uintptr(unsafe.Pointer(&data[0]))\n\t(*reflect.StringHeader)(unsafe.Pointer(&s)).Len = len(data)\n\treturn\n}", "title": "" }, { "docid": "f4ecbc2fca40952eccec5eb397df2dea", "score": "0.45841408", "text": "func TestForgetAllLGEs(t *testing.T) {\n\tdefer func() { _ = recover() }()\n\tsym, err := intern.NewLGE(\"old string\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tstr := sym.String()\n\tintern.ForgetAllLGEs()\n\tstr = sym.String() // Should panic\n\tt.Fatalf(\"Failed to catch invalid intern.LGE %d (%q)\", sym, str)\n}", "title": "" }, { "docid": "98354657683967261e27f034155dd269", "score": "0.45828936", "text": "func javaHashCode(name string, ty *vdl.Type, env *compile.Env) string {\n\tif isJavaNativeArray(ty, env) {\n\t\treturn fmt.Sprintf(\"java.util.Arrays.hashCode(%s)\", name)\n\t}\n\tif def := env.FindTypeDef(ty); def != nil && def.File == compile.BuiltInFile {\n\t\tswitch ty.Kind() {\n\t\tcase vdl.Bool:\n\t\t\treturn fmt.Sprintf(\"java.lang.Boolean.valueOf(%s).hashCode()\", name)\n\t\tcase vdl.Byte, vdl.Int16:\n\t\t\treturn \"(int)\" + name\n\t\tcase vdl.Int32:\n\t\t\treturn name\n\t\tcase vdl.Int64:\n\t\t\treturn fmt.Sprintf(\"java.lang.Long.valueOf(%s).hashCode()\", name)\n\t\tcase vdl.Float32:\n\t\t\treturn fmt.Sprintf(\"java.lang.Float.valueOf(%s).hashCode()\", name)\n\t\tcase vdl.Float64:\n\t\t\treturn fmt.Sprintf(\"java.lang.Double.valueOf(%s).hashCode()\", name)\n\t\t}\n\t}\n\treturn fmt.Sprintf(\"(%s == null ? 0 : %s.hashCode())\", name, name)\n}", "title": "" }, { "docid": "39573bb3ed30080f9fe61ded22d42955", "score": "0.45659074", "text": "func copyPJSStringRefBytes(slice *sliceHeader) (*C.JSStringRef, *cgoAllocMap) {\n\tallocs := new(cgoAllocMap)\n\tdefer runtime.SetFinalizer(allocs, func(a *cgoAllocMap) {\n\t\tgo a.Free()\n\t})\n\n\tmem0 := unsafe.Pointer(C.CBytes(*(*[]byte)(unsafe.Pointer(&sliceHeader{\n\t\tData: slice.Data,\n\t\tLen: int(sizeOfJSStringRefValue) * slice.Len,\n\t\tCap: int(sizeOfJSStringRefValue) * slice.Len,\n\t}))))\n\tallocs.Add(mem0)\n\n\treturn (*C.JSStringRef)(mem0), allocs\n}", "title": "" }, { "docid": "8649b816605982a2de3d0ffccc9169b6", "score": "0.45645022", "text": "func BenchmarkStringsConcat2(b *testing.B) {\n\n\ts1 := \"string to compare\"\n\ts2 := \"string to add\"\n\tb.ResetTimer()\n\tb.ReportAllocs()\n\tvar r string\n\tfor n := 0; n < b.N; n++ {\n\t\tr = s1 + s2\n\t}\n\n\tresult = r\n}", "title": "" }, { "docid": "dc64a812e5ec2a3a48014262fee3253c", "score": "0.4562245", "text": "func (ps *privateStorage) internColSet(colSet opt.ColSet) PrivateID {\n\t// The below code is carefully constructed to not allocate in the case\n\t// where the value is already in the map. Be careful when modifying.\n\tps.keyBuf.Reset()\n\tps.keyBuf.writeColSet(colSet)\n\ttyp := (*opt.ColSet)(nil)\n\tif id, ok := ps.privatesMap[privateKey{iface: typ, str: ps.keyBuf.String()}]; ok {\n\t\treturn id\n\t}\n\treturn ps.addValue(privateKey{iface: typ, str: ps.keyBuf.String()}, colSet)\n}", "title": "" }, { "docid": "72a94ab9639baffde429b8ae4ec742b3", "score": "0.45602295", "text": "func BenchmarkStringIndex(b *testing.B) {\n\n\ts1 := \"string to compare\"\n\ts2 := \"e\"\n\n\tb.ResetTimer()\n\tb.ReportAllocs()\n\tvar r int\n\tfor n := 0; n < b.N; n++ {\n\t\tr = strings.Index(s1, s2)\n\t}\n\n\tresult = r\n}", "title": "" }, { "docid": "70e0e7a47a281107e64034ada307f4a3", "score": "0.45579273", "text": "func StringPointer(val string) *string {\n\treturn &val\n}", "title": "" }, { "docid": "7b89b08a6d3065e13bba603020ae2edd", "score": "0.45499608", "text": "func GetStrZ(p unsafe.Pointer, n int) string {\n\tbuf := get(p)[:n]\n\tif i := bytes.IndexByte(buf, 0); i != -1 {\n\t\tbuf = buf[:i]\n\t}\n\treturn string(buf)\n}", "title": "" }, { "docid": "e27ed0d727e0599e72f5a3533a88f0f4", "score": "0.4541147", "text": "func (self ExternKind) String() string {\n\tswitch self {\n\tcase FUNCTION:\n\t\treturn \"func\"\n\tcase GLOBAL:\n\t\treturn \"global\"\n\tcase TABLE:\n\t\treturn \"table\"\n\tcase MEMORY:\n\t\treturn \"memory\"\n\t}\n\tpanic(\"Unknown extern kind\") // unreachable\n}", "title": "" }, { "docid": "907fcdd738d0696068b559c1d1b45668", "score": "0.45347473", "text": "func StringPointer(v string) *string {\n\treturn &v\n}", "title": "" }, { "docid": "618c0e6b4875eb71b2ac6ed4a9eeba67", "score": "0.45295483", "text": "func StringCreate() String {\n return NewString( C.sfString_Create() )\n}", "title": "" } ]
63c4593e02101606c16bd913226ca5e7
Deprecated: Use GetBlockResponse.ProtoReflect.Descriptor instead.
[ { "docid": "f78ad90a1d1908e9bda7afcedb05c477", "score": "0.7539626", "text": "func (*GetBlockResponse) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{9}\n}", "title": "" } ]
[ { "docid": "9497fb3f25be665d8aac40f56ad3df9b", "score": "0.73983705", "text": "func (*GetBlockInfoResponse) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "e7e661b3d9062ea38ec0499985e8bc0c", "score": "0.7376045", "text": "func (*ClientBlockGetResponse) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_client_block_pb2_client_block_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "aa8a7c6eded1564e6c3f9458ff4e321c", "score": "0.73560923", "text": "func (*GetRawBlockResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{189}\n}", "title": "" }, { "docid": "373ca1c1356c494a5110fe29edf29f81", "score": "0.7325482", "text": "func (*GetBlocksResponse) Descriptor() ([]byte, []int) {\n\treturn file_blockchain_blockchainpb_blockchain_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "ce2bc0e7a58c4228be821d28d059cac8", "score": "0.73219705", "text": "func (*GetRawBlockResponse) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "1e418689603ec9612491c0eba204e737", "score": "0.73092896", "text": "func (*GetBlockFilterResponse) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "e431c2989b7bc948b6a6460096029b1d", "score": "0.7282795", "text": "func (*GetBlockRequest) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "12a1d1a249449baaf3df40cf4fba703f", "score": "0.7238715", "text": "func (*BlockInfoResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{50}\n}", "title": "" }, { "docid": "8b66265c37e7c7543a1a962a3a8530eb", "score": "0.72368526", "text": "func (*ClientBlockListResponse) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_client_block_pb2_client_block_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "21e121c7b7c15d04f3e1d06e7d7044fb", "score": "0.7232032", "text": "func (*QueryBlockResponse) Descriptor() ([]byte, []int) {\n\treturn file_contract_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "d5d825e26b607d9b1d3c23888dc28ad9", "score": "0.7215027", "text": "func (x *fastReflection_Block) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Block\n}", "title": "" }, { "docid": "dc9e853768294952d965328fc3e33235", "score": "0.7161319", "text": "func (*GetTicketsResponse_BlockDetails) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{44, 1}\n}", "title": "" }, { "docid": "79052b5250454c38dc95b12e3c779d93", "score": "0.71603435", "text": "func (*GetBlockInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "737fa53b9e60b43e739ad21e302f87fb", "score": "0.71594566", "text": "func (x *fastReflection_BlockMetadata) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch descriptor.FullName() {\n\tcase \"cosmos.store.v1beta1.BlockMetadata.request_begin_block\":\n\t\tvalue := x.RequestBeginBlock\n\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\tcase \"cosmos.store.v1beta1.BlockMetadata.response_begin_block\":\n\t\tvalue := x.ResponseBeginBlock\n\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\tcase \"cosmos.store.v1beta1.BlockMetadata.deliver_txs\":\n\t\tif len(x.DeliverTxs) == 0 {\n\t\t\treturn protoreflect.ValueOfList(&_BlockMetadata_3_list{})\n\t\t}\n\t\tlistValue := &_BlockMetadata_3_list{list: &x.DeliverTxs}\n\t\treturn protoreflect.ValueOfList(listValue)\n\tcase \"cosmos.store.v1beta1.BlockMetadata.request_end_block\":\n\t\tvalue := x.RequestEndBlock\n\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\tcase \"cosmos.store.v1beta1.BlockMetadata.response_end_block\":\n\t\tvalue := x.ResponseEndBlock\n\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\tcase \"cosmos.store.v1beta1.BlockMetadata.response_commit\":\n\t\tvalue := x.ResponseCommit\n\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\tdefault:\n\t\tif descriptor.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.store.v1beta1.BlockMetadata\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.store.v1beta1.BlockMetadata does not contain field %s\", descriptor.FullName()))\n\t}\n}", "title": "" }, { "docid": "da64cf3f4d0eac975d79cbdc5d9f0d4f", "score": "0.7149552", "text": "func (*BlockResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_showcase_v1beta1_echo_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "f649dd38f42a957d2087c0ec07dac958", "score": "0.7145702", "text": "func (x *fastReflection_BlockMetadata) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_BlockMetadata\n}", "title": "" }, { "docid": "f649dd38f42a957d2087c0ec07dac958", "score": "0.7145702", "text": "func (x *fastReflection_BlockMetadata) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_BlockMetadata\n}", "title": "" }, { "docid": "863e886b514389ea2e695b55145c8df8", "score": "0.71441126", "text": "func (*ClientBlockGetByIdRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_client_block_pb2_client_block_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "d030b2f65d17102d1dd4793738fe36c8", "score": "0.7144036", "text": "func (*MineBlockResponse) Descriptor() ([]byte, []int) {\n\treturn file_blockchain_blockchainpb_blockchain_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "710df701ba7fa28137c89855eab0cc6d", "score": "0.7105276", "text": "func (*GetRawBlockRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{188}\n}", "title": "" }, { "docid": "80b5e30354f3d0a43afa6a96e2166c1a", "score": "0.7082051", "text": "func (*CreateBlockResponse) Descriptor() ([]byte, []int) {\n\treturn file_blockchain_blockchainpb_blockchain_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "c9091daa9152023e19fcc570b2e701ea", "score": "0.70731777", "text": "func (*GetRawBlockRequest) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "75d01b61a147df4859a1366a6b4f57d3", "score": "0.70539206", "text": "func (*GetBlockchainInfoResponse) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "899efcafb179423bc92a85fab7df2d65", "score": "0.7020734", "text": "func (*ClientBlockGetByNumRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_client_block_pb2_client_block_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "dcbdb43bebe8c4ea198186cc80562d3c", "score": "0.69907004", "text": "func (*BlockInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{49}\n}", "title": "" }, { "docid": "041723c099c762366784599af7ffeb00", "score": "0.69896656", "text": "func (*GetBlocksRequest) Descriptor() ([]byte, []int) {\n\treturn file_blockchain_blockchainpb_blockchain_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "9ec3b6be4e38d0d9f7c18abf601b0ad1", "score": "0.6984155", "text": "func (*BlockResponse) Descriptor() ([]byte, []int) {\n\treturn file_eth_v1_beacon_chain_proto_rawDescGZIP(), []int{21}\n}", "title": "" }, { "docid": "e7cc46640834023e6f1e2383dc9a5a60", "score": "0.69717944", "text": "func (*GetBlockFilterRequest) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "ec5b661cd13e52fbad97600001d02d65", "score": "0.69613576", "text": "func (*BlockRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_showcase_v1beta1_echo_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "436ae56c1fb442966aa3656ddfd34913", "score": "0.6954666", "text": "func (x *fastReflection_Block) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch descriptor.FullName() {\n\tcase \"cosmos.base.tendermint.v1beta1.Block.header\":\n\t\tvalue := x.Header\n\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\tcase \"cosmos.base.tendermint.v1beta1.Block.data\":\n\t\tvalue := x.Data\n\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\tcase \"cosmos.base.tendermint.v1beta1.Block.evidence\":\n\t\tvalue := x.Evidence\n\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\tcase \"cosmos.base.tendermint.v1beta1.Block.last_commit\":\n\t\tvalue := x.LastCommit\n\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\tdefault:\n\t\tif descriptor.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.base.tendermint.v1beta1.Block\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.base.tendermint.v1beta1.Block does not contain field %s\", descriptor.FullName()))\n\t}\n}", "title": "" }, { "docid": "078f772ac481a1b7645d29ea85dbee19", "score": "0.6937512", "text": "func (x *fastReflection_BlockMetadata) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch descriptor.FullName() {\n\tcase \"cosmos.store.v1beta1.BlockMetadata.response_commit\":\n\t\tvalue := x.ResponseCommit\n\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\tcase \"cosmos.store.v1beta1.BlockMetadata.request_finalize_block\":\n\t\tvalue := x.RequestFinalizeBlock\n\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\tcase \"cosmos.store.v1beta1.BlockMetadata.response_finalize_block\":\n\t\tvalue := x.ResponseFinalizeBlock\n\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\tdefault:\n\t\tif descriptor.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.store.v1beta1.BlockMetadata\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.store.v1beta1.BlockMetadata does not contain field %s\", descriptor.FullName()))\n\t}\n}", "title": "" }, { "docid": "b922bee0ef3cbbbfa3bc4bc825abdb97", "score": "0.6929468", "text": "func (*BlockDetails) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "3667aa3b9d24d2a72e0291a2a8b35374", "score": "0.6894183", "text": "func (*Block) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{47}\n}", "title": "" }, { "docid": "9f0a85b1fac9b7cecfb1a15c56928e88", "score": "0.68718123", "text": "func (*SubscribeToBlockNotificationsResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{104}\n}", "title": "" }, { "docid": "161cbcd4cb32d0decc4bb25d3fca9c3e", "score": "0.6871368", "text": "func (*Block) Descriptor() ([]byte, []int) {\n\treturn file_cosmos_base_tendermint_v1beta1_types_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "9911392d12a8698e333287ef985d05ad", "score": "0.6845452", "text": "func (*Block) Descriptor() ([]byte, []int) {\n\treturn file_protos_hclspec_v1_hcl_spec_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "0bec08d7a5ea75d70b734f77590bbb5a", "score": "0.68437403", "text": "func (*BestBlockResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{177}\n}", "title": "" }, { "docid": "2013fb03c0d36e59a1b3ad4766a2f226", "score": "0.6830027", "text": "func (*BlockInfo) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{46}\n}", "title": "" }, { "docid": "cd87147b03fcbc33175a0d1d54a5a5e1", "score": "0.6819635", "text": "func (*BlockHeadersResponse) Descriptor() ([]byte, []int) {\n\treturn file_eth_v1_beacon_chain_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "1dc0fb8b59134d5d5feedcb2e3f80d13", "score": "0.68175834", "text": "func (*ClientBlockGetByBatchIdRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_client_block_pb2_client_block_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "98b1b77cc44334c5fd94727356e4ec4e", "score": "0.68021864", "text": "func (*QueryBlockRequest) Descriptor() ([]byte, []int) {\n\treturn file_contract_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "7f69fdfba2d066a3940aa1c9db88de6c", "score": "0.6765389", "text": "func (*SetMaxPerBlockResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{148}\n}", "title": "" }, { "docid": "b98bdc62d59eacc02b1e4c395474f50f", "score": "0.6759673", "text": "func (*GetBlockchainInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "bc50668df7e6b612ed35e678f4bce099", "score": "0.67512256", "text": "func (*ClientBlockGetByTransactionIdRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_client_block_pb2_client_block_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "1d965c8fea2502522a54f867ea97573b", "score": "0.6729778", "text": "func (*GetPeerInfoResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{206}\n}", "title": "" }, { "docid": "14e7cbeabd4fcbee790ba77813fd9d1c", "score": "0.67287236", "text": "func (*BlockMetadata) Descriptor() ([]byte, []int) {\n\treturn file_cosmos_store_v1beta1_listening_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "14e7cbeabd4fcbee790ba77813fd9d1c", "score": "0.67287236", "text": "func (*BlockMetadata) Descriptor() ([]byte, []int) {\n\treturn file_cosmos_store_v1beta1_listening_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "82bed0052cf69642f8c5bb1ed0745147", "score": "0.6727606", "text": "func (*ClientBlockListRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_client_block_pb2_client_block_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "fe33361471c5cd61baefe2128e734b75", "score": "0.6697768", "text": "func (*CreateBlockRequest) Descriptor() ([]byte, []int) {\n\treturn file_blockchain_blockchainpb_blockchain_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "850cf6d7933fd9fa5635839debe95ded", "score": "0.6694777", "text": "func (ClientBlockGetResponse_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_protobuf_client_block_pb2_client_block_proto_rawDescGZIP(), []int{6, 0}\n}", "title": "" }, { "docid": "40cdd9fd3b87dd4c9bb042cf536bba56", "score": "0.669022", "text": "func (*BlockHeaderResponse) Descriptor() ([]byte, []int) {\n\treturn file_eth_v1_beacon_chain_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "2b6605b959cb3771b299193fe524c830", "score": "0.6689683", "text": "func (*DetachedBlockDetails) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "b31b6c01817fdcbdbef280b204d76cad", "score": "0.66869897", "text": "func (*DecryptResponse) Descriptor() ([]byte, []int) {\n\treturn file_apis_kms_v1_messages_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "b87ec6afff31b62c0c19edb2f50d4f58", "score": "0.66802096", "text": "func (*GetBallanceResponse) Descriptor() ([]byte, []int) {\n\treturn file_blockchain_blockchainpb_blockchain_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "e90d8bdc3852fe6a59b794f7ad278ef6", "score": "0.66745836", "text": "func (*GetBlockByHashRequest) Descriptor() ([]byte, []int) {\n\treturn file_qscc_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "90141a8b7c8c393f0a83ca150c6f3652", "score": "0.6672935", "text": "func (*ClearNeighborDiscoveryResponse) Descriptor() ([]byte, []int) {\n\treturn file_layer2_layer2_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "315c50c883348539b1c33754feedc9fc", "score": "0.66709095", "text": "func (*Block) Descriptor() ([]byte, []int) {\n\treturn file_blockchain_blockchainpb_blockchain_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "a718e2aba116320a3039298c0d8a52e1", "score": "0.6664039", "text": "func (*BlockRequest) Descriptor() ([]byte, []int) {\n\treturn file_eth_v1_beacon_chain_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "bf37e3ded0a96269d36b5d0bd56fae2e", "score": "0.6647933", "text": "func (*Block) Descriptor() ([]byte, []int) {\n\treturn file_contract_proto_rawDescGZIP(), []int{33}\n}", "title": "" }, { "docid": "18edf661173f16c2de31d1eda7a73bb1", "score": "0.66465175", "text": "func (*SendWakeOnLANResponse) Descriptor() ([]byte, []int) {\n\treturn file_layer2_layer2_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "ae07e9509a80daa5be653eccf1fb801e", "score": "0.66457784", "text": "func (*BestBlockRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{176}\n}", "title": "" }, { "docid": "83d08b8ada3162114308066f88de0c5d", "score": "0.66425174", "text": "func (*GetResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_powergate_v1_powergate_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "93519a70d0ccd6d81ad19865115627f3", "score": "0.66396403", "text": "func (*GetConfigBlockRequest) Descriptor() ([]byte, []int) {\n\treturn file_cscc_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "29168b71128e3813de4f09322220f3c7", "score": "0.6639566", "text": "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_fire_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "6fc4d1792d816f20e811ccbe35930627", "score": "0.6632569", "text": "func (*NetworkSourceResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_v1_bmc_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "097d1b0decb1483007fe39331415c4de", "score": "0.6625593", "text": "func (*GetBlockChainInfoResult) Descriptor() ([]byte, []int) {\n\treturn file_chain_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "b536efe51de83186e5c7e071e427ac4e", "score": "0.6607111", "text": "func (ClientBlockListResponse_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_protobuf_client_block_pb2_client_block_proto_rawDescGZIP(), []int{1, 0}\n}", "title": "" }, { "docid": "b69aa6c6ea7fa268edc9b99c182a1172", "score": "0.6606605", "text": "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_comment_proto_comment_comment_service_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "a69d2180935338821e4d69a7674f3d9a", "score": "0.66065437", "text": "func (*UnlockWalletResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{202}\n}", "title": "" }, { "docid": "83895ac7274c5f6b8e077c450d4bd8da", "score": "0.66019934", "text": "func (*GetBlockByNumberRequest) Descriptor() ([]byte, []int) {\n\treturn file_qscc_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "216d194edd35dffbf065d43f7b62462e", "score": "0.65978235", "text": "func (*SubscribeBlocksRequest) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{35}\n}", "title": "" }, { "docid": "bcd445ced0edef4104ebf7cbdac476c5", "score": "0.65950763", "text": "func (*Block) Descriptor() ([]byte, []int) {\n\treturn file_common_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "8f9132d020e1e9abe754e75ce2dcde10", "score": "0.6585797", "text": "func (*GetAttrResponse) Descriptor() ([]byte, []int) {\n\treturn file_learnfs_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "0763e53eeed6d9ce032b042e377165a2", "score": "0.6582427", "text": "func (*GetResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_comment_proto_comment_comment_service_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "ae89033b385d52506a35ba3729ed1b8e", "score": "0.6578795", "text": "func (*GetPeerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{205}\n}", "title": "" }, { "docid": "eba218eee2946edb8bd150ae8190d840", "score": "0.65731037", "text": "func (*CloseWalletResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{94}\n}", "title": "" }, { "docid": "b94beaca316b70db6bc094899a12a993", "score": "0.6565357", "text": "func (*Block) Descriptor() ([]byte, []int) {\n\treturn file_hotstuff_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "91eb24386ae1108fbb94273ef3d468c7", "score": "0.6559532", "text": "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_tags_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "7a9fd59a49f381ff3594932aa4610255", "score": "0.65534544", "text": "func (*LocalDisconnectResponse) Descriptor() ([]byte, []int) {\n\treturn file_cluster_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "289a38b435f9be13506f2d1eedb25449", "score": "0.6551941", "text": "func (*GetResponse) Descriptor() ([]byte, []int) {\n\treturn file_microservices_proto_item_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "31222fbf24fdc912756a14a7cafdaeee", "score": "0.65476686", "text": "func (x *fastReflection_MsgUpdateCuratorResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateCuratorResponse\n}", "title": "" }, { "docid": "c1fe32517a03d7ccd30f988e3bb69e16", "score": "0.65428835", "text": "func (*ListCbsdResponse) Descriptor() ([]byte, []int) {\n\treturn file_dp_protos_cbsd_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "26464d0a1d7aaf38ae425862844840db", "score": "0.6541574", "text": "func (*VerifyMessageResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_powergate_v1_powergate_proto_rawDescGZIP(), []int{33}\n}", "title": "" }, { "docid": "22b9b671b679c9321f60a82cec800933", "score": "0.6539175", "text": "func (*GetWalletBalanceResponse) Descriptor() ([]byte, []int) {\n\treturn file_m2m_wallet_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "1ca975b0421af0ef692f127130d0a4c2", "score": "0.6535549", "text": "func (*StudentGetNonJoinCourseResponse) Descriptor() ([]byte, []int) {\n\treturn file_course_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "05d3aadda46065ea8ef34ad222237da7", "score": "0.6533269", "text": "func (*WatchResponse) Descriptor() ([]byte, []int) {\n\treturn file_ms_diabet_profile_v1_api_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "3b85dbfd47decde79a36e93ce9ff4890", "score": "0.6533029", "text": "func (*BlockID) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "4e65df5a8de39d04884583e95b7f083c", "score": "0.65323895", "text": "func (*BlockAttestationsResponse) Descriptor() ([]byte, []int) {\n\treturn file_eth_v1_beacon_chain_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "57cbc18c49b132c09432331373d1ab65", "score": "0.65302974", "text": "func (*UnbanPeerReq) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "435c7b2658707a1ecd29347d0d2c785d", "score": "0.6524299", "text": "func (*UpdateCbsdResponse) Descriptor() ([]byte, []int) {\n\treturn file_dp_protos_cbsd_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "7c6b9bf32e18eac549febfa657612d1c", "score": "0.6519776", "text": "func (*FetchCbsdResponse) Descriptor() ([]byte, []int) {\n\treturn file_dp_protos_cbsd_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "f59ffc1563e67a49078d17b4efecb98f", "score": "0.6518231", "text": "func (*GetDownLinkPriceResponse) Descriptor() ([]byte, []int) {\n\treturn file_m2m_wallet_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "2954a636361029335fde0c9ebc544101", "score": "0.6517412", "text": "func (*FetchMissingCFiltersResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{102}\n}", "title": "" }, { "docid": "b4173433994933a62b0637ca51606be4", "score": "0.65173876", "text": "func (*BlockHeadersRequest) Descriptor() ([]byte, []int) {\n\treturn file_eth_v1_beacon_chain_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "3d1ffa0cbd107c31f35eb56a4601d29e", "score": "0.6515359", "text": "func (*FilteredBlock) Descriptor() ([]byte, []int) {\n\treturn file_event_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "d0f8b42797358bc12361051f7aa575ca", "score": "0.65116006", "text": "func (x *fastReflection_BlockMetadata) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.store.v1beta1.BlockMetadata.request_begin_block\":\n\t\tif x.RequestBeginBlock == nil {\n\t\t\tx.RequestBeginBlock = new(abci.RequestBeginBlock)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.RequestBeginBlock.ProtoReflect())\n\tcase \"cosmos.store.v1beta1.BlockMetadata.response_begin_block\":\n\t\tif x.ResponseBeginBlock == nil {\n\t\t\tx.ResponseBeginBlock = new(abci.ResponseBeginBlock)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.ResponseBeginBlock.ProtoReflect())\n\tcase \"cosmos.store.v1beta1.BlockMetadata.deliver_txs\":\n\t\tif x.DeliverTxs == nil {\n\t\t\tx.DeliverTxs = []*BlockMetadata_DeliverTx{}\n\t\t}\n\t\tvalue := &_BlockMetadata_3_list{list: &x.DeliverTxs}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"cosmos.store.v1beta1.BlockMetadata.request_end_block\":\n\t\tif x.RequestEndBlock == nil {\n\t\t\tx.RequestEndBlock = new(abci.RequestEndBlock)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.RequestEndBlock.ProtoReflect())\n\tcase \"cosmos.store.v1beta1.BlockMetadata.response_end_block\":\n\t\tif x.ResponseEndBlock == nil {\n\t\t\tx.ResponseEndBlock = new(abci.ResponseEndBlock)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.ResponseEndBlock.ProtoReflect())\n\tcase \"cosmos.store.v1beta1.BlockMetadata.response_commit\":\n\t\tif x.ResponseCommit == nil {\n\t\t\tx.ResponseCommit = new(abci.ResponseCommit)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.ResponseCommit.ProtoReflect())\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.store.v1beta1.BlockMetadata\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.store.v1beta1.BlockMetadata does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "9f3d29dca36a4ae869a9c97cbc4fa2a7", "score": "0.6511451", "text": "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_interservice_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "4f317452778e7c0757daec65235abc99", "score": "0.65112746", "text": "func (*CreateWatchingOnlyWalletResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{90}\n}", "title": "" }, { "docid": "80353fc04cf867b5c7cc0b53ae60b83c", "score": "0.6510834", "text": "func (*DecodeRawTransactionResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{167}\n}", "title": "" }, { "docid": "524c00a7c15e09b7eba2719ec641298c", "score": "0.6509572", "text": "func (*ConnectToPeerResponse) Descriptor() ([]byte, []int) {\n\treturn file_v2_mintter_proto_rawDescGZIP(), []int{15}\n}", "title": "" } ]
e9d68ad7d0d53a977195120c147a4349
GetByOriginID returns TemplateDetails founded by Origin ID and partner ID
[ { "docid": "a7d1530e0c9c69e0fd4650fd7ef8403f", "score": "0.7811983", "text": "func (mock TemplateCacheMock) GetByOriginID(ctx context.Context, partnerID string, originID gocql.UUID, hasNOCAccess bool) (models.TemplateDetails, error) {\n\tfmt.Printf(\"TemplateCacheMock.GetByOriginID method called, used RequestID: %v, partnerID: %v, originID: %v\",\n\t\ttransactionID.FromContext(ctx), partnerID, originID.String())\n\n\tif isNeedError, _ := ctx.Value(IsNeedError).(bool); isNeedError {\n\t\treturn models.TemplateDetails{}, errors.New(\"Cache and Scripting MS is down\")\n\t}\n\tfor _, template := range mock.Repo[partnerID] {\n\t\tif template.OriginID == originID && template.PartnerID == partnerID {\n\t\t\treturn template, nil\n\t\t}\n\t}\n\treturn models.TemplateDetails{}, models.TemplateNotFoundError{\n\t\tOriginID: originID,\n\t\tPartnerID: partnerID,\n\t}\n}", "title": "" } ]
[ { "docid": "ab1e1ccc438a1d7f55bce0e88cb25001", "score": "0.5431081", "text": "func (mock TemplateCacheMock) GetAllTemplatesDetails(ctx context.Context, partnerID string) ([]models.TemplateDetails, error) {\n\tfmt.Printf(\"TemplateCacheMock.GetAllTemplatesDetails method called, used RequestID: %v, partnerID: %v\\n\", transactionID.FromContext(ctx), partnerID)\n\n\tif isNeedError, _ := ctx.Value(IsNeedError).(bool); isNeedError {\n\t\treturn nil, errors.New(\"Cache and Scripting MS is down\")\n\t}\n\n\ttemplates := make([]models.TemplateDetails, 0, len(mock.Repo))\n\tfor _, template := range mock.Repo[partnerID] {\n\t\tif partnerID == template.PartnerID || template.PartnerID == emptyUUID.String() {\n\t\t\ttemplates = append(templates, template)\n\t\t}\n\t}\n\treturn templates, nil\n}", "title": "" }, { "docid": "065d566b750cd7a662d00ed130bcaad7", "score": "0.52216315", "text": "func (repository Transfers) GetByOriginID(originID uint64) ([]models.Transfer, error) {\n\trows, err := repository.db.Query(\n\t\t\"select id, account_origin_id, account_destination_id, amount, created_at from transfers where account_origin_id = ?\",\n\t\toriginID,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tvar transfers []models.Transfer\n\n\tfor rows.Next() {\n\t\tvar transfer models.Transfer\n\n\t\tif err = rows.Scan(\n\t\t\t&transfer.ID,\n\t\t\t&transfer.AccountOriginID,\n\t\t\t&transfer.AccountDestinationID,\n\t\t\t&transfer.Amount,\n\t\t\t&transfer.CreatedAt,\n\t\t); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ttransfers = append(transfers, transfer)\n\t}\n\n\treturn transfers, nil\n}", "title": "" }, { "docid": "deaf2c57ae35b840714e6d5bb9472a25", "score": "0.5216602", "text": "func getTemplate(c context.Context, id int64) (models.Template, error) {\n\tif id == 0 {\n\t\treturn models.Template{}, errors.New(\"datastore: no such entity\")\n\t}\n\t// Get the publication details by id\n\tvar template models.Template\n\ttemplateId := datastore.NewKey(c, \"Template\", \"\", id, nil)\n\n\terr := nds.Get(c, templateId, &template)\n\tif err != nil {\n\t\tlog.Errorf(c, \"%v\", err)\n\t\treturn models.Template{}, err\n\t}\n\n\tif !template.Created.IsZero() {\n\t\ttemplate.Format(templateId, \"templates\")\n\t\treturn template, nil\n\t}\n\treturn models.Template{}, errors.New(\"No template by this id\")\n}", "title": "" }, { "docid": "7c7b26ac2a908ce14566a43275d03a11", "score": "0.50669736", "text": "func (r EditTemplateRequest) GetRegionId() string {\n return r.RegionId\n}", "title": "" }, { "docid": "85e7c435a6286124aca27b100ed05f80", "score": "0.48743433", "text": "func (c *WorkOrderTemplateClient) Get(ctx context.Context, id int) (*WorkOrderTemplate, error) {\n\treturn c.Query().Where(workordertemplate.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "31f1844d14848a6570fab2a5f4096424", "score": "0.48257166", "text": "func (s *Stack) GetTemplate(id string) (template *abstract.HostTemplate, xerr fail.Error) {\n\tjsonFile, err := os.Open(s.LibvirtConfig.TemplatesJSONPath)\n\tif err != nil {\n\t\treturn nil, fail.Errorf(\n\t\t\tfmt.Sprintf(\"failed to open %s : %s\", s.LibvirtConfig.TemplatesJSONPath, err.Error()), err,\n\t\t)\n\t}\n\tdefer func() {\n\t\tif err := jsonFile.Close(); err != nil {\n\t\t\tfmt.Println(\"failed to close template file\")\n\t\t}\n\t}()\n\n\tbyteValue, err := ioutil.ReadAll(jsonFile)\n\tif err != nil {\n\t\treturn nil, fail.Errorf(\n\t\t\tfmt.Sprintf(\"failed to read %s : %s\", s.LibvirtConfig.TemplatesJSONPath, err.Error()), err,\n\t\t)\n\t}\n\n\tvar result map[string]interface{}\n\tif err := json.Unmarshal([]byte(byteValue), &result); err != nil {\n\t\treturn nil, fail.Errorf(\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"failed to unmarshal jsonFile %s : %s\", s.LibvirtConfig.TemplatesJSONPath, err.Error(),\n\t\t\t), err,\n\t\t)\n\t}\n\n\ttemplatesJSON := result[\"templates\"].([]interface{})\n\tfor _, templateJSON := range templatesJSON {\n\t\tif templateID, _ := templateJSON.(map[string]interface{})[\"templateID\"]; templateID == id {\n\t\t\treturn &abstract.HostTemplate{\n\t\t\t\tCores: int(templateJSON.(map[string]interface{})[\"templateSpecs\"].(map[string]interface{})[\"coresNumber\"].(float64)),\n\t\t\t\tRAMSize: float32(templateJSON.(map[string]interface{})[\"templateSpecs\"].(map[string]interface{})[\"ramSize\"].(float64)),\n\t\t\t\tDiskSize: int(templateJSON.(map[string]interface{})[\"templateSpecs\"].(map[string]interface{})[\"diskSize\"].(float64)),\n\t\t\t\tGPUNumber: int(templateJSON.(map[string]interface{})[\"templateSpecs\"].(map[string]interface{})[\"gpuNumber\"].(float64)),\n\t\t\t\tGPUType: templateJSON.(map[string]interface{})[\"templateSpecs\"].(map[string]interface{})[\"gpuType\"].(string),\n\t\t\t\tID: templateJSON.(map[string]interface{})[\"templateID\"].(string),\n\t\t\t\tName: templateJSON.(map[string]interface{})[\"templateName\"].(string),\n\t\t\t}, nil\n\t\t}\n\t}\n\n\treturn nil, fail.Errorf(fmt.Sprintf(\"template with id=%s not found\", id), err)\n}", "title": "" }, { "docid": "e1205a78ab526ee4bfea8d140165c204", "score": "0.47035086", "text": "func (client *Client) ZoneGetWithID(ctx context.Context, id string, opts ...RequestOption) (result *Zone, err error) {\n\tparams := url.Values{}\n\tfor _, opt := range opts {\n\t\topt(&params)\n\t}\n\tendpoint := fmt.Sprintf(\"zones/%s\", id)\n\terr = client.get(ctx, endpoint, params, &result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "c6e8af671b9fbb37bd0924280c6de5f8", "score": "0.46794388", "text": "func FindOriginProject(ctx context.Context, exec boil.ContextExecutor, iD int64, selectCols ...string) (*OriginProject, error) {\n\toriginProjectObj := &OriginProject{}\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 \\\"origin_projects\\\" where \\\"id\\\"=$1\", sel,\n\t)\n\n\tq := queries.Raw(query, iD)\n\n\terr := q.Bind(ctx, exec, originProjectObj)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"models: unable to select from origin_projects\")\n\t}\n\n\treturn originProjectObj, nil\n}", "title": "" }, { "docid": "48b5c4484da40dfb21e8ca296c56d7ff", "score": "0.4627251", "text": "func (f *Template) Get(ctx context.Context, id, name string) (*template.WorkflowTemplate, error) {\n\tswitch {\n\tcase id != \"\":\n\t\tif _, ok := f.Objs[id]; ok {\n\t\t\treturn proto.Clone(f.Objs[id]).(*template.WorkflowTemplate), nil\n\t\t}\n\tdefault:\n\t\tfor _, obj := range f.Objs {\n\t\t\tif obj.GetName() == name {\n\t\t\t\treturn proto.Clone(obj).(*template.WorkflowTemplate), nil\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil, client.ErrNotFound\n}", "title": "" }, { "docid": "b7bd5234f47f6f6a5d92e336f63e44d2", "score": "0.46150395", "text": "func (c *ProjectTemplateClient) Get(ctx context.Context, id int) (*ProjectTemplate, error) {\n\treturn c.Query().Where(projecttemplate.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "dd85e6733aaccf2efea5b0c394309ecc", "score": "0.45796677", "text": "func (r segmentRepositoryWithLoader) GetByOrigin(ctx context.Context, origin string) (do *domain.Segment, err error) {\n\tdo, err = r.repo.GetByOrigin(ctx, origin)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar loader = ContextSegmentLoader(ctx)\n\tif loader != nil {\n\t\tloader.Set(do.ID(), do)\n\t}\n\treturn\n}", "title": "" }, { "docid": "b8a4b6e4fd639f1d977bb3947d275eec", "score": "0.45769995", "text": "func GetTemplate(c context.Context, r *http.Request, id string) (models.Template, interface{}, error) {\n\t// Get the details of the current user\n\tcurrentId, err := utilities.StringIdToInt(id)\n\tif err != nil {\n\t\tlog.Errorf(c, \"%v\", err)\n\t\treturn models.Template{}, nil, err\n\t}\n\n\ttemplate, err := getTemplate(c, currentId)\n\tif err != nil {\n\t\tlog.Errorf(c, \"%v\", err)\n\t\treturn models.Template{}, nil, err\n\t}\n\n\treturn template, nil, nil\n}", "title": "" }, { "docid": "547b5e1a49723ff194c2249808f5b869", "score": "0.4564615", "text": "func (t *Tailer) getOrigin(entry *sdjournal.JournalEntry) *message.Origin {\n\torigin := message.NewOrigin(t.source)\n\torigin.Identifier = t.Identifier()\n\torigin.Offset, _ = t.journal.GetCursor()\n\t// set the service and the source attributes of the message,\n\t// those values are still overridden by the integration config when defined\n\ttags := t.getTags(entry)\n\tapplicationName := t.getApplicationName(entry, tags)\n\torigin.SetSource(applicationName)\n\torigin.SetService(applicationName)\n\torigin.SetTags(tags)\n\treturn origin\n}", "title": "" }, { "docid": "a1049b8977787268bc6ed1039116468a", "score": "0.4546389", "text": "func (receiver *EphemeralTemplateRaw) GetSingle(model extension.Model, db *gorm.DB, parameters gin.Params, _ url.Values, queryFields string) (interface{}, error) {\n\tmodelKey, err := model.GetModelKey(model, \"\")\n\tif err != nil {\n\t\tlogging.Logger().Debug(err.Error())\n\t\treturn nil, err\n\t}\n\n\tname := parameters.ByName(modelKey.KeyParameter)\n\n\tephemeralTemplate, exists := nameEphemeralTemplateMap[name]\n\n\tif !exists {\n\t\tlogging.Logger().Debug(errors.New(\"record not found\"))\n\t\treturn nil, errors.New(\"record not found\")\n\t}\n\n\treturn ephemeralTemplate.TemplateContent, nil\n}", "title": "" }, { "docid": "094046c7c0aaa6c1154867ef5153d629", "score": "0.45202872", "text": "func LoadInstanceByIDForTemplateIDAndProjectIDs(ctx context.Context, db gorp.SqlExecutor, id, templateID int64, projectIDs []int64, opts ...LoadInstanceOptionFunc) (*sdk.WorkflowTemplateInstance, error) {\n\tquery := gorpmapping.NewQuery(`\n SELECT *\n FROM workflow_template_instance\n WHERE id = $1 AND workflow_template_id = $2 AND project_id = ANY(string_to_array($3, ',')::int[])\n `).Args(id, templateID, gorpmapping.IDsToQueryString(projectIDs))\n\treturn getInstance(ctx, db, query, opts...)\n}", "title": "" }, { "docid": "aa8d8da41f6802bb8fc939f5409c5ff2", "score": "0.45150328", "text": "func (t Templates) ByID(id int) Templates {\n\tif id == 0 {\n\t\treturn t\n\t}\n\tfor _, template := range t {\n\t\tif template.ID == id {\n\t\t\treturn Templates{template}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7025dd7dd9f6bc5f2dc20d7e7ec16f5f", "score": "0.44987044", "text": "func OriginProjectExists(ctx context.Context, exec boil.ContextExecutor, iD int64) (bool, error) {\n\tvar exists bool\n\tsql := \"select exists(select 1 from \\\"origin_projects\\\" where \\\"id\\\"=$1 limit 1)\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, iD)\n\t}\n\n\trow := exec.QueryRowContext(ctx, sql, iD)\n\n\terr := row.Scan(&exists)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: unable to check if origin_projects exists\")\n\t}\n\n\treturn exists, nil\n}", "title": "" }, { "docid": "752014a510abaf8fe28a7e78ce65b2ce", "score": "0.44901896", "text": "func (receiver *EphemeralTemplate) GetSingle(model extension.Model, db *gorm.DB, parameters gin.Params, _ url.Values, queryFields string) (interface{}, error) {\n\tmodelKey, err := model.GetModelKey(model, \"\")\n\tif err != nil {\n\t\tlogging.Logger().Debug(err.Error())\n\t\treturn nil, err\n\t}\n\n\tname := parameters.ByName(modelKey.KeyParameter)\n\n\tresult, exists := nameEphemeralTemplateMap[name]\n\n\tif !exists {\n\t\tlogging.Logger().Debug(errors.New(\"record not found\"))\n\t\treturn nil, errors.New(\"record not found\")\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "c5d002ab931e68cd993f3bb272a57376", "score": "0.44784546", "text": "func LoadInstanceByTemplateIDAndProjectIDAndRequestWorkflowName(ctx context.Context, db gorp.SqlExecutor, templateID, projectID int64, workflowName string, opts ...LoadInstanceOptionFunc) (*sdk.WorkflowTemplateInstance, error) {\n\tquery := gorpmapping.NewQuery(`\n SELECT *\n FROM workflow_template_instance\n WHERE workflow_template_id = $1 AND project_id = $2 AND (request->>'workflow_name')::text = $3\n `).Args(templateID, projectID, workflowName)\n\treturn getInstance(ctx, db, query, opts...)\n}", "title": "" }, { "docid": "e8d311dca3980b3a3f7d3e70ae8b947a", "score": "0.4476571", "text": "func (mock TemplateCacheMock) GetAllTemplates(ctx context.Context, partnerID string, hasNOCAccess bool) ([]models.Template, error) {\n\tfmt.Printf(\"TemplateCacheMock.GetAllTemplatesDetails method called, used RequestID: %v, partnerID: %v\\n\", transactionID.FromContext(ctx), partnerID)\n\n\tif isNeedError, _ := ctx.Value(IsNeedError).(bool); isNeedError {\n\t\treturn nil, errors.New(\"Cache and Scripting MS is down\")\n\t}\n\n\ttemplates := make([]models.Template, 0, len(mock.Repo))\n\tfor _, template := range mock.RepoTemplates[partnerID] {\n\t\tif partnerID == template.PartnerID || template.PartnerID == emptyUUID.String() {\n\t\t\ttemplates = append(templates, template)\n\t\t}\n\t}\n\treturn templates, nil\n}", "title": "" }, { "docid": "d2e80a1d5ae45eaf4d1bb99647f610be", "score": "0.4476048", "text": "func (in *RecordSet) GetTemplate(client dynamic.Interface) (string, error) {\n\tif client == nil {\n\t\treturn \"\", fmt.Errorf(\"k8s client not loaded for template\")\n\t}\n\ttemplate := cloudformation.NewTemplate()\n\n\ttemplate.Description = \"AWS Controller - route53.RecordSet (ac-{TODO})\"\n\n\ttemplate.Outputs = map[string]interface{}{\n\t\t\"ResourceRef\": map[string]interface{}{\n\t\t\t\"Value\": cloudformation.Ref(\"RecordSet\"),\n\t\t\t\"Export\": map[string]interface{}{\n\t\t\t\t\"Name\": in.Name + \"Ref\",\n\t\t\t},\n\t\t},\n\t}\n\n\troute53RecordSet := &route53.RecordSet{}\n\n\tif !reflect.DeepEqual(in.Spec.AliasTarget, RecordSet_AliasTarget{}) {\n\t\troute53RecordSetAliasTarget := route53.RecordSet_AliasTarget{}\n\n\t\tif in.Spec.AliasTarget.DNSName != \"\" {\n\t\t\troute53RecordSetAliasTarget.DNSName = in.Spec.AliasTarget.DNSName\n\t\t}\n\n\t\tif in.Spec.AliasTarget.EvaluateTargetHealth || !in.Spec.AliasTarget.EvaluateTargetHealth {\n\t\t\troute53RecordSetAliasTarget.EvaluateTargetHealth = in.Spec.AliasTarget.EvaluateTargetHealth\n\t\t}\n\n\t\t// TODO(christopherhein) move these to a defaulter\n\t\troute53RecordSetAliasTargetHostedZoneRefItem := in.Spec.AliasTarget.HostedZoneRef.DeepCopy()\n\n\t\tif route53RecordSetAliasTargetHostedZoneRefItem.ObjectRef.Namespace == \"\" {\n\t\t\troute53RecordSetAliasTargetHostedZoneRefItem.ObjectRef.Namespace = in.Namespace\n\t\t}\n\n\t\tin.Spec.AliasTarget.HostedZoneRef = *route53RecordSetAliasTargetHostedZoneRefItem\n\t\thostedZoneId, err := in.Spec.AliasTarget.HostedZoneRef.String(client)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tif hostedZoneId != \"\" {\n\t\t\troute53RecordSetAliasTarget.HostedZoneId = hostedZoneId\n\t\t}\n\n\t\troute53RecordSet.AliasTarget = &route53RecordSetAliasTarget\n\t}\n\n\tif in.Spec.Comment != \"\" {\n\t\troute53RecordSet.Comment = in.Spec.Comment\n\t}\n\n\tif in.Spec.Failover != \"\" {\n\t\troute53RecordSet.Failover = in.Spec.Failover\n\t}\n\n\tif !reflect.DeepEqual(in.Spec.GeoLocation, RecordSet_GeoLocation{}) {\n\t\troute53RecordSetGeoLocation := route53.RecordSet_GeoLocation{}\n\n\t\tif in.Spec.GeoLocation.ContinentCode != \"\" {\n\t\t\troute53RecordSetGeoLocation.ContinentCode = in.Spec.GeoLocation.ContinentCode\n\t\t}\n\n\t\tif in.Spec.GeoLocation.CountryCode != \"\" {\n\t\t\troute53RecordSetGeoLocation.CountryCode = in.Spec.GeoLocation.CountryCode\n\t\t}\n\n\t\tif in.Spec.GeoLocation.SubdivisionCode != \"\" {\n\t\t\troute53RecordSetGeoLocation.SubdivisionCode = in.Spec.GeoLocation.SubdivisionCode\n\t\t}\n\n\t\troute53RecordSet.GeoLocation = &route53RecordSetGeoLocation\n\t}\n\n\t// TODO(christopherhein) move these to a defaulter\n\troute53RecordSetHealthCheckRefItem := in.Spec.HealthCheckRef.DeepCopy()\n\n\tif route53RecordSetHealthCheckRefItem.ObjectRef.Namespace == \"\" {\n\t\troute53RecordSetHealthCheckRefItem.ObjectRef.Namespace = in.Namespace\n\t}\n\n\tin.Spec.HealthCheckRef = *route53RecordSetHealthCheckRefItem\n\thealthCheckId, err := in.Spec.HealthCheckRef.String(client)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif healthCheckId != \"\" {\n\t\troute53RecordSet.HealthCheckId = healthCheckId\n\t}\n\n\t// TODO(christopherhein) move these to a defaulter\n\troute53RecordSetHostedZoneRefItem := in.Spec.HostedZoneRef.DeepCopy()\n\n\tif route53RecordSetHostedZoneRefItem.ObjectRef.Namespace == \"\" {\n\t\troute53RecordSetHostedZoneRefItem.ObjectRef.Namespace = in.Namespace\n\t}\n\n\tin.Spec.HostedZoneRef = *route53RecordSetHostedZoneRefItem\n\thostedZoneId, err := in.Spec.HostedZoneRef.String(client)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif hostedZoneId != \"\" {\n\t\troute53RecordSet.HostedZoneId = hostedZoneId\n\t}\n\n\tif in.Spec.HostedZoneName != \"\" {\n\t\troute53RecordSet.HostedZoneName = in.Spec.HostedZoneName\n\t}\n\n\tif in.Spec.MultiValueAnswer || !in.Spec.MultiValueAnswer {\n\t\troute53RecordSet.MultiValueAnswer = in.Spec.MultiValueAnswer\n\t}\n\n\tif in.Spec.Name != \"\" {\n\t\troute53RecordSet.Name = in.Spec.Name\n\t}\n\n\tif in.Spec.Region != \"\" {\n\t\troute53RecordSet.Region = in.Spec.Region\n\t}\n\n\tif len(in.Spec.ResourceRecords) > 0 {\n\t\troute53RecordSet.ResourceRecords = in.Spec.ResourceRecords\n\t}\n\n\tif in.Spec.SetIdentifier != \"\" {\n\t\troute53RecordSet.SetIdentifier = in.Spec.SetIdentifier\n\t}\n\n\tif in.Spec.TTL != \"\" {\n\t\troute53RecordSet.TTL = in.Spec.TTL\n\t}\n\n\tif in.Spec.Type != \"\" {\n\t\troute53RecordSet.Type = in.Spec.Type\n\t}\n\n\tif in.Spec.Weight != route53RecordSet.Weight {\n\t\troute53RecordSet.Weight = in.Spec.Weight\n\t}\n\n\ttemplate.Resources = map[string]cloudformation.Resource{\n\t\t\"RecordSet\": route53RecordSet,\n\t}\n\n\t// json, err := template.JSONWithOptions(&intrinsics.ProcessorOptions{NoEvaluateConditions: true})\n\tjson, err := template.JSON()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(json), nil\n}", "title": "" }, { "docid": "303adfc2bf865eb36c7a6f821183ac04", "score": "0.44698244", "text": "func ContactDetails(w http.ResponseWriter, r *http.Request) {\n\n\tvars := mux.Vars(r)\n\tid := vars[\"id\"]\n\tintg, err := strconv.Atoi(id)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tc, err := models.GetContacts()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tvar cnt models.Contact\n\t//checking db against url param\n\tfor _, val := range c {\n\t\tif val.ID == intg {\n\t\t\tcnt = val\n\t\t\tbreak\n\t\t}\n\t}\n\n\terr = tpl.ExecuteTemplate(w, \"contactDetails.gohtml\", cnt)\n\tif err != nil {\n\t\tlog.Fatalf(\"template execution: %s\", err)\n\t}\n\n}", "title": "" }, { "docid": "9e59d864b4f1d847a2e74889f20ec93d", "score": "0.4457171", "text": "func (c *WorkOrderTemplateClient) GetX(ctx context.Context, id int) *WorkOrderTemplate {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "c751ad02d0a4a9299738e87a4f84aa01", "score": "0.44038165", "text": "func (d DB) GetTemplate(ctx context.Context, fields map[string]string) (string, string, string, error) {\n\treturn d.GetTemplateFunc(ctx, fields)\n}", "title": "" }, { "docid": "d8e58a163c76865eb43717269debdb9b", "score": "0.43832654", "text": "func (c *Card) TemplateID() uint32 {\n\treturn c.templateID\n}", "title": "" }, { "docid": "e98a03655d6d59c7d0a40ac7c9cf7ea8", "score": "0.43827152", "text": "func (c *FlowExecutionTemplateClient) Get(ctx context.Context, id int) (*FlowExecutionTemplate, error) {\n\treturn c.Query().Where(flowexecutiontemplate.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "d54a9eb6ba09ee64e180632de5ac27f9", "score": "0.43779576", "text": "func (mgr *ServerTemplateManager) Get(id string) (*api.ServerTemplate, api.GetServerTemplateError) {\n\tfilters := append(mgr.createFilters(), &pricing.Filter{\n\t\tField: aws.String(\"instanceType\"),\n\t\tType: aws.String(\"TERM_MATCH\"),\n\t\tValue: aws.String(id),\n\t})\n\tout, err := mgr.Provider.AWSServices.PricingClient.GetProducts(&pricing.GetProductsInput{\n\t\tFilters: filters,\n\t\tFormatVersion: aws.String(\"aws_v1\"),\n\t\tServiceCode: aws.String(\"AmazonEC2\"),\n\t})\n\tif err != nil {\n\t\treturn nil, api.NewGetServerTemplateError(err, id)\n\t}\n\tfor _, price := range out.PriceList {\n\t\tres := toTemplate(price)\n\t\tif res.ID == id {\n\t\t\treturn res, nil\n\t\t}\n\n\t}\n\treturn nil, api.NewGetServerTemplateError(err, id)\n}", "title": "" }, { "docid": "01859d7b3db861a93d19c38235afd2a1", "score": "0.4350076", "text": "func (m *SearchHit) GetResultTemplateId()(*string) {\n return m.resultTemplateId\n}", "title": "" }, { "docid": "e0843c1183a3f6bd365c3341774bf160", "score": "0.433242", "text": "func (c *ProjectTemplateClient) GetX(ctx context.Context, id int) *ProjectTemplate {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "4f1a33e78dd3045b8c129c4f18b40511", "score": "0.4329403", "text": "func RetrieveItemDetails(w http.ResponseWriter, req *http.Request) {\n\ttemplate, err := getTemplateID(req.URL.Path, \"/detail/\")\n\tif err != nil {\n\t\tlogger.WriteError(err)\n\t\treturn\n\t}\n\n\titem, err := controller.GetDetail(template)\n\tif err != nil {\n\t\tlogger.WriteError(err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tm := map[string]interface{}{\n\t\t\"body\": item,\n\t}\n\tw.WriteHeader(http.StatusOK)\n\t_ = json.NewEncoder(w).Encode(m)\n}", "title": "" }, { "docid": "409f343d05afaca8c77f3d85d8b3446b", "score": "0.43168262", "text": "func (m *Manager) getTemplate(themeName, packageName, object string) (*template.Template, error) {\n\ttheme, ok1 := m.themes[themeName]\n\tif theme == nil {\n\t\treturn nil, fmt.Errorf(\"Theme \" + themeName + \" does not exist\")\n\t}\n\tlogger.Debug(\"Theme exists:\", themeName, ok1)\n\n\tpack, ok2 := theme.packages[packageName]\n\tif pack == nil {\n\t\treturn nil, fmt.Errorf(\"Package \" + packageName + \" does not exist\")\n\t}\n\tlogger.Debug(\"Package exists:\", packageName, ok2)\n\n\tobj, ok3 := pack.objects[object]\n\tif obj == nil {\n\t\treturn nil, fmt.Errorf(\"Object \" + object + \" does not exist\")\n\t}\n\tlogger.Debug(\"Object exists:\", object, ok3)\n\n\treturn obj, nil\n}", "title": "" }, { "docid": "ddc714a51f8caadd87b55d0e5257612c", "score": "0.43132034", "text": "func GetDetailsByID(w http.ResponseWriter, r *http.Request) {\n\n\tqueryParams := mux.Vars(r)\n\n\taccount := &Account{}\n\n\t// convert id to int64\n\tid, err := strconv.ParseInt(queryParams[\"id\"], 10, 64)\n\tif err != nil {\n\t\tbody, _ := json.Marshal(&errors{Code: http.StatusInternalServerError, Message: err.Error()})\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write(body)\n\t\treturn\n\t}\n\n\taccs, err := account.getDetailsFromDBbyID(id)\n\tif err != nil {\n\t\tbody, _ := json.Marshal(&errors{Code: http.StatusBadRequest, Message: err.Error()})\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tw.Write(body)\n\t\treturn\n\t}\n\n\tif len(accs) == 0 {\n\t\tbody, _ := json.Marshal(&errors{Code: http.StatusNotFound, Message: fmt.Sprintln(\"Account with the ID not exist\")})\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tw.Write(body)\n\t\treturn\n\t}\n\n\tbody, _ := json.Marshal(accs)\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(body)\n}", "title": "" }, { "docid": "bd4dbc74c3f837c73564e5b9a11499f2", "score": "0.43054074", "text": "func (client *Client) GetTemplate(id string) (*model.HostTemplate, error) {\n\t// Try 10 seconds to get template\n\tvar flv *flavors.Flavor\n\terr := retry.WhileUnsuccessfulDelay1Second(\n\t\tfunc() error {\n\t\t\tvar err error\n\t\t\tflv, err = flavors.Get(client.Compute, id).Extract()\n\t\t\treturn err\n\t\t},\n\t\t10*time.Second,\n\t)\n\tif err != nil {\n\t\tlog.Debugf(\"Error getting template: %+v\", err)\n\t\treturn nil, errors.Wrap(err, fmt.Sprintf(\"error getting template: %s\", ProviderErrorToString(err)))\n\t}\n\treturn &model.HostTemplate{\n\t\tHostTemplate: &propsv1.HostTemplate{\n\t\t\tHostSize: &propsv1.HostSize{\n\t\t\t\tCores: flv.VCPUs,\n\t\t\t\tRAMSize: float32(flv.RAM) / 1000.0,\n\t\t\t\tDiskSize: flv.Disk,\n\t\t\t},\n\t\t\tID: flv.ID,\n\t\t\tName: flv.Name,\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "a467fdb65f02121677eaa6c720ac8411", "score": "0.42966014", "text": "func (library *Library) GetGraphTemplate(origin, source, template, filter string) (*Graph, error) {\n\tid := origin + \"\\x30\" + template + \"\\x30\" + filter\n\n\tif _, ok := library.Config.Origins[origin]; !ok {\n\t\treturn nil, fmt.Errorf(\"unknown `%s' origin\", origin)\n\t} else if _, ok := library.Config.Origins[origin].Templates[template]; !ok {\n\t\treturn nil, fmt.Errorf(\"unknown `%s' template for `%s' origin\", template, origin)\n\t}\n\n\t// Load template from filesystem if needed\n\tif !library.ItemExists(id, LibraryItemGraphTemplate) {\n\t\tgraph := &Graph{\n\t\t\tItem: Item{Name: template, Modified: library.Config.Origins[origin].Modified},\n\t\t\tStackMode: library.Config.Origins[origin].Templates[template].StackMode,\n\t\t}\n\n\t\tfor i, tmplStack := range library.Config.Origins[origin].Templates[template].Stacks {\n\t\t\tstack := &Stack{Name: fmt.Sprintf(\"stack%d\", i)}\n\n\t\t\tfor groupName, tmplGroup := range tmplStack.Groups {\n\t\t\t\tvar re *regexp.Regexp\n\n\t\t\t\tif filter != \"\" {\n\t\t\t\t\tre = regexp.MustCompile(strings.Replace(tmplGroup.Pattern, \"%s\", regexp.QuoteMeta(filter), 1))\n\t\t\t\t} else {\n\t\t\t\t\tre = regexp.MustCompile(tmplGroup.Pattern)\n\t\t\t\t}\n\n\t\t\t\tgroup := &OperGroup{Name: groupName, Type: tmplGroup.Type}\n\n\t\t\t\tfor metricName := range library.Catalog.Origins[origin].Sources[source].Metrics {\n\t\t\t\t\tif !re.MatchString(metricName) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tgroup.Series = append(group.Series, &Serie{\n\t\t\t\t\t\tName: metricName,\n\t\t\t\t\t\tOrigin: origin,\n\t\t\t\t\t\tSource: source,\n\t\t\t\t\t\tMetric: metricName,\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\tif len(group.Series) == 1 {\n\t\t\t\t\tgroup.Series[0].Name = group.Name\n\t\t\t\t}\n\n\t\t\t\tstack.Groups = append(stack.Groups, group)\n\t\t\t}\n\n\t\t\tgraph.Stacks = append(graph.Stacks, stack)\n\t\t}\n\n\t\tgraph.ID = id\n\t\tlibrary.TemplateGraphs[id] = graph\n\t}\n\n\treturn library.TemplateGraphs[id], nil\n}", "title": "" }, { "docid": "be0120340647bfbb9cb53c3f5451eaeb", "score": "0.42867726", "text": "func (mock TemplateCacheMock) GetByType(ctx context.Context, partnerID string, taskType string, hasNOCAccess bool) ([]models.Template, error) {\n\tfmt.Printf(\"TemplateCacheMock.GetByType method called, used RequestID: %v, partnerID: %v, taskType: %v\\n\",\n\t\ttransactionID.FromContext(ctx), partnerID, taskType)\n\n\tif isNeedError, _ := ctx.Value(IsNeedError).(bool); isNeedError {\n\t\treturn nil, errors.New(\"Cache and Scripting MS is down\")\n\t}\n\ttemplates := make([]models.Template, 0, len(mock.RepoTemplates))\n\tfor _, template := range mock.RepoTemplates[partnerID] {\n\t\tif taskType == template.Type {\n\t\t\ttemplates = append(templates, template)\n\t\t}\n\t}\n\treturn templates, nil\n}", "title": "" }, { "docid": "e142741564011917aa3612b47ffbcace", "score": "0.4271638", "text": "func (l *LegacyMigration) GetByPartner(w http.ResponseWriter, r *http.Request) {\n\tdata, err := l.uc.GetByPartner(mux.Vars(r)[partnerIDKey])\n\tif err != nil {\n\t\tl.handleError(w, r, err)\n\t\treturn\n\t}\n\tcommon.RenderJSON(w, data)\n}", "title": "" }, { "docid": "54dbfdbed603d1699a87ea4c93ac46a9", "score": "0.42432436", "text": "func (c *templateClient) Get(ctx context.Context, flavor, targetNamespace string, skipTemplateProcess bool) (Template, error) {\n\tlog := logf.Log\n\n\tif targetNamespace == \"\" {\n\t\treturn nil, errors.New(\"invalid arguments: please provide a targetNamespace\")\n\t}\n\n\tversion := c.version\n\tname := c.processor.GetTemplateName(version, flavor)\n\n\t// read the component YAML, reading the local override file if it exists, otherwise read from the provider repository\n\trawArtifact, err := getLocalOverride(&newOverrideInput{\n\t\tconfigVariablesClient: c.configVariablesClient,\n\t\tprovider: c.provider,\n\t\tversion: version,\n\t\tfilePath: name,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif rawArtifact == nil {\n\t\tlog.V(5).Info(\"Fetching\", \"File\", name, \"Provider\", c.provider.Name(), \"Type\", c.provider.Type(), \"Version\", version)\n\t\trawArtifact, err = c.repository.GetFile(ctx, version, name)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"failed to read %q from provider's repository %q\", name, c.provider.ManifestLabel())\n\t\t}\n\t} else {\n\t\tlog.V(1).Info(\"Using\", \"Override\", name, \"Provider\", c.provider.ManifestLabel(), \"Version\", version)\n\t}\n\n\treturn NewTemplate(TemplateInput{\n\t\trawArtifact,\n\t\tc.configVariablesClient,\n\t\tc.processor,\n\t\ttargetNamespace,\n\t\tskipTemplateProcess,\n\t})\n}", "title": "" }, { "docid": "0a49ee42e59b9269d1f3a8f0c3301572", "score": "0.4240654", "text": "func FindTemplate(id string) Template {\n\ttpl, ok := templates[id]\n\tif !ok {\n\t\treturn nil\n\t}\n\treturn tpl\n}", "title": "" }, { "docid": "a7f0647b905fa82f84c5c7193a973f59", "score": "0.42370063", "text": "func (r AddCustomLiveStreamSnapshotTemplateRequest) GetRegionId() string {\n return \"\"\n}", "title": "" }, { "docid": "a7f0647b905fa82f84c5c7193a973f59", "score": "0.42370063", "text": "func (r AddCustomLiveStreamSnapshotTemplateRequest) GetRegionId() string {\n return \"\"\n}", "title": "" }, { "docid": "de088821c868aeb41ebbd9d43ba22dbf", "score": "0.42354047", "text": "func (m *SearchHit) GetResultTemplateId()(*string) {\n val, err := m.GetBackingStore().Get(\"resultTemplateId\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "acb21cf5107c90f6b56ee8ad4eafea55", "score": "0.42199975", "text": "func (m *FilePlanDescriptor) GetAuthorityTemplate()(AuthorityTemplateable) {\n val, err := m.GetBackingStore().Get(\"authorityTemplate\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(AuthorityTemplateable)\n }\n return nil\n}", "title": "" }, { "docid": "196806683aa1925a347aab104497cc48", "score": "0.42171627", "text": "func (client *AFDOriginsClient) getCreateRequest(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string, options *AFDOriginsClientGetOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}\"\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 originGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter originGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{originGroupName}\", url.PathEscape(originGroupName))\n\tif originName == \"\" {\n\t\treturn nil, errors.New(\"parameter originName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{originName}\", url.PathEscape(originName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "d9e6137855d8980a0e201335eccac7fb", "score": "0.42142898", "text": "func (m *UserItemRequestBuilder) LicenseDetailsById(id string)(*i03f3617a0bebd4a3033a4ba021c004c146b37855bfeed1510a905b18d838b51e.LicenseDetailsItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"licenseDetails%2Did\"] = id\n }\n return i03f3617a0bebd4a3033a4ba021c004c146b37855bfeed1510a905b18d838b51e.NewLicenseDetailsItemRequestBuilderInternal(urlTplParams, m.requestAdapter);\n}", "title": "" }, { "docid": "3fb24aa8eb9c7b524c023c9d3976b637", "score": "0.42109373", "text": "func (client RouteTableClient) GetDetailPreparer(ctx context.Context, responseFormatType string, routeTableNo string, regionCode string) (*http.Request, error) {\n\tqueryParameters := map[string]interface{}{\n\t\t\"responseFormatType\": autorest.Encode(\"query\", responseFormatType),\n\t\t\"routeTableNo\": autorest.Encode(\"query\", routeTableNo),\n\t}\n\tif len(regionCode) > 0 {\n\t\tqueryParameters[\"regionCode\"] = autorest.Encode(\"query\", regionCode)\n\t} else {\n\t\tqueryParameters[\"regionCode\"] = autorest.Encode(\"query\", \"FKR\")\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPath(\"/vpc/v2/getRouteTableDetail\"),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "9a25d172400c1136dd3e5056d1174ffe", "score": "0.4197648", "text": "func (c *SurveyTemplateQuestionClient) Get(ctx context.Context, id int) (*SurveyTemplateQuestion, error) {\n\treturn c.Query().Where(surveytemplatequestion.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "06e86e8573478b281ebf11881cc566af", "score": "0.41976464", "text": "func GetTemplate(r *http.Request, functions template.FuncMap, templates ...string) (*template.Template, error) {\n\t// If this is a pjax request, use the minimal template to send only\n\t// the main content\n\tif r.Header.Get(\"X-PJAX\") == \"true\" {\n\t\ttemplates = append(templates, \"base_minimal\")\n\t} else {\n\t\ttemplates = append(templates, \"base_full\")\n\t}\n\n\tvar tpl *template.Template\n\n\t// For each template, add it to the the tpl variable\n\tfor i, t := range templates {\n\t\t// Get the template from the assets\n\t\tpage, err := assets.Asset(\"templates/\" + t + \".tmpl\")\n\n\t\t// Check if there is some error. If so, the template doesn't exist\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t\treturn new(template.Template), err\n\t\t}\n\n\t\t// If it's the first iteration, creates a new template and add the\n\t\t// functions map\n\t\tif i == 0 {\n\t\t\ttpl, err = template.New(t).Funcs(functions).Parse(string(page))\n\t\t} else {\n\t\t\ttpl, err = tpl.Parse(string(page))\n\t\t}\n\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t\treturn new(template.Template), err\n\t\t}\n\t}\n\n\treturn tpl, nil\n}", "title": "" }, { "docid": "4382c5c4e8cd8825bf7ddc95a9e04f83", "score": "0.4191258", "text": "func (a CommunityActionTemplatesApi) ApiCommunityactiontemplatesIdGet(id string) (*CommunityActionTemplateResource, *APIResponse, error) {\n\n\tvar localVarHttpMethod = strings.ToUpper(\"Get\")\n\t// create path and map variables\n\tlocalVarPath := a.Configuration.BasePath + \"/api/communityactiontemplates/{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(CommunityActionTemplateResource)\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: \"ApiCommunityactiontemplatesIdGet\", 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": "b11b91e58a086f0c0952b22009aaff5b", "score": "0.41553232", "text": "func (t *BikeShareWorkflowChaincode) getRideById(stub shim.ChaincodeStubInterface, creatorOrg string, creatorCertIssuer string, args []string) pb.Response {\n\tvar err error\n\n\t// Access control: Only a Provider/User Org member can invoke this transaction\n\tif !t.devMode && !(authenticateProviderOrg(creatorOrg, creatorCertIssuer) || authenticateUserOrg(creatorOrg, creatorCertIssuer)) {\n\t\treturn shim.Error(\"Caller not a member of Provider/User Org. Access denied.\")\n\t}\n\n\tif len(args) != 1 {\n\t\terr = errors.New(fmt.Sprintf(\"Incorrect number of arguments. Expecting 1: {Ride ID}. Found %d.\", len(args)))\n\t\treturn shim.Error(err.Error())\n\t}\n\n\tqueryString := fmt.Sprintf(\"{\\\"selector\\\":{\\\"docType\\\":\\\"%s\\\",\\\"id\\\":\\\"%s\\\"}}\", RIDE, args[0])\n\tqueryResponse, err := getQueryResponse(stub, queryString)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\treturn shim.Success(queryResponse)\n}", "title": "" }, { "docid": "75f799ab216cc44c42f7b2e0963c29c9", "score": "0.41510487", "text": "func getTemplateID(path, prefix string) (string, error) {\n\ttemplate := path[len(prefix):]\n\n\tif len(template) == 0 {\n\t\treturn template, errors.New(\"/detail: template is empty\")\n\t}\n\n\treturn template, nil\n}", "title": "" }, { "docid": "033b4aecf86d5282d31dd2c6b41349cb", "score": "0.41495472", "text": "func (r *roadworks) GetDetailsFor(ctx context.Context, identifier string) (*GetDetailsForRoadworkResp, error) {\n\tjsonResp := &GetDetailsForRoadworkResp{Roadwork: &Roadwork{}}\n\n\turl := baseURL + \"details/roadworks/\" + identifier\n\terr := r.api.doRequest(ctx, \"GET\", url, jsonResp.Roadwork)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn jsonResp, err\n}", "title": "" }, { "docid": "1ae6565445b40826fef9ad6c87906c62", "score": "0.4145351", "text": "func (store *BoltStorage) RetrieveObjectsWithDestinationPolicy(orgID string, received bool) ([]common.ObjectDestinationPolicy, common.SyncServiceError) {\n\tresult := make([]common.ObjectDestinationPolicy, 0)\n\tfunction := func(object boltObject) {\n\t\tif orgID == object.Meta.DestOrgID && object.Meta.DestinationPolicy != nil &&\n\t\t\t(received || !object.PolicyReceived) {\n\t\t\tresult = append(result, createObjectDestinationPolicy(object))\n\t\t}\n\t}\n\tif err := store.retrieveObjectsHelper(function); err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "79b1804c9045341a3c49dcf9769bd3c6", "score": "0.41404817", "text": "func GetProvisionRequestDetailsById(ctx context.Context, id uint) (*models.ProvisionRequestDetails, error) { return defaultDatastore().GetProvisionRequestDetailsById(ctx, id) }", "title": "" }, { "docid": "48408929ce9f538f58c66100fea18a23", "score": "0.4133692", "text": "func (r CreateZoneRequest) GetRegionId() string {\n return r.RegionId\n}", "title": "" }, { "docid": "fef6ccde5918753e8cceb2249b97e810", "score": "0.41147897", "text": "func (c *WorkOrderClient) QueryTemplate(wo *WorkOrder) *WorkOrderTemplateQuery {\n\tquery := &WorkOrderTemplateQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := wo.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(workorder.Table, workorder.FieldID, id),\n\t\t\tsqlgraph.To(workordertemplate.Table, workordertemplate.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, false, workorder.TemplateTable, workorder.TemplateColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(wo.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "title": "" }, { "docid": "a9a8341e609ff95e2316d058576c0b82", "score": "0.41055325", "text": "func (store OrganisationStore) GetDetails(id string) (org OrganisationDetails, err error) {\n\tq := expression.Key(\"id\").Equal(expression.Value(newOrganisationRecordHashKey(id)))\n\texpr, err := expression.NewBuilder().\n\t\tWithKeyCondition(q).\n\t\tBuild()\n\tif err != nil {\n\t\terr = fmt.Errorf(\"organisationStore.GetDetails: failed to build query: %v\", err)\n\t\treturn\n\t}\n\tqi := &dynamodb.QueryInput{\n\t\tTableName: store.TableName,\n\t\tKeyConditionExpression: expr.KeyCondition(),\n\t\tExpressionAttributeValues: expr.Values(),\n\t\tFilterExpression: expr.Filter(),\n\t\tExpressionAttributeNames: expr.Names(),\n\t\tConsistentRead: aws.Bool(true),\n\t}\n\n\tvar items []map[string]*dynamodb.AttributeValue\n\tpage := func(page *dynamodb.QueryOutput, lastPage bool) bool {\n\t\titems = append(items, page.Items...)\n\t\treturn true\n\t}\n\terr = store.Client.QueryPages(qi, page)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"organisationStore.GetDetails: failed to query pages: %v\", err)\n\t\treturn\n\t}\n\n\torg, err = newOrganisationDetailsFromRecords(items)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"organisationStore.GetDetails: failed to create OrganisationDetails: %w\", err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "b0ab53e7580be2fb85defbbf52e5143c", "score": "0.41039357", "text": "func (client *AFDOriginsClient) listByOriginGroupCreateRequest(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, options *AFDOriginsClientListByOriginGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins\"\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 originGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter originGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{originGroupName}\", url.PathEscape(originGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "416378b7a3c71d000c0bad5837eb9b8d", "score": "0.41017118", "text": "func GetTrainsFromTripHandler(w http.ResponseWriter, r *http.Request) {\r\n\tparams := mux.Vars(r)\r\n\r\n\ttripID, err := uuid.FromString(params[\"id\"])\r\n\tif err != nil {\r\n\t\tcommon.SendBadRequest(w, r, \"ERROR: Wrong trip ID (can't convert string to uuid)\", err)\r\n\t\treturn\r\n\t}\r\n\r\n\ttrains, err := entity.GetFromTrip(tripID, entity.Train{})\r\n\tif err != nil {\r\n\t\tcommon.SendNotFound(w, r, \"ERROR: Can't get trains by trip ID\", err)\r\n\t\treturn\r\n\t}\r\n\r\n\tcommon.RenderJSON(w, r, trains)\r\n}", "title": "" }, { "docid": "3567f797f7528e00a9ef07266fcad0d1", "score": "0.40951282", "text": "func (s RequestStorage) GetByID(ormer orm.Ormer, id int64) (result models.Request, err error) {\n\terr = ormer.QueryTable(new(models.Request)).Filter(\"id\", id).RelatedSel().One(&result)\n\treturn\n}", "title": "" }, { "docid": "92c6a4c54166c3e10cea2760b2d70d24", "score": "0.40851384", "text": "func (e *Extracarricular) GetTemplate() string {\n\treturn `\n\\cventry{<.From> \\\\-- <.To>}{<.Title>}{<.Company>}{}{}{\n\t\\textcolor{dark_gray}{\\textit{<range $index, $element := .Subtitle><if $index>,<end> <.><end>}}\n\t\\begin{itemize}\n\t\t<range .Points>\\item <.><end>\n\t\\end{itemize}\n}\n`\n}", "title": "" }, { "docid": "53025a2fa0a80c889f1f5b4fc6dd1930", "score": "0.408284", "text": "func GetSourceIndividual(e ld.Entity) interface{} { return e.Get(Prop_SourceIndividual.ID) }", "title": "" }, { "docid": "0f7ec338ae830379c5767f57bbc7016f", "score": "0.4072215", "text": "func (r *TestContext) TestGetTemplate(t *testing.T) {\n\tresult, err := r.Repo.GetTemplate(Data.T01.Id)\n\tassertEquals(t, \"Unexpected error. Expected: %v; Actual: %v\", nil, err)\n\tassertEquals(t, \"Unexpected result. Expected: %v; Actual: %v\", Data.T01.Id, result.Id)\n}", "title": "" }, { "docid": "30b0373a9939690c62102b7453fc1167", "score": "0.40603912", "text": "func GetDetail(client *gophercloud.ServiceClient, tenantID string) (r GetDetailResult) {\n\tresp, err := client.Get(getDetailURL(client, tenantID), &r.Body, nil)\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "title": "" }, { "docid": "5668d10f479932cd3cb19b678878e2f4", "score": "0.4059262", "text": "func (s *Service) Details(accountID string) (*DetailsResponse, error) {\n\tu, err := url.Parse(s.host + detailsURL + accountID)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Could not parse URL\")\n\t}\n\tresult := &DetailsResponse{}\n\terr = helpers.Get(s.Client, u, s.token, result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "75aa971c7600b25349dfca1098e842d7", "score": "0.40528947", "text": "func (s *handler) GetTollTicketDetails(ctx context.Context, ticket *TicketToll) (*TicketToll, error) {\n\n\t// building the filter using ticketId provided for the findOne query\n\tfilter := newTicketFilter(ticket).setTicketIDFilter().getFilter()\n\tdbTicket := &TicketToll{}\n\n\t// necessary input for querying mongoDB\n\tdbParams := db.Params{\n\t\tDatabase: TollDatabaseName,\n\t\tCollection: TicketCollectionName,\n\t\tFilter: filter,\n\t\tResult: dbTicket,\n\t}\n\n\t// checking if the provided ticketId exists or not.\n\tif err := s.AppCtx.DbClient.FindOne(ctx, dbParams); err != nil {\n\t\tlog.Error(err)\n\t\treturn nil, errors.ToTollError(err)\n\t}\n\treturn dbTicket, nil\n}", "title": "" }, { "docid": "51a640a3d8aa2e7f33e4c5e050fde714", "score": "0.40446", "text": "func GetTemplateMetadata(catalogID string, templateID string) (model.Template, bool) {\n\tcat, ok := CatalogsCollection[catalogID]\n\tif !ok {\n\t\treturn model.Template{}, ok\n\t}\n\ttemplate, ok := cat.metadata[catalogID+\"/\"+templateID]\n\treturn template, ok\n}", "title": "" }, { "docid": "84d47444e0c575f523ea2f11abc431d8", "score": "0.40318805", "text": "func (c *ProjectClient) QueryTemplate(pr *Project) *ProjectTemplateQuery {\n\tquery := &ProjectTemplateQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pr.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(project.Table, project.FieldID, id),\n\t\t\tsqlgraph.To(projecttemplate.Table, projecttemplate.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, false, project.TemplateTable, project.TemplateColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pr.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "title": "" }, { "docid": "308fb0cf92697f5c5d0e780431213808", "score": "0.40224037", "text": "func (r UpdateTranscodeTemplateGroupRequest) GetRegionId() string {\n return \"\"\n}", "title": "" }, { "docid": "1083d520f30227c7113d76baa0cd4f5f", "score": "0.40207714", "text": "func (as *Server) Template(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tid, _ := strconv.ParseInt(vars[\"id\"], 0, 64)\n\tt, err := models.GetTemplate(id, ctx.Get(r, \"user_id\").(int64))\n\tif err != nil {\n\t\tJSONResponse(w, models.Response{Success: false, Message: \"Template not found\"}, http.StatusNotFound)\n\t\treturn\n\t}\n\tswitch {\n\tcase r.Method == \"GET\":\n\t\tJSONResponse(w, t, http.StatusOK)\n\tcase r.Method == \"DELETE\":\n\t\terr = models.DeleteTemplate(id, ctx.Get(r, \"user_id\").(int64))\n\t\tif err != nil {\n\t\t\tJSONResponse(w, models.Response{Success: false, Message: \"Error deleting template\"}, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tJSONResponse(w, models.Response{Success: true, Message: \"Template deleted successfully!\"}, http.StatusOK)\n\tcase r.Method == \"PUT\":\n\t\tt = models.Template{}\n\t\terr = json.NewDecoder(r.Body).Decode(&t)\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t}\n\t\tif t.Id != id {\n\t\t\tJSONResponse(w, models.Response{Success: false, Message: \"Error: /:id and template_id mismatch\"}, http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tt.ModifiedDate = time.Now().UTC()\n\t\tt.UserId = ctx.Get(r, \"user_id\").(int64)\n\t\terr = models.PutTemplate(&t)\n\t\tif err != nil {\n\t\t\tJSONResponse(w, models.Response{Success: false, Message: err.Error()}, http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tJSONResponse(w, t, http.StatusOK)\n\t}\n}", "title": "" }, { "docid": "0440b007ea07e733f8c8800506fb2283", "score": "0.4014584", "text": "func (cache *templateCache) get(adID string) ([]integration.Config, error) {\n\tcache.m.RLock()\n\tdefer cache.m.RUnlock()\n\n\t// do we know the identifier?\n\tif digests, found := cache.adIDToDigests[adID]; found {\n\t\ttemplates := []integration.Config{}\n\t\tfor _, digest := range digests {\n\t\t\ttemplates = append(templates, cache.digestToTemplate[digest])\n\t\t}\n\t\treturn templates, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"AD id %s not found in cache\", adID)\n}", "title": "" }, { "docid": "dd32ed18930854c54522546d4b3ad137", "score": "0.400562", "text": "func GetExperimentFromTemplate(r *v1alpha1.Rollout, stableRS, newRS *appsv1.ReplicaSet) (*v1alpha1.Experiment, error) {\n\tstep := replicasetutil.GetCurrentExperimentStep(r)\n\tif step == nil {\n\t\treturn nil, nil\n\t}\n\tpodHash := hash.ComputePodTemplateHash(&r.Spec.Template, r.Status.CollisionCount)\n\tcurrentStep := int32(0)\n\tif r.Status.CurrentStepIndex != nil {\n\t\tcurrentStep = *r.Status.CurrentStepIndex\n\t}\n\trevision := \"\"\n\tif r.Annotations != nil {\n\t\trevision = r.Annotations[annotations.RevisionAnnotation]\n\t}\n\texperiment := &v1alpha1.Experiment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: fmt.Sprintf(\"%s-%s-%s-%d\", r.Name, podHash, revision, currentStep),\n\t\t\tNamespace: r.Namespace,\n\t\t\tOwnerReferences: []metav1.OwnerReference{*metav1.NewControllerRef(r, controllerKind)},\n\t\t\tLabels: map[string]string{\n\t\t\t\tv1alpha1.DefaultRolloutUniqueLabelKey: podHash,\n\t\t\t},\n\t\t\tAnnotations: map[string]string{\n\t\t\t\tannotations.RevisionAnnotation: revision,\n\t\t\t},\n\t\t},\n\t\tSpec: v1alpha1.ExperimentSpec{\n\t\t\tDuration: step.Duration,\n\t\t\tProgressDeadlineSeconds: r.Spec.ProgressDeadlineSeconds,\n\t\t},\n\t}\n\n\tinstanceID := analysisutil.GetInstanceID(r)\n\tif instanceID != \"\" {\n\t\texperiment.Labels[v1alpha1.LabelKeyControllerInstanceID] = instanceID\n\t}\n\n\tfor i := range step.Templates {\n\t\ttemplateStep := step.Templates[i]\n\t\ttemplate := v1alpha1.TemplateSpec{\n\t\t\tName: templateStep.Name,\n\t\t\tReplicas: templateStep.Replicas,\n\t\t}\n\t\tif templateStep.Weight != nil || templateStep.Service != nil {\n\t\t\ttemplate.Service = &v1alpha1.TemplateService{}\n\t\t\t// Need to check if Service is not nil for the case where Weight is not nil and Service is\n\t\t\tif templateStep.Service != nil && templateStep.Service.Name != \"\" {\n\t\t\t\ttemplate.Service.Name = templateStep.Service.Name\n\t\t\t}\n\t\t}\n\t\ttemplateRS := &appsv1.ReplicaSet{}\n\t\tswitch templateStep.SpecRef {\n\t\tcase v1alpha1.CanarySpecRef:\n\t\t\ttemplateRS = newRS.DeepCopy()\n\t\tcase v1alpha1.StableSpecRef:\n\t\t\ttemplateRS = stableRS.DeepCopy()\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"Invalid template step SpecRef: must be canary or stable\")\n\t\t}\n\t\ttemplate.Template = templateRS.Spec.Template\n\t\ttemplate.MinReadySeconds = templateRS.Spec.MinReadySeconds\n\n\t\tif templateStep.Selector != nil {\n\t\t\ttemplate.Selector = templateStep.Selector.DeepCopy()\n\t\t} else {\n\t\t\ttemplate.Selector = templateRS.Spec.Selector.DeepCopy()\n\t\t}\n\n\t\tif templateStep.Metadata.Labels != nil {\n\t\t\tif template.Template.ObjectMeta.Labels == nil {\n\t\t\t\ttemplate.Template.ObjectMeta.Labels = make(map[string]string)\n\t\t\t}\n\t\t\tfor key := range templateStep.Metadata.Labels {\n\t\t\t\ttemplate.Template.ObjectMeta.Labels[key] = templateStep.Metadata.Labels[key]\n\t\t\t\ttemplate.Selector.MatchLabels[key] = templateStep.Metadata.Labels[key]\n\t\t\t}\n\t\t}\n\t\tif templateStep.Metadata.Annotations != nil {\n\t\t\tif template.Template.ObjectMeta.Annotations == nil {\n\t\t\t\ttemplate.Template.ObjectMeta.Annotations = make(map[string]string)\n\t\t\t}\n\n\t\t\tfor key := range templateStep.Metadata.Annotations {\n\t\t\t\ttemplate.Template.ObjectMeta.Annotations[key] = templateStep.Metadata.Annotations[key]\n\t\t\t}\n\t\t}\n\t\texperiment.Spec.Templates = append(experiment.Spec.Templates, template)\n\t}\n\tfor i := range step.Analyses {\n\t\tanalysis := step.Analyses[i]\n\t\targs, err := analysisutil.BuildArgumentsForRolloutAnalysisRun(analysis.Args, stableRS, newRS, r)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tanalysisTemplate := v1alpha1.ExperimentAnalysisTemplateRef{\n\t\t\tName: analysis.Name,\n\t\t\tTemplateName: analysis.TemplateName,\n\t\t\tClusterScope: analysis.ClusterScope,\n\t\t\tArgs: args,\n\t\t\tRequiredForCompletion: analysis.RequiredForCompletion,\n\t\t}\n\t\texperiment.Spec.Analyses = append(experiment.Spec.Analyses, analysisTemplate)\n\t}\n\n\treturn experiment, nil\n}", "title": "" }, { "docid": "adb6093ac5528350f6b47c1a3aa431c5", "score": "0.40051237", "text": "func Get(ctx context.Context, client *v1.ServiceClient, domainID, recordID int) (*View, *v1.ResponseResult, error) {\n\turl := strings.Join([]string{\n\t\tclient.Endpoint,\n\t\tstrconv.Itoa(domainID),\n\t\tv1.RecordsEndpoint,\n\t\tstrconv.Itoa(recordID)}, \"/\")\n\tresponseResult, err := client.DoRequest(ctx, http.MethodGet, url, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif responseResult.Err != nil {\n\t\treturn nil, responseResult, responseResult.Err\n\t}\n\n\t// Extract a single record from the response body.\n\trecord := &View{}\n\terr = responseResult.ExtractResult(record)\n\tif err != nil {\n\t\treturn nil, responseResult, err\n\t}\n\n\treturn record, responseResult, nil\n}", "title": "" }, { "docid": "d382e00f3f7d3b6b2f18b879df2e2cf8", "score": "0.40050843", "text": "func (s stack) InspectTemplate(id string) (_ abstract.HostTemplate, xerr fail.Error) {\n\tnullAHT := abstract.HostTemplate{}\n\tif s.IsNull() {\n\t\treturn nullAHT, fail.InvalidInstanceError()\n\t}\n\tif id == \"\" {\n\t\treturn nullAHT, fail.InvalidParameterError(\"id\", \"cannot be empty string\")\n\t}\n\n\ttracer := debug.NewTracer(nil, true /*tracing.ShouldTrace(\"stacks.compute\") || tracing.ShouldTrace(\"stack.outscale\")*/, \"(%s)\", id).WithStopwatch().Entering()\n\tdefer tracer.Exiting()\n\n\treturn s.parseTemplateID(id)\n}", "title": "" }, { "docid": "1c08334d3b53146f231177f0ac0a75a8", "score": "0.40050715", "text": "func Get(client *gophercloud.ServiceClient, transferRequestID string) (r GetResult) {\n\tresp, err := client.Get(resourceURL(client, transferRequestID), &r.Body, nil)\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "title": "" }, { "docid": "0f53e10144d97731e899625f95527c95", "score": "0.40041178", "text": "func (z *zones) GetZoneByProviderID(ctx context.Context, providerID string) (cloudprovider.Zone, error) {\n\tid, err := serverIDFromProviderID(providerID)\n\tif err != nil {\n\t\treturn cloudprovider.Zone{}, err\n\t}\n\n\ts, err := z.gclient.Server.Get(ctx, id)\n\tif err != nil {\n\t\treturn cloudprovider.Zone{}, err\n\t}\n\n\treturn cloudprovider.Zone{\n\t\tRegion: z.region,\n\t\tFailureDomain: s.AvailabilityZone}, nil\n}", "title": "" }, { "docid": "8c65320d1e31b6108940062dcf85c469", "score": "0.3999384", "text": "func (m *ServicePrincipal) GetApplicationTemplateId()(*string) {\n return m.applicationTemplateId\n}", "title": "" }, { "docid": "7a2ffea40910183e85939761d876b221", "score": "0.399644", "text": "func (r ModifyDomainTempInstRequest) GetRegionId() string {\n return \"\"\n}", "title": "" }, { "docid": "f6a4b1a8a7a362c27314765ca5547aec", "score": "0.39946118", "text": "func LoadInstancesByTemplateIDAndProjectIDs(ctx context.Context, db gorp.SqlExecutor, templateID int64, projectIDs []int64, opts ...LoadInstanceOptionFunc) ([]sdk.WorkflowTemplateInstance, error) {\n\tquery := gorpmapping.NewQuery(`\n SELECT *\n FROM workflow_template_instance\n WHERE workflow_template_id = $1 AND project_id = ANY(string_to_array($2, ',')::int[])\n `).Args(templateID, gorpmapping.IDsToQueryString(projectIDs))\n\treturn getInstances(ctx, db, query, opts...)\n}", "title": "" }, { "docid": "a2208fe8be391dc88dd2853452c76ed7", "score": "0.39916816", "text": "func TraceIDExtractor(ctx context.Context, r *http.Request) context.Context {\n\ttraceID := r.Header.Get(traceIDHeader)\n\tif traceID != \"\" {\n\t\treturn ctxWithTraceID(ctx, traceID)\n\t}\n\treturn ctxWithTraceID(ctx, utils.GenRandomString(traceIDLen))\n}", "title": "" }, { "docid": "4f7fec044084bfd6c56b116142ed6dd1", "score": "0.39764363", "text": "func (a *TradesApiService) FindTradeById(ctx context.Context, id int64) (Trade, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Get\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue Trade\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/trades/{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\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v Trade\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 == 0 {\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\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": "bcc70f75058122934a68e6ba024d4519", "score": "0.39710528", "text": "func (t *SimpleChaincode) GetWorkFlowTemplate(stub *shim.ChaincodeStub, workflowId string) ([]byte, error) {\n\t//workflowId := args[0]\n\t//TODO: call workflowTemplate chaincode to get template by workflowId.\n\t//TODO: should return a marshalled WorkFlowIO\n\t//TODO: wfIOBytes := querychaincode\n\tvar contractState ContractState\n\tvar wfIO WorkflowIO\n\tvar wfIOBytes []byte\n\tcontractStateJSON, err := stub.GetState(WORKFLOW_TEMPLATE_KEY)\n\tif err != nil {\n\t\treturn nil, errors.New(\"Unable to fetch container and compliance contract keys\")\n\t}\n\terr = json.Unmarshal(contractStateJSON, &contractState)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tworkflowTemplateChaincode := contractState.WorkflowTemplateCC\n\n\t//TODO: check with Sayandeep on what function to query\n\tfunction := \"query\" //\n\targs := []string{workflowId}\n\twfIOBytes,err = stub.QueryChaincode(workflowTemplateChaincode, function, args)\n\tif err != nil {\n\t\treturn nil, errors.New(\"workflowTemplate: Error in querying from workflow template chaincode\")\n\t} else {\n\t\terr = json.Unmarshal(wfIOBytes, &wfIO)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\treturn wfIOBytes, nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "eafe881b8aa827a38a05cc8fd3c6274d", "score": "0.39706716", "text": "func InitDomainDetails(domainID string) (Request, error) {\n\turl, err := url.Parse(fmt.Sprintf(requestDomainDetails, domainID))\n\tif err != nil {\n\t\treturn Request{}, err\n\t}\n\trequest := Request{\n\t\tMethod: http.MethodGet,\n\t\tURL: *url,\n\t\tActionType: ActionTypeDomainDetails,\n\t\tOperation: nil,\n\t}\n\treturn request, nil\n}", "title": "" }, { "docid": "ba1e41c9ddbbd2e50764c7cc430867ca", "score": "0.39652827", "text": "func (a *App) getProject(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 project ID\")\n\t\treturn\n\t}\n\n\tp := models.Project{ID: id}\n\tif err := p.GetProject(a.DB); err != nil {\n\t\tswitch err {\n\t\tcase sql.ErrNoRows:\n\t\t\trespondWithError(w, http.StatusNotFound, \"Project not found\")\n\t\tdefault:\n\t\t\trespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\t}\n\t\treturn\n\t}\n\n\tdata := struct {\n\t\tTitle string\n\t\tObject models.Project\n\t\tActive string\n\t\tHeaderTitle string\n\t\tUserRole string\n\t}{\n\t\tTitle: \"Project Details\",\n\t\tObject: models.Project{\n\t\t\tID: p.ID,\n\t\t\tCustID: p.CustID,\n\t\t\tName: p.Name,\n\t\t\tStartDate: p.StartDate,\n\t\t\tHours: p.Hours,\n\t\t},\n\t\tActive: \"Project\",\n\t\tHeaderTitle: \"Project\",\n\t\tUserRole: a.getUserRole(r),\n\t}\n\n\tgetTemplate(w, r, \"viewProject\", data)\n}", "title": "" }, { "docid": "9632387fcf779a3a987f2bba92e44196", "score": "0.396343", "text": "func (orderH *ShipperOrderHTTPhandler) GetByID(c echo.Context) error {\n\texample, err := orderH.shipperorderrepo.GetByID(2)\n\tif err != nil {\n\t\treturn c.String(http.StatusInternalServerError, err.Error())\n\t}\n\treturn c.JSON(http.StatusOK, example)\n}", "title": "" }, { "docid": "ac5454d2143ee230a49fbc943bb7dab3", "score": "0.3953219", "text": "func TestTplGet(t *testing.T) {\n\troutes := SetUpGin()\n\tConvey(\"test get info of template\", t, func() {\n\t\tvar (\n\t\t\tw *httptest.ResponseRecorder\n\t\t\tr *http.Request\n\t\t)\n\t\tConvey(\"get template list\", func() {\n\t\t\tw, r = NewTestContextWithDefaultSession(\"GET\", \"/api/v1/template\", nil)\n\t\t\troutes.ServeHTTP(w, r)\n\t\t\trespBody := w.Body.String()\n\t\t\tLCheck := gjson.Get(respBody, \"templates.#.template\")\n\t\t\tSo(len(LCheck.Array()), ShouldBeGreaterThan, 2)\n\t\t\tSo(w.Code, ShouldEqual, 200)\n\t\t\tCleanSession(r)\n\t\t\tConvey(\"test template get id\", func() {\n\t\t\t\tTid := gjson.Get(respBody, \"templates.1.template.id\")\n\t\t\t\turi := \"/api/v1/template/\" + Tid.String()\n\t\t\t\tw, r = NewTestContextWithDefaultSession(\"GET\", uri, nil)\n\t\t\t\troutes.ServeHTTP(w, r)\n\t\t\t\trespBody := w.Body.String()\n\t\t\t\tRCheck := gjson.Get(respBody, \"template.id\")\n\t\t\t\tSo(RCheck.String(), ShouldEqual, Tid.String())\n\t\t\t\tSo(w.Code, ShouldEqual, 200)\n\t\t\t})\n\t\t})\n\t})\n}", "title": "" }, { "docid": "7e7866359c6cfdf9ee78bcafc407a406", "score": "0.39529592", "text": "func SrcHandler(w http.ResponseWriter, r *http.Request) {\n vars := mux.Vars(r)\n fmt.Fprint(w, GetSource(vars[\"id\"]))\n}", "title": "" }, { "docid": "4256ea32ff07f275a0bc4082fa498129", "score": "0.39527413", "text": "func LoadInstanceByWorkflowID(ctx context.Context, db gorp.SqlExecutor, workflowID int64, opts ...LoadInstanceOptionFunc) (*sdk.WorkflowTemplateInstance, error) {\n\tquery := gorpmapping.NewQuery(`\n SELECT *\n FROM workflow_template_instance\n WHERE workflow_id = $1\n `).Args(workflowID)\n\treturn getInstance(ctx, db, query, opts...)\n}", "title": "" }, { "docid": "557e1ff648c6bf03f470ff3a494c99b0", "score": "0.3951795", "text": "func (source *Source) ByIdentifier(identifier interface{}) (Credential, error) {\n\treturn source.broker.ByIdentifier(identifier, source.template)\n}", "title": "" }, { "docid": "ff57a3cd7ebdc83ce6a202453ed7e58a", "score": "0.39505708", "text": "func GetTectonicTemplate(uri string) ([]byte, error) {\n\treturn getFileContents(path.Join(tectonicDataDir, uri))\n}", "title": "" }, { "docid": "9c75bef14d2ee5489392035b2f63015a", "score": "0.3948669", "text": "func (r DescribeCustomLiveStreamQualityDetectionTemplatesRequest) GetRegionId() string {\n return \"\"\n}", "title": "" }, { "docid": "7d6ae6e4dea44a300fbf92abe2e71cc4", "score": "0.39456338", "text": "func (db *ItemDB) GetInZone(id int, zone int) (item Item, ok bool) {\n\t// db.log.Printf(\"Getting item %d\", id)\n\titem, ok = db.items[id]\n\tok = ok && item.CurrentZone == zone\n\treturn\n}", "title": "" }, { "docid": "f907f018f7b953d850792adc0695be50", "score": "0.39441335", "text": "func (cc *CRUD) getTravelLogById(stub shim.ChaincodeStubInterface, args []string) peer.Response {\n\n\tif msg, err := stub.GetState(\"travelLog\" + args[0]); err == nil && msg != nil {\n\t\treturn Success(http.StatusOK, \"OK\", msg)\n\t} else {\n\t\treturn Error(http.StatusNotFound, \"TravelLog Not Found\")\n\t}\n\n}", "title": "" }, { "docid": "8ece680f4f28f0a6ceadf81e6fe71cd1", "score": "0.39428592", "text": "func (s *Set) getTemplate(name string) (template *Template, ok bool) {\n\tif s.developmentMode {\n\t\ttemplate, _ = s.GetTemplate(name)\n\t\tok = template != nil\n\t\treturn\n\t}\n\ts.tmx.RLock()\n\ttemplate, ok = s.templates[name]\n\ts.tmx.RUnlock()\n\treturn\n}", "title": "" }, { "docid": "2a7d03d1da2f98ff0088206f0892298b", "score": "0.39413092", "text": "func (a *ZonesApiService) ZonesGetById(ctx context.Context, zoneId string) (ResponseZoneInfo, *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 ResponseZoneInfo\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/zones/{zoneId}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"zoneId\"+\"}\", fmt.Sprintf(\"%v\", zoneId), -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{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\tif err == nil {\n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v ResponseZoneInfo\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": "640f766f9cfb6e71d0ebeec94e210c0a", "score": "0.39397472", "text": "func (t *OpenconfigSystem_System_Ntp_NtpKeys) GetOrCreateNtpKey(KeyId uint16) *OpenconfigSystem_System_Ntp_NtpKeys_NtpKey {\n\n\tkey := KeyId\n\n\tif v, ok := t.NtpKey[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewNtpKey(KeyId)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateNtpKey got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "640f766f9cfb6e71d0ebeec94e210c0a", "score": "0.39389732", "text": "func (t *OpenconfigSystem_System_Ntp_NtpKeys) GetOrCreateNtpKey(KeyId uint16) *OpenconfigSystem_System_Ntp_NtpKeys_NtpKey {\n\n\tkey := KeyId\n\n\tif v, ok := t.NtpKey[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewNtpKey(KeyId)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateNtpKey got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "6791fc02013d3bc80bcf7aefe744b222", "score": "0.39327598", "text": "func Template(ctx context.Context, c *gin.Context) {\n\twhat := c.Param(\"what\")\n\n\tswitch what {\n\tcase \"sample-tile\":\n\t\ttileUrl := fmt.Sprintf(\"https://%s.s3-%s.amazonaws.com/tile/%s/%s/%s.tgz\",\n\t\t\tengine.DiceConfig.BucketName,\n\t\t\tengine.DiceConfig.Region,\n\t\t\t\"sample-tile\",\n\t\t\t\"0.1.0\",\n\t\t\t\"sample-tile\")\n\t\tc.String(http.StatusOK, tileUrl)\n\tcase \"tile\":\n\t\ttileType := c.Query(\"type\")\n\t\ttileUrl := fmt.Sprintf(\"https://%s.s3-%s.amazonaws.com/tile/%s/%s-tile.tgz\",\n\t\t\tengine.DiceConfig.BucketName,\n\t\t\tengine.DiceConfig.Region,\n\t\t\t\"tile\",\n\t\t\ttileType)\n\t\tc.String(http.StatusOK, tileUrl)\n\tcase \"deployment\":\n\t\tc.String(http.StatusOK, \"not ready yet\")\n\tcase \"hu\":\n\t\tc.String(http.StatusOK, \"not ready yet\")\n\tcase \"super\":\n\t\tc.String(http.StatusOK, \"not ready yet\")\n\t}\n}", "title": "" }, { "docid": "2f32ba8cb479decd8037858bb9cf32c5", "score": "0.39303976", "text": "func (r *ClusterTopologyReconciler) getTemplate(ctx context.Context, ref *corev1.ObjectReference) (*unstructured.Unstructured, error) {\n\tif ref == nil {\n\t\treturn nil, errors.New(\"reference is not set\")\n\t}\n\tif err := utilconversion.ConvertReferenceAPIContract(ctx, r.Client, r.restConfig, ref); err != nil {\n\t\treturn nil, err\n\t}\n\n\tobj, err := external.Get(ctx, r.UnstructuredCachingClient, ref, ref.Namespace)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to retrieve %s %q in namespace %q\", ref.Kind, ref.Name, ref.Namespace)\n\t}\n\treturn obj, nil\n}", "title": "" }, { "docid": "0691fbdacef2775585c3ed5edc581cde", "score": "0.39285192", "text": "func GetMeetingDetailsFromID(meetingSvc meeting.Service) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tmessage := make(map[string]interface{})\n\n\t\tif r.Method != \"GET\" {\n\t\t\tmessage[\"message\"] = \"Requested URL not found, please check method of request and URL\"\n\t\t\tviews.SendResponse(w, http.StatusNotFound, \"An error occurred\", message)\n\t\t\treturn\n\t\t}\n\n\t\turi := r.URL.RequestURI()\n\t\tidx := strings.LastIndex(uri, \"/\")\n\t\tuid, err := strconv.Atoi(uri[idx+1:])\n\t\tif err != nil {\n\t\t\tmessage[\"message\"] = \"An error occurred\"\n\t\t\tviews.SendResponse(w, http.StatusBadRequest, pkg.ErrWrongFormat.Error(), message)\n\t\t\treturn\n\t\t}\n\n\t\tres, err := meetingSvc.GetMeetingDetailsFromId(uid)\n\t\tif err != nil {\n\t\t\tmessage[\"message\"] = err.Error()\n\t\t\tviews.SendResponse(w, http.StatusNotFound, \"An error occurred\", message)\n\t\t\treturn\n\t\t}\n\n\t\tmessage[\"meeting\"] = res\n\t\tviews.SendResponse(w, http.StatusOK, \"\", message)\n\t}\n}", "title": "" }, { "docid": "ca66d69282a2b9ca0d45cb7e1f834fb9", "score": "0.3926715", "text": "func (m *ServiceHealthIssue) GetOrigin()(*ServiceHealthOrigin) {\n return m.origin\n}", "title": "" } ]
a4097f75650e93a7c81671c1e1ca6702
The name which should be used for this Machine Learning Compute Cluster. Changing this forces a new Machine Learning Compute Cluster to be created.
[ { "docid": "c7b44a95b1290b4a2caf07de690711d9", "score": "0.7258909", "text": "func (o ComputeClusterOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ComputeCluster) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "title": "" } ]
[ { "docid": "b56cffad13606c226df9dd937c7258b9", "score": "0.7645341", "text": "func (c *Cluster) Name() string {\n\treturn cast.ToString(c.config.Get(\"cluster.name\"))\n}", "title": "" }, { "docid": "aa1366cdb83412839c667fc9db19b97c", "score": "0.72898626", "text": "func (s StoreCertificatesInCluster) Name() string {\n\treturn \"Store Certificates in Cluster\"\n}", "title": "" }, { "docid": "c5a8ddd7cda47e7250ad9699d752fff3", "score": "0.72328585", "text": "func (c *Cluster) Name() string {\n\treturn c.spec.Cluster.Name\n}", "title": "" }, { "docid": "6148d46dfa7e8168763ce7f89983c61e", "score": "0.7143883", "text": "func (o *Cluster) Name() string {\n\tif o != nil && o.bitmap_&64 != 0 {\n\t\treturn o.name\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "292dbd2d1d55b9e6f811c037e4b1a171", "score": "0.712819", "text": "func (c *Cluster) Name() string {\n\treturn c.opts.Name\n}", "title": "" }, { "docid": "74412167d23700351e8179537bc5e52f", "score": "0.7102837", "text": "func ClusterName() string {\n\treturn MustGet(\"CLUSTER_NAME\")\n}", "title": "" }, { "docid": "6f6174700441b92291cc79d18ee356d5", "score": "0.7036227", "text": "func ClusterName() (string, error) {\n\treturn metadata.InstanceAttributeValue(\"cluster-name\")\n}", "title": "" }, { "docid": "229ef14d47bf255353ff0900e929687c", "score": "0.7000922", "text": "func (op *CreateAwsClusterOperation) Name() string {\n\treturn op.lro.Name()\n}", "title": "" }, { "docid": "7ca6e7d3aca916e422e471256b0886f4", "score": "0.693732", "text": "func (c Topology) Name() string {\n\treturn c.ClusterName\n}", "title": "" }, { "docid": "b630e2b98095460bbe157320f50c7ca8", "score": "0.69337344", "text": "func (o DatastoreClusterOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *DatastoreCluster) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "039b6cfd4bcecb2f802d9776f0927c1f", "score": "0.6919164", "text": "func Name(cluster string, suffix Purpose) string {\n\treturn fmt.Sprintf(\"%s-%s\", cluster, suffix)\n}", "title": "" }, { "docid": "3c2342335a9cef198ddb389919f657c7", "score": "0.6906511", "text": "func (o AwsClusterOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *AwsCluster) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "73f9c3d6170b3bdfb5e95c2155d9bb11", "score": "0.6840457", "text": "func (ss storageService) ClusterName() (name string, err error) {\n\tresp, err := ss.jolokiaClient.ReadString(storageServicePath + \"/ClusterName\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn resp.Value, nil\n}", "title": "" }, { "docid": "4af785c1e7aa361ad808dc95879bae15", "score": "0.67945904", "text": "func (o VirtualClusterOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *VirtualCluster) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "04c49044098aaa4d954f2c2ab14d8083", "score": "0.6698074", "text": "func (o ClusterOutput) ClusterName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Cluster) pulumi.StringOutput { return v.ClusterName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c560ed1dcaf78a45955edf73cdabb3e6", "score": "0.6662668", "text": "func (c *Cluster) GetName() string {\n\treturn c.Name\n}", "title": "" }, { "docid": "1bc5df8d4f92d74646325121970baeeb", "score": "0.6661966", "text": "func (c *ServiceControlCluster) GetName() string {\n\treturn ServiceControlClusterName\n}", "title": "" }, { "docid": "cf617ba75d3631c15afbdd8b431a2cb4", "score": "0.66325563", "text": "func (op *UpdateAwsClusterOperation) Name() string {\n\treturn op.lro.Name()\n}", "title": "" }, { "docid": "392acc68c093c57ef7056a336d33c005", "score": "0.6622203", "text": "func (s *ManagedControlPlaneScope) Name() string {\n\treturn s.Cluster.Name\n}", "title": "" }, { "docid": "1e2e4d480e6add07f0d93ad8cf9652ed", "score": "0.6620824", "text": "func (o ClusterOutput) ClusterName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Cluster) pulumi.StringPtrOutput { return v.ClusterName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "1e2e4d480e6add07f0d93ad8cf9652ed", "score": "0.6620824", "text": "func (o ClusterOutput) ClusterName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Cluster) pulumi.StringPtrOutput { return v.ClusterName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "37ef9ed869ccd180e715237023734e80", "score": "0.6578243", "text": "func (op *DeleteAwsClusterOperation) Name() string {\n\treturn op.lro.Name()\n}", "title": "" }, { "docid": "0a16ac7fbbe33e71269b30d8b7bd85c3", "score": "0.6558596", "text": "func Name(kuber kube.Kuber) (string, error) {\n\tcontext, err := Context(kuber)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif context == nil {\n\t\treturn \"\", errors.New(\"kube context was nil\")\n\t}\n\t// context.Cluster will likely be in the form gke_<accountName>_<region>_<clustername>\n\t// Trim off the crud from the beginning context.Cluster\n\treturn SimplifiedClusterName(context.Cluster), nil\n}", "title": "" }, { "docid": "2f1c0c2866cb593fccce85887a5efc2b", "score": "0.65384907", "text": "func (o ClusterTemplateOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ClusterTemplate) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "794a8c18776b6ff794c08a468a42dbdd", "score": "0.6479367", "text": "func (proxy *ProxyClient) ClusterName() string {\n\treturn proxy.siteName\n}", "title": "" }, { "docid": "a63514cd51c4349bfc419c156e38940a", "score": "0.64781976", "text": "func (o EnvironmentClusterSettingOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v EnvironmentClusterSetting) string { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "b5e159a6038ff1367faf514ff777f3f9", "score": "0.64707017", "text": "func (o CacheSpecOutput) ClusterName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v CacheSpec) *string { return v.ClusterName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3a6ca5f5668bc4e618c2e8dd4ca78a14", "score": "0.6460759", "text": "func (o EnvironmentV3ClusterSettingOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v EnvironmentV3ClusterSetting) string { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "f673395485a11e30817fe799aaa2fb5b", "score": "0.64151585", "text": "func (c ComputeInstanceV2) Name() string {\n\treturn c.name\n}", "title": "" }, { "docid": "63ec0a109ea40c84514abd80968b8aad", "score": "0.6415007", "text": "func (o LookupKubernetesClusterResultOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupKubernetesClusterResult) string { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c46774eb17c5ac3ea0ca52afa77e3331", "score": "0.6407607", "text": "func (a *CreateEksClusterAction) GetName() string {\n\treturn \"CreateEksClusterAction\"\n}", "title": "" }, { "docid": "465469223923bd040864bfff08f8a0e2", "score": "0.6377736", "text": "func (c Cluster) KubernetesClusterName() (string, error) {\n\treturn \"test\", nil\n}", "title": "" }, { "docid": "573c2b531f9063351c281173d1cef884", "score": "0.634088", "text": "func (o MultiClusterAppOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *MultiClusterApp) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ff902be9d348c690da04e7d34a7dafd5", "score": "0.63263744", "text": "func (p *Provider) ClusterName(ctx context.Context) (string, error) {\n\tmetadata, err := p.detector.Metadata(ctx)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Code comes from https://github.com/DataDog/datadog-agent/blob/1b4afdd6a/pkg/util/cloudproviders/azure/azure.go#L72\n\t// It expects the resource group name to have the format (MC|mc)_resource-group_cluster-name_zone.\n\tsplitAll := strings.Split(metadata.ResourceGroupName, \"_\")\n\tif len(splitAll) < 4 || strings.ToLower(splitAll[0]) != \"mc\" {\n\t\treturn \"\", fmt.Errorf(\"cannot parse the clustername from resource group name: %s\", metadata.ResourceGroupName)\n\t}\n\n\treturn splitAll[len(splitAll)-2], nil\n}", "title": "" }, { "docid": "aa16d48eb884eb922acce832b7838e7d", "score": "0.6293362", "text": "func (minikube Minikube) Name() string {\n\treturn common.Minikube\n}", "title": "" }, { "docid": "42a3fc77690e4b8ce77dd2169925eee8", "score": "0.62743163", "text": "func (o GetAppServiceEnvironmentClusterSettingOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetAppServiceEnvironmentClusterSetting) string { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "3699ab4815dd174230eb002f2c918e50", "score": "0.6251301", "text": "func (o GetEnvironmentV3ClusterSettingOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetEnvironmentV3ClusterSetting) string { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "b9ddb3150208b94034c83e6403ae4250", "score": "0.6242401", "text": "func (o LookupClusterResultOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupClusterResult) string { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2d33dd2a7c52044a9310a7b617580c45", "score": "0.62286544", "text": "func (o GetKubernetesClusterNodePoolNodeOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetKubernetesClusterNodePoolNode) string { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "75fadc80fabad3c6a586e5ea5ffff099", "score": "0.62270814", "text": "func (o KubernetesClusterNodePoolOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v KubernetesClusterNodePool) string { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "638ae18af551afcc7a3c3db9a3de442d", "score": "0.62011474", "text": "func (sa *ClusterIAMServiceAccount) NameString() string {\n\treturn sa.Namespace + \"/\" + sa.Name\n}", "title": "" }, { "docid": "b48fed5cb658fd0d5c82f750b99c03a8", "score": "0.61882955", "text": "func (o GetKubernetesClusterNodePoolOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetKubernetesClusterNodePool) string { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c4745335353a0832e35c41dd38cc4ed0", "score": "0.6172347", "text": "func (c *Context) ClusterName() string {\n\treturn NewClusterComplexNameFromKubeClusterName(c.NameInKubeconf).Name\n}", "title": "" }, { "docid": "844b4392fb8d55726bb50b09a7d38345", "score": "0.61293465", "text": "func (pl *ServiceAffinity) Name() string {\n\treturn Name\n}", "title": "" }, { "docid": "6a12f11ee2c353f03dece1b0682405a9", "score": "0.61071134", "text": "func (a *CreateACSKClusterAction) GetName() string {\n\treturn \"CreateACSKClusterAction\"\n}", "title": "" }, { "docid": "6a12f11ee2c353f03dece1b0682405a9", "score": "0.61071134", "text": "func (a *CreateACSKClusterAction) GetName() string {\n\treturn \"CreateACSKClusterAction\"\n}", "title": "" }, { "docid": "66787cac8fb39717308e1f91f686404c", "score": "0.60957205", "text": "func (ccp *CmdCreateParking) Name() string {\n\treturn ccp.Cmd\n}", "title": "" }, { "docid": "ca2e868e5f094c682b09f95b8a6cfad7", "score": "0.6079419", "text": "func ClusterNameFlag(cmd *Cmd) string {\n\tif cmd.CobraCommand.Use == \"cluster\" {\n\t\treturn \"--name\"\n\t}\n\treturn \"--cluster\"\n}", "title": "" }, { "docid": "c6134461e19e2dad94e0ce5d9a3250a7", "score": "0.6078133", "text": "func (k *Kubelet) Name() string {\n\treturn \"Kubeconfig Kubelet\"\n}", "title": "" }, { "docid": "dd0e4507b4912e548d0f0f25ab1c17e5", "score": "0.60475343", "text": "func (o *Cluster) GetName() (value string, ok bool) {\n\tok = o != nil && o.bitmap_&64 != 0\n\tif ok {\n\t\tvalue = o.name\n\t}\n\treturn\n}", "title": "" }, { "docid": "02960a45be50a432a8145535061d6018", "score": "0.6044556", "text": "func (o *Cluster) DisplayName() string {\n\tif o != nil && o.bitmap_&4 != 0 {\n\t\treturn o.displayName\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "f663336092098c7b0b6098cb6b45a80d", "score": "0.6037749", "text": "func (c *ClusterConfigV3) GetName() string {\n\treturn c.Metadata.Name\n}", "title": "" }, { "docid": "7a99e454e9e5582807c7136ac609c2b8", "score": "0.60310644", "text": "func (p *Partition) Name() string { return \"p\" + strconv.Itoa(p.name) }", "title": "" }, { "docid": "5fc808f0bdeecbe9f5ea666ba4357a95", "score": "0.602711", "text": "func Rename(cluster *object.ClusterComputeResource, name string) error {\n\tlog.Printf(\"[DEBUG] Renaming compute cluster %q to %s\", cluster.InventoryPath, name)\n\tctx, cancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout)\n\tdefer cancel()\n\ttask, err := cluster.Rename(ctx, name)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn task.Wait(ctx)\n}", "title": "" }, { "docid": "fbc8ec2edf1aa1024062d133518c7c95", "score": "0.6004914", "text": "func (c *Cluster) GetClusterName() string {\n\treturn c.key\n}", "title": "" }, { "docid": "4989a7271119f29e144bcc2ad142ce41", "score": "0.59919894", "text": "func (ttn *ttNode) Name() string {\n\treturn fmt.Sprintf(\"ttNode-%s\", ttn.vChannelName)\n}", "title": "" }, { "docid": "d4b4f7139e42bfa9a7f6d93a87dd944e", "score": "0.5950109", "text": "func (o CacheSpecPtrOutput) ClusterName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *CacheSpec) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ClusterName\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "19e9c2208e6a11dfd8573ef481ebe1e9", "score": "0.5940111", "text": "func (a *UpdateACSKClusterAction) GetName() string {\n\treturn \"UpdateACSKClusterAction\"\n}", "title": "" }, { "docid": "23ebb370d3e04fc5755471b2009faf15", "score": "0.59369767", "text": "func makeClusterStackName(clusterName string) string {\n\treturn \"eksctl-\" + clusterName + \"-cluster\"\n}", "title": "" }, { "docid": "2912b02edd9f0959b8d6c30f4c190266", "score": "0.59192294", "text": "func (o ClusterAgentTokenOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ClusterAgentToken) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9954d7908d60bc80526fee3739011426", "score": "0.5905216", "text": "func (pl *NodeName) Name() string {\n\treturn Name\n}", "title": "" }, { "docid": "c43f431c80388eb5da92d7d095a70869", "score": "0.58621484", "text": "func (o KubernetesClusterNodePoolNodeOutput) Name() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v KubernetesClusterNodePoolNode) *string { return v.Name }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2b627034a588d743fb23e20c3cc1b513", "score": "0.5844555", "text": "func (t *Task) Name() string {\n\treturn \"replication\"\n}", "title": "" }, { "docid": "92d309316100e62246f739ec0a448d2b", "score": "0.5840851", "text": "func (a *DeleteACSKClusterAction) GetName() string {\n\treturn \"DeleteACSKClusterAction\"\n}", "title": "" }, { "docid": "66a3f1bef6a580a7526cdef58714c3b3", "score": "0.5836858", "text": "func (r *GCPManagedControlPlane) Default() {\n\tgcpmanagedcontrolplanelog.Info(\"default\", \"name\", r.Name)\n\n\tif r.Spec.ClusterName == \"\" {\n\t\tgcpmanagedcontrolplanelog.Info(\"ClusterName is empty, generating name\")\n\t\tname, err := generateGKEName(r.Name, r.Namespace, maxClusterNameLength)\n\t\tif err != nil {\n\t\t\tgcpmanagedcontrolplanelog.Error(err, \"failed to create GKE cluster name\")\n\t\t\treturn\n\t\t}\n\n\t\tgcpmanagedcontrolplanelog.Info(\"defaulting GKE cluster name\", \"cluster-name\", name)\n\t\tr.Spec.ClusterName = name\n\t}\n}", "title": "" }, { "docid": "14c59a226937a6ad7970425e10ab5cc1", "score": "0.5834871", "text": "func (n BackendNode) Name() string {\n\treturn fmt.Sprintf(\"%s_%d\", n.SafeName(), n.Port)\n}", "title": "" }, { "docid": "d58f72cff0278c6184a4a7c2bf78e4c3", "score": "0.5828917", "text": "func (proxy *ProxyClient) RootClusterName(ctx context.Context) (string, error) {\n\t_, span := proxy.Tracer.Start(\n\t\tctx,\n\t\t\"proxyClient/RootClusterName\",\n\t\toteltrace.WithSpanKind(oteltrace.SpanKindClient),\n\t)\n\tdefer span.End()\n\n\treturn proxy.teleportClient.RootClusterName(ctx)\n}", "title": "" }, { "docid": "1e6b2b31eae6861f5362ecfafabf4356", "score": "0.58269787", "text": "func (sphere *Sphere) Name() string { return sphere.NodeName }", "title": "" }, { "docid": "1fc5ff311cbf9f6fd8db840612015aca", "score": "0.5818633", "text": "func (*ClusterCSIDriverConfig) Name() string {\n\treturn \"Cluster CSI Driver Config\"\n}", "title": "" }, { "docid": "756b7e124f9b5d801a0800156400c0c6", "score": "0.58104384", "text": "func (ns *nodeStoreManager) Name() string {\n\treturn nodeResourceName\n}", "title": "" }, { "docid": "99713ca7acb2d3c4b8de2045d0f173cb", "score": "0.57940847", "text": "func (a *DeleteClusterAction) GetName() string {\n\treturn \"DeleteClusterAction\"\n}", "title": "" }, { "docid": "cd30904af69ff6d421e7344c33290e92", "score": "0.57849675", "text": "func (r Registration) Name() string {\n\treturn \"Machine Learning\"\n}", "title": "" }, { "docid": "54018a339081a868c945d4ddd25e4f44", "score": "0.5778183", "text": "func (op *CreateAwsNodePoolOperation) Name() string {\n\treturn op.lro.Name()\n}", "title": "" }, { "docid": "73c97a51c3de81644132c286b7c74f02", "score": "0.57779837", "text": "func (e CloudEnvironment) Name() string {\n\treturn string(e)\n}", "title": "" }, { "docid": "6600b0d105789bc7760ce276ac3d5cd7", "score": "0.57727814", "text": "func (cluster *Cluster) Rename(newName string) error {\n\t_, err := client.Call(\"one.cluster.rename\", cluster.ID, newName)\n\treturn err\n}", "title": "" }, { "docid": "88407b67a8837d655ae3177c451447df", "score": "0.5770342", "text": "func (n *network) Name() string {\n\treturn n.options.Name\n}", "title": "" }, { "docid": "88407b67a8837d655ae3177c451447df", "score": "0.5770342", "text": "func (n *network) Name() string {\n\treturn n.options.Name\n}", "title": "" }, { "docid": "e07ea5809025badd89588430c6723562", "score": "0.57674265", "text": "func NodeName() (string, error) {\n\t// TODO(fejta): jenkins sets the node name and our infra expect this value.\n\t// TODO(fejta): Consider doing something different here.\n\t_, exists := os.LookupEnv(NodeNameEnv)\n\tif !exists {\n\t\thostname, err := os.Hostname()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tname := strings.Join(strings.Split(hostname, \".\")[1:], \"\")\n\t\terr = os.Setenv(NodeNameEnv, name)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\treturn os.Getenv(NodeNameEnv), nil\n}", "title": "" }, { "docid": "9988a52f887ae0dc945fe47918ec7b45", "score": "0.57622415", "text": "func Name(index int64) string {\n\treturn fmt.Sprintf(\"%s-%d\", DefaultEngineName, index)\n}", "title": "" }, { "docid": "64a0b14af639db25f021d102c3b43234", "score": "0.5757327", "text": "func (c *Config) Name() string {\n\treturn \"node_exporter\"\n}", "title": "" }, { "docid": "f66bd1396a4ba36e87d4d08bead17e4e", "score": "0.5755848", "text": "func (c *Cluster) SetName(name string) {\n\tc.config.Set(\"cluster.name\", name)\n}", "title": "" }, { "docid": "3564d6984ad50ebd977cd220314388b3", "score": "0.57527274", "text": "func (kc *kodoCache) Name() string {\n\treturn kc.name\n}", "title": "" }, { "docid": "bdae75f0fdf0a7c4a1106c88c6408b0b", "score": "0.574127", "text": "func (awsProvider *AWS) ClusterName() ([]byte, error) {\n\tdefaultClusterName := \"AWS Cluster #1\"\n\tmakeStructure := func(clusterName string) ([]byte, error) {\n\t\tklog.V(2).Infof(\"Returning \\\"%s\\\" as ClusterName\", clusterName)\n\t\tm := make(map[string]string)\n\t\tm[\"name\"] = clusterName\n\t\tm[\"provider\"] = \"AWS\"\n\t\treturn json.Marshal(m)\n\t}\n\n\tmaybeClusterId := os.Getenv(ClusterIdEnvVar)\n\tif len(maybeClusterId) != 0 {\n\t\treturn makeStructure(maybeClusterId)\n\t}\n\tprovIdRx := regexp.MustCompile(\"aws:///([^/]+)/([^/]+)\")\n\tclusterIdRx := regexp.MustCompile(\"^kubernetes\\\\.io/cluster/([^/]+)\")\n\tnodeList, err := awsProvider.Clientset.CoreV1().Nodes().List(metav1.ListOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, n := range nodeList.Items {\n\t\tregion := \"\"\n\t\tinstanceId := \"\"\n\t\tproviderId := n.Spec.ProviderID\n\t\tfor matchNum, group := range provIdRx.FindStringSubmatch(providerId) {\n\t\t\tif matchNum == 1 {\n\t\t\t\tregion = group\n\t\t\t} else if matchNum == 2 {\n\t\t\t\tinstanceId = group\n\t\t\t}\n\t\t}\n\t\tif len(instanceId) == 0 {\n\t\t\tklog.V(2).Infof(\"Unable to decode Node.ProviderID \\\"%s\\\", skipping it\", providerId)\n\t\t\tcontinue\n\t\t}\n\t\tc := &aws.Config{\n\t\t\tRegion: aws.String(region),\n\t\t}\n\t\ts := session.Must(session.NewSession(c))\n\t\tec2Svc := ec2.New(s)\n\t\tdi, diErr := ec2Svc.DescribeInstances(&ec2.DescribeInstancesInput{\n\t\t\tInstanceIds: []*string{\n\t\t\t\taws.String(instanceId),\n\t\t\t},\n\t\t})\n\t\tif diErr != nil {\n\t\t\t// maybe log this?\n\t\t\tcontinue\n\t\t}\n\t\tif len(di.Reservations) != 1 {\n\t\t\tklog.V(2).Infof(\"Expected 1 Reservation back from DescribeInstances(%s), received %d\", instanceId, len(di.Reservations))\n\t\t\tcontinue\n\t\t}\n\t\tres := di.Reservations[0]\n\t\tif len(res.Instances) != 1 {\n\t\t\tklog.V(2).Infof(\"Expected 1 Instance back from DescribeInstances(%s), received %d\", instanceId, len(res.Instances))\n\t\t\tcontinue\n\t\t}\n\t\tinst := res.Instances[0]\n\t\tfor _, tag := range inst.Tags {\n\t\t\ttagKey := *tag.Key\n\t\t\tfor matchNum, group := range clusterIdRx.FindStringSubmatch(tagKey) {\n\t\t\t\tif matchNum != 1 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\treturn makeStructure(group)\n\t\t\t}\n\t\t}\n\t}\n\tklog.V(2).Infof(\"Unable to sniff out cluster ID, perhaps set $%s to force one\", ClusterIdEnvVar)\n\treturn makeStructure(defaultClusterName)\n}", "title": "" }, { "docid": "a21ef5101b029b81aa7cb7d8b2ea12be", "score": "0.5738747", "text": "func (*SDConfig) Name() string { return \"kubernetes\" }", "title": "" }, { "docid": "5f9528b3a59d2b628ae6ab1bbdbe47f3", "score": "0.5727196", "text": "func (w *Worker) Name() string {\n\treturn \"Worker Machines\"\n}", "title": "" }, { "docid": "9d38c09a8ac839b447efb5f83d4fa5e0", "score": "0.5726085", "text": "func (o ClusterSkuOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ClusterSku) string { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "3fddd5e9bc9e04b56a7aa10801ec71a1", "score": "0.57237893", "text": "func (r Registration) Name() string {\n\treturn \"Network\"\n}", "title": "" }, { "docid": "1da61e474c322ed08d28fd7aa4d22d54", "score": "0.57111657", "text": "func (Kubernetes) Name() string {\n\treturn \"k8s\"\n}", "title": "" }, { "docid": "6ca4d878ee064bd45cd84afa47bcdb13", "score": "0.56956714", "text": "func (s *ManagedClusterSpec) ResourceName() string {\n\treturn s.Name\n}", "title": "" }, { "docid": "5c6d86fb04c8c403904d649597235eac", "score": "0.5685577", "text": "func (ks *KeyStore) Name() string {\n\treturn name\n}", "title": "" }, { "docid": "76dc92eeeacac75ff130d33438bad7f9", "score": "0.5684842", "text": "func (o OceanVirtualNodeGroupOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *OceanVirtualNodeGroup) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ae63f09a5b04859138389e596eeb2507", "score": "0.5677825", "text": "func (cit *CreateIndexTask) Name() string {\n\treturn CreateIndexTaskName\n}", "title": "" }, { "docid": "d62366350fd634b1d0798be1c17447fb", "score": "0.5676279", "text": "func (b *Backend) Name() string {\n\th := md5.New()\n\tio.WriteString(h, fmt.Sprintf(\"%#v\", b.Servers))\n\treturn fmt.Sprintf(\"%x\", h.Sum(nil))\n}", "title": "" }, { "docid": "f7d660b678674452652d4395ad577ada", "score": "0.5670707", "text": "func (e *EtcdServer) Name() string {\n\treturn etcdName\n}", "title": "" }, { "docid": "4f0000ddda2aedcad7a9c05b9aeed9ca", "score": "0.56515324", "text": "func (c *Client) Name() string {\n\treturn \"azurets\"\n}", "title": "" }, { "docid": "4268ea8f5d48ba455c87cd60e1189603", "score": "0.56459904", "text": "func (c *AssetFetcherConfig) Name() string {\n\treturn \"Nexpose\"\n}", "title": "" }, { "docid": "9df659ac3adec82f48a0daee6387b270", "score": "0.5645182", "text": "func (c *common) Name() string {\n\treturn c.name\n}", "title": "" }, { "docid": "813affaec3830cf57f93ac3ca0d64044", "score": "0.56444114", "text": "func (c *hostContext) MasterAgentName() (string, error) {\n if len(c.ClusterID) == 0 {\n return \"\", errors.Errorf(\"[ERR] invalid cluster id\")\n }\n return c.ClusterID, nil\n}", "title": "" }, { "docid": "ca320afb20c53db52cc1d48de4cfda09", "score": "0.5641947", "text": "func (o *ConnectorClusterAllOfMetadata) GetName() string {\n\tif o == nil || o.Name == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Name\n}", "title": "" }, { "docid": "c87f7eff8ada2741d0f7c36584757954", "score": "0.56369275", "text": "func (c *Container) Name() string {\n\treturn fmt.Sprintf(\"cont-%d-%s\", c.Port, strings.ToLower(string(c.Protocol)))\n}", "title": "" } ]
ea0fc0b359e277fd8a78106a355ba246
HasRuleName returns a boolean if a field has been set.
[ { "docid": "e2340f87389ffdb6fa23966b7713b798", "score": "0.7760291", "text": "func (o *MetricsRules) HasRuleName() bool {\n\tif o != nil && o.RuleName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" } ]
[ { "docid": "5f154398acba008dbc06e6ee0d9ea432", "score": "0.78571767", "text": "func (o *WafRequestDetails) HasRuleName() bool {\n\tif o != nil && o.RuleName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d3d057f0f52e802564c9a0c0fd07ce50", "score": "0.7370269", "text": "func (o *MicrosoftGraphDeviceComplianceScheduledActionForRule) HasRuleName() bool {\n\tif o != nil && o.RuleName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2a0510be4609f8e083c9719add6b0d46", "score": "0.68803406", "text": "func (o *FirewallruleProperties) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "67451c5036eb4eba82d46ce24ef4d576", "score": "0.6829233", "text": "func (c *Component) HasRule(name string) bool {\n\t_, found := c.rules[name]\n\treturn found\n}", "title": "" }, { "docid": "3528aea7796248ff4413636d57f21f2c", "score": "0.6700316", "text": "func (o *DnsRecordset) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c78180d63c72c75745d3fe6099f217c9", "score": "0.6530197", "text": "func (o *FormulaAndFunctionSLOQueryDefinition) HasName() bool {\n\treturn o != nil && o.Name != nil\n}", "title": "" }, { "docid": "69fcd9f263ea11173782e53745a62717", "score": "0.64239705", "text": "func (o *TargetGroupProperties) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b82dccce4e4755903a2758630aedf32d", "score": "0.63126755", "text": "func (o *Metric) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e098296210818cff1f48b7cc84b755f8", "score": "0.62814695", "text": "func (o *PlanAllOf) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "bf9a66f38a4834d80d4805f4d54d5e8f", "score": "0.62368935", "text": "func (o *WafRequestDetails) HasRuleId() bool {\n\tif o != nil && o.RuleId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ccb501ed7d762713f3c8de3b2b989e07", "score": "0.61984426", "text": "func (o *WebhookAllOf) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9b831fbb7f631e6c9ff5fb3dcad7e370", "score": "0.61487997", "text": "func (o *Ga4ghExpressionAnalysis) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1c95dae839342e0cf37e717fa30521c5", "score": "0.6134378", "text": "func (o *SettingStateDeviceSummary) HasSettingName() bool {\n\tif o != nil && o.SettingName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "dd35eb7b1df619ef70e8ded3a34526d6", "score": "0.6125445", "text": "func (o *DatabaseVersionMode) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9a2d99a8b2eeaf75d3e45e745a0768be", "score": "0.6121064", "text": "func (o *PatchedUserAdminUpdate) HasName() bool {\n\tif o != nil && !IsNil(o.Name) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8faab8d155d37280e34785baf9860613", "score": "0.6112135", "text": "func (o *CampaignCreatedNotification) HasRuleset() bool {\n\tif o != nil && o.Ruleset != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e15e14348e0dce5f2dbac5e5be062dc0", "score": "0.6108298", "text": "func (o *DomainDnsSrvRecord) HasNameTarget() bool {\n\tif o != nil && o.NameTarget != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4da344c0f9d44bafcbb79ce0b5cfdbfb", "score": "0.6107281", "text": "func (o *IdentityVerificationRequestUser) HasName() bool {\n\tif o != nil && o.Name.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4bca604bb428f7868771508d62088cd0", "score": "0.6104476", "text": "func (o *IncomeVerificationPrecheckEmployer) HasName() bool {\n\tif o != nil && o.Name.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "841946a5a7350d04a60c781000ff373d", "score": "0.6103735", "text": "func (o *WebhookUpdate) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "784e34dff1622559a210299702ea8de3", "score": "0.608948", "text": "func (o *User) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "99f60595ce8ddaf4bb4b44948239b58e", "score": "0.6075458", "text": "func (o *Ga4ghLabtest) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9e53b4583ed54c3aa770ac441f8c078d", "score": "0.60685766", "text": "func (o *CdnCreateScopeRuleResponse) HasRule() bool {\n\tif o != nil && o.Rule != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a141b393a3b1dcb7c8132cdb0d3d93ae", "score": "0.60556006", "text": "func (variable Variable) HasName(name string) bool {\n\treturn strings.ToLower(variable.Name) == strings.ToLower(name)\n}", "title": "" }, { "docid": "002e06bcd1aa9bcf19888ff438031366", "score": "0.6052378", "text": "func (o *ReplicationUpdateRequest) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "434405de9c2bb425cb0ada47c57ac4ae", "score": "0.6051893", "text": "func (o *FormViewUpdate) HasName() bool {\n\tif o != nil && !IsNil(o.Name) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7bcd8ac439fca19faaac9687242ad69c", "score": "0.60497546", "text": "func (o *PatchUserGroupRequest) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e1787f41d449bff315b9e97097a2fd64", "score": "0.6043912", "text": "func (o *Source) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5cf75fca980f63b0d80b28b4f4b6f53d", "score": "0.6043263", "text": "func (o *TriggerSpec) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "660f71b90b93bd46d0751c3bd0926d76", "score": "0.60411423", "text": "func (o *TamQueryEntry) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "76b45843cfaca52f32f2dfab44757920", "score": "0.6032705", "text": "func (o *MonitorUpdateRequest) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a3898ea917ff2e237d750f0eede35a4c", "score": "0.6021753", "text": "func (o *PipelineStepStateCompletedErrorAllOf) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "eb24992b2506e7780b48f7997453b7f3", "score": "0.6021178", "text": "func (o *LogsTraceRemapper) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e4b8b4ff7c96e74ffd647418156ddd36", "score": "0.599196", "text": "func (o *Ga4ghRadiotherapy) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "cf344610b79c7b4bb39c6cecc6494517", "score": "0.59846973", "text": "func (o *WorkflowCatalogItemDefinitionAllOf) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b00d63d802aac3d682c73b13535a1654", "score": "0.5980762", "text": "func (o *MobileSessionPropertyUpdate) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0f895a2cc3abbc46a51db9bbd48f2103", "score": "0.5972332", "text": "func (o *SecurityFilterUpdateAttributes) HasName() bool {\n\treturn o != nil && o.Name != nil\n}", "title": "" }, { "docid": "77bf5b5082bc1355691f911df27587d3", "score": "0.5971455", "text": "func (o *DnsRrDataData) HasViewName() bool {\n\tif o != nil && o.ViewName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4f241a9cbd26ed1f7fbc4b274697077f", "score": "0.59674466", "text": "func (o *SystemProfileDnfModule) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "bf2320d790211ccc1a91bdfbab2fd79c", "score": "0.5963882", "text": "func (o *ProcessorRunStatusDetailsDTO) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a7458e6353eb2dcbd8cd4d64a116ce87", "score": "0.5961204", "text": "func (o *SecurityOverride) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "aad0eb3c552e8deb3c671c046fb77e13", "score": "0.595911", "text": "func (o *Metric) HasReferenceName() bool {\n\tif o != nil && o.ReferenceName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "691232ab0a632bd750efaf2a3898ab69", "score": "0.59460765", "text": "func (o *ModelResponse) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "781217ca4cdfefae7bb495855f215bea", "score": "0.59421456", "text": "func (o *NameMatchScore) HasIsBusinessNameDetected() bool {\n\tif o != nil && o.IsBusinessNameDetected.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b0cb0fe61de9334b5d49fa07c93f8fb3", "score": "0.59420675", "text": "func (o *HyperflexLunAllOf) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c76bc30352e64fa5f8cdda86ec54582f", "score": "0.5940681", "text": "func (o *WorkflowTaskMetadataAllOf) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "59a44b04e3356db525301a439c0799ab", "score": "0.5936862", "text": "func (o *HyperflexEntityReferenceAllOf) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "3fd459687e385143d4f9b06e9c3d63af", "score": "0.59317183", "text": "func (o *Registry) HasTeamName() bool {\n\tif o != nil && o.TeamName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "53c4cbcc46ea6b3d0e8d874f8a96a861", "score": "0.59190196", "text": "func (o *NameMatchScore) HasIsFirstNameOrLastNameMatch() bool {\n\tif o != nil && o.IsFirstNameOrLastNameMatch.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "27c321727af918af377bbd5fb9ce8737", "score": "0.5916564", "text": "func (o *Registry) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "27c321727af918af377bbd5fb9ce8737", "score": "0.5916564", "text": "func (o *Registry) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c93c1fbbe1f4f367800257d4ef1746c8", "score": "0.5916288", "text": "func (obj *node) HasRecursiveName() bool {\n\treturn obj.recursiveName != \"\"\n}", "title": "" }, { "docid": "527a448d871a69be0a7b9a23003b0735", "score": "0.5910417", "text": "func (o *LocationProperties) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "db80b9a4b074868c46bf917c27b20feb", "score": "0.5909042", "text": "func (o *SmsError) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "44b44955171bc3e47cbdb7186839b96e", "score": "0.59025705", "text": "func (o *Payment) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "de3661ff03f036a99841399f0daea841", "score": "0.5902078", "text": "func (o *DnsAclAddInput) HasAclName() bool {\n\tif o != nil && o.AclName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a9e3222ae1fdf8063f7558ffd5ef2f1d", "score": "0.59018004", "text": "func (o *SnmpUserAllOf) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ef98f2829f87bb23d5471fc1d65fcd51", "score": "0.58680886", "text": "func (o *HyperflexHealthCheckScriptInfo) HasScriptName() bool {\n\tif o != nil && o.ScriptName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "196e18e5a64ea6d07c5b1dc920b2fc3c", "score": "0.5862036", "text": "func (o *PiggyBankUpdate) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "424ac80562e95311a91e9f1b97024d9f", "score": "0.58598393", "text": "func (o *SearchServiceLevelObjectiveAttributes) HasName() bool {\n\treturn o != nil && o.Name != nil\n}", "title": "" }, { "docid": "be07d89581b34c673770b513d927a322", "score": "0.585359", "text": "func (o *ParameterDTO) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4d59d4392de99f7884b2be535bb3a1cd", "score": "0.5852295", "text": "func (o *ModelsBackupTarget) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "231d83eead4da0a1f31f6575d5e1b153", "score": "0.5849088", "text": "func (o *TaskTask) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9b5fd31b497bd832e63db3f09b8a935d", "score": "0.5844849", "text": "func (o *AssetCreateReqWeb) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "43fd1530ac0a5fa4fcc8540491a2b065", "score": "0.583821", "text": "func (a *Generator) hasField(fields []*models.Field, name string) bool {\n\tfor _, f := range fields {\n\t\tif f.Name == name {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "649e5c5b82cee5689d58b77c54977a40", "score": "0.5837266", "text": "func (o *VariableDTO) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a198cb5c5bfc59e769af75eec7c4480b", "score": "0.58336896", "text": "func (o *Account) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0b6ef7890d3cc0cc9f8beb20e4dca1a4", "score": "0.5827474", "text": "func (o *PipelineRefTarget) HasRefName() bool {\n\tif o != nil && o.RefName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "fa1563da5e793f2e98a160c48184cae6", "score": "0.5808826", "text": "func (o *TamActionAllOf) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9c8d00b8505a951793d913edd81f5145", "score": "0.5793103", "text": "func (o *DnsViewAddInput) HasViewName() bool {\n\tif o != nil && o.ViewName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "85bac6cfa6662f43f5887c0718c97790", "score": "0.5786463", "text": "func (obj *headValue) IsName() bool {\n\treturn obj.name != \"\"\n}", "title": "" }, { "docid": "8e3c5c05d6f1ba19d230f2fbab1bf9b2", "score": "0.5784255", "text": "func (o *Team) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d2eb21135c54b9b987192c28d4031578", "score": "0.5768596", "text": "func (o *VirtualizationBaseDatastore) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7dfd36b97251bf1f81e38b63420849f4", "score": "0.5767749", "text": "func (o *ConvergedinfraBaseComplianceDetails) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2fff539d58077db6fad1e46bbf2f57a1", "score": "0.57616735", "text": "func hasField(v interface{}, name string) bool {\n\tvr := reflect.Indirect(reflect.ValueOf(v))\n\treturn vr.FieldByName(name).IsValid()\n}", "title": "" }, { "docid": "d0b9648d41c3e02ad540525e4eb60ff4", "score": "0.5761101", "text": "func (o *Clickstream) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f6259789085e79f4c4988d7053fe2025", "score": "0.5758341", "text": "func (o *Namespace) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9a40964be1d215ed03e46c10296aad82", "score": "0.5750918", "text": "func (o *UpdateToken) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "de5ef2688247d8e7e4ad0d9ec9de5784", "score": "0.5744749", "text": "func (o *StatsApplianceAllOfData) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d810a903e5ab110a05af855318b7574b", "score": "0.5733364", "text": "func (o *RemoteProcessGroupStatusSnapshotDTO) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9cd5453f9ba33eaef17fe41271a3ee0c", "score": "0.57305044", "text": "func (o *Contact) HasGivenName() bool {\n\tif o != nil && o.GivenName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "afc6b370ab070b07d809716ea23de3a5", "score": "0.57285273", "text": "func (o *ViewProject) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "3d9c6d2860998f643cfcf3757c252f3a", "score": "0.57214344", "text": "func hasField(v any, name string) bool {\n\tvr := reflect.Indirect(reflect.ValueOf(v))\n\treturn vr.FieldByName(name).IsValid()\n}", "title": "" }, { "docid": "d877330ecbdbc48dfdf16a564a0ff41c", "score": "0.57150584", "text": "func (o *LinkEventMetadata) HasViewName() bool {\n\tif o != nil && o.ViewName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "02a23c1abf84b254038c02af177ef689", "score": "0.57125753", "text": "func (o *RemoteItem) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0e4c135e5d60ac6f4540f6ec0c7b90a0", "score": "0.56976604", "text": "func (o *ServiceAccount) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "026670f6137044617f30f74ce7d05e9d", "score": "0.5695957", "text": "func (o *Service) HasWebServerName() bool {\n\tif o != nil && o.WebServerName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "07d81597758f8157c20f940f4a17ee6a", "score": "0.5694362", "text": "func (o *Device) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f01fde78c1ad0f5739a31ba327d712d6", "score": "0.5690119", "text": "func (o *MicrosoftGraphCalendar) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5154f79bb29825284e626d984855023d", "score": "0.56871206", "text": "func (o *UserRole) HasRoleName() bool {\n\tif o != nil && o.RoleName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "3779bd12a9792a13d97a7c31d9e5fa8b", "score": "0.5684413", "text": "func (o *ModelsLegacyProjectBinding) HasRoleName() bool {\n\tif o != nil && o.RoleName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f88bd812bee3fa6be0566ff153536351", "score": "0.567727", "text": "func (o *ExtensionDto) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c3470799f7bd29cf66365a5205d02043", "score": "0.5675912", "text": "func (f *Form) Has(field string) bool {\n\t//x := r.Form.Get(field)\n\tx := f.Get(field)\n\tif x == \"\" {\n\t\t//f.Errors.Add(field, \"This field cannot be blank\")\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "c35497071416aca3b86af0faa672e5e3", "score": "0.5656407", "text": "func (g *Getter) Has(name string) bool {\n\t_, ok := g.getSafely(name)\n\treturn ok\n}", "title": "" }, { "docid": "3ba1f59cd995996de95040029a310162", "score": "0.5654311", "text": "func (o *SiteAllOf) HasNameResolution() bool {\n\tif o != nil && o.NameResolution != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8142009820889595cced63c9b90428ca", "score": "0.5653353", "text": "func (o *LogsIndex) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5d61b8629c6f511d6d61d30b4cb2b99c", "score": "0.5649151", "text": "func (o *VirtualMachine) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e54347db414d9350995c40d2ee51a6ff", "score": "0.5648756", "text": "func (o *CounterDTO) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "82c5f34a3f2e6bb37b3e97e89a9ca8b3", "score": "0.56423795", "text": "func (o *NameMatchScore) HasIsNicknameMatch() bool {\n\tif o != nil && o.IsNicknameMatch.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2855f6ccf0de49ace0877ab4852661a9", "score": "0.5639874", "text": "func (o *OrganizationAttributes) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" } ]
ca0eaf15dcdb95abdf803010a14b682c
AddStandardWithName quickly and easily composes and adds the tag using the information already known about a tag (using the name). Only works with standard tags.
[ { "docid": "e252939e82736c18815ca99c53690b63", "score": "0.8450544", "text": "func (ib *IfdBuilder) AddStandardWithName(tagName string, value interface{}) (err error) {\n\tdefer func() {\n\t\tif state := recover(); state != nil {\n\t\t\terr = log.Wrap(state.(error))\n\t\t}\n\t}()\n\n\tit, err := ib.tagIndex.GetWithName(ib.ifdPath, tagName)\n\tlog.PanicIf(err)\n\n\tbt := NewStandardBuilderTag(ib.ifdPath, it, ib.byteOrder, value)\n\n\terr = ib.add(bt)\n\tlog.PanicIf(err)\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "fcadb8486d479cbe611e8fee9025142a", "score": "0.707663", "text": "func (ib *IfdBuilder) SetStandardWithName(tagName string, value interface{}) (err error) {\n\tdefer func() {\n\t\tif state := recover(); state != nil {\n\t\t\terr = log.Wrap(state.(error))\n\t\t}\n\t}()\n\n\t// TODO(dustin): !! Add test for this function.\n\n\tit, err := ib.tagIndex.GetWithName(ib.ifdPath, tagName)\n\tlog.PanicIf(err)\n\n\tbt := NewStandardBuilderTag(ib.ifdPath, it, ib.byteOrder, value)\n\n\ti, err := ib.Find(bt.tagId)\n\tif err != nil {\n\t\tif log.Is(err, ErrTagEntryNotFound) == false {\n\t\t\tlog.Panic(err)\n\t\t}\n\n\t\tib.tags = append(ib.tags, bt)\n\t} else {\n\t\tib.tags[i] = bt\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e17e838089c6db05e3970e216d13f3ad", "score": "0.6983592", "text": "func (ib *IfdBuilder) AddStandard(tagId uint16, value interface{}) (err error) {\n\tdefer func() {\n\t\tif state := recover(); state != nil {\n\t\t\terr = log.Wrap(state.(error))\n\t\t}\n\t}()\n\n\tit, err := ib.tagIndex.Get(ib.ifdPath, tagId)\n\tlog.PanicIf(err)\n\n\tbt := NewStandardBuilderTag(ib.ifdPath, it, ib.byteOrder, value)\n\n\terr = ib.add(bt)\n\tlog.PanicIf(err)\n\n\treturn nil\n}", "title": "" }, { "docid": "27b2421e56ba080a0efd2df9129bc45d", "score": "0.55323744", "text": "func (ib *IfdBuilder) SetStandard(tagId uint16, value interface{}) (err error) {\n\tdefer func() {\n\t\tif state := recover(); state != nil {\n\t\t\terr = log.Wrap(state.(error))\n\t\t}\n\t}()\n\n\t// TODO(dustin): !! Add test for this function.\n\n\tit, err := ib.tagIndex.Get(ib.ifdPath, tagId)\n\tlog.PanicIf(err)\n\n\tbt := NewStandardBuilderTag(ib.ifdPath, it, ib.byteOrder, value)\n\n\ti, err := ib.Find(tagId)\n\tif err != nil {\n\t\tif log.Is(err, ErrTagEntryNotFound) == false {\n\t\t\tlog.Panic(err)\n\t\t}\n\n\t\tib.tags = append(ib.tags, bt)\n\t} else {\n\t\tib.tags[i] = bt\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "74ce6f74117c9ed07d7625b43464c4ab", "score": "0.5236153", "text": "func (g *Go2TS) AddWithName(v interface{}, interfaceName string) {\n\tg.AddWithNameToNamespace(v, interfaceName, \"\")\n}", "title": "" }, { "docid": "5b245919396957c20eab6e6363513719", "score": "0.5224036", "text": "func ForStandardLibrary(importPath string) *spb.VName {\n\treturn &spb.VName{\n\t\tCorpus: GolangCorpus,\n\t\tLanguage: Language,\n\t\tPath: importPath,\n\t\tSignature: \"package\",\n\t}\n}", "title": "" }, { "docid": "9665b8cd9325c3a03211ae4ff7516d04", "score": "0.52156436", "text": "func Add(ctx *types.SystemContext, name string, value reference.Named) error {\n\tisShort, _, err := parseUnnormalizedShortName(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !isShort {\n\t\treturn fmt.Errorf(\"%q is not a short name\", name)\n\t}\n\treturn sysregistriesv2.AddShortNameAlias(ctx, name, value.String())\n}", "title": "" }, { "docid": "766f081f21eccef364636671908185ae", "score": "0.4813913", "text": "func AddStandardUdf(aMap data.Map) {\n\tudf.Register(aMap)\n\taMap.Put(\"IsJSON\", IsJSON)\n\taMap.Put(\"WorkingDirectory\", WorkingDirectory)\n\taMap.Put(\"Pwd\", WorkingDirectory)\n\taMap.Put(\"HasResource\", HasResource)\n\taMap.Put(\"Md5\", Md5)\n\taMap.Put(\"LoadNeatly\", LoadNeatly)\n\taMap.Put(\"Zip\", Zip)\n\taMap.Put(\"Unzip\", Unzip)\n\taMap.Put(\"UnzipText\", UnzipText)\n\taMap.Put(\"Markdown\", Markdown)\n\taMap.Put(\"Cat\", Cat)\n\taMap.Put(\"LoadBinary\", LoadBinary)\n\taMap.Put(\"AssetsToMap\", AssetsToMap)\n\taMap.Put(\"BinaryAssetsToMap\", BinaryAssetsToMap)\n\taMap.Put(\"CurrentHour\", CurrentHour)\n\taMap.Put(\"MatchAnyRow\", MatchAnyRow)\n}", "title": "" }, { "docid": "017423f9079f2b2e7c87a9d0e36aeb10", "score": "0.47090742", "text": "func (g *Go2TS) AddUnionWithName(v interface{}, typeName string) {\n\tg.AddUnionWithNameToNamespace(v, typeName, \"\")\n}", "title": "" }, { "docid": "d8291ffefcc60a7337747a82ededf585", "score": "0.46734822", "text": "func (r *Response) AddStandardCard(title, text, smallImageURL, largeImageURL string) *Response {\n\tr.Response.Card = &Card{\n\t\tType: CardStandard,\n\t\tTitle: title,\n\t\tText: text,\n\t\tImageURLs: &ImageURLs{\n\t\t\tSmallImageURL: smallImageURL,\n\t\t\tLargeImageURL: largeImageURL,\n\t\t},\n\t}\n\n\treturn r\n}", "title": "" }, { "docid": "f2e4ede4b40ff23cfa00c46ed6505a8b", "score": "0.46184406", "text": "func AddNameFlag(fs *pflag.FlagSet, name *string) {\n\tfs.StringVarP(name, \"name\", \"n\", *name, \"Specify the name\")\n}", "title": "" }, { "docid": "32f5bc5176910c0c878e28db26912f02", "score": "0.46121266", "text": "func NewStandardBuilderTag(ifdPath string, it *IndexedTag, byteOrder binary.ByteOrder, value interface{}) *BuilderTag {\n\ttypeId := it.Type\n\ttt := NewTagType(typeId, byteOrder)\n\n\tve := NewValueEncoder(byteOrder)\n\n\tvar ed EncodedData\n\tif it.Type == TypeUndefined {\n\t\tvar err error\n\n\t\ted, err = EncodeUndefined(ifdPath, it.Id, value)\n\t\tlog.PanicIf(err)\n\t} else {\n\t\tvar err error\n\n\t\ted, err = ve.EncodeWithType(tt, value)\n\t\tlog.PanicIf(err)\n\t}\n\n\ttagValue := NewIfdBuilderTagValueFromBytes(ed.Encoded)\n\n\treturn NewBuilderTag(\n\t\tifdPath,\n\t\tit.Id,\n\t\ttypeId,\n\t\ttagValue,\n\t\tbyteOrder)\n}", "title": "" }, { "docid": "1597957df27eb8488048b422b3d8f32b", "score": "0.4606895", "text": "func LoadStandardTags(ti *TagIndex) (err error) {\n\tdefer func() {\n\t\tif state := recover(); state != nil {\n\t\t\terr = log.Wrap(state.(error))\n\t\t}\n\t}()\n\n\t// Read static data.\n\n\tencodedIfds := make(map[string][]encodedTag)\n\n\terr = yaml.Unmarshal([]byte(tagsYaml), encodedIfds)\n\tlog.PanicIf(err)\n\n\t// Load structure.\n\n\tcount := 0\n\tfor ifdPath, tags := range encodedIfds {\n\t\tfor _, tagInfo := range tags {\n\t\t\ttagId := uint16(tagInfo.Id)\n\t\t\ttagName := tagInfo.Name\n\t\t\ttagTypeName := tagInfo.TypeName\n\t\t\ttagTypeNames := tagInfo.TypeNames\n\n\t\t\tif tagTypeNames == nil {\n\t\t\t\tif tagTypeName == \"\" {\n\t\t\t\t\tlog.Panicf(\"no tag-types were given when registering standard tag [%s] (0x%04x) [%s]\", ifdPath, tagId, tagName)\n\t\t\t\t}\n\n\t\t\t\ttagTypeNames = []string{\n\t\t\t\t\ttagTypeName,\n\t\t\t\t}\n\t\t\t} else if tagTypeName != \"\" {\n\t\t\t\tlog.Panicf(\"both 'type_names' and 'type_name' were given when registering standard tag [%s] (0x%04x) [%s]\", ifdPath, tagId, tagName)\n\t\t\t}\n\n\t\t\ttagTypes := make([]exifcommon.TagTypePrimitive, 0)\n\t\t\tfor _, tagTypeName := range tagTypeNames {\n\n\t\t\t\t// TODO(dustin): Discard unsupported types. This helps us with non-standard types that have actually been found in real data, that we ignore for right now. e.g. SSHORT, FLOAT, DOUBLE\n\t\t\t\ttagTypeId, found := exifcommon.GetTypeByName(tagTypeName)\n\t\t\t\tif found == false {\n\t\t\t\t\ttagsLogger.Warningf(nil, \"Type [%s] for tag [%s] being loaded is not valid and is being ignored.\", tagTypeName, tagName)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\ttagTypes = append(tagTypes, tagTypeId)\n\t\t\t}\n\n\t\t\tif len(tagTypes) == 0 {\n\t\t\t\ttagsLogger.Warningf(nil, \"Tag [%s] (0x%04x) [%s] being loaded does not have any supported types and will not be registered.\", ifdPath, tagId, tagName)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tit := &IndexedTag{\n\t\t\t\tIfdPath: ifdPath,\n\t\t\t\tId: tagId,\n\t\t\t\tName: tagName,\n\t\t\t\tSupportedTypes: tagTypes,\n\t\t\t}\n\n\t\t\terr = ti.Add(it)\n\t\t\tlog.PanicIf(err)\n\n\t\t\tcount++\n\t\t}\n\t}\n\n\ttagsLogger.Debugf(nil, \"(%d) tags loaded.\", count)\n\n\treturn nil\n}", "title": "" }, { "docid": "ed0e9d98a55b2403dbc9e6949416d2ed", "score": "0.45653892", "text": "func Add(name, ctype string) {\n\tmut.Lock()\n\tdefer mut.Unlock()\n\tnameTypes = append(nameTypes, [2]string{name, ctype})\n}", "title": "" }, { "docid": "a0b7124bf665179a88ce6681083d29ea", "score": "0.45355028", "text": "func (g *Go2TS) AddWithNameIgnoreNil(v interface{}, interfaceName string) {\n\tg.AddWithNameToNamespaceIgnoreNil(v, interfaceName, \"\")\n}", "title": "" }, { "docid": "b4c9b9c98ddd45481ad056e5db6f633a", "score": "0.45336533", "text": "func DeployStandardToken(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *StandardToken, error) {\n\tparsed, err := abi.JSON(strings.NewReader(StandardTokenABI))\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\taddress, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(StandardTokenBin), backend)\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\treturn address, tx, &StandardToken{StandardTokenCaller: StandardTokenCaller{contract: contract}, StandardTokenTransactor: StandardTokenTransactor{contract: contract}, StandardTokenFilterer: StandardTokenFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "b4c9b9c98ddd45481ad056e5db6f633a", "score": "0.45336533", "text": "func DeployStandardToken(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *StandardToken, error) {\n\tparsed, err := abi.JSON(strings.NewReader(StandardTokenABI))\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\taddress, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(StandardTokenBin), backend)\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\treturn address, tx, &StandardToken{StandardTokenCaller: StandardTokenCaller{contract: contract}, StandardTokenTransactor: StandardTokenTransactor{contract: contract}, StandardTokenFilterer: StandardTokenFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "46cf9bdc79c83759fb10f8fe1ec04dd8", "score": "0.45096904", "text": "func AddStyle(name string, s Style) {\n\tStyles[name] = s\n}", "title": "" }, { "docid": "61657c86845f6425e093f3529a0dd656", "score": "0.44257304", "text": "func (c *Config) FontFamilyStandard(fontName string) {\n\ts := C.CString(fontName)\n\tuls := C.ulCreateString(s)\n\n\tdefer func() {\n\t\tC.ulDestroyString(uls)\n\t\tC.free(unsafe.Pointer(s))\n\t}()\n\n\tC.ulConfigSetFontFamilyStandard(c.cfg, uls)\n}", "title": "" }, { "docid": "0c7e976ae6b05653bec39987aa99ef66", "score": "0.44043773", "text": "func (s *Standard) AddInput(input *Input) {\n\ts.Inputs = append(s.Inputs, input)\n}", "title": "" }, { "docid": "51b8ac16684f43eeb853b49d62ddf278", "score": "0.4396622", "text": "func bindStandardToken(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(StandardTokenABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "51b8ac16684f43eeb853b49d62ddf278", "score": "0.4396622", "text": "func bindStandardToken(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(StandardTokenABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "03d7e1b5f0208121130ac85d06c11dc9", "score": "0.43738183", "text": "func AddTag(startPoint string, force bool) {\n\turl := fmt.Sprintf(\"%v/git/1.0/projects/%v/repos/%v/tags\",\n\t\tbitbucket.Api,\n\t\tbitbucket.Project,\n\t\tbitbucket.Repo,\n\t)\n\n\tbody := Body{\n\t\tName: bitbucket.Tag,\n\t\tStartPoint: startPoint,\n\t\tMessage: fmt.Sprintf(\"ADD Tag %v\", bitbucket.Tag),\n\t\tType: \"ANNOTATED\",\n\t\tForce: force,\n\t}\n\n\tclient(\n\t\tClientPrt{\n\t\t\tUrl: url,\n\t\t\tMethod: \"POST\",\n\t\t\tBody: body,\n\t\t\tContentType: \"application/json\",\n\t\t\tUser: bitbucket.User,\n\t\t\tPassword: bitbucket.Password,\n\t\t},\n\t\tfunc(res *http.Response, b string) {},\n\t\tfunc() {\n\t\t\tlog.Fatal(FatalBitbucketMsg)\n\t\t},\n\t)\n}", "title": "" }, { "docid": "6e08ccf73c4ce4fad4675e340a4e3038", "score": "0.43614012", "text": "func (function FunctionExpr) StandardName() string {\n\treturn function.standardName\n}", "title": "" }, { "docid": "9ff1c7af09565c82d87a16d8a243a6b5", "score": "0.43368387", "text": "func (gaugeCollection *StandardGaugeCollection) AddWithTag(reading int64, tag Tag) {\n\tgaugeCollection.mutex.Lock()\n\tdefer gaugeCollection.mutex.Unlock()\n\tgaugeReading := GaugeReading{\n\t\tReading: reading,\n\t\tTag: &Tag{\n\t\t\tName: tag.Name,\n\t\t\tValue: tag.Value,\n\t\t},\n\t\tTime: time.Now(),\n\t}\n\tgaugeCollection.readings = append(gaugeCollection.readings, gaugeReading)\n}", "title": "" }, { "docid": "3c42dc02abedc70c954ecaaf186b351a", "score": "0.43300322", "text": "func (n *Named) Add(name, hash, user string, overwrite bool) error {\n\tif !fiddleNameRe.MatchString(name) {\n\t\treturn fmt.Errorf(\"Not a valid fiddle name %q\", name)\n\t}\n\tif !fiddleHashRe.MatchString(hash) {\n\t\treturn fmt.Errorf(\"Not a valid fiddle hash %q\", hash)\n\t}\n\toldHash, err := n.DereferenceID(\"@\" + name)\n\tif err == nil {\n\t\t// This name exists already.\n\t\tif !overwrite {\n\t\t\treturn DuplicateNameErr\n\t\t}\n\t\tif oldHash == hash {\n\t\t\t// Don't bother writing if the hash is already correct.\n\t\t\treturn nil\n\t\t}\n\t\tsklog.Infof(\"Named Fiddle Changed: %s %s -> %s by %s\", name, oldHash, hash, user)\n\t} else {\n\t\tsklog.Infof(\"Named Fiddle Created: %s %s by %s\", name, hash, user)\n\t}\n\tif err := n.st.WriteName(name, hash, user, \"\"); err != nil {\n\t\treturn fmt.Errorf(\"Failed to write name: %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "99d400391e00a76d0a7c18ea2f38b1db", "score": "0.4301088", "text": "func NewStandard(ver uint8, fee uint64, R []byte) *Standard {\n\treturn &Standard{\n\t\tR: R,\n\t\tVersion: ver,\n\t\tFee: fee,\n\t\tTxType: StandardType,\n\t}\n}", "title": "" }, { "docid": "7142795fe82033bde8cb9b158a404ac1", "score": "0.42567444", "text": "func NewStandardHook(theType, hookDir string, upgradeables []string, cfg *config.Configuration) *Hook {\n\treturn &Hook{\n\t\tType: theType,\n\t\tContents: strings.Replace(hookBaseContent, \"{{Command}}\", theType, -1),\n\t\tDir: hookDir,\n\t\tupgradeables: upgradeables,\n\t\tcfg: cfg,\n\t}\n}", "title": "" }, { "docid": "187bcd844bb92c676a3e175c8f0776eb", "score": "0.42476875", "text": "func (g *Go2TS) Add(v interface{}) {\n\tg.AddToNamespace(v, \"\")\n}", "title": "" }, { "docid": "cbc2d972b6f3e5825e73108a4f1c9bb1", "score": "0.42417595", "text": "func (f *Feature) AddTag(key string, value interface{}) {\n\tf.tags = append(f.tags, tag{key, value})\n}", "title": "" }, { "docid": "fb7ab5a904a9017d264ccf2551c05d9e", "score": "0.42373443", "text": "func AddNameHook(hookPoint boil.HookPoint, nameHook NameHook) {\n\tswitch hookPoint {\n\tcase boil.BeforeInsertHook:\n\t\tnameBeforeInsertHooks = append(nameBeforeInsertHooks, nameHook)\n\tcase boil.BeforeUpdateHook:\n\t\tnameBeforeUpdateHooks = append(nameBeforeUpdateHooks, nameHook)\n\tcase boil.BeforeDeleteHook:\n\t\tnameBeforeDeleteHooks = append(nameBeforeDeleteHooks, nameHook)\n\tcase boil.BeforeUpsertHook:\n\t\tnameBeforeUpsertHooks = append(nameBeforeUpsertHooks, nameHook)\n\tcase boil.AfterInsertHook:\n\t\tnameAfterInsertHooks = append(nameAfterInsertHooks, nameHook)\n\tcase boil.AfterSelectHook:\n\t\tnameAfterSelectHooks = append(nameAfterSelectHooks, nameHook)\n\tcase boil.AfterUpdateHook:\n\t\tnameAfterUpdateHooks = append(nameAfterUpdateHooks, nameHook)\n\tcase boil.AfterDeleteHook:\n\t\tnameAfterDeleteHooks = append(nameAfterDeleteHooks, nameHook)\n\tcase boil.AfterUpsertHook:\n\t\tnameAfterUpsertHooks = append(nameAfterUpsertHooks, nameHook)\n\t}\n}", "title": "" }, { "docid": "b4341cd064f6fed6d3783c17e57f4aee", "score": "0.42301357", "text": "func (s *System) Add(basic *ecs.BasicEntity, space *common.SpaceComponent, control *Component) {\n\ts.entities = append(s.entities, entity{basic, space, control})\n}", "title": "" }, { "docid": "c4f1ecf70ca792db2ea906b28b125bf0", "score": "0.4213631", "text": "func (mr *metaResolver) AddBuiltin(kindName string, resolver resolve.Resolver) {\n\tmr.builtins[kindName] = resolver\n}", "title": "" }, { "docid": "a4fc8a5bd5aa30f74f98b827649f9f21", "score": "0.4206797", "text": "func applyTag(tagName, data string) string {\n\treturn fmt.Sprintf(\"<%s>%s</%s>\\n\", tagName, data, tagName)\n}", "title": "" }, { "docid": "bead298bd8dd13c34f66243e8888efde", "score": "0.4205679", "text": "func (b *ResponseBuilder) WithStandardCard(title, text string, image *Image) *ResponseBuilder {\n\tb.card = &Card{\n\t\tType: \"Standard\",\n\t\tTitle: title,\n\t\tText: text,\n\t\tImage: image,\n\t}\n\n\treturn b\n}", "title": "" }, { "docid": "820ff94d13467c92220c6958a5180a40", "score": "0.41914406", "text": "func bindUpgradedStandardToken(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(UpgradedStandardTokenABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "f1e6200d257025d525f07cec9a3b5358", "score": "0.41914073", "text": "func (g *Go2TS) AddWithNameToNamespace(v interface{}, interfaceName, namespace string) {\n\tg.add(v, interfaceName, namespace, doNotIgnoreNil)\n}", "title": "" }, { "docid": "285a996c6f9d205e66a62265a213a42b", "score": "0.41897228", "text": "func tagName(svc *ec2.EC2, ID *string, name string) {\n\ttagItExtra(svc, ID, \"Name\", name)\n}", "title": "" }, { "docid": "7005ba2613f5786976a00ac261f56625", "score": "0.41796562", "text": "func CreateTag(raw string) (Tag, error) {\n\tvar tag Tag\n\n\t// Check if the raw value could become a semanitc tag.\n\tmatched, err := regexp.MatchString(\"[0-9].[0-9].[0-9]\", raw)\n\tif !matched || err != nil {\n\t\treturn tag, errors.New(\"This is not a semantic tag.\")\n\t}\n\n\tslice := strings.Split(raw, \".\")\n\n\tmajor, err := strconv.Atoi(slice[0])\n\tif err != nil {\n\t\treturn tag, errors.New(\"Cannot get the major value.\")\n\t}\n\n\tminor, err := strconv.Atoi(slice[1])\n\tif err != nil {\n\t\treturn tag, errors.New(\"Cannot get the minor value.\")\n\t}\n\n\tpatch, err := strconv.Atoi(slice[2])\n\tif err != nil {\n\t\treturn tag, errors.New(\"Cannot get the patch value.\")\n\t}\n\n\ttag = Tag{\n\t\tMajor: major,\n\t\tMinor: minor,\n\t\tPatch: patch,\n\t}\n\n\treturn tag, nil\n}", "title": "" }, { "docid": "b9aeb13312139a02df231a5196f8356b", "score": "0.41790965", "text": "func (v Languages) Add(name Name) {\n\tv[name.Language] = name\n}", "title": "" }, { "docid": "3dd447b4fe04507fe1a34c138f04c647", "score": "0.41713125", "text": "func (m *Map) AddScene(name string, s Scene) error {\n\n\tif s.Start == nil {\n\t\ts.Start = func(*Context) {}\n\t}\n\tif s.End == nil {\n\t\ts.End = GoTo(name)\n\t}\n\n\tvar err error\n\tm.lock.Lock()\n\tif _, ok := m.scenes[name]; ok {\n\t\terr = oakerr.ExistingElement{\n\t\t\tInputName: name,\n\t\t\tInputType: \"scene\",\n\t\t\tOverwritten: false,\n\t\t}\n\t} else {\n\t\tm.scenes[name] = s\n\t}\n\tm.lock.Unlock()\n\n\treturn err\n}", "title": "" }, { "docid": "e2d33de702c48f326bba4f5c9c322ba3", "score": "0.41538608", "text": "func Add(name string, creator Creator) {\n\tInputs[name] = creator\n}", "title": "" }, { "docid": "6234e87a517d43eabd12781716be10d2", "score": "0.41421503", "text": "func (n *Name) Insert(index int, component NameComponent) error {\n\tif index < 0 || index >= n.Size() {\n\t\treturn util.ErrOutOfRange\n\t}\n\n\tn.components = append(n.components[:index], append([]NameComponent{component.DeepCopy()}, n.components[index:]...)...)\n\tn.wire = nil\n\tn.cachedString = \"\"\n\treturn nil\n}", "title": "" }, { "docid": "ca11f7a98e0b1f4e2dee0bee5af4b57b", "score": "0.4139319", "text": "func (g *Go2TS) AddWithNameToNamespaceIgnoreNil(v interface{}, interfaceName, namespace string) {\n\tg.add(v, interfaceName, namespace, ignoreNil)\n}", "title": "" }, { "docid": "8f1a558b6e17d259813c58cb6b366e50", "score": "0.4118089", "text": "func AddTag(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"content-type\", \"application/json\")\n\n\tvar tag models.Tag\n\terr := json.NewDecoder(r.Body).Decode(&tag)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tmodels.AddTag(tag)\n\tjson.NewEncoder(w).Encode(tag)\n}", "title": "" }, { "docid": "8afc46402fc64d54e296979c7ee8a4b0", "score": "0.41106984", "text": "func (w *Weights) Add(n string, v float64) error {\n\t_, ok := w.Map[n]\n\tif ok {\n\t\treturn fmt.Errorf(\"hepmc.Weights.Add: name [%s] already in container\", n)\n\t}\n\tidx := len(w.Slice)\n\tw.Map[n] = idx\n\tw.Slice = append(w.Slice, v)\n\treturn nil\n}", "title": "" }, { "docid": "713c1d238944fff9803261e61bb18eae", "score": "0.40974468", "text": "func (r *SimpleRegistry) WriteTag(ref regname.Tag, taggagle regremote.Taggable) error {\n\tif err := r.validateRef(ref); err != nil {\n\t\treturn err\n\t}\n\toverriddenRef, err := regname.NewTag(ref.String(), r.refOpts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\topts, err := r.writeOpts(overriddenRef)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = regremote.Tag(overriddenRef, taggagle, opts...)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Tagging image: %s\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a1db80c2ce35c4108f60ac4e5d21731f", "score": "0.40875563", "text": "func (p *Packet) Add(name string, value interface{}) error {\n\tattr, err := p.Dictionary.Attr(name, value)\n\tif err != nil {\n\t\treturn err\n\t}\n\tp.AddAttr(attr)\n\treturn nil\n}", "title": "" }, { "docid": "46db62451f386f0238fc584ec116d9a2", "score": "0.40839115", "text": "func (r *ProfileNamesCollectionRequest) Add(ctx context.Context, reqObj *PersonName) (resObj *PersonName, err error) {\n\terr = r.JSONRequest(ctx, \"POST\", \"\", reqObj, &resObj)\n\treturn\n}", "title": "" }, { "docid": "c92c3adcc1317d9844e5b03627c5b648", "score": "0.40809327", "text": "func (NilGaugeCollection) AddWithTag(value int64, tag Tag) {}", "title": "" }, { "docid": "153ab1f4c83dd4b3ba2cda2d7bbd510c", "score": "0.4079477", "text": "func AddSHATag(imageUrl string, extraTag string) error {\n\terr := crane.Tag(imageUrl, extraTag, crane.WithContext(context.TODO()))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "236ff4899fe52375929356a5c16e702c", "score": "0.40785754", "text": "func Tag(r *Repo, name, sha string, object bool) error {\n\trefPath := filepath.Join(\"tags\", name)\n\tif !object {\n\t\treturn createRef(r, refPath, sha)\n\t}\n\tto, err := ReadObject(r, sha)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\to := newTag(r)\n\to.KVLM.Append(\"tag\", name)\n\to.KVLM.Append(\"tagger\", \"dummy name <dummy@example.com>\")\n\to.KVLM.Append(\"object\", sha)\n\to.KVLM.Append(\"type\", to.Type)\n\to.KVLM.Append(\"\", \"Dummy commit message.\\n\")\n\n\ttagSHA, err := o.HashData(true)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn createRef(r, refPath, tagSHA)\n}", "title": "" }, { "docid": "2610d4fae1c72b681a543c95c5d4483e", "score": "0.40734845", "text": "func IsStdName(id string) bool {\n\tLoadStd()\n\n\t_, ok := stdpkgs[id]\n\treturn ok\n}", "title": "" }, { "docid": "9cd3e16b341feaac51d7e276ac6b1ef1", "score": "0.4056589", "text": "func (t *Tags) Add(tag string) error {\n\tif t.Exist(tag) != 0 {\n\t\treturn errors.New(\"tag name '\" + tag + \"' already exist\")\n\t}\n\t*t = append(*t, tag)\n\treturn nil\n}", "title": "" }, { "docid": "2f9f0b1e5b1f0a6de11b35d80f4d9676", "score": "0.40530822", "text": "func AddSystemConfig(name string, sysConfig *SystemConfig, makeDefault bool) error {\n\tappConfig.Systems[name] = *sysConfig\n\tif makeDefault {\n\t\tappConfig.Default = name\n\t\tviper.Set(\"default\", name)\n\t}\n\n\tviper.Set(\"systems\", appConfig.Systems)\n\terr := viper.WriteConfig()\n\treturn err\n}", "title": "" }, { "docid": "0b23dcaebedddc0ccb923da55a18040f", "score": "0.40504992", "text": "func (s *Set) Add(name string) *Tracer {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\t_, ok := s.tracers[name]\n\tif ok {\n\t\tpanic(fmt.Sprintf(\"a tracer named %s is already registered\", name))\n\t}\n\tbuffer := newBuffer(s.retain)\n\ttracer := newTracer(s, name, buffer)\n\ts.tracers[name] = tracer\n\treturn tracer\n}", "title": "" }, { "docid": "de3fcd9b0972ed75986f18d50f6ca2f9", "score": "0.40397286", "text": "func (r *StandardRegistry) Register(name string, i interface{}) error {\n\tr.mutex.Lock()\n\tdefer r.mutex.Unlock()\n\treturn r.register(name, i)\n}", "title": "" }, { "docid": "19d7c6f5dc13c2209c39a1b44b5c5aa7", "score": "0.40327358", "text": "func AddTag(t TagInfo) error {\n\tif len(t.Name) > MAX_TAG_LENGTH {\n\t\treturn ErrTagTooLong\n\t}\n\tvar component Component\n\ttag := Tag{Name: t.Name}\n\n\tif err := db.Where(&Component{ComponentChan: t.ComponentChan}).First(&component).Error; err != nil {\n\t\tif gorm.IsRecordNotFoundError(err) {\n\t\t\t// Check if the channel exists in slack\n\t\t\tchannel, err := getChanName(t.ComponentChan)\n\t\t\tif err != nil {\n\t\t\t\tlog.WithField(\"ComponentChannel\", t.ComponentChan).Error(\"Component channel is not valid\")\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlog.WithField(\"ComponentName\", channel).Error(\"Component is not in the DB\")\n\t\t\treturn ErrNoComponent\n\t\t}\n\t\tlog.Panic(err)\n\t}\n\n\tif err := db.Where(&tag).First(&tag).Error; err != nil {\n\t\tif gorm.IsRecordNotFoundError(err) {\n\t\t\tlog.WithField(\"tag\", tag.Name).Info(\"Adding new tag to DB\")\n\t\t} else {\n\t\t\tlog.Error(\"an error ocurred querying the database for tag\")\n\t\t\tlog.Panic(err)\n\t\t}\n\t}\n\n\tif db.NewRecord(tag) {\n\t\ttag.Components = append(tag.Components, component)\n\t\tif err := db.Create(&tag).Error; err != nil {\n\t\t\tlog.Error(\"Failed creating a tag in the database\")\n\t\t\tlog.Panic(err)\n\t\t}\n\t} else {\n\t\tif err := db.Model(&tag).Association(\"Components\").Append(component).Error; err != nil {\n\t\t\tlog.Error(\"Failed adding a tag association to the database\")\n\t\t\tlog.Panic(err)\n\t\t}\n\t}\n\tsupportChan, _ := getChanName(component.SupportChan)\n\tcomponentChan, _ := getChanName(component.ComponentChan)\n\tlog.WithFields(log.Fields{\"tag\": t.Name, \"support-channel\": supportChan, \"component-channel\": componentChan}).Info(\"added tag to the database\")\n\treturn nil\n}", "title": "" }, { "docid": "6eccb02b1ef2c8f29f4f05bfb985f90e", "score": "0.40303096", "text": "func (g *Go2TS) AddUnionWithNameToNamespace(v interface{}, typeName, namespace string) {\n\t// We can only build union types from Go slices or arrays.\n\treflectType := reflect.TypeOf(v)\n\tif reflectType.Kind() != reflect.Slice && reflectType.Kind() != reflect.Array {\n\t\tpanic(fmt.Sprintf(\"AddUnionWithName must be supplied an array or slice, got %v: %v\", reflectType.Kind(), v))\n\t}\n\n\t// Make sure we have a name for the union type.\n\tif typeName == \"\" {\n\t\ttypeName = reflectType.Elem().Name()\n\t}\n\n\t// We will populate the union type with the typescript.LiteralTypes corresponding to the elements\n\t// in the passed in Go slice.\n\tunionType := &typescript.UnionType{\n\t\tTypes: []typescript.Type{},\n\t}\n\n\t// Iterate over all elements in the passed in Go slice.\n\tvalues := reflect.ValueOf(v)\n\tfor i := 0; i < values.Len(); i++ {\n\t\tvalue := values.Index(i)\n\n\t\t// Obtain the typescript.BasicType corresponding to the current element. We only support basic\n\t\t// types; any other types will result in a panic.\n\t\tvar basicType typescript.BasicType\n\t\tif value.Kind() == reflect.Bool {\n\t\t\tbasicType = typescript.Boolean\n\t\t} else if isNumber(value.Kind()) {\n\t\t\tbasicType = typescript.Number\n\t\t} else if value.Kind() == reflect.String {\n\t\t\tbasicType = typescript.String\n\t\t} else {\n\t\t\tpanic(fmt.Sprintf(\"Go Kind %q cannot be used in a TypeScript union type.\", value.Kind()))\n\t\t}\n\n\t\t// Create a typescript.LiteralType for the current element and add it to the union type.\n\t\tunionType.Types = append(unionType.Types, &typescript.LiteralType{\n\t\t\tBasicType: basicType,\n\t\t\tLiteral: fmt.Sprintf(\"%v\", values.Index(i).Interface()),\n\t\t})\n\t}\n\n\tif existingTypeDeclaration, ok := g.typeDeclarations[reflectType.Elem()]; ok {\n\t\t// The reflect.Type was already added, so if it's a TypeScript type alias, we'll update it to be\n\t\t// an alias for the newly added union type.\n\t\texistingTypeAliasDeclaration, ok := existingTypeDeclaration.(*typescript.TypeAliasDeclaration)\n\t\tif !ok {\n\t\t\tpanic(fmt.Sprintf(\"Go type %v was already added as something other than a TypeScript type alias.\", reflectType.Elem()))\n\t\t}\n\t\texistingTypeAliasDeclaration.Namespace = namespace\n\t\texistingTypeAliasDeclaration.Identifier = typeName\n\t\texistingTypeAliasDeclaration.Type = unionType\n\t} else {\n\t\t// The reflect.Type hasn't been seen before, so we declare a new type alias for the union type.\n\t\tg.getOrSaveTypeDeclaration(reflectType.Elem(), &typescript.TypeAliasDeclaration{\n\t\t\tNamespace: namespace,\n\t\t\tIdentifier: typeName,\n\t\t\tType: unionType,\n\t\t})\n\t}\n}", "title": "" }, { "docid": "828c2596e9b9f64f2c817069f2f9153d", "score": "0.40053707", "text": "func (m *Model) AddSystem(s *SoftwareSystem) *SoftwareSystem {\n\texisting := m.SoftwareSystem(s.Name)\n\tif existing == nil {\n\t\tIdentify(s)\n\t\tm.Systems = append(m.Systems, s)\n\t\treturn s\n\t}\n\tif s.Description != \"\" {\n\t\texisting.Description = s.Description\n\t}\n\tif olddsl := existing.DSLFunc; olddsl != nil {\n\t\texisting.DSLFunc = func() { olddsl(); s.DSLFunc() }\n\t}\n\treturn existing\n}", "title": "" }, { "docid": "936403b8a50cffebc7cfe3c9cedfab4b", "score": "0.39953187", "text": "func (t *WGTags) AddTag(k string, v string) {\n\tt.tags = append(t.tags, &athena.Tag{\n\t\tKey: &k,\n\t\tValue: &v})\n}", "title": "" }, { "docid": "8a1aa2f83610eb798fd2d20ec1bdf519", "score": "0.39947933", "text": "func (s *Shell) RegisterShellBuiltin(name string, builtin ShellBuiltin) {\n\tif s.shellBuiltins == nil {\n\t\ts.shellBuiltins = make(map[string]ShellBuiltin)\n\t}\n\ts.shellBuiltins[name] = builtin\n}", "title": "" }, { "docid": "23d6c9aaaf19cb85297893d5930e4f24", "score": "0.39873165", "text": "func (m *Manifest) IsStandardSupported(standard string) bool {\n\tfor _, st := range m.SupportedStandards {\n\t\tif st == standard {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "aa7042426534a8c88661b13f27abe9cb", "score": "0.39865896", "text": "func (f *Flow) Add(name, component string) error {\n\tct, ok := registry[component]\n\tif !ok {\n\t\treturn fmt.Errorf(\"component %q not registered\", component)\n\t}\n\tci := reflect.New(ct)\n\tf.components[name] = ci\n\tf.add.Func.Call([]reflect.Value{reflect.ValueOf(f.net), reflect.ValueOf(name), ci})\n\treturn nil\n}", "title": "" }, { "docid": "da90eaf3fbe475579aaf40ef0c35e239", "score": "0.39837474", "text": "func (b Extra) IsStandard() bool {\n\treturn !b.hasComment()\n}", "title": "" }, { "docid": "38eb7a41a187887ce7f5c8b6a6415999", "score": "0.39821497", "text": "func (this *BuildContext) AddSymbol(symbol string) string {\n\n\tvar translatedSymbol string\n\n\ttranslatedSymbol = strings.Replace(symbol, \".\", NAMESPACE_SEPARATOR, -1)\n\tthis.symbols[symbol] = translatedSymbol\n\treturn translatedSymbol\n}", "title": "" }, { "docid": "9934f159d00edab6714e588b638f465a", "score": "0.39730015", "text": "func newStandardModel(std *root.Standard) (*standardModel) {\n\tstandard_model := standardModel{StandardName: std.StandardName, Controls:std.Controls}\n\treturn &standard_model\n}", "title": "" }, { "docid": "d56cffdbff73bf75bb2e4f005abd6e37", "score": "0.39589024", "text": "func (bldr TxBuilder) SignStdTx(name, passphrase string, stdTx auth.StdTx, appendSig bool) (signedStdTx auth.StdTx, err error) {\n\tif bldr.chainID == \"\" {\n\t\treturn auth.StdTx{}, fmt.Errorf(\"chain ID required but not specified\")\n\t}\n\n\tstdSignature, err := MakeSignature(bldr.keybase, name, passphrase, StdSignMsg{\n\t\tChainID: bldr.chainID,\n\t\tAccountNumber: bldr.accountNumber,\n\t\tSequence: bldr.sequence,\n\t\tFee: stdTx.Fee,\n\t\tMsgs: stdTx.GetMsgs(),\n\t\tMemo: stdTx.GetMemo(),\n\t})\n\tif err != nil {\n\t\treturn\n\t}\n\n\tsigs := stdTx.GetSignatures()\n\tif len(sigs) == 0 || !appendSig {\n\t\tsigs = []auth.StdSignature{stdSignature}\n\t} else {\n\t\tsigs = append(sigs, stdSignature)\n\t}\n\tsignedStdTx = auth.NewStdTx(stdTx.GetMsgs(), stdTx.Fee, sigs, stdTx.GetMemo())\n\treturn\n}", "title": "" }, { "docid": "16bc9634466f72fc18b967a11bced432", "score": "0.39545617", "text": "func (s *Standard) Encode(w io.Writer) error {\n\n\tif err := encoding.WriteUint8(w, uint8(s.TxType)); err != nil {\n\t\treturn err\n\t}\n\n\tif err := encoding.Write256(w, s.R); err != nil {\n\t\treturn err\n\t}\n\n\tif err := encoding.WriteUint8(w, uint8(s.Version)); err != nil {\n\t\treturn err\n\t}\n\n\tif err := encoding.WriteVarInt(w, uint64(len(s.Inputs))); err != nil {\n\t\treturn err\n\t}\n\n\tfor _, input := range s.Inputs {\n\t\tif err := input.Encode(w); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err := encoding.WriteVarInt(w, uint64(len(s.Outputs))); err != nil {\n\t\treturn err\n\t}\n\n\tfor _, output := range s.Outputs {\n\t\tif err := output.Encode(w); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := encoding.WriteUint64(w, binary.LittleEndian, s.Fee); err != nil {\n\t\treturn err\n\t}\n\n\tif err := encoding.WriteVarBytes(w, s.RangeProof); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4ac90da4ddcfa77337291c8875d76883", "score": "0.39484033", "text": "func InsertStandardCode(sc model.StandardCode) (sql.Result, error) {\n\tif len(sc.Code) > 50 {\n\t\treturn nil, fmt.Errorf(\"standard code too long. do not exceed 50 characters\")\n\t}\n\tif len(sc.Description) > 50 {\n\t\treturn nil, fmt.Errorf(\"standard description too long. do not exceed 50 characters\")\n\t}\n\n\tqry := `SELECT code_type_id FROM code_type WHERE description = $1;`\n\n\trow := model.Db.QueryRow(qry, sc.CodeType.Description)\n\n\tvar id int\n\tvar qry2 string\n\tswitch err := row.Scan(&id); err {\n\tcase sql.ErrNoRows:\n\t\treturn nil, fmt.Errorf(\"code type not found. please verify\")\n\tcase nil:\n\t\tqry2 = \"INSERT INTO standard_code (code, description, type_id, created_user, modified_user) VALUES ('\" + sc.Code + \"', '\" + sc.Description + \"', '\" + strconv.Itoa(id) + \"', '\" + model.AppUser + \"', '\" + model.AppUser + \"');\"\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"error finding code type please verify\")\n\t}\n\n\tr, err := model.Db.Exec(qry2)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn r, nil\n}", "title": "" }, { "docid": "0c455d69b8f03eac304b13d7ef438fc1", "score": "0.3923999", "text": "func parseStandard(data []byte) (XMLStandard, error) {\n\tvar standard XMLStandard\n\n\tif err := xml.Unmarshal(data, &standard); err != nil {\n\t\treturn standard, err\n\t}\n\n\treturn standard, nil\n}", "title": "" }, { "docid": "d691b6d068ef195f39e4d072f99a5bde", "score": "0.3922543", "text": "func (r DefaultRegistry) Add(name, version, endpoint string) {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\n\tservice, ok := r[name]\n\tif !ok {\n\t\tservice = map[string][]string{}\n\t\tr[name] = service\n\t}\n\tservice[version] = append(service[version], endpoint)\n}", "title": "" }, { "docid": "dc0abc8ba084eaa78bffaa63832529fa", "score": "0.39166665", "text": "func (gen *Generator) Add(infos ...Info) {\n\tlogger := gen.log\n\tfor _, info := range infos {\n\t\tif info.Name == \"\" {\n\t\t\t// dont create event for resources with generateName\n\t\t\t// as the name is not generated yet\n\t\t\tlogger.V(4).Info(\"not creating an event as the resource has not been assigned a name yet\", \"kind\", info.Kind, \"name\", info.Name, \"namespace\", info.Namespace)\n\t\t\tcontinue\n\t\t}\n\t\tgen.queue.Add(info)\n\t}\n}", "title": "" }, { "docid": "ef84bdb1a1667173afd54231684aa26b", "score": "0.39160615", "text": "func (i Using) ADDTagPair(tagName string, tagValue interface{}) Using {\n\ti.tagParis[tagName] = tagValue\n\treturn i\n}", "title": "" }, { "docid": "e5225a8cc74170c4cb594fa236f9e613", "score": "0.3914885", "text": "func (s *ObdInterface) SetObdStandard(v string) *ObdInterface {\n\ts.ObdStandard = &v\n\treturn s\n}", "title": "" }, { "docid": "60fd3b6cadd2be02f52934b38854d313", "score": "0.39080364", "text": "func (d *Dictionary) Register(name string, t byte, codec AttributeCodec) error {\n\td.mu.Lock()\n\tif d.attributesByType[t] != nil {\n\t\td.mu.Unlock()\n\t\treturn errors.New(\"radius: attribute already registered\")\n\t}\n\tentry := &dictEntry{\n\t\tType: t,\n\t\tName: name,\n\t\tCodec: codec,\n\t}\n\td.attributesByType[t] = entry\n\tif d.attributesByName == nil {\n\t\td.attributesByName = make(map[string]*dictEntry)\n\t}\n\td.attributesByName[name] = entry\n\td.mu.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "28c2e125f50d56bea9aae940adefe42a", "score": "0.39045417", "text": "func IsStandardLibrary(v *spb.VName) bool {\n\treturn v != nil && (v.Language == \"go\" || v.Language == \"\") && v.Corpus == GolangCorpus\n}", "title": "" }, { "docid": "72442cb6484a1adfe5402b5436736e8e", "score": "0.39034182", "text": "func tagAddNewTag(L *lua.LState) int {\n\ttag := checkTag(L) // arg 1\n\tname := L.ToString(2)\n\tif name == \"\" {\n\t\tL.ArgError(2, \"tag name expected\")\n\t\treturn 0 // no results\n\t}\n\n\t// Create a new Tag\n\tnewTag := tag.AddNewTag(name)\n\n\t// Create a new userdata struct\n\tud := L.NewUserData()\n\tud.Value = newTag\n\tL.SetMetatable(ud, L.GetTypeMetatable(TagClass))\n\n\t// Return the newly created userdata\n\tL.Push(ud)\n\treturn 1 // number of results\n}", "title": "" }, { "docid": "adcf980de7786b646280885279b1d5d7", "score": "0.38969317", "text": "func (s *Script) Add(name string, value interface{}) error {\n\tif name == reservedVar {\n\t\treturn errors.New(\"variable name must be different\")\n\t}\n\n\tv, err := tengo.NewVariable(name, value)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.variables[name] = v\n\treturn nil\n}", "title": "" }, { "docid": "3f6421a2adc525aef5416f34f3dc2390", "score": "0.3895266", "text": "func (a UserAttributes) Add(name, value string) {\n\ta[name] = append(a[name], value)\n}", "title": "" }, { "docid": "972966e37b9f3ae54e87449eb867ee6f", "score": "0.38948712", "text": "func (a *Auth0) AddSystem(s *System) error {\n\t_ = a.init()\n\n\t// If we're dealing with an empty file, we'll need to initialize this map.\n\tif a.config.Systems == nil {\n\t\ta.config.Systems = map[string]*System{}\n\t}\n\n\ta.config.Systems[a.system] = s\n\n\tif err := a.persistConfig(); err != nil {\n\t\treturn fmt.Errorf(\"unexpected error persisting config: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "578e1c81fb52c66a6821966f34bc0360", "score": "0.38839424", "text": "func RegisterName(name string, rcvr interface{}) error {}", "title": "" }, { "docid": "e33cad9a963e468819642c2178564961", "score": "0.38806948", "text": "func addFreeName(tx *bolt.Tx, family string, name string) error {\n\tb, err := tx.CreateBucketIfNotExists(freeNamesBucket)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn b.Put(familyNameToKey(family, name), freeValue)\n}", "title": "" }, { "docid": "178c6c3ed800f48f62b3133be5b1e415", "score": "0.38800523", "text": "func AddHook(hook Hook) {\n std.AddHook(hook)\n}", "title": "" }, { "docid": "28b8a9981141e0cf0ae32aa0532cbb2e", "score": "0.38717747", "text": "func (g *StatsGroup) Add(name string, n uint64) {\n\tif e, ok := g.entries[name]; ok {\n\t\te.Add(n)\n\t} else {\n\t\tg.defent.Add(n)\n\t}\n}", "title": "" }, { "docid": "f6a3bd0f1cf238ad88548dd1a75d467b", "score": "0.38508588", "text": "func (t *Tags) Add(tag Tag) *Tags {\n\n\ttagAlreadyExists, _ := t.Get(tag.Name)\n\n\tif tagAlreadyExists == nil {\n\t\tt.Tags = append(t.Tags, tag)\n\t}\n\n\treturn t\n}", "title": "" }, { "docid": "b17044950411003c4fc9019c26e5800a", "score": "0.3846903", "text": "func IsStandard(imp string) bool {\n\treturn stdPackages[imp]\n}", "title": "" }, { "docid": "17af44b0f65dd7567deeb82ac1f01736", "score": "0.384675", "text": "func (s *state) addNamedValue(n *Node, v *ssa.Value) {\n\tif n.class == Pxxx {\n\t\t// Don't track our dummy nodes (&memVar etc.).\n\t\treturn\n\t}\n\tif v == nil {\n\t\tpanic(\"nil *ssa.Value\")\n\t}\n\tif v.Type == nil {\n\t\tpanic(\"nil v.Type (*ssa.Value)\")\n\t}\n\tif n.class == PAUTO && (v.Type.IsString() || v.Type.IsSlice() || v.Type.IsInterface()) {\n\t\t// TODO: can't handle auto compound objects with pointers yet.\n\t\treturn\n\t}\n\t// if n.Class == PAUTO && n.Xoffset != 0 {\n\t// \ts.Fatalf(\"AUTO var with offset %s %d\", n, n.Xoffset)\n\t// }\n\n\tloc := ssa.LocalSlot{N: n, Type: n.Typ(), Off: 0}\n\tvalues, ok := s.f.NamedValues[loc]\n\tif !ok {\n\t\ts.f.Names = append(s.f.Names, loc)\n\t}\n\ts.f.NamedValues[loc] = append(values, v)\n}", "title": "" }, { "docid": "a4da905c9be48b7a10bb293c53101247", "score": "0.38458937", "text": "func (s *Scene) AddSystem(system System) {\n\ts.systems = append(s.systems, system)\n\n\tif s.isInitialized {\n\t\ts.addSystemAfterInit(system)\n\t}\n}", "title": "" }, { "docid": "211aa7a9d2ce27d3249ced066c694729", "score": "0.3845565", "text": "func (w WorkspaceEdit) Add(loc Location, newText string) {\n\tl := w[loc.URI]\n\tl.Add(loc.Range, newText)\n\tw[loc.URI] = l\n}", "title": "" }, { "docid": "d4b6976dca74973494f8b32a0917891e", "score": "0.38447216", "text": "func (r *Report) AddStyle(\n\tname string,\n\tfontFamily string,\n\tfontStyle string,\n\tfontSize float64,\n\talignment int,\n) {\n\tr.Styles[name] = Style{\n\t\tFontFamily: fontFamily,\n\t\tFontStyle: fontStyle,\n\t\tFontSize: fontSize,\n\t\tAlignment: alignment,\n\t}\n}", "title": "" }, { "docid": "3e74ec42bfdc20aef3e42b1ceb00f28b", "score": "0.38390723", "text": "func (w *Watcher) Add(ctx context.Context, kc *k8s.Client, namespace, name string) error {\n\tw.mu.Lock()\n\tdefer w.mu.Unlock()\n\n\tfor _, r := range w.resources {\n\t\tif r.Name() == name {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tres, err := w.prototyper.Changeable(ctx, kc, namespace, name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tw.resources = append(w.resources, res)\n\treturn nil\n}", "title": "" }, { "docid": "5ee6197f2db96f1bb554bd7a0d5d1c37", "score": "0.3830472", "text": "func AddUsage(name, usage string) {\n\tusages[name] = usage\n}", "title": "" }, { "docid": "6e88bd61d7368853a4756bd7fb65bf85", "score": "0.3821976", "text": "func (c *Context) AddValue(name string, value Value) {\n\tif _, ok := c.FindValue(name, false); ok {\n\t\tpanicf(\"name `%s' is already defined in this scope\", name)\n\t}\n\tc.symbols = append(c.symbols, &Symbol{\n\t\tName: name,\n\t\tValue: value,\n\t})\n}", "title": "" }, { "docid": "13e05382c361751c2169074519aa9abd", "score": "0.3821038", "text": "func Add(name string, creator Creator) {\n\tSerializers[name] = creator\n}", "title": "" }, { "docid": "cb9c758b0261aefa797d7a0e16f6f8d4", "score": "0.38185027", "text": "func WithName(v string) Pair {\n\treturn Pair{\n\t\tKey: \"name\",\n\t\tValue: v,\n\t}\n}", "title": "" }, { "docid": "5156d210ed6f903e1c3ca798f5d2f8ed", "score": "0.380915", "text": "func (su *SongUpdate) AddName(i int) *SongUpdate {\n\tif su.addname == nil {\n\t\tsu.addname = &i\n\t} else {\n\t\t*su.addname += i\n\t}\n\treturn su\n}", "title": "" }, { "docid": "06b10259f9b661cd8bd4c97fe3dd6151", "score": "0.38069224", "text": "func AddNamedImport(fset *token.FileSet, f *ast.File, name, path string) {\n\tnewImport := &ast.ImportSpec{\n\t\tName: &ast.Ident{Name: name},\n\t\tPath: &ast.BasicLit{\n\t\t\tKind: token.STRING,\n\t\t\tValue: strconv.Quote(path),\n\t\t},\n\t}\n\n\tvar (\n\t\tlastImport = -1 // index in f.Decls of the file's final import decl\n\t\timpDecl *ast.GenDecl // import decl containing the best match\n\t)\n\tfor i, decl := range f.Decls {\n\t\tgen, ok := decl.(*ast.GenDecl)\n\t\tif ok && gen.Tok == token.IMPORT {\n\t\t\tlastImport = i\n\t\t\timpDecl = gen\n\t\t\tbreak\n\t\t}\n\t}\n\timpDecl = &ast.GenDecl{\n\t\tTok: token.IMPORT,\n\t}\n\timpDecl.TokPos = f.Decls[lastImport].End()\n\tf.Decls = append(f.Decls, nil)\n\tcopy(f.Decls[lastImport+2:], f.Decls[lastImport+1:])\n\tf.Decls[lastImport+1] = impDecl\n\n\t// Insert new import at insertAt.\n\tinsertAt := 0\n\timpDecl.Specs = append(impDecl.Specs, nil)\n\tcopy(impDecl.Specs[insertAt+1:], impDecl.Specs[insertAt:])\n\timpDecl.Specs[insertAt] = newImport\n\tpos := impDecl.Pos()\n\tnewImport.Name.NamePos = pos\n\tnewImport.Path.ValuePos = pos\n\tnewImport.EndPos = pos\n\n\t// Clean up parens. impDecl contains at least one spec.\n\tif len(impDecl.Specs) == 1 {\n\t\t// Remove unneeded parens.\n\t\timpDecl.Lparen = token.NoPos\n\t} else if !impDecl.Lparen.IsValid() {\n\t\t// impDecl needs parens added.\n\t\timpDecl.Lparen = impDecl.Specs[0].Pos()\n\t}\n\n\tf.Imports = append(f.Imports, newImport)\n}", "title": "" }, { "docid": "c19481e32ed6c6bafdb86ea9d96018e0", "score": "0.38055184", "text": "func AddContainerName(metricAnnotations data.InterfaceMap, containerName string) {\n\tmetricAnnotations[data.ContainerName] = containerName\n}", "title": "" }, { "docid": "2ad0eebe8f450a88b361c94c954554ae", "score": "0.38039044", "text": "func (p Profile) Add(name string, a ...interface{}) {\n\tp[name] = fmt.Sprint(a...)\n}", "title": "" }, { "docid": "190f829e8d0c1d0e742219ff80d2f6eb", "score": "0.3803476", "text": "func Name(k string) ZapTag {\n\treturn NewStringTag(\"name\", k)\n}", "title": "" } ]
f643c9e2e315ba44e39264511f3ec527
Pwrite is an alias of golang.org/x/sys/unix.Pwrite, wrapped to automatically retry on EINTR.
[ { "docid": "6ee649b2ec6950b2baddbf299bbf0f8b", "score": "0.80038136", "text": "func Pwrite(fd int, p []byte, offset int64) (n int, err error) {\n\tfor {\n\t\tn, err = unix.Pwrite(fd, p, offset)\n\t\tif err != syscall.EINTR {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "93014fdd7a78e789223d6cd0e52fe540", "score": "0.73224205", "text": "func (fd *FD) Pwrite(p []byte, off int64) (int, error) {\n\t// Call incref, not writeLock, because since pwrite specifies the\n\t// offset it is independent from other writes.\n\t// Similarly, using the poller doesn't make sense for pwrite.\n\tif err := fd.incref(); err != nil {\n\t\treturn 0, err\n\t}\n\tdefer fd.decref()\n\tvar nn int\n\tfor {\n\t\tmax := len(p)\n\t\tif fd.IsStream && max-nn > maxRW {\n\t\t\tmax = nn + maxRW\n\t\t}\n\t\tn, err := syscall.Pwrite(fd.Sysfd, p[nn:max], off+int64(nn))\n\t\tif err == syscall.EINTR {\n\t\t\tcontinue\n\t\t}\n\t\tif n > 0 {\n\t\t\tnn += n\n\t\t}\n\t\tif nn == len(p) {\n\t\t\treturn nn, err\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nn, err\n\t\t}\n\t\tif n == 0 {\n\t\t\treturn nn, io.ErrUnexpectedEOF\n\t\t}\n\t}\n}", "title": "" }, { "docid": "61b39a7c5d52fbd8dce4f83df0991c36", "score": "0.71020764", "text": "func Pwrite(fd int, buf []byte, off int64) int {\n\tpdwfs.lock.Lock()\n\tdefer pdwfs.lock.Unlock()\n\tfile, err := pdwfs.getFileFromFd(fd)\n\tcheck(err)\n\n\tn, err := (*file).WriteAt(buf, off)\n\tif err != nil {\n\t\tif e, ok := err.(*os.PathError); ok && e.Err == redisfs.ErrNegativeOffset {\n\t\t\tsetErrno(C.EINVAL)\n\t\t\tC.perror(C.CString(e.Err.Error()))\n\t\t} else {\n\t\t\tpanic(fmt.Sprintf(\"unhandled %T in Pwrite: %s\", err, err))\n\t\t}\n\t\treturn -1\n\t}\n\treturn n\n}", "title": "" }, { "docid": "d0026f8cc3c27b6aa4d068fb4eaf2be1", "score": "0.7064335", "text": "func pwrite(fd int, p []byte, offset int64) (n int, err error) {\n\tvar _p0 unsafe.Pointer\n\tif len(p) > 0 {\n\t\t_p0 = unsafe.Pointer(&p[0])\n\t} else {\n\t\t_p0 = unsafe.Pointer(&_zero)\n\t}\n\tr0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)\n\tn = int(r0)\n\tif e1 != 0 {\n\t\terr = errnoErr(e1)\n\t}\n\treturn\n}", "title": "" }, { "docid": "f5f5abdb149e914ad037dedc56dc35eb", "score": "0.68413436", "text": "func Write(fd int, p []byte) (n int, err error) {\n\tfor {\n\t\tn, err = unix.Write(fd, p)\n\t\tif err != syscall.EINTR {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "67b3f70e91dec2e9c1763bc6d5ade1b7", "score": "0.67037755", "text": "func Pwritev(fd int, iovs [][]byte, offset int64) (n int, err error) {\n\tfor {\n\t\tn, err = unix.Pwritev(fd, iovs, offset)\n\t\tif err != syscall.EINTR {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "0cbde6d23163125893374c111c8cf5c2", "score": "0.66361094", "text": "func (ew Writer) Write(p []byte) (int, error) {\nagain:\n\tn, err := ew.writer.Write(p)\n\tif err == nil {\n\t\treturn n, nil\n\t}\n\n\t// keep retrying on EAGAIN\n\tok, errno := getErrno(err)\n\tif ok && (errno == syscall.EAGAIN || errno == syscall.EINTR) {\n\t\tgoto again\n\t}\n\n\treturn n, err\n}", "title": "" }, { "docid": "a472628903f73a83d3f3cceea5d545af", "score": "0.653068", "text": "func Pwritev2(fd int, iovs [][]byte, offset int64, flags int) (n int, err error) {\n\tfor {\n\t\tn, err = unix.Pwritev2(fd, iovs, offset, flags)\n\t\tif err != syscall.EINTR {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "84d1ec8e78f395f5ac5f5173a5065c0b", "score": "0.64008343", "text": "func (w *Writer) Write(p []byte) (n int, err error) {\n\tw.mu.Lock()\n\twerr := w.err\n\tw.mu.Unlock()\n\tif werr != nil {\n\t\treturn 0, werr\n\t}\n\tif !w.opened {\n\t\tif err := w.openWriter(); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\tn, err = w.pw.Write(p)\n\tif err != nil {\n\t\tw.mu.Lock()\n\t\twerr := w.err\n\t\tw.mu.Unlock()\n\t\t// Preserve existing functionality that when context is canceled, Write will return\n\t\t// context.Canceled instead of \"io: read/write on closed pipe\". This hides the\n\t\t// pipe implementation detail from users and makes Write seem as though it's an RPC.\n\t\tif errors.Is(werr, context.Canceled) || errors.Is(werr, context.DeadlineExceeded) {\n\t\t\treturn n, werr\n\t\t}\n\t}\n\treturn n, err\n}", "title": "" }, { "docid": "1a288a28374e18cc41735bc42675e731", "score": "0.6010567", "text": "func (fd *FD) Write(p []byte) (nn int, err error) {\n\tif err := fd.writeLock(); err != nil {\n\t\treturn 0, err\n\t}\n\tdefer fd.writeUnlock()\n\tif err := fd.pd.PrepareWrite(); err != nil {\n\t\treturn 0, err\n\t}\n\tfor {\n\t\tvar n int\n\t\tn, err = syscall.Write(fd.sysfd, p[nn:])\n\t\tif err != nil {\n\t\t\tn = 0\n\t\t\tif err != syscall.EAGAIN {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\terr = fd.pd.WaitWrite()\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif n == 0 {\n\t\t\terr = io.ErrUnexpectedEOF\n\t\t\tbreak\n\t\t}\n\t\tnn += n\n\t\tif nn == len(p) {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nn, err\n}", "title": "" }, { "docid": "c245ee6cabebfec554688dd14fdca2a8", "score": "0.6010348", "text": "func syscall_write(fd, buf, nbyte uintptr) (n, err uintptr) {\n\tcall := libcall{\n\t\tfn: uintptr(unsafe.Pointer(&libc_write)),\n\t\tn: 3,\n\t\targs: uintptr(unsafe.Pointer(&fd)),\n\t}\n\tasmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))\n\treturn call.r1, call.err\n}", "title": "" }, { "docid": "7a2dbbb70490843b2745f5b1145acc4e", "score": "0.5984121", "text": "func (s *pfkeysocket) Write(b []byte) (int, error) {\n\tn, err := unix.Write(s.fd, b)\n\treturn n, err\n}", "title": "" }, { "docid": "3a5e5bcffabb46ad8e57ee67c52e73d1", "score": "0.59178877", "text": "func Pwritev(fd int, iov [][]byte, off int64) int {\n\tpdwfs.lock.Lock()\n\tdefer pdwfs.lock.Unlock()\n\tfile, err := pdwfs.getFileFromFd(fd)\n\tcheck(err)\n\n\tn, err := (*file).WriteVecAt(iov, off)\n\tif err != nil {\n\t\tif e, ok := err.(*os.PathError); ok && e.Err == redisfs.ErrNegativeOffset {\n\t\t\tsetErrno(C.EINVAL)\n\t\t\tC.perror(C.CString(err.Error()))\n\t\t} else {\n\t\t\tpanic(fmt.Sprintf(\"unhandled %T in Pwritev: %s\", err, err))\n\t\t}\n\t\treturn -1\n\t}\n\treturn n\n}", "title": "" }, { "docid": "c8327ab34ecf84fcd5895c1247ba13ac", "score": "0.58940226", "text": "func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) {\n\tfor {\n\t\terr = unix.Prctl(option, arg2, arg3, arg4, arg5)\n\t\tif err != syscall.EINTR {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "6f8421f625a286f04e5c50264d3142c5", "score": "0.58562857", "text": "func (p *port) Write(b []byte) (n int, err error) {\n\tvar done uint32\n\tif err = syscall.WriteFile(p.handle, b, &done, nil); err != nil {\n\t\treturn\n\t}\n\tn = int(done)\n\treturn\n}", "title": "" }, { "docid": "2ce51759bf315ba4c4a478f050a230fa", "score": "0.5848257", "text": "func PWriteHandler(c *Connection, comm Communicator, payloadLen uint32) (uint32, error) {\n\tif c.readonly {\n\t\treturn 0, unix.EROFS\n\t}\n\tvar req PWriteReq\n\t// Note that it is an optimized Unmarshal operation which avoids any buffer\n\t// allocation and copying. req.Buf just points to payload. This is safe to do\n\t// as the handler owns payload and req's lifetime is limited to the handler.\n\treq.UnmarshalBytes(comm.PayloadBuf(payloadLen))\n\tfd, err := c.LookupOpenFD(req.FD)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tif !fd.writable {\n\t\treturn 0, unix.EBADF\n\t}\n\treturn fd.impl.Write(c, comm, req.Buf, uint64(req.Offset))\n}", "title": "" }, { "docid": "487b784620b9e45c280a80411cf29624", "score": "0.5809202", "text": "func Pread(fd int, p []byte, offset int64) (n int, err error) {\n\tfor {\n\t\tn, err = unix.Pread(fd, p, offset)\n\t\tif err != syscall.EINTR {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "8891d51b6ecba6cc24f50369876ed1b4", "score": "0.57207894", "text": "func (r *RingBuffer) TryWrite(p []byte) (n int, err error) {\n\tif len(p) == 0 {\n\t\treturn 0, nil\n\t}\n\tok := r.mu.TryLock()\n\tif !ok {\n\t\treturn 0, ErrAccuqireLock\n\t}\n\n\tn, err = r.write(p)\n\tr.mu.Unlock()\n\n\treturn n, err\n}", "title": "" }, { "docid": "f7f7424e01c6f93ba928c877c826d82a", "score": "0.57089424", "text": "func (fd *FD) Pread(p []byte, off int64) (int, error) {\n\t// Call incref, not readLock, because since pread specifies the\n\t// offset it is independent from other reads.\n\t// Similarly, using the poller doesn't make sense for pread.\n\tif err := fd.incref(); err != nil {\n\t\treturn 0, err\n\t}\n\tif fd.IsStream && len(p) > maxRW {\n\t\tp = p[:maxRW]\n\t}\n\tvar (\n\t\tn int\n\t\terr error\n\t)\n\tfor {\n\t\tn, err = syscall.Pread(fd.Sysfd, p, off)\n\t\tif err != syscall.EINTR {\n\t\t\tbreak\n\t\t}\n\t}\n\tif err != nil {\n\t\tn = 0\n\t}\n\tfd.decref()\n\terr = fd.eofError(n, err)\n\treturn n, err\n}", "title": "" }, { "docid": "4d9b2d4a9a50eadecb71d59a65ce868d", "score": "0.570689", "text": "func (res *Responder) Write(p []byte) (int, error) {\n\tif res.err != nil {\n\t\treturn 0, res.err\n\t}\n\n\tres.written = true\n\tn, err := res.w.Write(p)\n\tif err != nil {\n\t\tres.err = err\n\t}\n\treturn n, err\n}", "title": "" }, { "docid": "d7e191bc43889f4ad56b6d55f84d4a43", "score": "0.56069344", "text": "func (fh *WriteFileHandle) writeAt(p []byte, off int64) (n int, err error) {\n\t// defer log.Trace(fh.remote, \"len=%d off=%d\", len(p), off)(\"n=%d, fh.off=%d, err=%v\", &n, &fh.offset, &err)\n\tif fh.closed {\n\t\tfs.Errorf(fh.remote, \"WriteFileHandle.Write: error: %v\", EBADF)\n\t\treturn 0, ECLOSED\n\t}\n\tif fh.offset != off {\n\t\twaitSequential(\"write\", fh.remote, &fh.cond, fh.file.VFS().Opt.WriteWait, &fh.offset, off)\n\t}\n\tif fh.offset != off {\n\t\tfs.Errorf(fh.remote, \"WriteFileHandle.Write: can't seek in file without --vfs-cache-mode >= writes\")\n\t\treturn 0, ESPIPE\n\t}\n\tif err = fh.openPending(); err != nil {\n\t\treturn 0, err\n\t}\n\tfh.writeCalled = true\n\tn, err = fh.pipeWriter.Write(p)\n\tfh.offset += int64(n)\n\tfh.file.setSize(fh.offset)\n\tif err != nil {\n\t\tfs.Errorf(fh.remote, \"WriteFileHandle.Write error: %v\", err)\n\t\treturn 0, err\n\t}\n\t// fs.Debugf(fh.remote, \"WriteFileHandle.Write OK (%d bytes written)\", n)\n\tfh.cond.Broadcast() // wake everyone up waiting for an in-sequence read\n\treturn n, nil\n}", "title": "" }, { "docid": "b0fba62828d25210e2171f32a6f236b3", "score": "0.55721223", "text": "func (tw *timeoutWriter) Write(p []byte) (int, error) {\n\ttw.mu.Lock()\n\tdefer tw.mu.Unlock()\n\n\tif tw.timedOut {\n\t\treturn 0, http.ErrHandlerTimeout\n\t}\n\n\tif !tw.wroteHeader {\n\t\ttw.writeHeaderLocked(http.StatusOK)\n\t}\n\treturn tw.wbuf.Write(p)\n}", "title": "" }, { "docid": "c283b0ffcf3990eeb3be320d025b9f4f", "score": "0.5561893", "text": "func (l *Writer) Write(p []byte) (int, error) {\n\tl.mutex.Lock()\n\tdefer l.mutex.Unlock()\n\tl.reopenIfNeed()\n\tinode, err := l.checkInode()\n\tif os.IsNotExist(err) || inode != l.inode {\n\t\terr = l.reopen()\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\treturn l.file.Write(p)\n}", "title": "" }, { "docid": "2b63a44303eea2d6e4d493ef071e0f3f", "score": "0.55011094", "text": "func (w *buf) Write(p []byte) (int, error) {\n\tw.R = append(w.R, p...)\n\treturn len(p), nil\n}", "title": "" }, { "docid": "9ddc310961e15cbf3dc920c8e7b617be", "score": "0.5496262", "text": "func (w *WriteLimiter) Write(p []byte) (int, error) {\n\tif w.l == nil {\n\t\treturn w.w.Write(p)\n\t}\n\tn, err := w.w.Write(p)\n\tif err != nil {\n\t\treturn n, err\n\t}\n\tif err := w.l.WaitN(w.ctx, n); err != nil {\n\t\treturn n, err\n\t}\n\treturn n, err\n}", "title": "" }, { "docid": "6f4b7a3aabb1e00b75703d837ef05def", "score": "0.5471179", "text": "func (cli *Client) Write(p []byte) (_ int, err error) {\n\tdefer _recover(&err)\n\n\tr := cli.Call(\"Write\", p)\n\treturn r[0].(int), asError(r[1])\n}", "title": "" }, { "docid": "1ba87cd4e086cae81d8e2de43183b57a", "score": "0.54400766", "text": "func (w *SyslogWriter) Write(p []byte) (int, error) {\n\tw.mu.Lock()\n\tdefer w.mu.Unlock()\n\tif sl, ok := w.Writer.(*syslog.Writer); ok {\n\t\terr := sl.SetWriteDeadLine(time.Now().Add(w.timeout))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\treturn w.Writer.Write(p)\n}", "title": "" }, { "docid": "8748f35b36fddbac00170d30b6406da3", "score": "0.54159665", "text": "func (ew errWriter) Write(p []byte) (int, error) {\n\tif ew.err != nil {\n\t\treturn 0, ew.err\n\t}\n\treturn ew.w.Write(p)\n}", "title": "" }, { "docid": "25c6ca5da809893ae10cc0029b187181", "score": "0.54049313", "text": "func (e *endpoint) Write(p tcpip.Payloader, opts tcpip.WriteOptions) (int64, tcpip.Error) {\n\t// Linux completely ignores any address passed to sendto(2) for TCP sockets\n\t// (without the MSG_FASTOPEN flag). Corking is unimplemented, so opts.More\n\t// and opts.EndOfRecord are also ignored.\n\n\te.LockUser()\n\tdefer e.UnlockUser()\n\n\t// Return if either we didn't queue anything or if an error occurred while\n\t// attempting to queue data.\n\tnextSeg, n, err := e.queueSegment(p, opts)\n\tif n == 0 || err != nil {\n\t\treturn 0, err\n\t}\n\n\te.sendData(nextSeg)\n\treturn int64(n), nil\n}", "title": "" }, { "docid": "4932255697af15fe1b7c0b4ab357f2f5", "score": "0.5395148", "text": "func (s SecureReadWriteCloser) Write(p []byte) (n int, err error) {\n\treturn s.writer.Write(p)\n}", "title": "" }, { "docid": "c2d5834a5dfa1b5148afe1cafb439564", "score": "0.5377228", "text": "func (fh *WriteFileHandle) Write(p []byte) (n int, err error) {\n\tfh.mu.Lock()\n\tdefer fh.mu.Unlock()\n\t// Since we can't seek, just call WriteAt with the current offset\n\treturn fh.writeAt(p, fh.offset)\n}", "title": "" }, { "docid": "ec830c6a6226cfac17f3a6886bb39d9b", "score": "0.5352987", "text": "func (fd *FD) RawWrite(f func(uintptr) bool) error {\n\tif err := fd.writeLock(); err != nil {\n\t\treturn err\n\t}\n\tdefer fd.writeUnlock()\n\tif err := fd.pd.prepareWrite(fd.isFile); err != nil {\n\t\treturn err\n\t}\n\tfor {\n\t\tif f(uintptr(fd.Sysfd)) {\n\t\t\treturn nil\n\t\t}\n\t\tif err := fd.pd.waitWrite(fd.isFile); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "11951f6b5291e0b9915f9d61fa6e4aa2", "score": "0.5352799", "text": "func (ec myErr) Write(p []byte) (n int, err error) {\n\treturn len(p), err\n}", "title": "" }, { "docid": "58a307a0d1f45364b977c9f6745b3c79", "score": "0.5347292", "text": "func (w *Writer) Write(b []byte) (int, error) {\n\treturn w.writeAndRetry(w.priority, string(b))\n}", "title": "" }, { "docid": "8e1d422506cbf23ca5bbafcedb1f571e", "score": "0.53472334", "text": "func (w *PipeWriter) Write(data []byte) (int, error) {\n\tw.cond.L.Lock()\n\tdefer w.cond.L.Unlock()\n\n\tif w.werr != nil {\n\t\treturn 0, w.werr\n\t}\n\n\tn, err := w.buf.Write(data)\n\tw.cond.Signal()\n\treturn n, err\n}", "title": "" }, { "docid": "260c45c9e83e19f12550279a1c9715a9", "score": "0.5341578", "text": "func (w *blockingWriter) Write(p []byte) (int, error) {\n\tmu.Lock()\n\tout.writeAll(clear)\n\tn, err := w.out.Write(p)\n\tout.writeAll(save, []byte(spin.now), load)\n\tmu.Unlock()\n\treturn n, err\n}", "title": "" }, { "docid": "809d435ec2d569db1aa86236aa2de956", "score": "0.5300544", "text": "func (w *RollingWriter) Write(p []byte) (int, error) {\n\tif w.isClosed() {\n\t\treturn 0, ErrClosed\n\t}\n\tw.mu.Lock()\n\ttrigger, err := w.Trigger.Trigger(w.Writer, p)\n\tif err != nil {\n\t\tw.mu.Unlock()\n\t\treturn 0, fmt.Errorf(\"trigger: %w\", err)\n\t}\n\tif !trigger {\n\t\tw.mu.Unlock()\n\t\treturn w.Writer.Write(p)\n\t}\n\tnewWriter, err := w.Rotator.Rotate(w.Writer)\n\tif err != nil {\n\t\tw.mu.Unlock()\n\t\treturn 0, fmt.Errorf(\"rotator rotate: %w\", err)\n\t}\n\tw.Writer = newWriter\n\tw.mu.Unlock()\n\treturn w.Writer.Write(p)\n}", "title": "" }, { "docid": "e031d0bae0709342f32786521de22abc", "score": "0.52994967", "text": "func (b *writeBuffer) Write(p []byte) (int, error) {\n\tb.write(p)\n\treturn len(p), b.err\n}", "title": "" }, { "docid": "628fefb79951b494d0557f6a12b23888", "score": "0.52981925", "text": "func (w *pWriter) Write(p []byte) (int, error) {\n\tif len(p) > len(w.p)-w.n {\n\t\treturn 0, io.ErrShortWrite\n\t}\n\tcopy(w.p[w.n:w.n+len(p)], p)\n\tw.n += len(p)\n\treturn len(p), nil\n}", "title": "" }, { "docid": "d8494a1d8a02e067bad8a92387d71538", "score": "0.5252591", "text": "func (c *Conn) Write(p []byte) (n int, err error) {\n\tselect {\n\tcase <-c.writeDeadline.Done():\n\t\treturn 0, context.DeadlineExceeded\n\tdefault:\n\t}\n\treturn c.listener.pConn.WriteTo(p, c.rAddr)\n}", "title": "" }, { "docid": "902b42f051fc5a36a4695949604160f9", "score": "0.5223345", "text": "func (p *pipe) Write(d []byte) (n int, err error) {\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\tif p.c.L == nil {\n\t\tp.c.L = &p.mu\n\t}\n\tdefer p.c.Signal()\n\tif p.err != nil {\n\t\treturn 0, errClosedPipeWrite\n\t}\n\treturn len(d), p.IoBuffer.Append(d)\n}", "title": "" }, { "docid": "93ef344b4265852a20fcbe8e663838d0", "score": "0.5211365", "text": "func (lw *LockedWriter) Write(p []byte) (n int, err error) {\n\tlw.lock.Lock()\n\tdefer lw.lock.Unlock()\n\treturn lw.Writer.Write(p)\n}", "title": "" }, { "docid": "3cf6c919e03406ed0ede7d4db903ee7a", "score": "0.52090126", "text": "func (dl *downloader) Write(p []byte) (n int, err error) {\n\t// defer log.Trace(dl.dls.src, \"p_len=%d\", len(p))(\"n=%d, err=%v\", &n, &err)\n\n\t// Kick the waiters on exit if some characters received\n\tdefer func() {\n\t\tif n <= 0 {\n\t\t\treturn\n\t\t}\n\t\tif waitErr := dl.dls.kickWaiters(); waitErr != nil {\n\t\t\tfs.Errorf(dl.dls.src, \"vfs cache: download write: failed to kick waiters: %v\", waitErr)\n\t\t\tif err == nil {\n\t\t\t\terr = waitErr\n\t\t\t}\n\t\t}\n\t}()\n\n\tdl.mu.Lock()\n\tdefer dl.mu.Unlock()\n\n\t// Wait here if we have reached maxOffset until\n\t// - we are quitting\n\t// - we get kicked\n\t// - timeout happens\nloop:\n\tfor dl.offset >= dl.maxOffset {\n\t\tvar timeout = time.NewTimer(maxDownloaderIdleTime)\n\t\tdl.mu.Unlock()\n\t\tselect {\n\t\tcase <-dl.quit:\n\t\t\tdl.mu.Lock()\n\t\t\ttimeout.Stop()\n\t\t\tbreak loop\n\t\tcase <-dl.kick:\n\t\t\tdl.mu.Lock()\n\t\t\ttimeout.Stop()\n\t\tcase <-timeout.C:\n\t\t\t// stop any future reading\n\t\t\tdl.mu.Lock()\n\t\t\tif !dl.stop {\n\t\t\t\tfs.Debugf(dl.dls.src, \"vfs cache: stopping download thread as it timed out\")\n\t\t\t\tdl._stop()\n\t\t\t}\n\t\t\tbreak loop\n\t\t}\n\t}\n\n\tn, skipped, err := dl.dls.item.WriteAtNoOverwrite(p, dl.offset)\n\tif skipped == n {\n\t\tdl.skipped += int64(skipped)\n\t} else {\n\t\tdl.skipped = 0\n\t}\n\tdl.offset += int64(n)\n\n\t// Kill this downloader if skipped too many bytes\n\tif !dl.stop && dl.skipped > maxSkipBytes {\n\t\tfs.Debugf(dl.dls.src, \"vfs cache: stopping download thread as it has skipped %d bytes\", dl.skipped)\n\t\tdl._stop()\n\t}\n\n\t// If running without a async buffer then stop now as\n\t// StopBuffering has no effect if the Account wasn't buffered\n\t// so we need to stop manually now rather than wait for the\n\t// AsyncReader to stop.\n\tif dl.stop && !dl.in.HasBuffer() {\n\t\terr = asyncreader.ErrorStreamAbandoned\n\t}\n\treturn n, err\n}", "title": "" }, { "docid": "b19660d66d08324f4a46ef2f0b94ca6a", "score": "0.5203996", "text": "func Pselect(nfd int, r *unix.FdSet, w *unix.FdSet, e *unix.FdSet, timeout *unix.Timespec, sigmask *unix.Sigset_t) (n int, err error) {\n\tfor {\n\t\tn, err = unix.Pselect(nfd, r, w, e, timeout, sigmask)\n\t\tif err != syscall.EINTR {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "f62fe3ab6eb8951da0a69d561aa04836", "score": "0.5177283", "text": "func (t *TLS) Write(buf []byte) (int, error) {\n\tp := C.CString(string(buf))\n\tdefer C.free(unsafe.Pointer(p))\n\tret := C.tls_write(t.ctx, unsafe.Pointer(p), C.size_t(len(buf)))\n\tswitch {\n\tcase ret == C.TLS_WANT_POLLIN:\n\t\treturn -1, errWantPollIn\n\tcase ret == C.TLS_WANT_POLLOUT:\n\t\treturn -1, errWantPollOut\n\tcase ret < 0:\n\t\treturn -1, t.Error()\n\t}\n\treturn int(ret), nil\n}", "title": "" }, { "docid": "a6f015c77cf99e26059ca60759d1e2c9", "score": "0.517187", "text": "func (f *MockedFile) Write(p []byte) (int, error) {\n\targs := f.Called(p)\n\treturn args.Get(0).(int), args.Error(1)\n}", "title": "" }, { "docid": "363730b73f1e65c8e62c766fa60a7798", "score": "0.5167271", "text": "func write(res *RRQresponse, p []byte) (int, error) {\n\tres.conn.SetWriteDeadline(time.Now().Add(5 * time.Second))\n\treturn res.conn.Write(p)\n}", "title": "" }, { "docid": "7701011e97f97869ebf94ef855e85d9b", "score": "0.51650137", "text": "func write(file *os.File, data []byte) error {\n\tdefer file.Close()\n\tn, err := file.Write(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif n != len(data) {\n\t\treturn ErrBadWriteData\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "810ff3d267c73f16f81a9bdc4ba37999", "score": "0.51529956", "text": "func (b *buffer) write(p []byte) (n int, err error) {\n\tm, ok := b.tryGrowByReslice(len(p))\n\tif !ok {\n\t\tm = b.grow(len(p))\n\t}\n\treturn copy(b.buf[m:], p), nil\n}", "title": "" }, { "docid": "fc7f64b09a7f3afa67dea6d8b516ece9", "score": "0.51506555", "text": "func (r *RingBuffer) Write(p []byte) (n int, err error) {\n\tif len(p) == 0 {\n\t\treturn 0, nil\n\t}\n\tr.mu.Lock()\n\tn, err = r.write(p)\n\tr.mu.Unlock()\n\n\treturn n, err\n}", "title": "" }, { "docid": "04eb0628ec4c56ee594e568cd0c3b59a", "score": "0.5142723", "text": "func (i NopInstrumentation) RepairWriteFailure(int) {}", "title": "" }, { "docid": "d19337ea415fbc8774e359c5d9d2ce09", "score": "0.51367426", "text": "func (b *BufferWithError) Write(p []byte) (n int, err error) {\n\tinitErr := b.init(len(p))\n\tif initErr != nil {\n\t\treturn 0, initErr\n\t}\n\tchangedBuffer, allocErr := b.alloc.Append(b.currentBuffer, p...)\n\tif allocErr != nil {\n\t\treturn 0, allocErr\n\t}\n\tb.currentBuffer = changedBuffer\n\treturn len(p), nil\n}", "title": "" }, { "docid": "ab096d9e13ed1101a67ce7f0e63e24c9", "score": "0.51209617", "text": "func Writev(fd int, iovs [][]byte) (n int, err error) {\n\tfor {\n\t\tn, err = unix.Writev(fd, iovs)\n\t\tif err != syscall.EINTR {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "f26f37eef16bf2b5524229d45b8e414c", "score": "0.5102833", "text": "func (sc *PtyClient) Write(b []byte) (int, error) {\n\tvar n int\n\terr := sc.call(\"Write\", &b, &n)\n\treturn n, processRPCError(err)\n}", "title": "" }, { "docid": "4ee86b78ec7a2d2ba2947159d3a515df", "score": "0.5102207", "text": "func Write9P(c *net.Conn, f *FCall) error {\n\tbytes, err := marshalFCall(*f)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcnt, err := (*c).Write(bytes)\n\tif err != nil {\n\t\treturn err\n\t} else if cnt != len(bytes) {\n\t\treturn errors.New(\"incorrect count written to wire\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9d7bbbe349f923de90ea29bb8ddc4ce4", "score": "0.5099329", "text": "func (logger *Logger) Write(p []byte) (int, error) {\n\t// Construct the message once, outside of any mutex\n\tbuf := logger.makeBuf(p)\n\n\t// Accessing logger.conn must be done with a mutex\n\tlogger.mu.Lock()\n\tdefer logger.mu.Unlock()\n\n\tif logger.conn == nil {\n\t\treturn 0, ErrClosed\n\t}\n\n\t_, err := logger.conn.Write(buf)\n\tif err == nil {\n\t\treturn len(p), nil\n\t}\n\n\t// First write failed. Try reconnecting and then a second write; if that fails give up. If\n\t// we wanted to keep trying we would have to maintain a queue and a separate goroutine.\n\n\t// Ignore errors closing (including \"already closed\")\n\tlogger.conn.Close()\n\tnewConn, err := openConnection(logger.endpoint)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tlogger.conn = newConn\n\n\t_, err = logger.conn.Write(buf)\n\treturn len(p), err\n}", "title": "" }, { "docid": "daa5bd8b70330889bd8ec32603f33e59", "score": "0.5094685", "text": "func (rw *output) Write(p []byte) (int, error) {\n\trw.Lock()\n\tdefer rw.Unlock()\n\treturn rw.buf.Write(p) // and bytes.Buffer implements it, too\n}", "title": "" }, { "docid": "980583caaea182c657306925b4d33a75", "score": "0.5091689", "text": "func writen(w io.Writer, buf []byte) error {\n\tremainingTemporaryErrors := 10\n\tn := len(buf)\n\tfor n >= 0 {\n\t\tl, err := w.Write(buf)\n\t\tif err != nil {\n\t\t\tif nerr, ok := err.(net.Error); ok && nerr.Temporary() && !nerr.Timeout() {\n\t\t\t\tif remainingTemporaryErrors > 0 {\n\t\t\t\t\tremainingTemporaryErrors--\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\tif l >= n {\n\t\t\treturn nil\n\t\t}\n\t\tn -= l\n\t\tbuf = buf[l:]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e2ab26063cd2f385d007601f7f55156f", "score": "0.50750166", "text": "func (c *Adaptor) PwmWrite(pin string, val byte) (err error) {\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\n\tsysPin, err := c.pwmPin(pin)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tduty := uint32(gobot.FromScale(float64(val), 0, 255) * float64(c.PiBlasterPeriod))\n\treturn sysPin.SetDutyCycle(duty)\n}", "title": "" }, { "docid": "f81ff45b152ab8d243222acec193d2be", "score": "0.5072767", "text": "func (b *WriteBuf) Write(p []byte) (n int, err error) {\n\t// usually end >= off, but after a Seek, off > end\n\tcursor := max(b.end, b.off)\n\tif len(p)+cursor > b.Capacity() {\n\t\tnewsz := max(2*len(b.bs), len(p)+cursor+16) // TODO: this could be more intelligent\n\t\tb.grow(newsz)\n\t}\n\tn = copy(b.bs[b.off:], p)\n\tif n != len(p) {\n\t\treturn n, ErrWrite\n\t}\n\n\tb.off += n\n\tif b.off > b.end {\n\t\tb.end = b.off\n\t}\n\n\treturn n, nil\n}", "title": "" }, { "docid": "68cd22d9b879bbe530ebade75e1b298d", "score": "0.50584286", "text": "func Ppoll(fds []unix.PollFd, timeout *unix.Timespec, sigmask *unix.Sigset_t) (n int, err error) {\n\tfor {\n\t\tn, err = unix.Ppoll(fds, timeout, sigmask)\n\t\tif err != syscall.EINTR {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "d4517fee86591eb07ccd86e6355dd326", "score": "0.50475556", "text": "func (rs *retryingSink) write(events ...Event) error {\n\tif err := rs.sink.Write(events...); err != nil {\n\t\trs.failure()\n\t\treturn err\n\t}\n\n\trs.reset()\n\treturn nil\n}", "title": "" }, { "docid": "fc4066194b3a6cfec5f9406d9dbaf1d2", "score": "0.50352603", "text": "func (w *SyncWriter) Write(p []byte) (n int, err error) {\n\tw.mu.Lock()\n\tn, err = w.w.Write(p)\n\tw.mu.Unlock()\n\treturn n, err\n}", "title": "" }, { "docid": "c4bb4a0c5a2068c3ae0227985e0be121", "score": "0.5034694", "text": "func (rs *retryingSink) Write(events ...Event) error {\n\trs.mu.Lock()\n\tdefer rs.mu.Unlock()\n\nretry:\n\n\tif rs.closed {\n\t\treturn ErrSinkClosed\n\t}\n\n\tif !rs.proceed() {\n\t\tlogrus.Warnf(\"%v encountered too many errors, backing off\", rs.sink)\n\t\trs.wait(rs.failures.backoff)\n\t\tgoto retry\n\t}\n\n\tif err := rs.write(events...); err != nil {\n\t\tif err == ErrSinkClosed {\n\t\t\t// terminal!\n\t\t\treturn err\n\t\t}\n\n\t\tlogrus.Errorf(\"retryingsink: error writing events: %v, retrying\", err)\n\t\tgoto retry\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "57114faf4931ba3f3c11401bd5fbe703", "score": "0.50301117", "text": "func (e *EventFD) Write(p []byte) (int, error) {\n\tn, err := syscall.Write(e.fd, p[:])\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn n, nil\n}", "title": "" }, { "docid": "5c778419214b509062d3ef17208622a6", "score": "0.5017287", "text": "func (s *spi) Write(b []byte) (int, error) {\n\tif atomic.LoadInt32(&s.closed) != 0 {\n\t\treturn 0, io.ErrClosedPipe\n\t}\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\treturn s.f.Write(b)\n}", "title": "" }, { "docid": "96abc7547326dff80ab1ce5dc6796e05", "score": "0.50115407", "text": "func (r *ReadWriteStat) Write(p []byte) (n int, err error) {\n\tr.Lock()\n\tdefer r.Unlock()\n\n\tr.writeOps++\n\tif n, err = r.w.Write(p); err != nil {\n\t\treturn 0, err\n\t}\n\tr.totWrite += int64(n)\n\treturn n, nil\n}", "title": "" }, { "docid": "4140d6423b14815af8183191d85165e3", "score": "0.5006514", "text": "func PtraceSyscall(pid int, signal int) (err error) {\n\tfor {\n\t\terr = unix.PtraceSyscall(pid, signal)\n\t\tif err != syscall.EINTR {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "6cfbbca9250c1407b92991b322145190", "score": "0.50057584", "text": "func (m *Mocket) Write(f *os.File, b []byte) (n int, err error) {\n\tc := m.Called()\n\treturn c.Int(0), c.Error(1)\n}", "title": "" }, { "docid": "5fd4a389cc14c08395f52eabb4747070", "score": "0.50045025", "text": "func (c *NaclPipe) Write(p []byte) (n int, err error) {\n\tc.shazam()\n\n\tif c.cnt == 0 {\n\t\tn, err = c.wr.Write(c.salt)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Seal\n\tct := secretbox.Seal(nil, p, c.cntNonce, c.dKey)\n\tc.cnt++\n\n\t// now Write()\n\tn, err = c.wr.Write(ct)\n\tif err != nil || n != len(ct) {\n\t\tfmt.Fprintf(os.Stderr, \"we should write %d but wrote %d (err:%v)\\n\", len(ct), n, err)\n\t}\n\n\tn = len(p)\n\treturn\n}", "title": "" }, { "docid": "c483595ca30888067f2a1e33ac6396bc", "score": "0.50027156", "text": "func (d *Driver) Write(p []byte) (int, error) {\n\treturn d.WriteString(*(*string)(unsafe.Pointer(&p)))\n}", "title": "" }, { "docid": "1affd0a1924335f2f0b9c9cb58925ba9", "score": "0.50011694", "text": "func (b *errBuffer) Write(p []byte) (n int, err error) {\n\tb.mu.Lock()\n\tdefer b.mu.Unlock()\n\n\treturn b.buffer.Write(p)\n}", "title": "" }, { "docid": "b8ebd5b0caab5bf9c1a4f5f640dee6eb", "score": "0.4995962", "text": "func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {\n\treturn -1, ENOSYS\n}", "title": "" }, { "docid": "71fbdc51ed62e25e8bfd9b5074918cd0", "score": "0.49943385", "text": "func (c *UnixConn) CloseWrite() error {\n\tif !c.ok() {\n\t\treturn syscall.EINVAL\n\t}\n\treturn c.fd.closeWrite()\n}", "title": "" }, { "docid": "2553f34349a5d74107cb5acfa7a41fe3", "score": "0.49779606", "text": "func (t *Buf) Write(p []byte) (n int, err error) {\n\tt.buf = append(t.buf, p...)\n\tif t.limit > 0 && len(t.buf) > t.limit {\n\t\t_, err = t.w.Write(t.FlushP())\n\t}\n\treturn\n}", "title": "" }, { "docid": "1e9349885b1099d0861790b7b774e75b", "score": "0.49763414", "text": "func (w W) Write(fd int, ptr unsafe.Pointer) error {\n\t_, err := ioctlPointer(fd, w.Number(), ptr)\n\treturn wrapError(err, w.Name, w.Number())\n}", "title": "" }, { "docid": "e29fb427c06d8254482579ab85a13cfe", "score": "0.49708238", "text": "func (s *SecureWriter) Write(p []byte) (int, error) {\n\tif len(p) > MaxMsgLen {\n\t\treturn 0, ErrMsgTooLarge\n\t}\n\n\t// prepare header\n\tvar header struct {\n\t\tDataLen int32\n\t\tNonce [nonceLen]byte\n\t}\n\n\tif _, err := rand.Read(header.Nonce[:]); err != nil {\n\t\treturn 0, err\n\t}\n\n\ts.out = box.SealAfterPrecomputation(s.out[:0], p, &header.Nonce, &s.key)\n\theader.DataLen = int32(len(s.out))\n\n\t// write header\n\tif err := binary.Write(s.w, binary.BigEndian, &header); err != nil {\n\t\treturn 0, err\n\t}\n\n\t// write message\n\tif _, err := writeFull(s.w, s.out); err != nil {\n\t\t// report 0 bytes of p as written. It doesn't make sense\n\t\t// to report n since it is not true that p[:n] was\n\t\t// written. This error is not recoverable as we have\n\t\t// already written something to s.w, and the other end\n\t\t// is likely trying to read more bytes than what we\n\t\t// wrote.\n\t\treturn 0, err\n\t}\n\n\treturn len(p), nil\n}", "title": "" }, { "docid": "c8a5f46a7f11bfe78f5139dba445447e", "score": "0.49677515", "text": "func PrctlRetInt(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (int, error) {\n\tvar (\n\t\t_v0 int\n\t\t_v1 error\n\t)\n\tfor {\n\t\t_v0, _v1 = unix.PrctlRetInt(option, arg2, arg3, arg4, arg5)\n\t\tif _v1 != syscall.EINTR {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn _v0, _v1\n}", "title": "" }, { "docid": "5f4f813b4655c967c0a8b8beb493d9e4", "score": "0.49606127", "text": "func (srwc SecureReadWriteCloser) Write(p []byte) (int, error) {\n\t// The structure of a packet for reference is:\n\t// [ length uint32 | nonce [24]byte | enc_message []byte ]\n\n\t// Test if the input is too long\n\tif len(p) > MaxLength {\n\t\treturn 0, ErrOutputTooLong\n\t}\n\n\tlength := uint32(len(p) + NonceBytes + LengthBytes + box.Overhead)\n\n\t// Prepare the nonce\n\t// Using the same nonce twice reduces the difficulty of \"guessing\" the key,\n\t// so that's a big no-no, but while random numbers have a risk for collision,\n\t// NaCL docs (http://nacl.cr.yp.to/stream.html) state that, due to the large\n\t// nonce size (24 bytes), that randomly generated nonces have negligible risk\n\t// of collision.\n\tnonce := new([NonceBytes]byte)\n\tif _, err := rand.Read(nonce[:]); err != nil {\n\t\treturn 0, ErrRandom\n\t}\n\n\t// Make a slice with capacity for the entire thing, and the length set to the\n\t// length/nonce we'll be copying in\n\tmessage := make([]byte, LengthBytes+NonceBytes, length)\n\n\tbinary.BigEndian.PutUint32(message[0:LengthBytes], length)\n\tcopy(message[LengthBytes:LengthBytes+NonceBytes], nonce[:])\n\n\t// Encrypt!\n\tret := box.SealAfterPrecomputation(message, p, nonce, srwc.secret)\n\n\t// Write all the things! We just use this as the return value.\n\treturn srwc.writer.Write(ret)\n}", "title": "" }, { "docid": "72f4339902c8d692b1499b29c9712375", "score": "0.49468672", "text": "func (w *Writer) Write(p []byte) (int, error) {\n\treturn w.WriteWithTime(time.Now(), p)\n}", "title": "" }, { "docid": "ca01a1ba0302f685096c165aaa6c43e3", "score": "0.49442875", "text": "func Pread(fd int, buf []byte, off int64) int {\n\tpdwfs.lock.Lock()\n\tdefer pdwfs.lock.Unlock()\n\tfile, err := pdwfs.getFileFromFd(fd)\n\tcheck(err)\n\n\tn, err := (*file).ReadAt(buf, off)\n\tif err != nil && err != io.EOF {\n\t\tif e, ok := err.(*os.PathError); ok && e.Err == redisfs.ErrNegativeOffset {\n\t\t\tsetErrno(C.EINVAL)\n\t\t\tC.perror(C.CString(err.Error()))\n\t\t} else {\n\t\t\tpanic(fmt.Sprintf(\"unhandled %T in Pread: %s\", err, err))\n\t\t}\n\t\treturn -1\n\t}\n\treturn n\n}", "title": "" }, { "docid": "7574384cd9b76d1e4ada0ff56cb193a5", "score": "0.49422747", "text": "func (w *writer) Write(p []byte) (n int, err error) {\n\tif w.pw == nil {\n\t\treturn 0, errors.ErrStorageWriterNotOpened\n\t}\n\n\treturn w.pw.Write(p)\n}", "title": "" }, { "docid": "11fd684999ae02fa57f1c40cd9eed146", "score": "0.494115", "text": "func (c *unresponsiveTestConn) Write(b []byte) (n int, err error) {\n\treturn 0, nil\n}", "title": "" }, { "docid": "7b748b8222f6c605e5baa480a363bc1a", "score": "0.49349567", "text": "func Write(fd int, buf []byte) int {\n\tpdwfs.lock.Lock()\n\tdefer pdwfs.lock.Unlock()\n\tfile, err := pdwfs.getFileFromFd(fd)\n\tcheck(err)\n\n\tn, err := (*file).Write(buf)\n\n\tif err != nil {\n\t\tif err == redisfs.ErrReadOnly {\n\t\t\tsetErrno(C.EBADF)\n\t\t} else {\n\t\t\tcheck(err) // no known conversion to errno, just panic if err != nil\n\t\t}\n\t\treturn -1\n\t}\n\n\treturn n\n}", "title": "" }, { "docid": "c7d3f511f5a0de424dcbf3a493fd5cc2", "score": "0.49252686", "text": "func (fd *FD) WriteOnce(p []byte) (int, error) {\n\tif err := fd.writeLock(); err != nil {\n\t\treturn 0, err\n\t}\n\tdefer fd.writeUnlock()\n\treturn ignoringEINTRIO(syscall.Write, fd.Sysfd, p)\n}", "title": "" }, { "docid": "ff17ad9bb3c53222faa179d47231cd6b", "score": "0.49155158", "text": "func Write(path string) error {\n\tpid := os.Getpid()\n\tpidBytes := []byte(strconv.Itoa(pid) + \"\\n\")\n\tif err := ioutil.WriteFile(path, pidBytes, 0660); err != nil {\n\t\treturn err\n\t}\n\n\t// Handle the cleanup\n\tsig := make(chan os.Signal, 1)\n\tsignal.Notify(sig, syscall.SIGQUIT, syscall.SIGINT, syscall.SIGHUP, syscall.SIGTERM)\n\tgo func() {\n\t\tfor s := range sig {\n\t\t\tlog.WithField(\"signal\", s).Info(\"Exiting due to signal\")\n\t\t\tos.Remove(path)\n\t\t\tos.Exit(0)\n\t\t}\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "5f751797c945f40bdf6976e0eb3efc4e", "score": "0.49128366", "text": "func (w *Writer) Write(p []byte) (n int, err error) {\n\tw.grow(len(p))\n\tn = copy(w.buf[w.pos:], p)\n\tw.pos += n\n\treturn n, nil\n}", "title": "" }, { "docid": "0c18f9bb030696e6d0520016f00a0e45", "score": "0.49117953", "text": "func (b *ringBuffer) Write(p []byte, offset uint64) error {\n\tlen := uint64(len(p))\n\tif len+offset > b.writeCapacity {\n\t\treturn io.EOF\n\t}\n\n\twritePosition := b.writePosition + offset\n\n\tif writePosition+len < b.length {\n\t\tcopy(b.data[writePosition:], p)\n\t} else {\n\t\tcopy(b.data[writePosition:b.length], p[:b.length-writePosition])\n\t\tcopy(b.data, p[b.length-writePosition:])\n\t}\n\n\tb.writePosition = (writePosition + len) % b.length\n\tb.writeCapacity -= len\n\treturn nil\n}", "title": "" }, { "docid": "9d3fbb07931b53ccf4e81608585f99f0", "score": "0.49085543", "text": "func (w ErrorWriter) Write(p []byte) (int, error) {\n\treturn 0, errors.New(\"Write() called on an ErrorWriter\")\n}", "title": "" }, { "docid": "7867ce6258a0b9ee9861d48676863cfe", "score": "0.49054328", "text": "func (c *Client) Write(p []byte) (int, error) {\n\tif c.conn == nil || len(p) == 0 {\n\t\treturn 0, io.EOF\n\t}\n\n\tn, err := c.conn.Write(p)\n\tif err == nil {\n\t\tc.conn.SetDeadline(time.Now().Add(ConnectionTimeout))\n\t}\n\n\treturn n, err\n}", "title": "" }, { "docid": "6b5fd947210c97a5e3e80024d42f2a14", "score": "0.49011853", "text": "func (s *SafeByteBuffer) Write(p []byte) (n int, err error) {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\treturn s.buffer.Write(p)\n}", "title": "" }, { "docid": "9e0122df2c9e32062d97eb3b04a9ea21", "score": "0.49011675", "text": "func (c *Conn) Write(b []byte) (written int, err error) {\n\tif len(b) == 0 {\n\t\treturn 0, nil\n\t}\n\terr = tryAgain\n\tfor err == tryAgain {\n\t\tn, errcb := c.write(b)\n\t\terr = c.handleError(errcb)\n\t\tif err == nil {\n\t\t\treturn n, c.flushOutputBuffer()\n\t\t}\n\t}\n\treturn 0, err\n}", "title": "" }, { "docid": "9e0122df2c9e32062d97eb3b04a9ea21", "score": "0.49011675", "text": "func (c *Conn) Write(b []byte) (written int, err error) {\n\tif len(b) == 0 {\n\t\treturn 0, nil\n\t}\n\terr = tryAgain\n\tfor err == tryAgain {\n\t\tn, errcb := c.write(b)\n\t\terr = c.handleError(errcb)\n\t\tif err == nil {\n\t\t\treturn n, c.flushOutputBuffer()\n\t\t}\n\t}\n\treturn 0, err\n}", "title": "" }, { "docid": "941088948d178ec2c424f28143970a20", "score": "0.48996124", "text": "func (fd *ControlFD) safelyWrite(fn func() error) error {\n\tfd.conn.server.renameMu.RLock()\n\tdefer fd.conn.server.renameMu.RUnlock()\n\tfd.node.opMu.Lock()\n\tdefer fd.node.opMu.Unlock()\n\treturn fn()\n}", "title": "" }, { "docid": "1b7871098204ff581018f6841549c25e", "score": "0.48995528", "text": "func (bb *BlockingReadBuffer) Write(p []byte) (n int, err error) {\n\tbb.bufferGuard.Lock()\n\tn, err = bb.Buffer.Write(p)\n\tbb.bufferGuard.Unlock()\n\n\tbb.blockingCond.Signal()\n\treturn\n}", "title": "" }, { "docid": "d94884030c66c70cca53502ca76acdd8", "score": "0.48868552", "text": "func (m *MockNetpollWriter) WriteDirect(p []byte, remainCap int) (err error) {\n\tif m.WriteDirectFunc != nil {\n\t\treturn m.WriteDirectFunc(p, remainCap)\n\t}\n\treturn\n}", "title": "" }, { "docid": "80f96b4cac80625d4d7df500011c946d", "score": "0.4886465", "text": "func (b *Buffer) Write(p []byte) (n int, err error) {\n\tn, err = b.WriteAt(p, int64(b.p))\n\tb.p += n\n\treturn\n}", "title": "" }, { "docid": "3f8d39b526f713c5eb6913b00c5f47b1", "score": "0.48628172", "text": "func (w *writerWrapper) Write(p []byte) (int, error) {\n\tn, err := w.w.Write(p)\n\tw.offset += int64(n)\n\treturn n, err\n}", "title": "" }, { "docid": "a835fae5e4f8399560222806f7d1f251", "score": "0.48599845", "text": "func (pr *pipeReader) writeTo(w io.Writer) (int64, error) {\n\t// If w does not have a file descriptor (maybe it is a TLS connection, or\n\t// a *bytes.Buffer), this first step will fail.\n\tdst, err := getRawconn(w)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t// pr.reader must also be a thing with a file descriptor.\n\tsrc, err := getRawconn(pr.reader)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tstart := pr.position\n\tvar errRead, errWrite, errSendfile error\n\n\t// src.Read gives us the file descriptor of the underlying file of the\n\t// pipe.\n\terrRead = src.Read(func(srcFd uintptr) bool {\n\t\t// dst.Write gives us the file descriptor of the thing we write into,\n\t\t// typically a network socket.\n\t\terrWrite = dst.Write(func(dstFd uintptr) bool {\n\t\t\terrSendfile = pr.sendfile(int(dstFd), int(srcFd))\n\n\t\t\t// If errSendfile is EAGAIN, ask Go runtime to wait for dst to become\n\t\t\t// writeable again by returning false.\n\t\t\treturn errSendfile != syscall.EAGAIN\n\t\t})\n\n\t\treturn true\n\t})\n\twritten := pr.position - start\n\n\tfor _, err := range []error{errRead, errWrite, errSendfile} {\n\t\tif err != nil {\n\t\t\treturn written, err\n\t\t}\n\t}\n\n\treturn written, nil\n}", "title": "" }, { "docid": "08f2f726e4c8e54802d710090ec0b4f9", "score": "0.4854264", "text": "func writeFile(p string, content string) error {\n\treturn os.WriteFile(p, []byte(content), os.ModePerm)\n}", "title": "" }, { "docid": "68578d44838fe815c6b5e89cac11d275", "score": "0.48369154", "text": "func (s *Buffer) Write(p []byte) (n int, err error) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\treturn s.buf.Write(p)\n}", "title": "" } ]
94fb7365008000ac35a3a70a1fbe52ad
Store stores the hash map to the file storage and then returns the info address.
[ { "docid": "36f3c2a134c0611dedb7593aa4428ddc", "score": "0.73737496", "text": "func (hm *HashMap) Store() int64 {\n\tbuffer := proto.NewBuffer(nil)\n\n\tbuffer.EncodeMessage(&protocol.HashMapInfo{\n\t\tSlotDirsAddr: hm.slotDirsAddr,\n\t\tMaxSlotDirCountShift: int64(hm.maxSlotDirCountShift),\n\t\tSlotDirCount: int64(hm.slotDirCount),\n\t\tMinSlotCountShift: int64(hm.minSlotCountShift),\n\t\tSlotCount: int64(hm.slotCount),\n\t\tItemCount: int64(hm.itemCount),\n\t\tPayloadSize: int64(hm.payloadSize),\n\t})\n\n\tinfoAddr, buffer2 := hm.fileStorage.AllocateSpace(len(buffer.Bytes()))\n\tcopy(buffer2, buffer.Bytes())\n\t*hm = *new(HashMap).Init(hm.fileStorage)\n\treturn infoAddr\n}", "title": "" } ]
[ { "docid": "019d5101ac2e71bab9fbf98f81bfd22a", "score": "0.7117719", "text": "func StoreInfohash(infohash string) (err error) {\n\tif len(infohash) == 40 {\n\t\treturn utils.Repository.CreateInfohash(infohash)\n\t}\n\treturn\n}", "title": "" }, { "docid": "ff0dd97988104e4f9f6d208f54a5c615", "score": "0.648173", "text": "func (m MapStorage) Store(key string, bytes []byte) error {\n\tif _, taken := m[key]; taken {\n\t\treturn errors.New(\"key taken\")\n\t}\n\tm[key] = bytes\n\treturn nil\n}", "title": "" }, { "docid": "71537a75084c95079523d126e5659e04", "score": "0.6476806", "text": "func (fs *FileSystem) StoreInternal(f string, d *pb.Data) pb.Result {\n\thashedData := strconv.FormatUint(generateIDFromIP(f), 10)\n\tlog.Printf(yellow(\"Attempting to store %s at %s\"), f, hashedData)\n\tfs.fileSystem[f] = hashedData\n\treturn pb.Result{Result: &pb.Result_Success{Success: &pb.Success{}}}\n}", "title": "" }, { "docid": "c80b411754ca6c2fbb1c5349f33dfeb4", "score": "0.6371485", "text": "func (m *fileMap) Store(key string, value *File) {\n\tm.data.Store(key, value)\n}", "title": "" }, { "docid": "0d3feced16aaed9bf771b8684ff2f789", "score": "0.62630755", "text": "func (fs *FileSystem) storeMetaFile(metaFile *MetaFile) {\n\n\tkey := hex.EncodeToString(metaFile.Hash)\n\n\tfs.metaFiles[key] = metaFile\n\n}", "title": "" }, { "docid": "147d8ee9a51ad1b959990caa907358fe", "score": "0.61521864", "text": "func (_DataLedgerContract *DataLedgerContractSession) StoreInfo(hash [32]byte, uri string, description string) (*types.Transaction, error) {\n\treturn _DataLedgerContract.Contract.StoreInfo(&_DataLedgerContract.TransactOpts, hash, uri, description)\n}", "title": "" }, { "docid": "04bca91bc2cafff8b16dccf602e5e6ef", "score": "0.6112051", "text": "func (m TokenMapping) Store(filepath string) error {\n\treturn marshalToFile(filepath, m)\n}", "title": "" }, { "docid": "67a9585dcaf69c6781173bb3d028cb5b", "score": "0.6109529", "text": "func (r *fileRepo) store(addr core.HashAddress, path string, data []byte) error {\n fullPath := r.getPath(addr, path)\n logrus.Debugf(\"storing file on %s\", fullPath)\n\n return ioutil.WriteFile(fullPath, data, 0600)\n}", "title": "" }, { "docid": "b840c877bb4f57731ab3771ace135c97", "score": "0.61056733", "text": "func (_DataLedgerContract *DataLedgerContractTransactor) StoreInfo(opts *bind.TransactOpts, hash [32]byte, uri string, description string) (*types.Transaction, error) {\n\treturn _DataLedgerContract.contract.Transact(opts, \"storeInfo\", hash, uri, description)\n}", "title": "" }, { "docid": "073624257e46b7603b236ac1f608dbe8", "score": "0.6086596", "text": "func (_DataLedgerContract *DataLedgerContractTransactorSession) StoreInfo(hash [32]byte, uri string, description string) (*types.Transaction, error) {\n\treturn _DataLedgerContract.Contract.StoreInfo(&_DataLedgerContract.TransactOpts, hash, uri, description)\n}", "title": "" }, { "docid": "f61cdafd0e9603dfdf1edf48b06b8a1c", "score": "0.59369683", "text": "func (m *Map) Store(e process.ProcEntry) error {\n\tm.c.Store(e.Extension, e.Pid)\n\treturn nil\n}", "title": "" }, { "docid": "ce28425207034f883c4175c9ecfddede", "score": "0.58747387", "text": "func (fs *FileStorage) Store(s Sitemap) error {\n\tfile, err := os.Create(fs.path)\n\tif err != nil {\n\t\treturn StorageError{Description: \"could not create file\", Err: err}\n\t}\n\n\t// language mechanism that puts your function call into a stack, to be called before return\n\tdefer func() {\n\t\terr := file.Close()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}()\n\n\t// serializing struct into json\n\tbody, err := json.Marshal(s)\n\tif err != nil {\n\t\treturn StorageError{Description: \"could not marshal json\", Err: err}\n\t}\n\n\t// muting first return argument\n\t_, err = file.WriteString(string(body))\n\tif err != nil {\n\t\treturn StorageError{Description: \"could write into file\", Err: err}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ee9f58fc22fed9102bda4bd7de0b328e", "score": "0.57699174", "text": "func(NodeDicStruct *NodeDictionary) Storing(map_key int64, map_value main_struct.Global_nodeinfo){\n\tNodeDicStruct.Lock()\n\tNodeDicStruct.node_dictionary[map_key] = map_value\n\tNodeDicStruct.Unlock()\n}", "title": "" }, { "docid": "9b836f1cbf094581df3eb55063fae6c5", "score": "0.5763366", "text": "func storeCacheFile(ipMap map[string]struct{}, filename string) {\r\n\tif filename == \"\" {\r\n\t\treturn\r\n\t}\r\n\r\n\tvar data string\r\n\r\n\tfor ipA := range ipMap {\r\n\t\tdata += ipA + \"\\n\"\r\n\t}\r\n\r\n\tioutil.WriteFile(filename, []byte(data), 0644)\r\n}", "title": "" }, { "docid": "bb7ab4dc8b0eafa735e628fc1562b52f", "score": "0.5754285", "text": "func (tm *AgentMap) Store(key string, val *manager.AgentInfo) {\n tm.lock.Lock()\n defer tm.lock.Unlock()\n\n tm.unlockedStore(key, val)\n}", "title": "" }, { "docid": "3f0b2a6eeaba1092bce4819ba7ac51c3", "score": "0.5723405", "text": "func (fs *FileSystem) storeChunk(chunk Chunk) {\n\n\tkey := hex.EncodeToString(chunk.hash)\n\n\tfs.chunks[key] = &chunk\n\n}", "title": "" }, { "docid": "4a26cfe98f4cdfab1a1937c07b013837", "score": "0.5721143", "text": "func (userdata *User) StoreFileNodeInfo(filename string, node *FileNode) {\n\t// Initialize variables for initial permission/validity checks\n\tvar isOwner, isContributor bool\n\tvar file File\n\n\t// check to see if user is owner or contributor\n\tfile, isOwner = userdata.Created[filename]\n\tif !isOwner {\n\t\tfile, isContributor = userdata.Shared[filename]\n\t\tif !isContributor {\n\t\t\tpanic(errors.New(\"Filename invalid or access not permitted.\"))\n\t\t}\n\t}\n\n\t// Marshal (convert to byte array) FileNode struct\n\t// Will be stored as/used as field in filepair thing I added\n\tnodemarshal, err := json.Marshal(node)\n\tcheck_err(err)\n\n\t// Initialize filepair\n\t// Sets Data/ekey field to marshaled node struct\n\t// Sets MAC field to HMAC of file's stored MAC field and marshaled node struct\n\tfilepair := FilePair{nodemarshal, hmac(file.MAC, nodemarshal)}\n\n\t// Marshal FilePair for proper data storage as byte array\n\tfilepairmarshal, err := json.Marshal(filepair)\n\tcheck_err(err)\n\n\t// Set path for file info and store in Datastore\n\tpath := \"files/info/\" + file.ID.String()\n\tuserlib.DatastoreSet(path, filepairmarshal)\n}", "title": "" }, { "docid": "d636cc81ddeab70685d5d30cc86e0d74", "score": "0.5719414", "text": "func (h *Hasher) Save(path string) error {\n\tdata, err := serializer.SerializeAny(h.Block)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn ioutil.WriteFile(path, data, 0755)\n}", "title": "" }, { "docid": "03c3b68e40c7e9ffcc253a996f896f55", "score": "0.57186866", "text": "func (m *IPMap) Store(key string, value struct{}) {\n\t(*sync.Map)(m).Store(key, value)\n}", "title": "" }, { "docid": "63b3e209e446f177a2f3982c8b2c34d4", "score": "0.57184476", "text": "func (m *MemStore) Save(data interface{}) (string, error) {\n\tbytes, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\thasher := sha256.New()\n\thasher.Write(bytes)\n\tsum := hasher.Sum(nil)\n\tsumStr := hex.EncodeToString(sum)\n\n\tswitch ty := data.(type) {\n\tcase *Entry:\n\t\tm.Entries[sumStr] = data.(*Entry)\n\tcase *Snapshot:\n\t\tm.Snapshots[sumStr] = data.(*Snapshot)\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"Unknown type %s\", ty)\n\t}\n\treturn sumStr, nil\n}", "title": "" }, { "docid": "6d54dcb19688d414df42b8b2114aa5fd", "score": "0.5712353", "text": "func (a *app) Save(hash string, key string, value string) error {\n\tstationID, err := a.GetId(hash)\n\tif err != nil {\n\t\tlog.Info(\"Hash is not paired with the ID\", \"hash\", hash, \"id\", stationID)\n\t\treturn ErrNotFound\n\t}\n\n\treturn a.repo.Save(stationID, key, value)\n}", "title": "" }, { "docid": "430674f3d7c66b93226248df9d1ebc1b", "score": "0.5692225", "text": "func (f *FileBlobStore) Put(hash string, blob []byte) error {\n\terr := f.initOnce()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn ioutil.WriteFile(f.path(hash), blob, 0644)\n}", "title": "" }, { "docid": "7303732d78f84a797dd9563714f96c6a", "score": "0.56716", "text": "func Store(data parser.MetaInfo) (err error) {\n\tvar t repository.Torrent\n\tt.Infohash = data.InfoHash\n\tif len(t.Infohash) != 40 {\n\t\treturn fmt.Errorf(\"store infohash len is not 40\")\n\t}\n\tif data.Info.Name == \"\" {\n\t\t// fmt.Println(\"store name len is 0\")\n\t\treturn fmt.Errorf(\"store name len is 0\")\n\t}\n\tt.Name = data.Info.Name\n\tt.CreateTime = time.Now()\n\tif len(data.Info.Files) == 0 {\n\t\tt.Length = data.Info.Length\n\t\tt.FileCount = 1\n\t\tt.Files = append(t.Files, repository.File{Name: t.Name, Length: t.Length})\n\t} else {\n\t\tvar tmpFiles files\n\t\tif len(data.Info.Files) > 5 {\n\t\t\tfor _, v := range data.Info.Files {\n\t\t\t\tif len(v.Path) > 0 {\n\t\t\t\t\tt.Length += v.Length\n\t\t\t\t\tt.FileCount++\n\t\t\t\t\ttmpFiles = append(tmpFiles, repository.File{\n\t\t\t\t\t\tName: v.Path[0],\n\t\t\t\t\t\tLength: v.Length,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t\tsort.Sort(tmpFiles)\n\t\t\tif len(tmpFiles) >= 5 {\n\t\t\t\tt.Files = append(t.Files, tmpFiles[:5]...)\n\t\t\t} else {\n\t\t\t\tt.Files = append(t.Files, tmpFiles[:]...)\n\t\t\t}\n\t\t} else {\n\t\t\tfor _, v := range data.Info.Files {\n\t\t\t\tif len(v.Path) > 0 {\n\t\t\t\t\tt.Length += v.Length\n\t\t\t\t\tt.FileCount++\n\t\t\t\t\tt.Files = append(t.Files, repository.File{\n\t\t\t\t\t\tName: v.Path[0],\n\t\t\t\t\t\tLength: v.Length,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\terr = utils.Repository.CreateTorrent(t)\n\treturn\n}", "title": "" }, { "docid": "0d3deaddde0d809a1c0c3150e74bcd26", "score": "0.5649293", "text": "func (hashMap *HashMap) Put(item string) {\n\thash := md5.New()\n\thash.Sum([]byte(item))\n}", "title": "" }, { "docid": "ca168b619e925a40bb42e8a24c49d277", "score": "0.563027", "text": "func (kpl *KopiaPersisterLight) Store(ctx context.Context, key string, val []byte) error {\n\tkpl.waitFor(key)\n\tdefer kpl.doneWith(key)\n\n\tlog.Println(\"pushing metadata for\", key)\n\n\treturn kpl.kc.SnapshotCreate(ctx, key, val)\n}", "title": "" }, { "docid": "0ed2183c1a04188a2760c146a7346455", "score": "0.55753386", "text": "func (history ForecastHistory) Store(object interface{}) error {\n\tlog.Print(\"Storing historic data....\")\n\tfile, err := os.Create(storagePath)\n\tdefer file.Close()\n\tif err == nil {\n\t\tencoder := gob.NewEncoder(file)\n\t\tencoder.Encode(object)\n\t\treturn nil\n\t}\n\treturn err\n}", "title": "" }, { "docid": "dab986afaaba3393057d85f52773689c", "score": "0.557229", "text": "func (rm *ResultMap) Store(key CanonicalName, value *TreeCheck) {\n\trm.Lock()\n\trm.internal[key] = value\n\trm.Unlock()\n}", "title": "" }, { "docid": "e4641f521d94d9ec7cc23f766a987166", "score": "0.55620414", "text": "func (m *shardMap) Store(name string, shard *Shard) {\n\t(*sync.Map)(m).Store(name, shard)\n}", "title": "" }, { "docid": "4de15d8c3ded3751640d0a503467fc5e", "score": "0.5552841", "text": "func (fr *FileRegisterController) storeToDB(in *pb_center.RegisterRequest) error {\n\tfmt.Printf(\"Storing file meta data: %s\\n\", in.String())\n\tdbHandler, err := db_center.ToFileMeta(in.GetName())\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn dbHandler.Edit().SetSize(in.GetSize()).SetHash(in.GetHash()).SetUploadTime(time.Now()).Done()\n}", "title": "" }, { "docid": "d99e8a09c474a6e356b91e1da04e426e", "score": "0.55420375", "text": "func (s *Stats) Store() {\n\tif *statsFile == \"\" {\n\t\treturn\n\t}\n\tout, err := os.Create(*statsFile)\n\tif err != nil {\n\t\tlog.Fatalf(\"error opening statsfile: %v\", err)\n\t}\n\tdefer out.Close()\n\tencoder := json.NewEncoder(out)\n\t// Encode into the buffer\n\terr = encoder.Encode(&s)\n\tif err != nil {\n\t\tlog.Fatalf(\"error writing stats file: %v\", err)\n\t}\n}", "title": "" }, { "docid": "48ee77d680bcef81376262cde6760642", "score": "0.55403847", "text": "func (h *hasherStore) Put(ctx context.Context, chunkData ChunkData) (Reference, error) {\n\tc := chunkData\n\tvar encryptionKey encryption.Key\n\tif h.toEncrypt {\n\t\tvar err error\n\t\tc, encryptionKey, err = h.encryptChunkData(chunkData)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tchunk := h.createChunk(c)\n\th.storeChunk(ctx, chunk)\n\n\treturn Reference(append(chunk.Address(), encryptionKey...)), nil\n}", "title": "" }, { "docid": "92d7b4fe1999eca2666823d7bc0571bc", "score": "0.5532369", "text": "func (m *Map) Store(id uint64, meta common.MapStr) common.MapStrPointer {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\n\tif meta == nil {\n\t\treturn common.MapStrPointer{}\n\t}\n\n\tp, ok := m.meta[id]\n\tif !ok {\n\t\t// create\n\t\tp = common.NewMapStrPointer(meta)\n\t\tm.meta[id] = p\n\t} else {\n\t\t// update\n\t\tp.Set(meta)\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "92d7b4fe1999eca2666823d7bc0571bc", "score": "0.5532369", "text": "func (m *Map) Store(id uint64, meta common.MapStr) common.MapStrPointer {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\n\tif meta == nil {\n\t\treturn common.MapStrPointer{}\n\t}\n\n\tp, ok := m.meta[id]\n\tif !ok {\n\t\t// create\n\t\tp = common.NewMapStrPointer(meta)\n\t\tm.meta[id] = p\n\t} else {\n\t\t// update\n\t\tp.Set(meta)\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "f47e3ce4900c3ad165478da853158808", "score": "0.55215895", "text": "func (d *diskStorage) Store(key string, block []byte) error {\n\tdataFilePath := filepath.Join(d.path, key+dataExt)\n\n\tdataFileFound := false\n\n\t// Check if both files exist otherwise overwrite them\n\tif _, err := os.Stat(dataFilePath); err == nil {\n\t\tdataFileFound = true\n\t}\n\n\tif dataFileFound {\n\t\treturn ErrExists\n\t}\n\n\t// Write the data in a file\n\tif err := ioutil.WriteFile(dataFilePath, block, 0644); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c2b276f90f9c85e03db2c934e7cb93cb", "score": "0.5513827", "text": "func (maildir *Maildir) Store(m *data.Message) (string, error) {\n\tb, err := ioutil.ReadAll(m.Raw.Bytes())\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\terr = ioutil.WriteFile(filepath.Join(maildir.Path, string(m.ID)), b, 0660)\n\treturn string(m.ID), err\n}", "title": "" }, { "docid": "411203b88cb2aa9b4ba6361dff50c344", "score": "0.5507581", "text": "func putStorage(key, value string) {\n\tStorage.Lock()\n\tStorage.Map[key] = value\n\tStorage.Unlock()\n\n\t// Save it to disk as well\n\twriteStorage()\n}", "title": "" }, { "docid": "baa1f54d9d5f24534f8ff97b279f60a1", "score": "0.5491207", "text": "func (m *stringMap) Store(key string, value string) {\n\tm.data.Store(key, value)\n}", "title": "" }, { "docid": "723b94e02737b93ac8367195954bc9f8", "score": "0.548889", "text": "func (m *Map) Store(key string, value interface{}) {\n\tm.doStore(key, value, false)\n}", "title": "" }, { "docid": "c8c4cad7dcf7f4f349949f4b09b2037b", "score": "0.54822224", "text": "func (p *Store) Put(hash string, blob stream.Blob) error {\n\treturn errors.Err(shared.ErrNotImplemented)\n}", "title": "" }, { "docid": "2afff18cd4f04bf564fe7ede1abf54cb", "score": "0.5481188", "text": "func (store MaxStore) writeInfo(id string, info tusd.FileInfo) error {\n data, err := yaml.Marshal(info)\n if err != nil {\n return err\n }\n return ioutil.WriteFile(store.infoPath(id), data, defaultFilePerm)\n}", "title": "" }, { "docid": "04e7fe8cde3d833627fe860a361a051b", "score": "0.54809463", "text": "func Store(hash string, r io.Reader, length int64, psFileOffset int64, dir string) error {\n\tif psFileOffset < 0 {\n\t\treturn ArgError.New(\"Offset is less than 0. Must be greater than or equal to 0\")\n\t}\n\tif length < 0 {\n\t\treturn ArgError.New(\"Length is less than 0. Must be greater than or equal to 0\")\n\t}\n\tif dir == \"\" {\n\t\treturn ArgError.New(\"No path provided\")\n\t}\n\n\tdataPath, err := PathByHash(hash, dir)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create directory path on file system\n\tif err = os.MkdirAll(filepath.Dir(dataPath), 0700); err != nil {\n\t\treturn err\n\t}\n\n\t// Create File on file system\n\tdataFile, err := os.OpenFile(dataPath, os.O_RDWR|os.O_CREATE, 0755)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdataFileChunk := fpiece.NewChunk(dataFile, psFileOffset, length)\n\n\t// Close when finished\n\tdefer dataFile.Close()\n\n\tbuffer := make([]byte, 4096)\n\tfor {\n\t\t// Read data from read stream into buffer\n\t\tn, err := r.Read(buffer)\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\n\t\t// Write the buffer to the stream we opened earlier\n\t\t_, err = dataFileChunk.Write(buffer[:n])\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c5058d97c5177dd023d203f5c54398f4", "score": "0.5471315", "text": "func (hm *HashMap) Load(infoAddr int64) {\n\tbuffer := proto.NewBuffer(hm.fileStorage.AccessSpace(infoAddr))\n\tvar info protocol.HashMapInfo\n\n\tif err := buffer.DecodeMessage(&info); err != nil {\n\t\tpanic(errCorrupted)\n\t}\n\n\thm.fileStorage.FreeSpace(infoAddr)\n\thm.slotDirsAddr = info.SlotDirsAddr\n\thm.maxSlotDirCountShift = int(info.MaxSlotDirCountShift)\n\thm.slotDirCount = int(info.SlotDirCount)\n\thm.minSlotCountShift = int(info.MinSlotCountShift)\n\thm.slotCount = int(info.SlotCount)\n\thm.itemCount = int(info.ItemCount)\n\thm.payloadSize = int(info.PayloadSize)\n}", "title": "" }, { "docid": "f8d446312833de631e052d3272df6db8", "score": "0.54600894", "text": "func saveOnionInfo(onionInfo resource.OnionInfo) error {\n\tpubKey, err := encryption.RSAKeyToString(onionInfo.Key)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\tonionDirectory.Lock()\n\tonionDirectory.onionMap[pubKey] = onionInfo\n\tonionDirectory.Unlock()\n\n\treturn nil\n}", "title": "" }, { "docid": "a7cbe8323796c3438863784ee68bf2b9", "score": "0.545933", "text": "func (inst *TiFlashInstance) StoreAddr() string {\n\treturn fmt.Sprintf(\"%s:%d\", advertiseHost(inst.Host), inst.ServicePort)\n}", "title": "" }, { "docid": "3e0b0d00fa1273f921c1873891afcd6d", "score": "0.5455855", "text": "func (nm *NeighborMap) Store(key string, value *Neighbor) {\n\tnm.Lock()\n\tdefer nm.Unlock()\n\tnm.internal[key] = value\n}", "title": "" }, { "docid": "85901c04dc5d9ea40d3832622659a502", "score": "0.5449749", "text": "func (s *storage) Store(p Piece) {\n s.Lock()\n defer s.Unlock()\n\n s.pieces[p.Index] = PieceMeta{\n p.Index,\n p.Begin,\n p.Piece.Size,\n }\n\n s.checkCompleted()\n}", "title": "" }, { "docid": "d5cf43da9f765fdc799dd2611a5e2c99", "score": "0.54426545", "text": "func (s KVStorage) Store(key string, value []byte) error {\r\n\tfilename := filepath.Join(storagePath, key)\r\n\r\n\terr := ioutil.WriteFile(filename, value, 0644)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\treturn nil\r\n}", "title": "" }, { "docid": "0cc057be6edb51473991698711d11aca", "score": "0.5432294", "text": "func (hs *SimpleKVHashStore) StoreHash(pw string) uint64 {\n\tstartTime := time.Now()\n\tif (hs.shutdown) {\n\t\treturn 0\n\t}\n\n\tid := atomic.AddUint64(&(hs.ctr), 1);\n\t// if our channel buffer is full, the store could cause the calling thread to block, so doing the store\n\t// in a new goroutine\n\tgo func() {\n\t\ths.sm <- storemsg{id, pw, startTime}\n\t}()\n\n\treturn id;\n}", "title": "" }, { "docid": "edd5c3a7c1b3bf6a5c0d60bf9938810d", "score": "0.5431438", "text": "func (fi HashedFileInfo) Hash() string {\n return fi.FileHash\n}", "title": "" }, { "docid": "820c738d6e157ba77125fc031168893e", "score": "0.53957945", "text": "func (ms *MemoryStorage) Save(key, value string) {\n\tms.m[key] = value\n}", "title": "" }, { "docid": "3612f635ab4edb135fdfc297a83f26a6", "score": "0.5395614", "text": "func (cluster NounCluster) Store(filename string) {\n b := new(bytes.Buffer)\n g := gob.NewEncoder(b)\n err := g.Encode(cluster)\n if err != nil {\n fmt.Println(err)\n }\n fh, eopen := os.OpenFile(filename, os.O_CREATE|os.O_WRONLY, 0666)\n defer fh.Close()\n if eopen != nil {\n fmt.Println(eopen)\n }\n _,ewrite := fh.Write(b.Bytes())\n if ewrite != nil {\n fmt.Println(ewrite)\n }\n // fmt.Fprintf(os.Stderr, \"%d bytes successfully written to file\\n\", n)\n}", "title": "" }, { "docid": "426e1b61eb83e7632a5955b497303092", "score": "0.53879815", "text": "func SaveMap() {\n\tbuffer := new(bytes.Buffer)\n\tencoder := gob.NewEncoder(buffer)\n\n\tif err := encoder.Encode(piecesByFilename); err != nil {\n\t\tlog.Print(err)\n\t}\n\n\tif err := ioutil.WriteFile(pieceFile, buffer.Bytes(), 0644); err != nil {\n\t\tlog.Print(err)\n\t}\n}", "title": "" }, { "docid": "75020ed9399a8b33439b951892573613", "score": "0.5378843", "text": "func (v *Vault) Store(p string, s map[string]interface{}) error {\n\tif _, err := v.client.Write(p, s); err != nil {\n\t\treturn fmt.Errorf(\"Error writing to vault at path %s: %v\", p, err)\n\t}\n\tlog.Printf(\"Assets written to vault at path %s\", p)\n\treturn nil\n}", "title": "" }, { "docid": "f24718ab83d6233f9d6d052df969dbff", "score": "0.5357906", "text": "func (hi *DirectoryInfo) Save() error {\n\tif len(hi.previousFiles) == len(hi.currentFiles) && !hi.dirty {\n\t\treturn nil\n\t}\n\n\tvar buf bytes.Buffer\n\tgz := gzip.NewWriter(&buf)\n\n\tif err := json.NewEncoder(gz).Encode(hi.currentFiles); err != nil {\n\t\treturn err\n\t}\n\tgz.Flush()\n\n\tvalue := buf.Bytes()\n\n\terr := hi.parent.db.Update(func(t *bolt.Tx) error {\n\t\tb := t.Bucket(hashcacheBucket)\n\t\tif b == nil {\n\t\t\tvar err error\n\t\t\tb, err = t.CreateBucket(hashcacheBucket)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\treturn b.Put(hi.parent.keyOf(hi.dirName), value)\n\t})\n\n\tif err != nil {\n\t\tlog.Printf(\"warning: failed to update hash cache: %v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "940e63c28e134393d3847a6d62e5751d", "score": "0.5356531", "text": "func (_HoQuStorageAccessor *HoQuStorageAccessorCaller) Store(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _HoQuStorageAccessor.contract.Call(opts, out, \"store\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "940e63c28e134393d3847a6d62e5751d", "score": "0.5356531", "text": "func (_HoQuStorageAccessor *HoQuStorageAccessorCaller) Store(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _HoQuStorageAccessor.contract.Call(opts, out, \"store\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "d08a8b77fabaeac7c276ba583a91d3e9", "score": "0.5348815", "text": "func (s ShardedHashKey) Location() (pathname string, filename string) {\n\th := fnv.New64a()\n\tio.WriteString(h, string(s))\n\tdigest := h.Sum(nil)\n\n\tpathname = fmt.Sprintf(\"%x\", digest[0:1])\n\tfilename = fmt.Sprintf(\"%x\", digest[1:])\n\treturn\n}", "title": "" }, { "docid": "a3620a9e9bac7225ce513955efdd42ff", "score": "0.5346252", "text": "func (d *DiskStorage) Store(key string, bytes []byte) error {\n\tfp := path.Join(d.BaseDir, key)\n\tif _, err := os.Stat(fp); !os.IsNotExist(err) {\n\t\treturn err\n\t}\n\treturn ioutil.WriteFile(fp, bytes, 777)\n}", "title": "" }, { "docid": "74f803cc69bd3e04cc5e0637758b96bb", "score": "0.5342149", "text": "func (f *file) storeInfo(si *storedInfo) {\n\tf.walk(f.f, func(n ast.Node) bool {\n\t\tif n != nil {\n\t\t\tswitch t := n.(type) {\n\t\t\tcase *ast.FuncDecl:\n\t\t\t\tsi.init(t.Name.Name)\n\t\t\t\tf.walkFuncDecl(si, t)\n\t\t\t\twalkStmt(si, t.Body)\n\t\t\t\treturn false\n\t\t\tdefault:\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t})\n}", "title": "" }, { "docid": "e186970874cabf492e6de4b488fe4708", "score": "0.53408426", "text": "func (s HashKey) Location() (pathname string, filename string) {\n\th := fnv.New64a()\n\tio.WriteString(h, string(s))\n\tdigest := h.Sum(nil)\n\n\tpathname = \"\"\n\tfilename = fmt.Sprintf(\"%x\", digest)\n\treturn\n}", "title": "" }, { "docid": "bfe488bd4b741b934e62398d506c4526", "score": "0.5328867", "text": "func (be *MemoryBackend) Save(ctx context.Context, h restic.Handle, rd restic.RewindReader) error {\n\tif err := h.Valid(); err != nil {\n\t\treturn err\n\t}\n\n\tbe.m.Lock()\n\tdefer be.m.Unlock()\n\n\tif h.Type == restic.ConfigFile {\n\t\th.Name = \"\"\n\t}\n\n\tif _, ok := be.data[h]; ok {\n\t\treturn errors.New(\"file already exists\")\n\t}\n\n\tbuf, err := ioutil.ReadAll(rd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbe.data[h] = buf\n\tdebug.Log(\"saved %v bytes at %v\", len(buf), h)\n\n\treturn nil\n}", "title": "" }, { "docid": "485a3b225161f171415c945deaf28198", "score": "0.53190607", "text": "func (ht *HashTracker) Hash(hashName string) *HashTracker {\n\tfor _, geo := range ht.Geos {\n\t\thashVal := geo.Hash(hashName)\n\t\tgBytes, err := json.Marshal(geo)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tht.rawHashValues.Geos[string(gBytes)] = hashVal\n\t}\n\n\tfor _, zip := range ht.Zips {\n\t\thashVal := zip.Hash(hashName)\n\t\tht.rawHashValues.Zips[int(zip)] = hashVal\n\t}\n\n\tfor _, word := range ht.Words {\n\t\thashVal := word.Hash(hashName)\n\t\tht.rawHashValues.Words[string(word)] = hashVal\n\t}\n\treturn ht\n}", "title": "" }, { "docid": "998b5b83cea113296dee2ce0ce1d48cd", "score": "0.53141004", "text": "func (db *BoltDB) persistHashData(hashData *HashData) error {\n\tconst funcName = \"persistHashData\"\n\treturn db.DB.Update(func(tx *bolt.Tx) error {\n\t\tbkt, err := fetchBucket(tx, hashDataBkt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Do not persist already existing hash rate.\n\t\tif bkt.Get([]byte(hashData.UUID)) != nil {\n\t\t\tdesc := fmt.Sprintf(\"%s: hash data %s already exists\", funcName,\n\t\t\t\thashData.UUID)\n\t\t\treturn errs.DBError(errs.ValueFound, desc)\n\t\t}\n\n\t\thBytes, err := json.Marshal(hashData)\n\t\tif err != nil {\n\t\t\tdesc := fmt.Sprintf(\"%s: unable to marshal hash data bytes: %v\",\n\t\t\t\tfuncName, err)\n\t\t\treturn errs.DBError(errs.Parse, desc)\n\t\t}\n\t\terr = bkt.Put([]byte(hashData.UUID), hBytes)\n\t\tif err != nil {\n\t\t\tdesc := fmt.Sprintf(\"%s: unable to persist hash data entry: %v\",\n\t\t\t\tfuncName, err)\n\t\t\treturn errs.DBError(errs.PersistEntry, desc)\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "df08cecc5c2e3fc0f7c1cc8d435dd891", "score": "0.53117293", "text": "func (p *PairsManager) Store(a asset.Item, ps PairStore) {\n\tp.m.Lock()\n\n\tif p.Pairs == nil {\n\t\tp.Pairs = make(map[asset.Item]*PairStore)\n\t}\n\n\tif !p.AssetTypes.Contains(a) {\n\t\tp.AssetTypes = append(p.AssetTypes, a)\n\t}\n\n\tp.Pairs[a] = &ps\n\tp.m.Unlock()\n}", "title": "" }, { "docid": "57f64e76a1560ef96cc640d90bb00a2d", "score": "0.53044844", "text": "func (_HoQuStorageAccessor *HoQuStorageAccessorSession) Store() (common.Address, error) {\n\treturn _HoQuStorageAccessor.Contract.Store(&_HoQuStorageAccessor.CallOpts)\n}", "title": "" }, { "docid": "57f64e76a1560ef96cc640d90bb00a2d", "score": "0.53044844", "text": "func (_HoQuStorageAccessor *HoQuStorageAccessorSession) Store() (common.Address, error) {\n\treturn _HoQuStorageAccessor.Contract.Store(&_HoQuStorageAccessor.CallOpts)\n}", "title": "" }, { "docid": "22d0a3b75d3994752f4e9b886fb210e1", "score": "0.5297643", "text": "func (sm *simpleMap) Hash() []byte {\n\tsm.Sort()\n\treturn hashKVPairs(sm.kvs)\n}", "title": "" }, { "docid": "8ce7041883f54cfeca09fd8e4b0b59d1", "score": "0.5286404", "text": "func (userdata *User) StoreFile(filename string, data []byte) (err error) {\n\t//check userdata\n\t_, err = GetUser(userdata.Username, userdata.Password)\n\tif err != nil {\n\n\t\treturn err\n\t}\n\n\t//create file id and store it to userdata\n\tfileUUID := uuid.New()\n\tuserdata.FileKey[filename] = fileUUID\n\n\t//create and popullate instance of sharing record\n\tsharingkey := strings.Replace(fileUUID.String(), \"-\", \"\", -1)\n\n\t//check data length\n\tif (len(data) % configBlockSize) != 0 {\n\t\terr := errors.New(\"Invalid Data Size\")\n\t\treturn err\n\t}\n\n\t//create inodeindirect and add one inode\n\t//and save it to location pointed by\n\t//first 8 bytes of sharing key\n\tinodeIndirect := []uuid.UUID{}\n\tinodeID := uuid.New()\n\tinode := []uuid.UUID{}\n\tinodeIndirect = append(inodeIndirect, inodeID)\n\n\t//save encoded inode\n\tencodedInode, _ := json.Marshal(inode)\n\tuserlib.DatastoreSet(inodeID.String(), encodedInode)\n\n\t//save encoded inodeindirect\n\tencodedInodeIndirect, _ := json.Marshal(inodeIndirect)\n\tuserlib.DatastoreSet(string(sharingkey[:8]), encodedInodeIndirect)\n\n\t//save data to empty file\n\terr = userdata.AppendFile(filename, data)\n\treturn\n}", "title": "" }, { "docid": "4122336756bf29da8e01a07cb09ad715", "score": "0.5276681", "text": "func (sm *simpleMap) Hash() []byte {\n\tsm.Sort()\n\treturn hashKVPairs(sm.Kvs)\n}", "title": "" }, { "docid": "34a19c93f853b0123bfa0133e195838d", "score": "0.52722317", "text": "func Save(service *service.Service) (hash string, err error) {\n\tbytes, err := proto.Marshal(service)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdb, err := open()\n\tdefer close()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\thash = service.Hash()\n\treturn hash, db.Put([]byte(hash), bytes, nil)\n}", "title": "" }, { "docid": "daf0cffe5d88e2eefb8ac7eedba4a370", "score": "0.52616686", "text": "func (store FileStore) writeInfo(id string, info tusd.FileInfo) error {\n\tdata, err := json.Marshal(info)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn ioutil.WriteFile(store.infoPath(id), data, defaultFilePerm)\n}", "title": "" }, { "docid": "742b9e26849cf4ab7980c62f512e3f5a", "score": "0.52547777", "text": "func (fs FileStore) Store(private crypto.PrivateKey, curveType string, deriveKeyOptions multi.OptionsBuilders) ([]byte, error) {\n\tstorageKey, keyDefFunc, err := multi.DeriveKey(deriveKeyOptions)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"could not derive storage key\")\n\t}\n\tencrypted, err := easySeal(private.Bytes(), storageKey)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"could seal storage key\")\n\t}\n\taddress := private.PublicKey().Address()\n\tkeyJSON := keystore.EncryptedKey{\n\t\tAddress: hex.EncodeToString(address),\n\t\tStorageCipher: \"nacl\",\n\t\tCipherText: encrypted,\n\t\tCurveType: curveType,\n\t\tID: uuid.New().String(),\n\t\tKDF: keyDefFunc,\n\t\tTimestamp: time.Now(),\n\t\tVersion: \"0.0.0\", // TODO: get the actual version of this\n\t}\n\tif keyDefFunc != kdf.Scrypt {\n\t\treturn nil, errors.Errorf(\"kdf not supported\")\n\t}\n\n\tkeyJSON.ScryptParams = scrypt.CreateOptions(deriveKeyOptions.Scrypt)\n\tcontent, err := json.Marshal(keyJSON)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Write into temporary file\n\ttmpName, err := writeTemporaryKeyFile(fs.filename(address), content)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn address, os.Rename(tmpName, fs.filename(address))\n}", "title": "" }, { "docid": "747a5b5d206914e4005315c88ac80bc8", "score": "0.5252299", "text": "func (s *Store) Info() abci.ResponseInfo {\n\ts.logger.Info(\"Info synced\",\n\t\t\"height\", s.height,\n\t\t\"hash\", fmt.Sprintf(\"%X\", s.Hash()))\n\treturn abci.ResponseInfo{\n\t\tData: cmn.Fmt(\"size:%v\", s.State.Size()),\n\t\tLastBlockHeight: s.height,\n\t\tLastBlockAppHash: s.Hash(),\n\t}\n}", "title": "" }, { "docid": "a8b6ddf185415bdee63d3a734dd87f73", "score": "0.5251869", "text": "func (c *Cookbook) InfoHash(numResults interface{}) map[string]interface{} {\n\treturn c.infoHashBase(numResults, \"\")\n}", "title": "" }, { "docid": "6f066ca8d2f854f617a01dbfcb425fa2", "score": "0.52433556", "text": "func infoHash(info interface{}) (*util.Hash, error) {\n\tdata, err := bencode.Marshal(info)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &util.Hash{Value: sha1.Sum(data)}, nil\n}", "title": "" }, { "docid": "6c8eb4bebcad2e63e6859bd3efb425b3", "score": "0.52389693", "text": "func (f *MockFilecoinBackend) Store(data io.Reader, addr addr.Address, userToken string) (jobID, contentID string, size int64, err error) {\n\n\tcontentID, err = randCid()\n\tif err != nil {\n\t\treturn\n\t}\n\tjobID, err = randCid()\n\tif err != nil {\n\t\treturn\n\t}\n\n\toutfile, err := os.Create(path.Join(f.dataDir, contentID))\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer outfile.Close()\n\n\tsize, err = io.Copy(outfile, data)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tf.mtx.Lock()\n\tdefer f.mtx.Unlock()\n\tf.jobs[jobID] = \"finalized\" // TODO: use correct status\n\n\t// TODO: check address balance?\n\n\treturn contentID, jobID, size, nil\n}", "title": "" }, { "docid": "b76a758c92c4a66498348a1dd6b4f99a", "score": "0.5235728", "text": "func (node *Node) Save(key, value string) {\n\tfmt.Printf(\"Save %q : %q\\n\", key, value)\n\n\tvar saveNodeAddr string\n\n\t// get hash of key\n\tkeyHash := getHash(key)\n\n\t// find the node suitable to store the key and\n\t// get its rpc client\n\tnode.self.Call(\"RPCNode.Successor\", keyHash, &saveNodeAddr)\n\tsaveNode, err := getClient(saveNodeAddr)\n\n\tif err != nil {\n\t\tfor err.Error() == ErrUnableToDial.Error() {\n\t\t\tnode.self.Call(\"RPCNode.Successor\", keyHash, &saveNodeAddr)\n\t\t\tsaveNode, err = getClient(saveNodeAddr)\n\t\t}\n\t}\n\n\tdata := make(dataStore)\n\tdata[key] = value\n\n\t// save the data on the node\n\tsaveNode.Call(\"RPCNode.SetData\", &data, \"\")\n\tsaveNode.Close()\n}", "title": "" }, { "docid": "029128ae7c116f61bef12db5fecb77f2", "score": "0.523492", "text": "func (s *Settings) Store() {\n\tf, err := os.Create(settingsFile)\n\tdata, err := json.Marshal(s)\n\tdlog.ErrorCheck(err)\n\t_, err = f.Write(data)\n\tdlog.ErrorCheck(err)\n\tdlog.ErrorCheck(f.Close())\n}", "title": "" }, { "docid": "7ccd67d9489e57bec6bdcb85ca1890d7", "score": "0.52346116", "text": "func (_HoQuStorageAccessor *HoQuStorageAccessorCallerSession) Store() (common.Address, error) {\n\treturn _HoQuStorageAccessor.Contract.Store(&_HoQuStorageAccessor.CallOpts)\n}", "title": "" }, { "docid": "7ccd67d9489e57bec6bdcb85ca1890d7", "score": "0.52346116", "text": "func (_HoQuStorageAccessor *HoQuStorageAccessorCallerSession) Store() (common.Address, error) {\n\treturn _HoQuStorageAccessor.Contract.Store(&_HoQuStorageAccessor.CallOpts)\n}", "title": "" }, { "docid": "cfc1b06465c4a54a439cf942d6bcde9e", "score": "0.52247894", "text": "func (rm *HostCommandResultMap) Store(key string, value *HostCommandResult) {\n\trm.Lock()\n\trm.Results[key] = value\n\trm.Unlock()\n}", "title": "" }, { "docid": "2d84f0bc5d3aecd432b5340e93a7480f", "score": "0.5218172", "text": "func (h *hashForgetfulChain) Store(data []byte, mask uint, ix uint) {\n\tvar key uint = h.HashBytes(data[ix&mask:])\n\tvar bank uint = key & (h.numBanks - 1)\n\tidx := uint(h.free_slot_idx[bank]) & ((1 << h.bankBits) - 1)\n\th.free_slot_idx[bank]++\n\tvar delta uint = ix - uint(h.addr[key])\n\th.tiny_hash[uint16(ix)] = byte(key)\n\tif delta > 0xFFFF {\n\t\tdelta = 0xFFFF\n\t}\n\th.banks[bank][idx].delta = uint16(delta)\n\th.banks[bank][idx].next = h.head[key]\n\th.addr[key] = uint32(ix)\n\th.head[key] = uint16(idx)\n}", "title": "" }, { "docid": "3844716416f628ea26ce55301ea165ef", "score": "0.5217227", "text": "func (na *naEmulator) Save() error {\n\tpath := na.GetHashPath()\n\n\tna.GetLock()\n\tdefer na.ReleaseLock()\n\n\ts := serializeSize()\n\tbytes, err := serialize(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn ioutil.WriteFile(path, bytes, 0644)\n}", "title": "" }, { "docid": "c0e7d5c541d7fc35044dcbd414b843be", "score": "0.5200277", "text": "func (c Caches) StoreRoomInfo(roomID string, roomInfo types.RoomInfo) {\n\tc.RoomInfos.Set(roomID, roomInfo)\n}", "title": "" }, { "docid": "608a7fba660bb5b0dc54d691234d27a9", "score": "0.51952034", "text": "func (m *CMap) Store(key, value interface{}) {\n\thash := chash(key)\n\tfor {\n\t\tn, b := m.getNodeAndBucket(hash)\n\t\tif b.tryStore(m, n, key, value) {\n\t\t\treturn\n\t\t}\n\t\truntime.Gosched()\n\t}\n}", "title": "" }, { "docid": "1a1130c434c0866b19847eeadfa656c9", "score": "0.51951915", "text": "func Store(ctx context.Context, store cask.Store, fs billy.Filesystem, p string) (cask.Hash, error) {\n\twriter := caskio.NewWriter(store)\n\n\tdirEnts, err := fs.ReadDir(p)\n\tif err != nil {\n\t\treturn cask.ZeroHash, err\n\t}\n\n\tentries := make(entries, 0, len(dirEnts))\n\tfor _, dirEnt := range dirEnts {\n\t\tvar err error\n\t\tmode := NoMode\n\t\thash := cask.ZeroHash\n\t\tname := path.Join(p, dirEnt.Name())\n\t\tif dirEnt.IsDir() {\n\t\t\tmode = DirMode\n\t\t\thash, err = Store(ctx, store, fs, name)\n\t\t\tif err != nil {\n\t\t\t\treturn cask.ZeroHash, err\n\t\t\t}\n\t\t} else if dirEnt.Mode().IsRegular() {\n\t\t\tif dirEnt.Mode()&0111 == 0 {\n\t\t\t\tmode = FileMode\n\t\t\t} else {\n\t\t\t\tmode = ExecMode\n\t\t\t}\n\t\t\treader, err := fs.Open(name)\n\t\t\tif err != nil {\n\t\t\t\treturn cask.ZeroHash, err\n\t\t\t}\n\t\t\thash, err = caskblob.Store(ctx, store, reader)\n\t\t\tif err != nil {\n\t\t\t\treturn cask.ZeroHash, err\n\t\t\t}\n\t\t} else {\n\t\t\tcontinue\n\t\t}\n\t\tentries = append(entries, Entry{\n\t\t\tName: []byte(dirEnt.Name()),\n\t\t\tMode: mode,\n\t\t\tHash: hash,\n\t\t})\n\t}\n\n\tsort.Sort(entries)\n\tfor _, entry := range entries {\n\t\tif writer.Size()+cask.HashSize+4+len(entry.Name) > cask.BlockSize {\n\t\t\tif err := writer.Flush(ctx); err != nil {\n\t\t\t\treturn cask.ZeroHash, err\n\t\t\t}\n\t\t}\n\t\terr := writer.Link(ctx, entry.Hash)\n\t\tif err != nil {\n\t\t\treturn cask.ZeroHash, err\n\t\t}\n\t\tvar buf [4]byte\n\t\tbinary.BigEndian.PutUint16(buf[0:2], uint16(entry.Mode))\n\t\tbinary.BigEndian.PutUint16(buf[2:4], uint16(len(entry.Name)))\n\t\terr = writer.Copy(ctx, buf[:])\n\t\tif err != nil {\n\t\t\treturn cask.ZeroHash, err\n\t\t}\n\t\terr = writer.Copy(ctx, entry.Name)\n\t\tif err != nil {\n\t\t\treturn cask.ZeroHash, err\n\t\t}\n\t}\n\n\treturn writer.Sum(ctx)\n}", "title": "" }, { "docid": "f5f84ae070c98ac7eb0811006e27903e", "score": "0.5182745", "text": "func (queueMap *QueueMap) Store(value *Queue) {\n\tqueueMap.Lock()\n\tqueueMap.internal[value.Name.String] = value\n\tqueueMap.Unlock()\n}", "title": "" }, { "docid": "00eb57883acf893fafe8a165975e1f48", "score": "0.51760846", "text": "func (p *Provider) Store(url, alias string) error {\n\texists, _ := p.Exists(alias)\n\tif exists {\n\t\treturn storage.ErrAlreadyExists\n\t}\n\n\tp.mutex.Lock()\n\tdefer p.mutex.Unlock()\n\n\tp.URLs[alias] = url\n\n\tbody, err := json.Marshal(p.URLs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tobject := s3.PutObjectInput{\n\t\tBody: bytes.NewReader(body),\n\t\tBucket: aws.String(p.Config.Space),\n\t\tKey: aws.String(p.Config.Path),\n\t}\n\t_, err = p.Spaces.PutObject(&object)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "602ecbfa5a22503236b7286ae9e715ff", "score": "0.51714164", "text": "func (m *streamsMap) Store(key string, s *stream) {\n\tm.store(key, s)\n}", "title": "" }, { "docid": "7454c958800dced99c508d478d6eb641", "score": "0.515927", "text": "func (tracker *fsTracker) save(m map[string]Entry) error {\n\t// encode the map\n\tdata, err := encode(m)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// save the file\n\tpath := filepath.Join(tracker.trackingDir, badConfigsFile)\n\tif err := utilfiles.ReplaceFile(tracker.fs, path, data); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8409ba3e131c7cae66b6247342206f80", "score": "0.5157962", "text": "func (c *computer) storeAtAddr(p param, val int64) {\n\tif p.mode == RelativeMode {\n\t\tc.memory[int(p.val)+c.relativeBase] = val\n\t} else {\n\t\tc.memory[p.val] = val\n\t}\n}", "title": "" }, { "docid": "8ee552a9654699f9774e70fae3d08d6b", "score": "0.5157061", "text": "func (m *Master) StoreCheckPoint() error {\n\tm.RLock()\n\tdefer m.RUnlock()\n\n\tfilename := path.Join(string(m.metaPath), \"checkpoint.dat\")\n\tfd, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE, 0755)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer fd.Close()\n\tckcp := MasterCKP{\n\t\t// manage the state of chunkserver node\n\t\t// Servers: m.css.Serialize(),\n\t\tCs: m.cs.Serialize(),\n\t\tNamespace: m.ns.Serialize(),\n\t}\n\tlogrus.Debugln(ckcp)\n\tenc := gob.NewEncoder(fd)\n\terr = enc.Encode(ckcp)\n\tif err != nil {\n\t\tlogrus.Warnf(\"StoreCheckPointError : %s\\n\", err)\n\t\treturn err\n\t}\n\t//TODO : truncate the log\n\tfilename = path.Join(string(m.metaPath), \"log.dat\")\n\tf, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE, 0644)\n\tif err != nil {\n\t\tlogrus.Panic(err)\n\t\treturn err\n\t}\n\tdefer f.Close()\n\terr = f.Truncate(0) //clear log\n\tif err != nil {\n\t\tlogrus.Warnf(\"StoreCheckPointError : %s\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ebac6ddfe8eebe01a7dac9277737c7c7", "score": "0.5151883", "text": "func (s *dummyStore) Upload(ctx context.Context, file *bytes.Reader, fileType string) (string, error) {\n\tdata, err := ioutil.ReadAll(file)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tuniqueKey := uuid.NewV4().String()\n\ts.hash[uniqueKey] = data\n\treturn uniqueKey, nil\n}", "title": "" }, { "docid": "e7cd5305135c3e79d4317deaaede4c5a", "score": "0.5151103", "text": "func (hsm HostStorageMap) Add(hostAddr string, hs *HostStorage) (err error) {\n\thk, err := hs.HashKey()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, exists := hsm[hk]; !exists {\n\t\thsm[hk], err = NewHostStorageSet(hostAddr, hs)\n\t\treturn\n\t}\n\t_, err = hsm[hk].HostSet.Insert(hostAddr)\n\treturn\n}", "title": "" }, { "docid": "9ed55afad703ed161cdad281d41f2387", "score": "0.5150797", "text": "func (ms *memoryStore) Store(key Key, data []byte, replication time.Time, expiration time.Time, publisher bool) error {\n\tms.mutex.Lock()\n\tdefer ms.mutex.Unlock()\n\n\tkeyStr := key.String()\n\n\tms.replicateMap[keyStr] = replication\n\tms.expireMap[keyStr] = expiration\n\tms.data[keyStr] = data\n\treturn nil\n}", "title": "" }, { "docid": "1a8b99de94d8c04a4fc605f539288a58", "score": "0.51444876", "text": "func (m *MemoryHandler) store(item *resource.Item) error {\n\tvar data bytes.Buffer\n\tenc := gob.NewEncoder(&data)\n\tif err := enc.Encode(*item); err != nil {\n\t\treturn err\n\t}\n\tm.items[item.ID] = data.Bytes()\n\treturn nil\n}", "title": "" }, { "docid": "f2d3cde287e920f1dc9a1d8f7729dda8", "score": "0.5143075", "text": "func (node *SdfsNode) Store() {\n\tfmt.Println(node.GetLocalFiles())\n}", "title": "" }, { "docid": "efd6367116ff7c87239ee09342e3f33e", "score": "0.5142954", "text": "func (v *MapValue) Store(value llvm.Value) {\n\tpanic(\"interp: store on a map\")\n}", "title": "" }, { "docid": "18417c7425bb464215accea72d9aebb6", "score": "0.5142542", "text": "func (s *FakeStore) Save(h *host.Host) error {\n\ts.Hosts[h.Name] = h\n\treturn nil\n}", "title": "" }, { "docid": "fb01c0681f2764159cb75a5639b95113", "score": "0.5135045", "text": "func (gd *GoogleDrive) store(localPath *string, finfo *filesys.FileInfo, remotePath *string) {\n\tlog.Printf(\"Store %s\\n\", *localPath)\n\t_, file := path.Split(*remotePath)\n\tlog.Print(file)\n}", "title": "" } ]
919061ee6c4ce5ac5aa61a43bff6dd35
NewMetadataResponseWithDefaults instantiates a new MetadataResponse object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set
[ { "docid": "c60aea285c8950fe065cf2876b3ed5de", "score": "0.7779265", "text": "func NewMetadataResponseWithDefaults() *MetadataResponse {\n\tthis := MetadataResponse{}\n\treturn &this\n}", "title": "" } ]
[ { "docid": "e440faa4b06a1171786b9c8fcae70ca9", "score": "0.70101273", "text": "func NewResponseWithDefaults() *Response {\n\tthis := Response{}\n\treturn &this\n}", "title": "" }, { "docid": "9cd514cc8d3d464bf2b3fb08595dea8d", "score": "0.6070588", "text": "func NewBlobInfoResponseWithDefaults() *BlobInfoResponse {\n\tthis := BlobInfoResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "1ae23f26aebde15ceba27f2800028956", "score": "0.5973583", "text": "func NewPeopleResponseWithDefaults() *PeopleResponse {\n\tthis := PeopleResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "70adf4ddc1febf3d4f1c97316f53458b", "score": "0.59376097", "text": "func (m *MetricsQueryResponse) Defaults(ver string) bool {\n\treturn false\n}", "title": "" }, { "docid": "125f996cba7e6905115ac9ef66164816", "score": "0.58732915", "text": "func (qgpr QueueGetPropertiesResponse) NewMetadata() Metadata {\n\tmd := Metadata{}\n\tfor k, v := range qgpr.rawResponse.Header {\n\t\tif len(k) > mdPrefixLen {\n\t\t\tif prefix := k[0:mdPrefixLen]; strings.EqualFold(prefix, mdPrefix) {\n\t\t\t\tmd[strings.ToLower(k[mdPrefixLen:])] = v[0]\n\t\t\t}\n\t\t}\n\t}\n\treturn md\n}", "title": "" }, { "docid": "9f95a810303713830019ccc405d6a9c2", "score": "0.58493924", "text": "func NewV1TaxonomyMetadataResponseWithDefaults() *V1TaxonomyMetadataResponse {\n\tthis := V1TaxonomyMetadataResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "b7035efe915dd8873d4630903612deb7", "score": "0.57960856", "text": "func NewSettingsObjectResponseWithDefaults() *SettingsObjectResponse {\n\tthis := SettingsObjectResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "b7035efe915dd8873d4630903612deb7", "score": "0.57960856", "text": "func NewSettingsObjectResponseWithDefaults() *SettingsObjectResponse {\n\tthis := SettingsObjectResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "ec7f87a397c25edf5934c64e12b998e1", "score": "0.5793865", "text": "func NewErrataResponseWithDefaults() *ErrataResponse {\n\tthis := ErrataResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "70e1d043e0eda19c66caf07cd12d8551", "score": "0.57259977", "text": "func NewQueryResponseWithDefaults() *QueryResponse {\n\tthis := QueryResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "ec337e107fa3ea91bb80804f722ff237", "score": "0.5603041", "text": "func newBaseResponse() baseResponse {\n\tr := baseResponse{}\n\tr.SetCommonValues()\n\treturn r\n}", "title": "" }, { "docid": "a694577c3026d9640874c5aa32e132bb", "score": "0.55656266", "text": "func NewTimestampResponseDefault(code int) *TimestampResponseDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &TimestampResponseDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "34c9ede54b0838210050e5f71ef28aa7", "score": "0.55299973", "text": "func NewPackagesResponseWithDefaults() *PackagesResponse {\n\tthis := PackagesResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "868c8876c798a5ea2b5ba57bfb1b4e3a", "score": "0.55277485", "text": "func (m *SearchResponse) Defaults(ver string) bool {\n\treturn false\n}", "title": "" }, { "docid": "0642f0f13914f1c9cb0551e3a00bb5b8", "score": "0.55161", "text": "func (mc *MetadataCreate) defaults() error {\n\tif _, ok := mc.mutation.CreatedAt(); !ok {\n\t\tif metadata.DefaultCreatedAt == nil {\n\t\t\treturn fmt.Errorf(\"ent: uninitialized metadata.DefaultCreatedAt (forgotten import ent/runtime?)\")\n\t\t}\n\t\tv := metadata.DefaultCreatedAt()\n\t\tmc.mutation.SetCreatedAt(v)\n\t}\n\tif _, ok := mc.mutation.UpdatedAt(); !ok {\n\t\tif metadata.DefaultUpdatedAt == nil {\n\t\t\treturn fmt.Errorf(\"ent: uninitialized metadata.DefaultUpdatedAt (forgotten import ent/runtime?)\")\n\t\t}\n\t\tv := metadata.DefaultUpdatedAt()\n\t\tmc.mutation.SetUpdatedAt(v)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "61d8dacf71793e5be27f2d0c30988cc2", "score": "0.54925084", "text": "func NewIdentityMatchResponseWithDefaults() *IdentityMatchResponse {\n\tthis := IdentityMatchResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "34e35dfef34e03f69b7ed2e573948799", "score": "0.5486727", "text": "func NewHashResponseWithDefaults() *HashResponse {\n\tthis := HashResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "c2ba8b9fd8a563c8c6caed77da7b8155", "score": "0.54529625", "text": "func NewTimeseriesResponseAttributesWithDefaults() *TimeseriesResponseAttributes {\n\tthis := TimeseriesResponseAttributes{}\n\treturn &this\n}", "title": "" }, { "docid": "9bee440a4ae9f86117e92756ff35e341", "score": "0.5418788", "text": "func NewMetadataResponse() *MetadataResponse {\n\tthis := MetadataResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "fec44f359503ceb5f242c8750e7e3037", "score": "0.5388046", "text": "func NewDefaultResponseManager() (mgr *DefaultResponseManager) {\n\tmgr = &DefaultResponseManager{\n\t\tResponseMap: make(map[string]interface{}, 10),\n\t}\n\treturn\n}", "title": "" }, { "docid": "e80d0aaf1ff9c73d1bfbe6ecef4d3ba1", "score": "0.53504926", "text": "func addDefaultResponseFields(structure *definition.Structure) {\n\tif structure.HasField(\"Error\") {\n\t\treturn\n\t}\n\tstructure.Fields = append(structure.Fields, definition.Field{\n\t\tComment: \"Error is an error message if one occurred.\",\n\t\tName: \"Error\",\n\t\tType: definition.Type{\n\t\t\tName: \"string\",\n\t\t},\n\t})\n}", "title": "" }, { "docid": "4a72571db5e08ee7d80142238ab28658", "score": "0.5328204", "text": "func NewCreatePublicIpResponseWithDefaults() *CreatePublicIpResponse {\n\tthis := CreatePublicIpResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "d00d73441169d2401cbce18858b0c433", "score": "0.53154093", "text": "func DefaultResponse() []Response {\n\treturn []Response{}\n}", "title": "" }, { "docid": "c6e2860cd1c8fc5d46f2e7759ba29c83", "score": "0.53066677", "text": "func NewUserCreateResponseWithDefaults() *UserCreateResponse {\n\tthis := UserCreateResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "50d5e3959f56300e1c66a5a5ef9475f1", "score": "0.5296472", "text": "func (m *Metadata) new() Metadata {\n\treturn Metadata{\n\t\tProjectPath: \"\",\n\t\tName: \"default-repo\",\n\t\tOwner: \"default-owner\",\n\t\tVersion: \"1.0.0\",\n\t\tImports: DefaultImports,\n\t\tDescription: \"A default service\",\n\t\tEntrypoint: \"default-service\",\n\t\tMainBranch: \"main\",\n\t\tIsPrivate: true,\n\t\tHasCopyright: true,\n\t\tHasLicense: true,\n\t\tHasGitIgnore: true,\n\t}\n}", "title": "" }, { "docid": "e087b1417a7fdbf18d19e47ec5e436cc", "score": "0.52813005", "text": "func NewMetaData(clientID string, optionals ...MetaDataOptional) (*MetaData, error) {\n\ttmp := metaData{obj: MetaData{\n\t\tclientID: &clientID,\n\t}}\n\n\tfor _, setter := range optionals {\n\t\tif setter == nil {\n\t\t\treturn nil, errors.New(errors.KsiInvalidArgumentError).AppendMessage(\"Provided option is nil.\")\n\t\t}\n\t\tif err := setter(&tmp); err != nil {\n\t\t\treturn nil, errors.KsiErr(err).AppendMessage(\"Unable to initialize metadata.\")\n\t\t}\n\t}\n\n\trawTlv, err := tmp.obj.EncodeToTlv()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttmp.obj.rawTlv = rawTlv\n\n\treturn &tmp.obj, nil\n}", "title": "" }, { "docid": "ff785d7d6a09c95289ffe7806026a37d", "score": "0.5266401", "text": "func NewServicesResponseWithDefaults() *ServicesResponse {\n\tthis := ServicesResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "e6b9d206ea6e866d67dbd08fc0185984", "score": "0.5235153", "text": "func NewBulkCreateResponseWithDefaults() *BulkCreateResponse {\n\tthis := BulkCreateResponse{}\n\tvar superkey bool = false\n\tthis.Superkey = &superkey\n\treturn &this\n}", "title": "" }, { "docid": "3667be660477741b995055b59355353a", "score": "0.5221591", "text": "func NewRemountResponseWithDefaults() *RemountResponse {\n\tvar this RemountResponse\n\n\treturn &this\n}", "title": "" }, { "docid": "e22489ec3cf3ac83f9b9eb3199b130f3", "score": "0.52090746", "text": "func NewTfaVerificationResponseWithDefaults() *TfaVerificationResponse {\n\tthis := TfaVerificationResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "5f1bc6f7629fa77ac4f7f28fa6707cba", "score": "0.5202296", "text": "func NewResponseContextWithDefaults() *ResponseContext {\n\tthis := ResponseContext{}\n\treturn &this\n}", "title": "" }, { "docid": "277343875de2614bf30bea9bac35e64c", "score": "0.5197923", "text": "func NewMetadata() (md *Metadata) {\n\tmd = &Metadata{\n\t\tvals: map[string]string{},\n\t}\n\treturn md\n}", "title": "" }, { "docid": "83320f083fc8a78c08e657158136a30b", "score": "0.5186234", "text": "func (o *GetTvlpResultParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "title": "" }, { "docid": "837f19143d28ef6d5d50f3533b1183e1", "score": "0.51837647", "text": "func (o *GetNamespaceUsingGETParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "title": "" }, { "docid": "3b4068711e1be282ca2e256030f01d79", "score": "0.51539665", "text": "func NewInvoiceResponseWithDefaults() *InvoiceResponse {\n\tthis := InvoiceResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "d61154f8574c0150cab7331ad9d17b9d", "score": "0.5139125", "text": "func (o *GetKubeConfigUsingGETParams) SetDefaults() {\n\tvar (\n\t\tignoreTMCDefault = bool(false)\n\t)\n\n\tval := GetKubeConfigUsingGETParams{\n\t\tIgnoreTMC: &ignoreTMCDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "title": "" }, { "docid": "f23a1164139321e3010246e2514c5001", "score": "0.5130005", "text": "func NewGetTimestampResponseDefault(code int) *GetTimestampResponseDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &GetTimestampResponseDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "b4684847a4a8faa437a9c8656c924390", "score": "0.51160216", "text": "func NewEnvironmentResponseWithDefaults() *EnvironmentResponse {\n\tthis := EnvironmentResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "32b1a403de9279f8f1b003085d24938a", "score": "0.5111428", "text": "func NewResponse(opts ...interface{}) *Response {\n\tres := &Response{Message: Message{Headers: Headers{}, Content: NewAsset(\"\")}}\n\tfor _, opt := range opts {\n\t\tswitch v := opt.(type) {\n\t\tcase http.ResponseWriter:\n\t\t\tres.Writer = v\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"Unknown option type %T\\n\", v))\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "a815051ce0926e1c212c0f903ac727a6", "score": "0.51020855", "text": "func NewVerifyUserResponseWithDefaults() *VerifyUserResponse {\n\tthis := VerifyUserResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "14b79edafcd07fd505c809b079d37cdb", "score": "0.50489557", "text": "func (x *fastReflection_ConfigResponse) New() protoreflect.Message {\n\treturn new(fastReflection_ConfigResponse)\n}", "title": "" }, { "docid": "ea17e1521e76962e9068a64bf128f235", "score": "0.50459075", "text": "func NewCreateHTTPResponseRuleDefault(code int) *CreateHTTPResponseRuleDefault {\n\treturn &CreateHTTPResponseRuleDefault{\n\t\t_statusCode: code,\n\t\tConfigurationVersion: 0,\n\t}\n}", "title": "" }, { "docid": "9936773cab53c97793f1903fb6ebd53b", "score": "0.5039707", "text": "func (o *GetUsingGET1Params) SetDefaults() {\n\t// no default values defined for this parameter\n}", "title": "" }, { "docid": "388183a4aa670ce74174172ff4ab0632", "score": "0.5032399", "text": "func (o *DownloadHistoryUsingGETParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "title": "" }, { "docid": "206746f707743faa3950b7486544133d", "score": "0.5029585", "text": "func newResponse(r *http.Response) *Response {\n\tresponse := &Response{Response: r}\n\tresponse.populatePageValues()\n\treturn response\n}", "title": "" }, { "docid": "a135bd0f9eed73f51dd0625fef34711e", "score": "0.5015335", "text": "func (o *NvmeServiceCollectionGetParams) SetDefaults() {\n\tvar (\n\t\treturnRecordsDefault = bool(true)\n\n\t\treturnTimeoutDefault = int64(15)\n\t)\n\n\tval := NvmeServiceCollectionGetParams{\n\t\tReturnRecords: &returnRecordsDefault,\n\t\tReturnTimeout: &returnTimeoutDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "title": "" }, { "docid": "bb07d0be989f1741e057d98f17d66b9b", "score": "0.5013807", "text": "func FromDefault() (Response, error) {\n\treturn FromURL(DefaultURL)\n}", "title": "" }, { "docid": "aa617fc2d50c96938d4585519d279ce6", "score": "0.5011663", "text": "func NewDocumentMetadataWithDefaults() *DocumentMetadata {\n\tthis := DocumentMetadata{}\n\treturn &this\n}", "title": "" }, { "docid": "6f7e8315e6448edca983d92eb908a61a", "score": "0.50046706", "text": "func newResponse(data map[string]string) (*AMIResponse, error) {\n\tr, found := data[\"Response\"]\n\tif !found {\n\t\treturn nil, errNotResponse\n\t}\n\tresponse := &AMIResponse{\n\t\tID: data[\"ActionID\"],\n\t\tStatus: r,\n\t\tParams: make(map[string]string),\n\t}\n\tfor k, v := range data {\n\t\tif k == \"Response\" {\n\t\t\tcontinue\n\t\t}\n\t\tresponse.Params[k] = v\n\t}\n\treturn response, nil\n}", "title": "" }, { "docid": "dd3c707c54b13268ea65087973815472", "score": "0.49971578", "text": "func (o *GetImagesParams) SetDefaults() {\n\tvar (\n\t\tallowUnstableDefault = bool(false)\n\n\t\tlimitDefault = int64(50)\n\n\t\tpageDefault = int64(1)\n\t)\n\n\tval := GetImagesParams{\n\t\tAllowUnstable: &allowUnstableDefault,\n\t\tLimit: &limitDefault,\n\t\tPage: &pageDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "title": "" }, { "docid": "4a1c8c4cf6275945f89ee9cc14eae422", "score": "0.49962553", "text": "func CreateRegisterDefaultPatchBaselineResponse() (response *RegisterDefaultPatchBaselineResponse) {\n\tresponse = &RegisterDefaultPatchBaselineResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "57f9cf7abda0fdcb194deac323c8bd0c", "score": "0.4986555", "text": "func (kpc *K8sPodCreate) defaults() {\n\tif _, ok := kpc.mutation.CreatedAt(); !ok {\n\t\tv := k8spod.DefaultCreatedAt()\n\t\tkpc.mutation.SetCreatedAt(v)\n\t}\n\tif _, ok := kpc.mutation.UpdatedAt(); !ok {\n\t\tv := k8spod.DefaultUpdatedAt()\n\t\tkpc.mutation.SetUpdatedAt(v)\n\t}\n\tif _, ok := kpc.mutation.DeletedAt(); !ok {\n\t\tv := k8spod.DefaultDeletedAt()\n\t\tkpc.mutation.SetDeletedAt(v)\n\t}\n}", "title": "" }, { "docid": "e917597ecb8bbd41f8fbd7c622cadb38", "score": "0.49863127", "text": "func (o *ListPacketGeneratorResultsParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "title": "" }, { "docid": "7ed1e6e4bff59ecc56370afff142ea66", "score": "0.49835002", "text": "func (x *fastReflection_Metadata) New() protoreflect.Message {\n\treturn new(fastReflection_Metadata)\n}", "title": "" }, { "docid": "06739a1c6a451be3931d7223e2bbbdca", "score": "0.49813738", "text": "func (o *RetrieveCatalogObjectParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "title": "" }, { "docid": "f0a9f49614da296bdd7f4a4942d4ffcd", "score": "0.4972682", "text": "func CustomizeResponseFactory(status int, res interface{}, runtime map[string]string) interface{} {\n\tresMap, ok := res.(map[string]interface{})\n\tif !ok {\n\t\tresMap = make(map[string]interface{})\n\t\tresMap[\"data\"] = res\n\t}\n\tresMap[\"status\"] = status\n\tfor k, v := range runtime {\n\t\tresMap[k] = v\n\t}\n\treturn resMap\n}", "title": "" }, { "docid": "362950bbfcd22b51efe8466255246073", "score": "0.49704057", "text": "func (x *fastReflection_QuerySigningInfosResponse) New() protoreflect.Message {\n\treturn new(fastReflection_QuerySigningInfosResponse)\n}", "title": "" }, { "docid": "c62dd75e413abd3e47eda59be447013b", "score": "0.49683884", "text": "func (m *PolicySearchResponse) Defaults(ver string) bool {\n\tvar ret bool\n\tret = true\n\tswitch ver {\n\tdefault:\n\t\tm.Status = \"match\"\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "7fd3ac4a4a9f480c0cc68b9c53a5d7ef", "score": "0.49679294", "text": "func (o *NvmeNamespaceCollectionGetParams) SetDefaults() {\n\tvar (\n\t\treturnRecordsDefault = bool(true)\n\n\t\treturnTimeoutDefault = int64(15)\n\t)\n\n\tval := NvmeNamespaceCollectionGetParams{\n\t\tReturnRecords: &returnRecordsDefault,\n\t\tReturnTimeout: &returnTimeoutDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "title": "" }, { "docid": "c602cccb9f6d0fb588dd75bad93eb0af", "score": "0.49678764", "text": "func NewIsoMetadataWithDefaults() *IsoMetadata {\n\tthis := IsoMetadata{}\n\treturn &this\n}", "title": "" }, { "docid": "4499209fa442690109df65960f01eb09", "score": "0.49380445", "text": "func newResponse(data *textproto.MIMEHeader) (*AMIResponse, error) {\n\tif data.Get(\"Response\") == \"\" {\n\t\treturn nil, errors.New(\"Not Response\")\n\t}\n\tresponse := &AMIResponse{\n\t\tID: \"\",\n\t\tStatus: \"\",\n\t\tParams: make(map[string]string),\n\t}\n\tfor k, v := range *data {\n\t\t//Allways operate on first value\n\t\tfv := v[0]\n\t\tswitch {\n\t\tcase k == \"Response\":\n\t\t\tresponse.Status = fv\n\t\tcase k == \"Actionid\":\n\t\t\tresponse.ID = fv\n\t\tdefault:\n\t\t\tresponse.Params[k] = fv\n\t\t}\n\t}\n\treturn response, nil\n}", "title": "" }, { "docid": "559095f9bf15e07738461311c4da8ec3", "score": "0.49366242", "text": "func New(m map[string]interface{}) XMetaData {\n\tnewm := XMetaData{}\n\tfor k, v := range m {\n\t\tnewm[k] = v\n\t}\n\treturn newm\n}", "title": "" }, { "docid": "a787ce1f42e3f764a50858399c6a8257", "score": "0.49313277", "text": "func (o *FpolicyCreateParams) SetDefaults() {\n\tvar (\n\t\treturnRecordsDefault = bool(false)\n\t)\n\n\tval := FpolicyCreateParams{\n\t\tReturnRecords: &returnRecordsDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "title": "" }, { "docid": "cacae23c7e20c79375a16ec862eb1d8a", "score": "0.49263084", "text": "func (o *GetSampleV2Params) SetDefaults() {\n\tvar (\n\t\tpasswordProtectedDefault = bool(false)\n\t)\n\n\tval := GetSampleV2Params{\n\t\tPasswordProtected: &passwordProtectedDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "title": "" }, { "docid": "c396be659dab4b9e154eefdb47a44f4a", "score": "0.49218634", "text": "func NewWebhookKeyCreateResponseWithDefaults() *WebhookKeyCreateResponse {\n\tthis := WebhookKeyCreateResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "b4ad289e570db4d14e344013650f4c5a", "score": "0.49139518", "text": "func (o *NvmeCollectionPerformanceMetricsGetParams) SetDefaults() {\n\tvar (\n\t\tintervalDefault = string(\"1h\")\n\n\t\treturnRecordsDefault = bool(true)\n\n\t\treturnTimeoutDefault = int64(15)\n\t)\n\n\tval := NvmeCollectionPerformanceMetricsGetParams{\n\t\tInterval: &intervalDefault,\n\t\tReturnRecords: &returnRecordsDefault,\n\t\tReturnTimeout: &returnTimeoutDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "title": "" }, { "docid": "391acbbd7e7276b865e55c425d9ef2a4", "score": "0.4912088", "text": "func (tdrc *TCPDetectorResultCreate) defaults() {\n\tif _, ok := tdrc.mutation.CreatedAt(); !ok {\n\t\tv := tcpdetectorresult.DefaultCreatedAt()\n\t\ttdrc.mutation.SetCreatedAt(v)\n\t}\n\tif _, ok := tdrc.mutation.UpdatedAt(); !ok {\n\t\tv := tcpdetectorresult.DefaultUpdatedAt()\n\t\ttdrc.mutation.SetUpdatedAt(v)\n\t}\n}", "title": "" }, { "docid": "f1802aafe29b25942180365c832079b3", "score": "0.4907977", "text": "func NewBlockReceiptsResponseWithDefaults() *BlockReceiptsResponse {\n\tthis := BlockReceiptsResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "ffd2edb3dafd333698a02e2ee3546c53", "score": "0.4897143", "text": "func NewResponse() *Response {\n\tres := Response{}\n\t// Pre-initialise the maps. Synapse will return {} even if there are no rooms under a specific section,\n\t// so let's do the same thing. Bonus: this means we can't get dreaded 'assignment to entry in nil map' errors.\n\tres.Rooms.Join = map[string]JoinResponse{}\n\tres.Rooms.Peek = map[string]JoinResponse{}\n\tres.Rooms.Invite = map[string]InviteResponse{}\n\tres.Rooms.Leave = map[string]LeaveResponse{}\n\n\t// Also pre-intialise empty slices or else we'll insert 'null' instead of '[]' for the value.\n\t// TODO: We really shouldn't have to do all this to coerce encoding/json to Do The Right Thing. We should\n\t// really be using our own Marshal/Unmarshal implementations otherwise this may prove to be a CPU bottleneck.\n\t// This also applies to NewJoinResponse, NewInviteResponse and NewLeaveResponse.\n\tres.AccountData.Events = []gomatrixserverlib.ClientEvent{}\n\tres.Presence.Events = []gomatrixserverlib.ClientEvent{}\n\tres.ToDevice.Events = []gomatrixserverlib.SendToDeviceEvent{}\n\tres.DeviceListsOTKCount = map[string]int{}\n\n\treturn &res\n}", "title": "" }, { "docid": "1df6d5046a824438305460521d559045", "score": "0.48910952", "text": "func NewInlineResponse20068WithDefaults() *InlineResponse20068 {\n\tthis := InlineResponse20068{}\n\treturn &this\n}", "title": "" }, { "docid": "cbc1040c099d150688318f22ee32a1af", "score": "0.4889806", "text": "func CreateGetUserDataResponse() (response *GetUserDataResponse) {\nresponse = &GetUserDataResponse{\nBaseResponse: &responses.BaseResponse{},\n}\nreturn\n}", "title": "" }, { "docid": "db1d74f77f0107438928aabb8055f0c9", "score": "0.48845422", "text": "func (o *StorageProxyMetricsWriteHistogramGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "title": "" }, { "docid": "82b7f9cddf3b58c6c925754dcfd78690", "score": "0.48812076", "text": "func NewInlineResponse200WithDefaults() *InlineResponse200 {\n\tthis := InlineResponse200{}\n\treturn &this\n}", "title": "" }, { "docid": "e764f3a21cde77326796efbba30b57e6", "score": "0.487934", "text": "func (mc *MetricCreate) defaults() {\n\tif _, ok := mc.mutation.CreatedAt(); !ok {\n\t\tv := metric.DefaultCreatedAt()\n\t\tmc.mutation.SetCreatedAt(v)\n\t}\n\tif _, ok := mc.mutation.UpdatedAt(); !ok {\n\t\tv := metric.DefaultUpdatedAt()\n\t\tmc.mutation.SetUpdatedAt(v)\n\t}\n\tif _, ok := mc.mutation.DeletedAt(); !ok {\n\t\tv := metric.DefaultDeletedAt()\n\t\tmc.mutation.SetDeletedAt(v)\n\t}\n}", "title": "" }, { "docid": "a07274163556dd1fdf92c066a3131b74", "score": "0.4870084", "text": "func (r *CreateDocumentationVersionResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "509dd8c10009f8016ee3a850122aa89f", "score": "0.4864539", "text": "func NewListClustersResponseWithDefaults() *ListClustersResponse {\n\tthis := ListClustersResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "b06c8a60c65ca3a787633e2eaa997624", "score": "0.48618492", "text": "func NewResponse(errors []error) *Response {\n instance := new(Response)\n instance.result = (len(errors) == 0)\n instance.errors = errors\n return instance\n}", "title": "" }, { "docid": "28ea2818bce8bfccf493377d099e9d0a", "score": "0.48521137", "text": "func (nc *NamespaceCreate) defaults() {\n\tif _, ok := nc.mutation.CreatedAt(); !ok {\n\t\tv := namespace.DefaultCreatedAt()\n\t\tnc.mutation.SetCreatedAt(v)\n\t}\n\tif _, ok := nc.mutation.UpdatedAt(); !ok {\n\t\tv := namespace.DefaultUpdatedAt()\n\t\tnc.mutation.SetUpdatedAt(v)\n\t}\n\tif _, ok := nc.mutation.Config(); !ok {\n\t\tv := namespace.DefaultConfig\n\t\tnc.mutation.SetConfig(v)\n\t}\n\tif _, ok := nc.mutation.ID(); !ok {\n\t\tv := namespace.DefaultID()\n\t\tnc.mutation.SetID(v)\n\t}\n}", "title": "" }, { "docid": "791956a792eba995799add20430cb06b", "score": "0.48482656", "text": "func (api *Definition) SetDefaults() {\n\tapi.APIProtocols = append(api.APIProtocols, apimanagement.ProtocolHTTPS)\n\tapi.APIVersioningScheme = apimanagement.VersioningSchemeSegment\n\tapi.SubscriptionRequired = true\n\tapi.APIRevision = \"1\"\n\tapi.APIUniqueID = fmt.Sprintf(\"%s-%s\", api.APIID, api.APIVersion)\n\tif len(api.APIProductsRaw) > 0 {\n\t\tapi.APIProducts = strings.Split(strings.TrimSpace(api.APIProductsRaw), \",\")\n\t}\n}", "title": "" }, { "docid": "c9a620cec86900044e4c09c004d12617", "score": "0.48352906", "text": "func (x *fastReflection_SimulationResponse) New() protoreflect.Message {\n\treturn new(fastReflection_SimulationResponse)\n}", "title": "" }, { "docid": "3872586c666dee5355b6401653b5a047", "score": "0.48319605", "text": "func NewSecretKeysResponseAllOfWithDefaults() *SecretKeysResponseAllOf {\n\tthis := SecretKeysResponseAllOf{}\n\treturn &this\n}", "title": "" }, { "docid": "509b3656c4dc74f7f2a159c30e17e544", "score": "0.481529", "text": "func NewRequestReceiptResponseWithDefaults() *RequestReceiptResponse {\n\tthis := RequestReceiptResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "6363a6b695024d9eb90319eb51945375", "score": "0.48150036", "text": "func NewResponse(token PaginationToken) *Response {\n\tres := Response{\n\t\tNextBatch: token.String(),\n\t}\n\t// Pre-initialise the maps. Synapse will return {} even if there are no rooms under a specific section,\n\t// so let's do the same thing. Bonus: this means we can't get dreaded 'assignment to entry in nil map' errors.\n\tres.Rooms.Join = make(map[string]JoinResponse)\n\tres.Rooms.Invite = make(map[string]InviteResponse)\n\tres.Rooms.Leave = make(map[string]LeaveResponse)\n\n\t// Also pre-intialise empty slices or else we'll insert 'null' instead of '[]' for the value.\n\t// TODO: We really shouldn't have to do all this to coerce encoding/json to Do The Right Thing. We should\n\t// really be using our own Marshal/Unmarshal implementations otherwise this may prove to be a CPU bottleneck.\n\t// This also applies to NewJoinResponse, NewInviteResponse and NewLeaveResponse.\n\tres.AccountData.Events = make([]gomatrixserverlib.ClientEvent, 0)\n\tres.Presence.Events = make([]gomatrixserverlib.ClientEvent, 0)\n\n\t// Fill next_batch with a pagination token. Since this is a response to a sync request, we can assume\n\t// we'll always return a stream token.\n\tres.NextBatch = NewPaginationTokenFromTypeAndPosition(\n\t\tPaginationTokenTypeStream,\n\t\tStreamPosition(token.PDUPosition),\n\t\tStreamPosition(token.EDUTypingPosition),\n\t).String()\n\n\treturn &res\n}", "title": "" }, { "docid": "7d69bd6d7140be6fd44adc5daf1be9d0", "score": "0.48062173", "text": "func (o *CifsDomainPreferredDcGetParams) SetDefaults() {\n\tvar (\n\t\tneedStatusDefault = bool(false)\n\t)\n\n\tval := CifsDomainPreferredDcGetParams{\n\t\tNeedStatus: &needStatusDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "title": "" }, { "docid": "7c005cf990a19e21ac5b97078345092e", "score": "0.4802048", "text": "func NewInlineResponse20090WithDefaults() *InlineResponse20090 {\n\tthis := InlineResponse20090{}\n\treturn &this\n}", "title": "" }, { "docid": "05f0d3e1ca8be9cd8c8b3df982f68935", "score": "0.48020348", "text": "func (o *LunCollectionGetParams) SetDefaults() {\n\tvar (\n\t\treturnRecordsDefault = bool(true)\n\n\t\treturnTimeoutDefault = int64(15)\n\t)\n\n\tval := LunCollectionGetParams{\n\t\tReturnRecords: &returnRecordsDefault,\n\t\tReturnTimeout: &returnTimeoutDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "title": "" }, { "docid": "fd45f429420503f88141df78d99abf61", "score": "0.47919217", "text": "func (s CreateClassifierOutput) SDKResponseMetadata() aws.Response {\n\treturn s.responseMetadata\n}", "title": "" }, { "docid": "35293ee20873c5fb5b5b43b23e0d729f", "score": "0.47898957", "text": "func NewMetaPaginationWithDefaults() *MetaPagination {\n\tthis := MetaPagination{}\n\treturn &this\n}", "title": "" }, { "docid": "c6a8a94d210486f64f96dca55342a2fd", "score": "0.47881535", "text": "func (o *MetroclusterDrGroupCollectionGetParams) SetDefaults() {\n\tvar (\n\t\treturnRecordsDefault = bool(true)\n\n\t\treturnTimeoutDefault = int64(15)\n\t)\n\n\tval := MetroclusterDrGroupCollectionGetParams{\n\t\tReturnRecords: &returnRecordsDefault,\n\t\tReturnTimeout: &returnTimeoutDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "title": "" }, { "docid": "0d82a0f4e409fe834df5bb8b2f3c9e4b", "score": "0.4782068", "text": "func NewCdnRequestCertificateResponseWithDefaults() *CdnRequestCertificateResponse {\n\tthis := CdnRequestCertificateResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "c0339a22f4348e5201076fde0f5fc907", "score": "0.4779994", "text": "func (o *GetDecisionsUsingGET2Params) SetDefaults() {\n\t// no default values defined for this parameter\n}", "title": "" }, { "docid": "e23511d3458c9c2923999c2bf29cb178", "score": "0.4773142", "text": "func NewResponse() *Response {\n\tvar r Response\n\tr.answers = make(map[string]string)\n\treturn &r\n}", "title": "" }, { "docid": "423abaee658d8522fe6fe50a47015194", "score": "0.47668102", "text": "func NewInlineResponse2008WithDefaults() *InlineResponse2008 {\n\tthis := InlineResponse2008{}\n\treturn &this\n}", "title": "" }, { "docid": "ed0d281406feb495db87fda73fbe31f2", "score": "0.4766632", "text": "func NewPeeringNodeIdentityResponseWithDefaults() *PeeringNodeIdentityResponse {\n\tthis := PeeringNodeIdentityResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "d2e3d4e18d9ddde964ff785698f3a051", "score": "0.4762564", "text": "func (o *GetVersionByIDUsingGETMixin3Params) SetDefaults() {\n\t// no default values defined for this parameter\n}", "title": "" }, { "docid": "a456a5cb1e247cd567cc812499f9e6d1", "score": "0.47615337", "text": "func (o *MetroclusterSvmCollectionGetParams) SetDefaults() {\n\tvar (\n\t\treturnRecordsDefault = bool(true)\n\n\t\treturnTimeoutDefault = int64(15)\n\t)\n\n\tval := MetroclusterSvmCollectionGetParams{\n\t\tReturnRecords: &returnRecordsDefault,\n\t\tReturnTimeout: &returnTimeoutDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "title": "" }, { "docid": "2d09a4fc37388db8a461b879bc25adb1", "score": "0.47602758", "text": "func NewQueryPaginationResponseWithDefaults() *QueryPaginationResponse {\n\tthis := QueryPaginationResponse{}\n\treturn &this\n}", "title": "" }, { "docid": "07d624a43cebaaed97a4924fe1beb95c", "score": "0.47589254", "text": "func (r *AssociateCreatedArtifactResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "0fb7fa24c2db7c38c8b997820f476cda", "score": "0.475458", "text": "func initFakeVTMResponses(t *testing.T) {\n\tonce.Do(func() {\n\t\tfakeResponses = make(map[string][]indexedResponse, 0)\n\t\tvar methods []*restMethod\n\n\t\t// step: read in the test method specification\n\t\tmethodSpec, err := ioutil.ReadFile(\"./tests/rest-api/methods.yml\")\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"failed to read in the fake yaml responses\")\n\t\t}\n\n\t\terr = yaml.Unmarshal([]byte(methodSpec), &methods)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"failed to unmarshal the response\")\n\t\t}\n\t\tfor _, method := range methods {\n\t\t\tkey := fakeResponseMapKey(method.Method, method.URI, method.Scope)\n\t\t\tswitch {\n\t\t\tcase method.Content != \"\" && len(method.ContentSequence) > 0:\n\t\t\t\tpanic(\"content and contentSequence must not be provided simultaneously\")\n\t\t\tcase len(method.ContentSequence) > 0:\n\t\t\t\tfakeResponses[key] = method.ContentSequence\n\t\t\tdefault:\n\t\t\t\t// This combines the cases where static content was defined or not. The\n\t\t\t\t// latter models an empty response (via an empty content) that should\n\t\t\t\t// not result into a 404.\n\t\t\t\tfakeResponses[key] = []indexedResponse{\n\t\t\t\t\tindexedResponse{\n\t\t\t\t\t\t// Index -1 indicates a static response.\n\t\t\t\t\t\tIndex: -1,\n\t\t\t\t\t\tContent: method.Content,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n}", "title": "" }, { "docid": "2c8e8db507a136811ab4f155a6ef97d9", "score": "0.475336", "text": "func NewPkiImportKeyResponseWithDefaults() *PkiImportKeyResponse {\n\tvar this PkiImportKeyResponse\n\n\treturn &this\n}", "title": "" } ]
0bcbd0aa4f7cfe9e855399607ec2f608
ExitBlock_ending is called when production block_ending is exited.
[ { "docid": "c43a5800d65fea1d9c75321ac7a8cd7e", "score": "0.87481546", "text": "func (s *BaserefalListener) ExitBlock_ending(ctx *Block_endingContext) {}", "title": "" } ]
[ { "docid": "029afc36dc365384d1c42d7e45100a35", "score": "0.78174573", "text": "func (s *BaserefalListener) ExitBlock_(ctx *Block_Context) {}", "title": "" }, { "docid": "bfd0292cecbecfee874b1fa2257c86f5", "score": "0.7780635", "text": "func (s *BaseapexListener) ExitBlock(ctx *BlockContext) {}", "title": "" }, { "docid": "0434c3c3f17c1fdb6ff0a9f89098024a", "score": "0.7776487", "text": "func (s *BaseBODLParserListener) ExitBlock(ctx *BlockContext) {}", "title": "" }, { "docid": "0caa8bdaddc6911329b33f1ae84a8d0a", "score": "0.7658284", "text": "func (s *BaseGolangListener) ExitBlock(ctx *BlockContext) {}", "title": "" }, { "docid": "54647c9202e3037f0c8b316f1c62dcb9", "score": "0.7632571", "text": "func (s *BasekarelListener) ExitBlock(ctx *BlockContext) {}", "title": "" }, { "docid": "7c8fcc3a5df8c27966f3a6af6742078f", "score": "0.76244724", "text": "func (s *BaseABSLParserListener) ExitBlock(ctx *BlockContext) {}", "title": "" }, { "docid": "ea97b99cd179c7c015f3c9df32f87fe8", "score": "0.75945854", "text": "func (s *BasePMMNListener) ExitBlock(ctx *BlockContext) {}", "title": "" }, { "docid": "81b11f780118aabe61c8a7178cc6ac4e", "score": "0.7490514", "text": "func (s *BasemumathListener) ExitBlock(ctx *BlockContext) {}", "title": "" }, { "docid": "a47bf410ddc0eeb787d533bfe0ea798b", "score": "0.73992664", "text": "func (s *BaseLessParserListener) ExitBlock(ctx *BlockContext) {}", "title": "" }, { "docid": "a1f9a34bd1572c48de106cec5397ce3c", "score": "0.7382564", "text": "func (s *BaserefalListener) EnterBlock_ending(ctx *Block_endingContext) {}", "title": "" }, { "docid": "238ea47e00c952d568b65ae05249beff", "score": "0.7316348", "text": "func (s *InfoCollector) ExitBlock(ctx *parser.BlockContext) {}", "title": "" }, { "docid": "e04a3e52afb0affaa588fab183f1b6c3", "score": "0.72359717", "text": "func (s *BaseapexListener) ExitBlockStatement(ctx *BlockStatementContext) {}", "title": "" }, { "docid": "ea3b6539cfc67a9dcf68bfc510a7e36c", "score": "0.7159338", "text": "func (s *BasetsqlListener) ExitBlock_statement(ctx *Block_statementContext) {}", "title": "" }, { "docid": "240c2a3a5cc6480971595a9b9261bdfb", "score": "0.7038679", "text": "func (s *BaselolcodeListener) ExitPrint_block(ctx *Print_blockContext) {}", "title": "" }, { "docid": "2c613211f86dc7c3b82fd8586d7aa7c0", "score": "0.68929225", "text": "func (app *DSimApp) EndBlock() {\n\tapp.DnApp.EndBlock(abci.RequestEndBlock{})\n\tapp.DnApp.Commit()\n}", "title": "" }, { "docid": "9508fc248320a509f9c999e6685684f2", "score": "0.68851733", "text": "func (g *Glue) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock {\n\tlog.Infof(\"[%d]End block %d\", g.port, g.tn)\n\tg.lock.Lock()\n\tdefer g.lock.Unlock()\n\n\tlog.Infof(\"[%d]End block %d done\", g.port, g.tn)\n\tif len(g.validatorUpdates) != 0 {\n\t\tfor i := range g.validatorUpdates {\n\t\t\tlog.Infof(\"EndBlock: pubkey %d: %s, power: %d\", i,\n\t\t\t\tbase64.StdEncoding.EncodeToString(g.validatorUpdates[i].PubKey.Data), g.validatorUpdates[i].Power)\n\t\t}\n\t}\n\treturn types.ResponseEndBlock{ValidatorUpdates: g.validatorUpdates}\n}", "title": "" }, { "docid": "bc1a1851e1aa05d3207085c9ada036ee", "score": "0.67804873", "text": "func (s *BaseHiveParserListener) ExitBlocking(ctx *BlockingContext) {}", "title": "" }, { "docid": "970cc1f8c0b66ee262efb57888b65b6c", "score": "0.6626018", "text": "func (s *BaseapexListener) ExitFinallyBlock(ctx *FinallyBlockContext) {}", "title": "" }, { "docid": "4773f54c1cc43d2ecf28a9edd3e05724", "score": "0.6571285", "text": "func (a *Application) EndBlock(request tendermintabci.RequestEndBlock) (response tendermintabci.ResponseEndBlock) {\n\tdefer func() {\n\t\tlevel.Debug(a.logger).Log(\n\t\t\t\"abci\", \"EndBlock\",\n\t\t\t\"height\", request.Height,\n\t\t\t\"consensus_state_commits\", a.consensus.Commits(),\n\t\t)\n\t}()\n\n\t// TODO(pb): probably should validate height\n\n\treturn tendermintabci.ResponseEndBlock{}\n}", "title": "" }, { "docid": "9114fecf03ec8ac0ab80346fc6d5cfc6", "score": "0.6523181", "text": "func (s *BaselolcodeListener) ExitIf_block(ctx *If_blockContext) {}", "title": "" }, { "docid": "3e6579c9f3e859813e30d0395f20ac26", "score": "0.6500232", "text": "func (s *BaseABSLParserListener) ExitCaseBlock(ctx *CaseBlockContext) {}", "title": "" }, { "docid": "0087ccc95f31b4c0d2cb8ecdae2c6119", "score": "0.6491474", "text": "func (k *Keeper) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate {\n\t// Gas costs are handled within msg handler so costs should be ignored\n\tinfCtx := ctx.WithGasMeter(sdk.NewInfiniteGasMeter())\n\tk.WithContext(infCtx)\n\n\tbloom := ethtypes.BytesToBloom(k.GetBlockBloomTransient().Bytes())\n\tk.EmitBlockBloomEvent(infCtx, bloom)\n\n\tk.WithContext(ctx)\n\n\treturn []abci.ValidatorUpdate{}\n}", "title": "" }, { "docid": "97a6f0aff08d4bf51ce4766ce60ae408", "score": "0.6465482", "text": "func (s *BaselolcodeListener) ExitCode_block(ctx *Code_blockContext) {}", "title": "" }, { "docid": "7d384a35f94d0a1e05045918d341c5f0", "score": "0.6427368", "text": "func (s *BaseABSLParserListener) ExitYieldStatement(ctx *YieldStatementContext) {}", "title": "" }, { "docid": "cc7da19db9aded9c9de00a2d7be4c81c", "score": "0.6421505", "text": "func (m *Manager) EndBlock(ctx sdk.Ctx, req abci.RequestEndBlock) abci.ResponseEndBlock {\n\tdefer sdk.TimeTrack(time.Now())\n\tctx = ctx.WithEventManager(sdk.NewEventManager())\n\tvalidatorUpdates := []abci.ValidatorUpdate{}\n\tvar consensusUpdates *abci.ConsensusParams\n\n\tfor _, moduleName := range m.OrderEndBlockers {\n\t\t// Use these validator updates if provided\n\t\tmoduleValUpdates := m.Modules[moduleName].EndBlock(ctx, req)\n\t\tif len(moduleValUpdates) > 0 {\n\t\t\t// The module manager assumes only one module will update the validator set\n\t\t\tif len(validatorUpdates) > 0 {\n\t\t\t\tpanic(\"validator EndBlock updates already set by a previous module\")\n\t\t\t}\n\t\t\tvalidatorUpdates = moduleValUpdates\n\t\t}\n\n\t\t// Currently its only a non-empty struct in the pocket-core modules\n\t\tconsensusParamUpdate := m.Modules[moduleName].ConsensusParamsUpdate(ctx)\n\t\tif !consensusParamUpdate.Equal(&abci.ConsensusParams{}) {\n\t\t\tconsensusUpdates = consensusParamUpdate\n\t\t}\n\t}\n\n\t// Only attach the consensus updates if present.\n\t// Avoids sending the update (i.e. an empty struct) every block\n\tresponseBlock := abci.ResponseEndBlock{\n\t\tValidatorUpdates: validatorUpdates,\n\t\tEvents: ctx.EventManager().ABCIEvents(),\n\t}\n\n\tif consensusUpdates != nil {\n\t\tresponseBlock.ConsensusParamUpdates = consensusUpdates\n\t}\n\treturn responseBlock\n}", "title": "" }, { "docid": "366eeee7a6f03d0cab59a9b4f0891c11", "score": "0.6393452", "text": "func OnEndBlock(ctx sdk.Context, keepers Keepers) error {\n\tif err := transferFundsForActiveLeases(ctx, keepers); err != nil {\n\t\treturn err\n\t}\n\tif err := matchOrders(ctx, keepers); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "17bea6827224b3e88aeafc6db8bcf800", "score": "0.63821244", "text": "func (s *BaseMapCSSListener) ExitDecl_block(ctx *Decl_blockContext) {}", "title": "" }, { "docid": "aea6bfea3204ea9980d12e9494b26537", "score": "0.63426316", "text": "func (gm GlobalManager) OnEndBlock(ctx sdk.Context) {\n\tglobalTime := gm.storage.GetGlobalTime(ctx)\n\tglobalTime.LastBlockTime = ctx.BlockHeader().Time.Unix()\n\tgm.storage.SetGlobalTime(ctx, globalTime)\n}", "title": "" }, { "docid": "36233468b6ac171d6ed924d5db405ffa", "score": "0.6322364", "text": "func (s *BaseASLListener) ExitBreak_statement(ctx *Break_statementContext) {}", "title": "" }, { "docid": "4901f9127f3b25e43b17bf43fcbc95ff", "score": "0.6305746", "text": "func (a AppModule) EndBlock(ctx sdk.Context, b types.RequestEndBlock) []types.ValidatorUpdate {\n\treturn nil\n}", "title": "" }, { "docid": "38e50f2b83296364e462ed124ef5134d", "score": "0.62961805", "text": "func (s *StoreApp) EndBlock(_ abci.RequestEndBlock) (res abci.ResponseEndBlock) {\n\tres.ValidatorUpdates = weave.ValidatorUpdatesToABCI(s.pending)\n\ts.pending = weave.ValidatorUpdates{}\n\treturn\n}", "title": "" }, { "docid": "80e5016337afb0a89f913e7503b0cb93", "score": "0.6278246", "text": "func (s *BaselolcodeListener) ExitInput_block(ctx *Input_blockContext) {}", "title": "" }, { "docid": "3c1c475ddf88367a657cf100c4469af5", "score": "0.6268718", "text": "func (s *BasePowerBuilderParserListener) ExitExit_statement(ctx *Exit_statementContext) {}", "title": "" }, { "docid": "f52fdbdf88b0f5f883ac527ed017bf51", "score": "0.62538284", "text": "func (s *BaseABSLParserListener) ExitExportFromBlock(ctx *ExportFromBlockContext) {}", "title": "" }, { "docid": "c8d1f5c5510e323d83737dd8d9dc1046", "score": "0.62323004", "text": "func (s *BasePowerBuilderParserListener) ExitClose_cursor_statement(ctx *Close_cursor_statementContext) {\n}", "title": "" }, { "docid": "2ef3c53de817e8377742bc12ff576232", "score": "0.6220222", "text": "func (s *BasePowerBuilderParserListener) ExitEvent_body(ctx *Event_bodyContext) {}", "title": "" }, { "docid": "3c57b67c2280039349d79462623c799c", "score": "0.6184463", "text": "func (s *BaseABSLParserListener) ExitYieldExpression(ctx *YieldExpressionContext) {}", "title": "" }, { "docid": "ef598123445a018f0693fa087768944e", "score": "0.6173039", "text": "func (s *BasetsqlListener) ExitBreak_statement(ctx *Break_statementContext) {}", "title": "" }, { "docid": "0b34ef4567ae4387e4f3cfcb54bcea1e", "score": "0.61691844", "text": "func (app *PersistentApplication) EndBlock(reqEndBlock types.RequestEndBlock) (resEndBlock types.ResponseEndBlock) {\n\treturn types.ResponseEndBlock{ValidatorUpdates: app.changes}\n}", "title": "" }, { "docid": "0df5e54dfbf838310e011629d4a5e7cf", "score": "0.6098925", "text": "func (h *Hook) AfterEndBlock(ctx sdk.Context, req abci.RequestEndBlock, res abci.ResponseEndBlock) {\n\tfor _, event := range res.Events {\n\t\th.handleBeginBlockEndBlockEvent(ctx, event)\n\t}\n\t// Update balances of all affected accounts on this block.\n\t// Index 0 is message NEW_BLOCK, we insert SET_ACCOUNT messages right after it.\n\tmodifiedMsgs := []common.Message{h.msgs[0]}\n\tfor accStr := range h.accsInBlock {\n\t\tacc, _ := sdk.AccAddressFromBech32(accStr)\n\t\tmodifiedMsgs = append(modifiedMsgs, common.Message{\n\t\t\tKey: \"SET_ACCOUNT\",\n\t\t\tValue: common.JsDict{\n\t\t\t\t\"address\": acc,\n\t\t\t\t\"balance\": h.bankKeeper.GetCoins(ctx, acc).String(),\n\t\t\t}})\n\t}\n\th.msgs = append(modifiedMsgs, h.msgs[1:]...)\n\th.Write(\"COMMIT\", common.JsDict{\"height\": req.Height})\n}", "title": "" }, { "docid": "c9d81ba8f22bc74f2c5938b93ed8f46d", "score": "0.6076279", "text": "func (s *BaseABSLParserListener) ExitBreakStatement(ctx *BreakStatementContext) {}", "title": "" }, { "docid": "23e689f61d3e49d57b671bfabadb29d9", "score": "0.6074263", "text": "func (s *BaseapexListener) ExitPropertyBlock(ctx *PropertyBlockContext) {}", "title": "" }, { "docid": "906a4e1dc984c51f2f1e778b46573841", "score": "0.6014122", "text": "func (s *BaseASLListener) ExitBo_specification(ctx *Bo_specificationContext) {}", "title": "" }, { "docid": "8589475f01b61a1f5adca0e9ea7a220f", "score": "0.6008673", "text": "func (s *BaseABSLParserListener) ExitFunctionBody(ctx *FunctionBodyContext) {}", "title": "" }, { "docid": "0ebe240290378a712792ec9a57328b83", "score": "0.6008213", "text": "func (s *BaseGolangListener) ExitBreakStmt(ctx *BreakStmtContext) {}", "title": "" }, { "docid": "dc0f16420c521b7966807ff95b87d44a", "score": "0.60012203", "text": "func (s *BaseHiveParserListener) ExitBody(ctx *BodyContext) {}", "title": "" }, { "docid": "1745a3dbc4d6468884b8a69fb471307f", "score": "0.5996329", "text": "func (s *BasePowerBuilderParserListener) ExitFunction_body(ctx *Function_bodyContext) {}", "title": "" }, { "docid": "ef217afac415888564eb4246f14f56bb", "score": "0.5983307", "text": "func (app *IrisApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {\n\tvalidatorUpdates := stake.EndBlocker(ctx, app.stakeKeeper)\n\n\ttags := gov.EndBlocker(ctx, app.govKeeper)\n\ttags.AppendTags(upgrade.EndBlocker(ctx, app.upgradeKeeper))\n\n\treturn abci.ResponseEndBlock{\n\t\tValidatorUpdates: validatorUpdates,\n\t\tTags: tags,\n\t}\n}", "title": "" }, { "docid": "1594ecf5bc003d30b14731d8ebe6bd04", "score": "0.59799606", "text": "func (s *BaseABSLParserListener) ExitImportFromBlock(ctx *ImportFromBlockContext) {}", "title": "" }, { "docid": "8f3d5234919d5a799437c1980ae7a2b0", "score": "0.59710187", "text": "func (s *BasePowerBuilderParserListener) EnterExit_statement(ctx *Exit_statementContext) {}", "title": "" }, { "docid": "26782b81407d3e2fb04598faf81a1deb", "score": "0.5969791", "text": "func (s *Baseasm8086Listener) ExitEnd(ctx *EndContext) {}", "title": "" }, { "docid": "0b58a30fd20d1dc7298080ca15651527", "score": "0.5952689", "text": "func (app *MainApp) EndBlocker(ctx cTypes.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {\n\treturn app.mm.EndBlock(ctx, req)\n}", "title": "" }, { "docid": "357df6d038efffb849142904d70870d9", "score": "0.5895445", "text": "func (g *Graph) EndLoop() bool {\n\tg.Hook = g.ActiveBlock.End\n\tg.ActiveBlock.Terminate()\n\tg.ActiveBlock = nil\n\treturn true\n}", "title": "" }, { "docid": "544192c4538bec23f3faf7d125ddb974", "score": "0.58817506", "text": "func (s *BasePowerBuilderParserListener) ExitOn_body(ctx *On_bodyContext) {}", "title": "" }, { "docid": "cef82a4a8a3990b186d1317aa3c8266a", "score": "0.5880079", "text": "func (s *BaselolcodeListener) ExitElse_if_block(ctx *Else_if_blockContext) {}", "title": "" }, { "docid": "d7cc1bbd76e2d74250c9c96b5e29e0f4", "score": "0.5879877", "text": "func (s *BaseapexListener) ExitCatchClause(ctx *CatchClauseContext) {}", "title": "" }, { "docid": "13d70a9bc68662f80bc404a0d409993a", "score": "0.5851703", "text": "func (s *BasePowerBuilderParserListener) ExitStatement(ctx *StatementContext) {}", "title": "" }, { "docid": "09bbae035cce2f53aa40e6fa67371d61", "score": "0.5851211", "text": "func (dpos *Dpos) Finalize(tail *types.Block) error {\n\tif err := dpos.UpdateCandidateContext(tail); err != nil {\n\t\treturn err\n\t}\n\tif dpos.IsBookkeeper() && time.Now().Unix()-tail.Header.TimeStamp < MaxEternalBlockMsgCacheTime {\n\t\tgo dpos.BroadcastBFTMsgToBookkeepers(tail, p2p.BlockPrepareMsg)\n\t}\n\tgo dpos.TryToUpdateEternalBlock(tail)\n\treturn nil\n}", "title": "" }, { "docid": "312fafbb42b9a4d3cf7526c0913e97b1", "score": "0.5838573", "text": "func (blockchain *Blockchain) EndBlock(req abciTypes.RequestEndBlock) abciTypes.ResponseEndBlock {\n\theight := uint64(req.Height)\n\tatomic.StoreUint64(&blockchain.height, height)\n\tvals := blockchain.stateDeliver.Validators.GetValidators()\n\n\thasDroppedValidators := false\n\tfor _, val := range vals {\n\t\tif !val.IsToDrop() {\n\t\t\tcontinue\n\t\t}\n\t\thasDroppedValidators = true\n\n\t\t// Move dropped validator's accum rewards back to pool\n\t\tblockchain.rewards.Add(blockchain.rewards, val.GetAccumReward())\n\t\tval.SetAccumReward(big.NewInt(0))\n\t}\n\n\tblockchain.calculatePowers(vals)\n\n\t// accumulate rewards\n\tvar reward = big.NewInt(0)\n\tvar heightIsMaxIfIssueIsOverOrNotDynamic uint64 = math.MaxUint64\n\temission := blockchain.appDB.Emission()\n\tif emission.Cmp(blockchain.rewardsCounter.TotalEmissionBig()) == -1 {\n\t\treward, _ = blockchain.stateDeliver.App.Reward()\n\t\theightIsMaxIfIssueIsOverOrNotDynamic = height\n\t}\n\n\t{\n\t\trewardWithTxs := big.NewInt(0).Add(reward, blockchain.rewards)\n\n\t\t// compute remainder to keep total emission consist\n\t\tremainder := big.NewInt(0).Set(rewardWithTxs)\n\n\t\tfor i, val := range vals {\n\t\t\t// skip if candidate is not present\n\t\t\tif val.IsToDrop() || blockchain.GetValidatorStatus(val.GetAddress()) != ValidatorPresent {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tr := big.NewInt(0).Set(rewardWithTxs)\n\t\t\tr.Mul(r, val.GetTotalBipStake())\n\t\t\tr.Div(r, blockchain.totalPower)\n\n\t\t\tremainder.Sub(remainder, r)\n\t\t\tvals[i].AddAccumReward(r)\n\t\t}\n\n\t\t// add remainder to total slashed\n\t\tblockchain.stateDeliver.App.AddTotalSlashed(remainder)\n\t}\n\n\t// expire orders\n\tif height > blockchain.expiredOrdersPeriod && height%blockchain.updateStakesAndPayRewardsPeriod == blockchain.updateStakesAndPayRewardsPeriod/2 {\n\t\tblockchain.stateDeliver.Swapper().ExpireOrders(height - blockchain.expiredOrdersPeriod)\n\t}\n\n\t// pay rewards\n\tvar moreRewards = big.NewInt(0)\n\tif height%blockchain.updateStakesAndPayRewardsPeriod == 0 {\n\t\tPayRewards := blockchain.stateDeliver.Validators.PayRewardsV3\n\t\tif h := blockchain.appDB.GetVersionHeight(V330); h > 0 && height > h {\n\t\t\tif height < h+blockchain.updateStakesAndPayRewardsPeriod {\n\t\t\t\texcess := blockchain.stateDeliver.Candidates.FixStakesAfter10509400()\n\t\t\t\tblockchain.appDB.SetEmission(big.NewInt(0).Sub(blockchain.appDB.Emission(), excess))\n\t\t\t\tlog.Println(\"fixEmission\", blockchain.appDB.Emission())\n\t\t\t}\n\t\t\tPayRewards = blockchain.stateDeliver.Validators.PayRewardsV5Fix\n\t\t} else if h := blockchain.appDB.GetVersionHeight(V320); h > 0 && height > h {\n\t\t\tPayRewards = blockchain.stateDeliver.Validators.PayRewardsV5Bug\n\t\t} else if h := blockchain.appDB.GetVersionHeight(V310); h > 0 && height > h {\n\t\t\tPayRewards = blockchain.stateDeliver.Validators.PayRewardsV4\n\t\t}\n\t\tmoreRewards = PayRewards(heightIsMaxIfIssueIsOverOrNotDynamic, int64(blockchain.updateStakesAndPayRewardsPeriod))\n\t\tblockchain.appDB.SetEmission(big.NewInt(0).Add(blockchain.appDB.Emission(), moreRewards))\n\t\tblockchain.stateDeliver.Checker.AddCoinVolume(types.GetBaseCoinID(), moreRewards)\n\n\t}\n\n\tif heightIsMaxIfIssueIsOverOrNotDynamic != math.MaxUint64 {\n\t\t_, rewardForBlock := blockchain.CurrentState().App().Reward()\n\t\tblockchain.appDB.SetEmission(big.NewInt(0).Add(blockchain.appDB.Emission(), rewardForBlock))\n\t\tif diff := big.NewInt(0).Sub(rewardForBlock, reward); diff.Sign() == 1 {\n\t\t\tblockchain.stateDeliver.Accounts.AddBalance([20]byte{}, 0, diff)\n\t\t\treward.Add(reward, diff)\n\t\t}\n\t}\n\n\tblockchain.stateDeliver.Checker.AddCoinVolume(types.GetBaseCoinID(), reward)\n\n\t{\n\t\tupdateCommissionsBlockPrices := blockchain.isUpdateCommissionsBlockV2(height)\n\t\tif prices := updateCommissionsBlockPrices; len(prices) != 0 {\n\t\t\tblockchain.stateDeliver.Commission.SetNewCommissions(prices)\n\t\t\tprice := blockchain.stateDeliver.Commission.GetCommissions()\n\t\t\tblockchain.eventsDB.AddEvent(&eventsdb.UpdateCommissionsEvent{\n\t\t\t\tCoin: uint64(price.Coin),\n\t\t\t\tPayloadByte: price.PayloadByte.String(),\n\t\t\t\tSend: price.Send.String(),\n\t\t\t\tBuyBancor: price.BuyBancor.String(),\n\t\t\t\tSellBancor: price.SellBancor.String(),\n\t\t\t\tSellAllBancor: price.SellAllBancor.String(),\n\t\t\t\tBuyPoolBase: price.BuyPoolBase.String(),\n\t\t\t\tBuyPoolDelta: price.BuyPoolDelta.String(),\n\t\t\t\tSellPoolBase: price.SellPoolBase.String(),\n\t\t\t\tSellPoolDelta: price.SellPoolDelta.String(),\n\t\t\t\tSellAllPoolBase: price.SellAllPoolBase.String(),\n\t\t\t\tSellAllPoolDelta: price.SellAllPoolDelta.String(),\n\t\t\t\tCreateTicker3: price.CreateTicker3.String(),\n\t\t\t\tCreateTicker4: price.CreateTicker4.String(),\n\t\t\t\tCreateTicker5: price.CreateTicker5.String(),\n\t\t\t\tCreateTicker6: price.CreateTicker6.String(),\n\t\t\t\tCreateTicker7_10: price.CreateTicker7to10.String(),\n\t\t\t\tCreateCoin: price.CreateCoin.String(),\n\t\t\t\tCreateToken: price.CreateToken.String(),\n\t\t\t\tRecreateCoin: price.RecreateCoin.String(),\n\t\t\t\tRecreateToken: price.RecreateToken.String(),\n\t\t\t\tDeclareCandidacy: price.DeclareCandidacy.String(),\n\t\t\t\tDelegate: price.Delegate.String(),\n\t\t\t\tUnbond: price.Unbond.String(),\n\t\t\t\tRedeemCheck: price.RedeemCheck.String(),\n\t\t\t\tSetCandidateOn: price.SetCandidateOn.String(),\n\t\t\t\tSetCandidateOff: price.SetCandidateOff.String(),\n\t\t\t\tCreateMultisig: price.CreateMultisig.String(),\n\t\t\t\tMultisendBase: price.MultisendBase.String(),\n\t\t\t\tMultisendDelta: price.MultisendDelta.String(),\n\t\t\t\tEditCandidate: price.EditCandidate.String(),\n\t\t\t\tSetHaltBlock: price.SetHaltBlock.String(),\n\t\t\t\tEditTickerOwner: price.EditTickerOwner.String(),\n\t\t\t\tEditMultisig: price.EditMultisig.String(),\n\t\t\t\tEditCandidatePublicKey: price.EditCandidatePublicKey.String(),\n\t\t\t\tCreateSwapPool: price.CreateSwapPool.String(),\n\t\t\t\tAddLiquidity: price.AddLiquidity.String(),\n\t\t\t\tRemoveLiquidity: price.RemoveLiquidity.String(),\n\t\t\t\tEditCandidateCommission: price.EditCandidateCommission.String(),\n\t\t\t\tMintToken: price.MintToken.String(),\n\t\t\t\tBurnToken: price.BurnToken.String(),\n\t\t\t\tVoteCommission: price.VoteCommission.String(),\n\t\t\t\tVoteUpdate: price.VoteUpdate.String(),\n\t\t\t\tFailedTx: price.FailedTx.String(),\n\t\t\t\tAddLimitOrder: price.AddLimitOrder.String(),\n\t\t\t\tRemoveLimitOrder: price.RemoveLimitOrder.String(),\n\t\t\t\tMoveStake: price.MoveStake.String(),\n\t\t\t\tLockStake: price.LockStake.String(),\n\t\t\t\tLock: price.Lock.String(),\n\t\t\t})\n\t\t}\n\t\tblockchain.stateDeliver.Commission.Delete(height)\n\t}\n\n\t{\n\t\tif v, ok := blockchain.isUpdateNetworkBlockV2(height); ok {\n\t\t\tblockchain.appDB.AddVersion(v, height)\n\t\t\tblockchain.eventsDB.AddEvent(&eventsdb.UpdateNetworkEvent{\n\t\t\t\tVersion: v,\n\t\t\t})\n\t\t\tblockchain.grace.AddGracePeriods(graceForUpdate(height))\n\t\t\tblockchain.executor = GetExecutor(v)\n\t\t}\n\t\tblockchain.stateDeliver.Updates.Delete(height)\n\t}\n\n\thasChangedPublicKeys := false\n\tif blockchain.stateDeliver.Candidates.IsChangedPublicKeys() {\n\t\tblockchain.stateDeliver.Candidates.ResetIsChangedPublicKeys()\n\t\thasChangedPublicKeys = true\n\t}\n\n\t// update validators\n\tvar updates []abciTypes.ValidatorUpdate\n\tif height%blockchain.updateStakesAndPayRewardsPeriod == 0 || hasDroppedValidators || hasChangedPublicKeys {\n\t\tupdates = blockchain.updateValidators()\n\t}\n\n\tdefer func() {\n\t\tblockchain.StatisticData().PushEndBlock(&statistics.EndRequest{TimeEnd: time.Now(), Height: int64(height)})\n\t}()\n\n\treturn abciTypes.ResponseEndBlock{\n\t\tValidatorUpdates: updates,\n\t\tConsensusParamUpdates: &abciTypes.ConsensusParams{\n\t\t\tBlock: &abciTypes.BlockParams{\n\t\t\t\tMaxBytes: blockMaxBytes,\n\t\t\t\tMaxGas: int64(blockchain.stateDeliver.App.GetMaxGas()),\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "00c7525a989ee0169cd48845095e6ea7", "score": "0.5807211", "text": "func (s *BaseapexListener) ExitWhenStatements(ctx *WhenStatementsContext) {}", "title": "" }, { "docid": "6768d1554fdb69bf2a94b2e4493abba8", "score": "0.57910883", "text": "func (s *BaseapexListener) EnterFinallyBlock(ctx *FinallyBlockContext) {}", "title": "" }, { "docid": "fe6f91f5edc3f506848b4618748d202c", "score": "0.5780344", "text": "func (s *BaseHiveParserListener) ExitExpressionPart(ctx *ExpressionPartContext) {}", "title": "" }, { "docid": "5cf55bdf5f282539474afcfcc34a7650", "score": "0.5779679", "text": "func (s *BaseHiveParserListener) ExitRegularBody(ctx *RegularBodyContext) {}", "title": "" }, { "docid": "d3a4bcff8abf31cfad7c5795d5a57660", "score": "0.5764636", "text": "func (s *BaserefalListener) EnterBlock_(ctx *Block_Context) {}", "title": "" }, { "docid": "96ec438b6a01414d3ddc6efd31d4b483", "score": "0.57581055", "text": "func (s *BasePowerBuilderParserListener) ExitReturn_statement(ctx *Return_statementContext) {}", "title": "" }, { "docid": "f11ba45aa570bd83604fa8e937bc808c", "score": "0.5749524", "text": "func (k Keeper) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate {\n\t// Gas costs are handled within msg handler so costs should be ignored\n\tctx = ctx.WithGasMeter(sdk.NewInfiniteGasMeter())\n\n\t// set the block bloom filter bytes to store\n\tbloom := ethtypes.BytesToBloom(k.Bloom.Bytes())\n\tk.SetBlockBloom(ctx, req.Height, bloom)\n\n\tif types.GetEnableBloomFilter() {\n\t\t// the hash of current block is stored when executing BeginBlock of next block.\n\t\t// so update section in the next block.\n\t\tif indexer := types.GetIndexer(); indexer != nil {\n\t\t\tif types.GetIndexer().IsProcessing() {\n\t\t\t\t// notify new height\n\t\t\t\tgo func() {\n\t\t\t\t\tindexer.NotifyNewHeight(ctx)\n\t\t\t\t}()\n\t\t\t} else {\n\t\t\t\tinterval := uint64(req.Height - tmtypes.GetStartBlockHeight())\n\t\t\t\tif interval >= (indexer.GetValidSections()+1)*types.BloomBitsBlocks {\n\t\t\t\t\tgo types.GetIndexer().ProcessSection(ctx, k, interval)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif watcher.IsWatcherEnabled() && k.Watcher.IsFirstUse() {\n\t\tstore := ctx.KVStore(k.storeKey)\n\t\titeratorBlockedList := sdk.KVStorePrefixIterator(store, types.KeyPrefixContractBlockedList)\n\t\tdefer iteratorBlockedList.Close()\n\t\tfor ; iteratorBlockedList.Valid(); iteratorBlockedList.Next() {\n\t\t\tk.Watcher.SaveContractBlockedListItem(iteratorBlockedList.Key()[1:])\n\t\t}\n\n\t\titeratorDeploymentWhitelist := sdk.KVStorePrefixIterator(store, types.KeyPrefixContractDeploymentWhitelist)\n\t\tdefer iteratorDeploymentWhitelist.Close()\n\t\tfor ; iteratorDeploymentWhitelist.Valid(); iteratorDeploymentWhitelist.Next() {\n\t\t\tk.Watcher.SaveContractDeploymentWhitelistItem(iteratorDeploymentWhitelist.Key()[1:])\n\t\t}\n\n\t\tk.Watcher.Used()\n\t}\n\n\tif watcher.IsWatcherEnabled() {\n\t\tparams := k.GetParams(ctx)\n\t\tk.Watcher.SaveParams(params)\n\n\t\tk.Watcher.SaveBlock(bloom)\n\t\tk.Watcher.Commit()\n\t}\n\n\treturn []abci.ValidatorUpdate{}\n}", "title": "" }, { "docid": "553965348e56faef2bbbfceccaf18d49", "score": "0.57382756", "text": "func (s *BaseabbParserListener) ExitProcedure(ctx *ProcedureContext) {}", "title": "" }, { "docid": "65a2b63adce219f2241783c84865116a", "score": "0.5737904", "text": "func (r Region) End() {\n\tC.kdebug_signpost_end(\n\t\tC.uint32_t(r.Action),\n\t\tC.uintptr_t(r.Arg1),\n\t\tC.uintptr_t(r.Arg2),\n\t\tC.uintptr_t(r.Arg3),\n\t\tC.uintptr_t(r.Arg4),\n\t)\n}", "title": "" }, { "docid": "074ce24463d29ee52ebf35a40a6a5c76", "score": "0.57378167", "text": "func Goexit() {\n\t// its really just a deadlock\n\tdeadlock()\n}", "title": "" }, { "docid": "46930165d29c9c28bdc01c578d4eec57", "score": "0.57359874", "text": "func (s *BasePowerBuilderParserListener) ExitEvent_call_statement(ctx *Event_call_statementContext) {}", "title": "" }, { "docid": "0059a1c232d5a3640e820d0a4a506984", "score": "0.57322055", "text": "func (s *BaseABSLParserListener) ExitDebuggerStatement(ctx *DebuggerStatementContext) {}", "title": "" }, { "docid": "121d54f3614b239b2c40f62f0f4a97a8", "score": "0.5723247", "text": "func (s *BaseHiveParserListener) ExitWhenClauses(ctx *WhenClausesContext) {}", "title": "" }, { "docid": "6b58f35c6565b2e4d95c2a0ab5246580", "score": "0.5722765", "text": "func (s *BasePowerBuilderParserListener) ExitContinue_statement(ctx *Continue_statementContext) {}", "title": "" }, { "docid": "3b72b6a649fc3e3c2027b16be46600e2", "score": "0.56960034", "text": "func (rl *simpleratelimiter) Exit() {\n\trl.exit <- struct{}{}\n}", "title": "" }, { "docid": "12bc0b518d0bcd622073e3aff74d5e62", "score": "0.56942946", "text": "func (app *IrisApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {\n\treturn app.mm.EndBlock(ctx, req)\n}", "title": "" }, { "docid": "cc3fba282462047d523192f6a895dc82", "score": "0.56826425", "text": "func (s *BasePowerBuilderParserListener) ExitBody_rule(ctx *Body_ruleContext) {}", "title": "" }, { "docid": "9dc512c7f2c402355322c0822af12866", "score": "0.5678707", "text": "func (s *BaseBODLParserListener) ExitStatements(ctx *StatementsContext) {}", "title": "" }, { "docid": "9c0bdbd7d4ef4bab437654bfa8d76704", "score": "0.5669451", "text": "func (s *BaseHiveParserListener) ExitUnlockStatement(ctx *UnlockStatementContext) {}", "title": "" }, { "docid": "a4516f658c515e5e78c940c1910b9044", "score": "0.565704", "text": "func (app *ixoApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {\n\treturn app.mm.EndBlock(ctx, req)\n}", "title": "" }, { "docid": "0d8ac1e0be5d94a50bd24fefdd242fcf", "score": "0.5656225", "text": "func (s *BasetsqlListener) ExitBinary_mod_expression(ctx *Binary_mod_expressionContext) {}", "title": "" }, { "docid": "cff2d4199088e8adf206877c3ab2fccf", "score": "0.56313056", "text": "func (s *BasePowerBuilderParserListener) ExitClose_sql_statement(ctx *Close_sql_statementContext) {}", "title": "" }, { "docid": "9d0c1a6ba0e6705aabda703c5efcbb7b", "score": "0.56200886", "text": "func (s *BaseHiveParserListener) ExitCommitStatement(ctx *CommitStatementContext) {}", "title": "" }, { "docid": "ad08c766a17a4707ccf40e5476f3151c", "score": "0.5617619", "text": "func (s *BaseapexListener) ExitMethodBody(ctx *MethodBodyContext) {}", "title": "" }, { "docid": "937ca376665026a648b25d5a5aa20092", "score": "0.5616236", "text": "func (s *BaseABSLParserListener) ExitStatement(ctx *StatementContext) {}", "title": "" }, { "docid": "da193a0234f98101942fd715b6796654", "score": "0.5611558", "text": "func (s *BasePowerBuilderParserListener) ExitIf_statement(ctx *If_statementContext) {}", "title": "" }, { "docid": "a5147d56a1d434dbeedbe3bb14d8ed55", "score": "0.5599778", "text": "func (s *BasePowerBuilderParserListener) ExitThrow_statement(ctx *Throw_statementContext) {}", "title": "" }, { "docid": "3afc20e94bf97149d638dd124875c3c3", "score": "0.55811733", "text": "func (s *BaseabbParserListener) ExitModule(ctx *ModuleContext) {}", "title": "" }, { "docid": "962a37f9ec4db84c2abb77c6ec945707", "score": "0.5574824", "text": "func (e *Execution) End() {\n if e.markEnded() {\n close(e.ended)\n }\n}", "title": "" }, { "docid": "c1affeab0a461f74e9ca631c3c1178b0", "score": "0.5570065", "text": "func (s *BaseBODLParserListener) ExitNode(ctx *NodeContext) {}", "title": "" }, { "docid": "f738368eb74d3f2540b00e5b846ccc52", "score": "0.55622375", "text": "func (s *BaselolcodeListener) ExitStatement(ctx *StatementContext) {}", "title": "" }, { "docid": "ec6bfe5cf259bc93399ea6cbb84e93b3", "score": "0.55622125", "text": "func (s *BasePowerBuilderParserListener) ExitAncestor_event_call_statement(ctx *Ancestor_event_call_statementContext) {\n}", "title": "" }, { "docid": "07d9b921e9d285888a6bd4ee564b14a1", "score": "0.55609095", "text": "func (s *BaseGolangListener) ExitReturnStmt(ctx *ReturnStmtContext) {}", "title": "" }, { "docid": "295be26dd623ba3d5ef8f41aa7be5f22", "score": "0.555778", "text": "func (s *BaseABSLParserListener) ExitExpressionStatement(ctx *ExpressionStatementContext) {}", "title": "" }, { "docid": "43868b9df4449438a23283bddf3b0a03", "score": "0.55514467", "text": "func (b *Batcher) Exit() {\n\tatomic.StoreUint32(&b.exited, 1)\n\tclose(b.input)\n\tclose(b.flush)\n}", "title": "" }, { "docid": "3a3a818eb23e4904e93ff8e0907efafe", "score": "0.55501807", "text": "func (p *Parser) scopeExit() {\n\tp.scopeStack = p.scopeStack[:len(p.scopeStack)-1]\n}", "title": "" }, { "docid": "a51833d0f158441ccb522d763c69e83b", "score": "0.5549867", "text": "func (s *BaseFmtParserListener) ExitCmp_exp_body(ctx *Cmp_exp_bodyContext) {}", "title": "" }, { "docid": "d7be5286e60796f518bad553b66a7024", "score": "0.55456334", "text": "func (s *Span) end() {\n\t// After an exit span finishes (no more compression attempts), we drop it\n\t// when s.duration <= `exit_span_min_duration` and increment the tx dropped\n\t// count.\n\ts.dropFastExitSpan()\n\n\tif s.dropped() {\n\t\tif s.tx != nil {\n\t\t\tif !s.tx.ended() {\n\t\t\t\ts.aggregateDroppedSpanStats()\n\t\t\t} else {\n\t\t\t\ts.reset(s.tx.tracer)\n\t\t\t}\n\t\t} else {\n\t\t\tdroppedSpanDataPool.Put(s.SpanData)\n\t\t}\n\t} else {\n\t\ts.enqueue()\n\t}\n\n\ts.SpanData = nil\n}", "title": "" }, { "docid": "bd9fa1eebe43275f03702de3d78bf2ac", "score": "0.55421335", "text": "func (s *BaserefalListener) ExitExpression_(ctx *Expression_Context) {}", "title": "" }, { "docid": "ef9f1f7dd20acd7f09f800e8e6d7e80f", "score": "0.55406517", "text": "func (s *BaseMapCSSListener) ExitCanvas_decl_block(ctx *Canvas_decl_blockContext) {}", "title": "" }, { "docid": "7be5fc0bad2bd4441b0b0415f3cd6bc7", "score": "0.55396146", "text": "func (s *BasekarelListener) ExitStatement(ctx *StatementContext) {}", "title": "" } ]
53a00ecf53b500c03c2fa7de5946990a
import "os" Autogenerated code below aims at helping you parse the standard input according to the problem statement.
[ { "docid": "d340b72d28e7fb65b4810868ea8d14fa", "score": "0.0", "text": "func main() {\n for {\n var spaceX, spaceY int\n fmt.Scan(&spaceX, &spaceY)\n \n max := 0\n maxX := 9\n \n for i := 0; i < 8; i++ {\n // mountainH: represents the height of one mountain, from 9 to 0. Mountain heights are provided from left to right.\n var mountainH int\n fmt.Scan(&mountainH)\n \n if mountainH > max {\n max = mountainH\n maxX = i\n }\n }\n \n if spaceX == maxX {\n fmt.Println(\"FIRE\")\n } else {\n fmt.Println(\"HOLD\")\n }\n \n // fmt.Fprintln(os.Stderr, \"Debug messages...\")\n \n // either: FIRE (ship is firing its phase cannons) or HOLD (ship is not firing).\n }\n}", "title": "" } ]
[ { "docid": "8fb0b3bfd73ea7f6c7d02c1755cda249", "score": "0.5991325", "text": "func main() {\n\tb1 := bufio.NewReader(os.Stdin)\n\tc1, _, e := b1.ReadLine()\n\tif e != nil {\n\t\tfmt.Println(\"error\")\n\t}\n\tfmt.Println(string(c1))\n\tfmt.Println(\"Hello World!\")\n}", "title": "" }, { "docid": "e8511c361c05761383aceb8045847cf8", "score": "0.58876026", "text": "func readInput() (src string) {\n\tsrc = strings.Join(flag.Args(), \"\")\n\treturn src\n}", "title": "" }, { "docid": "41394d46999221d063afd8baf72af078", "score": "0.5833272", "text": "func parseArgs() {\n\tflag.Parse()\n\n\tif *version {\n\t\tfmt.Fprintf(os.Stdout, \"%s v%s (Go runtime %s)\\n\",\n\t\t\tAppName, AppVersion, runtime.Version())\n\t\tos.Exit(0)\n\t}\n\n\tpipe = len(*in) == 0\n\n\tif !pipe && len(*out) == 0 {\n\t\t// Ensure we create our own output filename that does not already exist.\n\t\tdir, file := path.Split(*in)\n\n\t\t*out = path.Join(dir, file) + \".go\"\n\t\tif _, err := os.Lstat(*out); err == nil {\n\t\t\t// File already exists. Pad name with a sequential number until we\n\t\t\t// find a name that is available.\n\t\t\tcount := 0\n\t\t\tfor {\n\t\t\t\tf := path.Join(dir, fmt.Sprintf(\"%s.%d.go\", file, count))\n\t\t\t\tif _, err := os.Lstat(f); err != nil {\n\t\t\t\t\t*out = f\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tcount++\n\t\t\t}\n\t\t}\n\n\t\tfmt.Fprintf(os.Stderr, \"[w] No output file specified. Using '%s'.\\n\", *out)\n\t}\n\n\tif len(*pkgname) == 0 {\n\t\tfmt.Fprintln(os.Stderr, \"[w] No package name specified. Using 'main'.\")\n\t\t*pkgname = \"main\"\n\t} else {\n\t\tif unicode.IsDigit(rune((*pkgname)[0])) {\n\t\t\t// Identifier can't start with a digit.\n\t\t\t*pkgname = \"_\" + *pkgname\n\t\t}\n\t}\n\n\tif len(*funcname) == 0 {\n\t\tif pipe {\n\t\t\t// Can't infer from input file name in this mode.\n\t\t\tfmt.Fprintln(os.Stderr, \"[e] No function name specified.\")\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\t_, file := path.Split(*in)\n\t\tfile = strings.ToLower(file)\n\t\tfile = strings.Replace(file, \" \", \"_\", -1)\n\t\tfile = strings.Replace(file, \".\", \"_\", -1)\n\t\tfile = strings.Replace(file, \"-\", \"_\", -1)\n\n\t\tif unicode.IsDigit(rune(file[0])) {\n\t\t\t// Identifier can't start with a digit.\n\t\t\tfile = \"_\" + file\n\t\t}\n\n\t\tfmt.Fprintf(os.Stderr, \"[w] No function name specified. Using '%s'.\\n\", file)\n\t\t*funcname = file\n\t}\n}", "title": "" }, { "docid": "de36fd84c33a3a8aec49f81e48f1c60b", "score": "0.575484", "text": "func stdIN() {\n\t// var f *os.File\n\t// f = os.Stdin\n\tf := os.Stdin\n\tdefer f.Close()\n\n\tscanner := bufio.NewScanner(f)\n\tfor scanner.Scan() {\n\t\tfmt.Println(\">\", scanner.Text())\n\t}\n}", "title": "" }, { "docid": "29e01f0d8a06913a9da7a767b719780d", "score": "0.5751896", "text": "func parseAndExecInput(input string) {\n\t// Split the line into 2 tokens (cmd and message)\n\ttokens := strings.SplitN(input, \" \", 2)\n\tcmd := tokens[0]\n\n\tswitch {\n\tcase cmd == \"\":\n\tcase strings.ToLower(cmd) == \"/users\":\n\t\tfmt.Println(users)\n\tcase strings.ToLower(cmd) == \"/exit\":\n\t\tos.Exit(1)\n\tcase cmd[0] == '@':\n\t\t// TODO-WORKSHOP-STEP-9: Write code to sendChat. Example\n\t\t// \"@gautam hello golang\" should send a message to handle with name \"gautam\" and message \"hello golang\"\n\t\t// Invoke sendChat to send the message\n\tdefault:\n\t\tfmt.Println(helpStr)\n\t}\n}", "title": "" }, { "docid": "aac684795710ab715ebcebcc0dfdd260", "score": "0.56908405", "text": "func input(prompt string) string {\n\treader := bufio.NewReader(os.Stdin)\n\tfmt.Printf(\"%s \", prompt)\n\tinput, _ := reader.ReadString('\\n')\n\treturn strings.Trim(input, \"\\r\\n\")\n}", "title": "" }, { "docid": "301c83851427a352197ab59e549496a8", "score": "0.5628883", "text": "func main() {\n\t// := lets go lang imply the type\n\tscanner := bufio.NewScanner(os.Stdin)\n\n\t// Whatever we type in as input will automatically be a string\n\tfmt.Printf(\"What year were you born? \")\n\tscanner.Scan()\n\n\t// Passing the text we want to parse to an int, we need to pass a base, and then the size of integer\n\t// strconv returns 2 values, the second one is an err\n\t// How do we convert year to a number?\n\tyear, _ := strconv.ParseInt(scanner.Text(), 10, 64)\n\tresult := 2020 - year\n\tfmt.Printf(\"You will be %d years old at the end of 2020\", result)\n}", "title": "" }, { "docid": "4b3f0b9cbf45a6e7b92c016c2e6e529f", "score": "0.5614575", "text": "func readInput(config config, filename *string) (input string, err error) {\n\tif config.filenameIsCode {\n\t\tinput, err = *filename, nil\n\t\t*filename = \"<cmdline>\"\n\t} else if *filename == \"-\" {\n\t\tvar bytes []byte\n\t\tbytes, err = ioutil.ReadAll(os.Stdin)\n\t\tinput = string(bytes)\n\t\t*filename = \"<stdin>\"\n\t} else {\n\t\tvar bytes []byte\n\t\tbytes, err = ioutil.ReadFile(*filename)\n\t\tinput = string(bytes)\n\t}\n\treturn\n}", "title": "" }, { "docid": "bc4fe3740a7767a5aa60d2a50e8f88b6", "score": "0.56058055", "text": "func main() {\n\t// Wrapping unbuffered os.Stdin with buffered scanner gives us a Scan method that advanced the scanner to the next token which is the next line in the default scanner\n\tscanner := bufio.NewScanner(os.Stdin)\n\n\t// Text returns the current token here the next line from input\n\tfor scanner.Scan() {\n\t\tucl := strings.ToUpper(scanner.Text())\n\t\tfmt.Println(ucl)\n\t}\n\n\t// Check for errors during Scan; end of file is expected and not reported by Scan as an error\n\tif err := scanner.Err(); err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"error:\", err)\n\t\tos.Exit(1)\n\t}\n\n}", "title": "" }, { "docid": "84b75bba5509e3c02e6478dd62c2e651", "score": "0.55943584", "text": "func openInput(source string) (r *os.File) {\n\n\tvar err error\n\n\tif source == \"\" || source == \"-\" {\n\t\tr = os.Stdin\n\t} else {\n\t\tr, err = os.Open(source)\n\t\tif err != nil {\n\t\t\tlog.Fatal(fmt.Printf(\"File open failed: %q\", err))\n\t\t}\n\t}\n\treturn r\n}", "title": "" }, { "docid": "cc9c66de6219f6d6074443df09b6f8c4", "score": "0.55768365", "text": "func parse_input(fp *noarch.File, tpath []byte) {\n\tvar fpc *noarch.File\n\tvar line []byte = make([]byte, 256)\n\tvar errMsg []byte = make([]byte, 512)\n\tif (func() *noarch.File {\n\t\tfpc = noarch.Fopen(tpath, []byte(\"w\\x00\"))\n\t\treturn fpc\n\t}()) == nil {\n\t\t// printf(\"Output file path generated: %s\\n\",fullpath); /* debug */\n\t\t//\n\t\t// * PARSE_INPUT\n\t\t// * strip comments from the input file, and write a stripped input file\n\t\t// * 07 May 2003\n\t\t//\n\t\t// stripped input file pointer\n\t\tnoarch.Sprintf(errMsg, []byte(\"\\n error: cannot open parsed input data file: '%s' \\n\\x00\"), tpath)\n\t\terrorMsg(errMsg)\n\t\tnoarch.Exit(12)\n\t}\n\tfor {\n\t\tgetline_no_comment(fp, line, 256)\n\t\tnoarch.Fprintf(fpc, []byte(\"%s \\n\\x00\"), line)\n\t\tif !(int32(line[0]) != int32('_') && int32(line[0]) != -1+256) {\n\t\t\tbreak\n\t\t}\n\t}\n\tnoarch.Fclose(fpc)\n}", "title": "" }, { "docid": "dfd0fe8709a219d80b65f1f3a23ca119", "score": "0.5568194", "text": "func main(){\n// \tvar (\n// \t\turl string\n// \t\tpath string\n// \t)\n// \tfmt.Println(\"please input: url path\")\n// \tfmt.Scanf(\"%s%s\",&url,&path)\n// \turl = urlProcess(url)\n// \tpath = pathProcess(path)\n\n// \tfmt.Println(url,path)\n\tstrtests.Strlearn()\n}", "title": "" }, { "docid": "4faca007f6e564540a555d0ad7a16df1", "score": "0.54933053", "text": "func newVersion() {\n\tscanner := bufio.NewScanner(os.Stdin)\n\tfmt.Printf(inputQuestion)\n\n\tfor scanner.Scan() {\n\t\tif scanner.Text() == \"\\n\" {\n\t\t\tbreak\n\t\t}\n\t\tif scanner.Text() == \"\" {\n\t\t\tfmt.Println(\"User must enter something into the program.\")\n\n\t\t\tbreak\n\t\t}\n\t\tfmt.Printf(\"%s has %d characters.\\n\", scanner.Text(), count(scanner.Text()))\n\t\tbreak\n\t}\n\n\tif scanner.Err() != nil {\n\t\tpanic(errors.New(\"Scanner Error\"))\n\t}\n}", "title": "" }, { "docid": "9191b7d1f7034ce84ceca83eb8fdbdea", "score": "0.54741067", "text": "func main() {\n\tparser := newCli()\n\tc, err := parser.Parse()\n\tif err != nil {\n\t\tif _, ok := err.(*flags.Error); ok {\n\t\t\ttyp := err.(*flags.Error).Type\n\t\t\tswitch {\n\t\t\tcase typ == VersionHelp:\n\t\t\t\tfmt.Println(err.(*flags.Error).Message)\n\t\t\tcase typ == flags.ErrHelp:\n\t\t\t\tparser.WriteHelp(os.Stdout)\n\t\t\tcase typ == flags.ErrCommandRequired && len(c[0]) == 0:\n\t\t\t\tparser.WriteHelp(os.Stdout)\n\t\t\tdefault:\n\t\t\t\tlog.Info(err.Error() + fmt.Sprint(typ))\n\t\t\t\tparser.WriteHelp(os.Stdout)\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Fatalf(\"Exiting: %s\", err.Error())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "adc4f70408c536fbf514bed58833eab2", "score": "0.5460971", "text": "func checkInput() error { // nolint:deadcode,unused\n\treturn nil\n}", "title": "" }, { "docid": "d5e55b09627053d2c3b56504b8ccd541", "score": "0.54540277", "text": "func (c cmd) valid() error {\n\targs := c.args\n\tswitch c.syscall {\n\tcase BIND:\n\t\tif len(args) < 2 {\n\t\t\treturn errors.New(\"usage: bind [–abcC] new old\")\n\t\t}\n\tcase MOUNT:\n\t\tif len(args) < 2 {\n\t\t\treturn errors.New(\"usage: mount [–abcC] servename old [spec]\")\n\t\t}\n\tcase UNMOUNT:\n\t\tif len(args) < 1 {\n\t\t\treturn errors.New(\"usage: unmount [ new ] old\")\n\t\t}\n\tcase RFORK:\n\t\t// doesn't take args or flags, so always valid even if not.\n\t\treturn nil\n\tcase CHDIR:\n\t\tif len(args) < 1 {\n\t\t\treturn errors.New(\"usage: cd dir\")\n\t\t}\n\tcase IMPORT:\n\t\tif len(args) < 2 {\n\t\t\treturn errors.New(\"usage: import [–abc] host [remotepath] mountpoint\")\n\t\t}\n\tcase INCLUDE:\n\t\tif len(args) < 1 {\n\t\t\treturn errors.New(\"usage: . path\")\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"%d is not implmented\", c.syscall)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "63a0d6a21c934859c71951dbe6a1c56e", "score": "0.54334754", "text": "func (f FileName) os() (string, error) {\n\t// These are listed by following command.\n\t// `go tool dist list | sed -r \"s/(\\w+)\\/(\\w+)/\\1/g\" | sort | uniq`\n\tplatforms := map[string][]string{\n\t\t\"aix\": {\"aix\"},\n\t\t\"android\": {\"android\"},\n\t\t\"darwin\": {\"darwin\", \"macos\", \"osx\"},\n\t\t\"dragonfly\": {\"dragonfly\"},\n\t\t\"freebsd\": {\"freebsd\"},\n\t\t\"illumos\": {\"illumos\"},\n\t\t\"ios\": {\"ios\"},\n\t\t\"js\": {\"js\"},\n\t\t\"linux\": {\"linux\"},\n\t\t\"netbsd\": {\"netbsd\"},\n\t\t\"openbsd\": {\"openbsd\"},\n\t\t\"plan9\": {\"plan9\"},\n\t\t\"solaris\": {\"solaris\"},\n\t\t\"windows\": {\"windows\", \"win\", \".exe\"},\n\t}\n\tlowner := strings.ToLower(f.String())\n\treturn findKeyWhichHasLongestMatchValue(platforms, lowner)\n}", "title": "" }, { "docid": "e0921d36c5841549f8e5ab45e27d914b", "score": "0.54283667", "text": "func isStdin(path string) bool {\n\treturn path == \"-\"\n}", "title": "" }, { "docid": "aed9fa52d6abb04d22a93b7e0da96083", "score": "0.5413304", "text": "func getInput() string {\n\tif len(os.Args) < 2 {\n\t\tlog.Fatal(\"Please provide a word to search for\")\n\t}\n\tvar words string\n\tfor _, v := range os.Args[1:] {\n\t\twords += v + \" \"\n\t}\n\twords = strings.TrimSuffix(words, \" \")\n\treturn words\n\n}", "title": "" }, { "docid": "dabf8e85cdf1ef732a20efa8c279777d", "score": "0.54122525", "text": "func System(str []byte) int32 {\n\tinput := string(str)\n\tif input[len(input)-1] == '\\x00' {\n\t\tinput = input[:len(input)-1]\n\t}\n\tre := regexp.MustCompile(`[^\\s\"']+|([^\\s\"']*\"([^\"]*)\"[^\\s\"']*)+|'([^']*)`)\n\targs := re.FindAllString(input, -1)\n\tcmd := exec.Command(args[0], args[1:]...)\n\n\tcmd.Stdout = os.Stdout\n\tcmd.Stderr = os.Stderr\n\n\terr := cmd.Run()\n\n\tif err != nil {\n\t\tif strings.HasPrefix(err.Error(), \"exit status \") {\n\t\t\tresult, _ := strconv.Atoi(strings.Split(err.Error(), \" \")[2])\n\t\t\treturn int32(result)\n\t\t} else {\n\t\t\treturn 1\n\t\t}\n\t} else {\n\t\treturn 0\n\t}\n}", "title": "" }, { "docid": "0b7674b8c064535c555dfcb3f6c2c16d", "score": "0.5405836", "text": "func main() {\n\tcounts := make(map[string]int) // constant-time operation to store, retrieve or test items in the set\n\tinput := bufio.NewScanner(os.Stdin)\n\tfor input.Scan() {\n\t\tcounts[input.Text()]++\n\t}\n\n\t// NOTE: ignoring potential errors from input.Err()\n\tfor line, n := range counts {\n\t\tif n > 1 {\n\t\t\tfmt.Printf(\"%d\\t%s\\n\", n, line)\n\t\t}\n\t}\n\n\t// After entering all the characters or strings,\n\t// press \"Ctrl + D\" (EOF) for the program to process\n\t// the input and end.\n}", "title": "" }, { "docid": "590c7db3e2640b1af83dc787f38ed44f", "score": "0.5405314", "text": "func getInput(filename string) (*os.File, error) {\n\tif filename == \"-\" || filename == \"\" {\n\t\treturn os.Stdin, nil\n\t}\n\n\treturn os.Open(filename)\n}", "title": "" }, { "docid": "30a6500317d4d9fb20593b6666059f93", "score": "0.5383715", "text": "func InputAlgorithm() (string, error) {\n\tfmt.Println(\"Please input which sorting algorithm you want to use:\")\n\tbr := bufio.NewReader(os.Stdin)\n\talgorithm, _, err := br.ReadLine() // ReadLine returns\n\t// the str containing the line,\n\t// the isPrefix attribute is false when\n\t// returning the last fragment of the line.\n\t// Returnd eventually an error.\n\n\treturn string(algorithm), err\n}", "title": "" }, { "docid": "bda44d9b9745e66a3ed4479c33834120", "score": "0.53831756", "text": "func main() {\n\tvar text string\n\tfmt.Print(\"Introduce un texto \")\n\tfmt.Scanf(\"%s\", &text)\n\n\tvar first = text[0:2]\n\n\tif first == \"in\" {\n\t\tfmt.Print(\"si empieza en in\")\n\t} else {\n\t\tfmt.Print(\"no empieza en in\")\n\t}\n}", "title": "" }, { "docid": "cc6cd77b58653c7c22c0817811b8642f", "score": "0.5379214", "text": "func main() {\n\t// if we input space, will be panic code\n\tfmt.Print(\"[?] Input Name: \")\n\n\tvar name string\n\tfmt.Scanln(&name)\n\n\tif status, err := func(name string) (bool, error) {\n\t\tif strings.TrimSpace(name) == \"\" {\n\t\t\treturn false, errors.New(\"Input nil\")\n\t\t}\n\t\treturn true, nil\n\t}(name); status {\n\t\tfmt.Println(\"halo\", name)\n\t} else {\n\t\tpanic(err.Error())\n\t}\n\n}", "title": "" }, { "docid": "edb2806e7a6616e1d49c6aff036df74f", "score": "0.53717226", "text": "func evaluate(input string) {\n\tswitch input {\n\n\t// Meta\n\tcase inputSniffer(\"(i need|need|show)?\\\\s?(help|h)?\\\\s?(page)?\", input):\n\t\thelpDoc()\n\tcase inputSniffer(\"((whats|what is|show) (my|the|nls)?\\\\s?version\\\\s?(of nls)?|version|v)\", input):\n\t\tversionDoc()\n\n\t// Date & Time\n\tcase inputSniffer(\"((whats|what is)|what|show) (the time|time is it|(the )?current time)\", input):\n\t\texecCommand(\"date \\\"+%X\\\"\")\n\tcase inputSniffer(\"(what|whats) (is todays date|todays date)?\\\\s?(the date|date is it)?\", input):\n\t\texecCommand(\"date \\\"+%x\\\"\")\n\tcase inputSniffer(\"(((whats|what is)|show) the( current)? month|what month is it)\", input):\n\t\texecCommand(\"date \\\"+%B\\\"\")\n\tcase inputSniffer(\"(what|whats) (day is it)?(is)?\\\\s?(todays day|the day)?\", input):\n\t\texecCommand(\"date \\\"+%A\\\"\")\n\n\t// Files\n\tcase inputSniffer(\"((whats|what is)|show) (the )?size (of)? .*\\\\..*\", input):\n\t\tr, _ := regexp.Compile(\"\\\\S*\\\\..*\")\n\t\tr.FindString(input)\n\t\texecCommand(\"ls -lah \" + r.FindString(input) + \" | awk '{print $5}'\")\n\n\t// Git\n\tcase inputSniffer(\"^(git) (add|prepare|stage) (\\\\w+)(.\\\\w+)( to | for )?(commit|staging( area)?)?\", input):\n\t\tr, _ := regexp.Compile(\"\\\\w+\\\\.\\\\w+\")\n\t\texecCommand(\"git add \" + r.FindString(input))\n\tcase inputSniffer(\"^(git) (show |whats |what is )?\\\\s?(the |repository )?status(\\\\s?of (this|my) repository)?\", input):\n\t\texecCommand(\"git status\")\n\tcase inputSniffer(\"(?:(^(git) commit (files )?(with|with a|and add) (a )?(comment(:)?|message(:)?) (saying(:)? )))(.*)$\", input):\n\t\tr, _ := regexp.Compile(\"[^:]*$\")\n\t\t_, i := utf8.DecodeRuneInString(r.FindString(input))\n\t\texecCommand(\"git commit -m \\\"\" + r.FindString(input)[i:] + \"\\\"\")\n\tcase inputSniffer(\"^(git) push( commit(s)?| (all)? committed files)?( to)?( remote)?( repository| GitHub)?\", input):\n\t\texecCommand(\"git push\")\n\n\t// Programs & Software\n\tcase inputSniffer(\"((^(\\\\w*)|(what|what is))|show) ((my|the)? version|(\\\\w*))\\\\s?(version|(of (\\\\w*)))\", input):\n\t\tswitch input {\n\t\tcase inputSniffer(\"^(whats|what is).*\", input):\n\t\t\tr, _ := regexp.Compile(\"\\\\b(\\\\w+)$\")\n\t\t\texecCommand(r.FindString(input) + \" --version\")\n\t\tcase inputSniffer(\"^\\\\w*\\\\s(\\\\w*)$\", input):\n\t\t\tr, _ := regexp.Compile(\"^\\\\w*\")\n\t\t\texecCommand(r.FindString(input) + \" --version\")\n\t\tcase inputSniffer(\"^show\\\\s\\\\w*\\\\s\\\\w*\", input):\n\t\t\tinput = inputSniffer(\"^\\\\w*\\\\s\\\\w*\", input)\n\t\t\tr, _ := regexp.Compile(\"(\\\\w*)$\")\n\t\t\texecCommand(r.FindString(input) + \" --version\")\n\t\tdefault:\n\t\t\texecCatch(input)\n\t\t}\n\tcase inputSniffer(\"(start|open|launch) (a )?(local )?(web |python |testing )?(server)( (on|at|(on|at) port) \\\\d{4})?\", input):\n\t\tpyVersion, _ := regexp.Compile(\"Python 3.\\\\d+.\\\\d*\")\n\t\tport, _ := regexp.Compile(\"\\\\d{4}$\")\n\t\tswitch input {\n\t\tcase inputSniffer(\"(start|open|launch) (web|python|testing)?\\\\s?server$\", input):\n\t\t\tif pyVersion.MatchString(verifyCommand(\"python3 --version\")) {\n\t\t\t\texecCommand(\"python -m SimpleHTTPServer\")\n\t\t\t}\n\t\t\tprintln(\"You don't have Python 3 installed\")\n\t\tcase inputSniffer(\"(start|open|launch) (web|python|testing)?\\\\s?server (at|(on|at) port) \\\\d{4}\", input):\n\t\t\tif pyVersion.MatchString(verifyCommand(\"python3 --version\")) {\n\t\t\t\texecCommand(\"python -m SimpleHTTPServer \" + port.FindString(input))\n\t\t\t}\n\t\tdefault:\n\t\t\tfmt.Println(\"nls: error: could not access python 3\")\n\t\t\tos.Exit(1)\n\t\t}\n\n\t// User\n\tcase inputSniffer(\"(whats|what is) my username\", input):\n\t\texecCommand(\"whoami\")\n\tcase inputSniffer(\"(whats|what is) my (account |full )?name\", input):\n\t\texecCommand(\"finger `whoami` | sed 's/.*: *//;q'\")\n\tcase inputSniffer(\"((whats|what is)|show) (my)?\\\\s?ip( address)?\", input):\n\t\tdarwin, _ := regexp.Compile(\"Darwin\")\n\t\tlinux, _ := regexp.Compile(\"Linux\")\n\t\tswitch {\n\t\tcase darwin.MatchString(verifyCommand(\"uname -a\")):\n\t\t\texecCommand(\"ipconfig getifaddr en0\")\n\t\tcase linux.MatchString(verifyCommand(\"uname -a\")):\n\t\t\texecCommand(\"hostname -I\")\n\t\tdefault:\n\t\t\tfmt.Println(\"nls: error: could not verify operating system\")\n\t\t\tos.Exit(1)\n\t\t}\n\n\tdefault:\n\t\texecCatch(input)\n\t}\n}", "title": "" }, { "docid": "b688d4f619d64a1e48ad0a624dade90c", "score": "0.5367792", "text": "func main() {\n\tinput := input.Ask(\"Pythogream True of False, Pythgoream Loop, Pyhagoream Find (P, Pl, Pf)\")\n\tinput1 := strings.ToLower(input)\n\tswitch input1 {\n\tcase \"p\":\n\t\tpreP()\n\tcase \"pl\":\n\t\tpythagreanLoop()\n\tcase \"pf\":\n\t\tpythagreanFind()\n\t}\n\n}", "title": "" }, { "docid": "12aca11ba5e81910bfcc4f211beb8d75", "score": "0.53546643", "text": "func main() {\n\tif len(os.Args) < 2 {\n\t\tfmt.Println(\"ERROR: Wrong number of arguments.\")\n\t\tutils.PrintUsageAndExit()\n\t}\n\tcommand := os.Args[1]\n\tvar err error\n\tswitch strings.ToLower(command) {\n\tcase string(utils.Extension):\n\t\terr = validateExtension()\n\tcase string(utils.Structure):\n\t\terr = validateDescriptor()\n\tcase string(utils.Tests):\n\t\terr = runTests()\n\tcase string(utils.UpgradeJfrogPlugins):\n\t\terr = upgradeJfrogPlugins()\n\tdefault:\n\t\terr = errors.New(\"Unknown command: \" + command)\n\t}\n\tif err != nil {\n\t\tfmt.Println(\"ERROR:\", err.Error())\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "9ca29f83d5ff1b55b5c6c488b43c27b9", "score": "0.53281033", "text": "func usage() {\r\n fmt.Printf(\"Usage of %s:\\n\\n\", progname)\r\n fmt.Printf(\"%s is a tool to select pages from what you want.\\n\\n\", progname)\r\n fmt.Printf(\"Usage:\\n\\n\")\r\n fmt.Printf(\"\\tselpg -s=Number -e=Number [options] [filename]\\n\\n\")\r\n fmt.Printf(\"The arguments are:\\n\\n\")\r\n fmt.Printf(\"\\t-s=Number\\tStart from Page <number>.\\n\")\r\n fmt.Printf(\"\\t-e=Number\\tEnd to Page <number>.\\n\")\r\n fmt.Printf(\"\\t-l=Number\\t[options]Specify the number of line per page.Default is 72.\\n\")\r\n fmt.Printf(\"\\t-f\\t\\t[options]Specify that the pages are sperated by \\\\f.\\n\")\r\n fmt.Printf(\"\\t[filename]\\t[options]Read input from the file.\\n\\n\")\r\n fmt.Printf(\"If no file specified, %s will read input from stdin. Control-D to end.\\n\\n\", progname)\r\n}", "title": "" }, { "docid": "11bec2b748356ddf84a476e8ae670b50", "score": "0.52884126", "text": "func readFromInput(opts InputReaderOpts) string {\n reader := bufio.NewReader(opts.r)\n\n var s string\n for {\n fmt.Print(opts.prefix)\n s, _ = reader.ReadString('\\n')\n s = strings.Trim(s, \"\\n\")\n\n if opts.validate == nil || opts.validate(s) {\n return s\n }\n\n fmt.Println(opts.error)\n }\n}", "title": "" }, { "docid": "95f7b1a5a8843e12434f698f40e8b39c", "score": "0.52791", "text": "func getStdIn() ([]byte, error) {\n\tfd, err := os.Stdin.Stat()\n\tif err != nil{\n\t\treturn nil, err\n\t}\n\tif fd.Mode() & os.ModeNamedPipe == 0 {\n\t\treturn nil, errors.New(\"stdin not a pipe\")\n\t}else{\n\t\tstdInput, err := ioutil.ReadAll(os.Stdin)\n\t\tif err != nil{\n\t\t\treturn nil, err\n\t\t}\n\t\tif len(stdInput) == 0 {\n\t\t\treturn nil, errors.New(\"stdin is zero-length\")\n\t\t}else{\n\t\t\tif ! utf8.Valid(stdInput){\n\t\t\t\treturn nil, errors.New(\"stdin is not utf8\")\n\t\t\t}else{\n\t\t\t\treturn stdInput, nil\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "98f6971c41616671e7e868da9173ce40", "score": "0.5277739", "text": "func getInput() error {\n\tvar err error\n\tinput, err = os.Open(inputFile)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"open input file\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "507507e9a3135b1aa81fe05929104643", "score": "0.52757293", "text": "func parseArgs() {\n\tflag.Usage = func() {\n\t\tfmt.Printf(\"Usage: %s [options] <filename>\\n\\n\", os.Args[0])\n\t\tflag.PrintDefaults()\n\t}\n\tflag.Parse()\n\n\tif *version {\n\t\tfmt.Printf(\"%s\\n\", Version())\n\t\tos.Exit(0)\n\t}\n\n\tpipe = flag.NArg() == 0\n\n\tif !pipe {\n\t\t*prefix, _ = filepath.Abs(filepath.Clean(*prefix))\n\t\tin, _ = filepath.Abs(filepath.Clean(flag.Args()[0]))\n\t\t*out = safeFilename(*out, in)\n\t}\n\n\tif len(*pkgname) == 0 {\n\t\tfmt.Fprintln(os.Stderr, \"[w] No package name specified. Using 'main'.\")\n\t\t*pkgname = \"main\"\n\t} else {\n\t\tif unicode.IsDigit(rune((*pkgname)[0])) {\n\t\t\t// Identifier can't start with a digit.\n\t\t\t*pkgname = \"_\" + *pkgname\n\t\t}\n\t}\n\n\tif len(*funcname) == 0 {\n\t\tif pipe {\n\t\t\t// Can't infer from input file name in this mode.\n\t\t\tfmt.Fprintln(os.Stderr, \"[e] No function name specified.\")\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\t*funcname = safeFuncname(in, *prefix)\n\t\tfmt.Fprintf(os.Stderr, \"[w] No function name specified. Using %s.\\n\", *funcname)\n\t}\n}", "title": "" }, { "docid": "7c3c57b10ffb5a6e7d01bba97772f624", "score": "0.5273075", "text": "func readCommandLine() (string, int, string) {\n\tvar imagePath, processingMode, size string\n\n\tif len(os.Args) < 4 {\n\t\tlog.Fatalln(\"Command not found. Please enter according to the template\" +\n\t\t\t\" fileName.jpg squareSize processingMode [S or M]\" +\n\t\t\t\" For example: go run main.go monalisa.jpg 30 M\")\n\t}\n\timagePath = os.Args[1]\n\tsize = os.Args[2]\n\tprocessingMode = os.Args[3]\n\tsquareSize, err := strconv.Atoi(size)\n\tcheck(err)\n\n\treturn imagePath, squareSize, processingMode\n}", "title": "" }, { "docid": "cc00d20e3b0549e9bfe9f37543b353b9", "score": "0.5271931", "text": "func parseInput(input string, net *Network) string {\n\tvar command string\n\tvar value string\n\n\tstringinput := strings.Fields(input) //Splits the text into an array with each entry being a word\n\n\tif len(stringinput) == 0{\n\t\treturn \"Blank input. Try again.\\n\"\n\t}\n\t// Single Input\n\tif len(stringinput) > 0 {\n\t\tcommand = stringinput[0]\n\t\tcommand = strings.ToLower(strings.Trim(command, \" \\r\\n\")) //Removes hidden \\n etc, which makes string comparision impossible.\n\t}\n\t// Dual input\n\tif len(stringinput) > 1 { // Checks if you have 1 or 2 Commands and then runs the correct function accordingly.\n\t\tvalue = stringinput[1]\n\t\tvalue = strings.Trim(value, \" \\r\\n\") // Will not make input lowercase (untested)\n\t\treturn handleDualInput(command, value, net)\n\t} else {\n\t\treturn handleSingleInput(command, 0)\n\t}\n}", "title": "" }, { "docid": "d02e57c7b43330d337376648ea9e5878", "score": "0.52684313", "text": "func main() {\n\t//Enter your code here. Read input from STDIN. Print output to STDOUT\n\n\tvar line string\n\tscanner := bufio.NewScanner(os.Stdin)\n\tfor scanner.Scan() {\n\t\tif len(scanner.Text()) == 0 {\n\t\t\tbreak\n\t\t}\n\t\tline=scanner.Text() // Println will add back the final '\\n'\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"reading standard input:\", err)\n\t}\n\n\tx,_:=strconv.ParseInt(line, 0, 64)\n\n\n\tif x%2!=0 || (x>=6 && x<=20){\n\n\t\tfmt.Println(\"Weird\")\n\n\t}else {\n\n\t\tfmt.Println(\"Not Weird\")\n\t}\n\n}", "title": "" }, { "docid": "383344bb3ab8d182409772c04a9578a5", "score": "0.52683383", "text": "func ParseCommandLine() {}", "title": "" }, { "docid": "fe9d8fdb643b22f6a9e569f9f1c9c9b2", "score": "0.52551144", "text": "func (g *Game) parseInput(input string) (string, string, string, error) {\n\twords := strings.Split(input, \" \")\n\tif len(words) == 0 {\n\t\treturn \"\", \"\", \"\", fmt.Errorf(g.Dictionary[\"errors\"][\"invalidCommand\"], input)\n\t}\n\tcommand := g.expandShortcut(words[0])\n\n\tvar object string\n\tvar objectTarget string\n\tif len(words) > 1 {\n\t\tobject = strings.ToLower(strings.Join(words[1:], \" \"))\n\t\tif len(words) >= 4 && command == strings.ToLower(g.Dictionary[\"commands\"][\"use\"]) {\n\t\t\tobjects := strings.Split(object, \" on \")\n\t\t\tif len(objects) != 2 {\n\t\t\t\treturn \"\", \"\", \"\", fmt.Errorf(g.Dictionary[\"errors\"][\"invalidCommand\"], input)\n\t\t\t}\n\t\t\tobject = objects[0]\n\t\t\tobjectTarget = objects[1]\n\t\t}\n\t\tif command == strings.ToLower(g.Dictionary[\"commands\"][\"go\"]) ||\n\t\t\tcommand == strings.ToLower(g.Dictionary[\"commands\"][\"examine\"]) {\n\t\t\tobject = g.expandDirection(object)\n\t\t}\n\t}\n\treturn command, object, objectTarget, nil\n}", "title": "" }, { "docid": "dcccb5a564be6a8cdbd14b39a699aed0", "score": "0.5241319", "text": "func inputFlags() (string, string) {\n\n\t// variables declaration\n\tvar flagfile string\n\tvar partid string\n\n\t// flags declaration using flag package\n\tflag.StringVar(&flagfile, \"file\", \"input.txt\", \"filename of the input data eg: input.txt\")\n\tflag.StringVar(&partid, \"part\", \"a\", \"use either a or b\")\n\n\tflag.Parse() // after declaring flags we need to call it\n\treturn flagfile, partid\n}", "title": "" }, { "docid": "c6cf633507c677604cd7a4cc3bf90332", "score": "0.5204853", "text": "func readFromStdin(opts *cli.Options) {\n\tinfo, err := os.Stdin.Stat()\n\tif err != nil {\n\t\tlogrus.Fatal(err)\n\t}\n\n\tif info.Mode()&os.ModeCharDevice != 0 || info.Size() <= 0 {\n\t\treturn\n\t}\n\n\tinputData := make([]string, 0)\n\n\treader := bufio.NewReader(os.Stdin)\n\tfor {\n\t\tline, err := reader.ReadBytes('\\n')\n\t\tif err != nil && err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tinputData = append(inputData, strings.Trim(string(line), \"\\n\"))\n\t}\n\n\t// Treat input as a JSON array\n\tif opts.WriteInputIsJsonArray {\n\t\topts.WriteInputData = convertJSONInput(inputData[0])\n\t\treturn\n\t}\n\n\t// Treat input as new object on each line\n\topts.WriteInputData = inputData\n}", "title": "" }, { "docid": "468d63afcc0700758478aebd9382c0e1", "score": "0.520137", "text": "func read(opts_c, opts_a, opts_i map[string] bool,\n animals map[string] Animal) (string, string, string, error) {\n\n var key_exists bool\n\n // Reads and processes the user's input.\n fmt.Print(\"> \")\n reader := bufio.NewReader(os.Stdin)\n input, _ := reader.ReadString('\\n')\n input = strings.TrimSuffix(input, \"\\n\")\n input = strings.Trim(input, \" \")\n input = strings.ToLower(input)\n\n // Checks if the user wants to quit.\n if strings.Compare(input, \"q\") == 0 {\n err := errors.New(\"Quitting.\\n\")\n return \"\", \"\", \"\", err\n }\n\n // Validates the user's input.\n\n input_pts := strings.Fields(input)\n\n if len(input_pts) < 3 {\n err := errors.New(\"Not enough arguments!\\n\\n\")\n return \"\", \"\", \"\", err\n }\n\n optc := input_pts[0]\n _, key_exists = opts_c[optc]\n if !key_exists {\n err := errors.New(\"Command unavailable!\\n\\n\")\n return \"\", \"\", \"\", err\n }\n\n name := input_pts[1]\n _, key_exists = animals[name]\n if strings.Compare(optc, \"newanimal\") == 0 {\n if key_exists {\n err := errors.New(\"An animal with this name already exists!\\n\\n\")\n return \"\", \"\", \"\", err\n }\n } else {\n if !key_exists {\n err := errors.New(\"There's no animal with this name!\\n\\n\")\n return \"\", \"\", \"\", err\n }\n }\n\n opt := input_pts[2]\n if strings.Compare(optc, \"newanimal\") == 0 {\n _, key_exists = opts_a[opt]\n if !key_exists {\n err := errors.New(\"Animal unavailable!\\n\\n\")\n return \"\", \"\", \"\", err\n }\n } else {\n _, key_exists = opts_i[opt]\n if !key_exists {\n err := errors.New(\"Information unavailable!\\n\\n\")\n return \"\", \"\", \"\", err\n }\n }\n\n return optc, name, opt, nil\n\n}", "title": "" }, { "docid": "610c9f1f6c965d4da21284ffcdeff3d0", "score": "0.51852477", "text": "func invalidInput(errorMessage string) {\n\tfmt.Println()\n\tfmt.Println(errorMessage)\n\tusage()\n\tos.Exit(2)\n}", "title": "" }, { "docid": "322cc9f9d0f7740205b23a7f79da5d09", "score": "0.51851326", "text": "func main() {\n\tif len(os.Args) == 1 {\n\t\tscanner := bufio.NewScanner(os.Stdin)\n\t\tfmt.Printf(\"rizzi> \")\n\t\tfor scanner.Scan() {\n\t\t\tlexer \t\t:= newLexer(scanner.Text() + \"\\x00\")\n\t\t\tparser\t\t:= newParser(*lexer)\n\t\t\tinterpreter\t:= newInterpreter(*parser)\n\t\t// TESTS\n/*\t\t\tif VERBOSE {\n\t\t\t\tthisToken \t:= lexer.getNextToken()\n\t\t\t\tfor thisToken.category != EOF {\n\t\t\t\t\tfmt.Println(thisToken)\n\t\t\t\t\tthisToken = lexer.getNextToken()\n\t\t\t\t}\n\t\t\t}\n*/\t\t// END TESTS\n\t\t\tresult \t\t:= interpreter.interpret()\n\t\t\tfmt.Println(result)\n\t\t\tfmt.Println(interpreter.globalScope)\n\t\t\tfmt.Printf(\"rizzi> \")\n\t\t}\n\t} else {\n\t\ttext, err := ioutil.ReadFile(os.Args[1])\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tlexer := newLexer(string(text) + \"\\x00\")\n\t\tparser := newParser(*lexer)\n\t\tinterpreter := newInterpreter(*parser)\n\t\tvar setter int\n\t\tsetted := false\n\t\tfor i := 2; i < len(os.Args) - 1; i++ {\n\t\t\tif os.Args[i] == \"-a\" {\n\t\t\t\tsetter, err = strconv.Atoi(os.Args[i+1])\n\t\t\t\tsetted = true\n\t\t\t}\n\t\t}\n\t\t\n\t\tif setted == false {\n\t\t\tfmt.Println(\"You didn't provide an argument. Provide one now.\")\n\t\t\tfmt.Printf(\"arg> \")\n\t\t\tscanner := bufio.NewScanner(os.Stdin)\n\t\t\tscanner.Scan()\n\t\t\tsetter, err = strconv.Atoi(scanner.Text())\n\t\t}\n\t\t\n\t\tinterpreter.setter = setter\n\t\tresult := interpreter.interpret()\n\t\tfmt.Println(result)\n\t\tfmt.Println(interpreter.globalScope)\n\t}\n}", "title": "" }, { "docid": "f5bac47e9ff4cf61c90f486b19c492da", "score": "0.51800317", "text": "func main() {\n\tvar msg string\n\tmsg = \"Welcome to Golang!!\"\n\t//fmt.Println(\"Hello World!\")\n\tfmt.Printf(\"Hello World! %s\\n\", msg)\n\n\t//accepting input from user\n\tvar name string\n\tfmt.Println(\"Enter the name :\")\n\tfmt.Scanf(\"%s\\n\", &name)\n\tfmt.Printf(\"Hello %s\\n\", name)\n\n\tvar no int\n\tfmt.Println(\"Enter the number :\")\n\tfmt.Scanf(\"%d\\n\", &no)\n\tfmt.Printf(\"%d\\n\", no)\n}", "title": "" }, { "docid": "c482b590ab5b01a479453b5fc815b460", "score": "0.5165039", "text": "func readUserCommand() string {\n\tscanner := bufio.NewScanner(os.Stdin)\n\tscanner.Scan()\n\tcmd := scanner.Text()\n\treturn cmd\n}", "title": "" }, { "docid": "ec4170aae63f6c52b4a24a3fde2d8d0e", "score": "0.5156063", "text": "func userInput(prompt *C.char) *C.char {\n\t//\ts := C.GoString(prompt)\n\t//\tif s != \"\" {\n\t//\t\tfmt.Println(s)\n\t//\t}\n\treturn C.CString(\"\")\n}", "title": "" }, { "docid": "2e13a5dc7896d958c98cb058b3a26372", "score": "0.51527244", "text": "func getinput() string {\n stdin_r := bufio.NewReader(os.Stdin)\n ret_val, _ := stdin_r.ReadString('\\n')\n ret_val = strings.Replace(ret_val, \"\\n\", \"\", -1)\n return ret_val\n}", "title": "" }, { "docid": "d875549fbbe99c587c06a3ac8e6f6513", "score": "0.51492685", "text": "func input() {\n\n\tdata, err := ioutil.ReadFile(\"input.txt\")\n if err != nil {\n fmt.Println(\"File reading error\", err)\n return\n }\n fmt.Println(\"Contents of file:\\n\", string(data))\n}", "title": "" }, { "docid": "b688db493c8c27520afa6d78c1a692ca", "score": "0.51482576", "text": "func Stdin_line_read(a string) string {\n\t//a is used to pass in a prompt\n\treader := bufio.NewReader(os.Stdin)\n\tfmt.Print(a + \"\\n\")\n\tb, _ := reader.ReadString('\\n')\n\treturn strings.TrimSpace(b)\n}", "title": "" }, { "docid": "ba6e5255e82b38432aac73dc7d05a13c", "score": "0.51368535", "text": "func main() {\n\tfmt.Println(\"USAGE: \", \"A program that accept a series of integers and\\ndetermines the highest and lowest value from the input\")\n\tfmt.Println(\"EXAMPLE: \\n\\tEnter a series of integers: 2 1 3 5\")\n\tfmt.Println()\n\tscanner := bufio.NewScanner(os.Stdin)\n\tfor {\n\t\tfmt.Print(\"Enter a series of integers: \")\n\t\tscanner.Scan()\n\t\tinputString := strings.Minify(scanner.Text())\n\t\tinput, err := convert.StringToArrayOfInt(inputString)\n\t\tif err != nil {\n\t\t\tgolog.Error(err)\n\t\t\tfmt.Println()\n\t\t\tcontinue\n\t\t}\n\t\tl, h := GetHighestAndLowestItem(input)\n\t\tfmt.Println(\"Input:\", input)\n\t\tfmt.Printf(\"Lowest: %d\\n\", l)\n\t\tfmt.Printf(\"Highest: %d\\n\", h)\n\t\tfmt.Println()\n\t}\n}", "title": "" }, { "docid": "586cc9dfb204726a09b55aa160a07dc6", "score": "0.51333004", "text": "func main() {\r\n\t\r\n\t// Make a scanner to read lines from standard input\r\n\tscanner := bufio.NewScanner(os.Stdin)\r\n\t\r\n\t// Process each of the lines from standard input\r\n\tfor scanner.Scan() {\r\n\t\t// Get the current line of text\r\n\t\tline := scanner.Text()\r\n\t\t// fmt.Println(line)\r\n\t\r\n if strings.Count(line, \"^\") >= 2 {\r\n newline := makeString(line)\r\n result , _ := evaluate(newline)\r\n fmt.Println(result)\r\n }else{\r\n\t\r\n result , _ := evaluate(line)\r\n fmt.Println(result)\r\n }\r\n \r\n \r\n }\r\n}", "title": "" }, { "docid": "66ebf76e14f1570309157cefb329b332", "score": "0.5128918", "text": "func main() {\n\ts := slurper.NewSlurper()\n\tinputs := os.Args[1:]\n\n\tfor i := range(inputs) {\n\t\tfmt.Printf(s.Slurp(inputs[i]))\n\t}\n\n\tif len(inputs) != 0 {\n\t\tfmt.Printf(\"\\n\")\n\t}\n}", "title": "" }, { "docid": "9ddd09d3df79cbb8de6ef561c585fcc5", "score": "0.5126865", "text": "func OpReadStdin(prgrm *ast.CXProgram, inputs []ast.CXValue, outputs []ast.CXValue) {\n\treader := bufio.NewReader(os.Stdin)\n\ttext, err := reader.ReadString('\\n')\n\tif err != nil {\n\t\tpanic(constants.CX_INTERNAL_ERROR)\n\t}\n\n\t// text = strings.Trim(text, \" \\n\")\n\ttext = strings.Replace(text, \"\\n\", \"\", -1)\n\ttext = strings.Replace(text, \"\\r\", \"\", -1)\n\toutputs[0].Set_str(prgrm, text)\n}", "title": "" }, { "docid": "c54c2c77dce625692d3e7c66e960891f", "score": "0.5111822", "text": "func ReadInput(reader *bufio.Reader) (in string, retErr error){\n\n\tvar err error = nil\n\tvar input string\n\n\tfor {\n\t\tinput, err = reader.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tFatal(\" Errore nella lettura dell'input. \" + err.Error())\n\t\t} else { break }\n\t}\n\n\tif runtime.GOOS == \"windows\" {\n\t\tinput = strings.Replace(input, \"\\n\", \"\", -1)\n\n\t} else {\n\t\tinput = strings.Replace(input, \"\\n\", \"\", -1)\n\t}\n\n\treturn input, nil\n}", "title": "" }, { "docid": "62c505fa15e94b11c63d40be47767281", "score": "0.51110244", "text": "func main() {\n\tscanner := bufio.NewScanner(os.Stdin)\n\tfmt.Printf(\"Type your born year: \")\n\tscanner.Scan()\n\tinput, _ := strconv.ParseInt(scanner.Text(), 10, 64)\n\tfmt.Printf(\"You wil be %d years old at the end of 2021\", 2021-input)\n\n}", "title": "" }, { "docid": "f9b406874719b3a87b4d10e8a0d3a2c7", "score": "0.5106939", "text": "func MustReadStdin() string {\n r := bufio.NewReader(os.Stdin)\n\n var in string\n for {\n var err error\n in, err = r.ReadString('\\n')\n if err != io.EOF {\n if err != nil {\n panic(err)\n }\n }\n in = strings.TrimSpace(in)\n if len(in) > 0 {\n break\n }\n }\n\n fmt.Println(\"\")\n\n return in\n}", "title": "" }, { "docid": "278da65575dc389c76589629f588a06e", "score": "0.5100238", "text": "func switchInput(input string) {\n\tswitch input {\n\tcase \"read\":\n\t\thandleRead()\n\tcase \"write\":\n\t\thandleWrite()\n\tcase \"users\":\n\t\thandleUsers()\n\tdefault:\n\t\tlog.Println(\"Invalid option\")\n\t}\n}", "title": "" }, { "docid": "472f72e7a7982cddbc6e6b2ba7ed3232", "score": "0.5096748", "text": "func main() {\n\t// The colon-equals syntax allows simultaneous variable\n\t// declaration and initialization with type inference. The\n\t// type of scanner is whatever is returned by the bufio\n\t// package's NewScanner function. The scanner is initialized\n\t// to use standard input from the operating system.\n\tscanner := bufio.NewScanner(os.Stdin)\n\n\t// The scanner is configured to split the input stream based\n\t// on words.\n\tscanner.Split(bufio.ScanWords)\n\n\t// The built-in routine, make, is used to define a map. The\n\t// map acts as a dictionary with keys of type string and\n\t// values of type int.\n\tcounts := make(map[string]int)\n\n\t// The only looping construct in Go is \"for\". This loop is\n\t// like a Java \"while\" loop, because it only has one\n\t// expression after \"for\" and before the loop body.\n\t//\n\t// The .Scan method of the bufio scanner returns true while\n\t// there's more input to see.\n\tfor scanner.Scan() {\n\t\t// The post-fix increment operator, plus-plus, is more\n\t\t// limited in Go than in C. But it still adds one.\n\t\t//\n\t\t// In Go, heavy use is made of the convention that\n\t\t// data without explicit initialization is its zero\n\t\t// value. For the integers in this map, that's a\n\t\t// zero. The scanner.Text() call returns the current\n\t\t// word, and it is used as a key in the dictionary.\n\t\t// The corresponding value is then incremented.\n\t\tcounts[scanner.Text()]++\n\t}\n\n\t// Declare an integer for storing the maximum count.\n\tmax := 0\n\n\t// Declare a slice of string with zero elements. (Just think\n\t// of it as an array for now.) It will store the modes.\n\tmodes := make([]string, 0)\n\n\t// This loop goes over every key/value pair in the map.\n\t//\n\t// The keys will be words, like \"a\", \"b\", and \"c\" in the\n\t// transcript at the top of this file. The values will be the\n\t// counts, like 1, 2, and 3 in the same transcript.\n\t//\n\t// The .Println function in the fmt package is like Java's\n\t// System.out.Println.\n\tfor word, count := range counts {\n\t\t// If the current counter is larger than the maximum\n\t\t// count seen so far, then reset the list of modes\n\t\t// with a slice containing only this word. Record the\n\t\t// new maximum.\n\t\tif count > max {\n\t\t\tmodes = []string{word}\n\t\t\tmax = count\n\t\t} else if count == max {\n\t\t\t// Append any other word with the same maximal\n\t\t\t// count to the mode list.\n\t\t\tmodes = append(modes, word)\n\t\t}\n\t}\n\n\t// Print a line to standard output using the default\n\t// stringification for the value.\n\tfmt.Println(modes)\n}", "title": "" }, { "docid": "c5bf15ad3936c070d1ae354d9d6ee4cc", "score": "0.50957626", "text": "func findSyslCommand(input string) string {\n\tvar re = regexp.MustCompile(`(?m)(?:\\n)(sysl.*)`)\n\tans := re.FindString(input)\n\tans = strings.Replace(ans, \"\\n\", \"\", 1)\n\treturn ans\n\n}", "title": "" }, { "docid": "43f7eac564d5a592ad00d66536bc161a", "score": "0.50892335", "text": "func main() {\n\tvar (\n\t\tnpt *os.File\n\t\tout *os.File\n\t\terr error\n\t\ttokenChannel chan lexer.Token\n\t)\n\n\t// Initializes flags; see above:\n\tinitFlags()\n\n\t// Getting our input File:\n\tif flags.i != \"\" {\n\t\tnpt, err = os.Open(flags.i)\n\t} else {\n\t\tnpt = os.Stdin\n\t}\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Getting our output File:\n\tif flags.o != \"\" {\n\t\tout, err = os.Create(flags.o)\n\t} else {\n\t\tout = os.Stdout\n\t}\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Tokenizing and serializing:\n\ttokenChannel = lexer.Tokenize(npt)\n\tserialize(tokenChannel, out)\n}", "title": "" }, { "docid": "6246ae66d3d7bf52ea83699ec279b5e9", "score": "0.5089179", "text": "func readStringStdin() string {\n\treader := bufio.NewReader(os.Stdin)\n\tinputVal, err := reader.ReadString('\\n')\n\tif err != nil {\n\t\tlog.Printf(\"Invalid option: %v\\n\", err)\n\t\treturn \"\"\n\t}\n\n\toutput := strings.TrimSuffix(inputVal, \"\\n\") // Important!\n\treturn output\n}", "title": "" }, { "docid": "0721b4c24e2c9c40ffcdbcd6c976fc88", "score": "0.5087528", "text": "func Main(cmd *cobra.Command, args []string) error {\n\t//version\n\tif viper.GetBool(\"version\") {\n\t\tfmt.Println(build.String())\n\t\treturn nil\n\t}\n\t//formats\n\tif viper.GetBool(\"Formats\") {\n\t\tprintFormats()\n\t\treturn nil\n\t}\n\t//pipe stdin\n\tif len(args) == 0 {\n\t\tinfo, err := os.Stdin.Stat()\n\t\tif err != nil {\n\t\t\treturn errors.Annotate(err, \"stdin stat failed\")\n\t\t}\n\t\t//OR ModeCharDevice & Size check\n\t\t// if (info.Mode()&os.ModeCharDevice) == os.ModeCharDevice &&\n\t\t// \tinfo.Size() > 0 {\n\t\tif (info.Mode() & os.ModeNamedPipe) == os.ModeNamedPipe {\n\t\t\td, err := ioutil.ReadAll(os.Stdin)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Annotate(err, \"stdin read failed\")\n\t\t\t}\n\t\t\targs = append(args, string(d))\n\t\t}\n\t}\n\t//timezone\n\tif len(viper.GetString(\"timezone\")) > 0 {\n\t\tloc, err := time.LoadLocation(viper.GetString(\"timezone\"))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ttime.Local = loc\n\t}\n\t//times\n\ttimes := make([]time.Time, 0, len(args)+1)\n\tif len(args) == 0 {\n\t\tt := time.Now()\n\t\tt = t.Add(viper.GetDuration(\"add\"))\n\t\tt = t.Add(-viper.GetDuration(\"sub\"))\n\t\ttimes = append(times, t)\n\t}\n\tfor _, arg := range args {\n\t\tt, err := dateparse.ParseIn(strings.TrimSpace(arg), time.Local)\n\t\tif err != nil {\n\t\t\treturn errors.Annotate(err, \"parse strict\")\n\t\t}\n\t\tt = t.Add(viper.GetDuration(\"add\"))\n\t\tt = t.Add(-viper.GetDuration(\"sub\"))\n\t\ttimes = append(times, t)\n\t}\n\n\t//before compare\n\tif len(viper.GetString(\"before\")) > 0 {\n\t\tt, err := dateparse.ParseIn(viper.GetString(\"before\"), time.Local)\n\t\t//t, err := dateparse.ParseStrict(viper.GetString(\"before\"))\n\t\tif err != nil {\n\t\t\treturn errors.Annotate(err, \"parse strict\")\n\t\t}\n\t\tif t.After(times[0]) {\n\t\t\treturn errors.CodeError(&cmpCode{val: 1})\n\t\t}\n\t\treturn errors.CodeError(&cmpCode{})\n\t}\n\n\t//after compare\n\tif len(viper.GetString(\"after\")) > 0 {\n\t\tt, err := dateparse.ParseIn(viper.GetString(\"after\"), time.Local)\n\t\tif err != nil {\n\t\t\treturn errors.Annotate(err, \"parse strict\")\n\t\t}\n\t\tif t.Before(times[0]) {\n\t\t\treturn errors.CodeError(&cmpCode{val: 1})\n\t\t}\n\t\treturn errors.CodeError(&cmpCode{})\n\t}\n\n\t//convert\n\tfor _, tm := range times {\n\t\tif len(viper.GetString(\"format\")) > 0 {\n\t\t\tdest := \"\"\n\t\t\tswitch viper.GetString(\"format\") {\n\t\t\tcase \"ANSIC\":\n\t\t\t\tdest = time.ANSIC\n\t\t\tcase \"UnixDate\":\n\t\t\t\tdest = time.UnixDate\n\t\t\tcase \"RubyDate\":\n\t\t\t\tdest = time.RubyDate\n\t\t\tcase \"RFC822\":\n\t\t\t\tdest = time.RFC822\n\t\t\tcase \"RFC822Z\":\n\t\t\t\tdest = time.RFC822Z\n\t\t\tcase \"RFC850\":\n\t\t\t\tdest = time.RFC850\n\t\t\tcase \"RFC1123\":\n\t\t\t\tdest = time.RFC1123\n\t\t\tcase \"RFC1123Z\":\n\t\t\t\tdest = time.RFC1123Z\n\t\t\tcase \"RFC3339\":\n\t\t\t\tdest = time.RFC3339\n\t\t\tcase \"RFC3339Nano\":\n\t\t\t\tdest = time.RFC3339Nano\n\t\t\tcase \"Kitchen\":\n\t\t\t\tdest = time.Kitchen\n\t\t\tcase \"Stamp\":\n\t\t\t\tdest = time.Stamp\n\t\t\tcase \"StampMilli\":\n\t\t\t\tdest = time.StampMilli\n\t\t\tcase \"StampMicro\":\n\t\t\t\tdest = time.StampMicro\n\t\t\tcase \"StampNano\":\n\t\t\t\tdest = time.StampNano\n\t\t\tcase \"TimestampSec\":\n\t\t\t\tfmt.Fprintln(os.Stdout, tm.Unix())\n\t\t\t\tcontinue\n\t\t\tcase \"TimestampMilli\":\n\t\t\t\tfmt.Fprintln(os.Stdout, tm.UnixNano()/1000000)\n\t\t\t\tcontinue\n\t\t\tcase \"TimestampMicro\":\n\t\t\t\tfmt.Fprintln(os.Stdout, tm.UnixNano()/1000)\n\t\t\t\tcontinue\n\t\t\tcase \"TimestampNano\":\n\t\t\t\tfmt.Fprintln(os.Stdout, tm.UnixNano())\n\t\t\t\tcontinue\n\t\t\tdefault:\n\t\t\t\td, err := dateparse.ParseFormat(viper.GetString(\"format\"))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errors.Annotate(err, \"parse format\")\n\t\t\t\t}\n\t\t\t\tdest = d\n\t\t\t}\n\t\t\tfmt.Fprintln(os.Stdout, tm.Format(dest))\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Fprintln(os.Stdout, tm.UnixNano()/1000000)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1cd2da8c0ffb62acb18baa58ecc88121", "score": "0.50858104", "text": "func main() {\n\tflagutil.Usage = \"[file...]\"\n\tflag.Parse()\n\n\t// Read in our input.\n\tnames := flag.Args()\n\tif len(names) == 0 {\n\t\tnames = append(names, \"/dev/stdin\")\n\t}\n\tbuf := Read(names)\n\n\t// Time to sort.\n\tSort(buf)\n\n\t// Print the sorted lines.\n\tPrint(buf)\n}", "title": "" }, { "docid": "1965f2f2e16b264df2dcb9888ba8c2e7", "score": "0.5082105", "text": "func parse(in io.Reader) (string, string, []string, error) {\n\tvar sb strings.Builder\n\tvar err error\n\tres := []string{}\n\tvar l int\n\tvar c byte\n\tb := make([]byte, 1)\n\tt := \"\"\n\targ1 := \"\"\n\tfor err == nil {\n\t\tif l, err = in.Read(b); err == nil && l == 1 {\n\t\t\tc = b[0]\n\t\t\tif c == '\\r' || c == ' ' {\n\t\t\t\tif t == \"\" {\n\t\t\t\t\tt = sb.String()\n\t\t\t\t} else if arg1 == \"\" {\n\t\t\t\t\targ1 = sb.String()\n\t\t\t\t} else {\n\t\t\t\t\tres = append(res, sb.String())\n\t\t\t\t}\n\t\t\t\tsb.Reset()\n\t\t\t} else {\n\t\t\t\tsb.WriteByte(c)\n\t\t\t}\n\t\t\tif c == '\\r' {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t}\n\t}\n\n\treturn t, arg1, res, err\n}", "title": "" }, { "docid": "343564d45c734e8bb2463916c0b47b4f", "score": "0.50777614", "text": "func parseInput() {\n\tinput := strings.ToLower(ui.commandInput.GetText())\n\tswitch input {\n\tcase \"q\", \"quit\":\n\t\tui.app.Stop()\n\tcase \"+\":\n\t\ttimeForward()\n\tcase \"-\":\n\t\ttimeBackward()\n\tcase \"n\", \"next\":\n\t\tdayForward()\n\tcase \"p\", \"prior\":\n\t\tdayBackward()\n\tcase \"t\", \"today\", \"r\", \"refresh\", \"reset\":\n\t\tdayTodayTimeNow()\n\tcase \"y\", \"yesterday\":\n\t\tdayYesterday()\n\tdefault:\n\t\tif strings.HasPrefix(input, \"t\") {\n\t\t\ttimeSlices, timeRange, activity, err := parseTimeEntry(input)\n\t\t\tif !err {\n\t\t\t\tif timeRange[0] > 0 {\n\t\t\t\t\ttimeSlices = expandRange(timeRange[0], timeRange[1])\n\t\t\t\t}\n\t\t\t\tassignTime(timeSlices, activity)\n\t\t\t}\n\t\t} else if strings.HasPrefix(input, \"u\") {\n\t\t\ttimeSlices, timeRange, err := parseUnassignment(input)\n\t\t\tif !err {\n\t\t\t\tif timeRange[0] > 0 {\n\t\t\t\t\ttimeSlices = expandRange(timeRange[0], timeRange[1])\n\t\t\t\t}\n\t\t\t\tunassignTime(timeSlices)\n\t\t\t}\n\t\t}\n\t}\n\tresetInput()\n}", "title": "" }, { "docid": "22df09b087a7484b3321e61475cf95af", "score": "0.50645715", "text": "func main() {\n\t// os.Args provides access to raw command-line arguments\n\targsWithProg := os.Args\n\t// First value in slice is path to program; rest holds arguments to program\n\targsWithoutProg := os.Args[1:]\n\n\targ := os.Args[3]\n\n\tfmt.Println(argsWithProg)\n\tfmt.Println(argsWithoutProg)\n\tfmt.Println(arg)\n}", "title": "" }, { "docid": "4e5e95970d2c46a89dc1622df69146c8", "score": "0.5054147", "text": "func readFile() string {\n\tvar fileName string\n\tfmt.Println(\"*** Enter absolute file path or place file in same directory of program execution if using just file name (example file.txt) *** \")\n\tfmt.Printf(\"\\n\" + \"Please enter the name of the file: \")\n\tfmt.Scan(&fileName)\n\treturn fileName\n}", "title": "" }, { "docid": "1e16b66081e4a9df60d69e530ff30842", "score": "0.50399166", "text": "func readInput(prompt string) string {\n\tscanner := bufio.NewScanner(os.Stdin)\n\n\tfmt.Print(prompt)\n\tscanner.Scan()\n\n\treturn scanner.Text()\n}", "title": "" }, { "docid": "e6429d6fead9692de535faf94bc4c85f", "score": "0.5035774", "text": "func inputProcessor() string {\n\tfmt.Println(\"What link would you like to check?\")\n\tfmt.Println(\"Be sure to include 'https://' before the url\")\n\tvar url string\n\tfmt.Scanln(&url)\n\treturn url\n}", "title": "" }, { "docid": "78532728027cc82279e426e58b36ef0b", "score": "0.5024538", "text": "func checkArgs() (string, error) {\n\t//Fetch the command line arguments.\n\targs := os.Args\n\t//Check the length of the arugments, return failure if they are too\n\t//long or too short.\n\tif len(args) != 2 {\n\t\treturn \"\", errors.New(\"Invalid number of arguments. \\n\" +\n\t\t\t\" Please provide the file name with relative path\" +\n\t\t\t\" of the words input file!\\n\")\n\t}\n\tfilePath := args[1]\n\t//On success, return the filePth value\n\treturn filePath, nil\n}", "title": "" }, { "docid": "ca52f79abcd31d1dcfa7200324e396e2", "score": "0.5021105", "text": "func getName() string {\r\n\treader := bufio.NewReader(os.Stdin)\r\n\tfmt.Print(\"Enter integer value X to finish: \\n \")\r\n\ttext, _ := reader.ReadString('\\n')\r\n\r\n\t//remove windows based line feed characters\r\n\r\n\ttext = strings.TrimSuffix(text, \"\\n\")\r\n\ttext = strings.TrimSuffix(text, \"\\r\")\r\n\treturn text\r\n}", "title": "" }, { "docid": "33dc1be30b972f20cb8a25dcb590e711", "score": "0.5020322", "text": "func UserInput(prompt string) string {\n\t// Variables for function use\n\t// Container to hold the user input\n\tvar inputRaw string\n\tvar err error\n\t// Retrieve the GOOS environment variable for compatibility\n\tconst GOOS string = runtime.GOOS\n\t// Generate a new reader\n\treader := bufio.NewReader(os.Stdin)\n\t// Prompt\n\tfmt.Print(prompt)\n\t// Read input using newline as the delimiter\n\t// Windows line endings: \\r\n\t// Unix line endings: \\n\n\tif GOOS == \"windows\" {\n\t\tinputRaw, err = reader.ReadString('\\r')\n\t} else {\n\t\tinputRaw, err = reader.ReadString('\\n')\n\t}\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t// Remove the final character (delimeter)\n\treturn inputRaw[:len(inputRaw)-1]\n}", "title": "" }, { "docid": "f1ac36d79a40b7efd79e26d756ebc430", "score": "0.50126964", "text": "func main() {\n\t// Parse float with 64 bits of precision\n\tf, _ := strconv.ParseFloat(\"1.234\", 64)\n\tfmt.Println(f)\n\n\t// Parse int and 0 means infer base from the string, 64 means result fits in 64 bits\n\ti, _ := strconv.ParseInt(\"123\", 0, 64)\n\tfmt.Println(i)\n\t// Recognizes hex-formatted numbers\n\td, _ := strconv.ParseInt(\"0x1c8\", 0, 64)\n\tfmt.Println(d)\n\n\tu, _ := strconv.ParseUint(\"789\", 0, 64)\n\tfmt.Println(u)\n\n\t// Base-10 int parsing\n\tk, _ := strconv.Atoi(\"135\")\n\tfmt.Println(k)\n\n\t// Parse functions return error on bad input\n\t_, e := strconv.Atoi(\"wat\")\n\tfmt.Println(e)\n\n}", "title": "" }, { "docid": "54df33b9f92b04145f47132bf910e1b0", "score": "0.5011129", "text": "func main() {\n\tfmt.Printf(\"%#v\\n\", os.Args)\n\n\tfmt.Println(\"Path:\", os.Args[0])\n\tfmt.Println(\"1st argument:\", os.Args[1])\n\tfmt.Println(\"2nd argument:\", os.Args[2])\n\tfmt.Println(\"3rd argument:\", os.Args[3])\n\n\tfmt.Println(\"Number of arguments:\", len(os.Args))\n}", "title": "" }, { "docid": "d710aca018a90f59a5f45183b7535765", "score": "0.5007723", "text": "func InputOption(title, def string) string {\n\tvar input = bufio.NewScanner(os.Stdin)\n\tfmt.Print(title)\n\tvar text string\n\tfor input.Scan() {\n\t\ttext = input.Text()\n\t\ttext = strings.TrimSpace(text)\n\t\tif text == \"\" {\n\t\t\ttext = def\n\t\t}\n\t\tbreak\n\t}\n\treturn text\n}", "title": "" }, { "docid": "71c2a42a2c5f38207cb66b85a2439574", "score": "0.5006376", "text": "func dorr(location string) {\n\tvar f *os.File\n\tvar err error\n\tif len(location) > 0 {\n\t\tf, err = os.Open(location)\n\t} else {\n\t\tf = os.Stdin\n\t}\n\tif err == nil {\n\t\treadrr(f)\n\t\tf.Close()\n\t} else {\n\t\tfmt.Fprintf(os.Stderr, \"%v\\n\", err)\n\t}\n}", "title": "" }, { "docid": "5eb5de2e2d860784a072b16ae1fc4182", "score": "0.50049067", "text": "func main() {\n\t_, err := os.Open(\"no-file.txt\")\n\tif err != nil {\n\n\t\t//fmt.Println(\"error happened\", err) //error happened open no-file.txt: The system cannot find the file specified.\n\t\tlog.Println(\"error happened\", err)\n\t\t//log.Fatalln(err)\n\t}\n}", "title": "" }, { "docid": "9436f8b582749f2181f5355089e19e5b", "score": "0.5003032", "text": "func readStdin(am_introducer int) {\n\tfor {\n\t\treader := bufio.NewReader(os.Stdin)\n\t\ttext, _ := reader.ReadString('\\n')\n\t\ts := strings.Fields(text)\n\t\tif len(s) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tcmd := s[0]\n\n\t\tif cmd == \"switch\" {\n\t\t\tmutex.Lock()\n\t\t\tif Network.IsGossipStyle == 1 {\n\t\t\t\tNetwork.IsGossipStyle = 0\n\t\t\t} else {\n\t\t\t\tNetwork.IsGossipStyle = 1\n\t\t\t}\n\t\t\tfor i, _ := range Network.MemList.Table {\n\t\t\t\tNetwork.MemList.Table[i][3] = Network.IsGossipStyle\n\t\t\t}\n\t\t\tmutex.Unlock()\n\t\t\tSendList(1)\n\t\t} else if cmd == \"list\" {\n\t\t\tvar strs []string\n\t\t\tfor ip, _ := range Network.MemList.Table {\n\t\t\t\tstrs = append(strs, ip)\n\t\t\t}\n\t\t\tfmt.Println(strings.Join(strs, \", \"))\n\t\t} else if cmd == \"listself\" {\n\t\t\tfmt.Println(myAddr)\n\t\t} else if cmd == \"join\" {\n\t\t\tmutex.Lock()\n\t\t\tleft = false\n\t\t\tmutex.Unlock()\n\t\t\tjoin(am_introducer)\n\t\t} else if cmd == \"leave\" {\n\t\t\tNetwork.MemList.Table[myAddr][2] = 2\n\t\t\tSendList(0)\n\t\t\tleave()\n\t\t\tmutex.Lock()\n\t\t\tleft = true\n\t\t\tfmt.Fprintf(file, \"%v left\\n\", myAddr)\n\t\t\tmutex.Unlock()\n\t\t} else if cmd == \"put\" { // put localfilename sdfsfilename\n\t\t\tL.Put(s[1], s[2])\n\t\t} else if cmd == \"get\" { // get sdfsfilename localfilename\n\t\t\tL.Get(s[1], s[2])\n\t\t} else if cmd == \"delete\" { // delete sdfsfilename\n\t\t\tL.Delete(s[1])\n\t\t} else if cmd == \"ls\" { // ls sdfsfilename\n\t\t\tL.Ls(s[1])\n\t\t} else if cmd == \"store\" {\n\t\t\tL.Store()\n\t\t} else if cmd == \"maple\" {\n\t\t\tstart = time.Now()\n\t\t\tvar ips []string\n\t\t\tfor ip, _ := range Network.MemList.Table {\n\t\t\t\tips = append(ips, ip)\n\t\t\t}\n\n\t\t\texecutable := s[1]\n\t\t\tnum_maples, _ := strconv.Atoi(s[2])\n\t\t\tnumMaples = num_maples\n\t\t\tprefix := s[3]\n\t\t\tsdfs_intermediate_filename_prefix = prefix\n\t\t\tsrcdir := s[4]\n\t\t\tlines := 20\n\t\t\tchunks := Maple.Chunkify(srcdir, prefix, lines)\n\t\t\tfmt.Println(\"made \", len(chunks), \" chunks\")\n\n\t\t\tassignment := Maple.AssignFiles(chunks, num_maples, ips, executable)\n\t\t\tfmt.Println(assignment)\n\n\t\t\tnum_actual_maples := 0\n\t\t\tfor _, files := range assignment {\n\t\t\t\tif len(files) != 0 {\n\t\t\t\t\tnum_actual_maples += 1\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnumMapleAcksNeeded = num_actual_maples\n\n\t\t\tmapleFetchMessage := Data.MessagePacket{}\n\t\t\tmapleFetchMessage.MessageType = Network.MAPLE_FETCH\n\t\t\tmapleFetchMessage.SenderIP = myAddr\n\n\t\t\tmapleByteArray, _ := json.Marshal(mapleFetchMessage)\n\t\t\tSendMessageToAll(mapleByteArray)\n\n\t\t} else if cmd == \"juice\" {\n\t\t\tstart = time.Now()\n\t\t\tvar ips []string\n\t\t\tfor ip, _ := range Network.MemList.Table {\n\t\t\t\tips = append(ips, ip)\n\t\t\t}\n\n\t\t\texecutable := s[1]\n\t\t\tnum_juices, _ := strconv.Atoi(s[2])\n\t\t\tnumJuices = num_juices\n\t\t\tprefix := s[3]\n\t\t\t// sdfs_intermediate_filename_prefix = prefix\n\t\t\tsdfs_dest_filename = s[4]\n\t\t\tdelete_input, _ = strconv.Atoi(s[5])\n\t\t\tpartition_type := s[6]\n\n\t\t\tif partition_type == \"range\" {\n\t\t\t\tassignment := Juice.RangePartitionAssignment(ips, executable, num_juices, prefix)\n\t\t\t\tfmt.Println(assignment)\n\t\t\t\tnumJuiceAcksNeeded = len(assignment)\n\t\t\t} else {\n\t\t\t\tassignment := Juice.HashPartitionAssignment(ips, executable, num_juices, prefix)\n\t\t\t\tfmt.Println(assignment)\n\t\t\t\tnumJuiceAcksNeeded = len(assignment)\n\t\t\t}\n\n\t\t\tjuiceFetchMessage := Data.MessagePacket{}\n\t\t\tjuiceFetchMessage.MessageType = Network.JUICE_FETCH\n\t\t\tjuiceFetchMessage.SenderIP = myAddr\n\n\t\t\tjuiceByteArray, _ := json.Marshal(juiceFetchMessage)\n\t\t\tSendMessageToAll(juiceByteArray)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7929069e0f3c342455d3fa0cb2c16e78", "score": "0.49896967", "text": "func main(){\n\n\n/*5:*/\n\n\n//line rev.w:34\n\nid,err:=strconv.Atoi(os.Getenv(\"winid\"))\nif err!=nil{\nreturn\n}\n\n\n\n/*:5*/\n\n\n//line rev.w:21\n\n\n\n/*7:*/\n\n\n//line rev.w:45\n\nw,err:=goacme.Open(id)\nif err!=nil{\nreturn\n}\n\n\n\n/*:7*/\n\n\n//line rev.w:22\n\n\n\n/*9:*/\n\n\n//line rev.w:56\n\nif len(os.Args)> 1{\ns:=strings.Join(os.Args[1:],\" \")\n\n\n/*15:*/\n\n\n//line rev.w:112\n\n{\nes:=\"\"\nfor _,v:=range s{\nif strings.ContainsRune(\"\\\\/[].+?()*^$\",v){\nes+= \"\\\\\"\n}\nes+= string(v)\n}\nif w.WriteAddr(\"?%s?\",es)!=nil{\nreturn\n}\n}\n\n\n\n/*:15*/\n\n\n//line rev.w:59\n\n}else\n\n\n/*10:*/\n\n\n//line rev.w:66\n\n{\n\n\n/*11:*/\n\n\n//line rev.w:76\n\nif w.WriteCtl(\"addr=dot\")!=nil{\nreturn\n}\n\n\n\n/*:11*/\n\n\n//line rev.w:68\n\n\n\n/*12:*/\n\n\n//line rev.w:82\n\nb,e,err:=w.ReadAddr()\nif err!=nil{\nreturn\n}\n\n\n\n/*:12*/\n\n\n//line rev.w:69\n\n\n\n/*13:*/\n\n\n//line rev.w:89\n\ns:=\"\"\n{\nd,err:=w.File(\"xdata\")\nif err!=nil{\nreturn\n}\n\nbuf:=make([]byte,e-b+1)\n\nfor n,_:=d.Read(buf);n> 0;n,_= d.Read(buf){\ns+= string(buf[:n])\n}\n}\n\n\n\n\n/*:13*/\n\n\n//line rev.w:70\n\n\n\n/*14:*/\n\n\n//line rev.w:106\n\nif w.WriteAddr(\"#%d,#%d\",b,e-len(s))!=nil{\nreturn\n}\n\n\n\n/*:14*/\n\n\n//line rev.w:71\n\n\n\n/*15:*/\n\n\n//line rev.w:112\n\n{\nes:=\"\"\nfor _,v:=range s{\nif strings.ContainsRune(\"\\\\/[].+?()*^$\",v){\nes+= \"\\\\\"\n}\nes+= string(v)\n}\nif w.WriteAddr(\"?%s?\",es)!=nil{\nreturn\n}\n}\n\n\n\n/*:15*/\n\n\n//line rev.w:72\n\n}\n\n\n\n/*:10*/\n\n\n//line rev.w:61\n\n\n\n/*16:*/\n\n\n//line rev.w:127\n\nif w.WriteCtl(\"dot=addr\\nshow\")!=nil{\nreturn\n}\n\n\n\n/*:16*/\n\n\n//line rev.w:62\n\n\n\n\n\n/*:9*/\n\n\n//line rev.w:23\n\n\n\n/*17:*/\n\n\n//line rev.w:141\n\n{\nfor ev,err:=w.ReadEvent();err==nil;ev,err= w.ReadEvent(){\nif ev.Type==goacme.Insert||ev.Type==goacme.Delete{\nreturn\n}\nswitch ev.Type&^goacme.Tag{\ncase goacme.Execute:\nswitch ev.Text{\ncase\"Look\":\nw.UnreadEvent(ev)\nreturn\ncase\"Rev\":\nif len(ev.Arg)> 0{\nb:=ev.Begin\ne:=ev.End\ns:=ev.Arg\n\n\n/*18:*/\n\n\n//line rev.w:181\n\n\n\n/*14:*/\n\n\n//line rev.w:106\n\nif w.WriteAddr(\"#%d,#%d\",b,e-len(s))!=nil{\nreturn\n}\n\n\n\n/*:14*/\n\n\n//line rev.w:182\n\n\n\n/*15:*/\n\n\n//line rev.w:112\n\n{\nes:=\"\"\nfor _,v:=range s{\nif strings.ContainsRune(\"\\\\/[].+?()*^$\",v){\nes+= \"\\\\\"\n}\nes+= string(v)\n}\nif w.WriteAddr(\"?%s?\",es)!=nil{\nreturn\n}\n}\n\n\n\n/*:15*/\n\n\n//line rev.w:183\n\n\n\n/*:18*/\n\n\n//line rev.w:158\n\n}else\n\n\n/*10:*/\n\n\n//line rev.w:66\n\n{\n\n\n/*11:*/\n\n\n//line rev.w:76\n\nif w.WriteCtl(\"addr=dot\")!=nil{\nreturn\n}\n\n\n\n/*:11*/\n\n\n//line rev.w:68\n\n\n\n/*12:*/\n\n\n//line rev.w:82\n\nb,e,err:=w.ReadAddr()\nif err!=nil{\nreturn\n}\n\n\n\n/*:12*/\n\n\n//line rev.w:69\n\n\n\n/*13:*/\n\n\n//line rev.w:89\n\ns:=\"\"\n{\nd,err:=w.File(\"xdata\")\nif err!=nil{\nreturn\n}\n\nbuf:=make([]byte,e-b+1)\n\nfor n,_:=d.Read(buf);n> 0;n,_= d.Read(buf){\ns+= string(buf[:n])\n}\n}\n\n\n\n\n/*:13*/\n\n\n//line rev.w:70\n\n\n\n/*14:*/\n\n\n//line rev.w:106\n\nif w.WriteAddr(\"#%d,#%d\",b,e-len(s))!=nil{\nreturn\n}\n\n\n\n/*:14*/\n\n\n//line rev.w:71\n\n\n\n/*15:*/\n\n\n//line rev.w:112\n\n{\nes:=\"\"\nfor _,v:=range s{\nif strings.ContainsRune(\"\\\\/[].+?()*^$\",v){\nes+= \"\\\\\"\n}\nes+= string(v)\n}\nif w.WriteAddr(\"?%s?\",es)!=nil{\nreturn\n}\n}\n\n\n\n/*:15*/\n\n\n//line rev.w:72\n\n}\n\n\n\n/*:10*/\n\n\n//line rev.w:160\n\n\n\n/*16:*/\n\n\n//line rev.w:127\n\nif w.WriteCtl(\"dot=addr\\nshow\")!=nil{\nreturn\n}\n\n\n\n/*:16*/\n\n\n//line rev.w:161\n\ncontinue\n}\nw.UnreadEvent(ev)\ncase goacme.Look:\nb:=ev.Begin\ne:=ev.End\ns:=ev.Text\nif len(ev.Arg)> 0{\ns+= \" \"+ev.Arg\n}\n\n\n/*18:*/\n\n\n//line rev.w:181\n\n\n\n/*14:*/\n\n\n//line rev.w:106\n\nif w.WriteAddr(\"#%d,#%d\",b,e-len(s))!=nil{\nreturn\n}\n\n\n\n/*:14*/\n\n\n//line rev.w:182\n\n\n\n/*15:*/\n\n\n//line rev.w:112\n\n{\nes:=\"\"\nfor _,v:=range s{\nif strings.ContainsRune(\"\\\\/[].+?()*^$\",v){\nes+= \"\\\\\"\n}\nes+= string(v)\n}\nif w.WriteAddr(\"?%s?\",es)!=nil{\nreturn\n}\n}\n\n\n\n/*:15*/\n\n\n//line rev.w:183\n\n\n\n/*:18*/\n\n\n//line rev.w:172\n\n\n\n/*16:*/\n\n\n//line rev.w:127\n\nif w.WriteCtl(\"dot=addr\\nshow\")!=nil{\nreturn\n}\n\n\n\n/*:16*/\n\n\n//line rev.w:173\n\ncontinue\n}\n}\n}\n\n\n\n\n/*:17*/\n\n\n//line rev.w:24\n\n}", "title": "" }, { "docid": "6e8d9bd71af6a28187d6022cda2bbd72", "score": "0.4989241", "text": "func main() {\n\tcontent, err := ioutil.ReadFile(\"./input.dos\")\n\tcheck(err)\n\tparser := Parser{}\n\terr = parser.GenerateAST(string(content))\n\tcheck(err)\n\tcompiler := Compiler{}\n\terr = compiler.Start(parser.AST)\n\tcheck(err)\n\tfmt.Println(\"done\")\n}", "title": "" }, { "docid": "3820eb72e738bdd9a6b1ced7bf77f071", "score": "0.49842536", "text": "func readInput() []byte {\n\tbytes, err := ioutil.ReadAll(os.Stdin)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfor i := range bytes {\n\t\tbytes[i] = normalizeLetter(bytes[i])\n\t}\n\ti := len(bytes) - 1\n\tfor ; i >= 0 && bytes[i] == 0; i-- {\n\t}\n\treturn bytes[:i+1]\n}", "title": "" }, { "docid": "ff47b5e4a5e21d2c01c7d6f3a8dd6f23", "score": "0.49825564", "text": "func checkCmd() {\n\tif ifile == \"\" {\n\t\tlog.Println(\"[ERROR] The input file path is required: -i path/to/file\")\n\t\tdefer os.Exit(1)\n\t}\n\n\tif ofile == \"\" {\n\t\tlog.Println(\"[ERROR] The output file path is required: -o path/to/file\")\n\t\tdefer os.Exit(1)\n\t}\n\n\tif methodId == \"\" {\n\t\tlog.Println(\"[ERROR] The method has to be specified: -m METHOD\")\n\t\tdefer os.Exit(1)\n\t}\n\n\tif flag.NArg() > 0 {\n\t\tlog.Println(\"[ERROR] Unknown arguments: \" + strings.Join(flag.Args(), \" \"))\n\t\tdefer os.Exit(1)\n\t}\n}", "title": "" }, { "docid": "b27f858627ae47fcece0e3a87192df27", "score": "0.497485", "text": "func main() {\n\tdata, err := os.ReadFile(os.Args[1])\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tcontent := append(\n\t\t[]byte(\"// AUTOGENERATED. DO NOT EDIT.\\npackage syntax\\n\\nimport (\\n\\t\\\"strings\\\"\\n\\n\\t\\\"github.com/arr-ai/wbnf/wbnf\\\"\\n)\\n\\nfunc unfakeBackquote(s string) string {\\n\\treturn strings.ReplaceAll(s, \\\"‵\\\", \\\"`\\\")\\n}\\n\\nvar arraiParsers = wbnf.MustCompile(unfakeBackquote(`\\n\"), //nolint:lll\n\t\tdata...)\n\tcontent = append(content, []byte(\"\\n`), nil)\\n\")...)\n\terr = os.WriteFile(os.Args[2], content, 0600)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "106f0e3150254c34e2ef45059efae8ef", "score": "0.49728495", "text": "func readInput() string {\n\tbuf := new(bytes.Buffer)\n\tbuf.ReadFrom(os.Stdin)\n\treturn buf.String()\n}", "title": "" }, { "docid": "bf8f0597ebba2851bac6f0bae90c47ea", "score": "0.49717295", "text": "func validateSystem() error {\n\ttestBin, err := os.Executable()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't get current binary: %w\", err)\n\t}\n\t// Pass all flags into the child process, so that it will see the same flag set.\n\toutput, err := exec.Command(testBin, append([]string{\"--system-validate-mode\"}, os.Args[1:]...)...).CombinedOutput()\n\t// The output of system validation should have been formatted, directly print here.\n\tfmt.Print(string(output))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"system validation failed: %w\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4fda48ae61856ffeb24fe9a0b242f74b", "score": "0.49640784", "text": "func main() {\n\tflag.Parse()\n\tvar err error\n\tvar f *os.File\n\tswitch flag.NArg() {\n\tcase 0:\n\t\tf = os.Stdin\n\tcase 1:\n\t\tf, err = os.Open(flag.Arg(0))\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"error opening %s: %s\\n\", flag.Arg(0), err.Error())\n\t\t\tos.Exit(1)\n\t\t}\n\tdefault:\n\t\tfmt.Printf(\"input must be from stdin or file\\n\")\n\t\tos.Exit(1)\n\t}\n\n\t// Create a new Scanner for the file.\n\tscanner := bufio.NewScanner(f)\n\t// Loop over all lines in the file and print them.\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\t// line = util.NonASCIIToASCII(line)\n\t\tb := []byte(line)\n\t\tlenb := len(b)\n\t\tlenbm1 := lenb - 1\n\t\tc := make([]byte, 0)\n\t\tfor i := 0; i < len(b); i++ {\n\t\t\tif b[i] == 0xc3 && i < lenbm1 {\n\t\t\t\tc = append(c, 'a')\n\t\t\t\ti++\n\t\t\t} else {\n\t\t\t\tc = append(c, b[i])\n\t\t\t}\n\t\t}\n\t\tfmt.Println(string(c))\n\t}\n}", "title": "" }, { "docid": "90c75df333c8f47aa11994b5da5ed136", "score": "0.49618036", "text": "func osArgs() {\n\tif len(os.Args) != 2 {\n\t\tos.Exit(1)\n\t}\n\n\tfmt.Println(\"It's over\", os.Args[1])\n}", "title": "" }, { "docid": "8ca01f335dc3bbd54e52e0bd709607cb", "score": "0.4961081", "text": "func parseInput(day int) []string {\n\tfile, err := os.Open(\"adventofcode/inputs/\" + strconv.Itoa(day) + \".txt\")\n\tif err != nil {\n\t\tlog.Fatalf(\"Could not open file: %s\", err)\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\tlog.Fatalf(\"Invalid input: %s\", err)\n\t}\n\n\treturn lines\n}", "title": "" }, { "docid": "998613d359d5bbfa219dfa56a093ce76", "score": "0.49594823", "text": "func ParseFlags(flags []string, privilly string) map[string]string {\n\n cmap := make(map[string]string)\n cmd := \"Error\"; strexp := \"OK.\"\n\n if CmdArrayHas(flags[0]) {\n cmd = flags[0]\n } else {\n cmd = \"Error\"\n strexp = \"No such command: \" + flags[0]\n } // endif cmd.\n\n if len(flags) > 1 {\n cmap = methods.GetConfigs(flags[1])\n } else {\n cmd = \"Error\"\n strexp = \"Usage: ...\"\n } // endif flags.\n\n switch(cmd) {\n\n case \"Quit\":\n if !AuthorizedBy(cmap[\"pubkey\"], privilly) {\n cmd = \"Error\"\n strexp = \"Unauthorized Quit instance.\"\n } // endif authorized.\n\n case \"Utxos\":\n strexp = \"Update Balances in Listener.\"\n\n\n case \"Balance\":\n if methods.NoFile(flags[1]) || !strings.HasSuffix(flags[1], \".conf\") {\n cmd = \"Error\"\n strexp = \"Bad filename: \" + flags[1]\n } // endif NoFile.\n\n case \"Transactions\":\n if methods.NoFile(flags[1]) || !strings.HasSuffix(flags[1], \".conf\") {\n cmd = \"Error\"\n strexp = \"Bad filename: \" + flags[1]\n } // endif NoFile.\n\n case \"Multitest\":\n if methods.NoFile(flags[1]) {\n cmd = \"Error\"\n strexp = \"Bad filename: \" + flags[1]\n } else {\n cmap[\"scriptfile\"] = flags[1]\n } // endif NoFile.\n\n case \"Autotest\":\n if methods.NoFile(flags[1]) {\n cmd = \"Error\"\n strexp = \"Bad Directory Name: \" + flags[1]\n } else {\n cmap[\"allpay\"] = flags[1]\n cmap[\"throttle\"] = flags[2]\n } // endif NoFile.\n\n case \"PayCoins\":\n cmap[\"amount\"] = flags[2]\n if methods.NoFile(flags[3]) {\n cmd = \"Error\"\n strexp = \"Bad pubkey filename: \" + flags[3]\n } else {\n cmap[\"payee\"] = flags[3]\n cmap[\"payhash\"] = himitsu.HashPublicKey(cmap[\"payee\"])\n } // endif NoFile.\n\n case \"CreateCoins\":\n if !AuthorizedBy(cmap[\"pubkey\"], privilly) {\n cmd = \"Error\"\n strexp = \"Unauthorized Coin Creation.\"\n } // endif unauthorized.\n\n if methods.NoFile(flags[1]) {\n cmd = \"Error\"\n strexp = \"Bad filename: \" + flags[1]\n } // endif NoFile.\n\n // Coin specs are already in cmap[\"coin\"] and cmap[\"denom\"] so we're good.\n\n default:\n strexp = \"Unknown command.\"\n cmd = \"Error\"\n\n } // end switch.\n\n cmap[\"cmd\"] = cmd\n cmap[\"strexp\"] = strexp\n return cmap\n\n}", "title": "" }, { "docid": "2cc29e53739e6cc368f8599226367b8c", "score": "0.49528718", "text": "func getInput(prefix string) string {\n\tfmt.Print(prefix)\n\ttext, _ := reader.ReadString('\\n')\n\t//Deleting the end of the line\n\ttext = strings.Replace(text, \"\\r\\n\", \"\", -1)\n\ttext = strings.Replace(text, \"\\n\", \"\", -1)\n\ttext = strings.Replace(text, \"\\r\", \"\", -1)\n\n\treturn text\n}", "title": "" }, { "docid": "98cfc8541a05b54341f89a6e444edb88", "score": "0.49521977", "text": "func readFile()(readIn string){\n\t//Set up the reader and find out user input--------\n\treader := bufio.NewReader(os.Stdin)\n\tfmt.Print(\"What File would you like to import: \")\n\tuserFName, _ := reader.ReadString('\\n') //Read the input for which file to read\n\tuserFName = strings.TrimSpace(userFName) \t\n\n\t//Actually read in the file------------------------\n\tdata, err := ioutil.ReadFile(userFName) //Read the file\n\t\n\t//Check for errors and return----------------------\n\tmanualError(err) //Check if there are errors!\n\treadIn = string(data)\n\t\n\treturn readIn\n\t\n}", "title": "" }, { "docid": "565d68d11ef6718d4a33dd1acf2363c3", "score": "0.49515653", "text": "func main() {\n\n\tvar file *os.File\n\tvar err error\n\n\tif len(os.Args) < 2 {\n\t\tfile = os.Stdin\n\t} else {\n\t\tfile, err = os.Open(os.Args[1])\n\t}\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\n\tr := bufio.NewReader(file)\n\n\t// read first line\n\tl, _, err := r.ReadLine()\n\n\tfor err == nil {\n\n\t\t// parse\n\t\tm, errParse := csgolog.Parse(string(l))\n\n\t\tif errParse != nil {\n\t\t\t// print parse errors to stderr\n\t\t\tfmt.Fprintf(os.Stderr, \"ERROR: %s\", csgolog.ToJSON(m))\n\t\t} else {\n\t\t\t// print to stdout\n\t\t\tfmt.Fprintf(os.Stdout, \"%s\", csgolog.ToJSON(m))\n\t\t}\n\n\t\t// next line\n\t\tl, _, err = r.ReadLine()\n\t}\n}", "title": "" }, { "docid": "143982908933f6fd6dd8df80c466274b", "score": "0.49442285", "text": "func mustReadStdin() string {\n\treader := bufio.NewReader(os.Stdin)\n\trawSd, err := reader.ReadString('\\n')\n\tif err != io.EOF {\n\t\tcheck(err)\n\t}\n\n\tfmt.Println(\"\")\n\n\tsd, err := base64.StdEncoding.DecodeString(rawSd)\n\tcheck(err)\n\n\treturn string(sd)\n}", "title": "" }, { "docid": "54a0e5c3e3c454d97cb6802cdca663c0", "score": "0.49436748", "text": "func main() {\n\tif len(os.Args) > 1 && os.Args[1] != \"\" {\n\t\tfileProcessor := helpers.FileProcessor{os.Args[1]}\n\t\tfileProcessor.Process()\n\t}\n\tcommandLineHelper := helpers.CommandLineHelper{}\n\tcommandLineHelper.Process()\n}", "title": "" }, { "docid": "1da81df1d18e25b1fe98a67e4e6c8410", "score": "0.494259", "text": "func readPipe() (string, error) {\n\tstats, _ := os.Stdin.Stat()\n\tif stats != nil && (stats.Mode()&os.ModeCharDevice) == 0 {\n\t\tbytes, err := ioutil.ReadAll(os.Stdin)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn string(bytes), nil\n\t}\n\treturn \"\", nil\n\n}", "title": "" }, { "docid": "3b523ab04dd3c563a6b66a2562f6ce7d", "score": "0.49346206", "text": "func handleSingleInput(command string, testing int) string {\n\tswitch command {\n\tcase \"exit\":\n\t\treturn exit(testing)\n\tcase \"help\":\n\t\treturn help()\n\tdefault:\n\t\treturn \"INVALID COMMAND, TYPE HELP\"\n\t}\n}", "title": "" }, { "docid": "26e6eecb4176ba6060cfd779bc7ec31a", "score": "0.49260074", "text": "func processLine(input string) (string, int, string) {\n\tres := reg.FindAllStringSubmatch(input, -1)\n\tif len(res) == 0 {\n\t\treturn \"\", -1, \"\"\n\t}\n\tif len(res[0]) == 0 {\n\t\treturn \"\", -1, \"\"\n\t}\n\tline := res[0][1:]\n\n\tif line[2] == \"\" {\n\t\tline = line[:2]\n\t}\n\tif line[1] == \"\" {\n\t\tline = line[:1]\n\t}\n\tif line[0] == \"\" && len(line) == 1 {\n\t\treturn \"\", EMPTY, \"\"\n\t}\n\n\topc := -1\n\tlab := \"\"\n\tusedlab := \"\"\n\n\topc = opcode(line[0])\n\n\tif opc == -1 {\n\t\tif len(line) == 1 {\n\t\t\treturn \"\", -1, \"\"\n\t\t}\n\t\topc = opcode(line[1])\n\t\tlab = line[0]\n\t\tif opc == -1 {\n\t\t\treturn \"\", -1, \"\"\n\t\t}\n\t\tif len(line) > 2 {\n\t\t\tusedlab = line[2]\n\t\t}\n\t} else if len(line) > 1 {\n\t\tusedlab = line[1]\n\t}\n\n\treturn lab, opc, usedlab\n}", "title": "" }, { "docid": "4f4f5b12ef314915297afc3420efc596", "score": "0.4923551", "text": "func main() {\n\tvar sa selpg_args\n\n\tprogname = os.Args[0]\n\n\tflag.IntVar(&sa.start_page, \"s\", -1, \"-sstart_page\")\n\tflag.IntVar(&sa.end_page, \"e\", -1, \"-eend_page\")\n\tflag.IntVar(&sa.page_len, \"l\", 72, \"-llines_per_page\")\n\tflag.StringVar(&sa.print_dest, \"d\", \"\", \"-ddest\")\n\n\t/*define -f and check it whether exist\n\t-f only useful for bool, default false*/\n\texist_f := flag.Bool(\"f\", false, \"-f=true\")\n\n\t/*analysis the command-line parameters and save in flag*/\n\tflag.Parse()\n\n\t/*if f = true, read file use '\\f' delimited*/\n\tif *exist_f {\n\t\tsa.page_type = \"f\"\n\t\tsa.page_len = -1\n\t} else {\n\t\tsa.page_type = \"l\"\n\t}\n\n\t/*the filename is the only Not Flag parameters*/\n\tif flag.NArg() == 1 {\n\t\tsa.in_filename = flag.Arg(0)\n\t} else {\n\t\tsa.in_filename = \"\"\n\t}\n\n\t/*check the parameters if meet the requirement*/\n\tcheckArgs(sa, flag.NArg())\n\n\t/*exec the command*/\n\tprocess_input(sa)\n}", "title": "" }, { "docid": "3a85ade76c8095236c30218348ea8d79", "score": "0.4920712", "text": "func main() {\n\tinFile, err := os.Open(inputFile)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer inFile.Close()\n\tscanner := bufio.NewScanner(inFile)\n\n\tw := NewWriter(outputFile)\n\tw.prLn(\"// Code generated by internal/gen/main.go; DO NOT EDIT.\")\n\tw.prLn(\"package main\")\n\tw.prLn(\"\")\n\tw.prLn(\"\")\n\tw.prLn(\"const (\")\n\tw.prLn(\" usageMsg = `\")\n\n\t// Skip the first two lines.\n\tscanner.Scan()\n\tscanner.Scan()\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tline = strings.Replace(line, \"`\", \"'\", -1)\n\t\tline = strings.Replace(line, \"\\\\[\", \"[\", -1)\n\t\tline = strings.Replace(line, \"\\\\]\", \"]\", -1)\n\t\tw.prLn(line)\n\t}\n\tw.prLn(\"`\")\n\tw.prLn(\")\")\n\tw.close()\n\n\tif err := scanner.Err(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "5c5be483837695c60af4bdb6350945b7", "score": "0.49141094", "text": "func lineFromConsole() (string, error) {\n\tbytes, _, err := bufio.NewReader(os.Stdin).ReadLine()\n\treturn string(bytes), err\n}", "title": "" }, { "docid": "6c87ec519335315d63171a42bd392c76", "score": "0.49090847", "text": "func isInputFromPipe() bool {\n\n\tfileInfo, _ := os.Stdin.Stat()\n\n\treturn fileInfo.Mode()&os.ModeCharDevice == 0\n}", "title": "" } ]
f2d3df50d28b8593b2201c33d389bf77
globFileOpen expands the file path, connects multiple files and returns one io.PipeReader.
[ { "docid": "904a82d350ff9d84e844bf15ef152150", "score": "0.817664", "text": "func globFileOpen(globName string) (*io.PipeReader, error) {\n\tglobName = expandTilde(trimQuote(globName))\n\tfileNames, err := filepath.Glob(globName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(fileNames) == 0 {\n\t\treturn nil, fmt.Errorf(\"%w: %s\", ErrNoMatchFound, fileNames)\n\t}\n\tpipeReader, pipeWriter := io.Pipe()\n\tgo func() {\n\t\tdefer func() {\n\t\t\tif err := pipeWriter.Close(); err != nil {\n\t\t\t\tlog.Printf(\"pipe close:%s\", err)\n\t\t\t}\n\t\t}()\n\t\tfor _, fileName := range fileNames {\n\t\t\tif err := copyFileOpen(pipeWriter, fileName); err != nil {\n\t\t\t\tlog.Printf(\"ERROR: %s:%s\", fileName, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t}()\n\treturn pipeReader, nil\n}", "title": "" } ]
[ { "docid": "ff56457c88517ba53b90174e74e00de2", "score": "0.63116086", "text": "func OpenGlob(name string) ([]io.ReadCloser, error) {\n\treaders := make([]io.ReadCloser, 0)\n\tfor file := range staticFiles {\n\t\tmatches, err := path.Match(name, file)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tif matches {\n\t\t\treader, err := Open(file)\n\t\t\tif err == nil && reader != nil {\n\t\t\t\treaders = append(readers, reader)\n\t\t\t}\n\t\t}\n\t}\n\tif len(readers) == 0 {\n\t\treturn nil, fmt.Errorf(\"No assets found that match.\")\n\t}\n\treturn readers, nil\n}", "title": "" }, { "docid": "ccace2b899d42b5c8417471c2f3980ec", "score": "0.6025877", "text": "func OpenFileMultiReader(path string) (*MultiReader, []io.Closer, error) {\n\tvar readers []io.Reader\n\tvar closers []io.Closer\n\tif err := func() error {\n\t\t// Open original snapshot file.\n\t\tf, err := os.Open(path)\n\t\tif os.IsNotExist(err) {\n\t\t\treturn err\n\t\t} else if err != nil {\n\t\t\treturn fmt.Errorf(\"open snapshot: %s\", err)\n\t\t}\n\t\treaders = append(readers, f)\n\t\tclosers = append(closers, f)\n\n\t\t// Open all incremental snapshots.\n\t\tfor i := 0; ; i++ {\n\t\t\tfilename := path + fmt.Sprintf(\".%d\", i)\n\t\t\tf, err := os.Open(filename)\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\tbreak\n\t\t\t} else if err != nil {\n\t\t\t\treturn fmt.Errorf(\"open incremental snapshot: file=%s, err=%s\", filename, err)\n\t\t\t}\n\t\t\treaders = append(readers, f)\n\t\t\tclosers = append(closers, f)\n\t\t}\n\n\t\treturn nil\n\t}(); err != nil {\n\t\tcloseAll(closers)\n\t\treturn nil, nil, err\n\t}\n\n\treturn NewMultiReader(readers...), nil, nil\n}", "title": "" }, { "docid": "ab38c07ab48254a7226c3baaa184cbf2", "score": "0.59029883", "text": "func Ropen(f string) (*Reader, error) {\n\tvar err error\n\tvar rdr io.Reader\n\tif f == \"\" {\n\t\treturn nil, errors.New(\"sent empty file-name to xopen.Ropen\")\n\t}\n\tif f == \"-\" {\n\t\tif !IsStdin() {\n\t\t\treturn nil, errors.New(\"warning: stdin not detected\")\n\t\t}\n\t\tb := Buf(os.Stdin)\n\t\treturn b, nil\n\t} else if f[0] == '|' {\n\t\t// TODO: use csv to handle quoted file names.\n\t\tcmdStrs := strings.Split(f[1:], \" \")\n\t\tvar cmd *exec.Cmd\n\t\tif len(cmdStrs) == 2 {\n\t\t\tcmd = exec.Command(cmdStrs[0], cmdStrs[1:]...)\n\t\t} else {\n\t\t\tcmd = exec.Command(cmdStrs[0])\n\t\t}\n\t\trdr, err = cmd.StdoutPipe()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = cmd.Start()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\trdr, err = XReader(f)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tb := Buf(rdr)\n\treturn b, nil\n}", "title": "" }, { "docid": "d10bb287aace0af6bdc5c6911268096b", "score": "0.5874184", "text": "func importFileOpen(tableName string) (io.ReadCloser, error) {\n\tr := regexp.MustCompile(`\\*|\\?|\\[`)\n\tif r.MatchString(tableName) {\n\t\treturn globFileOpen(tableName)\n\t}\n\treturn singleFileOpen(tableName)\n}", "title": "" }, { "docid": "80446251bfe7350f68f4918ab787df29", "score": "0.56429356", "text": "func singleFileOpen(fileName string) (io.ReadCloser, error) {\n\tif len(fileName) == 0 || fileName == \"-\" || strings.ToLower(fileName) == \"stdin\" {\n\t\treturn uncompressedReader(bufio.NewReader(os.Stdin)), nil\n\t}\n\tfileName = expandTilde(trimQuote(fileName))\n\tfile, err := os.Open(fileName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn uncompressedReader(file), nil\n}", "title": "" }, { "docid": "8bcc73acc1466feb7b0fdc44ccf4df0c", "score": "0.52534026", "text": "func Open(file string) (*Reader, error) {\n\tf, err := OpenRaw(file)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfn := rsuffixes[filepath.Ext(file)]\n\tif fn == nil {\n\t\treturn f, nil\n\t}\n\tff, err := fn(f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Reader{*bufio.NewReader(ff), f}, nil\n}", "title": "" }, { "docid": "a5a0ba0ec04c012b6131a407c227fbc0", "score": "0.5152316", "text": "func Compile(pattern string, options *Options) (Glob, error) {\n\tpattern = strings.TrimSpace(pattern)\n\treader := strings.NewReader(pattern)\n\n\tif options == nil {\n\t\toptions = DefaultOptions\n\t} else {\n\t\t// Check that the separator is not an expander\n\t\tfor _, expander := range expanders {\n\t\t\tif options.Separator == expander {\n\t\t\t\treturn nil, fmt.Errorf(\"'%s' is not allowed as a separator\", string(options.Separator))\n\t\t\t}\n\t\t}\n\t}\n\n\tstate := &parserState{\n\t\toptions: options,\n\t\tescapedSeparator: escapeRegexComponent(string(options.Separator)),\n\t\tprocessedTokens: make([]processedToken, 0, 10),\n\t}\n\tglob := &globImpl{\n\t\tRegexp: nil,\n\t\tglobPattern: pattern,\n\t\tnegated: false,\n\t\tparserState: state,\n\t}\n\n\tregexBuf := new(bytes.Buffer)\n\tif options.MatchAtStart {\n\t\tregexBuf.WriteRune('^')\n\t}\n\n\tvar err error\n\t// Transform into a regular expression pattern\n\t// 1. Parse negation prefixes\n\terr = parseNegation(reader, glob)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// 2. Tokenise and convert!\n\ttokeniser := newGlobTokeniser(reader, options)\n\tlastProcessedToken := &processedToken{}\n\tfor tokeniser.Scan() {\n\t\tif err = tokeniser.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ttoken, tokenType := tokeniser.Token()\n\t\tt := processedToken{\n\t\t\tcontents: nil,\n\t\t\ttokenType: tokenType,\n\t\t}\n\n\t\t// Special cases\n\t\tif tokenType == tcGlobStar && tokeniser.Peek() {\n\t\t\t// If this is a globstar and the next token is a separator, consume it (the globstar pattern itself includes\n\t\t\t// a separator)\n\t\t\tif err = tokeniser.PeekErr(); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\t_, peekedType := tokeniser.PeekToken()\n\t\t\tif peekedType == tcSeparator {\n\t\t\t\ttokeniser.Scan()\n\t\t\t}\n\t\t}\n\t\tif tokenType == tcGlobStar && lastProcessedToken.tokenType == tcGlobStar {\n\t\t\t// If the last token was a globstar and this is too, remove the last. We don't remove this globstar because\n\t\t\t// it may now be the last in the pattern, which is special\n\t\t\tlastProcessedToken = popLastToken(state)\n\t\t}\n\t\tif tokenType == tcGlobStar && lastProcessedToken.tokenType == tcSeparator && !tokeniser.Peek() {\n\t\t\t// If this is the last token, and it's a globstar, remove a preceeding separator\n\t\t\tlastProcessedToken = popLastToken(state)\n\t\t}\n\n\t\tt.contents, err = processToken(token, tokenType, glob, tokeniser)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tlastProcessedToken = &t\n\t\tstate.processedTokens = append(state.processedTokens, t)\n\t}\n\n\tfor _, t := range state.processedTokens {\n\t\tt.contents.WriteTo(regexBuf)\n\t}\n\n\tif options.MatchAtEnd {\n\t\tregexBuf.WriteRune('$')\n\t}\n\n\tregexString := regexBuf.String()\n\tLogger.Tracef(\"[ohmyglob:Glob] Compiled \\\"%s\\\" to regex `%s` (negated: %v)\", pattern, regexString, glob.negated)\n\tre, err := regexp.Compile(regexString)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tglob.parserState = nil\n\tglob.Regexp = re\n\n\treturn glob, nil\n}", "title": "" }, { "docid": "97c25b425162b0bbe7bc9bcf794bc23a", "score": "0.51450837", "text": "func Open(name string) (io.ReadCloser, error) {\n\tf, err := os.Open(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor ext, prog := range Exts {\n\t\tif strings.HasSuffix(name, \".\"+ext) {\n\t\t\tr, err := prog(f)\n\t\t\tif err != nil {\n\t\t\t\tf.Close()\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn r, nil\n\t\t}\n\t}\n\treturn f, nil\n}", "title": "" }, { "docid": "c21cdab9b9b82dca56341a2953b00bfb", "score": "0.5131687", "text": "func (p *Placer) OpenFile(path fs.RelPath, flag int, perms fs.Perms) (fs.File, error) {\n\tf, d, err := p.root.Get(strings.Split(path.String(), Separator), true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif d != nil {\n\t\treturn nil, os.ErrExist\n\t}\n\treturn &BillyFile{f, 0}, nil\n}", "title": "" }, { "docid": "369a2be4224533facb099e8158e8f9b1", "score": "0.51068306", "text": "func (f Files) Glob(pattern string) (matches []string, err error) {\n\treturn doublestar.Glob(pattern)\n}", "title": "" }, { "docid": "c7b59d6e9f7ca50a3666a68c110e63c4", "score": "0.5058208", "text": "func (driver *MainDriver) OpenFile(cc server.ClientContext, path string, flag int) (server.FileStream, error) {\n\tif (flag & os.O_RDONLY) != 0 {\n\t\tobj, err := driver.client.GetObject(driver.BaseDir, path, minio.GetObjectOptions{})\n\t\treturn nopWriter{obj}, err\n\t}\n\treader, writer := io.Pipe()\n\tgo func() {\n\t\tif _, err := driver.client.PutObject(driver.BaseDir, path, reader, -1, minio.PutObjectOptions{}); err != nil {\n\t\t\treader.CloseWithError(err)\n\t\t\treturn\n\t\t}\n\t\treader.Close()\n\t}()\n\treturn nopReadSeeker{writer}, nil\n}", "title": "" }, { "docid": "887a6d89adbb7914213386bcfd78650d", "score": "0.50324565", "text": "func Pipe() (r *File, w *File, err error)", "title": "" }, { "docid": "f56a040462c399cb48a5607885c9979f", "score": "0.50316846", "text": "func OpenFile(path string) []string {\n\tfile, err := os.Open(path)\n\tPanicOnError(err)\n\n\tscanner := bufio.NewScanner(file)\n\tfileContent := make([]string, 0)\n\tfor scanner.Scan() {\n\t\tfileContent = append(fileContent, scanner.Text())\n\t}\n\n\tLogOnError(scanner.Err())\n\tLogOnError(file.Close())\n\n\treturn fileContent\n}", "title": "" }, { "docid": "4f1119c815d7efab02d79e5d59c98772", "score": "0.5017048", "text": "func (fp *filePipeline) Open() (f *fileutil.LockedFile, err error) {\n\tselect {\n\tcase f = <-fp.filec:\n\tcase err = <-fp.errc:\n\t}\n\treturn\n}", "title": "" }, { "docid": "33f90940b40d7a3f4ca99485ff7c9005", "score": "0.49802285", "text": "func (fs *FS) Open(p string) (io.ReadCloser, error) {\n\treturn fs.paths.Open(cleanPath(p))\n}", "title": "" }, { "docid": "0cb7947a714f0f7f38185b9042d50f3d", "score": "0.49700582", "text": "func c___go_open(path *byte, mode _C_int, perm Mode_t) _C_int", "title": "" }, { "docid": "d16d22c2cfccde4699fbf53134044929", "score": "0.49532378", "text": "func (c *FakeClient) Open(ctx context.Context, gsURL string) (io.ReadCloser, error) {\n\tdata, ok := c.files[gsURL]\n\tif !ok {\n\t\treturn nil, os.ErrNotExist\n\t}\n\treturn ioutil.NopCloser(bytes.NewReader(data)), nil\n}", "title": "" }, { "docid": "211fabf60b48b5e733fa4747510c5c77", "score": "0.4924169", "text": "func (cs *copyState) glob(pattern string) (files []cpFile) {\n\tif pattern == \"\" {\n\t\tcs.state.Exitf(\"empty path name\")\n\t}\n\n\t// Path on local machine?\n\tif isLocal(pattern) {\n\t\tfor _, path := range cs.state.GlobLocal(subcmd.Tilde(pattern)) {\n\t\t\tfiles = append(files, cpFile{\n\t\t\t\tpath: path,\n\t\t\t\tisUpspin: false,\n\t\t\t})\n\t\t}\n\t\treturn files\n\n\t}\n\n\t// Extra check to catch use of relative path on local machine.\n\tif !strings.Contains(pattern, \"@\") {\n\t\tcs.state.Exitf(\"local pattern not qualified path: %s\", pattern)\n\t}\n\n\t// It must be an Upspin path.\n\tparsed, err := path.Parse(cs.state.AtSign(pattern))\n\tif err != nil {\n\t\tcs.state.Exit(err)\n\t}\n\tfor _, path := range cs.state.GlobUpspinPath(parsed.String()) {\n\t\tfiles = append(files, cpFile{\n\t\t\tpath: string(path),\n\t\t\tisUpspin: true,\n\t\t})\n\t}\n\treturn files\n}", "title": "" }, { "docid": "ceab4dd7a2b1ac0867c095feb4fb4a5e", "score": "0.492322", "text": "func (g *goPackagesModuleGetter) Open(name string) (fs.File, error) {\n\tvar bestMatch *packages.Module\n\tfor _, m := range g.modules {\n\t\tif strings.HasPrefix(name+\"/\", m.Path+\"/\") {\n\t\t\tif bestMatch == nil || m.Path > bestMatch.Path {\n\t\t\t\tbestMatch = m\n\t\t\t}\n\t\t}\n\t}\n\tif bestMatch == nil {\n\t\treturn nil, fmt.Errorf(\"no module matching %s\", name)\n\t}\n\tsuffix := strings.TrimPrefix(name, bestMatch.Path)\n\tsuffix = strings.TrimPrefix(suffix, \"/\")\n\tfilename := filepath.Join(bestMatch.Dir, filepath.FromSlash(suffix))\n\treturn os.Open(filename)\n}", "title": "" }, { "docid": "2c0defddffcbcf1ab3744967d071fc0a", "score": "0.4906935", "text": "func Open(filename string) (*Reader, error) {\n\tfile, err := os.Open(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar reader *Reader\n\tif strings.HasSuffix(filename, \".gz\") {\n\t\treader, err = NewGzipReader(file)\n\t\tif err != nil {\n\t\t\tfile.Close()\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\treader = NewReader(file)\n\t}\n\treader.deferUntilClose(file.Close)\n\n\treturn reader, nil\n}", "title": "" }, { "docid": "93ac34f96d2dfb3c8db3d245d9fd280a", "score": "0.48891968", "text": "func RWArrFilesStr(globPat string, fnameOut string) {\n\tfout, foerr := os.OpenFile(fnameOut, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)\n\tif foerr != nil {\n\t\t\tlog.Fatalf(\"failed creating file %s: %s\", fnameOut, foerr)\n\t}\n\tdatawriter := bufio.NewWriter(fout)\n\tdefer fout.Close()\n\t\n\tfnames, _ := filepath.Glob(globPat)\n\tif fnames == nil { \n\t\tfmt.Println(\"L322 Found no files for globPat=\", globPat)\n\t}\n\tnumFile := len(fnames)\n\tfmt.Println(\"L132: initial fileList len=\", numFile,\" files=\", fnames)\n\tfiles := make([]*os.File, numFile)\n\tscanners := make([]*bufio.Scanner, numFile)\n\t//lines = make([]string, numFile)\n\t// Open our Array of Files \n\tfor ndx:= 0; ndx < numFile; ndx++ {\n\t\tfiPtr, err := os.Open(fnames[ndx])\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed opening file %s: %s\", fnames[ndx], err)\n\t\t\treturn\n\t\t}\n\t\tdefer fiPtr.Close()\n\t\tfiles[ndx] = fiPtr\n\t\tscanner := bufio.NewScanner(fiPtr)\n\t\tscanners[ndx] = scanner\n\t}\n\tfmt.Println(\"L144: All files open\")\n\tallClosed := false\n\tbytesRead := 0\n\tlinesRead := 0\n\tfor allClosed != true {\n\t\t//fmt.Println(\"Outer Loop linesRead=\", linesRead)\n\t\tallClosed = true\n\t\tfor ndx:= 0; ndx < numFile; ndx++ {\n\t\t\tif scanners[ndx] == nil {\n\t\t\t\t// this file has reached EOF so skip\n\t\t\t\tfmt.Println(\"L155: Skip file closed\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tallClosed = false\n\t\t\tmore := scanners[ndx].Scan()\n\t\t\tstr1 := scanners[ndx].Text()\n\t\t\t//fmt.Println(\"REad ndx=\", ndx, \" str1=\", str1)\n\t\t\tdatawriter.WriteString(str1)\n\t\t\tblen := len(str1)\n\t\t\tbytesRead += blen\n\t\t\tlinesRead += 1\n\t\t\tif more == false {\n\t\t\t\tfiles[ndx]=nil\n\t\t\t\tscanners[ndx]=nil\n\t\t\t}\n\t }\n\t}\n\tfmt.Println(\"L167: bytesRead=\", bytesRead, \" linesRead=\", linesRead)\n}", "title": "" }, { "docid": "9fffc7b0bc29026a70a3c33e7957335d", "score": "0.48642513", "text": "func OpenReader(name string) (*ReadCloser, error) {\n\tf, err := os.Open(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfi, err := f.Stat()\n\tif err != nil {\n\t\tf.Close()\n\t\treturn nil, err\n\t}\n\tpak := new(ReadCloser)\n\tif err := pak.init(f, fi.Size()); err != nil {\n\t\tf.Close()\n\t\treturn nil, err\n\t}\n\tpak.f = f\n\treturn pak, nil\n}", "title": "" }, { "docid": "26fb03373dda90df9e5b014cfcdb67e4", "score": "0.47920138", "text": "func Pipe() (r *File, w *File, err error) {\n\tvar p [2]int\n\n\t// See ../syscall/exec.go for description of lock.\n\tsyscall.ForkLock.RLock()\n\te := syscall.Pipe(p[0:])\n\tif e != nil {\n\t\tsyscall.ForkLock.RUnlock()\n\t\treturn nil, nil, NewSyscallError(\"pipe\", e)\n\t}\n\tsyscall.CloseOnExec(p[0])\n\tsyscall.CloseOnExec(p[1])\n\tsyscall.ForkLock.RUnlock()\n\n\treturn newFile(uintptr(p[0]), \"|0\", kindPipe), newFile(uintptr(p[1]), \"|1\", kindPipe), nil\n}", "title": "" }, { "docid": "7f1a27ee75ab82ffdd2dd35543aa58ca", "score": "0.47919574", "text": "func NewPatternReader(filePath string) *PatternReader {\n\treturn &PatternReader{\n\t\tfilePath: filePath,\n\t}\n}", "title": "" }, { "docid": "6088d6ddcd20bb212c76d12cafdd1ec7", "score": "0.47621027", "text": "func NewReader(f *Finder, r io.ByteReader) io.Reader {\n\tm := &matcher{in: r, f: f}\n\tm.out, m.mid = io.Pipe()\n\tgo m.run()\n\treturn m.out\n}", "title": "" }, { "docid": "bf0b4d97e09e201f9aed401c87023991", "score": "0.47594804", "text": "func OpenRaw(file string) (*Reader, error) {\n\tf, err := os.Open(file)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Reader{*bufio.NewReader(f), f}, nil\n}", "title": "" }, { "docid": "8291c5ad86a6f98998c3c61d3d180d00", "score": "0.4756608", "text": "func Open(ctx context.Context, path string) (io.ReadCloser, bool) {\n\tf, err := file.Open(ctx, path)\n\tif err != nil {\n\t\treturn file.NewError(err), false\n\t}\n\tr, isCompressed := NewReaderPath(f.Reader(ctx), path)\n\n\treturn struct {\n\t\tio.Reader\n\t\tio.Closer\n\t}{r, doubleCloser{r, ioctx.ToStdCloser(ctx, f)}}, isCompressed\n}", "title": "" }, { "docid": "54fb540816213226eb3d9d384ef04e52", "score": "0.4755728", "text": "func OpenScanner(path string) *Scanner {\n\tfile := filepath.Join(path, setDir, setFile)\n\tf, err := os.Open(file)\n\tif err != nil {\n\t\treturn &Scanner{err: io.EOF}\n\t}\n\treturn &Scanner{\n\t\tsc: stanza.NewScanner(f),\n\t\tf: f,\n\t}\n}", "title": "" }, { "docid": "9eb3bca47a3c32ec8646bcb3b9d6e111", "score": "0.47512293", "text": "func ParseGlob(pattern string) (*Template, error) {}", "title": "" }, { "docid": "0eb94cd145edf25c76970ee7c7d23498", "score": "0.47471705", "text": "func Glob(pattern string, doubleStarPatternDepth uint8) ([]string, error) {\n\tpatterns, err := GlobPatterns(pattern, doubleStarPatternDepth)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar matches []string\n\tfor _, p := range patterns {\n\t\t// Evaluate the path as a wildcards/shell glob\n\t\tmatch, err := filepath.Glob(p)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tmatches = append(matches, match...)\n\t}\n\treturn matches, nil\n}", "title": "" }, { "docid": "4269e00012366cc75bcbb5ae92efb69e", "score": "0.47363213", "text": "func (f *Files) FileOpen(name string, flag int, perm os.FileMode) (*os.File, error) {\n\treturn os.OpenFile(name, flag, perm)\n}", "title": "" }, { "docid": "979e4dc9fc45bea93202d9f045bd466a", "score": "0.47186023", "text": "func (r *file_reader_type) read_file_buffer(filename string, fi os.FileInfo) (*bytes.Buffer, error) {\n\tr.gate <- struct{}{}\n\tdefer func() { <-r.gate }()\n\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbuf := bufferPool.Get().(*bytes.Buffer)\n\tbuf.Reset()\n\tbuf.Grow(int(fi.Size()) + bytes.MinRead)\n\n\t_, err = buf.ReadFrom(f)\n\tf.Close()\n\tif err != nil {\n\t\tbufferPool.Put(buf)\n\t\treturn nil, err\n\t}\n\n\treturn buf, nil\n}", "title": "" }, { "docid": "80e82e3d152ff32cbdd4d773293d2d80", "score": "0.47158593", "text": "func (scope Scope) Open(name string) (ReadSeekCloser, error) {\n\tvar err error\n\tfor _, m := range scope.resolve(name) {\n\t\tr, err1 := m.fs.Open(m.translate(name))\n\t\tif err1 == nil {\n\t\t\treturn r, nil\n\t\t}\n\t\t// IsNotExist errors in overlay FSes can mask real errors in\n\t\t// the underlying FS, so ignore them if there is another error.\n\t\tif err == nil || os.IsNotExist(err) {\n\t\t\terr = err1\n\t\t}\n\t}\n\tif err == nil {\n\t\terr = &os.PathError{Op: \"open\", Path: name, Err: os.ErrNotExist}\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "288510412abc40f48f8a7f78a26b8f36", "score": "0.4714718", "text": "func ParseGlob(pattern string) (*template.Template, error)", "title": "" }, { "docid": "3007e5199af9f84da3c0a79bad81fc06", "score": "0.47117037", "text": "func c___go_openat(dirfd _C_int, path *byte, flags _C_int, mode Mode_t) _C_int", "title": "" }, { "docid": "a2fcb1014c5fac05f5a72fccfb9da7e1", "score": "0.47112045", "text": "func (p *interp) getInputScannerFile(name string) (*bufio.Scanner, error) {\n\tif _, ok := p.outputStreams[name]; ok {\n\t\treturn nil, newError(\"can't read from writer stream\")\n\t}\n\tif _, ok := p.inputStreams[name]; ok {\n\t\treturn p.scanners[name], nil\n\t}\n\tr, err := os.Open(name)\n\tif err != nil {\n\t\treturn nil, newError(\"input redirection error: %s\", err)\n\t}\n\tscanner := p.newScanner(r)\n\tp.scanners[name] = scanner\n\tp.inputStreams[name] = r\n\treturn scanner, nil\n}", "title": "" }, { "docid": "999728adc0eabf8d48af94d6c0ce4728", "score": "0.4708305", "text": "func (f *FakeOS) Glob(pattern string) ([]string, error) {\n\tif f.GlobFn != nil {\n\t\tvar res []string\n\t\tf.FilesLock.RLock()\n\t\tdefer f.FilesLock.RUnlock()\n\t\tfor k := range f.Files {\n\t\t\tif f.GlobFn(pattern, k) {\n\t\t\t\tres = append(res, k)\n\t\t\t}\n\t\t}\n\t\treturn res, nil\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "c1264d853249b1e637fe0e93d882f837", "score": "0.46817127", "text": "func execOpenReader(_ int, p *gop.Context) {\n\targs := p.GetArgs(1)\n\tret, ret1 := zip.OpenReader(args[0].(string))\n\tp.Ret(1, ret, ret1)\n}", "title": "" }, { "docid": "e9e0f26b57c03c0ded55e5a68443c78c", "score": "0.46782497", "text": "func execmFileOpen(_ int, p *gop.Context) {\n\targs := p.GetArgs(1)\n\tret, ret1 := args[0].(*zip.File).Open()\n\tp.Ret(1, ret, ret1)\n}", "title": "" }, { "docid": "1756e0302059eaa80265f97332e3cc08", "score": "0.4670335", "text": "func fanInData(numFiles int) chan []byte {\n\tvar (\n\t\terr error\n\t\tinput chan []byte\n\t\tbuffer []byte\n\t)\n\n\tinput = make(chan []byte, MAP_BUFFER_SIZE)\n\n\tgo func() {\n\t\tfor i := 0; i < numFiles; i++ {\n\t\t\tif buffer, err = ioutil.ReadFile(mapFileName(i)); err != nil {\n\t\t\t\tclose(input)\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\n\t\t\tlog.Println(\"Fanning in file\", mapFileName(i))\n\t\t\tinput <- buffer\n\t\t}\n\t\tclose(input)\n\t}()\n\treturn input\n}", "title": "" }, { "docid": "12c15f7b1d32fb9b8d0af74ad7d23902", "score": "0.46631297", "text": "func Open(name, compr string) (*Reader, error) {\n\tr := new(Reader)\n\n\tif compr == \"\" {\n\t\tcompr = detectCompression(name)\n\t}\n\n\t// Validate Compressionession method before working with files.\n\tswitch compr {\n\tcase \"bzip2\", \"gzip\", \"\":\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown compression type %s\", compr)\n\t}\n\n\tif name == \"\" {\n\t\tr.reader = os.Stdin\n\t} else {\n\t\tfile, err := os.Open(name)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tr.file = file\n\t\tr.reader = file\n\t}\n\n\t// Apply the Compressionession decoder.\n\tswitch compr {\n\tcase \"gzip\":\n\t\treader, err := gzip.NewReader(r.reader)\n\n\t\tif err != nil {\n\t\t\tr.Close()\n\t\t\treturn nil, err\n\t\t}\n\n\t\tr.reader = reader\n\tcase \"bzip2\":\n\t\tr.reader = bzip2.NewReader(r.reader)\n\t}\n\n\tr.Compression = compr\n\n\tr.reader = &UniversalReader{r.reader}\n\n\treturn r, nil\n}", "title": "" }, { "docid": "b614cdeeef7589fc42fff40ea6221f80", "score": "0.4658806", "text": "func (d *QSDriver) OpenFile(cc client.Context, path string, flag int) (client.FileStream, error) {\n\tpath = removeLeadingSlash(trimPath(path))\n\tcontext.Logger.Debugf(\"Open file: %s\", path)\n\n\tswitch flag {\n\tcase os.O_RDONLY:\n\t\treturn NewQSDownloadFile(path)\n\tcase os.O_WRONLY:\n\t\treturn NewQSUploadFile(path)\n\t}\n\n\treturn nil, fmt.Errorf(\"Failed to open path: %s\", path)\n}", "title": "" }, { "docid": "6fd3a55629d71809a603add51e17d388", "score": "0.46579933", "text": "func GlobFile(ctx GlobFileContext, pattern string, excludes []string,\n\tfileListFile, depFile string) {\n\n\tctx.Build(pctx, blueprint.BuildParams{\n\t\tRule: GlobRule,\n\t\tOutputs: []string{fileListFile},\n\t\tArgs: map[string]string{\n\t\t\t\"glob\": pattern,\n\t\t\t\"excludes\": joinWithPrefixAndQuote(excludes, \"-e \"),\n\t\t},\n\t})\n}", "title": "" }, { "docid": "d48400054f6db602492b8971747e5f4b", "score": "0.4648611", "text": "func Glob(pattern string) (matches []string, err error) {\n\tresult, err := filepath.Glob(pattern)\n\tif len(result) > 0 {\n\t\treturn result, err\n\t}\n\tif rxCouldGlobPattern.MatchString(pattern) {\n\t\tpattern = fmt.Sprintf(\"%s.\\\\%s\", pattern[:2], pattern[2:])\n\t\tresult, err = filepath.Glob(pattern)\n\t}\n\treturn result, err\n}", "title": "" }, { "docid": "e76194fd8c85a074d315b0a79ddb5a96", "score": "0.46451426", "text": "func FileOpen(filename string, flags uint64) uint64", "title": "" }, { "docid": "c72052d81ae25b110bab09b3394e4fcb", "score": "0.46420503", "text": "func fastaOpen(fpath string) (io.Reader, *os.File, error) {\n\tfp, err := os.Open(fpath)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar r io.Reader\n\tif strings.HasSuffix(fpath, \".gz\") {\n\t\tgr, err := gzip.NewReader(fp)\n\t\tif err != nil {\n\t\t\tfp.Close()\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tr = gr\n\t} else {\n\t\tr = fp\n\t}\n\treturn r, fp, nil\n}", "title": "" }, { "docid": "9046d7f452dae406740878cdb4b7ba62", "score": "0.46366826", "text": "func getReadsFQ(filename string) chan string{\n\n\tfile, _ := os.Open(filename)\n\tch := make(chan string)\n\tscanner := bufio.NewScanner(file)\n\n\tgo func() {\n\t\tdefer close(ch)\n\t\tdefer file.Close()\n\t\tfor i := 0; scanner.Scan(); i++ {\n\t\t\tif i % 4 == 1 {\n\t\t\t\tch <- scanner.Text()\n\t\t\t}\n\t\t}\n\t}()\n\treturn ch\n}", "title": "" }, { "docid": "16eef49d2b49461032848560bfe94a1a", "score": "0.46366063", "text": "func readFile() chan string {\n\turl_chan := make(chan string)\n\n\tsysArgs := os.Args\n\tvar filename string\n\n\tif len(sysArgs) == 1 {\n\t\tfmt.Println(\"Filepath Argument not provided.\")\n\t\tfilename = \"./input.txt\"\n\t} else {\n\t\tfilename = sysArgs[1]\n\t}\n\n\tgo func() {\n\t\tfile, err := os.Open(\"./\" + filename)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tdefer file.Close()\n\n\t\treader := bufio.NewReader(file)\n\n\t\tfor {\n\t\t\turl, err := reader.ReadString('\\n')\n\t\t\tif err == io.EOF {\n\t\t\t\turl_chan <- url\n\t\t\t\tbreak\n\t\t\t}\n\t\t\turl = strings.TrimSuffix(url, \"\\n\")\n\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\turl_chan <- url\n\t\t}\n\t\tclose(url_chan)\n\t}()\n\treturn url_chan\n}", "title": "" }, { "docid": "569be875bbf4a5dd76565a4935220b54", "score": "0.4634772", "text": "func GrepFile(patten string, filename string) (lines []string, err error) {\n\tre, err := regexp.Compile(patten)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfd, err := os.Open(filename)\n\tif err != nil {\n\t\treturn\n\t}\n\tlines = make([]string, 0)\n\treader := bufio.NewReader(fd)\n\tprefix := \"\"\n\tvar isLongLine bool\n\tfor {\n\t\tbyteLine, isPrefix, er := reader.ReadLine()\n\t\tif er != nil && er != io.EOF {\n\t\t\treturn nil, er\n\t\t}\n\t\tif er == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tline := string(byteLine)\n\t\tif isPrefix {\n\t\t\tprefix += line\n\t\t\tcontinue\n\t\t} else {\n\t\t\tisLongLine = true\n\t\t}\n\n\t\tline = prefix + line\n\t\tif isLongLine {\n\t\t\tprefix = \"\"\n\t\t}\n\t\tif re.MatchString(line) {\n\t\t\tlines = append(lines, line)\n\t\t}\n\t}\n\treturn lines, nil\n}", "title": "" }, { "docid": "3ed978af391ced40cb0eb210229bcd4b", "score": "0.46315837", "text": "func NewLineIndexedFilePipe(data, index string, perm os.FileMode) (*LineIndexedFilePipe, error) {\n\tvar err error\n\tl := &LineIndexedFilePipe{\n\t\tdata: data,\n\t\tindex: index,\n\t}\n\n\tvar dataFile, indexFile *os.File\n\tif dataFile, err = os.OpenFile(data, os.O_APPEND|os.O_CREATE|os.O_RDWR, perm); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif indexFile, err = os.OpenFile(index, os.O_APPEND|os.O_CREATE|os.O_RDWR, perm); err != nil {\n\t\tdataFile.Close()\n\t\treturn nil, err\n\t}\n\n\tl.LineIndexedPipe = NewLineIndexedPipe(dataFile, indexFile)\n\n\treturn l, nil\n}", "title": "" }, { "docid": "bba9f43a248b46b42a44d71f1aa4a596", "score": "0.46313888", "text": "func ReadLine(fileschan chan string, strchan chan string) {\n\n\tfor filezippato := range fileschan {\n\t\tf, err := os.Open(filezippato)\n\t\tif err != nil {\n\t\t\tfileschan <- filezippato\n\t\t\tcontinue\n\t\t}\n\t\tdefer f.Close()\n\n\t\tgr, err := gzip.NewReader(f)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tdefer gr.Close()\n\n\t\tscanner := bufio.NewScanner(gr)\n\n\t\tscanner.Split(bufio.ScanLines)\n\n\t\tfor scanner.Scan() {\n\t\t\tfmt.Println(scanner.Text())\n\t\t\tstrchan <- scanner.Text()\n\t\t}\n\t}\n\tclose(strchan)\n}", "title": "" }, { "docid": "93b9cb3931782a4f7628d1a1a1bff11d", "score": "0.4624936", "text": "func Glob(pattern, root string) (matches []string, atRoot string, err error) {\n\tvar helper filePathHelper\n\tvar mh matchedSet\n\n\terr = doGlob(pattern, root, &helper, &mh)\n\n\tatRoot = mh.root\n\tmatches = mh.matches\n\treturn\n}", "title": "" }, { "docid": "a4c5ed075e93999db07628c272e67b09", "score": "0.4624205", "text": "func (t testfs) Glob(glob string) ([]string, error) {\n\treturn t._glob(glob)\n}", "title": "" }, { "docid": "1256f0c704a0c4e5834878c568bbfbfc", "score": "0.46187428", "text": "func (t *Template) ParseGlob(pattern string) (*Template, error) {}", "title": "" }, { "docid": "9925d05bf7bf2b7885850315660b6a62", "score": "0.46169898", "text": "func readArrFilesByte(globPat string) {\n\tfnames, _ := filepath.Glob(globPat)\n\tif fnames == nil { \n\t\tfmt.Println(\"L322 Found no files for globPat=\", globPat)\n\t}\n\tnumFile := len(fnames)\n\tfmt.Println(\"L132: initial fileList len=\", numFile,\" files=\", fnames)\n\tfiles := make([]*os.File, numFile)\n\tscanners := make([]*bufio.Scanner, numFile)\n\t//lines = make([]string, numFile)\n\t// Open our Array of Files \n\tfor ndx:= 0; ndx < numFile; ndx++ {\n\t\tfiPtr, err := os.Open(fnames[ndx])\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed opening file %s: %s\", fnames[ndx], err)\n\t\t\treturn\n\t\t}\n\t\tdefer fiPtr.Close()\n\t\tfiles[ndx] = fiPtr\n\t\tscanner := bufio.NewScanner(fiPtr)\n\t\tscanners[ndx] = scanner\n\t}\n\tfmt.Println(\"L144: All files open\")\n\tallClosed := false\n\tbytesRead := 0\n\tlinesRead := 0\n\tfor allClosed != true {\n\t\t//fmt.Println(\"Outer Loop linesRead=\", linesRead)\n\t\tallClosed = true\n\t\tfor ndx:= 0; ndx < numFile; ndx++ {\n\t\t\tif scanners[ndx] == nil {\n\t\t\t\t// this file has reached EOF so skip\n\t\t\t\tfmt.Println(\"L155: Skip file closed\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tallClosed = false\n\t\t\tmore := scanners[ndx].Scan()\n\t\t\tstr1 := scanners[ndx].Bytes()\n\t\t\t//fmt.Println(\"REad ndx=\", ndx, \" str1=\", str1)\n\t\t\tblen := len(str1)\n\t\t\tbytesRead += blen\n\t\t\tlinesRead += 1\n\t\t\tif more == false {\n\t\t\t\tfiles[ndx]=nil\n\t\t\t\tscanners[ndx]=nil\n\t\t\t}\n\t }\n\t}\n\tfmt.Println(\"L167: bytesRead=\", bytesRead, \" linesRead=\", linesRead)\n}", "title": "" }, { "docid": "b1d1d6830c41789ccd9fa3f30f6e1272", "score": "0.460946", "text": "func ReadMyFile(ruta string) {\n\truta = strings.ReplaceAll(ruta, \"\\\"\", \"\")\n\tarchivo, err := os.Open(ruta)\n\tdefer func() {\n\t\tarchivo.Close()\n\t\tif r := recover(); r != nil {\n\t\t\tfmt.Println(r)\n\t\t}\n\t}()\n\n\tif err != nil {\n\t\tpanic(\"~$: 'El fichero o directorio no existe'\\n\")\n\t}\n\tscanner := bufio.NewScanner(archivo)\n\tfor scanner.Scan() {\n\t\tif linea := scanner.Text(); linea != \"\" {\n\t\t\tfor strings.Contains(linea, \"\\\\*\") {\n\t\t\t\tfmt.Println(linea)\n\t\t\t\tlinea = strings.ReplaceAll(linea, \"\\\\*\", \"\")\n\t\t\t\tscanner.Scan()\n\t\t\t\tlinea += scanner.Text()\n\t\t\t\tfmt.Println(linea)\n\t\t\t}\n\n\t\t\tExecuteComands(linea)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bf359fb5feececcce17af43cb2e34316", "score": "0.4604059", "text": "func (p Path) Glob() ([]Path, error) {\n\tvar (\n\t\tpaths = []Path{}\n\t)\n\tfiles, err := filepath.Glob(p.Join(\"*\").String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, f := range files {\n\t\tpaths = append(paths, Path(f))\n\t}\n\treturn paths, nil\n}", "title": "" }, { "docid": "ada0b1c8516b0697d5d3c81c547b2b47", "score": "0.45913935", "text": "func (fp FS) Open(path string) (fs.File, error) {\n\ttarget, err := fp.openFile(\"open\", path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn target.Cursor(fp.ctx), nil\n}", "title": "" }, { "docid": "f2ae657b1a8f796ef4cd0cb668103f47", "score": "0.45890772", "text": "func Open(filename string) (*Reader, error) {\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\tfi, err := f.Stat()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsize := fi.Size()\n\tif size == 0 {\n\t\treturn &Reader{}, nil\n\t}\n\tif size < 0 {\n\t\treturn nil, fmt.Errorf(\"mmap: file %q has negative size\", filename)\n\t}\n\tif size != int64(int(size)) {\n\t\treturn nil, fmt.Errorf(\"mmap: file %q is too large\", filename)\n\t}\n\n\tdata, err := syscall.Mmap(int(f.Fd()), 0, int(size), syscall.PROT_READ, syscall.MAP_SHARED)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr := &Reader{data: data}\n\truntime.SetFinalizer(r, (*Reader).Close)\n\treturn r, nil\n}", "title": "" }, { "docid": "a6008d1d979c9319281239dfc4fb2045", "score": "0.45822382", "text": "func (f Files) Open(name string) (io.ReadWriteCloser, error) {\n\treturn os.Open(name)\n}", "title": "" }, { "docid": "35be87ffc9ab5e6a26387013df0cebd4", "score": "0.45822167", "text": "func (t testfs) Open(name string) (io.Reader, error) {\n\treturn t._open(name)\n}", "title": "" }, { "docid": "4e7bf6b2fd406c8a8ff372403852fa7b", "score": "0.45803767", "text": "func Open(uri string) (io.Reader, error) {\n\treturn OpenWithOptions(uri, OpenOptions{})\n}", "title": "" }, { "docid": "9e2966d24812ad62d5e9ffb048e13a0f", "score": "0.45788962", "text": "func Open(path string, mode int, perm uint32) (*Fd, error) {\n\tfd, err := unix.Open(path, mode|unix.O_NONBLOCK, perm)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trwc, err := NewFd(uintptr(fd))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn rwc, nil\n}", "title": "" }, { "docid": "f8453476e07b808089d31f122ef39f2b", "score": "0.45745903", "text": "func readFileByLine(f *os.File) <-chan string {\r\n\tch := make(chan string)\r\n\tgo lineReader(f, ch)\r\n\treturn ch\r\n}", "title": "" }, { "docid": "3db0db04caaafbe5526136645fabb281", "score": "0.4573319", "text": "func NewReader(fp sophie.FsPath) (*Reader, error) {\n\treader, err := fp.Fs.Open(fp.Path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Reader{\n\t\treader: countedReadCloser{ReadCloser: reader},\n\t}, nil\n}", "title": "" }, { "docid": "6b60519ed337e71e6069c7a659f0ee3e", "score": "0.4565962", "text": "func OpenReader(name string, ring Keyring) (io.Reader, error) {\n\tkey, err := ring.Search(name)\n\tif err == nil {\n\t\treturn NewReader(key), nil\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "a74858c40c2aca42b82f8d3e838e64d0", "score": "0.45635334", "text": "func (p *Prog) Open() io.ReadSeeker", "title": "" }, { "docid": "b43236002a631d26e0f1f69dfe887b0d", "score": "0.4563108", "text": "func glob(pattern string) []string {\n\tpattern, err := homedir.Expand(pattern)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tpaths, err := filepath.Glob(pattern)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif len(paths) == 0 {\n\t\tlog.Fatalf(\"%s: no such file or directory\", pattern)\n\t}\n\treturn paths\n}", "title": "" }, { "docid": "645c8f80c52263bd985439f360e4b5d9", "score": "0.45498645", "text": "func Open(f *os.File, offset int64, size int64, itemSize int64) (*MMapReader, error) {\n\tfi, err := f.Stat()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfSize := fi.Size()\n\tif fSize == 0 {\n\t\treturn &MMapReader{}, nil\n\t}\n\tif fSize < 0 {\n\t\treturn nil, fmt.Errorf(\"mmap: file has negative size\")\n\t}\n\tif fSize != int64(int(fSize)) {\n\t\treturn nil, fmt.Errorf(\"mmap: file is too large\")\n\t}\n\tif size + offset > fSize {\n\t\treturn nil, fmt.Errorf(\"mmap: size is too large\")\n\t}\n\n\tdata, err := syscall.Mmap(int(f.Fd()), 0, int(size), syscall.PROT_READ, syscall.MAP_SHARED)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tptr := uintptr(unsafe.Pointer(&data[0])) + uintptr(offset)\n\tr := &MMapReader{\n\t\tItemCount: int(size / itemSize),\n\t\tdata: data,\n\t\tptr: ptr,\n\t\tsize: size,\n\t\titemSize: itemSize}\n\n\truntime.SetFinalizer(r, (*MMapReader).Close)\n\treturn r, nil\n}", "title": "" }, { "docid": "96888b4795c7d6f7dd68d1ed2cc1ea92", "score": "0.45475817", "text": "func (d Directory) OpenFile(typeName FileTypeName) (File, error) {\n\tfileType := GetFileType(typeName)\n\tok := false\n\tfor _, dirType := range fileType.DirTypes {\n\t\tif dirType == d.Type {\n\t\t\tok = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !ok {\n\t\tpanic(fmt.Sprintf(\"%v file type does not belong to %v hosts\", fileType, d.Type))\n\t}\n\tfor _, localPath := range fileType.Paths {\n\t\tfilePath := path.Join(d.Path, localPath)\n\t\tfile, err := os.Open(filePath)\n\t\tif err == nil {\n\t\t\treturn file, nil // found\n\t\t}\n\t\tif !os.IsNotExist(err) {\n\t\t\treturn nil, err // error\n\t\t}\n\t\t// not found\n\t\t// try to open correspondent .gz file\n\t\tfilePath += \".gz\"\n\t\tfile, err = os.Open(filePath)\n\t\tif err != nil {\n\t\t\tif !os.IsNotExist(err) {\n\t\t\t\treturn nil, err // error\n\t\t\t}\n\t\t\tcontinue // not found\n\t\t}\n\t\t// found\n\t\tr, err := gzip.NewReader(file)\n\t\tif err != nil {\n\t\t\treturn nil, err // error\n\t\t}\n\t\treturn struct {\n\t\t\tio.Reader\n\t\t\tio.Closer\n\t\t\tnamer\n\t\t}{io.Reader(r), bulkCloser{r, file}, namer(filePath)}, nil\n\t}\n\treturn nil, fmt.Errorf(\"file(s) not found: %v\", strings.Join(fileType.Paths, \", \"))\n}", "title": "" }, { "docid": "d02f6a99ef5340dc8dbe6a2994da553c", "score": "0.45452678", "text": "func (r *Reader) OpenFile(name string) (*io.SectionReader, error) {\n\tname = cleanEntryName(name)\n\tent, ok := r.Lookup(name)\n\tif !ok {\n\t\t// TODO: come up with some error plan. This is lazy:\n\t\treturn nil, &os.PathError{\n\t\t\tPath: name,\n\t\t\tOp: \"OpenFile\",\n\t\t\tErr: os.ErrNotExist,\n\t\t}\n\t}\n\tif ent.Type != \"reg\" {\n\t\treturn nil, &os.PathError{\n\t\t\tPath: name,\n\t\t\tOp: \"OpenFile\",\n\t\t\tErr: errors.New(\"not a regular file\"),\n\t\t}\n\t}\n\tfr := &fileReader{\n\t\tr: r,\n\t\tsize: ent.Size,\n\t\tents: r.getChunks(ent),\n\t}\n\treturn io.NewSectionReader(fr, 0, fr.size), nil\n}", "title": "" }, { "docid": "846b5ac62083287e67543aa24214b2be", "score": "0.45408744", "text": "func open_and_read(fn string) ([]string, error) {\r\n\r\n // Open the file\r\n file, err := os.Open(fn)\r\n check_error(err)\r\n defer file.Close()\r\n\r\n // Read the file.\r\n var lines []string\r\n scanner := bufio.NewScanner(file)\r\n for scanner.Scan() {\r\n lines = append(lines, scanner.Text())\r\n }\r\n return lines, scanner.Err()\r\n}", "title": "" }, { "docid": "b2e0e081c5375d9eb19ad20e5a888cf6", "score": "0.45372242", "text": "func ReadAll(path string, fieldSeparator rune, chanSize int) <-chan []string {\n\tcs := make(chan []string, chanSize)\n\n\tgo func() {\n\t\tdefer close(cs)\n\n\t\tfr, err := os.Open(path)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Failed to open file: %s. Error: %v\", path, err)\n\t\t\treturn\n\t\t}\n\t\tdefer fr.Close()\n\n\t\tr := csv.NewReader(bufio.NewReader(fr))\n\t\tr.Comma = fieldSeparator\n\n\t\tfor {\n\t\t\trecord, err := r.Read()\n\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\tclose(cs)\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\n\t\t\tcs <- record\n\t\t}\n\t}()\n\n\treturn cs\n}", "title": "" }, { "docid": "f467596c5b7aa0f0f14a1fdb3b7b2887", "score": "0.45306885", "text": "func (s *Shell) FilesRead(path string) (io.ReadCloser, error) {\n\tresp, err := s.Request(\"files/read\", path).\n\t\tSend(context.Background())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.Error != nil {\n\t\treturn nil, resp.Error\n\t}\n\n\treturn resp.Output, nil\n}", "title": "" }, { "docid": "c29393e0250430e1e8c56425b646f85b", "score": "0.45302707", "text": "func (application Application) Open(files []File, hint string) {\n\tfiles0 := make([]*C.GFile, len(files))\n\tfor idx, elemG := range files {\n\t\tfiles0[idx] = elemG.native()\n\t}\n\tvar files0Ptr **C.GFile\n\tif len(files0) > 0 {\n\t\tfiles0Ptr = &files0[0]\n\t}\n\thint0 := (*C.gchar)(C.CString(hint))\n\tC.g_application_open(application.native(), files0Ptr, C.gint(len(files)), hint0)\n\tC.free(unsafe.Pointer(hint0)) /*ch:<stdlib.h>*/\n}", "title": "" }, { "docid": "9d94c3f57b6a6c0d16dd37e13fe106b7", "score": "0.45245272", "text": "func Glob(pattern string) Option {\n\treturn func(f *Filehound) {\n\t\tf.Filter(func(path string, info os.FileInfo) bool {\n\t\t\tisMatch, _ := filepath.Match(pattern, filepath.Base(path))\n\t\t\treturn isMatch\n\t\t})\n\t}\n}", "title": "" }, { "docid": "45eeb95000a96c9e6882dcf101d7fb43", "score": "0.45216912", "text": "func (mock *FileServiceMock) OpenCalls() []struct {\n\tFn string\n} {\n\tvar calls []struct {\n\t\tFn string\n\t}\n\tlockFileServiceMockOpen.RLock()\n\tcalls = mock.calls.Open\n\tlockFileServiceMockOpen.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "79e13a9a7b85a7a3767e850c7288cc2a", "score": "0.45131642", "text": "func (proc *ProcState) openFile(path string, flags AccessFlag,\nmode [3]FileMode) (interface{File}, error) {\n var err error; var inode *Inode\n dir, filename, _ := proc.resolveDirPath(path)\n file, ok := dir[filename]\n\n // Finding our *Inode, if possible.\n if ok {\n switch file.(type) {\n case *Inode:\n inode = file.(*Inode)\n default:\n return nil, errors.New(\"Cannot open file of this type.\")\n }\n } else {\n switch {\n case (flags & O_CREAT) != 0:\n inode = initInode()\n dir[filename] = inode\n default:\n return nil, errors.New(\"File not found.\")\n }\n }\n\n // We're here? We found it! Otherwise, would have err.\n file = initDataFile(inode)\n return file.(interface{File}), err\n}", "title": "" }, { "docid": "c1d249a5aa3823ba548c407a2308e185", "score": "0.45055917", "text": "func openPipe() (*os.File, *os.File, error) {\n\tif socketOpen {\n\t\treturn nil, nil, fmt.Errorf(\"socket already opened\\n\")\n\t}\n\toldStdout = os.Stdout\n\tr, w, err := os.Pipe()\n\tif err != nil {\n\t\tlog.Errorf(\"os.Pipe: %v\", err)\n\t\treturn nil, nil, err\n\t}\n\tos.Stdout = w\n\tsocketOpen = true\n\n\treturn r, w, nil\n}", "title": "" }, { "docid": "9cb442030665f089e1b96bc12b6ce4b4", "score": "0.45054853", "text": "func loopThroughFile(file os.FileInfo, files chan channelFiles) {\n\tvar filesChan channelFiles\n\tvar fileValues [][]string\n\tif file.Size() != 0 {\n\t\tfile, err := os.Open(\"./csvFiles/\" + file.Name())\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"readCsvFile Error:\", err.Error())\n\t\t}\n\t\t// automatically call Close() at the end of current method\n\t\tdefer file.Close()\n\t\t//\n\t\treader := csv.NewReader(file)\n\t\treader.Comma = ';'\n\t\tfor {\n\t\t\t// read just one record\n\t\t\trecord, err := reader.Read()\n\t\t\t// end-of-file is fitted into err\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t} else if err != nil {\n\t\t\t\tlogger.Error(\"getRecordById: File\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfileValues = append(fileValues, record)\n\t\t}\n\t}\n\tfilesChan.Values = fileValues\n\tfilesChan.Id = file.Name()\n\tfiles <- filesChan\n\n}", "title": "" }, { "docid": "ff3fbe36430643e3a8d6a238d1b33a72", "score": "0.45041335", "text": "func (p *Projector) open(ctx context.Context) (Cursor, error) {\n\tvar types []dogma.Message\n\tp.types.Range(func(t message.Type) bool {\n\t\ttypes = append(\n\t\t\ttypes,\n\t\t\treflect.Zero(t.ReflectType()).Interface().(dogma.Message),\n\t\t)\n\t\treturn true\n\t})\n\n\tvar (\n\t\toffset uint64\n\t\terr error\n\t)\n\tp.current, err = p.Handler.ResourceVersion(ctx, p.resource)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toffset, err = resource.UnmarshalOffset(p.current)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlogging.Log(\n\t\tp.Logger,\n\t\t\"[%s %s@%d] started consuming\",\n\t\tp.name,\n\t\tp.resource,\n\t\toffset,\n\t)\n\n\treturn p.Stream.Open(ctx, offset, types)\n}", "title": "" }, { "docid": "336381e09e25d6024501d9dfc2f8bc82", "score": "0.45024544", "text": "func (receiver *RegularCollectionReceiver) Open() error {\n\t// TODO move this implementation to some non intents.file method, to be called from prioritizer.Get\n\t// So that we don't have to enable this double open stuff.\n\t// Currently the open needs to finish before the prioritizer.Get finishes, so we open the intents.file\n\t// in prioritizer.Get even though it's going to get opened again in DumpIntent.\n\treceiver.openOnce.Do(func() {\n\t\treceiver.readLenChan = make(chan int)\n\t\treceiver.readBufChan = make(chan []byte)\n\t\treceiver.hash = crc64.New(crc64.MakeTable(crc64.ECMA))\n\t\treceiver.Demux.Open(receiver.Origin, receiver)\n\t})\n\treturn nil\n}", "title": "" }, { "docid": "608c4f42fa309bbb7baea001c0c510f6", "score": "0.44970888", "text": "func Open(ctx context.Context, file string) (<-chan *Received, *failures.Failure) {\n\topenedAt := time.Now()\n\n\tf, err := os.OpenFile(file, os.O_CREATE|os.O_APPEND, 0660)\n\tif err != nil {\n\t\treturn nil, failures.FailOS.Wrap(err)\n\t}\n\tf.Close()\n\n\trcvs, err := monitor(ctx.Done(), openedAt, file)\n\tif err != nil {\n\t\treturn nil, failures.FailOS.Wrap(err)\n\t}\n\n\treturn rcvs, nil\n}", "title": "" }, { "docid": "a1cc681bd8249c0ae030ac10fbb3342a", "score": "0.44957516", "text": "func (m *MockFS) Open(path string) (vfs.ReadSeekCloser, error) {\n\targs := m.Called(path)\n\tvar file vfs.ReadSeekCloser\n\tfile, _ = args.Get(0).(vfs.ReadSeekCloser)\n\treturn file, args.Error(1)\n}", "title": "" }, { "docid": "ef757430294a228f370073011082bc21", "score": "0.44828326", "text": "func (r *FileRepository) Reader(u fyne.URI) (fyne.URIReadCloser, error) {\n\treturn openFile(u, false)\n}", "title": "" }, { "docid": "818352bcdf12ae4bfccb00fab9cf3705", "score": "0.44821867", "text": "func Open(frame wdte.Frame, args ...wdte.Func) wdte.Func {\n\tframe = frame.Sub(\"open\")\n\n\tif len(args) == 0 {\n\t\treturn wdte.GoFunc(Open)\n\t}\n\n\tpath := args[0].(wdte.String)\n\tfile, err := os.Open(string(path))\n\tif err != nil {\n\t\treturn wdte.Error{Err: err, Frame: frame}\n\t}\n\treturn File{File: file, mode: modeReader}\n}", "title": "" }, { "docid": "14c4ce98890ed960b765126ce8a388da", "score": "0.4480751", "text": "func (client GroupClient) Open(accountName string, pathParameter string, read string, op string, length *int64, offset *int64, fileSessionID *uuid.UUID) (result ReadCloser, err error) {\n\treq, err := client.OpenPreparer(accountName, pathParameter, read, op, length, offset, fileSessionID)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"filesystem.GroupClient\", \"Open\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.OpenSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"filesystem.GroupClient\", \"Open\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.OpenResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"filesystem.GroupClient\", \"Open\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "9b70c03b25b6fc0cae975ef00c0bedb5", "score": "0.44769418", "text": "func (c *container) openFile(path string, flags int) (*os.File, error) {\n\tcdirfd, err := c.Fd()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfd, err := syscall.Openat(cdirfd, path, flags, 0)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to open file: %v\", err)\n\t}\n\n\treturn os.NewFile(uintptr(fd), path), nil\n}", "title": "" }, { "docid": "04e39a0d5672460d96c887060f013677", "score": "0.4469406", "text": "func OpenFileR(fn string) (fil *os.File) {\n\tfil, err := os.Open(os.ExpandEnv(fn))\n\tif err != nil {\n\t\tchk.Panic(\"%v\\n\", err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "bec082a680616afefb9c8fcb9454cb5b", "score": "0.44655842", "text": "func dirGlob(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\tpattern := args[0].(*object.String).Value\n\n\tentries, err := filepath.Glob(pattern)\n\tif err != nil {\n\t\treturn NULL\n\t}\n\n\t// Create an array to hold the results and populate it\n\tl := len(entries)\n\tresult := make([]object.Object, l)\n\tfor i, txt := range entries {\n\t\tresult[i] = &object.String{Value: txt}\n\t}\n\treturn &object.Array{Elements: result}\n}", "title": "" }, { "docid": "e07c14e21039ee62b719b4f96f7966dc", "score": "0.4464843", "text": "func getFileReader(file string) (*bufio.Scanner, *os.File, error) {\n\tpath, err := filepath.Abs(file)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn bufio.NewScanner(bufio.NewReader(f)), f, nil\n}", "title": "" }, { "docid": "a42a92f2c1a2bed0ee6716174a32b51a", "score": "0.4464575", "text": "func (fsys FileSystem) OpenFile(name string, flag int, perm os.FileMode) (io.WriteCloser, error) {\n\treturn os.OpenFile(name, flag, perm)\n}", "title": "" }, { "docid": "19abc4b4cf787f9b8781f85868e3075a", "score": "0.44628006", "text": "func (i *helper) OpenFileRelative(path string) (*os.File, error) {\n\tdir := filepath.Dir(path)\n\treturn os.Open(filepath.Join(i.DirectoryRelative(dir), filepath.Base(path)))\n}", "title": "" }, { "docid": "7a130393f32e37b919200aa2fcdf8a86", "score": "0.4450162", "text": "func (fs P2PFS) Open(path string, req *http.Request) (*P2PFile, error) {\n\tfile := P2PFile{path, fs, 0, 0, newRemoteSource(req, fs.hp, fs.apikey)}\n\tfileSize, err := file.Fstat()\n\tif fs.prefetchable {\n\t\tfile.Prefetch(0, fileSize)\n\t}\n\treturn &file, err\n}", "title": "" }, { "docid": "2338dc0eb07383ed2225b30d15155007", "score": "0.44494274", "text": "func (p Provider) DialPipe(path string, timeout *time.Duration) (net.Conn, error) {\n\treturn winio.DialPipe(path, timeout)\n}", "title": "" }, { "docid": "412f0cc9e03bafdf96a8771bc8443929", "score": "0.44484764", "text": "func (p *Pipe) OpenSub() (*Pipe, error) {\n\td := p.handler\n\n\td.pipeLock.Lock()\n\tdefer d.pipeLock.Unlock()\n\n\tid := d.sessionId(p.other)\n\n\tpipe := &Pipe{\n\t\tother: p.other,\n\t\thandler: d,\n\t\tsession: id,\n\t\tservice: p.service,\n\t\tlazy: true,\n\t\tmessage: make(chan pipeMessage, d.PipeBacklog),\n\t\tnextSeqId: 1,\n\t\tackBacklog: d.AckBacklog,\n\t\tparent: p,\n\t}\n\n\tpipe.init()\n\n\td.pipes[mkpipeKey(p.other, id)] = pipe\n\n\treturn pipe, nil\n}", "title": "" }, { "docid": "df94cd6a6bf29f3a74858a43fd9a41e5", "score": "0.44479063", "text": "func open(path *byte, mode int, perm uint32) int", "title": "" }, { "docid": "a7f9b256f62780c9bdea8bd8d09dc102", "score": "0.44455695", "text": "func FileOpen2(filename string, flags uint64, mode uint64) uint64", "title": "" }, { "docid": "35bf4d3a7950332bc924caee1b9507c2", "score": "0.44451582", "text": "func Glob(pattern string, opts ...Options) ([]string, error) {\n\tvar options = compileOptions(opts)\n\tpattern = strings.TrimPrefix(pattern, \"./\")\n\n\tvar fs = options.fs\n\tvar matches []string\n\n\tmatcher, err := glob.Compile(pattern, filepath.Separator)\n\tif err != nil {\n\t\treturn matches, err\n\t}\n\n\tprefix, err := staticPrefix(pattern)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot determine static prefix: %w\", err)\n\t}\n\n\tprefixInfo, err := fs.Stat(prefix)\n\tif os.IsNotExist(err) {\n\t\t// if the prefix does not exist, the whole\n\t\t// glob pattern won't match anything\n\t\treturn []string{}, nil\n\t}\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"stat prefix: %w\", err)\n\t}\n\n\tif !prefixInfo.IsDir() {\n\t\t// if the prefix is a file, it either has to be\n\t\t// the only match, or nothing matches at all\n\t\tif matcher.Match(prefix) {\n\t\t\treturn []string{prefix}, nil\n\t\t}\n\n\t\treturn []string{}, nil\n\t}\n\n\treturn matches, afero.Walk(fs, prefix, 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 !matcher.Match(path) {\n\t\t\treturn nil\n\t\t}\n\n\t\tif info.IsDir() {\n\t\t\t// a direct match on a directory implies that all files inside match\n\t\t\tfilesInDir, err := filesInDirectory(fs, path)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tmatches = append(matches, filesInDir...)\n\t\t\treturn filepath.SkipDir\n\t\t} else {\n\t\t\tmatches = append(matches, path)\n\t\t}\n\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "72f847ca98360e17d30f698c45298312", "score": "0.44441086", "text": "func (fs *FileSystem) Open(path string) (io.WriteCloser, error) {\n\treturn file{path: path, buf: &fs.buf, owner: fs}, nil\n}", "title": "" } ]
7e977c408b774bdf5e03ac27c506f625
MarshalJSONBuf marshal buff to json template
[ { "docid": "4b78e620903c1c5db62d87334725e97c", "score": "0.64336526", "text": "func (j *Instructor) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"name\":`)\n\tfflib.WriteJsonString(buf, string(j.Name))\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" } ]
[ { "docid": "39ca53d726ae54440ea95e74ebd6c031", "score": "0.7110313", "text": "func (j *Meta) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ `)\n\tif j.Code != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"code\":`)\n\t\t\tfflib.FormatBits2(buf, uint64(*j.Code), 10, *j.Code < 0)\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.Message != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"message\":`)\n\t\t\tfflib.WriteJsonString(buf, string(*j.Message))\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "c660a302182b5519f1937cb2b302cb0e", "score": "0.7104173", "text": "func (j *NativeRequest) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ `)\n\tif len(j.Ver) != 0 {\n\t\tbuf.WriteString(`\"ver\":`)\n\t\tfflib.WriteJsonString(buf, string(j.Ver))\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.Layout != 0 {\n\t\tbuf.WriteString(`\"layout\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.Layout), 10, j.Layout < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.Adunit != 0 {\n\t\tbuf.WriteString(`\"adunit\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.Adunit), 10, j.Adunit < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.Plcmtcnt != 0 {\n\t\tbuf.WriteString(`\"plcmtcnt\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.Plcmtcnt), 10, j.Plcmtcnt < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.Seq != 0 {\n\t\tbuf.WriteString(`\"seq\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.Seq), 10, j.Seq < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Assets) != 0 {\n\t\tbuf.WriteString(`\"assets\":`)\n\t\tif j.Assets != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Assets {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\n\t\t\t\t{\n\n\t\t\t\t\tif v == nil {\n\t\t\t\t\t\tbuf.WriteString(\"null\")\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\terr = v.MarshalJSONBuf(buf)\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\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.Ext != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"ext\":`)\n\n\t\t\t{\n\n\t\t\t\tobj, err = j.Ext.MarshalJSON()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tbuf.Write(obj)\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "4251ba6f215a0a97af91b01b0726724c", "score": "0.709689", "text": "func (j *apple) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"id\":`)\n\tfflib.FormatBits2(buf, uint64(j.ID), 10, false)\n\tbuf.WriteString(`,\"dot\":`)\n\n\t{\n\n\t\tobj, err = j.Dot.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\tbuf.WriteString(`,\"type\":`)\n\tfflib.WriteJsonString(buf, string(j.Type))\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "8b0a9fec97c93b9851faf55c6c8935f9", "score": "0.70021", "text": "func (j *CommentDto) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"ID\":`)\n\tfflib.FormatBits2(buf, uint64(j.ID), 10, j.ID < 0)\n\tbuf.WriteString(`,\"Text\":`)\n\tfflib.WriteJsonString(buf, string(j.Text))\n\tbuf.WriteString(`,\"Username\":`)\n\tfflib.WriteJsonString(buf, string(j.Username))\n\tbuf.WriteString(`,\"Created\":`)\n\n\t{\n\n\t\tobj, err = j.Created.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\tbuf.WriteString(`,\"Modified\":`)\n\n\t{\n\n\t\tobj, err = j.Modified.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "b5f1cea7c221153ad36c9502375f4370", "score": "0.699259", "text": "func (j *NativeRequestData) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ `)\n\tif j.Type != 0 {\n\t\tbuf.WriteString(`\"type\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.Type), 10, j.Type < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.Len != 0 {\n\t\tbuf.WriteString(`\"len\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.Len), 10, j.Len < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.Ext != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"ext\":`)\n\n\t\t\t{\n\n\t\t\t\tobj, err = j.Ext.MarshalJSON()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tbuf.Write(obj)\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "5103e4e0f6d35d8a07a4a073e6b69656", "score": "0.69677126", "text": "func (j *Layer) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ \"id\":`)\n\tfflib.WriteJsonString(buf, string(j.ID))\n\tbuf.WriteByte(',')\n\tif len(j.Names) != 0 {\n\t\tbuf.WriteString(`\"names\":`)\n\t\tif j.Names != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Names {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\tfflib.WriteJsonString(buf, string(v))\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Parent) != 0 {\n\t\tbuf.WriteString(`\"parent\":`)\n\t\tfflib.WriteJsonString(buf, string(j.Parent))\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Metadata) != 0 {\n\t\tbuf.WriteString(`\"metadata\":`)\n\t\tfflib.WriteJsonString(buf, string(j.Metadata))\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.MountLabel) != 0 {\n\t\tbuf.WriteString(`\"mountlabel\":`)\n\t\tfflib.WriteJsonString(buf, string(j.MountLabel))\n\t\tbuf.WriteByte(',')\n\t}\n\tif true {\n\t\tbuf.WriteString(`\"created\":`)\n\n\t\t{\n\n\t\t\tobj, err = j.Created.MarshalJSON()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbuf.Write(obj)\n\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.CompressedDigest) != 0 {\n\t\tbuf.WriteString(`\"compressed-diff-digest\":`)\n\t\tfflib.WriteJsonString(buf, string(j.CompressedDigest))\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.CompressedSize != 0 {\n\t\tbuf.WriteString(`\"compressed-size\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.CompressedSize), 10, j.CompressedSize < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.UncompressedDigest) != 0 {\n\t\tbuf.WriteString(`\"diff-digest\":`)\n\t\tfflib.WriteJsonString(buf, string(j.UncompressedDigest))\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.UncompressedSize != 0 {\n\t\tbuf.WriteString(`\"diff-size\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.UncompressedSize), 10, j.UncompressedSize < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.CompressionType != 0 {\n\t\tbuf.WriteString(`\"compression\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.CompressionType), 10, j.CompressionType < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Flags) != 0 {\n\t\tbuf.WriteString(`\"flags\":`)\n\t\t/* Falling back. type=map[string]interface {} kind=map */\n\t\terr = buf.Encode(j.Flags)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.UIDMap) != 0 {\n\t\tbuf.WriteString(`\"uidmap\":`)\n\t\tif j.UIDMap != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.UIDMap {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\t/* Struct fall back. type=idtools.IDMap kind=struct */\n\t\t\t\terr = buf.Encode(&v)\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\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.GIDMap) != 0 {\n\t\tbuf.WriteString(`\"gidmap\":`)\n\t\tif j.GIDMap != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.GIDMap {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\t/* Struct fall back. type=idtools.IDMap kind=struct */\n\t\t\t\terr = buf.Encode(&v)\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\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "f7ebdd586ada0ecd34f73292a944c522", "score": "0.6958041", "text": "func (j *RouteDto) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"ID\":`)\n\tfflib.FormatBits2(buf, uint64(j.ID), 10, j.ID < 0)\n\tbuf.WriteString(`,\"Source\":`)\n\n\t{\n\n\t\terr = j.Source.MarshalJSONBuf(buf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\tbuf.WriteString(`,\"Destination\":`)\n\n\t{\n\n\t\terr = j.Destination.MarshalJSONBuf(buf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "1b13cd29efca94d6897caf8b6e768c0e", "score": "0.6908371", "text": "func (j *UserDto) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"ID\":`)\n\tfflib.FormatBits2(buf, uint64(j.ID), 10, j.ID < 0)\n\tbuf.WriteString(`,\"Username\":`)\n\tfflib.WriteJsonString(buf, string(j.Username))\n\tbuf.WriteString(`,\"Role\":`)\n\tfflib.WriteJsonString(buf, string(j.Role))\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "7b6c24f1ad35a8e42f342b9badb1abc6", "score": "0.6885975", "text": "func (j *Metadata) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"title\":`)\n\tfflib.WriteJsonString(buf, string(j.Title))\n\tbuf.WriteString(`,\"content\":`)\n\tfflib.WriteJsonString(buf, string(j.Content))\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "36bdce3ff756aa28c11b317e4e3f08cd", "score": "0.6882436", "text": "func (j *Response) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ `)\n\tif j.Meta != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"meta\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.Meta.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.Data != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"data\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.Data.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "dcd3a6bd067f91980421d420bb7a4a6b", "score": "0.6876455", "text": "func (j *NativeRequestAsset) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ `)\n\tif j.ID != 0 {\n\t\tbuf.WriteString(`\"id\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.ID), 10, j.ID < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.Required != 0 {\n\t\tbuf.WriteString(`\"required\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.Required), 10, j.Required < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.Title != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"title\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.Title.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.Image != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"img\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.Image.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.Video != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"video\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.Video.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.Data != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"data\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.Data.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.Ext != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"ext\":`)\n\n\t\t\t{\n\n\t\t\t\tobj, err = j.Ext.MarshalJSON()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tbuf.Write(obj)\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "b51d774714fda0c1ea80007c23ebe79c", "score": "0.68638325", "text": "func (j *NativeRequestOuter) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ `)\n\tif j.Native != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"native\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.Native.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "2e07a4812dd37992e115c53514fb6333", "score": "0.68451416", "text": "func (j *WithdrawPermissionCreateOperation) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ \"authorized_account\":`)\n\n\t{\n\n\t\tobj, err = j.AuthorizedAccount.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\tbuf.WriteString(`,\"period_start_time\":`)\n\n\t{\n\n\t\tobj, err = j.PeriodStartTime.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\tbuf.WriteString(`,\"periods_until_expiration\":`)\n\tfflib.FormatBits2(buf, uint64(j.PeriodsUntilExpiration), 10, false)\n\tbuf.WriteString(`,\"withdraw_from_account\":`)\n\n\t{\n\n\t\tobj, err = j.WithdrawFromAccount.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\t/* Struct fall back. type=types.AssetAmount kind=struct */\n\tbuf.WriteString(`,\"withdrawal_limit\":`)\n\terr = buf.Encode(&j.WithdrawalLimit)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbuf.WriteString(`,\"withdrawal_period_sec\":`)\n\tfflib.FormatBits2(buf, uint64(j.WithdrawalPeriodSec), 10, false)\n\tbuf.WriteByte(',')\n\tif j.Fee != nil {\n\t\tif true {\n\t\t\t/* Struct fall back. type=types.AssetAmount kind=struct */\n\t\t\tbuf.WriteString(`\"fee\":`)\n\t\t\terr = buf.Encode(j.Fee)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "b07255ffc286da0c1e4a7f305624ddcd", "score": "0.68368673", "text": "func (j *ResponseErrorStack) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"context\":`)\n\n\t{\n\n\t\terr = j.Context.MarshalJSONBuf(buf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\tbuf.WriteString(`,\"format\":`)\n\tfflib.WriteJsonString(buf, string(j.Format))\n\tbuf.WriteString(`,\"data\":`)\n\t/* Interface types must use runtime reflection. type=interface {} kind=interface */\n\terr = buf.Encode(j.Data)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "d1e6d2dd38f0b2d64c2dd0cfe467e7bf", "score": "0.68346375", "text": "func (j *PathDto) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{}`)\n\treturn nil\n}", "title": "" }, { "docid": "7143fd6c8fff3183158747a978c04413", "score": "0.67978007", "text": "func (j *layerStore) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{}`)\n\treturn nil\n}", "title": "" }, { "docid": "e8283879bb2264641da70ed85d7bdead", "score": "0.678396", "text": "func (j *Meeting) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ `)\n\tif j.Room != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"room\":`)\n\t\t\tfflib.WriteJsonString(buf, string(*j.Room))\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.Day != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"day\":`)\n\t\t\tfflib.WriteJsonString(buf, string(*j.Day))\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.StartTime != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"start_time\":`)\n\t\t\tfflib.WriteJsonString(buf, string(*j.StartTime))\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.EndTime != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"end_time\":`)\n\t\t\tfflib.WriteJsonString(buf, string(*j.EndTime))\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.ClassType != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"class_type\":`)\n\t\t\tfflib.WriteJsonString(buf, string(*j.ClassType))\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tbuf.WriteString(`\"index\":`)\n\tfflib.FormatBits2(buf, uint64(j.Index), 10, j.Index < 0)\n\tbuf.WriteByte(',')\n\tif len(j.Metadata) != 0 {\n\t\tbuf.WriteString(`\"metadata\":`)\n\t\tif j.Metadata != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Metadata {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\n\t\t\t\t{\n\n\t\t\t\t\tif v == nil {\n\t\t\t\t\t\tbuf.WriteString(\"null\")\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\terr = v.MarshalJSONBuf(buf)\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\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "06427a16d6ccc6d52c5f8ec8ff6bf6eb", "score": "0.6777333", "text": "func (j *AccountCreateOperation) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ \"registrar\":`)\n\n\t{\n\n\t\tobj, err = j.Registrar.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\tbuf.WriteString(`,\"name\":`)\n\n\t{\n\n\t\tobj, err = j.Name.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\t/* Struct fall back. type=types.Authority kind=struct */\n\tbuf.WriteString(`,\"owner\":`)\n\terr = buf.Encode(&j.Owner)\n\tif err != nil {\n\t\treturn err\n\t}\n\t/* Struct fall back. type=types.Authority kind=struct */\n\tbuf.WriteString(`,\"active\":`)\n\terr = buf.Encode(&j.Active)\n\tif err != nil {\n\t\treturn err\n\t}\n\t/* Struct fall back. type=types.AccountOptions kind=struct */\n\tbuf.WriteString(`,\"options\":`)\n\terr = buf.Encode(&j.Options)\n\tif err != nil {\n\t\treturn err\n\t}\n\t/* Struct fall back. type=types.AccountCreateExtensions kind=struct */\n\tbuf.WriteString(`,\"extensions\":`)\n\terr = buf.Encode(&j.Extensions)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbuf.WriteByte(',')\n\tif j.Fee != nil {\n\t\tif true {\n\t\t\t/* Struct fall back. type=types.AssetAmount kind=struct */\n\t\t\tbuf.WriteString(`\"fee\":`)\n\t\t\terr = buf.Encode(j.Fee)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "e9664b61289244ba97973c0380db8ad1", "score": "0.67724884", "text": "func (j *File) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"id\":`)\n\n\t{\n\n\t\tobj, err = j.ID.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\tbuf.WriteString(`,\"file_name\":`)\n\n\t{\n\n\t\tobj, err = j.FileName.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\tbuf.WriteString(`,\"file_owner\":`)\n\n\t{\n\n\t\tobj, err = j.FileOwner.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\tbuf.WriteString(`,\"create_time\":`)\n\n\t{\n\n\t\tobj, err = j.CreateTime.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\tbuf.WriteString(`,\"file_content\":`)\n\tfflib.WriteJsonString(buf, string(j.FileContent))\n\tbuf.WriteString(`,\"related_account\":`)\n\tif j.RelatedAccount != nil {\n\t\tbuf.WriteString(`[`)\n\t\tfor i, v := range j.RelatedAccount {\n\t\t\tif i != 0 {\n\t\t\t\tbuf.WriteString(`,`)\n\t\t\t}\n\n\t\t\t{\n\n\t\t\t\tobj, err = v.MarshalJSON()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tbuf.Write(obj)\n\n\t\t\t}\n\t\t}\n\t\tbuf.WriteString(`]`)\n\t} else {\n\t\tbuf.WriteString(`null`)\n\t}\n\tbuf.WriteString(`,\"signature\":`)\n\n\t{\n\n\t\tobj, err = j.Signature.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\tif j.ParentFile != nil {\n\t\tbuf.WriteString(`,\"parent_file\":`)\n\n\t\t{\n\n\t\t\tobj, err = j.ParentFile.MarshalJSON()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbuf.Write(obj)\n\n\t\t}\n\t} else {\n\t\tbuf.WriteString(`,\"parent_file\":null`)\n\t}\n\tbuf.WriteString(`,\"sub_file\":`)\n\tif j.SubFile != nil {\n\t\tbuf.WriteString(`[`)\n\t\tfor i, v := range j.SubFile {\n\t\t\tif i != 0 {\n\t\t\t\tbuf.WriteString(`,`)\n\t\t\t}\n\n\t\t\t{\n\n\t\t\t\tobj, err = v.MarshalJSON()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tbuf.Write(obj)\n\n\t\t\t}\n\t\t}\n\t\tbuf.WriteString(`]`)\n\t} else {\n\t\tbuf.WriteString(`null`)\n\t}\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "526831e9965b6a8e34fb647c36a448cf", "score": "0.6760169", "text": "func (j *UpdateCollateralForGasOperation) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ \"mortgager\":`)\n\n\t{\n\n\t\tobj, err = j.Mortgager.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\tbuf.WriteString(`,\"beneficiary\":`)\n\n\t{\n\n\t\tobj, err = j.Beneficiary.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\tbuf.WriteString(`,\"collateral\":`)\n\tfflib.FormatBits2(buf, uint64(j.Collateral), 10, j.Collateral < 0)\n\tbuf.WriteByte(',')\n\tif j.Fee != nil {\n\t\tif true {\n\t\t\t/* Struct fall back. type=types.AssetAmount kind=struct */\n\t\t\tbuf.WriteString(`\"fee\":`)\n\t\t\terr = buf.Encode(j.Fee)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "6453347259be52f634072972f7424b78", "score": "0.6751739", "text": "func (j *Request) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ `)\n\tif len(j.Session) != 0 {\n\t\tbuf.WriteString(`\"session\":`)\n\t\tfflib.WriteJsonString(buf, string(j.Session))\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.ResponseID) != 0 {\n\t\tbuf.WriteString(`\"responseId\":`)\n\t\tfflib.WriteJsonString(buf, string(j.ResponseID))\n\t\tbuf.WriteByte(',')\n\t}\n\tif true {\n\t\tbuf.WriteString(`\"queryResult\":`)\n\n\t\t{\n\n\t\t\terr = j.QueryResult.MarshalJSONBuf(buf)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.OriginalDetectIntentRequest) != 0 {\n\t\tbuf.WriteString(`\"originalDetectIntentRequest\":`)\n\n\t\t{\n\n\t\t\tobj, err = j.OriginalDetectIntentRequest.MarshalJSON()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbuf.Write(obj)\n\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "043e68c9a192272163aaf9a65cc27fb1", "score": "0.6751091", "text": "func (j *rpcResponseString) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ \"id\":`)\n\tfflib.WriteJsonString(buf, string(j.ID))\n\tbuf.WriteByte(',')\n\tif j.Result != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"result\":`)\n\n\t\t\t{\n\n\t\t\t\tobj, err = j.Result.MarshalJSON()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tbuf.Write(obj)\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.Error != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"error\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.Error.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "1bb62ccc52f4a7aaf2272610b673dde4", "score": "0.6712749", "text": "func (j *User) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"userId\":`)\n\tfflib.WriteJsonString(buf, string(j.Id))\n\tbuf.WriteString(`,\"userName\":`)\n\tfflib.WriteJsonString(buf, string(j.Name))\n\tbuf.WriteString(`,\"gender\":`)\n\tfflib.WriteJsonString(buf, string(j.Gender))\n\tbuf.WriteString(`,\"userMobile\":`)\n\tfflib.WriteJsonString(buf, string(j.Phone))\n\tbuf.WriteString(`,\"pwd\":`)\n\tfflib.WriteJsonString(buf, string(j.Pwd))\n\tbuf.WriteString(`,\"permission\":`)\n\tfflib.WriteJsonString(buf, string(j.Permission))\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "ea697df045dc3ac7fcaa9b860776014e", "score": "0.6708652", "text": "func (j *simpleGetCloser) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{}`)\n\treturn nil\n}", "title": "" }, { "docid": "0e53bfe77659e6de515c86f7ea00fada", "score": "0.6703155", "text": "func (j *rpcResponse) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ \"id\":`)\n\tfflib.FormatBits2(buf, uint64(j.ID), 10, false)\n\tbuf.WriteByte(',')\n\tif j.Result != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"result\":`)\n\n\t\t\t{\n\n\t\t\t\tobj, err = j.Result.MarshalJSON()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tbuf.Write(obj)\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.Error != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"error\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.Error.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "9bf510953ec29da70d223ef0ff3310a1", "score": "0.66858", "text": "func (j *Event) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"type\":`)\n\n\t{\n\n\t\tobj, err = j.Type.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\tbuf.WriteString(`,\"payload\":`)\n\t/* Interface types must use runtime reflection. type=interface {} kind=interface */\n\terr = buf.Encode(j.Payload)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "2193aad9f418207ce572082b759fbd1a", "score": "0.66804755", "text": "func (j *Section) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ \"number\":`)\n\tfflib.WriteJsonString(buf, string(j.Number))\n\tbuf.WriteString(`,\"call_number\":`)\n\tfflib.WriteJsonString(buf, string(j.CallNumber))\n\tbuf.WriteString(`,\"max\":`)\n\tfflib.FormatBits2(buf, uint64(j.Max), 10, j.Max < 0)\n\tbuf.WriteString(`,\"now\":`)\n\tfflib.FormatBits2(buf, uint64(j.Now), 10, j.Now < 0)\n\tbuf.WriteString(`,\"status\":`)\n\tfflib.WriteJsonString(buf, string(j.Status))\n\tbuf.WriteString(`,\"credits\":`)\n\tfflib.WriteJsonString(buf, string(j.Credits))\n\tbuf.WriteString(`,\"topic_name\":`)\n\tfflib.WriteJsonString(buf, string(j.TopicName))\n\tbuf.WriteString(`,\"topic_id\":`)\n\tfflib.WriteJsonString(buf, string(j.TopicId))\n\tbuf.WriteByte(',')\n\tif len(j.Meetings) != 0 {\n\t\tbuf.WriteString(`\"meetings\":`)\n\t\tif j.Meetings != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Meetings {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\n\t\t\t\t{\n\n\t\t\t\t\tif v == nil {\n\t\t\t\t\t\tbuf.WriteString(\"null\")\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\terr = v.MarshalJSONBuf(buf)\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\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Instructors) != 0 {\n\t\tbuf.WriteString(`\"instructors\":`)\n\t\tif j.Instructors != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Instructors {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\n\t\t\t\t{\n\n\t\t\t\t\tif v == nil {\n\t\t\t\t\t\tbuf.WriteString(\"null\")\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\terr = v.MarshalJSONBuf(buf)\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\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Books) != 0 {\n\t\tbuf.WriteString(`\"books\":`)\n\t\tif j.Books != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Books {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\n\t\t\t\t{\n\n\t\t\t\t\tif v == nil {\n\t\t\t\t\t\tbuf.WriteString(\"null\")\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\terr = v.MarshalJSONBuf(buf)\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\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Metadata) != 0 {\n\t\tbuf.WriteString(`\"metadata\":`)\n\t\tif j.Metadata != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Metadata {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\n\t\t\t\t{\n\n\t\t\t\t\tif v == nil {\n\t\t\t\t\t\tbuf.WriteString(\"null\")\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\terr = v.MarshalJSONBuf(buf)\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\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "8fc90f6322549897107037b3922f164f", "score": "0.6679194", "text": "func (j *BidRequest) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ \"id\":`)\n\tfflib.WriteJsonString(buf, string(j.ID))\n\tbuf.WriteByte(',')\n\tif len(j.Imp) != 0 {\n\t\tbuf.WriteString(`\"imp\":`)\n\t\tif j.Imp != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Imp {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\n\t\t\t\t{\n\n\t\t\t\t\terr = v.MarshalJSONBuf(buf)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.Site != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"site\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.Site.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.App != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"app\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.App.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.Device != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"device\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.Device.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.User != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"user\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.User.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tbuf.WriteString(`\"at\":`)\n\tfflib.FormatBits2(buf, uint64(j.AuctionType), 10, j.AuctionType < 0)\n\tbuf.WriteByte(',')\n\tif j.TMax != 0 {\n\t\tbuf.WriteString(`\"tmax\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.TMax), 10, j.TMax < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.WSeat) != 0 {\n\t\tbuf.WriteString(`\"wseat\":`)\n\t\tif j.WSeat != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.WSeat {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\tfflib.WriteJsonString(buf, string(v))\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.BSeat) != 0 {\n\t\tbuf.WriteString(`\"bseat\":`)\n\t\tif j.BSeat != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.BSeat {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\tfflib.WriteJsonString(buf, string(v))\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.AllImps != 0 {\n\t\tbuf.WriteString(`\"allimps\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.AllImps), 10, j.AllImps < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.Test != 0 {\n\t\tbuf.WriteString(`\"test\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.Test), 10, j.Test < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Cur) != 0 {\n\t\tbuf.WriteString(`\"cur\":`)\n\t\tif j.Cur != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Cur {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\tfflib.WriteJsonString(buf, string(v))\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.WLang) != 0 {\n\t\tbuf.WriteString(`\"wlang\":`)\n\t\tif j.WLang != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.WLang {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\tfflib.WriteJsonString(buf, string(v))\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Bcat) != 0 {\n\t\tbuf.WriteString(`\"bcat\":`)\n\t\tif j.Bcat != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Bcat {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\tfflib.WriteJsonString(buf, string(v))\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.BAdv) != 0 {\n\t\tbuf.WriteString(`\"badv\":`)\n\t\tif j.BAdv != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.BAdv {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\tfflib.WriteJsonString(buf, string(v))\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.BApp) != 0 {\n\t\tbuf.WriteString(`\"bapp\":`)\n\t\tif j.BApp != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.BApp {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\tfflib.WriteJsonString(buf, string(v))\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.Exp != 0 {\n\t\tbuf.WriteString(`\"exp\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.Exp), 10, j.Exp < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.Regs != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"regs\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.Regs.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.Source != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"source\":`)\n\n\t\t\t{\n\n\t\t\t\tobj, err = j.Source.MarshalJSON()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tbuf.Write(obj)\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.Ext != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"ext\":`)\n\n\t\t\t{\n\n\t\t\t\tobj, err = j.Ext.MarshalJSON()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tbuf.Write(obj)\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.Pmp != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"pmp\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.Pmp.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "e95f0652eeb0e412c247b471349a717f", "score": "0.6655271", "text": "func (j *Book) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"title\":`)\n\tfflib.WriteJsonString(buf, string(j.Title))\n\tbuf.WriteString(`,\"url\":`)\n\tfflib.WriteJsonString(buf, string(j.Url))\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "7016ef19cac72a96a076de49695a591a", "score": "0.66512775", "text": "func (j *NHAsset) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"id\":`)\n\n\t{\n\n\t\tobj, err = j.ID.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\tbuf.WriteString(`,\"nh_asset_creator\":`)\n\n\t{\n\n\t\tobj, err = j.NhAssetCreator.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\tbuf.WriteString(`,\"nh_asset_owner\":`)\n\n\t{\n\n\t\tobj, err = j.NhAssetOwner.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\tbuf.WriteString(`,\"nh_asset_active\":`)\n\n\t{\n\n\t\tobj, err = j.NhAssetActive.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\tbuf.WriteString(`,\"dealership\":`)\n\n\t{\n\n\t\tobj, err = j.Dealership.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\tbuf.WriteString(`,\"asset_qualifier\":`)\n\tfflib.WriteJsonString(buf, string(j.AssetQualifier))\n\tbuf.WriteString(`,\"world_view\":`)\n\tfflib.WriteJsonString(buf, string(j.WorldView))\n\tbuf.WriteString(`,\"base_describe\":`)\n\tfflib.WriteJsonString(buf, string(j.BaseDescribe))\n\t/* Falling back. type=types.NHAssetMapType kind=map */\n\tbuf.WriteString(`,\"parent\":`)\n\terr = buf.Encode(j.Parent)\n\tif err != nil {\n\t\treturn err\n\t}\n\t/* Falling back. type=types.NHAssetMapType kind=map */\n\tbuf.WriteString(`,\"child\":`)\n\terr = buf.Encode(j.Child)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbuf.WriteString(`,\"create_time\":`)\n\n\t{\n\n\t\tobj, err = j.CreateTime.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\tbuf.WriteString(`,\"limit_list\":`)\n\tif j.LimitList != nil {\n\t\tbuf.WriteString(`[`)\n\t\tfor i, v := range j.LimitList {\n\t\t\tif i != 0 {\n\t\t\t\tbuf.WriteString(`,`)\n\t\t\t}\n\n\t\t\t{\n\n\t\t\t\tobj, err = v.MarshalJSON()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tbuf.Write(obj)\n\n\t\t\t}\n\t\t}\n\t\tbuf.WriteString(`]`)\n\t} else {\n\t\tbuf.WriteString(`null`)\n\t}\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "4e6e356da9ebf17dfc86be26fe893a37", "score": "0.6648975", "text": "func (j *layerMountPoint) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"id\":`)\n\tfflib.WriteJsonString(buf, string(j.ID))\n\tbuf.WriteString(`,\"path\":`)\n\tfflib.WriteJsonString(buf, string(j.MountPoint))\n\tbuf.WriteString(`,\"count\":`)\n\tfflib.FormatBits2(buf, uint64(j.MountCount), 10, j.MountCount < 0)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "4a6da3985590e3b4a3aa671fb06505a8", "score": "0.6643018", "text": "func (j *QueryResult) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ `)\n\tif len(j.QueryText) != 0 {\n\t\tbuf.WriteString(`\"queryText\":`)\n\t\tfflib.WriteJsonString(buf, string(j.QueryText))\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Action) != 0 {\n\t\tbuf.WriteString(`\"action\":`)\n\t\tfflib.WriteJsonString(buf, string(j.Action))\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.LanguageCode) != 0 {\n\t\tbuf.WriteString(`\"languageCode\":`)\n\t\tfflib.WriteJsonString(buf, string(j.LanguageCode))\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.AllRequiredParamsPresent != false {\n\t\tif j.AllRequiredParamsPresent {\n\t\t\tbuf.WriteString(`\"allRequiredParamsPresent\":true`)\n\t\t} else {\n\t\t\tbuf.WriteString(`\"allRequiredParamsPresent\":false`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.IntentDetectionConfidence != 0 {\n\t\tbuf.WriteString(`\"intentDetectionConfidence\":`)\n\t\tfflib.AppendFloat(buf, float64(j.IntentDetectionConfidence), 'g', -1, 64)\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Parameters) != 0 {\n\t\tbuf.WriteString(`\"parameters\":`)\n\n\t\t{\n\n\t\t\tobj, err = j.Parameters.MarshalJSON()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbuf.Write(obj)\n\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.OutputContexts) != 0 {\n\t\tbuf.WriteString(`\"outputContexts\":`)\n\t\tif j.OutputContexts != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.OutputContexts {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\tif v != nil {\n\t\t\t\t\t/* Struct fall back. type=dialogflow.Context kind=struct */\n\t\t\t\t\terr = buf.Encode(&v)\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} else {\n\t\t\t\t\tbuf.WriteString(`null`)\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif true {\n\t\tbuf.WriteString(`\"intent\":`)\n\n\t\t{\n\n\t\t\terr = j.Intent.MarshalJSONBuf(buf)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "498bf805b1dd5436e42b7639fa8b5f3a", "score": "0.66351444", "text": "func (j *CityDto) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"ID\":`)\n\tfflib.FormatBits2(buf, uint64(j.ID), 10, j.ID < 0)\n\tbuf.WriteString(`,\"Name\":`)\n\tfflib.WriteJsonString(buf, string(j.Name))\n\tbuf.WriteString(`,\"Country\":`)\n\tfflib.WriteJsonString(buf, string(j.Country))\n\tbuf.WriteString(`,\"Comments\":`)\n\tif j.Comments != nil {\n\t\tbuf.WriteString(`[`)\n\t\tfor i, v := range j.Comments {\n\t\t\tif i != 0 {\n\t\t\t\tbuf.WriteString(`,`)\n\t\t\t}\n\n\t\t\t{\n\n\t\t\t\terr = v.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\tbuf.WriteString(`]`)\n\t} else {\n\t\tbuf.WriteString(`null`)\n\t}\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "7b97d36557c905bfdb56599a8a4596e6", "score": "0.6628064", "text": "func (j *UCTNotification) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"notification_id\":`)\n\tfflib.FormatBits2(buf, uint64(j.NotificationId), 10, j.NotificationId < 0)\n\tbuf.WriteString(`,\"topic_name\":`)\n\tfflib.WriteJsonString(buf, string(j.TopicName))\n\tbuf.WriteString(`,\"status\":`)\n\tfflib.WriteJsonString(buf, string(j.Status))\n\tbuf.WriteString(`,\"university\":`)\n\n\t{\n\n\t\terr = j.University.MarshalJSONBuf(buf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "28b474b629c4daca0efeb2b71d186768", "score": "0.66246796", "text": "func (j *ResponseCity) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ `)\n\tif j.Data != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"Data\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.Data.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif len(j.Error) != 0 {\n\t\tbuf.WriteString(`\"Error\":`)\n\t\tfflib.WriteJsonString(buf, string(j.Error))\n\t\tbuf.WriteByte(',')\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "b74215ef7219e3336107c45aef3c2e37", "score": "0.66179365", "text": "func (j *NativeRequestTitle) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ `)\n\tif j.Len != 0 {\n\t\tbuf.WriteString(`\"len\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.Len), 10, j.Len < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.Ext != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"ext\":`)\n\n\t\t\t{\n\n\t\t\t\tobj, err = j.Ext.MarshalJSON()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tbuf.Write(obj)\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "aafaf13018e3c02d699ebfdd7d966465", "score": "0.661562", "text": "func (j *ResponseErrorContext) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"level\":`)\n\tfflib.WriteJsonString(buf, string(j.Level))\n\tbuf.WriteString(`,\"file\":`)\n\tfflib.WriteJsonString(buf, string(j.File))\n\tbuf.WriteString(`,\"line\":`)\n\tfflib.FormatBits2(buf, uint64(j.Line), 10, j.Line < 0)\n\tbuf.WriteString(`,\"method\":`)\n\tfflib.WriteJsonString(buf, string(j.Method))\n\tbuf.WriteString(`,\"hostname\":`)\n\tfflib.WriteJsonString(buf, string(j.Hostname))\n\tbuf.WriteString(`,\"thread_name\":`)\n\tfflib.WriteJsonString(buf, string(j.ThreadName))\n\tbuf.WriteString(`,\"timestamp\":`)\n\tfflib.WriteJsonString(buf, string(j.Timestamp))\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "a20284c8a06be566a45373ca285f7b0b", "score": "0.66087013", "text": "func (j *Intent) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ `)\n\tif len(j.Name) != 0 {\n\t\tbuf.WriteString(`\"name\":`)\n\t\tfflib.WriteJsonString(buf, string(j.Name))\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.DisplayName) != 0 {\n\t\tbuf.WriteString(`\"displayName\":`)\n\t\tfflib.WriteJsonString(buf, string(j.DisplayName))\n\t\tbuf.WriteByte(',')\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "81a219f53bc5df5409e5a704d32020c5", "score": "0.6599877", "text": "func (j *PathRouteDto) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"RouteID\":`)\n\tfflib.FormatBits2(buf, uint64(j.RouteID), 10, j.RouteID < 0)\n\tbuf.WriteString(`,\"Airport\":`)\n\tfflib.WriteJsonString(buf, string(j.Airport))\n\tbuf.WriteString(`,\"City\":`)\n\tfflib.WriteJsonString(buf, string(j.City))\n\tbuf.WriteString(`,\"Country\":`)\n\tfflib.WriteJsonString(buf, string(j.Country))\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "0a2fe1a0d612eca137983980fddc0dc2", "score": "0.65665406", "text": "func (j *DiffOptions) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tif j.Compression != nil {\n\t\tbuf.WriteString(`{\"Compression\":`)\n\t\tfflib.FormatBits2(buf, uint64(*j.Compression), 10, *j.Compression < 0)\n\t} else {\n\t\tbuf.WriteString(`{\"Compression\":null`)\n\t}\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "f98fe537d4bbe359bea55227d8bb4402", "score": "0.65627503", "text": "func (j *Subscription) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"id\":`)\n\tfflib.WriteJsonString(buf, string(j.Id))\n\tbuf.WriteString(`,\"os\":`)\n\tfflib.WriteJsonString(buf, string(j.Os))\n\tbuf.WriteString(`,\"is_subscribed\":`)\n\tfflib.WriteJsonString(buf, string(j.IsSubscribed))\n\tbuf.WriteString(`,\"topic_name\":`)\n\tfflib.WriteJsonString(buf, string(j.TopicName))\n\tbuf.WriteString(`,\"fcm_token\":`)\n\tfflib.WriteJsonString(buf, string(j.FcmToken))\n\tbuf.WriteString(`,\"created_at\":`)\n\tfflib.WriteJsonString(buf, string(j.CreatedAt))\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "5fc2b73fc4b2b85dd1b3cfe1699bbb2e", "score": "0.6556085", "text": "func (j *LoginReq) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"mobile\":`)\n\tfflib.WriteJsonString(buf, string(j.Phone))\n\tbuf.WriteString(`,\"pwd\":`)\n\tfflib.WriteJsonString(buf, string(j.Pwd))\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "92a1620f52c820cafd18c16598408d4b", "score": "0.65475136", "text": "func (j *NativeRequestImage) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ `)\n\tif j.Type != 0 {\n\t\tbuf.WriteString(`\"type\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.Type), 10, j.Type < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.H != 0 {\n\t\tbuf.WriteString(`\"h\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.H), 10, j.H < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.W != 0 {\n\t\tbuf.WriteString(`\"w\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.W), 10, j.W < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.HMin != 0 {\n\t\tbuf.WriteString(`\"hmin\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.HMin), 10, j.HMin < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.WMin != 0 {\n\t\tbuf.WriteString(`\"wmin\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.WMin), 10, j.WMin < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Mimes) != 0 {\n\t\tbuf.WriteString(`\"mimes\":`)\n\t\tif j.Mimes != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Mimes {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\tfflib.WriteJsonString(buf, string(v))\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.Ext != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"ext\":`)\n\n\t\t\t{\n\n\t\t\t\tobj, err = j.Ext.MarshalJSON()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tbuf.Write(obj)\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "67590fa17239d8ee31c8f62582e3b919", "score": "0.65408474", "text": "func (j *SubscriptionView) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"topic_name\":`)\n\tfflib.WriteJsonString(buf, string(j.TopicName))\n\tbuf.WriteString(`,\"subscribers\":`)\n\tfflib.FormatBits2(buf, uint64(j.Subscribers), 10, j.Subscribers < 0)\n\tif j.IsHot {\n\t\tbuf.WriteString(`,\"is_hot\":true`)\n\t} else {\n\t\tbuf.WriteString(`,\"is_hot\":false`)\n\t}\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "7f98e12b653730d4e4aacbff9ecd2db4", "score": "0.65314597", "text": "func (j *BidRequest) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ \"id\":`)\n\tfflib.WriteJsonString(buf, string(j.ID))\n\tbuf.WriteByte(',')\n\tif len(j.Impressions) != 0 {\n\t\tbuf.WriteString(`\"imp\":`)\n\t\tif j.Impressions != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Impressions {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\t/* Struct fall back. type=openrtb.Impression kind=struct */\n\t\t\t\terr = buf.Encode(&v)\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\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.Site != nil {\n\t\tif true {\n\t\t\t/* Struct fall back. type=openrtb.Site kind=struct */\n\t\t\tbuf.WriteString(`\"site\":`)\n\t\t\terr = buf.Encode(j.Site)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.App != nil {\n\t\tif true {\n\t\t\t/* Struct fall back. type=openrtb.App kind=struct */\n\t\t\tbuf.WriteString(`\"app\":`)\n\t\t\terr = buf.Encode(j.App)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.Device != nil {\n\t\tif true {\n\t\t\t/* Struct fall back. type=openrtb.Device kind=struct */\n\t\t\tbuf.WriteString(`\"device\":`)\n\t\t\terr = buf.Encode(j.Device)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.User != nil {\n\t\tif true {\n\t\t\t/* Struct fall back. type=openrtb.User kind=struct */\n\t\t\tbuf.WriteString(`\"user\":`)\n\t\t\terr = buf.Encode(j.User)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.Test != 0 {\n\t\tbuf.WriteString(`\"test\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.Test), 10, j.Test < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tbuf.WriteString(`\"at\":`)\n\tfflib.FormatBits2(buf, uint64(j.AuctionType), 10, j.AuctionType < 0)\n\tbuf.WriteByte(',')\n\tif j.TimeMax != 0 {\n\t\tbuf.WriteString(`\"tmax\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.TimeMax), 10, j.TimeMax < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Seats) != 0 {\n\t\tbuf.WriteString(`\"wseat\":`)\n\t\tif j.Seats != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Seats {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\tfflib.WriteJsonString(buf, string(v))\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.BlockedSeats) != 0 {\n\t\tbuf.WriteString(`\"bseat\":`)\n\t\tif j.BlockedSeats != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.BlockedSeats {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\tfflib.WriteJsonString(buf, string(v))\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Languages) != 0 {\n\t\tbuf.WriteString(`\"wlang\":`)\n\t\tif j.Languages != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Languages {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\tfflib.WriteJsonString(buf, string(v))\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.AllImpressions != 0 {\n\t\tbuf.WriteString(`\"allimps\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.AllImpressions), 10, j.AllImpressions < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Currencies) != 0 {\n\t\tbuf.WriteString(`\"cur\":`)\n\t\tif j.Currencies != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Currencies {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\tfflib.WriteJsonString(buf, string(v))\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.BlockedCategories) != 0 {\n\t\tbuf.WriteString(`\"bcat\":`)\n\t\tif j.BlockedCategories != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.BlockedCategories {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\tfflib.WriteJsonString(buf, string(v))\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.BlockedAdvDomains) != 0 {\n\t\tbuf.WriteString(`\"badv\":`)\n\t\tif j.BlockedAdvDomains != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.BlockedAdvDomains {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\tfflib.WriteJsonString(buf, string(v))\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.BlockedApps) != 0 {\n\t\tbuf.WriteString(`\"bapp\":`)\n\t\tif j.BlockedApps != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.BlockedApps {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\tfflib.WriteJsonString(buf, string(v))\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.Source != nil {\n\t\tif true {\n\t\t\t/* Struct fall back. type=openrtb.Source kind=struct */\n\t\t\tbuf.WriteString(`\"source\":`)\n\t\t\terr = buf.Encode(j.Source)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.Regulations != nil {\n\t\tif true {\n\t\t\t/* Struct fall back. type=openrtb.Regulations kind=struct */\n\t\t\tbuf.WriteString(`\"regs\":`)\n\t\t\terr = buf.Encode(j.Regulations)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif len(j.Ext) != 0 {\n\t\tbuf.WriteString(`\"ext\":`)\n\n\t\t{\n\n\t\t\tobj, err = j.Ext.MarshalJSON()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbuf.Write(obj)\n\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "b4cea1f7322c77117fe3ae6a2fe20410", "score": "0.64993995", "text": "func (j *Registration) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"period\":`)\n\tfflib.WriteJsonString(buf, string(j.Period))\n\tbuf.WriteString(`,\"period_date\":`)\n\tfflib.FormatBits2(buf, uint64(j.PeriodDate), 10, j.PeriodDate < 0)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "4347bd714b540db7265594b9544d60bb", "score": "0.6494019", "text": "func (j *Course) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ \"name\":`)\n\tfflib.WriteJsonString(buf, string(j.Name))\n\tbuf.WriteString(`,\"number\":`)\n\tfflib.WriteJsonString(buf, string(j.Number))\n\tbuf.WriteByte(',')\n\tif j.Synopsis != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"synopsis\":`)\n\t\t\tfflib.WriteJsonString(buf, string(*j.Synopsis))\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tbuf.WriteString(`\"topic_name\":`)\n\tfflib.WriteJsonString(buf, string(j.TopicName))\n\tbuf.WriteString(`,\"topic_id\":`)\n\tfflib.WriteJsonString(buf, string(j.TopicId))\n\tbuf.WriteByte(',')\n\tif len(j.Sections) != 0 {\n\t\tbuf.WriteString(`\"sections\":`)\n\t\tif j.Sections != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Sections {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\n\t\t\t\t{\n\n\t\t\t\t\tif v == nil {\n\t\t\t\t\t\tbuf.WriteString(\"null\")\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\terr = v.MarshalJSONBuf(buf)\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\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Metadata) != 0 {\n\t\tbuf.WriteString(`\"metadata\":`)\n\t\tif j.Metadata != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Metadata {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\n\t\t\t\t{\n\n\t\t\t\t\tif v == nil {\n\t\t\t\t\t\tbuf.WriteString(\"null\")\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\terr = v.MarshalJSONBuf(buf)\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\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "3da02044803c317c338db6d466b7c819", "score": "0.64860654", "text": "func (j *ResponseASN) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ `)\n\tif j.Data != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"Data\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.Data.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif len(j.Error) != 0 {\n\t\tbuf.WriteString(`\"Error\":`)\n\t\tfflib.WriteJsonString(buf, string(j.Error))\n\t\tbuf.WriteByte(',')\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "ad485b31d2f0cfcacbfb6ecbbeed74a8", "score": "0.64844775", "text": "func (j *Data) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ `)\n\tif len(j.Universities) != 0 {\n\t\tbuf.WriteString(`\"universities\":`)\n\t\tif j.Universities != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Universities {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\n\t\t\t\t{\n\n\t\t\t\t\tif v == nil {\n\t\t\t\t\t\tbuf.WriteString(\"null\")\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\terr = v.MarshalJSONBuf(buf)\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\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Subjects) != 0 {\n\t\tbuf.WriteString(`\"subjects\":`)\n\t\tif j.Subjects != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Subjects {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\n\t\t\t\t{\n\n\t\t\t\t\tif v == nil {\n\t\t\t\t\t\tbuf.WriteString(\"null\")\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\terr = v.MarshalJSONBuf(buf)\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\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Courses) != 0 {\n\t\tbuf.WriteString(`\"courses\":`)\n\t\tif j.Courses != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Courses {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\n\t\t\t\t{\n\n\t\t\t\t\tif v == nil {\n\t\t\t\t\t\tbuf.WriteString(\"null\")\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\terr = v.MarshalJSONBuf(buf)\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\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Sections) != 0 {\n\t\tbuf.WriteString(`\"sections\":`)\n\t\tif j.Sections != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Sections {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\n\t\t\t\t{\n\n\t\t\t\t\tif v == nil {\n\t\t\t\t\t\tbuf.WriteString(\"null\")\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\terr = v.MarshalJSONBuf(buf)\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\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.University != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"university\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.University.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.Subject != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"subject\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.Subject.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.Course != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"course\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.Course.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.Section != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"section\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.Section.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif len(j.SubscriptionView) != 0 {\n\t\tbuf.WriteString(`\"subscription_view\":`)\n\t\tif j.SubscriptionView != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.SubscriptionView {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\n\t\t\t\t{\n\n\t\t\t\t\tif v == nil {\n\t\t\t\t\t\tbuf.WriteString(\"null\")\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\terr = v.MarshalJSONBuf(buf)\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\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "ff3d3c92e69d152fb88b2beffd6502d2", "score": "0.6395132", "text": "func (j *ResponseError) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"code\":`)\n\tfflib.FormatBits2(buf, uint64(j.Code), 10, j.Code < 0)\n\tbuf.WriteString(`,\"message\":`)\n\tfflib.WriteJsonString(buf, string(j.Message))\n\tbuf.WriteString(`,\"data\":`)\n\n\t{\n\n\t\terr = j.Data.MarshalJSONBuf(buf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "7153cfb91abe846bbdd194af546bca04", "score": "0.6376791", "text": "func (j *Subject) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ \"name\":`)\n\tfflib.WriteJsonString(buf, string(j.Name))\n\tbuf.WriteString(`,\"number\":`)\n\tfflib.WriteJsonString(buf, string(j.Number))\n\tbuf.WriteString(`,\"season\":`)\n\tfflib.WriteJsonString(buf, string(j.Season))\n\tbuf.WriteString(`,\"year\":`)\n\tfflib.WriteJsonString(buf, string(j.Year))\n\tbuf.WriteString(`,\"topic_name\":`)\n\tfflib.WriteJsonString(buf, string(j.TopicName))\n\tbuf.WriteString(`,\"topic_id\":`)\n\tfflib.WriteJsonString(buf, string(j.TopicId))\n\tbuf.WriteByte(',')\n\tif len(j.Courses) != 0 {\n\t\tbuf.WriteString(`\"courses\":`)\n\t\tif j.Courses != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Courses {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\n\t\t\t\t{\n\n\t\t\t\t\tif v == nil {\n\t\t\t\t\t\tbuf.WriteString(\"null\")\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\terr = v.MarshalJSONBuf(buf)\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\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Metadata) != 0 {\n\t\tbuf.WriteString(`\"metadata\":`)\n\t\tif j.Metadata != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Metadata {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\n\t\t\t\t{\n\n\t\t\t\t\tif v == nil {\n\t\t\t\t\t\tbuf.WriteString(\"null\")\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\terr = v.MarshalJSONBuf(buf)\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\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "4a892c67220f24f36dbd2fc9b0d2dd1b", "score": "0.63536894", "text": "func (j *AccountBalance) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"id\":`)\n\n\t{\n\n\t\tobj, err = j.ID.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\tbuf.WriteString(`,\"owner\":`)\n\n\t{\n\n\t\tobj, err = j.Owner.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\tbuf.WriteString(`,\"asset_type\":`)\n\n\t{\n\n\t\tobj, err = j.AssetType.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Write(obj)\n\n\t}\n\tbuf.WriteString(`,\"balance\":`)\n\tfflib.FormatBits2(buf, uint64(j.Balance), 10, false)\n\tif j.MaintenanceFlag {\n\t\tbuf.WriteString(`,\"maintenance_flag\":true`)\n\t} else {\n\t\tbuf.WriteString(`,\"maintenance_flag\":false`)\n\t}\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "4b5c9d24bfbc33c5dfaf0aa6e75d99fd", "score": "0.6353058", "text": "func (j *Node) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"children\":`)\n\tif j.Children != nil {\n\t\tbuf.WriteString(`[`)\n\t\tfor i, v := range j.Children {\n\t\t\tif i != 0 {\n\t\t\t\tbuf.WriteString(`,`)\n\t\t\t}\n\n\t\t\t{\n\n\t\t\t\tif v == nil {\n\t\t\t\t\tbuf.WriteString(\"null\")\n\t\t\t\t} else {\n\n\t\t\t\t\terr = v.MarshalJSONBuf(buf)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\tbuf.WriteString(`]`)\n\t} else {\n\t\tbuf.WriteString(`null`)\n\t}\n\tbuf.WriteString(`,\"id\":`)\n\tfflib.WriteJsonString(buf, string(j.ID))\n\tbuf.WriteString(`,\"name\":`)\n\tfflib.WriteJsonString(buf, string(j.Name))\n\tbuf.WriteString(`,\"comment\":`)\n\tfflib.WriteJsonString(buf, string(j.Comment))\n\tbuf.WriteString(`,\"type\":`)\n\tfflib.FormatBits2(buf, uint64(j.Type), 10, j.Type < 0)\n\tbuf.WriteString(`,\"machinereg\":`)\n\tfflib.WriteJsonString(buf, string(j.MachineReg))\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "cb8a162a4999ec4e142074fa5ca52cb4", "score": "0.6352759", "text": "func (j *ResolvedSemester) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ `)\n\tif j.Current != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"current\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.Current.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.Last != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"last\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.Last.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif j.Next != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"next\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.Next.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "fbec7036f72a11a85de8f8968573ee5c", "score": "0.6336454", "text": "func (j *ResponseCountry) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ `)\n\tif j.Data != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"Data\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.Data.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif len(j.Error) != 0 {\n\t\tbuf.WriteString(`\"Error\":`)\n\t\tfflib.WriteJsonString(buf, string(j.Error))\n\t\tbuf.WriteByte(',')\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "1817b97cca06ff84369bb9909df21469", "score": "0.6311813", "text": "func (j *AirportDto) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"ID\":`)\n\tfflib.FormatBits2(buf, uint64(j.ID), 10, j.ID < 0)\n\tbuf.WriteString(`,\"AirportID\":`)\n\tfflib.FormatBits2(buf, uint64(j.AirportID), 10, j.AirportID < 0)\n\tbuf.WriteString(`,\"Name\":`)\n\tfflib.WriteJsonString(buf, string(j.Name))\n\tbuf.WriteString(`,\"City\":`)\n\n\t{\n\n\t\terr = j.City.MarshalJSONBuf(buf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "b156b82b5bf67a28a0587ccd00ee6d97", "score": "0.6283012", "text": "func (j *ResponseErrorData) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"code\":`)\n\tfflib.FormatBits2(buf, uint64(j.Code), 10, j.Code < 0)\n\tbuf.WriteString(`,\"name\":`)\n\tfflib.WriteJsonString(buf, string(j.Name))\n\tbuf.WriteString(`,\"message\":`)\n\tfflib.WriteJsonString(buf, string(j.Message))\n\tbuf.WriteString(`,\"stack\":`)\n\tif j.Stack != nil {\n\t\tbuf.WriteString(`[`)\n\t\tfor i, v := range j.Stack {\n\t\t\tif i != 0 {\n\t\t\t\tbuf.WriteString(`,`)\n\t\t\t}\n\n\t\t\t{\n\n\t\t\t\terr = v.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\tbuf.WriteString(`]`)\n\t} else {\n\t\tbuf.WriteString(`null`)\n\t}\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "002766c426c82f54907a696e8d6ad726", "score": "0.626315", "text": "func (j *NativeRequestVideo) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ `)\n\tif len(j.Mimes) != 0 {\n\t\tbuf.WriteString(`\"mimes\":`)\n\t\tif j.Mimes != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Mimes {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\tfflib.WriteJsonString(buf, string(v))\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.MinDuration != 0 {\n\t\tbuf.WriteString(`\"minduration\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.MinDuration), 10, j.MinDuration < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.MaxDuration != 0 {\n\t\tbuf.WriteString(`\"maxduration\":`)\n\t\tfflib.FormatBits2(buf, uint64(j.MaxDuration), 10, j.MaxDuration < 0)\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Protocols) != 0 {\n\t\tbuf.WriteString(`\"protocols\":`)\n\t\tif j.Protocols != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Protocols {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\tfflib.FormatBits2(buf, uint64(v), 10, v < 0)\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif j.Ext != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"ext\":`)\n\n\t\t\t{\n\n\t\t\t\tobj, err = j.Ext.MarshalJSON()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tbuf.Write(obj)\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "c1aa4260d58fd9b1121061f0c8378823", "score": "0.6257019", "text": "func (j *rpcSubscriptionResponse) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"method\":`)\n\tfflib.WriteJsonString(buf, string(j.Method))\n\tbuf.WriteString(`,\"params\":`)\n\tif j.Params != nil {\n\t\tbuf.WriteString(`[`)\n\t\tfor i, v := range j.Params {\n\t\t\tif i != 0 {\n\t\t\t\tbuf.WriteString(`,`)\n\t\t\t}\n\t\t\t/* Interface types must use runtime reflection. type=interface {} kind=interface */\n\t\t\terr = buf.Encode(v)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tbuf.WriteString(`]`)\n\t} else {\n\t\tbuf.WriteString(`null`)\n\t}\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "491b167e2a309237cb3f43ba1db44ab4", "score": "0.6254556", "text": "func (j *NodeProperty) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"id\":`)\n\tfflib.WriteJsonString(buf, string(j.ID))\n\tbuf.WriteString(`,\"name\":`)\n\tfflib.WriteJsonString(buf, string(j.Name))\n\tbuf.WriteString(`,\"comment\":`)\n\tfflib.WriteJsonString(buf, string(j.Comment))\n\tbuf.WriteString(`,\"type\":`)\n\tfflib.FormatBits2(buf, uint64(j.Type), 10, j.Type < 0)\n\tbuf.WriteString(`,\"machinereg\":`)\n\tfflib.WriteJsonString(buf, string(j.MachineReg))\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "559f07595c2586f280f0a70b392b74ce", "score": "0.6134358", "text": "func genMarshalJSON(mtyp *marshalerType) Function {\n\tvar (\n\t\tm = newMarshalMethod(mtyp, false)\n\t\trecv = m.receiver()\n\t\tintertyp = m.intermediateType(m.scope.newIdent(m.mtyp.orig.Obj().Name()))\n\t\tenc = Name(m.scope.newIdent(\"enc\"))\n\t\tjson = Name(m.scope.parent.packageName(\"encoding/json\"))\n\t)\n\tfn := Function{\n\t\tReceiver: recv,\n\t\tName: \"MarshalJSON\",\n\t\tReturnTypes: Types{{TypeName: \"[]byte\"}, {TypeName: \"error\"}},\n\t\tBody: []Statement{\n\t\t\tdeclStmt{intertyp},\n\t\t\tDeclare{Name: enc.Name, TypeName: intertyp.Name},\n\t\t},\n\t}\n\tfn.Body = append(fn.Body, m.marshalConversions(Name(recv.Name), enc, \"json\")...)\n\tfn.Body = append(fn.Body, Return{Values: []Expression{\n\t\tCallFunction{\n\t\t\tFunc: Dotted{Receiver: json, Name: \"Marshal\"},\n\t\t\tParams: []Expression{AddressOf{Value: enc}},\n\t\t},\n\t}})\n\treturn fn\n}", "title": "" }, { "docid": "01daa4ef56bbd3c685a74e64d7706912", "score": "0.6051879", "text": "func (j *Semester) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{\"year\":`)\n\tfflib.FormatBits2(buf, uint64(j.Year), 10, j.Year < 0)\n\tbuf.WriteString(`,\"season\":`)\n\tfflib.WriteJsonString(buf, string(j.Season))\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "37b483ed389990f8b627169aab3c3b8f", "score": "0.57900417", "text": "func (j *University) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ \"id\":`)\n\tfflib.FormatBits2(buf, uint64(j.Id), 10, j.Id < 0)\n\tbuf.WriteString(`,\"name\":`)\n\tfflib.WriteJsonString(buf, string(j.Name))\n\tbuf.WriteString(`,\"abbr\":`)\n\tfflib.WriteJsonString(buf, string(j.Abbr))\n\tbuf.WriteString(`,\"home_page\":`)\n\tfflib.WriteJsonString(buf, string(j.HomePage))\n\tbuf.WriteString(`,\"registration_page\":`)\n\tfflib.WriteJsonString(buf, string(j.RegistrationPage))\n\tbuf.WriteString(`,\"main_color\":`)\n\tfflib.WriteJsonString(buf, string(j.MainColor))\n\tbuf.WriteString(`,\"accent_color\":`)\n\tfflib.WriteJsonString(buf, string(j.AccentColor))\n\tbuf.WriteString(`,\"topic_name\":`)\n\tfflib.WriteJsonString(buf, string(j.TopicName))\n\tbuf.WriteString(`,\"topic_id\":`)\n\tfflib.WriteJsonString(buf, string(j.TopicId))\n\tbuf.WriteByte(',')\n\tif j.ResolvedSemesters != nil {\n\t\tif true {\n\t\t\tbuf.WriteString(`\"resolved_semesters\":`)\n\n\t\t\t{\n\n\t\t\t\terr = j.ResolvedSemesters.MarshalJSONBuf(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t}\n\tif len(j.Subjects) != 0 {\n\t\tbuf.WriteString(`\"subjects\":`)\n\t\tif j.Subjects != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Subjects {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\n\t\t\t\t{\n\n\t\t\t\t\tif v == nil {\n\t\t\t\t\t\tbuf.WriteString(\"null\")\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\terr = v.MarshalJSONBuf(buf)\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\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.AvailableSemesters) != 0 {\n\t\tbuf.WriteString(`\"available_semesters\":`)\n\t\tif j.AvailableSemesters != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.AvailableSemesters {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\n\t\t\t\t{\n\n\t\t\t\t\tif v == nil {\n\t\t\t\t\t\tbuf.WriteString(\"null\")\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\terr = v.MarshalJSONBuf(buf)\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\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Registrations) != 0 {\n\t\tbuf.WriteString(`\"registrations\":`)\n\t\tif j.Registrations != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Registrations {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\n\t\t\t\t{\n\n\t\t\t\t\tif v == nil {\n\t\t\t\t\t\tbuf.WriteString(\"null\")\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\terr = v.MarshalJSONBuf(buf)\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\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Metadata) != 0 {\n\t\tbuf.WriteString(`\"metadata\":`)\n\t\tif j.Metadata != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Metadata {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\n\t\t\t\t{\n\n\t\t\t\t\tif v == nil {\n\t\t\t\t\t\tbuf.WriteString(\"null\")\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\terr = v.MarshalJSONBuf(buf)\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\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "9d414abf150e6d96f55d571f8b420f06", "score": "0.57866496", "text": "func JSONMarshal(t interface{}) ([]byte, error) {\n\tbuffer := &bytes.Buffer{}\n\tencoder := json.NewEncoder(buffer)\n\tencoder.SetEscapeHTML(false)\n\terr := encoder.Encode(t)\n\treturn buffer.Bytes(), err\n}", "title": "" }, { "docid": "9d414abf150e6d96f55d571f8b420f06", "score": "0.57866496", "text": "func JSONMarshal(t interface{}) ([]byte, error) {\n\tbuffer := &bytes.Buffer{}\n\tencoder := json.NewEncoder(buffer)\n\tencoder.SetEscapeHTML(false)\n\terr := encoder.Encode(t)\n\treturn buffer.Bytes(), err\n}", "title": "" }, { "docid": "37434c10bf325b69747b955c762a2439", "score": "0.57666576", "text": "func JSONMarshal(t interface{}) string {\n\tbuffer := &bytes.Buffer{}\n\tencoder := json.NewEncoder(buffer)\n\tencoder.SetEscapeHTML(false)\n\n\tif err := encoder.Encode(t); err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\treturn buffer.String()\n}", "title": "" }, { "docid": "bac1ef1056aaa4e38bfcd96bf4199405", "score": "0.572966", "text": "func Marshal(payload interface{}) ([]byte, error) {\n\tjsonLock()\n\tdefer jsonUnlock()\n\terr := jsonencoder.Encode(payload)\n\tif err != nil {\n\t\treturn []byte{}, errors.Wrap(err, \"wiz.Marshal\")\n\t}\n\tb := jsonencbuf.Bytes()\n\treturn b, nil\n}", "title": "" }, { "docid": "c8b74997c9f12e5ea24a36b4c80dd00d", "score": "0.5711341", "text": "func (b *Buffer) Json() {\n\tb.appendf(func(w io.Writer, s string) error {\n\t\tt, err := lexj.JSON.Tokenise(nil, s)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn formatters.TTY16m.Format(w, chromaStyle, t)\n\t})\n}", "title": "" }, { "docid": "4b8446c187b61489e55005879be6c2e2", "score": "0.5646835", "text": "func (mp JsoniterMsgPacker) PackMsg(msg interface{}, buf []byte) ([]byte, error) {\n\t// var json = jsoniter.ConfigCompatibleWithStandardLibrary\n\t// err = json.Marshal(msg)\n\n\t// return nil, nil\n\tbuffer := bytes.NewBuffer(buf)\n\tjsonEncoder := jsoniter.NewEncoder(buffer)\n\terr := jsonEncoder.Encode(msg)\n\tif err != nil {\n\t\treturn buf, err\n\t}\n\treturn buffer.Bytes(), nil\n}", "title": "" }, { "docid": "2c162364ffadce6cf346e17fc9f65819", "score": "0.56359476", "text": "func (m *Message) JSONMarshal(b *bytes.Buffer, datasetIndex int) ([]byte, error) {\n\tb.WriteString(\"{\")\n\n\t// encode agent id\n\tm.encodeAgent(b)\n\n\t// encode header\n\tm.encodeHeader(b)\n\n\t// encode data set\n\tif err := m.encodeDataSet(b, datasetIndex); err != nil {\n\t\treturn nil, err\n\t}\n\n\tb.WriteString(\"}\")\n\n\treturn b.Bytes(), nil\n}", "title": "" }, { "docid": "cb126ed7bf118afbf05b774b30a2789d", "score": "0.5633682", "text": "func Marshal(jsonObj interface{}) ([]byte, error) {\n\treturn NewFormatter().Marshal(jsonObj)\n}", "title": "" }, { "docid": "9fb6e06e90ff33091203026a3f7f6ba3", "score": "0.56017166", "text": "func (fb *FieldBuffer) MarshalJSON() ([]byte, error) {\n\treturn JsonDocument{Document: fb}.MarshalJSON()\n}", "title": "" }, { "docid": "d498485cef9b89924602cda369cc6f14", "score": "0.5593043", "text": "func (v *HTTPSpanContext) MarshalFastJSON(w *fastjson.Writer) error {\n\tw.RawByte('{')\n\tfirst := true\n\tif v.URL != nil {\n\t\tbeforeURL := w.Size()\n\t\tw.RawString(`\"url\":\"`)\n\t\tif v.marshalURL(w) {\n\t\t\tw.RawByte('\"')\n\t\t\tfirst = false\n\t\t} else {\n\t\t\tw.Rewind(beforeURL)\n\t\t}\n\t}\n\tif v.StatusCode > 0 {\n\t\tif !first {\n\t\t\tw.RawByte(',')\n\t\t}\n\t\tw.RawString(`\"status_code\":`)\n\t\tw.Int64(int64(v.StatusCode))\n\t}\n\tw.RawByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "e6f0c4f7e8f8b7bdd1ca391305a8a0a0", "score": "0.55856097", "text": "func Marshal(t interface{}) ([]byte, error) {\n\tbuffer := &bytes.Buffer{}\n\tencoder := json.NewEncoder(buffer)\n\tencoder.SetEscapeHTML(false)\n\n\terr := encoder.Encode(t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn bytes.TrimSpace(buffer.Bytes()), nil\n}", "title": "" }, { "docid": "870b2eb9bd74197c3a647290de71ad0f", "score": "0.55281746", "text": "func (m Parameters) Buffer() *bytes.Buffer {\n\tb, err := json.Marshal(m)\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn bytes.NewBuffer(b)\n}", "title": "" }, { "docid": "07ab8c965187d15ec26c36531b823c0b", "score": "0.5516684", "text": "func invokeMarshalJSON(w io.Writer, rv reflect.Value) error {\n\tblob, err := rv.Interface().(json.Marshaler).MarshalJSON()\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = w.Write(blob)\n\treturn err\n}", "title": "" }, { "docid": "8641cc06169d3a4cb220f8195497d7aa", "score": "0.5470933", "text": "func Marshal(v interface{}) ([]byte, error) {\n\tenc := &encoder{buf: new(bytes.Buffer)}\n\tvar data json.RawMessage\n\tvar err error\n\tif data, err = enc.marshal(reflect.ValueOf(v)); err != nil {\n\t\treturn nil, err\n\t}\n\treturn json.Marshal(data)\n}", "title": "" }, { "docid": "25c390355685724ea538861c30b88080", "score": "0.5462324", "text": "func TestJsonWriter_Object(t *testing.T) { // {{{\n\tif obj.JsonWriteTo(jw).HasErrors() {\n\t\tt.Fatal(jw.LastError())\n\t}\n\t// t.Log(buf.Bytes())\n\tt.Log(buf.String())\n\tjw.Release()\n}", "title": "" }, { "docid": "b624b734261d941640b6246dedf110cb", "score": "0.54507184", "text": "func (o UpdateWidgetTemplateBody) MarshalJSON() ([]byte, error) {\n\t_parts := make([][]byte, 0, 2)\n\n\tvar dataUpdateWidgetTemplateParamsBodyAO0 struct {\n\t\tName string `json:\"name,omitempty\"`\n\n\t\tSchema []interface{} `json:\"schema\"`\n\n\t\tStorefrontAPIQuery string `json:\"storefront_api_query,omitempty\"`\n\n\t\tTemplate string `json:\"template,omitempty\"`\n\t}\n\n\tdataUpdateWidgetTemplateParamsBodyAO0.Name = o.Name\n\n\tdataUpdateWidgetTemplateParamsBodyAO0.Schema = o.Schema\n\n\tdataUpdateWidgetTemplateParamsBodyAO0.StorefrontAPIQuery = o.StorefrontAPIQuery\n\n\tdataUpdateWidgetTemplateParamsBodyAO0.Template = o.Template\n\n\tjsonDataUpdateWidgetTemplateParamsBodyAO0, errUpdateWidgetTemplateParamsBodyAO0 := swag.WriteJSON(dataUpdateWidgetTemplateParamsBodyAO0)\n\tif errUpdateWidgetTemplateParamsBodyAO0 != nil {\n\t\treturn nil, errUpdateWidgetTemplateParamsBodyAO0\n\t}\n\t_parts = append(_parts, jsonDataUpdateWidgetTemplateParamsBodyAO0)\n\tvar dataUpdateWidgetTemplateParamsBodyAO1 struct {\n\t\tCreateNewVersion bool `json:\"create_new_version,omitempty\"`\n\t}\n\n\tdataUpdateWidgetTemplateParamsBodyAO1.CreateNewVersion = o.CreateNewVersion\n\n\tjsonDataUpdateWidgetTemplateParamsBodyAO1, errUpdateWidgetTemplateParamsBodyAO1 := swag.WriteJSON(dataUpdateWidgetTemplateParamsBodyAO1)\n\tif errUpdateWidgetTemplateParamsBodyAO1 != nil {\n\t\treturn nil, errUpdateWidgetTemplateParamsBodyAO1\n\t}\n\t_parts = append(_parts, jsonDataUpdateWidgetTemplateParamsBodyAO1)\n\treturn swag.ConcatJSON(_parts...), nil\n}", "title": "" }, { "docid": "4a12dfd4e8f096c6c58d051a1d325c5e", "score": "0.54357255", "text": "func JSON(jo *JSONOptions) ([]byte, error) { return jsonFunc(globalFaker.Rand, jo) }", "title": "" }, { "docid": "de61f24c67f49641133b6f876fcdc6a4", "score": "0.542563", "text": "func Marshal( T interface{} ) []byte {\n // for development and testing, we'll use a prettier output\n\tj, _ := json.MarshalIndent(T, \"\", \" \")\n return j\n}", "title": "" }, { "docid": "731e1e4cee6458ab78ecd8d1ce030211", "score": "0.53937376", "text": "func (m PlacementPut) MarshalJSON() ([]byte, error) {\n\t_parts := make([][]byte, 0, 2)\n\n\tvar dataAO0 struct {\n\t\tTemplateFile string `json:\"template_file,omitempty\"`\n\n\t\tWidgetUUID string `json:\"widget_uuid,omitempty\"`\n\t}\n\n\tdataAO0.TemplateFile = m.TemplateFile\n\n\tdataAO0.WidgetUUID = m.WidgetUUID\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\tvar dataAO1 struct {\n\t\tEntityID string `json:\"entity_id,omitempty\"`\n\n\t\tRegion string `json:\"region,omitempty\"`\n\n\t\tSortOrder int64 `json:\"sort_order,omitempty\"`\n\n\t\tStatus *string `json:\"status,omitempty\"`\n\t}\n\n\tdataAO1.EntityID = m.EntityID\n\n\tdataAO1.Region = m.Region\n\n\tdataAO1.SortOrder = m.SortOrder\n\n\tdataAO1.Status = m.Status\n\n\tjsonDataAO1, errAO1 := swag.WriteJSON(dataAO1)\n\tif errAO1 != nil {\n\t\treturn nil, errAO1\n\t}\n\t_parts = append(_parts, jsonDataAO1)\n\treturn swag.ConcatJSON(_parts...), nil\n}", "title": "" }, { "docid": "36fadf3f186bb6c8bb9e85a255d11fa9", "score": "0.5391532", "text": "func JSONBytesIndent[T constraints.Ordered](ss []T, prefix, indent string) []byte {\n\tif ss == nil {\n\t\treturn []byte(\"[]\")\n\t}\n\n\t// An error should not be possible.\n\tdata, _ := json.MarshalIndent(ss, prefix, indent)\n\n\treturn data\n}", "title": "" }, { "docid": "d04abb788547133b45e92782730364f0", "score": "0.53862613", "text": "func JSONFormat(b []byte, w io.Writer) {\n\tvar out bytes.Buffer\n\tif err := json.Indent(&out, b, \"\", \"\\t\"); err != nil {\n\t\t// reset out since it may have partial output from above.\n\t\tout.Reset()\n\t\t// indentation failed, so write the original string as is.\n\t\tout.Write(b)\n\t\tout.Write([]byte(\"\\n\"))\n\t\tout.WriteTo(w)\n\t\treturn\n\t}\n\tout.Write([]byte(\"\\n\"))\n\tout.WriteTo(w)\n}", "title": "" }, { "docid": "2b6898e6cf22136f0a55438b1b4ec276", "score": "0.53809065", "text": "func (e JsonEncoding) Marshal(file *os.File, message *Message) {\n\tjs, err := json.Marshal(message)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif _, err := file.Write(js); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "c1293cc94df714982e9c2e4098a17c34", "score": "0.5365549", "text": "func (f *Funcs) jsonfn(v interface{}) (string, error) {\n\tz := json.MarshalIndent\n\tif f.ugly {\n\t\tz = uglyMarshal\n\t}\n\t// marshal\n\tbuf, err := z(v, \"\", f.indent)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(buf), nil\n}", "title": "" }, { "docid": "a5880eae029a50437cce322af52624a7", "score": "0.53418374", "text": "func (j *JSONFormat) Marshal(v interface{}) ([]byte, error) {\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "cde04c626a8b5cb07b58a791a8736cfd", "score": "0.5339791", "text": "func Marshal(i interface{}) (string, error) {\n\tstream := json.ConfigFastest.BorrowStream(nil)\n\tdefer json.ConfigFastest.ReturnStream(stream)\n\n\tstream.WriteVal(i)\n\tif stream.Error != nil {\n\t\treturn \"\", errors.New(\"failed to marshal object\")\n\t}\n\treturn string(stream.Buffer()), nil\n}", "title": "" }, { "docid": "4c72c9a55e52cdeb45d6be8aee8bbe99", "score": "0.53397083", "text": "func TestEncodeMarshalJSON(t *testing.T) {\n\n\tfoo := Foo {\n\t\tBar: 123,\n\t}\n\tshould := require.New(t)\n\tvar buf, stdbuf bytes.Buffer\n\tenc := jsoniter.ConfigCompatibleWithStandardLibrary.NewEncoder(&buf)\n\tenc.Encode(foo)\n\tstdenc := json.NewEncoder(&stdbuf)\n\tstdenc.Encode(foo)\n\tshould.Equal(stdbuf.Bytes(), buf.Bytes())\n}", "title": "" }, { "docid": "f0096daecc59a3c59d1b19c77a396aa2", "score": "0.5335108", "text": "func MarshalJSON(jsonContent *json.Json) string {\n\tjsonByte, err := jsonContent.Encode()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn string(jsonByte)\n}", "title": "" }, { "docid": "c237d494a22d15f378fde121d6301e24", "score": "0.53264326", "text": "func (e *exporter) marshallToJson(obj interface{}) ([]byte, error) {\n\tbuff := bytes.NewBuffer([]byte{})\n\tjsonEncoder := json.NewEncoder(buff)\n\tjsonEncoder.SetIndent(\"\", \" \")\n\tjsonEncoder.SetEscapeHTML(false)\n\terr := jsonEncoder.Encode(obj)\n\treturn buff.Bytes(), err\n}", "title": "" }, { "docid": "abad5b8d05318d480cfd9897e61df2eb", "score": "0.53089905", "text": "func (msg MsgCreatePost) MarshalJSON() ([]byte, error) {\n\ttype temp MsgCreatePost\n\treturn json.Marshal(temp(msg))\n}", "title": "" }, { "docid": "9724ff047a1880ac354c86fbb7532c3d", "score": "0.53038424", "text": "func (lp LogPcntl) MarshalJSON() ([]byte, error) {\n\tjsonFmt := \"\\\"%g\\\": {\\\"time\\\": %d, \\\"value\\\": %d, \\\"idx\\\": %d}%s\"\n\tmax := fmt.Sprintf(jsonFmt, math.MaxFloat64, math.MaxInt32, math.MaxInt32, math.MaxInt32, \",\")\n\tbuf := make([]byte, len(lp)*len(max)+4)\n\n\t// copy the keys to a list for sorting so they're in order in the output\n\tcount := 0\n\tkeys := make([]float64, len(lp))\n\tfor key, _ := range lp {\n\t\tkeys[count] = key\n\t\tcount++\n\t}\n\n\tsort.Float64s(keys)\n\n\tsep := \",\"\n\tbuf[0] = '{'\n\tbufidx := 1\n\tfor i, key := range keys {\n\t\tif i == len(keys)-1 {\n\t\t\tsep = \"\"\n\t\t}\n\t\tout := fmt.Sprintf(jsonFmt, key, lp[key].Time, lp[key].Val, lp[key].Idx, sep)\n\t\toutbytes := []byte(out)\n\t\tbufidx += copy(buf[bufidx:bufidx+len(outbytes)], outbytes)\n\t}\n\tbuf[bufidx] = '}'\n\n\t// buf was overallocated generously, return a precisely sized array\n\tout := make([]byte, bufidx+1)\n\tcopy(out, buf[0:bufidx+1])\n\n\treturn out, nil\n}", "title": "" }, { "docid": "b24ddea7f0e79dd5da910213447ca648", "score": "0.5295155", "text": "func hookJSON(ctx *gin.Context) {\n\tvar hook tat.HookJSON\n\tctx.BindJSON(&hook)\n\n\tif hook.HookMessage == nil || hook.HookMessage.MessageJSONOut == nil || hook.Hook.Destination == \"\" {\n\t\tlog.Errorf(\"Invalid HookJSON received %+v\", hook)\n\t\tctx.JSON(http.StatusBadRequest, \"Invalid HookJSON received\")\n\t\treturn\n\t}\n\n\tkey := getHeader(ctx, tat.HookTat2XMPPHeaderKey)\n\tif key == \"\" || key != viper.GetString(\"hook_key\") {\n\t\tctx.JSON(http.StatusBadRequest, \"Invalid key received\")\n\t\treturn\n\t}\n\n\tctx.JSON(http.StatusCreated, fmt.Sprintf(\"Message received\"))\n\n\tgo hookProcess(hook)\n}", "title": "" }, { "docid": "d3bb83081e65c4efe4b3ae67c814e10d", "score": "0.528764", "text": "func (t *JsonProducer) Marshal(input interface{}) ([]byte, error) {\n\treturn json.Marshal(input)\n}", "title": "" }, { "docid": "29387fef46b636565c80c81ae3a98910", "score": "0.52841413", "text": "func JSONMarshaling(t *testing.T, v interface{}) {\n\tt.Helper()\n\n\tglobal.JSONMarshaling(t, v)\n}", "title": "" }, { "docid": "e648d80b48b51683269c9a7df9e067fc", "score": "0.5280984", "text": "func (r ProtoBuf) Render(w http.ResponseWriter) error {\n\tr.WriteContentType(w)\n\n\tresult, err := protobufToMap(r.Data)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// 自定义外层数据格式\n\tjsonBytes, err := json.Marshal(Success(result))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = w.Write(jsonBytes)\n\treturn err\n}", "title": "" }, { "docid": "45eb243f34221b9bb75a023eee11222f", "score": "0.52803373", "text": "func (o UpdateWidgetTemplateOKBody) MarshalJSON() ([]byte, error) {\n\t_parts := make([][]byte, 0, 2)\n\n\tvar dataUpdateWidgetTemplateOKBodyAO0 struct {\n\t\tData struct {\n\n\t\t\t// The user-friendly name.\n\t\t\tName string `json:\"name,omitempty\"`\n\n\t\t\t// The schema for the widget's merchant-facing UI. For more information on the available schema settings, see [Widget UI Schema](https://developer.bigcommerce.com/stencil-docs/page-builder/widget-ui-schema).\n\t\t\tSchema []interface{} `json:\"schema\"`\n\n\t\t\t// The GraphQL Storefront API query that provides widget data.\n\t\t\tStorefrontAPIQuery string `json:\"storefront_api_query,omitempty\"`\n\n\t\t\t// The widget template HTML. Supports Handlebars and Paper helpers.\n\t\t\tTemplate string `json:\"template,omitempty\"`\n\n\t\t\t// The identifier to the current version of this widget template.\n\t\t\tCurrentVersionUUID string `json:\"current_version_uuid,omitempty\"`\n\n\t\t\t// The date on which this object was initially created.\n\t\t\t// Format: datetime\n\t\t\tDateCreated strfmt.DateTime `json:\"date_created,omitempty\"`\n\n\t\t\t// The date on which this object was last updated.\n\t\t\t// Format: datetime\n\t\t\tDateModified strfmt.DateTime `json:\"date_modified,omitempty\"`\n\n\t\t\t// A read-only value. Do not attempt to set or modify this value in a POST or PUT operation.\n\t\t\tIconName *string `json:\"icon_name,omitempty\"`\n\n\t\t\t// The kind of widget template.\n\t\t\tKind string `json:\"kind,omitempty\"`\n\n\t\t\t// The primary identifier.\n\t\t\t// Format: uuid\n\t\t\tUUID strfmt.UUID `json:\"uuid,omitempty\"`\n\t\t} `json:\"data,omitempty\"`\n\t}\n\n\tdataUpdateWidgetTemplateOKBodyAO0.Data = o.Data\n\n\tjsonDataUpdateWidgetTemplateOKBodyAO0, errUpdateWidgetTemplateOKBodyAO0 := swag.WriteJSON(dataUpdateWidgetTemplateOKBodyAO0)\n\tif errUpdateWidgetTemplateOKBodyAO0 != nil {\n\t\treturn nil, errUpdateWidgetTemplateOKBodyAO0\n\t}\n\t_parts = append(_parts, jsonDataUpdateWidgetTemplateOKBodyAO0)\n\tvar dataUpdateWidgetTemplateOKBodyAO1 struct {\n\t\tMeta interface{} `json:\"meta,omitempty\"`\n\t}\n\n\tdataUpdateWidgetTemplateOKBodyAO1.Meta = o.Meta\n\n\tjsonDataUpdateWidgetTemplateOKBodyAO1, errUpdateWidgetTemplateOKBodyAO1 := swag.WriteJSON(dataUpdateWidgetTemplateOKBodyAO1)\n\tif errUpdateWidgetTemplateOKBodyAO1 != nil {\n\t\treturn nil, errUpdateWidgetTemplateOKBodyAO1\n\t}\n\t_parts = append(_parts, jsonDataUpdateWidgetTemplateOKBodyAO1)\n\treturn swag.ConcatJSON(_parts...), nil\n}", "title": "" }, { "docid": "505e118e7a50935471dbfef790238feb", "score": "0.5262704", "text": "func (r JSONPB) Render(w http.ResponseWriter) (err error) {\n\tif err = WriteJSONPB(w, r.Data); err != nil {\n\t\tpanic(err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "65353bbf693830c0ac884ea228004bd2", "score": "0.5257072", "text": "func Marshal(c echo.Context, obj interface{}) ([]byte, error) {\n\treturn jsonConfig().Marshal(obj)\n}", "title": "" } ]
919c4ca52ece4a28914bc160c76374f1
init sets initial states for checklist sets.
[ { "docid": "e9981776b0e9f6c546d434945ee7993b", "score": "0.5903179", "text": "func (a *Agent) init() error {\n\tif a.log == nil {\n\t\ta.log = zap.NewNop()\n\t}\n\tif a.ta == 0 {\n\t\ta.ta = defaultAgentTa\n\t}\n\tif a.t == nil {\n\t\ta.t = make(map[transactionID]*agentTransaction)\n\t}\n\tif a.rand == nil {\n\t\ta.rand = rand.Reader\n\t}\n\t// Generating random tiebreaker number.\n\ttbValue, err := randUint64(a.rand)\n\tif err != nil {\n\t\treturn err\n\t}\n\ta.tiebreaker = tbValue\n\ta.foundations = a.foundations[:0]\n\t// Gathering all unique foundations.\n\tfoundations := make(foundationSet)\n\tfor _, c := range a.set {\n\t\tfor i := range c.Pairs {\n\t\t\tpair := c.Pairs[i]\n\t\t\tif foundations.Contains(pair.Foundation) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfoundations.Add(pair.Foundation)\n\t\t\ta.foundations = append(a.foundations, pair.Foundation)\n\t\t}\n\t}\n\t// For each foundation, the agent sets the state of exactly one\n\t// candidate pair to the Waiting state (unfreezing it). The\n\t// candidate pair to unfreeze is chosen by finding the first\n\t// candidate pair (ordered by the lowest component ID and then the\n\t// highest priority if component IDs are equal) in the first\n\t// checklist (according to the usage-defined checklist set order)\n\t// that has that foundation.\n\tfor _, f := range a.foundations {\n\t\tfor _, c := range a.set {\n\t\t\tfor i := range c.Pairs {\n\t\t\t\tif !bytes.Equal(c.Pairs[i].Foundation, f) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tc.Pairs[i].State = PairWaiting\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\ta.checklist = noChecklist\n\treturn nil\n}", "title": "" } ]
[ { "docid": "87fa0cd0c01c47de8204b1861ac2431e", "score": "0.6223684", "text": "func setInitialStates(m *maze.Maze) *maze.Maze {\n\t// m = states.Empty(m)\n\t// m = states.Concrete(m)\n\tm = states.Random(m)\n\treturn m\n}", "title": "" }, { "docid": "e08e32190bd9138c975baf9215ab72e4", "score": "0.611195", "text": "func init() {\n\tonce.Do(initialiseList)\n}", "title": "" }, { "docid": "9cf2751ca5b97a3238e8d69f45ddc975", "score": "0.5990585", "text": "func (app *BaseApp) setCheckState(header abci.Header) {\n\tms := app.cms.CacheMultiStore()\n\tapp.checkState = &state{\n\t\tms: ms,\n\t\tctx: sdk.NewContext(ms, header, true, app.logger).WithMinGasPrices(app.minGasPrices),\n\t}\n}", "title": "" }, { "docid": "3597340ba93298de8fe07b14b9396ffe", "score": "0.59354794", "text": "func (self *Workloads) Init() *Workloads {\n\tif self.WorkloadList == nil {\n\t\tself.WorkloadList = make([]*Workload, 0)\n\t}\n\treturn self\n}", "title": "" }, { "docid": "2f2daaa42fd5318f481583fc7edd2add", "score": "0.58626235", "text": "func (a *Agent) PrepareChecklistSet() error {\n\tif len(a.remoteCandidates) != len(a.localCandidates) {\n\t\treturn errStreamCountMismatch\n\t}\n\tfor streamID := 0; streamID < len(a.localCandidates); streamID++ {\n\t\tvar localCandidates []Candidate\n\t\tfor i := range a.localCandidates[streamID] {\n\t\t\tlocalCandidates = append(localCandidates, a.localCandidates[streamID][i].candidate)\n\t\t}\n\t\tpairs := NewPairs(localCandidates, a.remoteCandidates[streamID])\n\t\tlist := Checklist{Pairs: pairs}\n\t\tlist.ComputePriorities(a.role)\n\t\tlist.Sort()\n\t\tlist.Prune()\n\t\tlist.Limit(a.maxChecks)\n\t\ta.set = append(a.set, list)\n\t}\n\treturn a.init()\n}", "title": "" }, { "docid": "fd704b8a36a6e76e9ee6d417b3e0d8c6", "score": "0.58598375", "text": "func (l *List) Init() *List", "title": "" }, { "docid": "604475ea5f21ad35fc439dbbdfc18ac7", "score": "0.57590157", "text": "func init() {\n\tlog.Logger.Infof(\"Initializing health check and uptime\")\n\t// Set start time to now\n\tstartTime = time.Now().UTC()\n\n\tMainCheck = NewCheck()\n}", "title": "" }, { "docid": "2211a7ac78392b9e83f33288e747ce5c", "score": "0.57126707", "text": "func (rf *Raft) leaderStateInit(){\n\n\trf.nextIndex[rf.me] = rf.getLogLen()\n\trf.matchIndex[rf.me] = rf.getLogLen()-1\n\n\tfor i := range rf.peers{\n\n\t\tif i!=rf.me{\n\t\t\trf.nextIndex[i] = rf.getLogLen()\n\t\t\trf.matchIndex[i] = 0\n\t\t}\n\n\t}\n\n\n\n}", "title": "" }, { "docid": "82463d416e8e1162fecdf47b5597e992", "score": "0.5707675", "text": "func (c *Cache) init() {\n\tif atomic.LoadInt32(&c.nshards) != 0 {\n\t\treturn\n\t}\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\tif c.nshards == 0 {\n\t\tc.shards = []*shard{newShard(c)}\n\t\tatomic.StoreInt32(&c.nshards, 1)\n\t}\n}", "title": "" }, { "docid": "a862ec09f5f8f06df1582290507472a0", "score": "0.5674418", "text": "func init() {\n\t_ = diffusion.Diffusion{}\n\t_ = porous.SolidLiquid{}\n\t_ = seepage.Liquid{}\n\t_ = solid.Solid{}\n\t_ = thermomech.SolidThermal{}\n}", "title": "" }, { "docid": "c1bd2a463271393ba7dc7e8b750d79a7", "score": "0.5667755", "text": "func init() {\n\tn := len(staticPullStatusInfoSlice)\n\tstaticPullStatusInfoFromLabel = make(map[string]*staticStatusInfo, n)\n\tif n > 0 {\n\t\tfor i := 1; i < n; i++ {\n\t\t\tstaticPullStatusInfoSlice[i].weightBefore = staticPullStatusInfoSlice[i-1].weightBefore + staticPullStatusInfoSlice[i-1].weight\n\t\t}\n\t\tmaxPullWeight = staticPullStatusInfoSlice[n-1].weightBefore + staticPullStatusInfoSlice[n-1].weight\n\t\tfor _, item := range staticPullStatusInfoSlice {\n\t\t\tfor _, label := range item.labels {\n\t\t\t\tstaticPullStatusInfoFromLabel[label] = item\n\t\t\t}\n\t\t}\n\t}\n\tn = len(staticPushStatusInfoSlice)\n\tstaticPushStatusInfoFromLabel = make(map[string]*staticStatusInfo, n)\n\tif n > 0 {\n\t\tfor i := 1; i < n; i++ {\n\t\t\tstaticPushStatusInfoSlice[i].weightBefore = staticPushStatusInfoSlice[i-1].weightBefore + staticPushStatusInfoSlice[i-1].weight\n\t\t}\n\t\tmaxPushWeight = staticPushStatusInfoSlice[n-1].weightBefore + staticPushStatusInfoSlice[n-1].weight\n\t\tfor _, item := range staticPushStatusInfoSlice {\n\t\t\tfor _, label := range item.labels {\n\t\t\t\tstaticPushStatusInfoFromLabel[label] = item\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a52e71bd283262883edbd0547cd680be", "score": "0.5654959", "text": "func (n *NFD) init(\n\tr *NodeFeatureDiscoveryReconciler,\n\ti *nfdv1.NodeFeatureDiscovery,\n) {\n\tn.rec = r\n\tn.ins = i\n\tn.idx = 0\n\tif len(n.controls) == 0 {\n\t\tn.addState(\"/opt/nfd/master\")\n\t\tn.addState(\"/opt/nfd/worker\")\n\t\tn.addState(\"/opt/nfd/topologyupdater\")\n\t}\n}", "title": "" }, { "docid": "d11c89236f60d9045ba26165b9cec250", "score": "0.56253374", "text": "func init() {\n\ttotalSize := heapEnd - heapStart\n\n\t// Allocate some memory to keep 2 bits of information about every block.\n\tmetadataSize := totalSize / (blocksPerStateByte * bytesPerBlock)\n\n\t// Align the pool.\n\tpoolStart = (heapStart + metadataSize + (bytesPerBlock - 1)) &^ (bytesPerBlock - 1)\n\tpoolEnd := heapEnd &^ (bytesPerBlock - 1)\n\tnumBlocks := (poolEnd - poolStart) / bytesPerBlock\n\tendBlock = gcBlock(numBlocks)\n\tif gcDebug {\n\t\tprintln(\"heapStart: \", heapStart)\n\t\tprintln(\"heapEnd: \", heapEnd)\n\t\tprintln(\"total size: \", totalSize)\n\t\tprintln(\"metadata size: \", metadataSize)\n\t\tprintln(\"poolStart: \", poolStart)\n\t\tprintln(\"# of blocks: \", numBlocks)\n\t\tprintln(\"# of block states:\", metadataSize*blocksPerStateByte)\n\t}\n\tif gcAsserts && metadataSize*blocksPerStateByte < numBlocks {\n\t\t// sanity check\n\t\truntimePanic(\"gc: metadata array is too small\")\n\t}\n\n\t// Set all block states to 'free'.\n\tmemzero(unsafe.Pointer(heapStart), metadataSize)\n}", "title": "" }, { "docid": "ddc7ab4c1e8eaea329e085eccfbe0afd", "score": "0.55811185", "text": "func (m Master_Data) init(num int) Master_Data {\n\n\tm.Number_Workers = num\n\n\tfor i := 0; i < num; i++ {\n\t\tm.ws = append(m.ws, Worker_Status{i, \"idle\"})\n\t}\n\treturn m\n}", "title": "" }, { "docid": "dbec58e83b2cf889d48295a85ace2749", "score": "0.5564265", "text": "func (r *lriterator) init(xctn lrxact, t cluster.Target, msg *apc.ListRange) {\n\tr.xctn = xctn\n\tr.t = t\n\tr.ctx = context.Background()\n\tr.msg = msg\n}", "title": "" }, { "docid": "96ec5da03751f83d6061016f3b65a84a", "score": "0.5560441", "text": "func init() {\n\treferenceRunsTotp = createReferenceRunsTotp()\n\treferenceRunsHotp = createReferenceRunsHotp()\n}", "title": "" }, { "docid": "7bf4cc8f895a4a2da251c7d6b54f7551", "score": "0.55567414", "text": "func (t *Tree) Init(c CompareFunc, flags byte) *Tree {\n\tt.compare = c\n\tt.root = nil\n\tt.treeFlags = flags\n\treturn t\n}", "title": "" }, { "docid": "86a6ffe19e284d6ebd0ae0642ff64233", "score": "0.55556697", "text": "func (l *LruList[K, V]) Init() *LruList[K, V] {\n\tl.root.next = &l.root\n\tl.root.prev = &l.root\n\tl.len = 0\n\treturn l\n}", "title": "" }, { "docid": "d4c93a2a0dcbb1accf13a475f991d8f3", "score": "0.55360466", "text": "func init() {\n\n\t// init sbc\n\tSBC = data.NewBlockChain()\n\n\t// init data structures\n\tidentityMap = make(map[int32]data.Identity)\n\tuserPubKeyMap = make(map[int32]string)\n\tcompPubKeyMap = make(map[string]string)\n\n\t// init Caches\n\tapplicationCache = make(map[int32]data.Merit)\n\tacceptanceCache = make(map[string]int32)\n\t// First 0-99 are reserved for potential testing\n\tUID = 99\n\n\tgo startTickin()\n}", "title": "" }, { "docid": "47197e0f66538f730b85e2e0c7cf6d9d", "score": "0.55290335", "text": "func decisionInit() {\n\t_mtxCostFuncVar = sync.Mutex{}\n\t_mtxCostFuncVar.Lock()\n\tdefer _mtxCostFuncVar.Unlock()\n\t_costFuncVar.ElevatorStates = map[string]elevator.Elevator{}\n\t_costFuncVar.OnlineElevators = map[string]bool{}\n}", "title": "" }, { "docid": "52bf8375e3978c5a834d458ce7405d03", "score": "0.55188787", "text": "func (l *VersionList) Init(mu *sync.Mutex) {\n\tl.mu = mu\n\tl.root.next = &l.root\n\tl.root.prev = &l.root\n}", "title": "" }, { "docid": "2f979971256d27d9443cd9a696d7afc8", "score": "0.54967743", "text": "func (t *Trie) init() {\n\tt.head = &node{\"\", nil, make(map[rune]*node)}\n}", "title": "" }, { "docid": "6f13ac889985c02c00db903d06684aff", "score": "0.5496658", "text": "func (g *Graph) init() {\n\tif g.nodeByID == nil {\n\t\tg.nodeByID = make(map[string]Node)\n\t}\n\tif g.nodes == nil {\n\t\tg.nodes = make(nodeSet)\n\t}\n\tif g.outEdges == nil {\n\t\tg.outEdges = make(map[Node]nodeSet)\n\t}\n\tif g.inEdges == nil {\n\t\tg.inEdges = make(map[Node]nodeSet)\n\t}\n}", "title": "" }, { "docid": "a215cd7b180f4bc507736075030fcf75", "score": "0.54923594", "text": "func init() {\n\tcheckKeys = make(map[ZobristCode]int64, checkKeysNeeded)\n\tZSeed = (2 * 3 * 5 * 7 * 11) - 1\n\trand.Seed(ZSeed)\n\tvar i, j uint8\n\tfor i = 0; i < MaxBoardSize; i += 1 {\n\t\tfor j = 0; j < MaxBoardSize; j += 1 {\n\t\t\tBlackZKey[i][j] = newZobristKey()\n\t\t\tWhiteZKey[i][j] = newZobristKey()\n\t\t\tKoZKey[i][j] = newZobristKey()\n\t\t}\n\t}\n\t//\tBlackToPlayZKey = newZobristKey()\n\tWhiteToPlayZKey = newZobristKey()\n}", "title": "" }, { "docid": "c08f57f43b684d191d40a761ab19da02", "score": "0.5483256", "text": "func initialiseList() {\n\tlist = []Todo{}\n}", "title": "" }, { "docid": "ba7c37578cf7816d87135afbb618dd00", "score": "0.54625154", "text": "func TestInit(t *testing.T) {\n\tsetup()\n\tlogList.front = &Element{}\n\tlogList.length = 77\n\tlogList.tolerance = 5\n\tlogList.Init()\n\tif logList.front != nil {\n\t\tt.Fail()\n\t}\n\tif logList.length != 0 {\n\t\tt.Fail()\n\t}\n\tif logList.tolerance != 0 {\n\t\tt.Fail()\n\t}\n}", "title": "" }, { "docid": "9292aa8734895b4ac27e129dc6ca8029", "score": "0.5453706", "text": "func (this *TernarySearchTree) Init() {\n\tthis.length = 0\n\tthis.root = nil\n}", "title": "" }, { "docid": "2af81b33a4d7eaad6a44be1feeb6b04c", "score": "0.54480064", "text": "func (apr *ActivePushReplicator) _initCheckpointer(remoteCheckpoints []replicationCheckpoint) error {\n\t// wrap the replicator context with a cancelFunc that can be called to abort the checkpointer from _disconnect\n\tapr.checkpointerCtx, apr.checkpointerCtxCancel = context.WithCancel(apr.ctx)\n\n\terr := apr.forEachCollection(func(c *activeReplicatorCollection) error {\n\t\tcheckpointHash, hashErr := apr.config.CheckpointHash(c.collectionIdx)\n\t\tif hashErr != nil {\n\t\t\treturn hashErr\n\t\t}\n\n\t\tc.Checkpointer = NewCheckpointer(apr.checkpointerCtx, c.metadataStore, c.collectionDataStore, apr.CheckpointID, checkpointHash, apr.blipSender, apr.config, c.collectionIdx)\n\n\t\tif apr.config.CollectionsEnabled {\n\t\t\terr := c.Checkpointer.setLastCheckpointSeq(&remoteCheckpoints[*c.collectionIdx])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\terr := c.Checkpointer.fetchDefaultCollectionCheckpoints()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tif err := apr.registerCheckpointerCallbacks(c); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tc.Checkpointer.Start()\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "874472bb960397662ce1aa70842eef59", "score": "0.5444009", "text": "func (s *structure) initialize() {\n\ts.Lock()\n\tdefer s.Unlock()\n\tprojectMap := map[string]project{}\n\tnamespaceMap := map[string]map[string]namespace{}\n\tfor _, p := range s.ProjectList {\n\t\tprojectMap[p.Name] = p\n\t\tnamespaceMap[p.Name] = map[string]namespace{}\n\t\tfor _, n := range p.Namespaces {\n\t\t\tnamespaceMap[p.Name][n.Name] = n\n\t\t}\n\t}\n\ts.ProjectMap = projectMap\n\ts.NamespaceMap = namespaceMap\n}", "title": "" }, { "docid": "d966714d49036e35877c8168ab6bb25a", "score": "0.53898966", "text": "func (l *List) Init() *List {\n\tl.root.next = &l.root\n\tl.root.prev = &l.root\n\tl.len = 0\n\treturn l\n}", "title": "" }, { "docid": "d966714d49036e35877c8168ab6bb25a", "score": "0.53898966", "text": "func (l *List) Init() *List {\n\tl.root.next = &l.root\n\tl.root.prev = &l.root\n\tl.len = 0\n\treturn l\n}", "title": "" }, { "docid": "7668a3eea81aa0ab2a48bef38173a8e0", "score": "0.5389292", "text": "func init () () {\n\tvar i uint = 0\n\tvar j uint = 0\n\t\n\tfor i=0; i < maxnodes; i++ {\n\t\tthisDag.g[i].id=-1\n\t\tthisDag.g[i].weight=-1\n\t\tthisDag.g[i].level=-1\n\t\tfor j=0; j < maxnodes; j++ {\n\t\t\tthisDag.g[i].children[j].id=-1\n\t\t\tthisDag.g[i].children[j].ccost=-1\n\t\t}\n\t}\n\treturn\n\t\n}", "title": "" }, { "docid": "417fbb4eb7e0b11d97828a981bfe5034", "score": "0.53856415", "text": "func (s *FastSolve) init() {\n\ts.n = [9]Number{}\n\ts.fr, s.fc, s.fb = [9]int{}, [9]int{}, [9]int{}\n\ts.cnt = 0\n\tfor i := range s.b.cell {\n\t\tfor j := range s.b.cell[i] {\n\t\t\tif s.b.cell[i][j] == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ts.AddStat(j, i, s.b.cell[i][j])\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cba8f634c47276e2ab5edbcd02b60ca9", "score": "0.5371449", "text": "func init() {\n\t// Set debug flag\n\tDEBUG, _ = os.LookupEnv(\"DEBUG\")\n\n\tfor i := 0; i < 26; i++ {\n\t\tstack := Storage{\n\t\t\tStorageType: SStack,\n\t\t\tMemory: []int{},\n\t\t}\n\n\t\tstacks = append(stacks, stack)\n\t}\n\n\tqueue = Storage{\n\t\tStorageType: SQueue,\n\t\tMemory: []int{},\n\t}\n\n\tpipe = Storage{\n\t\tStorageType: SPipe,\n\t\tMemory: []int{},\n\t}\n}", "title": "" }, { "docid": "70e2945a43507c3494373cd15e64f553", "score": "0.5369646", "text": "func initializeReplicaStatuses(jobStatus *commonv1.JobStatus, rtype commonv1.ReplicaType) {\n\tif jobStatus.ReplicaStatuses == nil {\n\t\tjobStatus.ReplicaStatuses = make(map[commonv1.ReplicaType]*commonv1.ReplicaStatus)\n\t}\n\n\tjobStatus.ReplicaStatuses[rtype] = &commonv1.ReplicaStatus{}\n}", "title": "" }, { "docid": "4600281331a4f1bfc94a7deebaaef69e", "score": "0.53636646", "text": "func initFlagSet() FlagWrap {\n\tinitSet := flag.NewFlagSet(\"init\", flag.ExitOnError)\n\treturn FlagWrap{\"init\", initSet}\n}", "title": "" }, { "docid": "18c3948ae7323bdecbf59c7b0ab1c0de", "score": "0.53592646", "text": "func (act *ActiveCalculator) Init() *ActiveCalculator {\n\tif act.init {\n\t\treturn act\n\t}\n\tact.init = true\n\n\tsort.Slice(act.states, func(i, j int) bool { return act.states[i].T < act.states[j].T })\n\n\treturn act\n}", "title": "" }, { "docid": "c0567a29829bd8c78f6bb19039c0bab0", "score": "0.5346277", "text": "func (executor *Executor) init() {\n\texecutor.Tasks = []*Task{}\n\texecutor.isRunning = false\n\texecutor.resultChan = make(chan Result)\n\texecutor.summary.successCount = 0\n\texecutor.summary.failedCount = 0\n\texecutor.summary.TaskResults = []*Result{}\n\t// executor.mutex = &sync.Mutex{}\n}", "title": "" }, { "docid": "a5129a038b50f8c85c05702f90079f73", "score": "0.5341664", "text": "func (fs FlagSet) Init(c *cli.Context) error {\n\tfor _, name := range c.LocalFlagNames() {\n\t\tfs[name] = struct{}{}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3e4c20cf903846480e4f3a46d1527871", "score": "0.53178406", "text": "func (s *State) initTables(schema string, whitelist, blacklist []string) error {\n\tvar err error\n\ts.Tables, err = bdb.Tables(s.Driver, schema, whitelist, blacklist)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to fetch table data\")\n\t}\n\n\tif len(s.Tables) == 0 {\n\t\treturn errors.New(\"no tables found in database\")\n\t}\n\n\tif err := checkPKeys(s.Tables); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4f66778886951416414f0d948862911c", "score": "0.53157043", "text": "func (c *City) init() {\n\tc.mutex = &sync.Mutex{}\n}", "title": "" }, { "docid": "8515048a5d62dd950ec95f48255dcbaa", "score": "0.53083014", "text": "func (b *BinarySearchTree)InitFromSlice(s []int)error {\n\tif len(s) < 1 {\n\t\treturn errors.New(\"no elements to initialize from\")\n\t}\n\tb.value = s[0]\n\tfor _, item := range s[1:] {\n\t\tb.Add(item)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "98ca4f3c676d82780054ba0e222bd908", "score": "0.5281334", "text": "func init() {\n\tvalidVersion = map[int]bool{\n\t\tVer1: true,\n\t\tVer2: true,\n\t}\n}", "title": "" }, { "docid": "19c9330437d007a5c1e00f6db5821620", "score": "0.52679384", "text": "func (self *Workload) Init() *Workload {\n\tif self.IpAddresses == nil {\n\t\tself.IpAddresses = make([]string, 0)\n\t}\n\treturn self\n}", "title": "" }, { "docid": "fdec0211fcd29f0ff0c6cfe1e1110ec8", "score": "0.52671206", "text": "func initializeML() {\n\tnode := member{currHost, time.Now().Format(time.RFC850)}\n\tmembershipList = append(membershipList, node)\n}", "title": "" }, { "docid": "45bea739079d9e2384d2d25775d0b135", "score": "0.5264294", "text": "func initialize() {\n\tall_accounts = make(map[string]account)\n\tcommit_log = make([]account_mutator_cmd_data, 0) // size 0 initially \n\taccount_mutator_channel = make(chan account_mutator_cmd, conf.CmdChanDepth) // the channel only blocks if it's full\n\tcommitlog_mutator_channel = make(chan commitlog_mutator_cmd, conf.CmdChanDepth)\n\taccount_mutator_control_channel = make(chan bool)\n\tcommitlog_mutator_control_channel = make(chan bool)\n\t// Start the mutator\n\tgo account_mutator()\n\tgo commitlog_mutator()\n\tif deserialize() {\n\t\treplayCommitLog()\n\t}\n\n}", "title": "" }, { "docid": "96656a6d48d78211ce10289876a061a9", "score": "0.52437925", "text": "func (c *Circonus) initCheck(id string) error {\n\tcheckType := \"httptrap:cua:\"\n\n\tif id == \"*\" {\n\t\tcheckType += \"default\"\n\t} else {\n\t\tcheckType += id\n\t}\n\n\tcfg := &cgm.Config{}\n\tcfg.Debug = c.DebugCGM\n\tif c.DebugCGM {\n\t\tcfg.Log = logshim{logh: c.Log}\n\t}\n\tcfg.CheckManager.API = c.apicfg\n\tif c.Broker != \"\" {\n\t\tcfg.CheckManager.Broker.ID = c.Broker\n\t}\n\tcfg.CheckManager.Check.InstanceID = strings.Replace(checkType, \"httptrap\", c.CheckNamePrefix, 1)\n\tcfg.CheckManager.Check.Type = checkType\n\n\tm, err := cgm.New(cfg)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"initializing cgm instance for %s (%w)\", id, err)\n\t}\n\n\tc.checks[id] = m\n\treturn nil\n}", "title": "" }, { "docid": "be6c745e29a144dd14edd012a0008f01", "score": "0.52378815", "text": "func initStatus(total int) {\n\ttotalCount = total\n}", "title": "" }, { "docid": "c966c7dfcf7bc345d46979cd882f6e00", "score": "0.522918", "text": "func InitLState(target string) (ls *LState) {\n\tls = new(LState)\n\tls.target = []rune(target)\n\n\treturn\n}", "title": "" }, { "docid": "46dfe057f873dda3f1143475899aea73", "score": "0.52270114", "text": "func (t *systemChaincode) init(stub *shim.ChaincodeStub, args []string) ([]byte, error) {\n\tvar vp int64 = 0\n\n\t// Initialize the validity period in the ledger (this needs to be run only once!!!!)\n\terr := stub.PutState(system_validity_period_key, []byte(strconv.FormatInt(vp, 10)))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t\n\treturn nil, nil\n}", "title": "" }, { "docid": "fef529c73f7c38f0c89a25b4aa5504fb", "score": "0.52263594", "text": "func (evh *EventHandlerList) Init(lcores uint) {\n\t*evh = make([](*BitSet), lcores)\n\tfor i := 0 ; i < int(lcores); i++ {\n\t\t(*evh)[i] = new(BitSet)\n\t\t(*evh)[i].Init(EventHandlerListSize)\n // 0 is reserved for event cmd\n (*evh)[i].Set(0)\n\t}\n}", "title": "" }, { "docid": "54999c5b540d8d41751e1287769bc1f3", "score": "0.52220803", "text": "func (s *state) Init() {\n\tif s.pollInterval == 0 {\n\t\ts.pollInterval = ec2PollInterval\n\t}\n\tif s.reconcile == nil {\n\t\ts.reconcile = func(ctx context.Context) error {\n\t\t\tinstances, err := s.getEC2State(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ts.mu.Lock()\n\t\t\tdefer s.mu.Unlock()\n\n\t\t\t// Remove from pool instances that are not available on EC2.\n\t\t\tfor id := range s.pool {\n\t\t\t\tif instances[id] == nil {\n\t\t\t\t\tdelete(s.pool, id)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Add instances on EC2 that are not in the pool.\n\t\t\tfor id, inst := range instances {\n\t\t\t\tif _, ok := s.pool[id]; !ok {\n\t\t\t\t\tbaseurl := fmt.Sprintf(\"https://%s:9000/v1/\", *inst.PublicDnsName)\n\t\t\t\t\tclnt, err := client.New(baseurl, s.c.HTTPClient, nil)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\ts.c.Log.Errorf(\"client %s: %v\", baseurl, err)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\t// Add instance to the pool.\n\t\t\t\t\ts.pool[*inst.InstanceId] = reflowletPool{inst, clnt}\n\t\t\t\t}\n\t\t\t}\n\t\t\ts.c.SetPools(vals(s.pool))\n\t\t\treturn nil\n\t\t}\n\t}\n\ts.pool = make(map[string]reflowletPool)\n\ts.sync = make(chan struct{})\n}", "title": "" }, { "docid": "6f6994e8ba1b769503c79cea24ddda8d", "score": "0.52202374", "text": "func init() {\n\tfor i, v := range nodeConverter.orderedNodesName {\n\t\tnodeConverter.nodeNameToIDMap[v] = graph.NodeID(i)\n\t}\n}", "title": "" }, { "docid": "f1e563eb4d3133a2667a9b0dfc33d4c1", "score": "0.52192444", "text": "func (fmc *FiltersExprMutateChecker) Init(filters FiltersExpr) {\n\t// This initialization pattern ensures that fields are not unwittingly\n\t// reused. Field reuse must be explicit.\n\t*fmc = FiltersExprMutateChecker{}\n\tfmc.hasher.Init()\n\tfmc.hasher.HashFiltersExpr(filters)\n\tfmc.hash = fmc.hasher.hash\n}", "title": "" }, { "docid": "5f8b33f51f6302e4246fe27c516a3cc3", "score": "0.5218576", "text": "func (manager *Manager) init() error {\n\tlog.Println(\"Initializing Assignment manager\")\n\t// TODO: Check actual status of deployed deployments\n\n\t// Start node watcher\n\tw, err := infrastructure.NewNodeWatcher(manager.clientset)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tinstance.nodeWatcher = w\n\n\treturn nil\n}", "title": "" }, { "docid": "977aa3807734890f97310b9730e6f946", "score": "0.5216886", "text": "func (s *State) Init(gs *game.GameState) {\n\ts.Board.Init(&gs.Board)\n\ts.You.Init(&gs.You)\n\n\t// Sort snakes by length\n\t// This allows us to project short snakes avoiding long ones\n\tsort.Slice(s.Board.Snakes, func(i, j int) bool {\n\t\treturn s.Board.Snakes[i].Length > s.Board.Snakes[j].Length\n\t})\n\n\t// Initialize body guesses\n\ts.BodyGuesses = make(SnakeVision, len(s.Board.Snakes))\n\n\tfor i, snake := range s.Board.Snakes {\n\t\tfor _, body := range snake.Body {\n\t\t\ts.BodyGuesses[i].Set(&body, guess.Certain)\n\t\t}\n\t}\n\n\t// Initialize head guesses\n\ts.HeadGuesses = make(SnakeVision, len(s.Board.Snakes))\n\n\tfor i := range s.Board.Snakes {\n\t\ts.HeadGuesses[i].Set(&s.Board.Snakes[i].Head, guess.Certain)\n\t}\n\n\t// Initialize food\n\tfor i := 0; i < len(s.Board.Food); i++ {\n\t\tfood := s.Board.Food[i]\n\t\ts.FoodGuesses.Set(&food, guess.Certain)\n\t}\n}", "title": "" }, { "docid": "782c80cd50870ca57aa0dfd464e2b382", "score": "0.52115065", "text": "func (recv *IntSet) Initialize(line []string) {\n\trecv.set = make(map[int]bool)\n\tfor _, str := range line {\n\t\tnum, _ := strconv.Atoi(str)\n\t\trecv.set[num] = true\n\t}\n}", "title": "" }, { "docid": "cfc822135f1ed84823e429dae6e07c24", "score": "0.5208908", "text": "func (ts *TwoState) Init() {\n\tts.Pos = PosZero\n\tts.NestStack = ts.NestStack[0:0]\n}", "title": "" }, { "docid": "0e909227caadd7dc30fd97134ecbd779", "score": "0.52081424", "text": "func (sl *binarySlush) Initialize(choice int) { sl.preference = choice }", "title": "" }, { "docid": "6c9296510915e44481dfbcab31610b58", "score": "0.5203714", "text": "func (shp *s) init() {\n\t(*shp).clr = termbox.ColorGreen\n\t(*shp).dir = 0\n\n\t// top row\n\t(*shp).blk[0].x = 0\n\t(*shp).blk[0].y = 0\n\t(*shp).blk[1].x = 3\n\t(*shp).blk[1].y = 1\n\t(*shp).blk[2].x = 4\n\t(*shp).blk[2].y = 1\n\t// middle row\n\t(*shp).blk[3].x = 2\n\t(*shp).blk[3].y = 2\n\t(*shp).blk[4].x = 3\n\t(*shp).blk[4].y = 2\n\t(*shp).blk[5].x = 0\n\t(*shp).blk[5].y = 0\n\t// bottom row\n\t(*shp).blk[6].x = 0\n\t(*shp).blk[6].y = 0\n\t(*shp).blk[7].x = 0\n\t(*shp).blk[7].y = 0\n\t(*shp).blk[8].x = 0\n\t(*shp).blk[8].y = 0\n}", "title": "" }, { "docid": "b9a303df4026c5acfda393b001457539", "score": "0.51989365", "text": "func (b *work) init() {\n\tb.initOnce.Do(func() {\n\t\tb.results = make(chan *result)\n\t\tb.stopCh = make(chan struct{}, b.c)\n\t\tb.w = b.writer()\n\t\tb.pool = &sync.WaitGroup{}\n\t\tb.pool.Add(len(b.urls))\n\t})\n}", "title": "" }, { "docid": "754d4ff7c7742bb4879f69273689992e", "score": "0.5198059", "text": "func (s *State) SetupInitialState(ctx context.Context) {\n\ts.customState.init(s)\n}", "title": "" }, { "docid": "59d6c1a6a4b4ee5f48c52f4919f7d3dd", "score": "0.5197048", "text": "func (c *App) init() error {\n\n\tvar added []string\n\tfor intf := range c.input {\n\t\tadded = append(added, intf)\n\t}\n\n\terr := c.updateLinkMap(added)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn c.updateBpfMap(added, []string{}, []string{})\n}", "title": "" }, { "docid": "097672ce19d27df088ef11980eb60fb9", "score": "0.51961", "text": "func (s *BitSet) Init(size uint) {\n\t*s = make([]Bits, (size / BitSize + 1))\n}", "title": "" }, { "docid": "1f4500ba7bc0afec4474f00a9302ef4f", "score": "0.519392", "text": "func init() {\n\tconst (\n\t\tsilentUsage = \"silent; don't output to STDERR\"\n\t\tcwdUsage = \"the directory to verify using its checksum file\"\n\t)\n\thashUsage := fmt.Sprintf(\"the hash to use; if unspecified, the following are tried in order: %s\", strings.Join(preferredHashes, \", \"))\n\tf := &cmdVerify.Flag\n\tf.BoolVar(&silent, \"s\", false, silentUsage)\n\tf.Var(&hashFunction, \"c\", hashUsage)\n\tf.StringVar(&cwd, \"D\", \".\", cwdUsage)\n}", "title": "" }, { "docid": "6a7ce37b3d215007c0b3e582a0786fd9", "score": "0.5184884", "text": "func (m *metricMysqlLocks) init() {\n\tm.data.SetName(\"mysql.locks\")\n\tm.data.SetDescription(\"The number of MySQL locks.\")\n\tm.data.SetUnit(\"1\")\n\tm.data.SetEmptySum()\n\tm.data.Sum().SetIsMonotonic(true)\n\tm.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)\n\tm.data.Sum().DataPoints().EnsureCapacity(m.capacity)\n}", "title": "" }, { "docid": "8d6d0556ba4df22fea79348e6988e2ac", "score": "0.51815975", "text": "func (b *MockBroker) Initialize(peers []string) {\n\tb.MsgList = make([]string, 0)\n}", "title": "" }, { "docid": "9b638267df4cc20b512056370045328b", "score": "0.51775146", "text": "func (l *LinkedList[TElem]) Init() *LinkedList[TElem] {\n\tl.root.next = &l.root\n\tl.root.prev = &l.root\n\tl.len = 0\n\treturn l\n}", "title": "" }, { "docid": "393b916b2c648c514468bdae5b37f47c", "score": "0.5174912", "text": "func (m *Model) SetInitialState(state *State) {\n\tif len(m.States) > 0 {\n\t\tlog.Fatal(\"ltm: the initial state must be set before any input\")\n\t}\n\tm.States = append(m.States, state)\n}", "title": "" }, { "docid": "2378ab021227a5d15beecaf95408dfab", "score": "0.51694345", "text": "func (s *HeaviestSelector) reset() {\n\ts.Lock()\n\tdefer s.Unlock()\n\n\t// create an empty map\n\ts.trackedTails = make(map[trinary.Hash]*bundleTail)\n\n\t// create an empty list\n\ts.tips = list.New()\n}", "title": "" }, { "docid": "db52f161f8626c3825f4301d414ae861", "score": "0.5166902", "text": "func init() {\n\tinitFlavorsCache()\n\tinitImagesCache()\n\n\tfl := ListFalvors()\n\tklog.V(6).Infof(\"built-in flavors: %v\", fl)\n\n\til := ListImages()\n\tklog.V(6).Infof(\"built-in images: %v\", il)\n}", "title": "" }, { "docid": "3a390c34c346e06704598cb4ef44f6e2", "score": "0.5164541", "text": "func (c *CommandLineIndicator) init() {\n\t// Start the loading indicator goroutine.\n\tgo func() {\n\t\tfor {\n\t\t\t// Check if we're loading.\n\t\t\tc.mu.Lock()\n\t\t\tloading := c.loading\n\t\t\tc.mu.Unlock()\n\n\t\t\t// Update the loader if applicable.\n\t\t\tif loading {\n\t\t\t\tc.out.Write(loaderText)\n\t\t\t}\n\n\t\t\t// Sleep a while before checking/displaying the loading indicator again.\n\t\t\ttime.Sleep(loaderSleepTime)\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "eefb2f1287d0ec30d2b159bbeebda3e8", "score": "0.51617527", "text": "func (c *Condition) init(groupBy *event.TagSet) {\n\tc.checks = c.compileChecks()\n\tc.eventTrackers = make(map[string]*eventTracker)\n\n\t// fixes issue where occurences are hit, even when the event doesn't satisify the condition\n\tif c.Occurences < 1 {\n\t\tlogrus.Warnf(\"Occurences must be > 1. %d given. Occurences for this condition will be set to 1.\", c.Occurences)\n\t\tc.Occurences = 1\n\t}\n\n\t// if we have no trackers already, make an empty map of them\n\tif c.eventTrackers == nil {\n\t\tc.eventTrackers = make(map[string]*eventTracker)\n\t}\n\n\t// WindowSize must be above 2. At least one piece of data is needed for historical checks.\n\tif c.WindowSize < 2 {\n\t\tlogrus.Warnf(\"WindowSize must be >= 1. %d given. Window size for this condition will be set to %d\", c.WindowSize, DEFAULT_WINDOW_SIZE)\n\t\tc.WindowSize = DEFAULT_WINDOW_SIZE\n\t}\n\n\t// decide which tracking method we will use\n\tc.trackFunc = getTrackingFunc(c)\n\n\tc.ready = true\n}", "title": "" }, { "docid": "0ba2101f8916992561ff56a06215a3df", "score": "0.5147706", "text": "func (fsm *fsm) init() (err error) {\n\tif fsm.rand != nil || fsm.instanceID == 0 {\n\t\treturn nil\n\t}\n\n\t// Create new PRNG.\n\tfsm.rand = rand.New(rand.NewSource(int64(fsm.instanceID)))\n\n\t// Restart FSM from the beginning and iterate until the current step.\n\tfsm.state = \"start\"\n\tfor i := 0; i < fsm.stepN; i++ {\n\t\tfsm.state, err = fsm.next(false)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tassert(fsm.state != \"\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "78024abefa25db9a70468fa57ede1ad2", "score": "0.5146517", "text": "func (sm *SM) Init() {\n\tsm.lock = &sync.Mutex{}\n\tsm.Handlers = make(map[string]StateHandler)\n\tsm.Transitions = make(map[string]map[string]struct{})\n\tsm.ForcedStates = map[string]struct{}{\n\t\tmodels.JobError: struct{}{},\n\t\tmodels.JobStopped: struct{}{},\n\t\tmodels.JobCanceled: struct{}{},\n\t\tmodels.JobRetrying: struct{}{},\n\t}\n}", "title": "" }, { "docid": "5b9a2558b19c1d7cdf51626037c243f0", "score": "0.5143602", "text": "func (l *lruCache) init(c *cache, cap int) {\n\tl.cache = c\n\tl.cap = cap\n\tl.ls.Init()\n}", "title": "" }, { "docid": "1bf9c899821bed12db63e4d0206e78ca", "score": "0.5142086", "text": "func (s *Store) init() *Store {\n\ts.parkingCenter = parking.New(\n\t\tconfig.Start,\n\t\tconfig.Capacity,\n\t)\n\treturn s\n}", "title": "" }, { "docid": "2e1899d94de8adbc55d99096be423010", "score": "0.51386225", "text": "func (list *SkipList) Init() *SkipList {\n\tlist.next = make([]*Element, list.level)\n\tatomic.StoreInt64(&list.length, 0)\n\treturn list\n}", "title": "" }, { "docid": "9681fa595c704d014d45a6a0bac7eb58", "score": "0.5138241", "text": "func (tracker *Tracker) initWhitelist(r redis.Conn) {\n\ttracker.WhitelistMutex.Lock()\n\tdefer tracker.WhitelistMutex.Unlock()\n\ttracker.Whitelist = []string{}\n\tvalues, err := r.Do(\"HKEYS\", \"t:whitelist\")\n\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"fn\": \"initWhitelist\",\n\t\t}).Error(\"Failed to fetch whitelist\", err)\n\t\treturn\n\t}\n\ttracker.Whitelist, err = redis.Strings(values, nil)\n\tlog.WithFields(log.Fields{\n\t\t\"total_clients\": len(tracker.Whitelist),\n\t\t\"fn\": \"initWhitelist\",\n\t}).Info(\"Loaded whitelist clients\")\n}", "title": "" }, { "docid": "1e12676a99c356f3d6aee96e4b3e2f9d", "score": "0.5126818", "text": "func (m *Model) SetInitialState(state *State) {\n\tif len(m.States) > 0 {\n\t\tlog.Fatal(\"mist: the initial state must be set before any input\")\n\t}\n\tm.States = append(m.States, state)\n}", "title": "" }, { "docid": "e76d10801f62ebf1cac1056e8e7e45d6", "score": "0.51096094", "text": "func (g *grid) init() {\n\tsort.Slice(g.locs, func(i, j int) bool {\n\t\tif g.locs[i].x < g.locs[j].x {\n\t\t\treturn true\n\t\t}\n\t\tif g.locs[i].x > g.locs[j].x {\n\t\t\treturn false\n\t\t}\n\t\tif g.locs[i].y < g.locs[j].y {\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t})\n\tg.top = g.locs[0].y\n\tg.left = g.locs[0].x\n\tg.right = g.locs[len(g.locs)-1].x\n\tg.bottom = g.locs[len(g.locs)-1].y\n\tg.width = g.right - g.left + 1\n\tg.projected = make(map[string]int)\n\n}", "title": "" }, { "docid": "803c4bb4ab959d3624111a3bc77074b0", "score": "0.5109435", "text": "func initTests(c TestCollection, p string) error {\n\tfor i, t := range c {\n\t\ttk, err := task.New(t.TaskName, p)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tc[i].Task = *tk\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "43638e7683ec343ee777755503354bf2", "score": "0.51006246", "text": "func (l *baseLayer) initialize(initializer Initializer) {\n\tinitializer.Initialize(l.weights)\n\tfor i := 0; i < l.neurons; i++ {\n\t\tl.biases[i] = 0\n\t}\n}", "title": "" }, { "docid": "822483e9873014a621eeae1542b71f22", "score": "0.5098519", "text": "func Constructor0313() MyHashSet {\n return MyHashSet{make([]list.List,base)}\n}", "title": "" }, { "docid": "286a2e51599c435e3279302dfc19f24f", "score": "0.5098454", "text": "func InitGroupList(head *GroupNode) {\n\thead.Name = \"default\"\n}", "title": "" }, { "docid": "849e8eeed238258ef00725b4755fac7c", "score": "0.50933933", "text": "func Init() HealthChecks {\n\treturn HealthChecks{}\n}", "title": "" }, { "docid": "77d0286da10a39296c03ef0312555c9f", "score": "0.5089699", "text": "func (pl *packetBufferCircularList) init(size int) {\n\tpl.pbs = make([]stack.PacketBufferPtr, size)\n}", "title": "" }, { "docid": "115d4388c3f9e7478d611494022882fe", "score": "0.5083908", "text": "func (t *BinaryTree) Init(root Item, a PrioritizeTreeItem, b EquivalenceTreeItem) {\n\tif a == nil {\n\t\tt.SetLTIntPrioritizeTreeItem()\n\t} else {\n\t\tt.SetPrioritizeTreeItem(a)\n\t}\n\tif b == nil {\n\t\tt.SetEqIntEquivalenceTreeItem()\n\t} else {\n\t\tt.SetEquivalenceTreeItem(b)\n\t}\n\n\t// Insert() uses lesser() methods, so SetPrioritizeTreeItem() must run first\n\tt.Insert(root)\n}", "title": "" }, { "docid": "c9ffe0a9c5bc3bacf1c9dfaef2a71b1e", "score": "0.5080897", "text": "func (c *Crawler) init(ctxs []*URLContext) {\n\t// Initialize the internal hosts map\n\tc.hosts = make(map[string]struct{}, len(ctxs))\n\tfor _, ctx := range ctxs {\n\t\t// Add this normalized URL's host if it is not already there.\n\t\tif _, ok := c.hosts[ctx.normalizedURL.Host]; !ok {\n\t\t\tc.hosts[ctx.normalizedURL.Host] = struct{}{}\n\t\t}\n\t}\n\n\thostCount := len(c.hosts)\n\tl := len(ctxs)\n\tc.logFunc(LogTrace, \"init() - seeds length: %d\", l)\n\tc.logFunc(LogTrace, \"init() - host count: %d\", hostCount)\n\tc.logFunc(LogInfo, \"robot user-agent: %s\", c.Options.RobotUserAgent)\n\n\t// Create a shiny new WaitGroup\n\tc.wg = new(sync.WaitGroup)\n\n\t// Initialize the visits fields\n\tc.visited = make(map[string]struct{}, l)\n\tc.pushPopRefCount, c.visits = 0, 0\n\n\t// Create the workers map and the push channel (the channel used by workers\n\t// to communicate back to the crawler)\n\tc.stop = make(chan struct{})\n\tif c.Options.SameHostOnly {\n\t\tc.workers, c.push = make(map[string]*worker, hostCount),\n\t\t\tmake(chan *workerResponse, hostCount)\n\t} else {\n\t\tc.workers, c.push = make(map[string]*worker, c.Options.HostBufferFactor*hostCount),\n\t\t\tmake(chan *workerResponse, c.Options.HostBufferFactor*hostCount)\n\t}\n\t// Create and pass the enqueue channel\n\tc.enqueue = make(chan interface{}, c.Options.EnqueueChanBuffer)\n\tc.setExtenderEnqueueChan()\n}", "title": "" }, { "docid": "9cd144a468f92227f71ea3513004176e", "score": "0.50804174", "text": "func (t *Tree) Init(lessfunc LessFunc) {\n\tt.less = lessfunc\n\tt.root = nil\n\tt.count = 0\n}", "title": "" }, { "docid": "d2db009752ef9a1976acdd63451e639d", "score": "0.50800806", "text": "func (h *HivedAlgorithm) initFreeCellList() {\n\tfor chain, ccl := range h.fullCellList {\n\t\ttopLevel := CellLevel(len(ccl))\n\t\th.freeCellList[chain] = NewChainCellList(topLevel - 1)\n\t\th.freeCellList[chain][topLevel] = make(CellList, len(ccl[topLevel]))\n\t\tcopy(h.freeCellList[chain][topLevel], ccl[topLevel])\n\t}\n}", "title": "" }, { "docid": "28b09c1b1d166d5cb570657237f8e2b2", "score": "0.5077153", "text": "func initList(opts *listOptions) error {\n\tswitch {\n\tcase opts.long:\n\t\tif opts.format != \"\" {\n\t\t\treturn fmt.Errorf(\"--format and --long cannot be specified at the same time\")\n\t\t}\n\t\tif opts.quiet {\n\t\t\treturn fmt.Errorf(\"--long and --quiet cannot be specified at the same time\")\n\t\t}\n\t\topts.format = longListTpl\n\tcase opts.quiet:\n\t\tif opts.format != \"\" {\n\t\t\treturn fmt.Errorf(\"--format and --quiet cannot be specified at the same time\")\n\t\t}\n\t\tif opts.long {\n\t\t\treturn fmt.Errorf(\"--long and --quiet cannot be specified at the same time\")\n\t\t}\n\t\topts.format = quietListTpl\n\tdefault:\n\t\tif opts.format == \"\" {\n\t\t\topts.format = defaultListTpl\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bf9533c1cfc09af18fbfbcd9358589b7", "score": "0.5073918", "text": "func (db *MongoDbBridge) fMintTrxListInit(col *mongo.Collection, cursor *string, count int32, filter *bson.D) (*types.FMintTransactionList, error) {\n\t// make sure some filter is used\n\tif nil == filter {\n\t\tfilter = &bson.D{}\n\t}\n\n\t// find how many transactions do we have in the database\n\ttotal, err := col.CountDocuments(context.Background(), *filter)\n\tif err != nil {\n\t\tdb.log.Errorf(\"can not count fMint transactions\")\n\t\treturn nil, err\n\t}\n\n\t// make the list and notify the size of it\n\tdb.log.Debugf(\"found %d filtered fmint transactions\", total)\n\tlist := types.FMintTransactionList{\n\t\tCollection: make([]*types.FMintTransaction, 0),\n\t\tTotal: uint64(total),\n\t\tFirst: 0,\n\t\tLast: 0,\n\t\tIsStart: total == 0,\n\t\tIsEnd: total == 0,\n\t\tFilter: *filter,\n\t}\n\n\t// is the list non-empty? return the list with properly calculated range marks\n\tif 0 < total {\n\t\treturn db.fMintTrxListCollectRangeMarks(col, &list, cursor, count)\n\t}\n\t// this is an empty list\n\tdb.log.Debug(\"empty fMint trx list created\")\n\treturn &list, nil\n}", "title": "" }, { "docid": "c977382331f4316f658184bd14ab1597", "score": "0.50739044", "text": "func (t *TaskGroup) init(parent Canceler) {\n\tt.initOnce.Do(func() {\n\t\tt.closer, t.cancel = context.WithCancel(ctxtool.FromCanceller(parent))\n\t\tif t.OnQuit == nil {\n\t\t\tt.OnQuit = StopOnError\n\t\t}\n\t\tif t.MaxErrors == 0 {\n\t\t\tt.MaxErrors = 10\n\t\t}\n\t})\n}", "title": "" }, { "docid": "8453ef7a1ddf7e8fe684f1463946f6ce", "score": "0.5073895", "text": "func (m *MasterElectionClient) init() {\n\tvar data []byte\n\tvar err error\n\n\tm.wg.Add(1)\n\n\tdata, m.old_rev, err = m.conn.Get(m.path, nil)\n\tif err == doozer.ErrNoEnt || m.old_rev == 0 {\n\t\tm.old_rev, err = m.conn.Rev()\n\t\tif err != nil {\n\t\t\tm.cb.ElectionFatal(err)\n\t\t\treturn\n\t\t} else if m.participating {\n\t\t\t// There's no master, we'll have to find one.\n\t\t\tm.runMasterElection()\n\t\t}\n\t} else if err != nil {\n\t\tm.cb.ElectionFatal(err)\n\t\treturn\n\t} else {\n\t\tm.old_rev += 1\n\t\tm.master = string(data)\n\t\tm.cb.BecomeSlave(m.master)\n\t}\n\n\tgo m.run()\n}", "title": "" }, { "docid": "d1ec0f444edd41ec7e9bb4cefc17a85a", "score": "0.5067286", "text": "func init() {\n\t// Try to load the configuration from the environment and fall back to files in the filesystem\n\tvar c ConfigSpecification\n\terr := envconfig.Process(\"github\", &c)\n\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\n\t\t// Fall back to reading from files if there is an error\n\t\tloadCommitsToMasterConfigFromFile()\n\t} else {\n\t\terr = json.Unmarshal([]byte(c.Config), CommitsToMasterConfig)\n\t\tif err != nil {\n\t\t\tlog.Println(\"error parsing config: \", err)\n\t\t\tloadCommitsToMasterConfigFromFile()\n\t\t}\n\t}\n\tCommitsToMaster := &CommitsToMasterBot{}\n\tRegisterRobot(\"commitstomaster\", CommitsToMaster)\n}", "title": "" }, { "docid": "f4248e781a3cb8ef1dff818d59b833b8", "score": "0.5064871", "text": "func (l *LruList[K, V]) lazyInit() {\n\tif l.root.next == nil {\n\t\tl.Init()\n\t}\n}", "title": "" }, { "docid": "bc7d0b8c6cbadd4184554705e09b748c", "score": "0.5061626", "text": "func Slave_init() {\n\n\t//communicate with driver\n\n\t//run externalList\n\n\t//internal list\n\n}", "title": "" }, { "docid": "891831e21e7e980543f6507feb26ac51", "score": "0.50612545", "text": "func (bs *BrokerStatus) InitializeConditions() {\n\tbrokerCondSet.Manage(bs).InitializeConditions()\n}", "title": "" }, { "docid": "0c496a8f51cc1ff9313a8abfd7a9f1c6", "score": "0.504849", "text": "func (sdb *ChainStateDB) Init(dbType string, dataDir string, bestBlock *types.Block, test bool) error {\n\tsdb.Lock()\n\tdefer sdb.Unlock()\n\n\tsdb.testmode = test\n\t// init db\n\tif sdb.store == nil {\n\t\tdbPath := common.PathMkdirAll(dataDir, stateName)\n\t\tsdb.store = db.NewDB(db.ImplType(dbType), dbPath)\n\t}\n\n\t// init trie\n\tif sdb.states == nil {\n\t\tvar sroot []byte\n\t\tif bestBlock != nil {\n\t\t\tsroot = bestBlock.GetHeader().GetBlocksRootHash()\n\t\t}\n\n\t\tsdb.states = NewStateDB(sdb.store, sroot, sdb.testmode)\n\t}\n\treturn nil\n}", "title": "" } ]
a2257139c24532b5c486c9970e289cd8
Get the patch with the specified request it
[ { "docid": "d0c91501aa610c3b001ac5295d5982b0", "score": "0.7855294", "text": "func getPatchFromRequest(r *http.Request) (*patch.Patch, error) {\n\t// get id and secret from the request.\n\tpatchIdStr := gimlet.GetVars(r)[\"patchId\"]\n\tif len(patchIdStr) == 0 {\n\t\treturn nil, errors.New(\"no patch id supplied\")\n\t}\n\n\t// find the patch\n\texistingPatch, err := patch.FindOneId(patchIdStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif existingPatch == nil {\n\t\treturn nil, errors.Errorf(\"no existing request with id: %v\", patchIdStr)\n\t}\n\treturn existingPatch, nil\n}", "title": "" } ]
[ { "docid": "1b86314b08af4c8b0c0669ff791b60d6", "score": "0.72715807", "text": "func PatchRequest(rawUrl string) *Request {\n\treturn NewRequest(rawUrl).Method(\"PATCH\")\n}", "title": "" }, { "docid": "4cdcbbcc286e84c99a1c6a1da6346952", "score": "0.71410185", "text": "func (r *Request) Patch(pathURL string) *Request {\n\tr.method = http.MethodPatch\n\treturn r.Path(pathURL)\n}", "title": "" }, { "docid": "d930786c11843695257b4a66bfe69461", "score": "0.70774114", "text": "func (e *Expect) PATCH(path string, pathargs ...interface{}) *Request {\n\treturn e.Request(\"PATCH\", path, pathargs...)\n}", "title": "" }, { "docid": "23a85c3c7cd50775d0d390980b49bc31", "score": "0.7060854", "text": "func (c *MgClient) PatchRequest(url string, parameters []byte) ([]byte, int, error) {\n\treturn makeRequest(\n\t\t\"PATCH\",\n\t\tfmt.Sprintf(\"%s%s%s\", c.URL, prefix, url),\n\t\tbytes.NewBuffer(parameters),\n\t\tc,\n\t)\n}", "title": "" }, { "docid": "fed9c700a69b0a5875391796b2a23d25", "score": "0.70447886", "text": "func (req *Request) Patch(body io.ReadCloser) *Request {\n\treturn req.set(body, \"PATCH\")\n}", "title": "" }, { "docid": "3fba9cba974331c22fe63e1854baf64b", "score": "0.6927594", "text": "func (c *RESTClient) Patch(pt PatchType) *Request {\n\treturn c.Verb(\"PATCH\").SetHeader(\"Content-Type\", string(pt))\n}", "title": "" }, { "docid": "1e6622c771e3afb6ee40e40e9dbad059", "score": "0.6890202", "text": "func Patch(o Crudder, patch []byte) error {\n\turi := urlFor(o)\n\toutbuf, err := session.request(\"PATCH\", uri, patch)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn unmarshal(uri, outbuf, o)\n}", "title": "" }, { "docid": "b00397ee3a5cde2c073df00b7cf5181b", "score": "0.6888725", "text": "func (request *Request) Patch(ctx context.Context) (*Response, error) {\n\trequest.Method = \"PATCH\"\n\treturn request.httpWithMiddleware(ctx)\n}", "title": "" }, { "docid": "cddd9cbabf28ab1fd79ea2d2b690bc39", "score": "0.6880791", "text": "func ViewPatch(w http.ResponseWriter, r *http.Request) {\r\n\t// swagger:operation PATCH /patch postRequest\r\n\t//\r\n\t// ---\r\n\t// produces:\r\n\t// - application/json\r\n\t//\r\n\t// summary: The request's PATCH params.\r\n\t//\r\n\t// schemes:\r\n\t// - http\r\n\t// - https\r\n\t//\r\n\t// tags:\r\n\t// - HTTP Methods\r\n\t//\r\n\t// responses:\r\n\t// '200':\r\n\t// description: The request's PATCH params.\r\n\r\n\te := json.NewEncoder(w)\r\n\te.Encode(helpers.MakeResponse(r, \"url\", \"headers\", \"args\", \"body\", \"origin\"))\r\n}", "title": "" }, { "docid": "102437643bb0c8e6edc51450c3ff04e4", "score": "0.68476105", "text": "func (ht *HTTPIntegrationTest) Patch(url string, requestJSON interface{}) *Response {\n\treturn ht.callAPI(\"PATCH\", url, requestJSON)\n}", "title": "" }, { "docid": "7518aba64b4247fbdf4a21ebf0a76661", "score": "0.68402237", "text": "func (r *taskResolver) Patch(ctx context.Context, obj *restModel.APITask) (*restModel.APIPatch, error) {\n\tif !evergreen.IsPatchRequester(*obj.Requester) {\n\t\treturn nil, nil\n\t}\n\tapiPatch, err := data.FindPatchById(*obj.Version)\n\tif err != nil {\n\t\treturn nil, InternalServerError.Send(ctx, fmt.Sprintf(\"Couldn't find a patch with id: `%s` %s\", *obj.Version, err.Error()))\n\t}\n\treturn apiPatch, nil\n}", "title": "" }, { "docid": "cd0ba85e09ad376b324f7a0ccb13e0d6", "score": "0.68343633", "text": "func Patch(url string, options ...func(*Request)) (*Response, error) {\n\treturn New(\"PATCH\", url, options...)\n}", "title": "" }, { "docid": "81a348830d6447f0b2b5d74abb5e078d", "score": "0.6792053", "text": "func (g *xGroup) PATCH(path string, h HttpHandle) RouterNode {\n\treturn g.add(RouteMethod_PATCH, path, h)\n}", "title": "" }, { "docid": "bdc8baed33b2e6989b9e9af530986b50", "score": "0.6689553", "text": "func (c *Client) PATCH(url string, params map[string]string, headers map[string]string) *Response {\n\treturn c.send(url, params, \"PATCH\", headers)\n}", "title": "" }, { "docid": "4f67b3b16d1c342408807e1da1b02cc2", "score": "0.66568553", "text": "func PatchRequest(baseURL string, object *jsh.Object) (*http.Request, error) {\n\tu, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error parsing URL: %s\", err.Error())\n\t}\n\n\tsetIDPath(u, object.Type, object.ID)\n\n\trequest, err := NewRequest(\"PATCH\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error creating PATCH request: %s\", err.Error())\n\t}\n\n\terr = prepareBody(request, object)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn request, nil\n}", "title": "" }, { "docid": "ce918d6b66d488ea43374e05e6a2a33a", "score": "0.6611056", "text": "func decodePatchRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.PatchRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "title": "" }, { "docid": "24975b4933735d53da7f3e1b53c1c801", "score": "0.65971124", "text": "func PATCH(handler http.Handler) Matcher {\n\treturn Method(\"PATCH\", handler)\n}", "title": "" }, { "docid": "94263db8271497a108823add268e2347", "score": "0.6569985", "text": "func (c *httpClient) patch(rawURL string, expectedStatus int, in interface{}, out interface{}) error {\n\terr := c.do(rawURL, \"PATCH\", expectedStatus, in, out)\n\treturn errio.Error(err)\n}", "title": "" }, { "docid": "4dcbae6d04b0ba20f1c5a10d9ff80158", "score": "0.6555844", "text": "func (p *patcher) patchResource(ctx context.Context) (runtime.Object, error) {\n\tp.namespace = request.NamespaceValue(ctx)\n\tswitch p.patchType {\n\tcase types.JSONPatchType, types.MergePatchType:\n\t\tp.mechanism = &jsonPatcher{patcher: p}\n\tcase types.StrategicMergePatchType:\n\t\tp.mechanism = &smpPatcher{patcher: p}\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"%v: unimplemented patch type\", p.patchType)\n\t}\n\tp.updatedObjectInfo = rest.DefaultUpdatedObjectInfo(nil, p.applyPatch, p.applyAdmission)\n\treturn finishRequest(p.timeout, p.requestLoop(ctx))\n}", "title": "" }, { "docid": "06285b208ecab1b3bd8757ed082e610c", "score": "0.6521133", "text": "func (c *Client) Patch(ctx context.Context, requestURL, accessToken string, body io.Reader) ([]byte, error) {\n\treturn c.postOrPatch(ctx, http.MethodPatch, requestURL, accessToken, body)\n}", "title": "" }, { "docid": "add155fed1176d21955a2eda413a6aa9", "score": "0.6450719", "text": "func (c Client) Patch(ctx context.Context, url string, payload, result interface{}, opt ...RequestOption) error {\n\treturn c.request(ctx, url, \"PATCH\", payload, result, opt)\n}", "title": "" }, { "docid": "9a16b869e813a4a9bffa1643b6772cb6", "score": "0.6437531", "text": "func (c *Client) Patch(url string, body interface{}, options ...RequestOption) (*Response, error) {\n\treturn c.newRequest(url, http.MethodPatch, body, options...).execute()\n}", "title": "" }, { "docid": "29660c1f56873e4fc93e0ee6c502bfdf", "score": "0.64149165", "text": "func (c *Client) Patch(ctx context.Context, url string, body interface{}, v interface{}) (*Response, error) {\n\tr := &Request{Ctx: ctx, Method: http.MethodPatch, URL: url, Body: body}\n\trsp, err := c.Send(r).Response()\n\tif err != nil {\n\t\treturn rsp, err\n\t}\n\tif v != nil {\n\t\treturn rsp, rsp.Decode(v)\n\t}\n\treturn rsp, nil\n}", "title": "" }, { "docid": "0a6166ebd454a5090239b3f08b570113", "score": "0.64032596", "text": "func (r *router) PATCH(res string, _path string, handlers ...gin.HandlerFunc) gin.IRoutes {\n\trelativePath := fmt.Sprintf(\"/%s/:%s\", res+\"s\", \"id\")\n\n\tif _path != \"\" {\n\t\trelativePath = _path\n\t}\n\treturn r.engine.PATCH(relativePath, handlers...)\n}", "title": "" }, { "docid": "328bd70f1277c60a53ca215bfee0dde9", "score": "0.63805616", "text": "func (r *Resource) PATCH(path string, h HandlerFunc, filters ...Filter) *Resource {\n\treturn r.Route(\"PATCH\", path, h, filters...)\n}", "title": "" }, { "docid": "f88176675c1cfc62a6e9defbdb825d72", "score": "0.6334079", "text": "func (c *FakeDebugRequests) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *squash_v1.DebugRequest, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewPatchSubresourceAction(debugrequestsResource, c.ns, name, data, subresources...), &squash_v1.DebugRequest{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*squash_v1.DebugRequest), err\n}", "title": "" }, { "docid": "f74cc6f68f26f9a0c55ba714cad98abd", "score": "0.62163395", "text": "func (g *Group) Patch(path string, h HandlerFunc, opts ...HandlerOption) {\n\tg.add(path, h, opts, http.MethodPatch)\n}", "title": "" }, { "docid": "95e969567b08d7061cd21cca5a585150", "score": "0.6212264", "text": "func (r *Routes) PATCH(pattern string, h RHandler) {\n\tr.Add(\"patch\", pattern, h)\n}", "title": "" }, { "docid": "72db7689d1acf159d9ca87160986bde5", "score": "0.6196689", "text": "func (c *Client) Patch(url string, v, body interface{}) (*Response, error) {\n\treq := c.http.R().SetBody(body)\n\n\tif v != nil {\n\t\treq.SetResult(v)\n\t}\n\tresp, err := req.Patch(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn checkResponse(resp)\n}", "title": "" }, { "docid": "ab62d79115b7f15d94d4f785b7a62ab9", "score": "0.6194432", "text": "func (self *App) PATCH(path string, cb handler) *App {\n\treturn self.METHOD(\"PATCH\", path, cb)\n}", "title": "" }, { "docid": "f812bd15087f2bf7e1c34e969ab6a1aa", "score": "0.61919826", "text": "func (c Client) Patch(path string, body io.Reader, options ...Option) (*Response, error) {\n\treturn c.Do(http.MethodPatch, path, body, options...)\n}", "title": "" }, { "docid": "2a4373af36de15af9ec1dd9ca6be1396", "score": "0.61903346", "text": "func (r *Request) AsPatch() *Request {\n\tr.method = MethodPatch\n\treturn r\n}", "title": "" }, { "docid": "6464fb48c02c00905307b0bb89f3d7f8", "score": "0.61735016", "text": "func getPatch(rc *RedisCluster) ([]byte, error) {\n\trcBytes, err := json.Marshal(rc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar raw map[string]interface{}\n\terr = json.Unmarshal(rcBytes, &raw)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tobjCopy := make(map[string]interface{})\n\tspecCopy := make(map[string]interface{})\n\n\tspecCopy[\"spec\"] = raw[\"spec\"].(map[string]interface{})\n\tspecCopy[\"$patch\"] = \"replace\"\n\tobjCopy[\"spec\"] = specCopy\n\tpatch, err := json.Marshal(objCopy)\n\treturn patch, err\n}", "title": "" }, { "docid": "651b5a25dd42b2e8346afedbc61f7b66", "score": "0.616721", "text": "func (v *Vinxi) Patch(path string) *router.Route {\n\treturn v.Route(\"PATCH\", path)\n}", "title": "" }, { "docid": "fa6e77686f735597b6e8228e57d4612c", "score": "0.61659396", "text": "func (r *Route) Patch(h http.Handler) *Route {\n\treturn r.Handle(h, \"PATCH\")\n}", "title": "" }, { "docid": "62be8b05399b8061bb4629ef087aeb4d", "score": "0.6142748", "text": "func (c Client) Patch(subDomain string, path string, data interface{}) (body []byte, header http.Header, err error) {\n\tbody, header, err = c.process(\"PATCH\", subDomain, path, data)\n\treturn\n}", "title": "" }, { "docid": "2382595d6f3c864435327af141f6c812", "score": "0.6140722", "text": "func getPatch(ds *appsv1alpha1.DaemonSet) ([]byte, error) {\n\tdsBytes, err := json.Marshal(ds)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar raw map[string]interface{}\n\terr = json.Unmarshal(dsBytes, &raw)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tobjCopy := make(map[string]interface{})\n\tspecCopy := make(map[string]interface{})\n\n\t// Create a patch of the DaemonSet that replaces spec.template\n\tspec := raw[\"spec\"].(map[string]interface{})\n\ttemplate := spec[\"template\"].(map[string]interface{})\n\tspecCopy[\"template\"] = template\n\ttemplate[\"$patch\"] = \"replace\"\n\tobjCopy[\"spec\"] = specCopy\n\tpatch, err := json.Marshal(objCopy)\n\treturn patch, err\n}", "title": "" }, { "docid": "90afe1cd9bddd73553a6ebf0de542bbc", "score": "0.61252654", "text": "func (n *Nice) Patch(pattern string, h ...HandlerFunc) RouteNode {\n\treturn n.Router().Add(\"PATCH\", pattern, h)\n}", "title": "" }, { "docid": "8ec7a6aefbe35c9224e362a4b91d229e", "score": "0.61113644", "text": "func getPatch(set *apps.StatefulSet) ([]byte, error) {\n\tdata, err := runtime.Encode(patchCodec, set)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar raw map[string]interface{}\n\terr = json.Unmarshal(data, &raw)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tobjCopy := make(map[string]interface{})\n\tspecCopy := make(map[string]interface{})\n\tspec := raw[\"spec\"].(map[string]interface{})\n\ttemplate := spec[\"template\"].(map[string]interface{})\n\tspecCopy[\"template\"] = template\n\ttemplate[\"$patch\"] = \"replace\"\n\tobjCopy[\"spec\"] = specCopy\n\tpatch, err := json.Marshal(objCopy)\n\treturn patch, err\n}", "title": "" }, { "docid": "ea7425025682f15fc865b57e020af76d", "score": "0.6093358", "text": "func (r *Router) PATCH(pattern string, svc Service) { r.Register(\"PATCH\", pattern, svc) }", "title": "" }, { "docid": "00bc5c9e74b8aee07214cd113589591b", "score": "0.6075016", "text": "func (sg *SweetyGo) PATCH(path string, handler HandlerFunc) {\n\tsg.Handle(\"PATCH\", path, handler)\n}", "title": "" }, { "docid": "6aad7fd0cdc24a9952b88d1cd3aec03e", "score": "0.6064572", "text": "func (o CertificateSigningRequestSpecPatchOutput) Request() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v CertificateSigningRequestSpecPatch) *string { return v.Request }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a388ad2fc20fa08c330cebb1908d8164", "score": "0.60556865", "text": "func (c *Client) Patch(url string, params interface{}) (*Response, error) {\n\tjsonData, err := JSONData(params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tURL := c.BaseURL + url\n\treq, err := http.NewRequest(PATCH, URL, jsonData)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header = c.Headers\n\treturn performRequest(req, c.Client)\n}", "title": "" }, { "docid": "d445480c620bc734091b31ec9314a563", "score": "0.6041719", "text": "func (g *Group) Patch(path string, handler context.Handler) {\n\tg.Handle(http.MethodPatch, path, handler)\n}", "title": "" }, { "docid": "92bc45448eb6cb2febe6518cb2e3f274", "score": "0.60380495", "text": "func (a *Routes) PATCH(relativePath string, h HandlerFunc, optionFns ...OptionFn) IRoutes {\n\ta.GinRouter.Handle(\"PATCH\", relativePath, a.Adaptor.Adapt(h, optionFns...))\n\treturn a\n}", "title": "" }, { "docid": "37dc6851f5cea9ef58041bce9dcdb8f9", "score": "0.6027224", "text": "func (g *routeGroup) Patch(path string, h http.HandlerFunc) {\n\tg.handle(http.MethodPatch, path, h)\n}", "title": "" }, { "docid": "8a32da70b92430adb041d07c483b5412", "score": "0.6016477", "text": "func (r *router) PATCH(path string, f func(Control)) {\n\tr.register(\"PATCH\", path, f)\n}", "title": "" }, { "docid": "4fb4fec968ba4a5e0908d8361a97dd2c", "score": "0.6009746", "text": "func (hr *Request) AsPatch() *Request {\n\thr.Verb = \"PATCH\"\n\treturn hr\n}", "title": "" }, { "docid": "316385273e2bbd90af85a28611cf9a12", "score": "0.5989207", "text": "func PATCHFunc(handler func(http.ResponseWriter, *http.Request)) Matcher {\n\treturn PATCH(http.HandlerFunc(handler))\n}", "title": "" }, { "docid": "cfcee6a55d1ee4deb714ceb574113079", "score": "0.59863555", "text": "func (c *realControl) getPatch(deploy *gdv1alpha1.GameDeployment, coreControl gdcore.Control) ([]byte, error) {\n\tstr, err := runtime.Encode(patchCodec, deploy)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar raw map[string]interface{}\n\t_ = json.Unmarshal([]byte(str), &raw)\n\tobjCopy := make(map[string]interface{})\n\tspecCopy := make(map[string]interface{})\n\tspec := raw[\"spec\"].(map[string]interface{})\n\ttemplate := spec[\"template\"].(map[string]interface{})\n\n\tcoreControl.SetRevisionTemplate(specCopy, template)\n\tobjCopy[\"spec\"] = specCopy\n\tpatch, err := json.Marshal(objCopy)\n\treturn patch, err\n}", "title": "" }, { "docid": "12688bb7a54b22f2c459c34469c11e79", "score": "0.59856164", "text": "func (receiver *Base) Patch(_ extension.Model, _ *gorm.DB, _ gin.Params, _ url.Values, _ interface{}) (interface{}, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "9684ddc70378ee7fb1d0ec2c53dfee28", "score": "0.59838325", "text": "func (_class HostPatchClass) GetPoolPatch(sessionID SessionRef, self HostPatchRef) (_retval PoolPatchRef, _err error) {\n\tif IsMock {\n\t\treturn _class.GetPoolPatchMock(sessionID, self)\n\t}\t\n\t_method := \"host_patch.get_pool_patch\"\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 := convertHostPatchRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"self\"), self)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_retval, _err = convertPoolPatchRefToGo(_method + \" -> \", _result.Value)\n\treturn\n}", "title": "" }, { "docid": "ac0e7b6c64c0289921e2f87eb1b0dc19", "score": "0.59805816", "text": "func (r *Router) PATCH(path string, handle Handle) { r.Router.PATCH(path, r.middlewareSelect(handle)) }", "title": "" }, { "docid": "89e35c42b80a74d941e0a18b81857201", "score": "0.5974981", "text": "func (e *express) Patch(url string, middleware Middleware) ExpressInterface {\n e.router.Patch(url, middleware)\n return e\n}", "title": "" }, { "docid": "bbe738c1f07d1b7923ecff16a7a92535", "score": "0.59676915", "text": "func (ta *TestAPI) Patch(target string, body io.Reader, headersQueryParams ...any) *TestAPI {\n\tta.t.Helper()\n\treq, err := patch(target, body, headersQueryParams...)\n\tif err != nil {\n\t\tta.t.Fatal(err)\n\t}\n\treturn ta.Request(req)\n}", "title": "" }, { "docid": "37aefb4fde1ed0a461991cefe88bb4b4", "score": "0.5954075", "text": "func (e *express) Patch(url string, middleware router.Middleware) *express {\n\te.router.Patch(url, middleware)\n\treturn e\n}", "title": "" }, { "docid": "3f7a090bac9d961b0701db56e3055ad2", "score": "0.5948594", "text": "func (client *Rest) Patch(payload interface{}) *Rest {\n\tclient.verb = \"PATCH\"\n\tif payload != nil {\n\t\tclient.WithPayload(payload)\n\t}\n\treturn client\n}", "title": "" }, { "docid": "c4b074c1bc777ceb71345bf9fdf78751", "score": "0.5940401", "text": "func (g *Group) Patch(relativePath string, handler http.Handler) {\n\tg.handle(http.MethodPatch, relativePath, handler)\n}", "title": "" }, { "docid": "0c435d5d832c92e5c8c642a416968efa", "score": "0.59382635", "text": "func (r *AppRoute) PATCH(path string, handler Middleware) {\n\tr.Handle(\"PATCH\", path, handler)\n}", "title": "" }, { "docid": "74b8275521edc2b2ea1cc53c1d088240", "score": "0.5936513", "text": "func (c *packetMirroringsRESTClient) Patch(ctx context.Context, req *computepb.PatchPacketMirroringRequest, opts ...gax.CallOption) (*computepb.Operation, error) {\n\tm := protojson.MarshalOptions{AllowPartial: true}\n\tbody := req.GetPacketMirroringResource()\n\tjsonReq, err := m.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbaseUrl, _ := url.Parse(c.endpoint)\n\tbaseUrl.Path += fmt.Sprintf(\"/compute/v1/projects/%v/regions/%v/packetMirrorings/%v\", req.GetProject(), req.GetRegion(), req.GetPacketMirroring())\n\n\tparams := url.Values{}\n\tif req != nil && req.RequestId != nil {\n\t\tparams.Add(\"requestId\", fmt.Sprintf(\"%v\", req.GetRequestId()))\n\t}\n\n\tbaseUrl.RawQuery = params.Encode()\n\n\thttpReq, err := http.NewRequest(\"PATCH\", baseUrl.String(), bytes.NewReader(jsonReq))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\thttpReq = httpReq.WithContext(ctx)\n\t// Set the headers\n\tfor k, v := range c.xGoogMetadata {\n\t\thttpReq.Header[k] = v\n\t}\n\thttpReq.Header[\"Content-Type\"] = []string{\"application/json\"}\n\n\thttpRsp, err := c.httpClient.Do(httpReq)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer httpRsp.Body.Close()\n\n\tif httpRsp.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(httpRsp.Status)\n\t}\n\n\tbuf, err := ioutil.ReadAll(httpRsp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tunm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}\n\trsp := &computepb.Operation{}\n\n\treturn rsp, unm.Unmarshal(buf, rsp)\n}", "title": "" }, { "docid": "43326af2d451b003b6d3ce75d5aef9c6", "score": "0.5920714", "text": "func (s Semver) Patch() int {\n\treturn s.patch\n}", "title": "" }, { "docid": "0111906a8bb5d4dade6c7446f9fede0a", "score": "0.5904563", "text": "func (db *db) patch(c Collection, id common.ID, r Resource) error {\n\toldR := reflect.New(reflect.ValueOf(r).Elem().Type()).Interface().(Resource)\n\tif err := db.get(c, id, oldR); err != nil {\n\t\treturn err\n\t}\n\n\tif err := mergo.Merge(r, oldR); err != nil {\n\t\treturn err\n\t}\n\n\treturn db.update(c, id, r)\n}", "title": "" }, { "docid": "639ea233c4ca86d9a83b68a7949fe25b", "score": "0.589384", "text": "func (r *Routes) RoutePATCH(pattern string, h Routable) {\n\tr.Add(\"patch\", pattern, h.Handle)\n}", "title": "" }, { "docid": "dace0f1af2cd0dfdc7decc104b7859d5", "score": "0.5886545", "text": "func (o CertificateSigningRequestSpecPatchPtrOutput) Request() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *CertificateSigningRequestSpecPatch) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Request\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "35d1dcb06473dfbcf337fd0da891c48e", "score": "0.5883709", "text": "func PATCH(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes {\n\treturn engine().PATCH(relativePath, handlers...)\n}", "title": "" }, { "docid": "ea2e39bc1254d7006b3e978117f82014", "score": "0.5852905", "text": "func (repo *Repository) GetPatch(base, head string) ([]byte, error) {\n\treturn NewCommand(\"diff\", \"-p\", \"--binary\", base, head).RunInDirBytes(repo.Path)\n}", "title": "" }, { "docid": "9f64da892c5219ecb27b4f6b129e826c", "score": "0.5848856", "text": "func (r *Request) IsPatch() bool {\n\treturn r.Method == \"PATCH\"\n}", "title": "" }, { "docid": "2cd1458cad3fc3b6ba2657958cec7c74", "score": "0.58427405", "text": "func Patch(path string, fn http.HandlerFunc) {\n\tr.Router.PATCH(path, HandlerFunc(fn))\n}", "title": "" }, { "docid": "971a02e86f6f6b8e345bab7a7f6df2d3", "score": "0.5812851", "text": "func Patch(v int) predicate.ModuleVersion {\n\treturn predicate.ModuleVersion(\n\t\tfunc(s *sql.Selector) {\n\t\t\ts.Where(sql.EQ(s.C(FieldPatch), v))\n\t\t},\n\t)\n}", "title": "" }, { "docid": "615095efaf2e05fbe793982cc345fc50", "score": "0.5811823", "text": "func Patch(pattern string, handler interface{}) {\n\tUse([]string{\"PATCH\"}, pattern, handler)\n}", "title": "" }, { "docid": "aeb7af74f7b7661b928eb06905a435b5", "score": "0.5798562", "text": "func Patch(baseURL string, object *jsh.Object) (*jsh.Document, *http.Response, error) {\n\trequest, err := PatchRequest(baseURL, object)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn Do(request, jsh.ObjectMode)\n}", "title": "" }, { "docid": "98320ba7eddbebe4f06baa9f99b235a1", "score": "0.5774939", "text": "func (r *Helper) Patch(name types.NamespacedName, kind, apiVersion string, patch []byte, patchType string) error {\n\n\tioStreams := genericclioptions.IOStreams{\n\t\tIn: &bytes.Buffer{},\n\t\tOut: &bytes.Buffer{},\n\t\tErrOut: &bytes.Buffer{},\n\t}\n\tfactory, err := r.getFactory(name.Namespace)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpatchOptions, err := r.setupPatchCommand(name.Name, kind, apiVersion, patchType, factory, string(patch), ioStreams)\n\tif err != nil {\n\t\tr.logger.WithError(err).Error(\"failed to setup patch command\")\n\t\treturn err\n\t}\n\terr = patchOptions.RunPatch()\n\tif err != nil {\n\t\tr.logger.WithError(err).\n\t\t\tWithField(\"stdout\", ioStreams.Out.(*bytes.Buffer).String()).\n\t\t\tWithField(\"stderr\", ioStreams.ErrOut.(*bytes.Buffer).String()).Error(\"running the patch command failed\")\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f366290722174994e99c1c00d7bbc756", "score": "0.57734007", "text": "func (c *idGenerates) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IdGenerate, err error) {\n\tresult = &v1alpha1.IdGenerate{}\n\terr = c.client.Patch(pt).\n\t\tNamespace(c.ns).\n\t\tResource(\"idgenerates\").\n\t\tName(name).\n\t\tSubResource(subresources...).\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tBody(data).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "f28fd92fa4fc57d8d4b40f30f549298c", "score": "0.5764926", "text": "func (r *Router) PATCH(route string, handler interface{}) *Router {\n\tr.Handle(MethodPATCH, route, handler)\n\treturn r\n}", "title": "" }, { "docid": "4a58f45ae19d2a0da1c7bd4593882c51", "score": "0.57558465", "text": "func (engine *Engine) PATCH(relativePath string, handlers ...HandlerFunc) IRoutes {\n\treturn engine.handle(http.MethodPatch, relativePath, handlers)\n}", "title": "" }, { "docid": "95dca983b01b26a8f2a94dc7bf95ad32", "score": "0.5755146", "text": "func (router *Router) Patch(path string, handler http.HandlerFunc, middlewares ...Middleware) {\n\trouter.handle(\"PATCH\", path, handler, middlewares...)\n}", "title": "" }, { "docid": "39d7788c670f76620732d9a4549938fc", "score": "0.57495445", "text": "func (engine *Engine) PATCH(relativePath string, handlers ...gin.HandlerFunc) IRoutes {\n\treturn engine.core.PATCH(relativePath, handlers...)\n}", "title": "" }, { "docid": "5c44cb77b71962b4fffa3d642e1c9a8b", "score": "0.5741712", "text": "func (r *Route) Patch(handlers ...Handler) *Route {\n\treturn r.group.add(\"PATCH\", r.path, handlers)\n}", "title": "" }, { "docid": "891ed8d781bc24ec36122ef0785aba13", "score": "0.57394594", "text": "func (service *Service) PATCH(path string, handle http.HandlerFunc) {\n\tservice.router.Handle(\"PATCH\", path, handle, service.middlewares...)\n}", "title": "" }, { "docid": "dd7fd94224d89b6de577b464798788d5", "score": "0.5726856", "text": "func (req *Request) IsPatch() bool {\n\treturn req.Is(\"Patch\")\n}", "title": "" }, { "docid": "b312ff139c182ac0ea2312d51d4f6bae", "score": "0.5724268", "text": "func (r *Router) PATCH(path string, handle Handle) {\n\tr.Handle(\"PATCH\", path, handle)\n}", "title": "" }, { "docid": "4097b90bba871190cf9c695643397bfb", "score": "0.5719833", "text": "func (client *IotAlertsClient) patchCreateRequest(ctx context.Context, deviceGroupName string, alertID string, alertPatchModel AlertPatchPropertiesModel, options *IotAlertsClientPatchOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.IoTSecurity/locations/{iotDefenderLocation}/deviceGroups/{deviceGroupName}/alerts/{alertId}\"\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 client.iotDefenderLocation == \"\" {\n\t\treturn nil, errors.New(\"parameter client.iotDefenderLocation cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{iotDefenderLocation}\", url.PathEscape(client.iotDefenderLocation))\n\tif deviceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter deviceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{deviceGroupName}\", url.PathEscape(deviceGroupName))\n\tif alertID == \"\" {\n\t\treturn nil, errors.New(\"parameter alertID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{alertId}\", url.PathEscape(alertID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-07-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, alertPatchModel)\n}", "title": "" }, { "docid": "cbf631874fcb328d52819e988df17120", "score": "0.5710266", "text": "func (c *Controller) Patch() {\n\t(*web.Controller)(c).Patch()\n}", "title": "" }, { "docid": "70a3a0bf7e9e877d95659722e987ead1", "score": "0.57064253", "text": "func (r *Router) PATCH(path string, handle HandlerFunc) {\n\tr.Handle(\"PATCH\", path, handle)\n}", "title": "" }, { "docid": "505bb708a0014c2c3eedceee81935bc8", "score": "0.57004905", "text": "func (r *RequestHandler) Patch() {\n\tr.App().Error(http.StatusNotFound, r.getResponse(), ErrNotFound)\n}", "title": "" }, { "docid": "fbccbf413d6b3b8ee7633efc9002d9c4", "score": "0.5699413", "text": "func (s *routeSetClient) Patch(o *RouteSet, data []byte, subresources ...string) (*RouteSet, error) {\n\tobj, err := s.objectClient.Patch(o.Name, o, data, subresources...)\n\treturn obj.(*RouteSet), err\n}", "title": "" }, { "docid": "810cf85ef42fad4e9b05304e66243e5e", "score": "0.5696646", "text": "func (r router) Patch(path string, handler http.Handler) {\n\tr.handle(path, PATCH, handler)\n}", "title": "" }, { "docid": "c2b22925d2fe4ecb72708afd3f3c2347", "score": "0.5694727", "text": "func (c *rioInfos) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.RioInfo, err error) {\n\tresult = &v1.RioInfo{}\n\terr = c.client.Patch(pt).\n\t\tResource(\"rioinfos\").\n\t\tSubResource(subresources...).\n\t\tName(name).\n\t\tBody(data).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "42e37d88b50cfa3ff55fc6377cc6bc30", "score": "0.5687482", "text": "func (this *Router) Patch(pattern string, handler http.HandlerFunc) *Route {\n\treturn this.AddRoute(PATCH, pattern, handler)\n}", "title": "" }, { "docid": "8b38273e708f599d70a0aa1e23fb32b5", "score": "0.5684861", "text": "func (grp *RouteGroup) Patch(route string, handlers ...HandleFunc) {\n\tgrp.Route(route, \"PATCH\", handlers...)\n}", "title": "" }, { "docid": "2233dc80914a63f8be8f1784f30b0b8a", "score": "0.5675471", "text": "func (c *fileSyncs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.FileSync, err error) {\n\tresult = &v1alpha1.FileSync{}\n\terr = c.client.Patch(pt).\n\t\tNamespace(c.ns).\n\t\tResource(\"filesyncs\").\n\t\tName(name).\n\t\tSubResource(subresources...).\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tBody(data).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "5632e2eba92e8dd7f7b4910f4e6d11aa", "score": "0.56740063", "text": "func (g *routeGroup) Patch(path string, h ...Handler) {\n\tg.handle(PATCH, path, h)\n}", "title": "" }, { "docid": "0c14cad3084c2665a1ec206267f21f7a", "score": "0.56663084", "text": "func (r RouterFunc) Patch(pattern string, handler interface{}, filters ...Filter) *Leaf {\n\treturn r.Route().Patch().Pattern(pattern).Handler(handler).AddFilters(filters...)\n}", "title": "" }, { "docid": "5ac2cd6d4dd707c163f4334f105925c1", "score": "0.56448144", "text": "func (m *PrivilegedAccessRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PrivilegedAccessRootable, requestConfiguration *PrivilegedAccessRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PrivilegedAccessRootable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CreatePrivilegedAccessRootFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PrivilegedAccessRootable), nil\n}", "title": "" }, { "docid": "f6a54f144aaad4403f1cce6d6f56468d", "score": "0.56440336", "text": "func (r *Router) PATCH(path string, handle httprouter.Handle) {\n\tr.Router.PATCH(path, Wrap(handle, path, r.opts...))\n}", "title": "" }, { "docid": "d42efdd4d291ce0ff6b9ca2453371121", "score": "0.5635451", "text": "func (s *exampleClient) Patch(o *Example, patchType types.PatchType, data []byte, subresources ...string) (*Example, error) {\n\tobj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...)\n\treturn obj.(*Example), err\n}", "title": "" }, { "docid": "ff2b908c2e2aa918dd770849d9304a3e", "score": "0.5626904", "text": "func (c *PacketMirroringsClient) Patch(ctx context.Context, req *computepb.PatchPacketMirroringRequest, opts ...gax.CallOption) (*computepb.Operation, error) {\n\treturn c.internalClient.Patch(ctx, req, opts...)\n}", "title": "" }, { "docid": "29ac136ea4d84ac4f1f6b1fe82c13db9", "score": "0.56220585", "text": "func (k *Kubeclient) Patch(\n\tname string,\n\tpt types.PatchType,\n\tdata []byte,\n\tsubresources ...string,\n) (*corev1.Service, error) {\n\tcli, err := k.getClientOrCached()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn k.patch(cli, name, k.namespace, pt, data, subresources...)\n}", "title": "" }, { "docid": "70e3cf65a20c4578f58235cabfa5cd5d", "score": "0.5617773", "text": "func (o *UpdatePatchParams) 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\tif o.Patch != nil {\n\t\tif err := r.SetBodyParam(o.Patch); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param patch_id\n\tif err := r.SetPathParam(\"patch_id\", o.PatchID.String()); 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": "9b7f4ace7cfaa58f6c64d9f82a2668b7", "score": "0.5613697", "text": "func HTTPPatch(URL string, encoding string, postData string, header http.Header) (HTTPResponse, error) {\n\treturn httpcall(URL, \"PATCH\", encoding, postData, header)\n}", "title": "" } ]
aa243372d69f1dc478e5aab60ca7f5f8
IndexOf returns the index of the first occurrence of the given element in this list.
[ { "docid": "34189b2d6a27acc8fb4adf769297b123", "score": "0.70778924", "text": "func (l *List) IndexOf(ctx context.Context, element interface{}) (int, error) {\n\telementData, err := l.validateAndSerialize(element)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\trequest := codec.EncodeListIndexOfRequest(l.name, elementData)\n\tresponse, err := l.invokeOnPartition(ctx, request, l.partitionID)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn int(codec.DecodeListIndexOfResponse(response)), nil\n}", "title": "" } ]
[ { "docid": "9a1bc57a202154c6330c69f8695eba5d", "score": "0.74825144", "text": "func (a *ArrayList) GetIndexOf(element interface{}) (int, error) {\n\tfor i := 0; i < a.size; i++ {\n\t\tif a.Comparator(a.elements[i], element) == 0 {\n\t\t\treturn i, nil\n\t\t}\n\t}\n\treturn -1, errors.New(\"element not found\")\n}", "title": "" }, { "docid": "32e4a4b7bcebc3e5625ff8006a00ef1b", "score": "0.7226428", "text": "func GetIndex(element interface{}, list []interface{}) int {\n\tfor pos, item := range list {\n\t\tif item == element {\n\t\t\treturn pos\n\t\t}\n\t}\n\n\treturn -1\n}", "title": "" }, { "docid": "36dda18fa96113323928c4206e55ba5a", "score": "0.6964799", "text": "func (l *ArrayList) IndexOf(o interface{}) (index int) {\n\tfor i := 0; i < l.size; i++ {\n\t\tif o == l.internalSlice[i] {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "1bae0c74f13f6bcde76985522cedc0b7", "score": "0.6901701", "text": "func (list *ArrayList) IndexOf(item CollectionItem) int {\n\tvar arr = list.arr\n\tfor i := 0; i < list.size; i++ {\n\t\tif arr[i].Equals(item) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "bb6b59c9919a658d5e7e2eb6051403cb", "score": "0.68963796", "text": "func (base *ArrayList) IndexOf(obj Obj) int {\n\treturn base.findObj(1, obj)\n}", "title": "" }, { "docid": "de3050bba45373f69f36cb82ce505b84", "score": "0.67015165", "text": "func (base *ArrayList) IndexOf(obj Obj) int {\n return base.findObj(1, obj)\n}", "title": "" }, { "docid": "509ca32758dd2e3381fb03a588f51467", "score": "0.66320807", "text": "func ( s *Sliceint) IndexOf( value *int ) int {\n\tfor i, v := range *s {\n\t\tif v == value {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "234cd91cbdca81762037c9ed8b9b1d49", "score": "0.6609818", "text": "func Index(i int, l List) (int, error) {\n\tfor x := range l {\n\t\tk := l[x].ID\n\t\tif i == k {\n\t\t\treturn x, nil\n\t\t}\n\t}\n\treturn 0, errors.New(\"unknown ID\")\n}", "title": "" }, { "docid": "dc0e763839d5602e18fa5c6037deddd3", "score": "0.6574389", "text": "func Index(arr []string, item string) int {\n\tfor i := 0; i < len(arr); i++ {\n\t\tif item == arr[i] {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "5856b217d8565b3c19863ce081d50867", "score": "0.64872986", "text": "func (l *LinkedList) IndexOf(o interface{}) (index int) {\n\tif l.size == 0 {\n\t\treturn -1\n\t}\n\n\tif l.size<<1 >= index {\n\t\ttempIndex := 0\n\t\tfor node := l.head; node != nil; node = node.nextNode {\n\t\t\tif node.value == o {\n\t\t\t\treturn tempIndex\n\t\t\t}\n\t\t\ttempIndex++\n\t\t}\n\t\treturn -1\n\t}\n\n\ttempIndex := l.size - 1\n\tfor node := l.tail; node != nil; node = node.preNode {\n\t\tif node.value == o {\n\t\t\treturn tempIndex\n\t\t}\n\t\ttempIndex--\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "7591124c5dcf2448ab5d2581aa499cf5", "score": "0.64808905", "text": "func Index[T comparable](haystack []T, needle T) int {\n\tfor i, curr := range haystack {\n\t\tif curr == needle {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "ef16425ad836c154bc47793f6174a6aa", "score": "0.64081746", "text": "func getIndex(element interface{}, slice []interface{}) int {\n\tfor i, v := range slice {\n\t\tif v == element {\n\t\t\treturn i\n\t\t}\n\t}\n\t// Element not in slice\n\treturn -1\n}", "title": "" }, { "docid": "602614e5b5a093d9a3b6cf21e60361d5", "score": "0.63934356", "text": "func indexOf(value int, array []int) int {\n\tfor index, val := range array {\n\t\tif val == value {\n\t\t\treturn index\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "ad8c1e4591bb910d3233c9cba92a8dad", "score": "0.6379734", "text": "func (s *DoublyLinkedList[T]) GetIndexOf(value T) int {\n\tindex := 0\n\tcurrent := s.head\n\tfor current != nil {\n\t\tif reflect.DeepEqual(value, current.Value) {\n\t\t\treturn index\n\t\t}\n\t\tcurrent = current.Next\n\t\tindex++\n\t}\n\tcurrent = nil\n\treturn -1\n}", "title": "" }, { "docid": "d641aab26c0b80b9f4d57ec954361a94", "score": "0.6368367", "text": "func IndexOf(a []string, toFind string) int {\n\ti := sort.Search(len(a), func(index int) bool {\n\t\treturn strings.Compare(a[index], toFind) >= 0\n\t})\n\tif i < 0 || i >= len(a) {\n\t\treturn -1\n\t}\n\tif a[i] == toFind {\n\t\treturn i\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "24c294007e8fb93eb3b79ca16b2c4b8a", "score": "0.6349209", "text": "func IndexOf[E any](items []E, element E) (int, bool) {\n\tvar index = -1\n\tvar ok bool\n\n\tfor i, el := range items {\n\t\tif reflect.DeepEqual(el, element) {\n\t\t\tindex = i\n\t\t\tok = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn index, ok\n}", "title": "" }, { "docid": "1d68e9ab4d341871bd54ac5c35d67736", "score": "0.6345199", "text": "func (c *Byte) IndexOf(el byte) int {\n\tfor i, item := range c.items {\n\t\tif item == el {\n\t\t\treturn i\n\t\t}\n\t}\n\n\treturn -1\n}", "title": "" }, { "docid": "59c73f59087b5f7ab5915155136009e9", "score": "0.63021773", "text": "func indexOf(array []int64, e int64) int {\r\n\tfor i, ele := range array {\r\n\t\tif ele == e {\r\n\t\t\treturn i\r\n\t\t}\r\n\t}\r\n\treturn -1\r\n}", "title": "" }, { "docid": "b785d474f98805da2f813dd528145079", "score": "0.6263033", "text": "func Index(s []int, t int) int {\n\tfor i, j := range s {\n\t\tif j == t {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "d49e21686acb2d1babcafc0202249c7e", "score": "0.6260559", "text": "func (n *Node) IndexOf(value string) int {\n\tcurrentIndex := 0\n\n\tfor n.next != nil {\n\t\tif n.value == value {\n\t\t\treturn currentIndex\n\t\t}\n\n\t\tcurrentIndex++\n\t\tn = n.next\n\t}\n\n\t// We need to check the last element\n\tif n.value == value {\n\t\treturn currentIndex\n\t}\n\n\treturn -1\n}", "title": "" }, { "docid": "7936db02cfa964462bdd8c6611b850fa", "score": "0.6249131", "text": "func containsIdx(l []string, e string) int {\n\tfor idx, i := range l {\n\t\tif i == e {\n\t\t\treturn idx\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "5c6d36900cd26401d5d90014d705806b", "score": "0.6223982", "text": "func (_ StdArray) Index(arr []string, val string) int {\n\tfor i := 0; i < len(arr); i++ {\n\t\tif arr[i] == val {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "bec01a9e2bc201b63876a8efbd9f9f0a", "score": "0.6214743", "text": "func (*Float32) IndexOf(ints []float32, e float32, fromIndex ...int) int {\n\tvar start int\n\tvar n = len(ints)\n\n\tfor _, id := range fromIndex {\n\t\tstart = id\n\t}\n\n\tstart = g.Min(start, n)\n\tif start < 0 {\n\t\tstart = g.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": "4fde903cc151c9216395d80a0521c047", "score": "0.61827505", "text": "func indexOf(value string, slice []string) int {\n\tfor p, v := range slice {\n\t\tif (v == value) {\n\t\t\treturn p\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "c3709044b9ac2707a3191c2961f36d83", "score": "0.61754364", "text": "func (c *Contacts) IndexOf(node *Node) int {\n\tc.mutex.RLock()\n\tdefer c.mutex.RUnlock()\n\n\tid := c.nodeID(node)\n\tif i, ok := c.uniq[id]; ok {\n\t\treturn i\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "a0250d56a2256b0bda5beb31fec2e832", "score": "0.61682576", "text": "func (l *DoublyLinkedList) IndexOf(value interface{}) int {\n\toutput := -1\n\tl.readerRestart()\n\tfor l.reader.HasNext() || l.reader.index == l.Size-1 {\n\t\tif l.reader.current.Value == value {\n\t\t\toutput = l.reader.index\n\t\t\tbreak\n\t\t}\n\t\tl.reader.Next()\n\t}\n\treturn output\n}", "title": "" }, { "docid": "45631700e7741970735a3aabcf0046e5", "score": "0.6150962", "text": "func IndexOf(element string, data []string) int {\n\tfor k, v := range data {\n\t\tif element == v {\n\t\t\treturn k\n\t\t}\n\t}\n\treturn -1 //not found.\n}", "title": "" }, { "docid": "c9f9f2a650f8a0528ebfcb44e5e2bcaa", "score": "0.61164457", "text": "func (linkedList *DoublyLinkedList) IndexOf(data int) int {\n\tindex := 0\n\tcurrent := linkedList.Head\n\tfor true {\n\t\tif current.Data == data {\n\t\t\treturn index\n\t\t}\n\t\tindex++\n\t\tif current.Next == nil {\n\t\t\t// data not found in the linkedList\n\t\t\treturn -1\n\t\t}\n\t\tcurrent = current.Next\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "356e55542363cf8d1e8d04bcaec1c2ae", "score": "0.61161935", "text": "func IndexOf(slice []string, value string) int {\n\tfor i, v := range slice {\n\t\tif v == value {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "2707fec9d877a0a7a6fe41ccc8e31732", "score": "0.6085684", "text": "func FindPos(elem string, elemArray []string) int {\n\tfor p, v := range elemArray {\n\t\tif v == elem {\n\t\t\treturn p\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "2fe20ce2504afa6c9df4f44346a56281", "score": "0.6081611", "text": "func Index(strs []string, str string) int {\n\tfor i, v := range strs {\n\t\tif v == str {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "6c1e9d5a703bbe8342d5f9c1258feb84", "score": "0.6079651", "text": "func IndexOf(haystack []int, needle int) (int, error) {\n\tfor i, v := range haystack {\n\t\tif v == needle {\n\t\t\treturn i, nil\n\t\t}\n\t}\n\treturn 0, errors.New(\"cannot find needle\")\n}", "title": "" }, { "docid": "cf21a06d215c62c06e14c4f30c3341da", "score": "0.60674393", "text": "func (s StringSlice) Index(str string) int {\n\tfor i, v := range s {\n\t\tif v == str {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "9afb9cdcc0c90d146ea344c7bbfabc0b", "score": "0.6062445", "text": "func (s *Set) IndexOf(k interface{}) int {\n\treturn s.data.IndexOf(k)\n}", "title": "" }, { "docid": "88a9c653727fc96fc419f036aeecf626", "score": "0.6058345", "text": "func (idx *index) Find(token string) int32 {\n\ti := sort.SearchStrings(idx.tokens, token)\n\tif i == len(idx.tokens) || idx.tokens[i] != token {\n\t\t// not in index\n\t\treturn int32(-1)\n\t}\n\treturn int32(i)\n}", "title": "" }, { "docid": "b1a0c22d9727ab2e15f640c02961458e", "score": "0.60557735", "text": "func FindIndex(intArray []int, intToSearchFor int) int {\n\tfor i, item := range intArray {\n\t\tif item == intToSearchFor {\n\t\t\treturn i\n\t\t}\n\t}\n\n\treturn -1\n}", "title": "" }, { "docid": "1e746a3023983eb5ea57d3c89623c30e", "score": "0.60447603", "text": "func IndexOf(in interface{}, elem interface{}) int {\n\tinValue := reflect.ValueOf(in)\n\n\telemValue := reflect.ValueOf(elem)\n\n\tinType := inValue.Type()\n\n\tif inType.Kind() == reflect.String {\n\t\treturn strings.Index(inValue.String(), elemValue.String())\n\t}\n\n\tif inType.Kind() == reflect.Slice {\n\t\tequalTo := equal(elem)\n\t\tfor i := 0; i < inValue.Len(); i++ {\n\t\t\tif equalTo(reflect.Value{}, inValue.Index(i)) {\n\t\t\t\treturn i\n\t\t\t}\n\t\t}\n\t}\n\n\treturn -1\n}", "title": "" }, { "docid": "bf71e71243bfe6a289c7a239d6ae746a", "score": "0.6036491", "text": "func IndexOf(slice, elemen interface{}) int {\n\tsliceValue := reflect.ValueOf(slice)\n\telemenValue := reflect.ValueOf(elemen)\n\n\tsliceType := reflect.TypeOf(slice)\n\n\tif sliceType.Kind() == reflect.String {\n\t\tstrings.Index(sliceValue.String(), elemenValue.String())\n\t}\n\n\tif sliceType.Kind() == reflect.Slice {\n\t\tfor i := 0; i < sliceValue.Len(); i++ {\n\t\t\tif sliceValue.Index(i).Interface() == elemen {\n\t\t\t\treturn i\n\t\t\t}\n\t\t}\n\t}\n\n\treturn -1\n}", "title": "" }, { "docid": "15d36fff468e075b7eb382ba7829c7fb", "score": "0.6025362", "text": "func (a IntArray) IndexOf(n Int) Int {\n\tfor i, v := range a {\n\t\tif v == n {\n\t\t\treturn Int(i)\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "dcdf248036e1f08e55416811984bce91", "score": "0.6019193", "text": "func Index[T comparable](value T, slice []T) int {\n\tfor i, a := range slice {\n\t\tif a == value {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "62bb4a2202626c4922e269ecc90b7ffc", "score": "0.6016991", "text": "func IndexOf(haystack []string, pin string) int {\n\tfor index, hay := range haystack {\n\t\tif hay == pin {\n\t\t\treturn index\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "033f7de24ff7154de47ccd581ba01a51", "score": "0.6013788", "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\n\treturn -1\n}", "title": "" }, { "docid": "b055a900c756af76f6dea726c9e2fb72", "score": "0.5994894", "text": "func indexOf(haystack []string, needle string) int {\n\tfor i, val := range haystack {\n\t\tif val == needle {\n\t\t\treturn i\n\t\t}\n\t}\n\n\treturn len(haystack)\n}", "title": "" }, { "docid": "7c540c91eda223cb7538c09a1c1fec3b", "score": "0.59854287", "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": "7c540c91eda223cb7538c09a1c1fec3b", "score": "0.59854287", "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": "7c540c91eda223cb7538c09a1c1fec3b", "score": "0.59854287", "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": "89ab3d6f5320368d3a7e0764a0080ed1", "score": "0.5957269", "text": "func (l *GroupList) IndexOf(atomIndex uint64) int {\n\treturn interval.IndexOf(l, atomIndex)\n}", "title": "" }, { "docid": "992ebe342cf599b74666b6c23de84f09", "score": "0.59339255", "text": "func ListIndex[T constraints.Equable](list []T, value T) (index int) {\n\tindex = -1\n\tfor i, v := range list {\n\t\tif v == value {\n\t\t\tindex = i\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "44cee5695d21a9b6c2a8b5d516655b71", "score": "0.59313446", "text": "func (v Vector[T]) Index(x T) int {\n\tfor i, e := range v {\n\t\tif reflect.DeepEqual(e, x) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "59c6521ae96ed96836ac2ce6e6b4eb8c", "score": "0.5918082", "text": "func FindInSlice(slice []string, elem string) int {\n\tfor i := range slice {\n\t\tif slice[i] == elem {\n\t\t\treturn i\n\t\t}\n\t}\n\n\treturn -1\n}", "title": "" }, { "docid": "03c50a099f32f77be3daf633288e6ea5", "score": "0.59135693", "text": "func index[T comparable](list []T, find T) int {\n for i, v := range list {\n if v == find {\n return i\n }\n }\n return -1\n}", "title": "" }, { "docid": "2deef71e169eb36b2b53120f9af55ef1", "score": "0.59044194", "text": "func StringIndexOf(element string, data []string) int {\n\tfor k, v := range data {\n\t\tif element == v {\n\t\t\treturn k\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "49f1f37b44bfa3cacc0126f20255bcbb", "score": "0.58786035", "text": "func (arr *Array) FindIndex(callback func(element string) bool) int {\n\ta := arr.internal\n\tfor i, v := range *a {\n\t\t// index, array parameters have not been implemented\n\t\tif callback(v) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "afd10499323a27afa94336d2cf75b9a4", "score": "0.5859662", "text": "func (list *Dll) IndexOf(payload interface{}) (int, bool) {\n\tcurrentNode := list.Head\n\tif currentNode == nil {\n\t\tfmt.Println(\"Empty list\")\n\t\treturn -1, false\n\t}\n\ti := 0\n\tfor {\n\t\tif currentNode.Payload == payload {\n\t\t\treturn i, true\n\t\t}\n\t\tif currentNode.nextNode == nil {\n\t\t\tbreak\n\t\t}\n\t\tcurrentNode = currentNode.nextNode\n\t\ti++\n\t}\n\treturn -1, false\n}", "title": "" }, { "docid": "eda974a4b1b3679ff62b22f7b8d94577", "score": "0.5837929", "text": "func ( s *SliceDamStruct) IndexOf( value *DamStruct ) int {\n\tfor i, v := range *s {\n\t\tif v == value {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "b35b5b68064ed483621a8de7569ef914", "score": "0.5829042", "text": "func getIndItem (items [] string, finder string) int {\n\tfor i := 0; i < len(items); i++ {\n\t\tif items[i] == finder {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "955d48d9841e2b358a69bfc6dbb7adaa", "score": "0.58136314", "text": "func indexOfWord(value string, words []string) int {\n\tfor i := range words {\n\t\tif words[i] == value {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "fedadc8cbd0a5fee2e76c02eee7b3c04", "score": "0.57686955", "text": "func FindIndex[E any](items []E, predicate Predicate[E]) (int, bool) {\n\tindex := -1\n\tok := false\n\n\tfor i, el := range items {\n\t\tif predicate(el) {\n\t\t\tindex = i\n\t\t\tok = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn index, ok\n}", "title": "" }, { "docid": "eb0ac158908679092d895b1389219b81", "score": "0.57409704", "text": "func (h *MaxHeap) Index(x interface{}) int {\n\tfor i := 0; i < h.Len(); i++ {\n\t\tif x == (*h)[i] {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "8622260e527394dace17a9f19c70146d", "score": "0.57256156", "text": "func (ll *LinkListService) IndexOf(ServiceName string) int {\n\tnode := ll.head\n\n\tj := 0\n\tfor {\n\t\tif node.ServiceName == ServiceName {\n\t\t\treturn j\n\t\t}\n\t\tif node.next == nil {\n\t\t\treturn -1\n\t\t}\n\t\tnode = node.next\n\t\tj++\n\t}\n}", "title": "" }, { "docid": "a00bebbe8ada6c5d41ba14170b0b41c6", "score": "0.571319", "text": "func FindIndex[T any](it Iterator[T], fn func(T) bool) int {\n\tfor i := 0; ; i++ {\n\t\tx, ok := it.Next()\n\t\tif !ok {\n\t\t\treturn -1\n\t\t}\n\t\tif fn(x) {\n\t\t\treturn i\n\t\t}\n\t}\n}", "title": "" }, { "docid": "06d01bca8a81d0f8d49ebc034fbee87b", "score": "0.57007724", "text": "func (l *FileList) FindIndex(p string) int {\n\tif idx, ok := l.dict[p]; ok {\n\t\treturn idx\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "8430a68acb5980379d45a7ca56fd46bc", "score": "0.5696322", "text": "func (list *SingleLinkedList) IndexOf(target interface{}) *Node {\r\n\tcur := list.head.next\r\n\tfor cur != nil {\r\n\t\tif cur.val == target {\r\n\t\t\treturn cur\r\n\t\t}\r\n\t\tcur = cur.next\r\n\t}\r\n\treturn nil\r\n}", "title": "" }, { "docid": "cfe3d42e7c3fc995a6fe582d34ca0d23", "score": "0.56656164", "text": "func contains(list []string, e string) int {\n\tif len(list) < 1 {\n\t\treturn -1\n\t}\n\tfor i, a := range list {\n\t\tif a == e {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "57aa0cc637046dc4749d7f1bdd57d841", "score": "0.5654791", "text": "func index_in_array(index[]string, element string)int{\n\tret := -1\n\t\n\n\tfor i := 0; i < len(index); i++{\n\n\t\tif strings.Compare(index[i], element) == 0{\n\n\t\t\tret = i\n\t\t\t\n\t\t}\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "d6ef0b43d6981dd90fb40f85def4ea0a", "score": "0.56354797", "text": "func (slice NodeSlice) index(n Node) int {\n\t// sort.Search() doesn't work as a general purpose search.\n\t// return sort.Search(len(slice), func(j int) bool {\n\t// \treturn slice[j] == n\n\t// })\n\tfor i := 0; i < len(slice); i++ {\n\t\tif slice[i] == n {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn notFound\n}", "title": "" }, { "docid": "232c466a82286f0007fc6bf12cc57a5f", "score": "0.56336683", "text": "func Find(a []string, x string) int {\n\tfor i, n := range a {\n\t\tif x == n {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn len(a)\n}", "title": "" }, { "docid": "7853db24b75e3570cfe617dc27ae3c21", "score": "0.56203336", "text": "func (base *ArrayList) LastIndexOf(obj Obj) int {\n\treturn base.findObj(-1, obj)\n}", "title": "" }, { "docid": "4a5005b2a79ba7f6a4989f65c44ce31b", "score": "0.56092566", "text": "func IndexOf(array interface{}, compare interface{}) int {\n\tarrayType := reflect.ValueOf(array)\n\tif arrayType.Kind() != reflect.Array && arrayType.Kind() != reflect.Slice && arrayType.Kind() != reflect.String {\n\t\tpanic(\"The type of array isn't correct\")\n\t}\n\tfor i := 0; i < arrayType.Len(); i++ {\n\t\tif arrayType.Index(i).Interface() == compare {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "cc309e03f9ec07b7cbc3a4ada82708e5", "score": "0.5601261", "text": "func IndexInt(s []int, t int) int {\n for i, v := range s {\n if v == t {\n return i\n }\n }\n\n return -1\n}", "title": "" }, { "docid": "6cb254b0410b5f03d4dd499da3e5a5dd", "score": "0.5592349", "text": "func (h *Handler) 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": "482bee4fc1f6db6db840601a8a4b8906", "score": "0.5560175", "text": "func indexOf(refs []int, ref int) (int, bool) {\n\tfor i, j := range refs {\n\t\tif ref == j {\n\t\t\treturn i, true\n\t\t}\n\t}\n\treturn -1, false\n}", "title": "" }, { "docid": "a36eabc54522eaa37b9fc6d31285b3be", "score": "0.55601007", "text": "func index_of(slice []string, id string) int {\n for index, value := range slice {\n if (value == id) {\n return index\n }\n }\n return -1 \n}", "title": "" }, { "docid": "ba3e3deec16893f7e9200c3621f2db8b", "score": "0.5558314", "text": "func (g johnsonGraph) indexOf(id int64) int {\n\treturn g.index[id]\n}", "title": "" }, { "docid": "bab67b18a01a851ae23584d59e178271", "score": "0.55560327", "text": "func (*Float32) FindIndex(ints []float32, predict func(float32) bool, fromIndex ...int) int {\n\tvar start int\n\tvar n = len(ints)\n\n\tfor _, id := range fromIndex {\n\t\tstart = id\n\t}\n\n\tstart = g.Min(start, n)\n\tif start < 0 {\n\t\tstart = g.Max(n+start, 0)\n\t}\n\n\tfor i := start; i < n; i++ {\n\t\tif ok := predict(ints[i]); ok {\n\t\t\treturn i\n\t\t}\n\t}\n\n\treturn -1\n}", "title": "" }, { "docid": "a285bef1458b2243a5a5b7f4e3143a9e", "score": "0.5551868", "text": "func StringSliceIndexOf(element string, slice []string) int {\n\tfor k, v := range slice {\n\t\tif element == v {\n\t\t\treturn k\n\t\t}\n\t}\n\n\treturn -1\n}", "title": "" }, { "docid": "53846216d0519c6d0d226a53df42272a", "score": "0.55447626", "text": "func (base *ArrayList) LastIndexOf(obj Obj) int {\n return base.findObj(-1, obj)\n}", "title": "" }, { "docid": "67641e53758eb584b58542f8f9fdc396", "score": "0.5524526", "text": "func (d *DynamicArray) Find(element interface{}) (int32, error) {\n\tfor index, value := range d.container {\n\t\tif element == value {\n\t\t\treturn int32(index), nil\n\t\t}\n\t}\n\treturn 0, ErrorElementNotFound\n}", "title": "" }, { "docid": "2f20ed687fc25d9edfb081b1d733ad92", "score": "0.55220795", "text": "func (n *bucketNode) indexOf(id []byte) int {\n\tfor i, c := range n.contacts {\n\t\tif bytes.Equal(c.GetID(), id) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "1f5338bd3aabc687a1d1b58fdb664b5b", "score": "0.55206734", "text": "func (v *Vector) Find(idx interface{}) (interface{}, bool) {\n\ti := idx.(int)\n\tif i < 0 || i >= v.Length() {\n\t\treturn nil, false\n\t}\n\treturn v.At(i), true\n}", "title": "" }, { "docid": "481c0a8ac0be039f44f160c406dff2fb", "score": "0.55012816", "text": "func IndexOf(source interface{}, state data.Map) (interface{}, error) {\n\tif !toolbox.IsSlice(source) {\n\t\treturn nil, fmt.Errorf(\"expected arguments but had: %T\", source)\n\t}\n\targs := toolbox.AsSlice(source)\n\tif len(args) != 2 {\n\t\treturn nil, fmt.Errorf(\"expected 2 arguments but had: %v\", len(args))\n\t}\n\n\tif toolbox.IsString(args[0]) {\n\t\treturn strings.Index(toolbox.AsString(args[0]), toolbox.AsString(args[1])), nil\n\t}\n\tcollection, err := AsCollection(args[0], state)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor i, candidate := range toolbox.AsSlice(collection) {\n\t\tif candidate == args[1] || toolbox.AsString(candidate) == toolbox.AsString(args[1]) {\n\t\t\treturn i, nil\n\t\t}\n\t}\n\treturn -1, nil\n}", "title": "" }, { "docid": "8a9dc93d2a497bece60174865678e3fd", "score": "0.5498044", "text": "func IndexOfInt(intslice []int, val int) int {\n\tfor i, ele := range intslice {\n\t\tif ele == val {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "851bf484ad541eef6c9f9e57f8ccee97", "score": "0.5493615", "text": "func FindElemIndex[T any](eq cmp.Eq[T]) func(it Iterator[T], e T) int {\n\treturn func(it Iterator[T], e T) int {\n\t\treturn FindIndex[T](it, func(x T) bool { return eq.Equal(x, e) })\n\t}\n}", "title": "" }, { "docid": "862b3c28f1bf7fed497d4ea9c652abc9", "score": "0.54737437", "text": "func (list *List) Get (idx int) interface{} {\n\treturn list.elements[idx]\n}", "title": "" }, { "docid": "c14c7c93d28befb161689810c3abf68d", "score": "0.5470388", "text": "func (l *List) LastIndexOf(ctx context.Context, element interface{}) (int, error) {\n\telementData, err := l.validateAndSerialize(element)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\trequest := codec.EncodeListLastIndexOfRequest(l.name, elementData)\n\tresponse, err := l.invokeOnPartition(ctx, request, l.partitionID)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn int(codec.DecodeListLastIndexOfResponse(response)), nil\n}", "title": "" }, { "docid": "7d8848f703017a76f46edd10dbe8bafc", "score": "0.54661715", "text": "func linearSearch(arr []int, num int) int {\n\tfor i, v := range arr {\n\t\tif v == num {\n\t\t\treturn i\n\t\t}\n\t}\n\n\treturn -1\n}", "title": "" }, { "docid": "e54f18558be7d2a62bd40f93b5e6a555", "score": "0.54610395", "text": "func (ul URLList) Find(url string) int {\n\tfor i, u := range ul {\n\t\tif u == url {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "5b32901f51ab7778062f0d2142de9459", "score": "0.54603684", "text": "func FindIndexWith[E any](items []E, element E, comparison Comparison[E]) (index int, ok bool) {\n\tindex = -1\n\tfor i, el := range items {\n\t\tif comparison(element, el) {\n\t\t\tindex = i\n\t\t\tok = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn index, ok\n}", "title": "" }, { "docid": "1ebda56d7082363f90ed3a8b1c12fcb6", "score": "0.54559046", "text": "func (aa *SliceType) FindIndex(condition closures.ConditionFn) int64 {\n\treturn FindIndex(*aa, condition)\n}", "title": "" }, { "docid": "f162f23b934464091b8b161ba4a492a3", "score": "0.54489654", "text": "func (l *List) Get(index int) int {\n\ti := 0\n\titem := l.head\n\tfor item != nil {\n\t\tif i == index {\n\t\t\treturn item.data\n\t\t}\n\n\t\titem = item.next\n\t\ti++\n\t}\n\n\treturn -1\n}", "title": "" }, { "docid": "05087f4434208501d3225a08df56e58f", "score": "0.543794", "text": "func (k *KBucket) IndexOf(node *bucketNode, id []byte) int {\n\treturn node.indexOf(id)\n}", "title": "" }, { "docid": "9f046802cf581e9f99b7b720289001d4", "score": "0.5422215", "text": "func (n Nodes) indexOf(key string) int {\n\tfor i, node := range n {\n\t\tif node.Key == key {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "5be7fdd9bedf32d36d768fa37f6f0dd1", "score": "0.5389359", "text": "func posString(slice []string, element string) int {\n\tfor index, elem := range slice {\n\t\tif elem == element {\n\t\t\treturn index\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "5be7fdd9bedf32d36d768fa37f6f0dd1", "score": "0.5389359", "text": "func posString(slice []string, element string) int {\n\tfor index, elem := range slice {\n\t\tif elem == element {\n\t\t\treturn index\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "a456da879aeb506728e4e66be9138274", "score": "0.5374201", "text": "func FindElement(arr []int, f func(int) bool) int {\n\tfor _, a := range arr {\n\t\tif f(a) {\n\t\t\treturn a\n\t\t}\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "dca351d689d24326c01b75cd96ed9c6a", "score": "0.53637516", "text": "func (s RootishArrayStack) Index(x interface{}) (int, error) {\n\treturn 0, nil\n}", "title": "" }, { "docid": "026a5736256709bdc5d853f183040def", "score": "0.5358911", "text": "func (e *Element) Index() uint {\n\tvar index uint\n\tif ret := HTMLayoutGetElementIndex(e.handle, &index); ret != HLDOM_OK {\n\t\tdomPanic2(ret, \"Failed to get element's index\")\n\t}\n\treturn index\n}", "title": "" }, { "docid": "15742b4f0e18c4accb775032bee8d204", "score": "0.53566754", "text": "func (pp Params) IndexOf(name string) int {\n\tfor i, p := range pp {\n\t\tif p.Name == name {\n\t\t\treturn i\n\t\t}\n\t}\n\n\treturn -1\n}", "title": "" }, { "docid": "01cf7571bceacc55738d92abe573bc60", "score": "0.5352797", "text": "func IndexOf(blks []blocks.Block, c cid.Cid) int {\n\tfor i, n := range blks {\n\t\tif n.Cid() == c {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "73f772bb0dbe2eae5dbf5c55fd7e2dfd", "score": "0.53470856", "text": "func (s Int) Find(n int) int {\n\tfor i := range s {\n\t\tif s[i] == n {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn NotFound\n}", "title": "" } ]
2943912e1440f6c5ba3a1e6e887f95d3
Tries to read enhanced ID3V1 tag from rs
[ { "docid": "b09bf409bb74d34da5a8210a974dca38", "score": "0.7352878", "text": "func readEnhancedTag(rs io.ReadSeeker) (EnhancedID3v1Tag, error) {\n\tif !containsEnhancedTAG(rs) {\n\t\t// rs does not contain enhanced TAG, there is nothing to read\n\t\treturn EnhancedID3v1Tag{}, errDoesNotUseEnhancedID3v1\n\t}\n\n\tvar enhanced EnhancedID3v1Tag\n\n\t// set reader into the position\n\t_, err := rs.Seek(-int64(TAGSIZE+ENHANCEDSIZE), io.SeekEnd)\n\tif err != nil {\n\t\treturn enhanced, fmt.Errorf(\"could not seek: %s\", err)\n\t}\n\n\t// songname\n\tsongName, err := util.ReadToString(rs, 60)\n\tif err != nil {\n\t\treturn EnhancedID3v1Tag{}, err\n\t}\n\tenhanced.SongName = songName\n\n\tartist, err := util.ReadToString(rs, 60)\n\tif err != nil {\n\t\treturn enhanced, err\n\t}\n\tenhanced.Artist = artist\n\n\t// album\n\talbum, err := util.ReadToString(rs, 60)\n\tif err != nil {\n\t\treturn enhanced, err\n\t}\n\tenhanced.Album = album\n\n\t// speed\n\tspeedByte, err := util.Read(rs, 1)\n\tif err != nil {\n\t\treturn enhanced, err\n\t}\n\n\tvar speed string = EnhancedSpeed[int(speedByte[0])]\n\tenhanced.Speed = speed\n\n\t// genre\n\tgenre, err := util.ReadToString(rs, 30)\n\tif err != nil {\n\t\treturn enhanced, err\n\t}\n\tenhanced.Genre = genre\n\n\t// time\n\tstartTime, err := util.ReadToString(rs, 6)\n\tif err != nil {\n\t\treturn enhanced, err\n\t}\n\tenhanced.StartTime = startTime\n\n\tendtime, err := util.ReadToString(rs, 6)\n\tif err != nil {\n\t\treturn enhanced, err\n\t}\n\tenhanced.EndTime = endtime\n\n\treturn enhanced, nil\n}", "title": "" } ]
[ { "docid": "4a4fa493dbf031c2f813e9bc1ce69f91", "score": "0.7306085", "text": "func Readv1Tag(rs io.ReadSeeker) (*ID3v1Tag, error) {\n\tvar tag ID3v1Tag\n\n\t// check if need to read enhanced tag\n\tif containsEnhancedTAG(rs) {\n\t\tenhanced, _ := readEnhancedTag(rs)\n\t\ttag.HasEnhancedTag = true\n\t\ttag.EnhancedTag = enhanced\n\t}\n\n\tif !containsTAG(rs) {\n\t\t// no TAG to read\n\t\treturn nil, ErrDoesNotUseID3v1\n\t}\n\n\t// Songname\n\tsongname, err := util.ReadToString(rs, 30)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttag.SongName = songname\n\n\t// Artist\n\tartist, err := util.ReadToString(rs, 30)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttag.Artist = artist\n\n\t// Album name\n\talbum, err := util.ReadToString(rs, 30)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttag.Album = album\n\n\t// Year\n\tyearStr, err := util.ReadToString(rs, 4)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tyear, err := strconv.Atoi(yearStr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not convert yearbytes into int: %s\", err)\n\t}\n\ttag.Year = year\n\n\t// Comment and Track\n\tcomment, err := util.Read(rs, 30)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttag.Comment = util.ToStringLossy(comment)\n\ttag.Track = 0\n\n\tvar track int = 0\n\t// check if 29th byte is null byte (v1.0 or v1.1)\n\tif comment[28] == 0 {\n\t\t// it is v1.1, track number exists\n\t\ttrack = int(comment[29])\n\n\t\ttag.Track = uint8(track)\n\n\t\tcomment = comment[0:28]\n\t\ttag.Comment = util.ToStringLossy(comment)\n\t}\n\n\t// Genre\n\tgenreByte, err := util.Read(rs, 1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tgenreInt := int(genreByte[0])\n\n\tgenre, exists := id3v1genres[int(genreInt)]\n\tif !exists {\n\t\tgenre = \"\"\n\t}\n\ttag.Genre = genre\n\n\tif track == 0 {\n\t\ttag.version = V1_0\n\t} else {\n\t\ttag.version = V1_1\n\t}\n\n\treturn &tag, nil\n}", "title": "" }, { "docid": "8c3996d34ebce47aebfebc424c22e79b", "score": "0.61460704", "text": "func NextID3v2Tag(stream io.Reader) (*ID3v2Tag, error) {\n\tfor {\n\t\tobj := NextObject(stream)\n\t\tswitch obj := obj.(type) {\n\t\tcase *MP3Frame:\n\t\t\treturn nil, ErrMP3Frame\n\t\tcase *ID3v1Tag:\n\t\t\treturn nil, ErrID3v1\n\t\tcase *ID3v2Tag:\n\t\t\treturn obj, nil\n\t\tcase nil:\n\t\t\treturn nil, io.EOF\n\t\t}\n\t}\n}", "title": "" }, { "docid": "335ab6797eff66f9982d5949464c1345", "score": "0.5868202", "text": "func NextObject(stream io.Reader) interface{} {\n\t// Each MP3 frame begins with a 4-byte header.\n\tbuffer := make([]byte, 4)\n\tlastByte := buffer[3:]\n\n\t// Fill the header buffer.\n\tif ok := fillBuffer(stream, buffer); !ok {\n\t\treturn nil\n\t}\n\n\t// Scan forward until we find an object or reach the end of the stream.\n\tfor {\n\t\t// Check for an ID3v1 tag: 'TAG'.\n\t\tif buffer[0] == 84 && buffer[1] == 65 && buffer[2] == 71 {\n\n\t\t\ttag := &ID3v1Tag{}\n\t\t\ttag.RawBytes = make([]byte, 128)\n\t\t\tcopy(tag.RawBytes, buffer)\n\n\t\t\tif ok := fillBuffer(stream, tag.RawBytes[4:]); !ok {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\treturn tag\n\t\t}\n\n\t\t// Check for an ID3v2 tag: 'ID3'.\n\t\tif buffer[0] == 73 && buffer[1] == 68 && buffer[2] == 51 {\n\n\t\t\t// Read the remainder of the 10 byte tag header.\n\t\t\tremainder := make([]byte, 6)\n\t\t\tif ok := fillBuffer(stream, remainder); !ok {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\t// The last 4 bytes of the header indicate the length of the tag.\n\t\t\t// This length does not include the header itself.\n\t\t\tlength :=\n\t\t\t\t(int(remainder[2]) << (7 * 3)) |\n\t\t\t\t\t(int(remainder[3]) << (7 * 2)) |\n\t\t\t\t\t(int(remainder[4]) << (7 * 1)) |\n\t\t\t\t\t(int(remainder[5]) << (7 * 0))\n\n\t\t\ttag := &ID3v2Tag{}\n\t\t\ttag.RawBytes = make([]byte, 10+length)\n\t\t\tcopy(tag.RawBytes, buffer)\n\t\t\tcopy(tag.RawBytes[4:], remainder)\n\n\t\t\tif ok := fillBuffer(stream, tag.RawBytes[10:]); !ok {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\treturn tag\n\t\t}\n\n\t\t// Check for a frame header, indicated by an 11-bit frame-sync\n\t\t// sequence.\n\t\tif buffer[0] == 0xFF && (buffer[1]&0xE0) == 0xE0 {\n\n\t\t\tframe := &MP3Frame{}\n\n\t\t\tif ok := parseHeader(buffer, frame); ok {\n\n\t\t\t\tframe.RawBytes = make([]byte, frame.FrameLength)\n\t\t\t\tcopy(frame.RawBytes, buffer)\n\n\t\t\t\tif ok := fillBuffer(stream, frame.RawBytes[4:]); !ok {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\n\t\t\t\treturn frame\n\t\t\t}\n\t\t}\n\n\t\t// Nothing found. Shift the buffer forward by one byte and try again.\n\t\tdebug(\"sync error: skipping byte\")\n\t\tbuffer[0] = buffer[1]\n\t\tbuffer[1] = buffer[2]\n\t\tbuffer[2] = buffer[3]\n\t\tn, _ := stream.Read(lastByte)\n\t\tif n < 1 {\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a2afb9ca814c4c546f46c38fbf9dbd23", "score": "0.5724866", "text": "func readTag(buffer *dicomio.Decoder) dicomtag.Tag {\n\tgroup := buffer.ReadUInt16() // group\n\telement := buffer.ReadUInt16() // element\n\treturn dicomtag.Tag{group, element}\n}", "title": "" }, { "docid": "a19c3916322dc047e058fe8d44b397b4", "score": "0.5543911", "text": "func getTag(r *bytes.Reader) ([]byte, error) {\n\tvar data NbtTag\n\terr := binary.Read(r, byteOrder, &data.TagType)\n\tif err != nil {\n\t\treturn nil, NbtParseError{\"Reading TagType\", err}\n\t}\n\t// do not try to fetch name for TagType 0 which is compound end tag\n\tif data.TagType != 0 {\n\t\tvar err error\n\t\tvar nameLen int16\n\t\terr = binary.Read(r, byteOrder, &nameLen)\n\t\tif err != nil {\n\t\t\treturn nil, NbtParseError{\"Reading Name length\", err}\n\t\t}\n\t\tname := make([]byte, nameLen)\n\t\terr = binary.Read(r, byteOrder, &name)\n\t\tif err != nil {\n\t\t\treturn nil, NbtParseError{fmt.Sprintf(\"Reading Name - is UseJavaEncoding or UseBedrockEncoding set correctly? Name length decoded is %d\", nameLen), err}\n\t\t}\n\t\tdata.Name = string(name[:])\n\t}\n\tdata.Value, err = getPayload(r, data.TagType)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\toutJson, err := json.MarshalIndent(data, \"\", \" \")\n\treturn outJson, err\n}", "title": "" }, { "docid": "fa4eb56be37b89e246b6729d5c319732", "score": "0.54657185", "text": "func readIDTag(v []uint8) (IDTag uint8, encodedHash string, err error) {\n\tIDTag = v[0]\n\thash := []byte{}\n\tfor _, x := range v[1:] {\n\t\thash = append(hash, byte(x))\n\t}\n\n\tvar prefix binary.HashPrefix\n\tswitch IDTag {\n\tcase IDTagAccount:\n\t\tprefix = binary.PrefixAccountPubkey\n\tcase IDTagName:\n\t\tprefix = binary.PrefixName\n\tcase IDTagCommitment:\n\t\tprefix = binary.PrefixCommitment\n\tcase IDTagOracle:\n\t\tprefix = binary.PrefixOraclePubkey\n\tcase IDTagContract:\n\t\tprefix = binary.PrefixContractPubkey\n\tcase IDTagChannel:\n\t\tprefix = binary.PrefixChannel\n\tdefault:\n\t\treturn 0, \"\", fmt.Errorf(\"readIDTag() does not recognize this IDTag (first byte in input array): %v\", IDTag)\n\t}\n\n\tencodedHash = binary.Encode(prefix, hash)\n\treturn\n}", "title": "" }, { "docid": "3546ade03befbc6f3743bb89698275a0", "score": "0.5251651", "text": "func containsEnhancedTAG(rs io.ReadSeeker) bool {\n\t_, err := rs.Seek(-int64(TAGSIZE+ENHANCEDSIZE), io.SeekEnd)\n\tif err != nil {\n\t\treturn false\n\t}\n\tidentifier, err := util.Read(rs, 4)\n\tif err != nil {\n\t\treturn false\n\t}\n\tif !bytes.Equal(identifier, []byte(ENHANCEDIDENTIFIER)) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "6ad40220bede7aa671cb4d49faa55ff2", "score": "0.52425826", "text": "func readExplicit(buffer *dicomio.Decoder, tag dicomtag.Tag) (string, uint32) {\n\tvr := buffer.ReadString(2)\n\tvar vl uint32\n\tif vr == \"US\" {\n\t\tvl = 2\n\t}\n\t// long value representations\n\tswitch vr {\n\tcase \"NA\", \"OB\", \"OD\", \"OF\", \"OL\", \"OW\", \"SQ\", \"UN\", \"UC\", \"UR\", \"UT\":\n\t\tbuffer.Skip(2) // ignore two bytes for \"future use\" (0000H)\n\t\tvl = buffer.ReadUInt32()\n\t\tif vl == element.VLUndefinedLength && (vr == \"UC\" || vr == \"UR\" || vr == \"UT\") {\n\t\t\tbuffer.SetError(errors.New(\"UC, UR and UT may not have an Undefined Length, i.e.,a Value Length of FFFFFFFFH\"))\n\t\t\tvl = 0\n\t\t}\n\tdefault:\n\t\tvl = uint32(buffer.ReadUInt16())\n\t\t// Rectify Undefined Length VL\n\t\tif vl == 0xffff {\n\t\t\tvl = element.VLUndefinedLength\n\t\t}\n\t}\n\tif vl != element.VLUndefinedLength && vl%2 != 0 {\n\t\tbuffer.SetErrorf(\"Encountered odd length (vl=%v) when reading explicit VR %v for tag %s\", vl, vr, dicomtag.DebugString(tag))\n\t\tvl = 0\n\t}\n\treturn vr, vl\n}", "title": "" }, { "docid": "dc8e6e8cc374d2ccc48dbecb41c609dc", "score": "0.52122146", "text": "func NextFrameOrID3v2Tag(stream io.Reader) (*MP3Frame, *ID3v2Tag, error) {\n\tfor {\n\t\tobj := NextObject(stream)\n\t\tswitch obj := obj.(type) {\n\t\tcase *MP3Frame:\n\t\t\treturn obj, nil, nil\n\t\tcase *ID3v1Tag:\n\t\t\treturn nil, nil, ErrID3v1\n\t\tcase *ID3v2Tag:\n\t\t\treturn nil, obj, nil\n\t\tcase nil:\n\t\t\treturn nil, nil, io.EOF\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a9439ca5e77e6aa5039d34ed327d915b", "score": "0.5197602", "text": "func ParseID3v2Header(reader io.Reader) (*ID3v2Header, error) {\n\tbuf := make([]byte, 10)\n\tn, err := reader.Read(buf)\n\tif err != nil || n != 10 {\n\t\treturn nil, ErrRead\n\t}\n\n\tif string(buf[0:3]) != \"ID3\" {\n\t\treturn nil, ErrInvalidHeader\n\t}\n\n\th := new(ID3v2Header)\n\th.Version = int(buf[3])\n\th.MinorVersion = int(buf[4])\n\th.Unsynchronized = buf[5]&(1<<7) != 0\n\th.Extended = buf[5]&(1<<6) != 0\n\th.Experimental = buf[5]&(1<<5) != 0\n\th.Footer = buf[5]&(1<<4) != 0\n\th.Size = ParseSynchSafe(buf[6:10])\n\treturn h, nil\n}", "title": "" }, { "docid": "d31bcb43d3ae954296698769911770a1", "score": "0.5145945", "text": "func (o obj3) read() (string, []byte) {\n\tfmt.Printf(\"Data received of type obj2 : The object structure = %#v\\n\", o)\n\treturn o.ID.String(), o.Data\n}", "title": "" }, { "docid": "28b5b4910b297a6a5ddfb28452006c54", "score": "0.5109154", "text": "func containsTAG(rs io.ReadSeeker) bool {\n\t_, err := rs.Seek(-int64(TAGSIZE), io.SeekEnd)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tidentifier, err := util.Read(rs, 3)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tif string(identifier) != IDENTIFIER {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "f14ffc6b22ba3b9a5ab59564e012072b", "score": "0.50165087", "text": "func (parsed rawHeader) getTag() (*byteBuffer, error) {\n\treturn parsed.getByteBuffer(headerTag)\n}", "title": "" }, { "docid": "eb507935b926e280a69b4d6de7951a60", "score": "0.5016033", "text": "func (c *controller) ReadNextTag(resp http.ResponseWriter, req *http.Request) {\n\tlog.Printf(\"Attempting to read next available tag...\")\n\n\t// TODO(duckworthd): Read timeout from query parameter \"timeout_sec\" if available.\n\tvar timeout time.Duration = 5 * time.Second\n\n\tstate, err := c.s.ReadNextTag(timeout)\n\tif err != nil {\n\t\tlog.Printf(\"Failed in call to Service.ReadNextTag(): %s\", err)\n\t\thttp.Error(resp, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\terr = json.NewEncoder(resp).Encode(state)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to encode JSON: %s\", err)\n\t\thttp.Error(resp, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tlog.Printf(\"Succesfully return tag: %s\", state.UUID)\n}", "title": "" }, { "docid": "ce94b9915e84b17ca2285827294a6715", "score": "0.5014701", "text": "func readImplicit(buffer *dicomio.Decoder, tag dicomtag.Tag) (string, uint32) {\n\tvr := \"UN\"\n\tif entry, err := dicomtag.Find(tag); err == nil {\n\t\tvr = entry.VR\n\t}\n\n\tvl := buffer.ReadUInt32()\n\tif vl != element.VLUndefinedLength && vl%2 != 0 {\n\t\tbuffer.SetErrorf(\"Encountered odd length (vl=%v) when reading implicit VR '%v' for tag %s\", vl, vr, dicomtag.DebugString(tag))\n\t\tvl = 0\n\t}\n\treturn vr, vl\n}", "title": "" }, { "docid": "b5ceddd91e32e5b34bf743f8feacf871", "score": "0.4952558", "text": "func (o *ObjectDatabase) Tag(sha []byte) (*Tag, error) {\n\tvar t Tag\n\n\tif err := o.openDecode(sha, &t); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &t, nil\n}", "title": "" }, { "docid": "068df9815eaeb8f5322b3ff2dd6f445f", "score": "0.4902401", "text": "func (t *Tag) ReadFrom(r io.Reader) (int64, error) {\n\trr := newReader(r)\n\n\t// Read 3 bytes to check for the ID3 file id.\n\tif rr.Load(3); rr.err != nil {\n\t\treturn int64(rr.n), rr.err\n\t}\n\tfileID := rr.Bytes()\n\tif fileID[0] != 'I' || fileID[1] != 'D' || fileID[2] != '3' {\n\t\treturn int64(rr.n), ErrInvalidTag\n\t}\n\n\t// Read another byte to check the version number (2.2, 2.3, or 2.4).\n\tif rr.Load(1); rr.err != nil {\n\t\treturn int64(rr.n), rr.err\n\t}\n\tt.Version = Version(rr.Bytes()[3])\n\tc, err := newCodec(t.Version)\n\tif err != nil {\n\t\treturn int64(rr.n), err\n\t}\n\n\t// Decode the rest of the tag.\n\terr = c.Decode(t, rr)\n\treturn int64(rr.n), err\n}", "title": "" }, { "docid": "869ff7d22e50ea6eae339a349035dc12", "score": "0.48054633", "text": "func (o obj1) read() (string, []byte) {\n\tfmt.Printf(\"Data received of type obj1: The object structure = %#v\\n\", o)\n\treturn string(o.ID), o.Data\n}", "title": "" }, { "docid": "cd1cef8350005701b471d1a60aac91fc", "score": "0.4789526", "text": "func (s *DPKISmartContract) ReadDPKIAsset(ctx contractapi.TransactionContextInterface, id string) (*DPKIAsset, error) {\n\n\t// Enable logging.\n\tlog.SetOutput(io.MultiWriter(os.Stdout))\n\n\t// Retrieve dPKI asset.\n\tdPKIAssetJSON, err := ctx.GetStub().GetState(id)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read from world state: %v\", err)\n\t}\n\tif dPKIAssetJSON == nil {\n\t\treturn nil, fmt.Errorf(\"the dPKI asset %s does not exist\", id)\n\t}\n\tlog.Println(\"Found dPKI asset:\\n\", dPKIAssetJSON)\n\n\tvar dPKIAsset DPKIAsset\n\t// Marshal the afore mentioned asset to it's json form.\n\terr = json.Unmarshal(dPKIAssetJSON, &dPKIAsset)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &dPKIAsset, nil\n}", "title": "" }, { "docid": "a99715292aec5d0bf893ab643470f19b", "score": "0.4748477", "text": "func (tag *Tag) Read4ByteTag() {\n\t_tag := make([]byte, 4)\n\tn, err := tag.file.Read(_tag)\n\tif err != nil && n != 4 {\n\t\tpanic(\"expected to read 4 bytes\")\n\t}\n\tcopy(tag.tag, _tag)\n\n}", "title": "" }, { "docid": "483fac9fcc7b646cacffdc6bb381e09a", "score": "0.4728841", "text": "func (r *Reader) ReadTag() (*Tag, io.Reader, error) {\n\tb, err := r.next(15)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\ttag := &Tag{\n\t\tType: b[4],\n\t\tSize: getInt24(b[5:]),\n\t\tTime: getTime(b[8:]),\n\t\tStream: getUint24(b[12:]),\n\t}\n\tdata, err := r.reader(tag.Size)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn tag, data, nil\n}", "title": "" }, { "docid": "1773d185796ef54efa4c42497ed17969", "score": "0.47170657", "text": "func ReadNamedTag(r io.Reader) (Tag, string, error) {\n\t_tt, err := kagus.ReadByte(r)\n\tif err != nil {\n\t\treturn Tag{}, \"\", err\n\t}\n\ttt := TagType(_tt)\n\n\tif tt == TAG_End {\n\t\treturn Tag{Type: tt}, \"\", nil\n\t}\n\n\tname, err := readTagData(r, TAG_String)\n\tif err != nil {\n\t\treturn Tag{}, \"\", err\n\t}\n\n\ttd, err := readTagData(r, tt)\n\treturn Tag{Type: tt, Payload: td}, name.(string), err\n}", "title": "" }, { "docid": "3036b6cbb0b82a9841f7c4659bbaa29a", "score": "0.46948525", "text": "func parseV24Tag(reader *bufio.Reader) []byte {\n\ttag := new(ID3v24)\n\tparseV24Header(reader, tag)\n\tif tag.Header.ExtendedHeader {\n\t\tskipB(reader, parseV24Size(reader) - 4)\n\t}\n\n\tfor hasFrame(reader, 4) {\n\t\tparseV24Frame(reader, tag)\n\t}\n\n\tif tag.Header.FooterPresent {\n\t\tfor hasFooter(reader) == false {\n\t\t\tskipB(reader, 1)\n\t\t}\n\t\tparseV24Footer(reader, tag)\n\t} else {\n\t\ttag.Footer = nil\n\t}\n\n\tresult, err := json.Marshal(tag)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Unable to convert tag to JSON data.\"))\n\t}\n\n\treturn result;\n}", "title": "" }, { "docid": "a1def79df19e8071e831f32b2ba9b718", "score": "0.46887258", "text": "func WriteTag(file string, track *PrivateTrack) error {\n\ttag, err := id3v2.Open(file, id3v2.Options{Parse: true})\n\tif err != nil {\n\t\tlog.Fatal(\"error opening mp3 file\", err)\n\t}\n\ttag.AddTextFrame(tag.CommonID(\"Title\"), tag.DefaultEncoding(), track.Data.SongTitle)\n\ttag.AddTextFrame(tag.CommonID(\"Lead artist/Lead performer/Soloist/Performing group\"), tag.DefaultEncoding(), track.Data.Artists[0].Name)\n\ttag.AddTextFrame(tag.CommonID(\"Album/Movie/Show title\"), tag.DefaultEncoding(), track.Data.AlbumTitle)\n\t//tag.AddTextFrame(tag.CommonID(\"Band/Orchestra/Accompaniment\"), tag.DefaultEncoding(), track.Data.)\n\ttag.AddTextFrame(tag.CommonID(\"Track number/Position in set\"), tag.DefaultEncoding(), track.Data.TrackNumber)\n\ttag.AddTextFrame(tag.CommonID(\"Part of a set\"), tag.DefaultEncoding(), track.Data.DiskNumber)\n\ttag.AddTextFrame(tag.CommonID(\"ISRC\"), tag.DefaultEncoding(), track.Data.ISRC)\n\t//tag.AddTextFrame(tag.CommonID(\"Length\"), tag.DefaultEncoding(), track.Data.)\n\t//tag.AddTextFrame(tag.CommonID(\"Attached picture\"), tag.DefaultEncoding(), track.Data.)\n\t//tag.AddTextFrame(tag.CommonID(\"Unsynchronised lyrics/text transcription\"), tag.DefaultEncoding(), track.Lyrics.LyricsText)\n\t//tag.AddTextFrame(tag.CommonID(\"Publisher\"), tag.DefaultEncoding(), track.Data.)\n\t//tag.AddTextFrame(tag.CommonID(\"Genre\"), tag.DefaultEncoding(), track.Data.)\n\ttag.AddTextFrame(tag.CommonID(\"Copyright message\"), tag.DefaultEncoding(), track.Data.Copywrite)\n\t//tag.AddTextFrame(tag.CommonID(\"Date\"), tag.DefaultEncoding(), track.Data.PhysicalReleaseDate)\n\t//tag.AddTextFrame(tag.CommonID(\"Year\"), tag.DefaultEncoding(), track.Data.)\n\t//tag.AddTextFrame(tag.CommonID(\"BPM\"), tag.DefaultEncoding(), track.Data.BPM)\n\t//tag.AddTextFrame(tag.CommonID(\"Composer\"), tag.DefaultEncoding(), track.Data.)\n\tif err = tag.Save(); err != nil {\n\t\tlog.Fatal(\"error while saving tag\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4a2c3f26f6dd4719a45848016bc834b3", "score": "0.46541008", "text": "func Decodev3(buf v3.Reader, e interface{}) error {\n\tdec := NewV3Decoder(buf, true)\n\t//We dont have to lock/unlock since we know we are the only one witha access\n\treturn dec.decode(e)\n}", "title": "" }, { "docid": "e355612a845bebfce3e949265db13bab", "score": "0.46533826", "text": "func readRawItem(d *dicomio.Decoder) ([]byte, bool) {\n\ttag := readTag(d)\n\t// Item is always encoded implicit. PS3.6 7.5\n\tvr, vl := readImplicit(d, tag)\n\tif d.Error() != nil {\n\t\treturn nil, true\n\t}\n\tif tag == dicomtag.SequenceDelimitationItem {\n\t\tif vl != 0 {\n\t\t\td.SetErrorf(\"SequenceDelimitationItem's VL != 0: %v\", vl)\n\t\t}\n\t\treturn nil, true\n\t}\n\tif tag != dicomtag.Item {\n\t\td.SetErrorf(\"Expect Item in pixeldata but found tag %v\", dicomtag.DebugString(tag))\n\t\treturn nil, false\n\t}\n\tif vl == element.VLUndefinedLength {\n\t\td.SetErrorf(\"Expect defined-length item in pixeldata\")\n\t\treturn nil, false\n\t}\n\tif vr != \"NA\" {\n\t\td.SetErrorf(\"Expect NA item, but found %s\", vr)\n\t\treturn nil, true\n\t}\n\treturn d.ReadBytes(int(vl)), false\n}", "title": "" }, { "docid": "61df96897e0df55f06f1b9909fe20efa", "score": "0.46340474", "text": "func (o obj2) read() (string, []byte) {\n\tfmt.Printf(\"Data received of type obj2 : The object structure = %#v\\n\", o)\n\treturn o.ID, o.Data\n}", "title": "" }, { "docid": "d97e7ead39b61e1b107bc8b5371ebeb8", "score": "0.4614455", "text": "func parseV24Header(reader *bufio.Reader, tag *ID3v24) {\n\tskipB(reader, 3)\n\ttag.Header.Version[0] = int(readB(reader, 1)[0])\n\ttag.Header.Version[1] = int(readB(reader, 1)[0])\n\tflags := readB(reader, 1)\n\ttag.Header.Unsynchronisation = flags[0] & 1<<7 != 0\n\ttag.Header.ExtendedHeader = flags[0] & 1<<6 != 0\n\ttag.Header.ExperimentalInd = flags[0] & 1<<5 != 0\n\ttag.Header.FooterPresent = flags[0] & 1<<4 != 0\n\ttag.Header.Size = parseV24Size(reader)\n}", "title": "" }, { "docid": "be9e2e269b1c4fd014d762ef0fcbd369", "score": "0.4580963", "text": "func readObject(doc *enigma.Doc, name string) (*enigma.GenericObject, error) {\n\treturn doc.GetObject(ctx, name)\n}", "title": "" }, { "docid": "34e4518b09fd1629f6f3128fbf3275b5", "score": "0.4570682", "text": "func readHeader(r io.Reader) (tag packetType, length int64, contents io.Reader, err error) {\n\tvar buf [4]byte\n\t_, err = io.ReadFull(r, buf[:1])\n\tif err != nil {\n\t\treturn\n\t}\n\tif buf[0]&0x80 == 0 {\n\t\terr = errors.StructuralError(\"tag byte does not have MSB set\")\n\t\treturn\n\t}\n\tif buf[0]&0x40 == 0 {\n\t\t// Old format packet\n\t\ttag = packetType((buf[0] & 0x3f) >> 2)\n\t\tlengthType := buf[0] & 3\n\t\tif lengthType == 3 {\n\t\t\tlength = -1\n\t\t\tcontents = r\n\t\t\treturn\n\t\t}\n\t\tlengthBytes := 1 << lengthType\n\t\t_, err = readFull(r, buf[0:lengthBytes])\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tfor i := 0; i < lengthBytes; i++ {\n\t\t\tlength <<= 8\n\t\t\tlength |= int64(buf[i])\n\t\t}\n\t\tcontents = &spanReader{r, length}\n\t\treturn\n\t}\n\n\t// New format packet\n\ttag = packetType(buf[0] & 0x3f)\n\tlength, isPartial, err := readLength(r)\n\tif err != nil {\n\t\treturn\n\t}\n\tif isPartial {\n\t\tcontents = &partialLengthReader{\n\t\t\tremaining: length,\n\t\t\tisPartial: true,\n\t\t\tr: r,\n\t\t}\n\t\tlength = -1\n\t} else {\n\t\tcontents = &spanReader{r, length}\n\t}\n\treturn\n}", "title": "" }, { "docid": "ec3e5997d2e571386b96a23152d208a9", "score": "0.45246264", "text": "func (d *Dao) Tag(c context.Context, tid int64, mid int64) (*taGrpcModel.Tag, error) {\n\targ := &taGrpcModel.TagReq{\n\t\tMid: mid,\n\t\tTid: tid,\n\t}\n\treply, err := d.tagRPC.Tag(c, arg)\n\tif err != nil {\n\t\tlog.Error(\"d.dao.Tag(%v) error: %v\", arg, err)\n\t\treturn nil, err\n\t}\n\treturn reply.Tag, err\n}", "title": "" }, { "docid": "cace28bf36c6b118531eb7a1eb23d1d3", "score": "0.44700024", "text": "func (x *ID3) GetLocaleTag(lang string, tag string) (string, error) {\n\tt, err := mapTagToV24(tag)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif val, err := xmp.GetLocaleField(x, lang, t); err != nil {\n\t\treturn \"\", fmt.Errorf(\"%s: %v\", NsID3.GetName(), err)\n\t} else {\n\t\treturn val, nil\n\t}\n}", "title": "" }, { "docid": "5ba5321c094515d63ba7873068fbca20", "score": "0.4461631", "text": "func GetVersionIRI(e ld.Entity) interface{} { return e.Get(Prop_VersionIRI.ID) }", "title": "" }, { "docid": "5a28c43514301480d0985d9cc66368ee", "score": "0.44542205", "text": "func (s *SmartContract) ReadDID(ctx contractapi.TransactionContextInterface, id string) (string, error) {\n\n\tdidJSON, err := ctx.GetStub().GetState(id)\n\tfmt.Print(string(didJSON))\n\tif err != nil {\n\t\treturn string(didJSON), fmt.Errorf(\"Unexpected error : %q\", err)\n\t}\n\treturn string(didJSON), nil\n}", "title": "" }, { "docid": "8aabf4c4da66dfc6e4e932f38a9212ad", "score": "0.44516656", "text": "func formatMetaCacheV1(r io.ReadSeeker) (*formatCacheV1, error) {\n\tformat := &formatCacheV1{}\n\tif err := jsonLoad(r, format); err != nil {\n\t\treturn nil, err\n\t}\n\treturn format, nil\n}", "title": "" }, { "docid": "d3d65fb2ddf1a790cff0b1eb0d6dcaaa", "score": "0.44217253", "text": "func (c *defTagsCache) getTagID(target *utils.TargetColumns, metric telegraf.Metric) (int, error) {\n\tmeasureName := metric.Name()\n\ttags := metric.Tags()\n\tcacheKey := constructCacheKey(tags)\n\ttagID, isCached := c.checkTagCache(measureName, cacheKey)\n\tif isCached {\n\t\treturn tagID, nil\n\t}\n\n\tvar whereParts []string\n\tvar whereValues []interface{}\n\tif c.tagsAsJSONb {\n\t\twhereParts = []string{utils.QuoteIdent(columns.TagsJSONColumn) + \"= $1\"}\n\t\tnumTags := len(tags)\n\t\tif numTags > 0 {\n\t\t\td, err := utils.BuildJsonb(tags)\n\t\t\tif err != nil {\n\t\t\t\treturn tagID, err\n\t\t\t}\n\t\t\twhereValues = []interface{}{d}\n\t\t} else {\n\t\t\twhereValues = []interface{}{nil}\n\t\t}\n\t} else {\n\t\twhereParts = make([]string, len(target.Names)-1)\n\t\twhereValues = make([]interface{}, len(target.Names)-1)\n\t\twhereIndex := 1\n\t\tfor columnIndex, tagName := range target.Names[1:] {\n\t\t\tif val, ok := tags[tagName]; ok {\n\t\t\t\twhereParts[columnIndex] = utils.QuoteIdent(tagName) + \" = $\" + strconv.Itoa(whereIndex)\n\t\t\t\twhereValues[whereIndex-1] = val\n\t\t\t} else {\n\t\t\t\twhereParts[whereIndex-1] = tagName + \" IS NULL\"\n\t\t\t}\n\t\t\twhereIndex++\n\t\t}\n\t}\n\n\ttagsTableName := c.tagsTableName(measureName)\n\ttagsTableFullName := utils.FullTableName(c.schema, tagsTableName).Sanitize()\n\t// SELECT tag_id FROM measure_tag WHERE t1 = v1 AND ... tN = vN\n\tquery := fmt.Sprintf(selectTagIDTemplate, tagsTableFullName, strings.Join(whereParts, \" AND \"))\n\terr := c.db.QueryRow(query, whereValues...).Scan(&tagID)\n\t// tag set found in DB, cache it and return\n\tif err == nil {\n\t\tc.addToCache(measureName, cacheKey, tagID)\n\t\treturn tagID, nil\n\t}\n\n\t// tag set is new, insert it, and cache the tagID\n\tquery = utils.GenerateInsert(tagsTableFullName, target.Names[1:]) + \" RETURNING \" + columns.TagIDColumnName\n\terr = c.db.QueryRow(query, whereValues...).Scan(&tagID)\n\tif err == nil {\n\t\tc.addToCache(measureName, cacheKey, tagID)\n\t}\n\treturn tagID, err\n}", "title": "" }, { "docid": "840f535e73a4f170be9ed58263efef96", "score": "0.44183967", "text": "func (i *Iter) NextTag() (t Tag, err error) {\n\tif len(i.data) < 4 { //tag\n\t\treturn t, io.EOF\n\t}\n\n\ttag, err := strconv.ParseUint(string(i.data[:4]), 16, 16)\n\tif err != nil {\n\t\treturn t, err\n\t}\n\n\ti.data = i.data[4:]\n\tt.Constructor = uint16(tag)&gConstructor != 0\n\tt.Tag = uint16(tag) & ^gConstructor\n\n\tif i.data[0] != ' ' {\n\t\tdataStart := bytes.IndexByte(i.data, ' ')\n\t\tif dataStart == -1 {\n\t\t\treturn t, io.ErrShortBuffer\n\t\t}\n\n\t\tdataLen, err := strconv.ParseInt(string(i.data[:dataStart]), 10, 32)\n\t\tif err != nil {\n\t\t\treturn t, err\n\t\t} else if dataLen < 0 {\n\t\t\treturn t, strconv.ErrRange\n\t\t}\n\n\t\tif dataStart+int(dataLen)+1 > len(i.data) {\n\t\t\treturn t, io.ErrShortBuffer\n\t\t}\n\n\t\tdata := i.data[dataStart+1:]\n\t\tt.Data = data[:int(dataLen)]\n\t\tif t.Constructor {\n\t\t\t// assume nested tags, and start at the nested tag\n\t\t\ti.data = data\n\t\t} else {\n\t\t\t//else, jump to next tag\n\n\t\t}\n\t\ti.data = data[int(dataLen):]\n\n\t} else { //variable length\n\t\ti.data = i.data[1:]\n\t\tt.Data = i.data\n\t\tt.VarLen = true\n\t}\n\n\treturn t, nil\n}", "title": "" }, { "docid": "8634221ef61f5db5638414b9c430ae30", "score": "0.43967265", "text": "func TestReadByString(t *testing.T) {\n\ttypeIndex := ByEquality(\"type\")\n\n\ttable := New(Tag{}, &Options{\n\t\tKey: \"slug\",\n\t\tStore: fs.NewStore(),\n\t\tIndexes: []Index{typeIndex},\n\t\tDebug: false,\n\t\tNamespace: uuid.Must(uuid.NewV4()).String(),\n\t})\n\n\terr := table.Create(Tag{\n\t\tSlug: \"1\",\n\t\tType: \"post-tag\",\n\t})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\terr = table.Create(Tag{\n\t\tSlug: \"2\",\n\t\tType: \"post-tag\",\n\t})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\ttags := []Tag{}\n\tq := QueryEquals(\"type\", \"post-tag\")\n\terr = table.Read(q, &tags)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif len(tags) != 2 {\n\t\tt.Fatal(tags)\n\t}\n}", "title": "" }, { "docid": "9a7ba429fd6056f2660f3c37e74c17f9", "score": "0.43867072", "text": "func readHeader(r io.Reader, h *header, version int) error {\n\tbuf := make([]byte, headerSize(version))\n\t_, err := r.Read(buf)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version == 1 {\n\t\tbuf = append(buf, \"sha1\"...)\n\t}\n\n\treturn binary.Read(bytes.NewBuffer(buf), binary.BigEndian, h)\n}", "title": "" }, { "docid": "0114142f9c29f233066a7f38f786a531", "score": "0.4381413", "text": "func (v *IntVector) R3() r3.Vector {\n\treturn r3.Vector{\n\t\tX: float64(v.X),\n\t\tY: float64(v.Y),\n\t\tZ: float64(v.Z),\n\t}\n}", "title": "" }, { "docid": "2ab9559bde0137d8614c101506584479", "score": "0.43704483", "text": "func getPayload(r *bytes.Reader, tagType byte) (interface{}, error) {\n\tvar output interface{}\n\tvar err error\n\tswitch tagType {\n\tcase 0:\n\t\t// end tag for compound; do nothing further\n\tcase 1:\n\t\tvar i int8\n\t\terr = binary.Read(r, byteOrder, &i)\n\t\tif err != nil {\n\t\t\treturn nil, NbtParseError{\"Reading int8\", err}\n\t\t}\n\t\toutput = i\n\tcase 2:\n\t\tvar i int16\n\t\terr = binary.Read(r, byteOrder, &i)\n\t\tif err != nil {\n\t\t\treturn nil, NbtParseError{\"Reading int16\", err}\n\t\t}\n\t\toutput = i\n\tcase 3:\n\t\tvar i int32\n\t\terr = binary.Read(r, byteOrder, &i)\n\t\tif err != nil {\n\t\t\treturn nil, NbtParseError{\"Reading int32\", err}\n\t\t}\n\t\toutput = i\n\tcase 4:\n\t\tvar i int64\n\t\terr = binary.Read(r, byteOrder, &i)\n\t\tif err != nil {\n\t\t\treturn nil, NbtParseError{\"Reading int64\", err}\n\t\t}\n\t\tif longAsString {\n\t\t\toutput = fmt.Sprintf(\"%d\", i)\n\t\t} else {\n\t\t\toutput = longToIntPair(i)\n\t\t}\n\tcase 5:\n\t\tvar f float32\n\t\terr = binary.Read(r, byteOrder, &f)\n\t\tif err != nil {\n\t\t\treturn nil, NbtParseError{\"Reading float32\", err}\n\t\t}\n\t\toutput = f\n\tcase 6:\n\t\tvar f float64\n\t\terr = binary.Read(r, byteOrder, &f)\n\t\tif err != nil {\n\t\t\treturn nil, NbtParseError{\"Reading float64\", err}\n\t\t}\n\t\tif math.IsNaN(f) {\n\t\t\toutput = \"NaN\"\n\t\t} else {\n\t\t\toutput = f\n\t\t}\n\tcase 7:\n\t\tvar byteArray []int8\n\t\tvar oneByte int8\n\t\tvar numRecords int32\n\t\terr := binary.Read(r, byteOrder, &numRecords)\n\t\tif err != nil {\n\t\t\treturn nil, NbtParseError{\"Reading byte array tag length\", err}\n\t\t}\n\t\tfor i := int32(1); i <= numRecords; i++ {\n\t\t\terr = binary.Read(r, byteOrder, &oneByte)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, NbtParseError{\"Reading byte in byte array tag\", err}\n\t\t\t}\n\t\t\tbyteArray = append(byteArray, oneByte)\n\t\t}\n\t\toutput = byteArray\n\tcase 8:\n\t\tvar strLen int16\n\t\terr := binary.Read(r, byteOrder, &strLen)\n\t\tif err != nil {\n\t\t\treturn nil, NbtParseError{\"Reading string tag length\", err}\n\t\t}\n\t\tutf8String := make([]byte, strLen)\n\t\terr = binary.Read(r, byteOrder, &utf8String)\n\t\tif err != nil {\n\t\t\treturn nil, NbtParseError{\"Reading string tag data\", err}\n\t\t}\n\t\toutput = string(utf8String[:])\n\tcase 9:\n\t\tvar tagList NbtTagList\n\t\terr = binary.Read(r, byteOrder, &tagList.TagListType)\n\t\tif err != nil {\n\t\t\treturn nil, NbtParseError{\"Reading TagType\", err}\n\t\t}\n\t\tvar numRecords int32\n\t\terr := binary.Read(r, byteOrder, &numRecords)\n\t\tif err != nil {\n\t\t\treturn nil, NbtParseError{\"Reading list tag length\", err}\n\t\t}\n\t\tfor i := int32(1); i <= numRecords; i++ {\n\t\t\tpayload, err := getPayload(r, tagList.TagListType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, NbtParseError{\"Reading list tag item\", err}\n\t\t\t}\n\t\t\ttagList.List = append(tagList.List, payload)\n\t\t}\n\t\toutput = tagList\n\tcase 10:\n\t\tvar compound []json.RawMessage\n\t\tvar tagType byte\n\t\tfor err = binary.Read(r, byteOrder, &tagType); tagType != 0; err = binary.Read(r, byteOrder, &tagType) {\n\t\t\tif err != nil {\n\t\t\t\treturn nil, NbtParseError{\"compound: reading next tag type\", err}\n\t\t\t}\n\t\t\t_, err = r.Seek(-1, 1)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, NbtParseError{\"seeking back one\", err}\n\t\t\t}\n\t\t\ttag, err := getTag(r)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, NbtParseError{\"compound: reading a child tag\", err}\n\t\t\t}\n\t\t\tcompound = append(compound, json.RawMessage(string(tag)))\n\t\t}\n\t\tif compound == nil {\n\t\t\t// Explicitly give empty array else value will be null instead of []\n\t\t\toutput = []int{}\n\t\t} else {\n\t\t\toutput = compound\n\t\t}\n\tcase 11:\n\t\tvar intArray []int32\n\t\tvar numRecords, oneInt int32\n\t\terr := binary.Read(r, byteOrder, &numRecords)\n\t\tif err != nil {\n\t\t\treturn nil, NbtParseError{\"Reading int array tag length\", err}\n\t\t}\n\t\tfor i := int32(1); i <= numRecords; i++ {\n\t\t\terr := binary.Read(r, byteOrder, &oneInt)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, NbtParseError{\"Reading int in int array tag\", err}\n\t\t\t}\n\t\t\tintArray = append(intArray, oneInt)\n\t\t}\n\t\toutput = intArray\n\tcase 12:\n\t\tvar longArray []NbtLong\n\t\tvar longStringArray []string\n\t\tvar numRecords int32\n\t\tvar oneInt int64\n\t\terr := binary.Read(r, byteOrder, &numRecords)\n\t\tif err != nil {\n\t\t\treturn nil, NbtParseError{\"Reading long array tag length\", err}\n\t\t}\n\t\tfor i := int32(1); i <= numRecords; i++ {\n\t\t\terr := binary.Read(r, byteOrder, &oneInt)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, NbtParseError{\"Reading long in long array tag\", err}\n\t\t\t}\n\t\t\tlongArray = append(longArray, longToIntPair(oneInt))\n\t\t\tlongStringArray = append(longStringArray, fmt.Sprintf(\"%d\", oneInt))\n\t\t}\n\t\tif longAsString {\n\t\t\toutput = longStringArray\n\t\t} else {\n\t\t\toutput = longArray\n\t\t}\n\n\tdefault:\n\t\treturn nil, NbtParseError{fmt.Sprintf(\"TagType %d not recognized\", tagType), nil}\n\t}\n\treturn output, nil\n}", "title": "" }, { "docid": "74f9eafb87a6c5e80fe18f8b9caffef4", "score": "0.4366629", "text": "func (db *DB) GetTag(oldTag string) (*shimmie.Tag, error) {\n\tvar (\n\t\tt shimmie.Tag\n\t)\n\terr := db.QueryRow(tagGetQuery, oldTag).Scan(\n\t\t&t.ID,\n\t\t&t.Tag,\n\t\t&t.Count,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &t, nil\n}", "title": "" }, { "docid": "44907dd4089aadb5552c81fb5a42d4e3", "score": "0.4365203", "text": "func (s *Srv) GetTag(c *gin.Context) {\n\tid, err := strconv.ParseUint(c.Param(\"id\"), 10, 64)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t}\n\tvar tag Tag\n\ts.DB.Where(\"ID = ?\", id).First(&tag)\n\tc.JSON(http.StatusOK, tag)\n}", "title": "" }, { "docid": "47e52d743f6c9e9fa86dd58e26a5b32e", "score": "0.4357063", "text": "func (b *block) readRecord(ridx int) record {\n\tidx := hdrSize + ridx*recSize\n\t_, ts, _ := xbinary.UnmarshalUint64(b.buf[idx:])\n\t_, idx2, _ := xbinary.UnmarshalUint32(b.buf[idx+8:])\n\treturn record{int64(ts), idx2}\n}", "title": "" }, { "docid": "a18ff44a94c465d6425a1ba27191b1e9", "score": "0.43524307", "text": "func parseV24Frame(reader *bufio.Reader, tag *ID3v24) {\n\tvar frame ID3v24Frame\n\n\tframe.ID = string(readB(reader, 4))\n\tframe.Size = parseV24Size(reader)\n\tflags := readB(reader, 2)\n\tframe.TagAlterPreservation = flags[0] & 1<<6 != 0\n\tframe.FileAlterPreservation = flags[0] & 1<<5 != 0\n\tframe.ReadOnly = flags[0] & 1<<4 != 0\n\tframe.GroupingIdentity = flags[1] & 1<<6 != 0\n\tframe.Compression = flags[1] & 1<<3 != 0\n\tframe.Encryption = flags[1] & 1<<2 != 0\n\tframe.Unsynchronisation = flags[1] & 1<<1 != 0\n\tframe.DataLengthIdicator = flags[1] & 1 != 0\n\n\tif frame.ID[0] != 'T' && frame.ID[0] != 'W' {\n\t\tskipB(reader, frame.Size)\n\t\treturn\n\t}\n\n\tframe.TextEncoding = readB(reader, 1)[0]\n\tif frame.ID == \"TCON\" {\n\t\tframe.Data = parseGenre(readB(reader, frame.Size - 1))\n\t} else {\n\t\tframe.Data = strings.TrimSpace(string(readB(reader, frame.Size - 1)))\n\t}\n\ttag.Frames = append(tag.Frames, frame)\n}", "title": "" }, { "docid": "e4afcb30800c4e79e59197fc82300e58", "score": "0.43497136", "text": "func (u *ror2Reader) readAndDecodePrimitiveFieldValue() (string, error) {\n\tstartPos, err := u.unsafeReadPrimitiveFieldValue()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\ts, err := u.decoder(string(u.data[startPos:u.pos]))\n\treturn s, u.wrapDeserializationError(err)\n}", "title": "" }, { "docid": "5d3f4e14c80987ee5fb67c7c3a85a953", "score": "0.43476224", "text": "func (s Storage) GetContainerTag(ctx context.Context, lrn int, name string) (string, error) {\n\tkey := keyContainer(lrn, name)\n\tresp, err := s.etcd.Get(ctx, key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif resp.Count == 0 {\n\t\treturn \"\", ErrNotFound\n\t}\n\treturn string(resp.Kvs[0].Value), nil\n}", "title": "" }, { "docid": "980f6246e3a246fd414e9376e4175abc", "score": "0.43273842", "text": "func (tag *Tag) parse(rd io.Reader, opts Options) error {\n\tif rd == nil {\n\t\treturn errors.New(\"rd is nil\")\n\t}\n\n\theader, err := parseHeader(rd)\n\tif err == errNoTag || err == io.EOF {\n\t\ttag.init(rd, 0, 4)\n\t\treturn nil\n\t}\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error by parsing tag header: %v\", err)\n\t}\n\tif header.Version < 3 {\n\t\treturn ErrUnsupportedVersion\n\t}\n\n\ttag.init(rd, tagHeaderSize+header.FramesSize, header.Version)\n\tif !opts.Parse {\n\t\treturn nil\n\t}\n\treturn tag.parseFrames(opts)\n}", "title": "" }, { "docid": "f7c3d11ff540d3fe59e5d923b00cc8ec", "score": "0.43254524", "text": "func (char *FixedDecalAsset) Parse(reader *packet.Reader) {\n\n}", "title": "" }, { "docid": "c2372de16bb610c68f298f9ce2f25cd0", "score": "0.43161348", "text": "func (rm *ResourceManager) Tag() string {\n\treturn fmt.Sprintf(\"RM[%s/%s]\",\n\t\trm.Resource,\n\t\trm.RMSID)\n}", "title": "" }, { "docid": "6b8f510798635e76100a3e4e1a9306dc", "score": "0.43101442", "text": "func findTag(contents []byte, start int64) (offset, length int64, err error) {\n\t// An MSI can have a tagged Omaha inside of it, but that is the wrong tag -- it should be the\n\t// one on the outermost container, or none.\n\tcontents = contents[start:]\n\tlenContents := int64(len(contents))\n\n\t// Find the oidChromeTag in the contents. The search string includes everything up to the\n\t// asn1 length specification right before the Omaha2.0 marker.\n\toffset = int64(bytes.LastIndex(contents, oidChromeTagSearchBytes))\n\tif offset < 0 { // Not an error, simply not found.\n\t\treturn -1, 0, nil\n\t}\n\toffset += int64(len(oidChromeTagSearchBytes))\n\tif offset > lenContents-2 {\n\t\treturn -1, 0, fmt.Errorf(\"failed in findTag, want offset plus tag size bytes to fit in file size %d, but offset %d is too large\", lenContents, offset)\n\t}\n\tlength = int64(binary.BigEndian.Uint16(contents[offset:]))\n\toffset += 2\n\tif offset+length > lenContents {\n\t\treturn -1, 0, fmt.Errorf(\"failed in findTag, want tag buffer to fit in file size %d, but offset (%d) plus length (%d) is %d\", lenContents, offset, length, offset+length)\n\t}\n\treturn start + offset, length, nil\n}", "title": "" }, { "docid": "4366ed1007e48536d15117061eaf47b5", "score": "0.42979684", "text": "func GetRaw(loggedin bool, uid, id int64) (string, bool) {\n var text string\n var mid = \" \"\n if !loggedin {\n mid = \" public = true and \"\n }\n err := db.QueryRow(\n \"select text from article where ((draft = false) or (draft = true and user_id = ?)) and\" + mid + \"id = ?\",\n uid, id,\n ).Scan(&text)\n if err != nil {\n return \"\", false\n }\n return text, true\n}", "title": "" }, { "docid": "b85a32d8fea305722185ec9596ce5a9d", "score": "0.42860433", "text": "func (x *ID3) ListTags() (xmp.TagList, error) {\n\tif l, err := xmp.ListNativeFields(x); err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %v\", NsID3.GetName(), err)\n\t} else {\n\t\treturn l, nil\n\t}\n}", "title": "" }, { "docid": "53efa8da3ecc5c75f3b6456575376f64", "score": "0.42654476", "text": "func (r *Reader) Read() (record []string, err error) {}", "title": "" }, { "docid": "d7abbd2870bf5c50713a17b040cad0f1", "score": "0.42632532", "text": "func (o *VolumeGetIterResponseResult) NextTag() string {\n\tvar r string\n\tif o.NextTagPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.NextTagPtr\n\treturn r\n}", "title": "" }, { "docid": "b76d14a4dfdec3ce48fc76121579388f", "score": "0.4259187", "text": "func readUnstructuredV1OrDie(objBytes []byte) *unstructured.Unstructured {\n\tudi, _, err := scheme.Codecs.UniversalDecoder().Decode(objBytes, nil, &unstructured.Unstructured{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn udi.(*unstructured.Unstructured)\n}", "title": "" }, { "docid": "44cadcdb93eb76f1a7c99b5957d89f35", "score": "0.42585868", "text": "func (tag *CompoundTag) Read(reader io.Reader) error {\n\tif tag.Tags == nil {\n\t\ttag.Tags = make(map[string]Tag)\n\t}\n\n\tfor {\n\t\tt, err := ReadNamedTag(reader)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif t.TagID() == TagEnd {\n\t\t\tbreak\n\t\t}\n\n\t\ttag.Tags[t.Name()] = t\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d833d9af830441397068aa6237a9b1cd", "score": "0.42553464", "text": "func (v *VDRI) Read(didKey string, opts ...vdriapi.ResolveOpts) (*did.Doc, error) {\n\tparsed, err := did.Parse(didKey)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"pub:key vdri Read: failed to parse DID document: %w\", err)\n\t}\n\n\tif !isValidMethodID(parsed.MethodSpecificID) {\n\t\treturn nil, fmt.Errorf(\"vdri Read: invalid did:key method ID: %s\", parsed.MethodSpecificID)\n\t}\n\n\tpubKeyBytes, err := fingerprint.PubKeyFromFingerprint(parsed.MethodSpecificID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"pub:key vdri Read: failed to get key fingerPrint: %w\", err)\n\t}\n\n\t// did:key can't add non converted encryption key as keyAgreement (unless it's added as an option just like creator,\n\t// it can be added and read here if needed. Below TODO is a reminder for this)\n\t// TODO find a way to get the Encryption key as in creator.go\n\t// for now keeping original ed25519 to X25519 key conversion as keyAgreement.\n\tkeyAgr, err := keyAgreement(didKey, pubKeyBytes)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"pub:key vdri Read: failed to fetch KeyAgreement: %w\", err)\n\t}\n\n\tdidKey = fmt.Sprintf(\"did:key:%s\", parsed.MethodSpecificID)\n\tkeyID := fmt.Sprintf(\"%s#%s\", didKey, parsed.MethodSpecificID)\n\tpublicKey := did.NewPublicKeyFromBytes(keyID, ed25519VerificationKey2018, didKey, pubKeyBytes)\n\n\treturn createDoc(publicKey, keyAgr, didKey)\n}", "title": "" }, { "docid": "e239057d4831df83489b8e51d50c3ebe", "score": "0.42542237", "text": "func (udh UserDataHeader) IE(id byte) (InformationElement, bool) {\n\tfor i := len(udh) - 1; i >= 0; i-- {\n\t\tif udh[i].ID == id {\n\t\t\treturn udh[i], true\n\t\t}\n\t}\n\treturn InformationElement{}, false\n}", "title": "" }, { "docid": "0c299cdb30b47b8d8aa38a3446242522", "score": "0.42485237", "text": "func rtmpReadBasicHeader(ctx core.Context, in bufferedReader) (fmt uint8, cid uint32, err error) {\n\tif core.Conf.Debug.RtmpDumpRecv {\n\t\tcore.Trace.Println(ctx, \"start read basic header.\")\n\t}\n\n\tvar vb byte\n\tif vb, err = in.ReadByte(); err != nil {\n\t\treturn\n\t}\n\n\tfmt = uint8(vb)\n\tcid = uint32(fmt & 0x3f)\n\tfmt = (fmt >> 6) & 0x03\n\n\t// 2-63, 1B chunk header\n\tif cid >= 2 {\n\t\treturn\n\t}\n\n\t// 2 or 3B\n\tif cid >= 0 {\n\t\t// 64-319, 2B chunk header\n\t\tif vb, err = in.ReadByte(); err != nil {\n\t\t\treturn\n\t\t}\n\n\t\ttemp := uint32(vb) + 64\n\n\t\t// 64-65599, 3B chunk header\n\t\tif cid >= 1 {\n\t\t\tif vb, err = in.ReadByte(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\ttemp += uint32(vb) * 256\n\t\t}\n\n\t\treturn fmt, temp, nil\n\t}\n\n\treturn fmt, cid, RtmpChunkError\n}", "title": "" }, { "docid": "c2e537a6662e6ee4b80b10d07b444048", "score": "0.42383674", "text": "func (f genHelperDecoder) I2Rtid(v interface{}) uintptr {\n\treturn i2rtid(v)\n}", "title": "" }, { "docid": "b1f1ecba483b8a4eee3a2fda518114ce", "score": "0.42308784", "text": "func (s *Service) Tag(ID int64) (tag *model.Tag, err error) {\n\ttag = new(model.Tag)\n\tif err = s.dao.DB.First(&tag, ID).Error; err != nil {\n\t\tlog.Error(\"Tag(%v) error(%v)\", ID, err)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = ecode.NothingFound\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "ab0559ea6e738058fcc22c9117b9d98b", "score": "0.4230531", "text": "func (o *OIDCConnectorV3) V3() *OIDCConnectorV3 {\n\treturn o\n}", "title": "" }, { "docid": "7dbda84f6c3153be1a8f79aa1addee0d", "score": "0.4217924", "text": "func (api *HabiticaAPI) GetTagByID(id string) Tag {\n\t_, exists := fromCache(id)\n\n\ttag := Tag{}\n\tif !exists {\n\t\tapi.Get(\"/tags/\"+id, &tag)\n\t\tupdateCache(tag)\n\t}\n\ttag, _ = fromCache(id)\n\treturn tag\n}", "title": "" }, { "docid": "c7b0f834c09f2b55a80b0350d8cb351a", "score": "0.4212728", "text": "func GetTag(s storer.EncodedObjectStorer, h plumbing.Hash) (*Tag, error) {\n\to, err := s.EncodedObject(plumbing.TagObject, h)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn DecodeTag(s, o)\n}", "title": "" }, { "docid": "2775b3801ca7fbc0aec1176b4ee6a684", "score": "0.42029804", "text": "func Read(r io.ReadSeeker) (ret []Record, err error){\n\tvar currentOffset int64\n\n\t// Read the first 12 bytes - as far as I can tell they are just magic\n\tvar (\n\t\tmagic1 uint64\n\t\tmagic2 uint32\n\t)\n\tif err = binary.Read(r, binary.BigEndian, &magic1); err != nil {\n\t\terr = fmt.Errorf(\"error reading magic 1\")\n\t\treturn\n\t}\n\n\tif err = binary.Read(r, binary.BigEndian, &magic2); err != nil {\n\t\terr = fmt.Errorf(\"error reading magic 2\")\n\t\treturn\n\t}\n\tcurrentOffset += 12\n\n\t// Scan the XML - read until we get </bajaObjectGraph>\n\tvar xml []byte\n\tfor {\n\t\tvar x byte\n\t\tif err = binary.Read(r, binary.BigEndian, &x); err != nil {\n\t\t\terr = fmt.Errorf(\"error scanning XML header\")\n\t\t\treturn\n\t\t}\n\t\txml = append(xml, x)\n\t\tcurrentOffset += 1\n\t\tif endsWith(string(xml), \"</bajaObjectGraph>\"){\n\t\t\tbreak\n\t\t}\n\t}\n\tadvanceToNextMultipleOf16(&currentOffset)\n\tr.Seek(currentOffset, 0) // whence = 0 means relative to start of file\n\n\t// Scan rows until we find the first non-zero one\n\tvar (\n\t\ti1 int64\n\t\ti2 int64\n\t)\n\tfor {\n\t\tif err = binary.Read(r, binary.BigEndian, &i1); err != nil {\n\t\t\terr = fmt.Errorf(\"could not scan padding row\")\n\t\t\treturn\n\t\t}\n\t\tif err = binary.Read(r, binary.BigEndian, &i2); err != nil {\n\t\t\terr = fmt.Errorf(\"could not scan padding row\")\n\t\t\treturn\n\t\t}\n\t\tif i1 != 0 || i2 != 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tgoToPreviousMultipleOf16(&currentOffset) // Go back to start of row\n\tr.Seek(currentOffset, 0)\n\n\tfor {\n\t\trow, errI := scanRow(r)\n\t\tif errI != nil {\n\t\t\terrI = err\n\t\t\treturn\n\t\t}\n\t\tret = append(ret, row)\n\t}\n\n}", "title": "" }, { "docid": "c32c7587d3766538703371a85f197a65", "score": "0.42002952", "text": "func (api *HabiticaAPI) GetTag(name string) (Tag, error) {\n\t_, exists := fromCache(name)\n\n\ttag := Tag{}\n\tif !exists {\n\t\t_, err := api.GetTags()\n\t\tif err != nil {\n\t\t\treturn Tag{}, err\n\t\t}\n\t}\n\ttag, _ = fromCache(name)\n\treturn tag, nil\n}", "title": "" }, { "docid": "67ec16a57930620c9a4f4e75ef2b96ca", "score": "0.4197609", "text": "func ReadPKRU() PKRU", "title": "" }, { "docid": "91dcd7482fffa1a25bc9861fa49a397c", "score": "0.41888204", "text": "func ReadString(v interface{}, tag, tagval string) (txt string, err error) {\n\tfv := findField(v, tag, tagval) //find the field\n\tif fv == nil { //there was no such field, report it as an error\n\t\treturn \"\", ErrNoContentField\n\t}\n\t//convert to string type ()\n\tif !fv.Type().ConvertibleTo(stringType) {\n\t\treturn \"\", ErrWrongContentFieldType //has the wrong type\n\t}\n\t//conversion has been checked above\n\ttxt = fv.Convert(stringType).Interface().(string)\n\treturn\n\n}", "title": "" }, { "docid": "ba989f2d848d056a98366eda11b0de4b", "score": "0.41877875", "text": "func (r *Record) Read() {\n\tif hasError(r) {\n\t\treturn\n\t}\n\trow := r.db.QueryRow(`\n\t\tSELECT added_id, id, datatype, data, time \n\t\tFROM record \n\t\tWHERE id = $1 AND datatype = $2\n\t\tORDER BY time DESC LIMIT 1`, r.ID, r.DataType)\n\tr.err = row.Scan(&r.AddedID, &r.ID, &r.DataType, &r.Data, &r.Time)\n}", "title": "" }, { "docid": "9fe322921c408f47f751b5b464bde6c0", "score": "0.41844633", "text": "func parseEntityTag(structName, dosaAnnotation string) (string, time.Duration, ETLState, *PrimaryKey, error) {\n\ttag := dosaAnnotation\n\n\t// find the primaryKey\n\tmatchs := primaryKeyLeadingPattern.FindStringSubmatch(tag)\n\tif len(matchs) != primaryKeyLeadingPattern.NumSubexp()+1 {\n\t\treturn \"\", NoTTL(), EtlOff, nil, fmt.Errorf(\"dosa.Entity on object %s with an invalid dosa struct tag %q\", structName, tag)\n\t}\n\tpkString := matchs[1]\n\n\tkey, err := parsePrimaryKey(structName, pkString)\n\tif err != nil {\n\t\treturn \"\", NoTTL(), EtlOff, nil, errors.Wrapf(err, \"struct %s has an invalid primary key %q\", structName, pkString)\n\t}\n\ttoRemove := strings.TrimSuffix(matchs[0], matchs[2])\n\ttoRemove = strings.TrimSuffix(matchs[0], matchs[3])\n\ttag = strings.Replace(tag, toRemove, \"\", 1)\n\n\t// find the name\n\tfullNameTag, name, err := parseNameTag(tag, structName)\n\tif err != nil {\n\t\t// parseNameTag returns a sane error.\n\t\treturn \"\", NoTTL(), EtlOff, nil, err\n\t}\n\ttag = strings.Replace(tag, fullNameTag, \"\", 1)\n\n\t// find the ETL flag\n\tfullETLTag, etlState, err := parseETLTag(tag)\n\tif err != nil {\n\t\treturn \"\", NoTTL(), EtlOff, nil, errors.Wrapf(err, \"invalid etl tag: %s\", tag)\n\t}\n\ttag = strings.Replace(tag, fullETLTag, \"\", 1)\n\n\t// find the ttl flag\n\tfullTTLTag, ttl, err := parseTTLTag(tag)\n\tif err != nil {\n\t\treturn \"\", NoTTL(), EtlOff, nil, errors.Wrapf(err, \"invalid ttl tag: %s\", tag)\n\t}\n\ttag = strings.Replace(tag, fullTTLTag, \"\", 1)\n\n\ttag = strings.TrimSpace(tag)\n\tif tag != \"\" {\n\t\treturn \"\", NoTTL(), EtlOff, nil, fmt.Errorf(\"struct %s with an invalid dosa struct tag: %s\", structName, tag)\n\t}\n\n\treturn name, ttl, etlState, key, nil\n}", "title": "" }, { "docid": "16000d25c0b42c950608e91b9d374327", "score": "0.41805193", "text": "func (repo *Repository) Readlink(id SHA1) (string, error) {\n\n\tb, err := repo.OpenObject(id)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif b.Type() != ObjBlob {\n\t\treturn \"\", fmt.Errorf(\"id must point to a blob\")\n\t}\n\n\tblob := b.(*Blob)\n\n\t//TODO: check size and don't read unreasonable large blobs\n\tdata, err := ioutil.ReadAll(blob)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(data), nil\n}", "title": "" }, { "docid": "e2d164782047c9b71dc90ae24f321585", "score": "0.41804275", "text": "func (c S3Conn) Read(key string, recType string) (value []byte, err error) {\n\tsess := session.Must(session.NewSession(c.config))\n\t//svc := s3.New(sess)\n\tdownloader := s3manager.NewDownloader(sess)\n\tvalue, err = download(downloader, c.bucket, key)\n\n\treturn\n}", "title": "" }, { "docid": "d73438df6025cf33f8d1e2418e2331f6", "score": "0.4173669", "text": "func (parsed rawHeader) getIV() (*byteBuffer, error) {\n\treturn parsed.getByteBuffer(headerIV)\n}", "title": "" }, { "docid": "9f7a17b79b8771cd423b260a2b407da2", "score": "0.41701248", "text": "func getTagForObject(obj *events.S3Entity) *s3.PutObjectTaggingInput {\n\tvar filetype string\n\tfiletypeKey := FILETYPE_KEY\n\tfor potentialFiletype, regex := range REGEXES {\n\t\tif regex.MatchString(obj.Object.Key) {\n\t\t\tfiletype = potentialFiletype\n\t\t\tbreak\n\t\t}\n\t}\n\tif filetype == \"\" && obj.Object.Size >= MinSizeForLargeFile {\n\t\tfiletype = \"largefile\"\n\t}\n\tif filetype != \"\" {\n\t\tvar versionId *string = nil\n\t\t// cannot pass through empty string to aws\n\t\tif obj.Object.VersionID != \"\" {\n\t\t\tversionId = &obj.Object.VersionID\n\t\t}\n\t\treturn &s3.PutObjectTaggingInput{\n\t\t\tBucket: &obj.Bucket.Name,\n\t\t\tKey: &obj.Object.Key,\n\t\t\tTagging: &s3.Tagging{\n\t\t\t\tTagSet: []*s3.Tag{\n\t\t\t\t\t{Key: aws.String(filetypeKey), Value: aws.String(filetype)},\n\t\t\t\t},\n\t\t\t},\n\t\t\tVersionId: versionId,\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "df90a38d252873ec94266f44eb8a5e81", "score": "0.41638377", "text": "func (c *TagClient) Get(ctx context.Context, id int) (*Tag, error) {\n\treturn c.Query().Where(tag.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "7f858088dcf665786b56fe1e1e6fb32b", "score": "0.4157669", "text": "func Read3(s string) string {\n\tf, err := os.Open(s)\n\tif err != nil {\n\t\tfmt.Println(\"read file fail\", err)\n\t\tos.Exit(0)\n\t}\n\tdefer f.Close()\n\n\tfd, err := ioutil.ReadAll(f)\n\tif err != nil {\n\t\tfmt.Println(\"read to fd fail\", err)\n\t\tos.Exit(0)\n\n\t}\n\n\treturn string(fd[:])\n}", "title": "" }, { "docid": "f8afa6738930f3377ebcffbc17e252fb", "score": "0.41568506", "text": "func GetCachetagsViaTag(iTag string) (*Cachetags, error) {\n\tvar _Cachetags = &Cachetags{Tag: iTag}\n\thas, err := Engine.Get(_Cachetags)\n\tif has {\n\t\treturn _Cachetags, err\n\t} else {\n\t\treturn nil, err\n\t}\n}", "title": "" }, { "docid": "32952d40244bc44344b233fffaea68d7", "score": "0.41557744", "text": "func (c *snmpConn) read() error {\n\t// since the go implementation requires us to read udp packet\n\t// all at once, a larger buffer size is used\n\tbuf := make([]byte, 512)\n\tn, err := c.conn.read(buf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// asn1 constructed sequence\n\tif buf[0] != 48 {\n\t\treturn errors.New(\"malformed packet\")\n\t}\n\n\t// read full packet\n\tc.resp = append([]byte(nil), buf[:n]...)\n\t_, size := asn1Len(c.resp)\n\tfor len(c.resp) < size {\n\t\tn, err = c.conn.read(buf)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"malformed packet\")\n\t\t}\n\t\tc.resp = append(c.resp, buf[:n]...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4fa91cb8a2e2ea16083aab5df82ccea5", "score": "0.4154473", "text": "func (i *item) ETag() (string, error) {\n\treturn i.base.ETag()\n}", "title": "" }, { "docid": "54f2f108429743c4e760f10390c2cb66", "score": "0.41501212", "text": "func ReadOctet(r io.Reader) (data byte, err error) {\n\tif err = binary.Read(r, binary.BigEndian, &data); err != nil {\n\t\treturn 0, errors.New(\"Could not read byte: \" + err.Error())\n\t}\n\treturn data, nil\n}", "title": "" }, { "docid": "7ca71a16b06a4c8e5b0b6a8da634577d", "score": "0.41446337", "text": "func (s *Service) tags(c context.Context, aid int64) (res string, err error) {\n\tvar (\n\t\ttags map[int64][]*model.Tag\n\t\tts []string\n\t\targ = &model.ArgResTags{Type: model.PicResType, Oids: []int64{aid}}\n\t)\n\tif tags, err = s.tagRPC.ResTags(c, arg); err != nil {\n\t\tlog.Error(\"s.Tags(%d) error(%+v)\", aid, err)\n\t\tdao.PromError(\"rpc:获取Tag\")\n\t\treturn\n\t} else if tags == nil || len(tags[aid]) == 0 {\n\t\treturn\n\t}\n\tfor _, t := range tags[aid] {\n\t\tts = append(ts, t.Name)\n\t}\n\tres = strings.Join(ts, \",\")\n\treturn\n}", "title": "" }, { "docid": "d13cbb0bbd375d281f0ec8b479195061", "score": "0.41443005", "text": "func (c _StoreImpl) Tag_ByName(Name string) (*Tag, bool) {\n\to, ok := RowCacheIndex.Get(\"Tag_Name:\" + fmt.Sprintf(\"%v\", Name))\n\tif ok {\n\t\tif obj, ok := o.(*Tag); ok {\n\t\t\treturn obj, true\n\t\t}\n\t}\n\n\trow, err := NewTag_Selector().Name_Eq(Name).GetRow(base.DB)\n\tif err == nil {\n\t\tRowCacheIndex.Set(\"Tag_Name:\"+fmt.Sprintf(\"%v\", row.Name), row, 0)\n\t\treturn row, true\n\t}\n\n\tXOLogErr(err)\n\treturn nil, false\n}", "title": "" }, { "docid": "3d1038200cd111d82970312720aa2360", "score": "0.41424668", "text": "func getEvent(c *sqlite3.SQLiteConn, stmt string, rowid interface{}) (*Event, error) {\n\trows, err := SQLiteSelectConn(c, stmt, rowid)\n\tdefer rows.Close()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Sqlite hook error %w\", err)\n\t}\n\tvals := make([]driver.Value, 7)\n\tfor i := 0; i < 7; i++ {\n\t\tvar v interface{}\n\t\tvals[i] = v\n\n\t}\n\terr = rows.Next(vals)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error reading row from sqlite hook %w\", err)\n\t}\n\tif len(vals) != 7 {\n\t\treturn nil, fmt.Errorf(\"Sqlite hook: Incorrect number of returned results\")\n\t}\n\n\ttsel := func(v interface{}) string {\n\t\tswitch vv := v.(type) {\n\t\tcase string:\n\t\t\treturn vv\n\t\tcase []byte:\n\t\t\treturn string(vv)\n\t\tdefault:\n\t\t\treturn \"\"\n\t\t}\n\t}\n\n\ttaggy := &dbutil.StringArray{}\n\ttagstring := tsel(vals[4])\n\tif tagstring == \"\" {\n\t\ttaggy = nil\n\t} else {\n\t\terr = json.Unmarshal([]byte(tagstring), &taggy.Strings)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpval := tsel(vals[2])\n\tpkval := tsel(vals[6])\n\tpvalp := &pval\n\tpkvalp := &pkval\n\tif pval == \"\" {\n\t\tpvalp = nil\n\t}\n\tif vals[6] == nil {\n\t\tpkvalp = nil\n\t}\n\n\treturn &Event{\n\t\tUser: tsel(vals[0]),\n\t\tApp: tsel(vals[1]),\n\t\tPlugin: pvalp,\n\t\tObject: tsel(vals[3]),\n\t\tTags: taggy,\n\t\tType: tsel(vals[5]),\n\t\tKey: pkvalp,\n\t}, nil\n}", "title": "" }, { "docid": "6e4dee0e8888baa656a6b297545bc34a", "score": "0.4140725", "text": "func (s *SmartContract) ReadAsset(ctx contractapi.TransactionContextInterface, id string) (*Asset, error) {\n assetJSON, err := ctx.GetStub().GetState(id)\n if err != nil {\n return nil, fmt.Errorf(\"failed to read from world state: %v\", err)\n }\n if assetJSON == nil {\n return nil, fmt.Errorf(\"the asset %s does not exist\", id)\n }\n\n var asset Asset\n err = json.Unmarshal(assetJSON, &asset)\n if err != nil {\n return nil, err\n }\n\n return &asset, nil\n}", "title": "" }, { "docid": "d0295ff4d0efb3b7a6539889a813d3c1", "score": "0.41406202", "text": "func stat_3 (req Request) ( Response) {\n\tvar (\n\t\tresp = Response {\n\t\t\tErr: nil,\n\t\t\tUsermd: \"\",\n\t\t}\n\t\tusermd []byte\n\t\thead = datatype.StatObjRequest{\n\t\t\tService: req.Svc,\n\t\t\tBucket: req.Bucket,\n\t\t\tKey: req.Key,\n\t\t}\n\t)\n\t if result,err := api.StatObject(head) ; err == nil {\n\t\t if v, ok := result.Metadata[\"Usermd\"]; ok {\n\t\t\t if usermd, resp.Err = base64.StdEncoding.DecodeString(*v); resp.Err == nil {\n\t\t\t\t gLog.Trace.Printf(\"key:%s - Usermd: %s\", req.Key, string(usermd))\n\t\t\t\t resp.Usermd = string(usermd)\n\t\t\t }\n\t\t } else {\n\t\t\t resp.Usermd = fmt.Sprintf(\"Missing user metadata\")\n\t\t }\n\t } else {\n\t \tresp.Err = err\n\t }\n\treturn resp\n}", "title": "" }, { "docid": "9df5b79072d1331fb17e8b6a94f75800", "score": "0.41402128", "text": "func readBlob(ctx context.Context, cl *client.Client, bd *digest.Digest) ([]byte, error) {\n\tb, _, err := cl.ReadBlob(ctx, *bd)\n\tif err != nil {\n\t\t// convert gRPC code to LUCI errors tag.\n\t\tt := grpcutil.Tag.With(status.Code(err))\n\t\treturn nil, errors.Annotate(err, \"failed to read blob\").Tag(t).Err()\n\t}\n\treturn b, nil\n}", "title": "" }, { "docid": "730d9992ba1deb9c2d8447d84452694a", "score": "0.4139094", "text": "func (r RequestID) Tag() string {\n\treturn r.String()\n}", "title": "" }, { "docid": "c87caaa727abbc59ab7a6c050114e505", "score": "0.4137558", "text": "func (d *Dao) TagByName(c context.Context, mid int64, tname string) (*taGrpcModel.Tag, error) {\n\targ := &taGrpcModel.TagByNameReq{\n\t\tMid: mid,\n\t\tTname: tname,\n\t}\n\treply, err := d.tagRPC.TagByName(c, arg)\n\tif err != nil {\n\t\tlog.Error(\"d.dao.TagByName(%v) error: %v\", arg, err)\n\t\treturn nil, err\n\t}\n\treturn reply.Tag, err\n}", "title": "" }, { "docid": "a94c0ca3abc93f88501480df31196ae4", "score": "0.41255385", "text": "func (tbl *TblSymbolTag) SelectTagRowBySymbol(obj TblSymbolTagRow) ([]TblSymbolTagRow, error) {\n\tvar tags []TblSymbolTagRow\n\tdb, dbConnErr := sql.Open(MYSQL_DBNAME, MYSQL_DBADDR+DB_NAME)\n\tif dbConnErr != nil {\n\t\treturn tags, dbConnErr\n\t}\n\tdefer db.Close()\n\tvar querySQL string = \"SELECT * FROM \" + TBL_SYMBOL_TAG + \" WHERE Symbol=?\"\n\tstmt, dbPrepErr := db.Prepare(querySQL)\n\tif dbPrepErr != nil {\n\t\treturn tags, dbPrepErr\n\t}\n\tdefer stmt.Close()\n\trows, dbQueryErr := stmt.Query(obj.Symbol)\n\tif dbQueryErr != nil {\n\t\treturn tags, dbQueryErr\n\t}\n\tdefer rows.Close()\n\tvar symbol string\n\tvar tag string\n\tfor rows.Next() {\n\t\tif scanErr := rows.Scan(&symbol, &tag); scanErr != nil {\n\t\t\tfmt.Println(scanErr)\n\t\t\treturn tags, scanErr\n\t\t}\n\t\ttags = append(tags, TblSymbolTagRow{\n\t\t\tSymbol: symbol,\n\t\t\tTag: tag,\n\t\t})\n\t}\n\treturn tags, nil\n}", "title": "" }, { "docid": "9d897833a557e69ffc5ea6af5dd2bd68", "score": "0.41186327", "text": "func readXLMeta(ctx context.Context, disk StorageAPI, bucket string, object string) (xlMeta xlMetaV1, err error) {\n\t// Reads entire `xl.json`.\n\txlMetaBuf, err := disk.ReadAll(bucket, path.Join(object, xlMetaJSONFile))\n\tif err != nil {\n\t\tif err != errFileNotFound && err != errVolumeNotFound {\n\t\t\tlogger.GetReqInfo(ctx).AppendTags(\"disk\", disk.String())\n\t\t\tlogger.LogIf(ctx, err)\n\t\t}\n\t\treturn xlMetaV1{}, err\n\t}\n\tif len(xlMetaBuf) == 0 {\n\t\treturn xlMetaV1{}, errFileNotFound\n\t}\n\txlMeta, err = xlMetaV1UnmarshalJSON(ctx, xlMetaBuf)\n\tif err != nil {\n\t\tlogger.GetReqInfo(ctx).AppendTags(\"disk\", disk.String())\n\t\tlogger.LogIf(ctx, err)\n\t\treturn xlMetaV1{}, err\n\t}\n\t// Return structured `xl.json`.\n\treturn xlMeta, nil\n}", "title": "" }, { "docid": "cab668e83bbd4893c3fc4c429e1a4148", "score": "0.4109132", "text": "func PeekTag(b []byte) (version Version, size int, err error) {\n\tswitch {\n\tcase len(b) < 10:\n\t\treturn 0, 0, ErrInvalidHeader\n\tcase b[0] != 'I' || b[1] != 'D' || b[2] != '3':\n\t\treturn 0, 0, ErrInvalidHeader\n\tcase b[3] < 2 || b[3] > 4:\n\t\treturn 0, 0, ErrInvalidHeader\n\tcase b[4] != 0:\n\t\treturn 0, 0, ErrInvalidHeader\n\t}\n\n\tvar sz uint32\n\tsz, err = decodeSyncSafeUint32(b[6:10])\n\tif err != nil {\n\t\treturn 0, 0, ErrInvalidHeader\n\t}\n\n\treturn Version(b[3]), int(sz + 10), nil\n}", "title": "" }, { "docid": "581e24372010e4aaece949fdd85d790c", "score": "0.41063508", "text": "func getMetadata(id string) (*DocMetadata, error) {\n\tvar metadata DocMetadata\n\terr := db.View(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket(dbBucket)\n\t\tv := b.Get([]byte(id))\n\t\tbuf := bytes.NewBuffer(v)\n\t\tdec := gob.NewDecoder(buf)\n\t\terr := dec.Decode(&metadata)\n\t\treturn err\n\t})\n\treturn &metadata, err\n}", "title": "" }, { "docid": "cb0f6e5c90897f0f40e4260574504dbb", "score": "0.41054508", "text": "func getID1(stmtGet *sql.Stmt, arg interface{}) (id string, err error) {\n\trow := stmtGet.QueryRow(arg)\n\terr = row.Scan(&id)\n\treturn\n}", "title": "" }, { "docid": "f368897cc28b53899ea0bcfdd65cb062", "score": "0.41049334", "text": "func UnmarshalTag(data []string) (Tag, error) {\n\tid, err := strconv.ParseUint(data[0], 10, 64)\n\tif err != nil {\n\t\treturn Tag{}, err\n\t}\n\n\ttag := Tag{\n\t\tID: id,\n\t\tTag: data[1],\n\t}\n\n\treturn tag, nil\n}", "title": "" }, { "docid": "7a47c581c14eb3e3e8bd558bb191f7f5", "score": "0.41011426", "text": "func (c *Clientset) ExperimentV1alpha3() experimentv1alpha3.ExperimentV1alpha3Interface {\n\treturn c.experimentV1alpha3\n}", "title": "" }, { "docid": "17f0fd928cb02d6348b73ab2af6991da", "score": "0.40977836", "text": "func (t TagTable) Get(\n\tdb DBi,\n\tDatasetID string,\n\tTagTypeID string,\n\tTagID string,\n) (\n\trow Tag,\n\terr error,\n) {\n\tsrc := db.QueryRow(getQuery_Tag,\n\t\tDatasetID,\n\t\tTagTypeID,\n\t\tTagID)\n\n\treturn t.Scan(src)\n}", "title": "" }, { "docid": "afde8994e405b5c2fd1156f09064d2c1", "score": "0.4087013", "text": "func (r *REST) Get(ctx kapi.Context, id string) (runtime.Object, error) {\n\tist, err := r.imageStreamTagRegistry.GetImageStreamTag(ctx, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tirt := api.ImageRepositoryTag{}\n\tif err := kapi.Scheme.Convert(ist, &irt); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &irt, nil\n}", "title": "" }, { "docid": "e01940103eae36fbf18c7c3e1d602033", "score": "0.40779018", "text": "func (o *ObjectDatabase) decode(r *ObjectReader, into Object) error {\n\ttyp, size, err := r.Header()\n\tif err != nil {\n\t\treturn err\n\t} else if typ != into.Type() {\n\t\treturn &UnexpectedObjectType{Got: typ, Wanted: into.Type()}\n\t}\n\n\tif _, err = into.Decode(o.Hasher(), r, size); err != nil {\n\t\treturn err\n\t}\n\n\tif into.Type() == BlobObjectType {\n\t\treturn nil\n\t}\n\treturn r.Close()\n}", "title": "" }, { "docid": "8bbfce4959c3dd51a5e105ec0c5bd0c2", "score": "0.4076686", "text": "func mapTagToV24(tag string) (string, error) {\n\tif len(tag) > 4 {\n\t\tif t, ok := V11_TO_V24_TAGS[tag]; !ok {\n\t\t\treturn tag, fmt.Errorf(\"id3: unknown v1 tag '%s'\", tag)\n\t\t} else {\n\t\t\ttag = t\n\t\t}\n\t} else if len(tag) < 4 {\n\t\tif t, ok := V22_TO_V24_TAGS[tag]; !ok {\n\t\t\treturn tag, fmt.Errorf(\"id3: unknown v2.2 tag '%s'\", tag)\n\t\t} else {\n\t\t\ttag = t\n\t\t}\n\t}\n\treturn tag, nil\n}", "title": "" } ]
b53ef25ed90ef1a387673e019dfc6415
gtri (greaterthan register/immediate) sets register C to 1 if register A is greater than value B. Otherwise, register C is set to 0.
[ { "docid": "4110ea00bfd150ba7cddc9bd72417424", "score": "0.770005", "text": "func gtri(i Instruction, d Device) Device {\n\tif d.registers[i.Ain] > i.Bin {\n\t\td.registers[i.Cout] = 1\n\t} else {\n\t\td.registers[i.Cout] = 0\n\t}\n\treturn d\n}", "title": "" } ]
[ { "docid": "01485ba2f6709ecec501898dcdaed69b", "score": "0.82262856", "text": "func gtri(in [4]int) {\n\tif regs[in[A]] > in[B] {\n\t\tregs[in[C]] = 1\n\t\treturn\n\t}\n\tregs[in[C]] = 0\n}", "title": "" }, { "docid": "180dd6abfddbe402e92fad9b4fb4434e", "score": "0.79698133", "text": "func gtri(r *[6]int, a, b, c int) {\n\tif r[a] > b {\n\t\tr[c] = 1\n\t} else {\n\t\tr[c] = 0\n\t}\n}", "title": "" }, { "docid": "4fe331a1d2300c263de5adc5421ef86c", "score": "0.7701118", "text": "func gtri(register [4]int, instruction [4]int) (result [4]int) {\n\tif register[instruction[1]] > instruction[2] {\n\t\tregister[instruction[3]] = 1\n\t} else {\n\t\tregister[instruction[3]] = 0\n\t}\n\treturn register\n}", "title": "" }, { "docid": "4e91115bc2c09a1116675e1e569bc7a4", "score": "0.65151596", "text": "func gtir(in [4]int) {\n\tif in[A] > regs[in[B]] {\n\t\tregs[in[C]] = 1\n\t\treturn\n\t}\n\tregs[in[C]] = 0\n}", "title": "" }, { "docid": "da6769fa6b37f310ee58eb3726cbd969", "score": "0.6350995", "text": "func gtrr(in [4]int) {\n\tif regs[in[A]] > regs[in[B]] {\n\t\tregs[in[C]] = 1\n\t\treturn\n\t}\n\tregs[in[C]] = 0\n}", "title": "" }, { "docid": "a6b0e33ca1c3ae7903d2f6a1c0b466ae", "score": "0.63123536", "text": "func gtir(r *[6]int, a, b, c int) {\n\tif a > r[b] {\n\t\tr[c] = 1\n\t} else {\n\t\tr[c] = 0\n\t}\n}", "title": "" }, { "docid": "20046309adbfdb8366686587de296af6", "score": "0.6197112", "text": "func opI32Gt(prgrm *ast.CXProgram, inputs []ast.CXValue, outputs []ast.CXValue) {\n\toutV0 := inputs[0].Get_i32(prgrm) > inputs[1].Get_i32(prgrm)\n\toutputs[0].Set_bool(prgrm, outV0)\n}", "title": "" }, { "docid": "3007ab9d3cad1044612bbfef8c1d1b50", "score": "0.6155182", "text": "func gtrr(r *[6]int, a, b, c int) {\n\tif r[a] > r[b] {\n\t\tr[c] = 1\n\t} else {\n\t\tr[c] = 0\n\t}\n}", "title": "" }, { "docid": "c4f02d0cb0c7a23eb7ef5baeb765a155", "score": "0.614737", "text": "func opI32Gteq(prgrm *ast.CXProgram, inputs []ast.CXValue, outputs []ast.CXValue) {\n\toutV0 := inputs[0].Get_i32(prgrm) >= inputs[1].Get_i32(prgrm)\n\toutputs[0].Set_bool(prgrm, outV0)\n}", "title": "" }, { "docid": "2089e18c5fea01d164bce5b571c45d01", "score": "0.60602456", "text": "func opF32Gteq(inputs []ast.CXValue, outputs []ast.CXValue) {\n\toutV0 := inputs[0].Get_f32() >= inputs[1].Get_f32()\n\toutputs[0].Set_bool(outV0)\n}", "title": "" }, { "docid": "3ee5e17f689dfe92cb70de3d3d272a22", "score": "0.5961841", "text": "func gtrr(i Instruction, d Device) Device {\n\tif d.registers[i.Ain] > d.registers[i.Bin] {\n\t\td.registers[i.Cout] = 1\n\t} else {\n\t\td.registers[i.Cout] = 0\n\t}\n\treturn d\n}", "title": "" }, { "docid": "52acbdca3f2758dc806a6e48d791baab", "score": "0.57137465", "text": "func opF32Gt(inputs []ast.CXValue, outputs []ast.CXValue) {\n\toutV0 := inputs[0].Get_f32() > inputs[1].Get_f32()\n\toutputs[0].Set_bool(outV0)\n}", "title": "" }, { "docid": "63d95b9c6c84a585082e18d649511d75", "score": "0.57083344", "text": "func gtrr(register [4]int, instruction [4]int) (result [4]int) {\n\tif register[instruction[1]] > register[instruction[2]] {\n\t\tregister[instruction[3]] = 1\n\t} else {\n\t\tregister[instruction[3]] = 0\n\t}\n\treturn register\n}", "title": "" }, { "docid": "463d140d5526c763609edb6db9e951d0", "score": "0.5669937", "text": "func gtir(register [4]int, instruction [4]int) (result [4]int) {\n\tif instruction[1] > register[instruction[2]] {\n\t\tregister[instruction[3]] = 1\n\t} else {\n\t\tregister[instruction[3]] = 0\n\t}\n\treturn register\n}", "title": "" }, { "docid": "a2f3e3dd663f7f0cbae3c6ccbd9f4478", "score": "0.5623512", "text": "func opUI8Gt(prgrm *ast.CXProgram, inputs []ast.CXValue, outputs []ast.CXValue) {\n\toutV0 := inputs[0].Get_ui8(prgrm) > inputs[1].Get_ui8(prgrm)\n\toutputs[0].Set_bool(prgrm, outV0)\n}", "title": "" }, { "docid": "d73bd3a52d3716fdcdf6ffacd85d6062", "score": "0.5570462", "text": "func opUI8Gteq(prgrm *ast.CXProgram, inputs []ast.CXValue, outputs []ast.CXValue) {\n\toutV0 := inputs[0].Get_ui8(prgrm) >= inputs[1].Get_ui8(prgrm)\n\toutputs[0].Set_bool(prgrm, outV0)\n}", "title": "" }, { "docid": "4167aa3d2452a3ba6dcb7763625d71bf", "score": "0.5473177", "text": "func Gt(a, b *Node, retSame bool) (*Node, error) {\n\top := newElemBinOp(gtOpType, a, b)\n\top.retSame = retSame\n\treturn binOpNode(op, a, b)\n}", "title": "" }, { "docid": "f6209e596e0bc4e27d819bf4f02eea94", "score": "0.5322307", "text": "func FnGT(a1 U, a2 V, b1 U, b2 V) bool {\n\tswitch a1 & 7 {\n\tcase Py:\n\t\ta := inline.TakePJ(a1, a2)\n\t\tswitch b1 & 7 {\n\t\tcase Py:\n\t\t\tb := inline.TakePJ(b1, b2)\n\t\t\treturn inline.Compares_GT(a.Compare_Py(b))\n\t\tcase Int:\n\t\t\tb := inline.TakeIntJ(b1, b2)\n\t\t\treturn inline.Compares_GT(a.Compare_Int(b))\n\t\tcase Str:\n\t\t\tb := inline.TakeStrJ(b1, b2)\n\t\t\treturn inline.Compares_GT(a.Compare_Str(b))\n\t\t}\n\tcase Int:\n\t\ta := inline.TakeIntJ(a1, a2)\n\t\tswitch b1 & 7 {\n\t\tcase Py:\n\t\t\tb := inline.TakePJ(b1, b2)\n\t\t\treturn inline.Compares_GT(-b.Compare_Int(a))\n\t\tcase Int:\n\t\t\tb := inline.TakeIntJ(a1, a2)\n\t\t\treturn macro.Operator_GT(a, b)\n\t\tcase Str:\n\t\t\treturn inline.Compares_GT(-1) // Int < Str\n\t\t}\n\tcase Str:\n\t\ta := inline.TakeStrJ(a1, a2)\n\t\tswitch b1 & 7 {\n\t\tcase Py:\n\t\t\tb := inline.TakePJ(b1, b2)\n\t\t\treturn inline.Compares_GT(-b.Compare_Str(a))\n\t\tcase Int:\n\t\t\treturn inline.Compares_GT(1) // Str > Int\n\t\tcase Str:\n\t\t\tb := inline.TakeStrJ(a1, a2)\n\t\t\treturn macro.Operator_GT(a, b)\n\t\t}\n\t}\n\tpanic(F(\"Bad switch FnGT: %x %x %x %x\", a1, a2, b1, b2))\n}", "title": "" }, { "docid": "cff34183315a9cbba548fdc1c8d82fd4", "score": "0.5303982", "text": "func gtir(i Instruction, d Device) Device {\n\tif i.Ain > d.registers[i.Bin] {\n\t\td.registers[i.Cout] = 1\n\t} else {\n\t\td.registers[i.Cout] = 0\n\t}\n\treturn d\n}", "title": "" }, { "docid": "1bb36c42f205fa3be7cb43e95f27ec02", "score": "0.5285507", "text": "func Gt(a interface{}, b interface{}) bool {\n\tvar left, right int64\n\tav := reflect.ValueOf(a)\n\n\tswitch av.Kind() {\n\tcase reflect.Array, reflect.Chan, reflect.Map, reflect.Slice:\n\t\tleft = int64(av.Len())\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\tleft = av.Int()\n\tcase reflect.String:\n\t\tleft, _ = strconv.ParseInt(av.String(), 10, 64)\n\t}\n\n\tbv := reflect.ValueOf(b)\n\n\tswitch bv.Kind() {\n\tcase reflect.Array, reflect.Chan, reflect.Map, reflect.Slice:\n\t\tright = int64(bv.Len())\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\tright = bv.Int()\n\tcase reflect.String:\n\t\tright, _ = strconv.ParseInt(bv.String(), 10, 64)\n\t}\n\n\treturn left > right\n}", "title": "" }, { "docid": "1bb36c42f205fa3be7cb43e95f27ec02", "score": "0.5285507", "text": "func Gt(a interface{}, b interface{}) bool {\n\tvar left, right int64\n\tav := reflect.ValueOf(a)\n\n\tswitch av.Kind() {\n\tcase reflect.Array, reflect.Chan, reflect.Map, reflect.Slice:\n\t\tleft = int64(av.Len())\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\tleft = av.Int()\n\tcase reflect.String:\n\t\tleft, _ = strconv.ParseInt(av.String(), 10, 64)\n\t}\n\n\tbv := reflect.ValueOf(b)\n\n\tswitch bv.Kind() {\n\tcase reflect.Array, reflect.Chan, reflect.Map, reflect.Slice:\n\t\tright = int64(bv.Len())\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\tright = bv.Int()\n\tcase reflect.String:\n\t\tright, _ = strconv.ParseInt(bv.String(), 10, 64)\n\t}\n\n\treturn left > right\n}", "title": "" }, { "docid": "c34beb6f6907c90a047609dbcfca1073", "score": "0.5229422", "text": "func GT(v values.Sortable) *Greater {\n\treturn &Greater{Value: v}\n}", "title": "" }, { "docid": "bc6d1d65638b424cc7a28a847c148631", "score": "0.5191154", "text": "func zerrgt(path string, t *testing.T) {\n\tvar anorm float64\n\tvar i, nmax int\n\tvar err error\n\n\tb := cvf(2)\n\tdl := cvf(2)\n\tdlf := cvf(2)\n\tdu := cvf(2)\n\tdu2 := cvf(2)\n\tduf := cvf(2)\n\te := cvf(2)\n\tef := cvf(2)\n\tw := cvf(2)\n\tx := cvf(2)\n\td := vf(2)\n\tdf := vf(2)\n\tr1 := vf(2)\n\tr2 := vf(2)\n\trw := vf(2)\n\tip := make([]int, 2)\n\n\tnmax = 2\n\n\terrt := &gltest.Common.Infoc.Errt\n\tok := &gltest.Common.Infoc.Ok\n\tsrnamt := &gltest.Common.Srnamc.Srnamt\n\tc2 := path[1:3]\n\tfor i = 1; i <= nmax; i++ {\n\t\td.Set(i-1, 1.)\n\t\te.Set(i-1, 2.)\n\t\tdl.Set(i-1, 3.)\n\t\tdu.Set(i-1, 4.)\n\t}\n\tanorm = 1.0\n\t*ok = true\n\n\tif c2 == \"gt\" {\n\t\t// Test error exits for the general tridiagonal routines.\n\t\t//\n\t\t// Zgttrf\n\t\t*srnamt = \"Zgttrf\"\n\t\t*errt = fmt.Errorf(\"n < 0: n=-1\")\n\t\t_, err = golapack.Zgttrf(-1, dl, e, du, du2, &ip)\n\t\tchkxer2(\"Zgttrf\", err)\n\n\t\t// Zgttrs\n\t\t*srnamt = \"Zgttrs\"\n\t\t*errt = fmt.Errorf(\"!notran && trans != Trans && trans != ConjTrans: trans=Unrecognized: /\")\n\t\terr = golapack.Zgttrs('/', 0, 0, dl, e, du, du2, &ip, x.CMatrix(1, opts))\n\t\tchkxer2(\"Zgttrs\", err)\n\t\t*errt = fmt.Errorf(\"n < 0: n=-1\")\n\t\terr = golapack.Zgttrs(NoTrans, -1, 0, dl, e, du, du2, &ip, x.CMatrix(1, opts))\n\t\tchkxer2(\"Zgttrs\", err)\n\t\t*errt = fmt.Errorf(\"nrhs < 0: nrhs=-1\")\n\t\terr = golapack.Zgttrs(NoTrans, 0, -1, dl, e, du, du2, &ip, x.CMatrix(1, opts))\n\t\tchkxer2(\"Zgttrs\", err)\n\t\t*errt = fmt.Errorf(\"b.Rows < max(n, 1): b.Rows=1, n=2\")\n\t\terr = golapack.Zgttrs(NoTrans, 2, 1, dl, e, du, du2, &ip, x.CMatrix(1, opts))\n\t\tchkxer2(\"Zgttrs\", err)\n\n\t\t// Zgtrfs\n\t\t*srnamt = \"Zgtrfs\"\n\t\t*errt = fmt.Errorf(\"!notran && trans != Trans && trans != ConjTrans: trans=Unrecognized: /\")\n\t\terr = golapack.Zgtrfs('/', 0, 0, dl, e, du, dlf, ef, duf, du2, &ip, b.CMatrix(1, opts), x.CMatrix(1, opts), r1, r2, w, rw)\n\t\tchkxer2(\"Zgtrfs\", err)\n\t\t*errt = fmt.Errorf(\"n < 0: n=-1\")\n\t\terr = golapack.Zgtrfs(NoTrans, -1, 0, dl, e, du, dlf, ef, duf, du2, &ip, b.CMatrix(1, opts), x.CMatrix(1, opts), r1, r2, w, rw)\n\t\tchkxer2(\"Zgtrfs\", err)\n\t\t*errt = fmt.Errorf(\"nrhs < 0: nrhs=-1\")\n\t\terr = golapack.Zgtrfs(NoTrans, 0, -1, dl, e, du, dlf, ef, duf, du2, &ip, b.CMatrix(1, opts), x.CMatrix(1, opts), r1, r2, w, rw)\n\t\tchkxer2(\"Zgtrfs\", err)\n\t\t*errt = fmt.Errorf(\"b.Rows < max(1, n): b.Rows=1, n=2\")\n\t\terr = golapack.Zgtrfs(NoTrans, 2, 1, dl, e, du, dlf, ef, duf, du2, &ip, b.CMatrix(1, opts), x.CMatrix(2, opts), r1, r2, w, rw)\n\t\tchkxer2(\"Zgtrfs\", err)\n\t\t*errt = fmt.Errorf(\"x.Rows < max(1, n): x.Rows=1, n=2\")\n\t\terr = golapack.Zgtrfs(NoTrans, 2, 1, dl, e, du, dlf, ef, duf, du2, &ip, b.CMatrix(2, opts), x.CMatrix(1, opts), r1, r2, w, rw)\n\t\tchkxer2(\"Zgtrfs\", err)\n\n\t\t// Zgtcon\n\t\t*srnamt = \"Zgtcon\"\n\t\t*errt = fmt.Errorf(\"!onenrm && norm != 'I': norm='/'\")\n\t\t_, err = golapack.Zgtcon('/', 0, dl, e, du, du2, &ip, anorm, w)\n\t\tchkxer2(\"Zgtcon\", err)\n\t\t*errt = fmt.Errorf(\"n < 0: n=-1\")\n\t\t_, err = golapack.Zgtcon('I', -1, dl, e, du, du2, &ip, anorm, w)\n\t\tchkxer2(\"Zgtcon\", err)\n\t\t*errt = fmt.Errorf(\"anorm < zero: anorm=-1\")\n\t\t_, err = golapack.Zgtcon('I', 0, dl, e, du, du2, &ip, -anorm, w)\n\t\tchkxer2(\"Zgtcon\", err)\n\n\t} else if c2 == \"pt\" {\n\t\t// Test error exits for the positive definite tridiagonal\n\t\t// routines.\n\t\t//\n\t\t// Zpttrf\n\t\t*srnamt = \"Zpttrf\"\n\t\t*errt = fmt.Errorf(\"n < 0: n=-1\")\n\t\t_, err = golapack.Zpttrf(-1, d, e)\n\t\tchkxer2(\"Zpttrf\", err)\n\n\t\t// Zpttrs\n\t\t*srnamt = \"Zpttrs\"\n\t\t*errt = fmt.Errorf(\"!upper && uplo != Lower: uplo=Unrecognized: /\")\n\t\terr = golapack.Zpttrs('/', 1, 0, d, e, x.CMatrix(1, opts))\n\t\tchkxer2(\"Zpttrs\", err)\n\t\t*errt = fmt.Errorf(\"n < 0: n=-1\")\n\t\terr = golapack.Zpttrs(Upper, -1, 0, d, e, x.CMatrix(1, opts))\n\t\tchkxer2(\"Zpttrs\", err)\n\t\t*errt = fmt.Errorf(\"nrhs < 0: nrhs=-1\")\n\t\terr = golapack.Zpttrs(Upper, 0, -1, d, e, x.CMatrix(1, opts))\n\t\tchkxer2(\"Zpttrs\", err)\n\t\t*errt = fmt.Errorf(\"b.Rows < max(1, n): b.Rows=1, n=2\")\n\t\terr = golapack.Zpttrs(Upper, 2, 1, d, e, x.CMatrix(1, opts))\n\t\tchkxer2(\"Zpttrs\", err)\n\n\t\t// Zptrfs\n\t\t*srnamt = \"Zptrfs\"\n\t\t*errt = fmt.Errorf(\"!upper && uplo != Lower: uplo=Unrecognized: /\")\n\t\terr = golapack.Zptrfs('/', 1, 0, d, e, df, ef, b.CMatrix(1, opts), x.CMatrix(1, opts), r1, r2, w, rw)\n\t\tchkxer2(\"Zptrfs\", err)\n\t\t*errt = fmt.Errorf(\"n < 0: n=-1\")\n\t\terr = golapack.Zptrfs(Upper, -1, 0, d, e, df, ef, b.CMatrix(1, opts), x.CMatrix(1, opts), r1, r2, w, rw)\n\t\tchkxer2(\"Zptrfs\", err)\n\t\t*errt = fmt.Errorf(\"nrhs < 0: nrhs=-1\")\n\t\terr = golapack.Zptrfs(Upper, 0, -1, d, e, df, ef, b.CMatrix(1, opts), x.CMatrix(1, opts), r1, r2, w, rw)\n\t\tchkxer2(\"Zptrfs\", err)\n\t\t*errt = fmt.Errorf(\"b.Rows < max(1, n): b.Rows=1, n=2\")\n\t\terr = golapack.Zptrfs(Upper, 2, 1, d, e, df, ef, b.CMatrix(1, opts), x.CMatrix(2, opts), r1, r2, w, rw)\n\t\tchkxer2(\"Zptrfs\", err)\n\t\t*errt = fmt.Errorf(\"x.Rows < max(1, n): x.Rows=1, n=2\")\n\t\terr = golapack.Zptrfs(Upper, 2, 1, d, e, df, ef, b.CMatrix(2, opts), x.CMatrix(1, opts), r1, r2, w, rw)\n\t\tchkxer2(\"Zptrfs\", err)\n\n\t\t// Zptcon\n\t\t*srnamt = \"Zptcon\"\n\t\t*errt = fmt.Errorf(\"n < 0: n=-1\")\n\t\t_, err = golapack.Zptcon(-1, d, e, anorm, rw)\n\t\tchkxer2(\"Zptcon\", err)\n\t\t*errt = fmt.Errorf(\"anorm < zero: anorm=-1\")\n\t\t_, err = golapack.Zptcon(0, d, e, -anorm, rw)\n\t\tchkxer2(\"Zptcon\", err)\n\t}\n\n\t// Print a summary line.\n\t// alaesm(path, *ok)\n\n\tif !(*ok) {\n\t\tt.Fail()\n\t}\n}", "title": "" }, { "docid": "bf4f5eacb9afc15308fcb4b05703b240", "score": "0.5175588", "text": "func Gt(lval, rval float64) bool {\n\treturn lval > rval\n}", "title": "" }, { "docid": "acc7b6dbcb87dba655b239601ebe7baa", "score": "0.51471996", "text": "func (n *Number) Gt(value interface{}) *Number {\n\topChain := n.chain.enter(\"Gt()\")\n\tdefer opChain.leave()\n\n\tif opChain.failed() {\n\t\treturn n\n\t}\n\n\tnum, ok := canonNumber(opChain, value)\n\tif !ok {\n\t\treturn n\n\t}\n\n\tif !(n.value > num) {\n\t\topChain.fail(AssertionFailure{\n\t\t\tType: AssertGt,\n\t\t\tActual: &AssertionValue{n.value},\n\t\t\tExpected: &AssertionValue{num},\n\t\t\tErrors: []error{\n\t\t\t\terrors.New(\"expected: number is larger than given value\"),\n\t\t\t},\n\t\t})\n\t}\n\n\treturn n\n}", "title": "" }, { "docid": "eb3a0d0e75c8d395f353cdee52df9a53", "score": "0.5121419", "text": "func (self *MaximumNode) Gt(other interface{}) *GreaterThanNode {\n\treturn GreaterThan(self, other)\n}", "title": "" }, { "docid": "538d8130a2e0860c1f93112234378579", "score": "0.51081216", "text": "func op_f32_gt(expr *CXExpression, fp int) {\n\tinp1, inp2, out1 := expr.Inputs[0], expr.Inputs[1], expr.Outputs[0]\n\toutB1 := FromBool(ReadF32(fp, inp1) > ReadF32(fp, inp2))\n\tWriteMemory(GetFinalOffset(fp, out1), outB1)\n}", "title": "" }, { "docid": "8cb0d65b1883c2daa70dab6c2a03be24", "score": "0.509669", "text": "func gt(t *testing.T, a, b float64) {\n\tif a <= b {\n\t\tt.Errorf(\"Expected %v (type %v) > Got %v (type %v)\", a, reflect.TypeOf(a), b, reflect.TypeOf(b))\n\t}\n}", "title": "" }, { "docid": "8cb0d65b1883c2daa70dab6c2a03be24", "score": "0.509669", "text": "func gt(t *testing.T, a, b float64) {\n\tif a <= b {\n\t\tt.Errorf(\"Expected %v (type %v) > Got %v (type %v)\", a, reflect.TypeOf(a), b, reflect.TypeOf(b))\n\t}\n}", "title": "" }, { "docid": "fccfd42ae7379f347b17e22ae7e645cd", "score": "0.5090992", "text": "func (u Uint) GT(u2 Uint) bool { return u > u2 }", "title": "" }, { "docid": "004f7b82ea0d4ef7edf764220a1b0ea5", "score": "0.5083565", "text": "func Gt(ctx expr.EvalContext, lv, rv value.Value) (value.BoolValue, bool) {\n\tleft, _ := value.ToFloat64(lv.Rv())\n\tright, _ := value.ToFloat64(rv.Rv())\n\n\tif math.IsNaN(left) || math.IsNaN(right) {\n\t\treturn value.BoolValueFalse, true\n\t}\n\treturn value.NewBoolValue(left > right), true\n}", "title": "" }, { "docid": "0b290f9639fd740ded0d21ab346431ad", "score": "0.5081157", "text": "func opF32Lteq(inputs []ast.CXValue, outputs []ast.CXValue) {\n\toutV0 := inputs[0].Get_f32() <= inputs[1].Get_f32()\n\toutputs[0].Set_bool(outV0)\n}", "title": "" }, { "docid": "8b84071c486607174449b702af3e8b87", "score": "0.5075818", "text": "func Gt(ctx expr.EvalContext, lv, rv value.Value) (value.BoolValue, bool) {\n\tleft, _ := value.ToFloat64(lv.Rv())\n\tright, _ := value.ToFloat64(rv.Rv())\n\tif math.IsNaN(left) || math.IsNaN(right) {\n\t\treturn value.BoolValueFalse, false\n\t}\n\treturn value.NewBoolValue(left > right), true\n}", "title": "" }, { "docid": "62b6ba710d1d84e4583913eb7a907a6e", "score": "0.5052903", "text": "func (e Exp) Gt(operand interface{}) Exp {\n\treturn naryOperator(greaterThanKind, e, operand)\n}", "title": "" }, { "docid": "fcd361bc90f8d2fe94b7e67047164b44", "score": "0.504077", "text": "func Gt(x, y interface{}) (r bool, err error) {\n\tif x_, ok := x.(byte); ok {\n\t\tif y_, ok := y.(byte); ok {\n\t\t\tr = x_ > y_\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"incompatible types: %T %s %T\", x, \">\", y)\n\t\t}\n\t\treturn\n\t}\n\tif x_, ok := x.(float32); ok {\n\t\tif y_, ok := y.(float32); ok {\n\t\t\tr = x_ > y_\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"incompatible types: %T %s %T\", x, \">\", y)\n\t\t}\n\t\treturn\n\t}\n\tif x_, ok := x.(float64); ok {\n\t\tif y_, ok := y.(float64); ok {\n\t\t\tr = x_ > y_\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"incompatible types: %T %s %T\", x, \">\", y)\n\t\t}\n\t\treturn\n\t}\n\tif x_, ok := x.(int); ok {\n\t\tif y_, ok := y.(int); ok {\n\t\t\tr = x_ > y_\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"incompatible types: %T %s %T\", x, \">\", y)\n\t\t}\n\t\treturn\n\t}\n\tif x_, ok := x.(int16); ok {\n\t\tif y_, ok := y.(int16); ok {\n\t\t\tr = x_ > y_\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"incompatible types: %T %s %T\", x, \">\", y)\n\t\t}\n\t\treturn\n\t}\n\tif x_, ok := x.(int32); ok {\n\t\tif y_, ok := y.(int32); ok {\n\t\t\tr = x_ > y_\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"incompatible types: %T %s %T\", x, \">\", y)\n\t\t}\n\t\treturn\n\t}\n\tif x_, ok := x.(int64); ok {\n\t\tif y_, ok := y.(int64); ok {\n\t\t\tr = x_ > y_\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"incompatible types: %T %s %T\", x, \">\", y)\n\t\t}\n\t\treturn\n\t}\n\tif x_, ok := x.(int8); ok {\n\t\tif y_, ok := y.(int8); ok {\n\t\t\tr = x_ > y_\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"incompatible types: %T %s %T\", x, \">\", y)\n\t\t}\n\t\treturn\n\t}\n\tif x_, ok := x.(rune); ok {\n\t\tif y_, ok := y.(rune); ok {\n\t\t\tr = x_ > y_\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"incompatible types: %T %s %T\", x, \">\", y)\n\t\t}\n\t\treturn\n\t}\n\tif x_, ok := x.(string); ok {\n\t\tif y_, ok := y.(string); ok {\n\t\t\tr = x_ > y_\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"incompatible types: %T %s %T\", x, \">\", y)\n\t\t}\n\t\treturn\n\t}\n\tif x_, ok := x.(uint); ok {\n\t\tif y_, ok := y.(uint); ok {\n\t\t\tr = x_ > y_\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"incompatible types: %T %s %T\", x, \">\", y)\n\t\t}\n\t\treturn\n\t}\n\tif x_, ok := x.(uint16); ok {\n\t\tif y_, ok := y.(uint16); ok {\n\t\t\tr = x_ > y_\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"incompatible types: %T %s %T\", x, \">\", y)\n\t\t}\n\t\treturn\n\t}\n\tif x_, ok := x.(uint32); ok {\n\t\tif y_, ok := y.(uint32); ok {\n\t\t\tr = x_ > y_\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"incompatible types: %T %s %T\", x, \">\", y)\n\t\t}\n\t\treturn\n\t}\n\tif x_, ok := x.(uint64); ok {\n\t\tif y_, ok := y.(uint64); ok {\n\t\t\tr = x_ > y_\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"incompatible types: %T %s %T\", x, \">\", y)\n\t\t}\n\t\treturn\n\t}\n\tif x_, ok := x.(uint8); ok {\n\t\tif y_, ok := y.(uint8); ok {\n\t\t\tr = x_ > y_\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"incompatible types: %T %s %T\", x, \">\", y)\n\t\t}\n\t\treturn\n\t}\n\tif x_, ok := x.(uintptr); ok {\n\t\tif y_, ok := y.(uintptr); ok {\n\t\t\tr = x_ > y_\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"incompatible types: %T %s %T\", x, \">\", y)\n\t\t}\n\t\treturn\n\t}\n\t\n\terr = fmt.Errorf(\"no operation defined: %T %s %T\", x, \">\", y)\n\treturn\n}", "title": "" }, { "docid": "1f7954797704844aa91d84b1dc6898ee", "score": "0.50108606", "text": "func opI32Lteq(prgrm *ast.CXProgram, inputs []ast.CXValue, outputs []ast.CXValue) {\n\toutV0 := inputs[0].Get_i32(prgrm) <= inputs[1].Get_i32(prgrm)\n\toutputs[0].Set_bool(prgrm, outV0)\n}", "title": "" }, { "docid": "0c03c4e3b6e7165c2d3dd3376e6cc2b9", "score": "0.49646506", "text": "func GT(x, y Expr) P {\n\treturn &BinaryExpr{\n\t\tOp: OpGT,\n\t\tX: x,\n\t\tY: y,\n\t}\n}", "title": "" }, { "docid": "74db27573fb3cb9229af6384934a1676", "score": "0.49572578", "text": "func (self *AttributeNode) Gt(other interface{}) *GreaterThanNode {\n\treturn GreaterThan(self, other)\n}", "title": "" }, { "docid": "cf0d4cc85ccd8f697e3e3253cba6258e", "score": "0.4935147", "text": "func (impl Implementation) Dgetri(n int, a []float64, lda int, ipiv []int, work []float64, lwork int) (ok bool) {\n\tiws := max(1, n)\n\tswitch {\n\tcase n < 0:\n\t\tpanic(nLT0)\n\tcase lda < max(1, n):\n\t\tpanic(badLdA)\n\tcase lwork < iws && lwork != -1:\n\t\tpanic(badLWork)\n\tcase len(work) < max(1, lwork):\n\t\tpanic(shortWork)\n\t}\n\n\tif n == 0 {\n\t\twork[0] = 1\n\t\treturn true\n\t}\n\n\tnb := impl.Ilaenv(1, \"DGETRI\", \" \", n, -1, -1, -1)\n\tif lwork == -1 {\n\t\twork[0] = float64(n * nb)\n\t\treturn true\n\t}\n\n\tswitch {\n\tcase len(a) < (n-1)*lda+n:\n\t\tpanic(shortA)\n\tcase len(ipiv) != n:\n\t\tpanic(badLenIpiv)\n\t}\n\n\t// Form inv(U).\n\tok = impl.Dtrtri(blas.Upper, blas.NonUnit, n, a, lda)\n\tif !ok {\n\t\treturn false\n\t}\n\n\tnbmin := 2\n\tif 1 < nb && nb < n {\n\t\tiws = max(n*nb, 1)\n\t\tif lwork < iws {\n\t\t\tnb = lwork / n\n\t\t\tnbmin = max(2, impl.Ilaenv(2, \"DGETRI\", \" \", n, -1, -1, -1))\n\t\t}\n\t}\n\tldwork := nb\n\n\tbi := blas64.Implementation()\n\t// Solve the equation inv(A)*L = inv(U) for inv(A).\n\t// TODO(btracey): Replace this with a more row-major oriented algorithm.\n\tif nb < nbmin || n <= nb {\n\t\t// Unblocked code.\n\t\tfor j := n - 1; j >= 0; j-- {\n\t\t\tfor i := j + 1; i < n; i++ {\n\t\t\t\t// Copy current column of L to work and replace with zeros.\n\t\t\t\twork[i] = a[i*lda+j]\n\t\t\t\ta[i*lda+j] = 0\n\t\t\t}\n\t\t\t// Compute current column of inv(A).\n\t\t\tif j < n-1 {\n\t\t\t\tbi.Dgemv(blas.NoTrans, n, n-j-1, -1, a[(j+1):], lda, work[(j+1):], 1, 1, a[j:], lda)\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// Blocked code.\n\t\tnn := ((n - 1) / nb) * nb\n\t\tfor j := nn; j >= 0; j -= nb {\n\t\t\tjb := min(nb, n-j)\n\t\t\t// Copy current block column of L to work and replace\n\t\t\t// with zeros.\n\t\t\tfor jj := j; jj < j+jb; jj++ {\n\t\t\t\tfor i := jj + 1; i < n; i++ {\n\t\t\t\t\twork[i*ldwork+(jj-j)] = a[i*lda+jj]\n\t\t\t\t\ta[i*lda+jj] = 0\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Compute current block column of inv(A).\n\t\t\tif j+jb < n {\n\t\t\t\tbi.Dgemm(blas.NoTrans, blas.NoTrans, n, jb, n-j-jb, -1, a[(j+jb):], lda, work[(j+jb)*ldwork:], ldwork, 1, a[j:], lda)\n\t\t\t}\n\t\t\tbi.Dtrsm(blas.Right, blas.Lower, blas.NoTrans, blas.Unit, n, jb, 1, work[j*ldwork:], ldwork, a[j:], lda)\n\t\t}\n\t}\n\t// Apply column interchanges.\n\tfor j := n - 2; j >= 0; j-- {\n\t\tjp := ipiv[j]\n\t\tif jp != j {\n\t\t\tbi.Dswap(n, a[j:], lda, a[jp:], lda)\n\t\t}\n\t}\n\twork[0] = float64(iws)\n\treturn true\n}", "title": "" }, { "docid": "2d3d70c8c3bab917b95605cf95b6518e", "score": "0.49160126", "text": "func ValueGT(v int) predicate.Node {\n\treturn predicate.Node(sql.FieldGT(FieldValue, v))\n}", "title": "" }, { "docid": "8215aa73c6e4e6efc95689a5754574a9", "score": "0.48980674", "text": "func (u Uint) GTE(u2 Uint) bool { return u >= u2 }", "title": "" }, { "docid": "fd8d2a8484ea636ef12f0709256449e9", "score": "0.48916045", "text": "func Gt(column string, value interface{}) *stmt.Condition {\n\treturn Op(\">\", column, value)\n}", "title": "" }, { "docid": "c0bf1ec2a32b4eaa53e6db7c08705748", "score": "0.48890802", "text": "func CmpGt(t TestingT, got interface{}, val interface{}, args ...interface{}) bool {\n\tt.Helper()\n\treturn Cmp(t, got, Gt(val), args...)\n}", "title": "" }, { "docid": "1a3d7c5449756d6253dd60879f499ba4", "score": "0.4856238", "text": "func Dtrtri(uplo mat.MatUplo, diag mat.MatDiag, n int, a *mat.Matrix) (info int, err error) {\n\tvar nounit, upper bool\n\tvar one, zero float64\n\tvar j, jb, nb, nn int\n\n\tone = 1.0\n\tzero = 0.0\n\n\t// Test the input parameters.\n\tupper = uplo == Upper\n\tnounit = diag == NonUnit\n\tif !upper && uplo != Lower {\n\t\terr = fmt.Errorf(\"!upper && uplo != Lower: uplo=%s\", uplo)\n\t} else if !diag.IsValid() {\n\t\terr = fmt.Errorf(\"!diag.IsValid(): diag=%s\", diag)\n\t} else if n < 0 {\n\t\terr = fmt.Errorf(\"n < 0: n=%v\", n)\n\t} else if a.Rows < max(1, n) {\n\t\terr = fmt.Errorf(\"a.Rows < max(1, n): a.Rows=%v, n=%v\", a.Rows, n)\n\t}\n\tif err != nil {\n\t\tgltest.Xerbla2(\"Dtrtri\", err)\n\t\treturn\n\t}\n\n\t// Quick return if possible\n\tif n == 0 {\n\t\treturn\n\t}\n\n\t// Check for singularity if non-unit.\n\tif nounit {\n\t\tfor info = 1; info <= n; info++ {\n\t\t\tif a.Get(info-1, info-1) == zero {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tinfo = 0\n\t}\n\n\t// Determine the block size for this environment.\n\tnb = Ilaenv(1, \"Dtrtri\", []byte{uplo.Byte(), diag.Byte()}, n, -1, -1, -1)\n\tif nb <= 1 || nb >= n {\n\t\t// Use unblocked code\n\t\tif err = Dtrti2(uplo, diag, n, a); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t} else {\n\t\t// Use blocked code\n\t\tif upper {\n\t\t\t// Compute inverse of upper triangular matrix\n\t\t\tfor j = 1; j <= n; j += nb {\n\t\t\t\tjb = min(nb, n-j+1)\n\n\t\t\t\t// Compute rows 1:j-1 of current block column\n\t\t\t\terr = a.Off(0, j-1).Trmm(mat.Left, mat.Upper, mat.NoTrans, diag, j-1, jb, one, a)\n\t\t\t\terr = a.Off(0, j-1).Trsm(mat.Right, mat.Upper, mat.NoTrans, diag, j-1, jb, -one, a.Off(j-1, j-1))\n\n\t\t\t\t// Compute inverse of current diagonal block\n\t\t\t\tif err = Dtrti2(Upper, diag, jb, a.Off(j-1, j-1)); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// Compute inverse of lower triangular matrix\n\t\t\tnn = ((n-1)/nb)*nb + 1\n\t\t\tfor j = nn; j >= 1; j -= nb {\n\t\t\t\tjb = min(nb, n-j+1)\n\t\t\t\tif j+jb <= n {\n\t\t\t\t\t// Compute rows j+jb:n of current block column\n\t\t\t\t\terr = a.Off(j+jb-1, j-1).Trmm(mat.Left, mat.Lower, mat.NoTrans, diag, n-j-jb+1, jb, one, a.Off(j+jb-1, j+jb-1))\n\t\t\t\t\terr = a.Off(j+jb-1, j-1).Trsm(mat.Right, mat.Lower, mat.NoTrans, diag, n-j-jb+1, jb, -one, a.Off(j-1, j-1))\n\t\t\t\t}\n\n\t\t\t\t// Compute inverse of current diagonal block\n\t\t\t\tif err = Dtrti2(Lower, diag, jb, a.Off(j-1, j-1)); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "1fba555867666592cd6a9d400c15a486", "score": "0.48242217", "text": "func tri(n int, a, d, c, x, b *Matrix) {\n\n\t//forward Elimination updates b vector\n\tfor i := 1; i < n; i++ {\n\t\taPrev := a.Get(0, i-1)\n\t\tdPrev := d.Get(0, i-1)\n\t\tbPrev := b.Get(0, i-1)\n\t\tcPrev := c.Get(0, i-1)\n\t\tdCur := d.Get(0, i)\n\t\tbCur := b.Get(0, i)\n\n\t\txMult := aPrev / dPrev\n\t\td.Set(0, i, dCur-xMult*cPrev)\n\t\tb.Set(0, i, bCur-xMult*bPrev)\n\n\t}\n\n\t//backSubstitution phase:\n\t//places answers into x using backSubstitution\n\tbn := b.Get(0, n-1)\n\tdn := d.Get(0, n-1)\n\tx.Set(0, n-1, bn/dn)\n\tfor i := n - 2; i <= 0; i-- {\n\t\tbCur := b.Get(0, i)\n\t\tcCur := c.Get(0, i)\n\t\tdCur := d.Get(0, i)\n\t\txPrev := x.Get(0, i+1)\n\t\tx.Set(0, i, (bCur-cCur*xPrev)/dCur)\n\t}\n\n}", "title": "" }, { "docid": "489f694d7d706c7886c4241f9420e816", "score": "0.48238167", "text": "func BroadcastGt(a, b *Node, retSame bool, leftPattern, rightPattern []byte) (*Node, error) {\n\ta2, b2, err := Broadcast(a, b, NewBroadcastPattern(leftPattern, rightPattern))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn Gt(a2, b2, retSame)\n}", "title": "" }, { "docid": "84bdaed3ebc0a020439d4f8f433d6fb2", "score": "0.48088798", "text": "func gte(t *testing.T, a, b float64) {\n\tif a < b {\n\t\tt.Errorf(\"Expected %v (type %v) > Got %v (type %v)\", a, reflect.TypeOf(a), b, reflect.TypeOf(b))\n\t}\n}", "title": "" }, { "docid": "84bdaed3ebc0a020439d4f8f433d6fb2", "score": "0.48088798", "text": "func gte(t *testing.T, a, b float64) {\n\tif a < b {\n\t\tt.Errorf(\"Expected %v (type %v) > Got %v (type %v)\", a, reflect.TypeOf(a), b, reflect.TypeOf(b))\n\t}\n}", "title": "" }, { "docid": "1a109d1c8b618c46ed9eb40124cd64a8", "score": "0.48028967", "text": "func IntGT(v int) predicate.FieldType {\n\treturn predicate.FieldType(sql.FieldGT(FieldInt, v))\n}", "title": "" }, { "docid": "8ba3ba6a2f818b7b1620ec572a81db55", "score": "0.48017886", "text": "func PressureGT(v float64) predicate.TriageResult {\n\treturn predicate.TriageResult(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPressure), v))\n\t})\n}", "title": "" }, { "docid": "f8a9553fb7b6a2681d4a26cdbb429c55", "score": "0.48001093", "text": "func Gt(t TestingT, give, min any, fmtAndArgs ...any) bool {\n\tif mathutil.Compare(give, min, \"gt\") {\n\t\treturn true\n\t}\n\n\tt.Helper()\n\treturn fail(t, fmt.Sprintf(\"Given %v should greater than %v\", give, min), fmtAndArgs)\n}", "title": "" }, { "docid": "561d1a911586ce8734269800f8d5eafb", "score": "0.47957698", "text": "func (f Float64) Gt(t Float64) bool {\n\treturn t.Le(f)\n}", "title": "" }, { "docid": "833a8385b6446da55d4825e31b8a4f7d", "score": "0.47893527", "text": "func (f *Field) GT(n int) *PQLRowQuery {\n\treturn f.binaryOperation(\">\", n)\n}", "title": "" }, { "docid": "58bea26d89b44cc7f6f10f1f33bb6482", "score": "0.47780007", "text": "func TransactionsGT(v int32) predicate.BarRecord {\n\treturn predicate.BarRecord(sql.FieldGT(FieldTransactions, v))\n}", "title": "" }, { "docid": "5c0e9dfd79fca0a8946345fa2a388eb6", "score": "0.47641727", "text": "func (t TransposeTriBand) Triangle() (int, TriKind) {\n\tn, upper := t.TriBanded.Triangle()\n\treturn n, !upper\n}", "title": "" }, { "docid": "a7f6ed06d59b60fb9847c86abd20441e", "score": "0.4760132", "text": "func (f *Field) GT(n IntOrFloat) *PQLRowQuery {\n\treturn f.binaryOperation(\">\", n)\n}", "title": "" }, { "docid": "8abc275766f614b729944440a748840f", "score": "0.475968", "text": "func GTE(v values.Sortable) *Greater {\n\treturn &Greater{Value: v, Equal: true}\n}", "title": "" }, { "docid": "f7f8cc5b13624cae884826cd9add3ba0", "score": "0.47569078", "text": "func (t *TriDense) SetTri(i, j int, v float64) {\n\tif uint(i) >= uint(t.mat.N) {\n\t\tpanic(ErrRowAccess)\n\t}\n\tif uint(j) >= uint(t.mat.N) {\n\t\tpanic(ErrColAccess)\n\t}\n\tisUpper := t.isUpper()\n\tif (isUpper && i > j) || (!isUpper && i < j) {\n\t\tpanic(ErrTriangleSet)\n\t}\n\tt.set(i, j, v)\n}", "title": "" }, { "docid": "3c57ccd9893b182a6a7141ccd773a4fd", "score": "0.47503826", "text": "func opF64Gteq(prgrm *ast.CXProgram, inputs []ast.CXValue, outputs []ast.CXValue) {\n\toutV0 := inputs[0].Get_f64(prgrm) >= inputs[1].Get_f64(prgrm)\n\toutputs[0].Set_bool(prgrm, outV0)\n}", "title": "" }, { "docid": "9a9ddf63b9aae41705538dbcd62d21bd", "score": "0.47338098", "text": "func (gp *GABABParams) GABAB(gabaB, gabaBx, gi float32) (g, x float32) {\n\tdG, dX := gp.BiExp(gabaB, gabaBx)\n\tx = gabaBx + gp.GFmS(gi) + dX // gets new input\n\tg = gabaB + dG\n\treturn\n}", "title": "" }, { "docid": "d59f86f1a344f5cb2c3d8abb4fb6946a", "score": "0.47247308", "text": "func (i *Int32) SwapGreater(new int32) (old int32, swapped bool) {\n\tfor {\n\t\told := i.Load()\n\t\tif new <= old {\n\t\t\treturn old, false\n\t\t}\n\t\tif i.CAS(old, new) {\n\t\t\treturn old, true\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8cfa3e4d27a953f4a326768781f85fa0", "score": "0.47177547", "text": "func (s *Severity) Gt(val Severity) bool {\n\treturn s.Get() > val\n}", "title": "" }, { "docid": "e04243b519e95ec11d1f287337354dc8", "score": "0.47134706", "text": "func Gt(v interface{}) Func {\n\treturn numericalMatch(\">\", v)\n}", "title": "" }, { "docid": "b2cd2a2b1e1bb3954ae3713ec31f3ce3", "score": "0.46965253", "text": "func GCDEuclidean(a, b int) int {\n\tfor a != b {\n\t\tif a > b {\n\t\t\ta -= b\n\t\t} else {\n\t\t\tb -= a\n\t\t}\n\t}\n\n\treturn a\n}", "title": "" }, { "docid": "48fbb5fcb3b73d3256ca9a8b892f3209", "score": "0.4682762", "text": "func op_f32_gteq(expr *CXExpression, fp int) {\n\tinp1, inp2, out1 := expr.Inputs[0], expr.Inputs[1], expr.Outputs[0]\n\toutB1 := FromBool(ReadF32(fp, inp1) >= ReadF32(fp, inp2))\n\tWriteMemory(GetFinalOffset(fp, out1), outB1)\n}", "title": "" }, { "docid": "7fd763be4d806e84c8d4a911167c4aa0", "score": "0.46572483", "text": "func lexGreater(l *lexer) stateFn {\n\tif l.accept(\"=\") {\n\t\tl.emit(token.Ge)\n\t} else {\n\t\tl.emit(token.Gt)\n\t}\n\treturn lexToken\n}", "title": "" }, { "docid": "0ac38b6509c42c3380e83ea829b670a1", "score": "0.46550867", "text": "func PriorityGT(v task.Priority) predicate.Task {\n\tvc := int(v)\n\treturn predicate.Task(sql.FieldGT(FieldPriority, vc))\n}", "title": "" }, { "docid": "cdcc684b905f290efd148b76d91b6ecb", "score": "0.46455956", "text": "func TestGt(t *testing.T) {\n\tfor _, tt := range gttt {\n\t\t// Act\n\t\tresult, err := gt(tt.v1, tt.v2)\n\n\t\t// Assert\n\t\tassert.Equal(t, tt.err, err, tt.message)\n\t\tassert.Equal(t, tt.result, (result != nil), tt.message)\n\t}\n}", "title": "" }, { "docid": "31dc21aec29371a6fe9357077b04bab3", "score": "0.46221265", "text": "func (f *FloatU) Gt(u *FloatU) bool {\n return f.value - f.uncertainty > u.value + u.uncertainty\n}", "title": "" }, { "docid": "0b264df07083e781385fea604f1ee489", "score": "0.4614835", "text": "func opUI8Lteq(prgrm *ast.CXProgram, inputs []ast.CXValue, outputs []ast.CXValue) {\n\toutV0 := inputs[0].Get_ui8(prgrm) <= inputs[1].Get_ui8(prgrm)\n\toutputs[0].Set_bool(prgrm, outV0)\n}", "title": "" }, { "docid": "732c6a2835342ddb56627a95c13ead24", "score": "0.4602466", "text": "func CvvGT(v string) predicate.Orderonline {\n\treturn predicate.Orderonline(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldCvv), v))\n\t})\n}", "title": "" }, { "docid": "f31d7d3b54196af93dfbb1e434ed3960", "score": "0.4601667", "text": "func (t *TriBandDense) TTri() Triangular {\n\treturn TransposeTri{t}\n}", "title": "" }, { "docid": "d106e9665bfcae7ce0d46b19e0130e3c", "score": "0.46016377", "text": "func CreditGT(v int) predicate.Course {\n\treturn predicate.Course(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldCredit), v))\n\t})\n}", "title": "" }, { "docid": "825bf9a9b1e9ec08df3b60553c221b00", "score": "0.4596617", "text": "func checkTriangle(a, b, c float64) bool {\n\t// If any side is 0, it's not a valid triange\n\tif a == 0 || b == 0 || c == 0 {\n\t\treturn false\n\t}\n\tsides := []float64{a, b, c}\n\tsort.Float64s(sides)\n\tmax := sides[len(sides)-1]\n\tif max <= sumFloats(sides)-max {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "932118af15cd21d77a596a1790b66b02", "score": "0.4584392", "text": "func TripleGT(v schema.Triple) predicate.FieldType {\n\treturn predicate.FieldType(sql.FieldGT(FieldTriple, v))\n}", "title": "" }, { "docid": "e89b7281b1f75a405a887952be9e579b", "score": "0.45807672", "text": "func Gt(lattr string, rattr string) Criterion {\n\tml := Mapper.MapInt(lattr)\n\tmr := Mapper.MapInt(rattr)\n\tp := func(r *Record) bool { return ml(r) > mr(r) }\n\treturn Criterion{p}\n}", "title": "" }, { "docid": "a035c5b457197e0e4008cad5fb0c249b", "score": "0.45793945", "text": "func (t *RBTint32) Glb(x int32) (k int32, d interface{})", "title": "" }, { "docid": "4e6fca49d84536c60d91924b55fff64c", "score": "0.45764813", "text": "func opF64Gt(prgrm *ast.CXProgram, inputs []ast.CXValue, outputs []ast.CXValue) {\n\toutV0 := inputs[0].Get_f64(prgrm) > inputs[1].Get_f64(prgrm)\n\toutputs[0].Set_bool(prgrm, outV0)\n}", "title": "" }, { "docid": "59a3ee0d9e3042e60e4f8b375a4b4d27", "score": "0.45717016", "text": "func AssertInt32GT(t *testing.T, v1 int32, v2 int32) {\n if (v1 <= v2) {\n LogErr(t, fmt.Sprintf(\"%v is less than %v\", v1, v2))\n }\n}", "title": "" }, { "docid": "8ed90db09df54b7d2e2cd284b27ff179", "score": "0.45698276", "text": "func calcGBBBits(curr, clear, set uint32) uint32 {\n\treturn (curr & ^clear) | set\n}", "title": "" }, { "docid": "e1ac18fc13c998229233dbc7aa54a008", "score": "0.45683926", "text": "func triArea(a, b, c Point) *big.Float {\n\n\t//return (b[0]-a[0])*(c[1]-a[1]) - (b[1]-a[1])*(c[0]-a[0])\n\n\tba0 := new(big.Float).Sub(b[0], a[0])\n\tca0 := new(big.Float).Sub(c[0], a[0])\n\tba1 := new(big.Float).Sub(b[1], a[1])\n\tca1 := new(big.Float).Sub(c[1], a[1])\n\tmulba0ca1 := new(big.Float).Mul(ba0, ca1)\n\tmulba1ca0 := new(big.Float).Mul(ba1, ca0)\n\treturn new(big.Float).Sub(mulba0ca1, mulba1ca0)\n}", "title": "" }, { "docid": "1a9174c1add41b47d01a6d0683dfaf30", "score": "0.45581636", "text": "func cp(c *CPU, value uint8) uint8 {\n\t// Flags: z 1 h c\n\tc.F = FlagN\n\tif value&0xf > c.A&0xf {\n\t\tc.F |= FlagH\n\t}\n\tif value > c.A {\n\t\tc.F |= FlagC\n\t}\n\tresult := c.A - value\n\tif result == 0 {\n\t\tc.F |= FlagZ\n\t}\n\treturn result\n}", "title": "" }, { "docid": "f5714fb173f35d704cac86a20cc448e4", "score": "0.45493916", "text": "func (cli *field) Gt(val interface{}) Condition {\n\tcli.opeartor = BKDBGT\n\tcli.fieldValue = val\n\treturn cli.condition\n}", "title": "" }, { "docid": "fa44172ec65993e9574b98fd2810fe08", "score": "0.45475858", "text": "func Gcd(a, b int) int {\n\tif a < b {\n\t\treturn Gcd(b, a)\n\t}\n\tif b == 0 {\n\t\treturn a\n\t}\n\treturn Gcd(b, a%b)\n}", "title": "" }, { "docid": "c9acbaee2cfe43b69a7cefc1ce090cac", "score": "0.45275635", "text": "func (t TransposeTriBand) TTri() Triangular {\n\treturn t.TriBanded\n}", "title": "" }, { "docid": "c628c88c07067784f79316185ee5f8ff", "score": "0.45100594", "text": "func mathUlt(state *lua.State) int {\n\tm := uint64(state.CheckInt(1))\n\tn := uint64(state.CheckInt(2))\n\tstate.Push(m < n)\n\treturn 1\n}", "title": "" }, { "docid": "9ef4e35309783763e1b26d005bdf68c5", "score": "0.45024407", "text": "func Int32GT(v int32) predicate.FieldType {\n\treturn predicate.FieldType(sql.FieldGT(FieldInt32, v))\n}", "title": "" }, { "docid": "e465a3c57e187407d0d3b8622974b9b2", "score": "0.449531", "text": "func opI32Lt(prgrm *ast.CXProgram, inputs []ast.CXValue, outputs []ast.CXValue) {\n\toutV0 := inputs[0].Get_i32(prgrm) < inputs[1].Get_i32(prgrm)\n\toutputs[0].Set_bool(prgrm, outV0)\n}", "title": "" }, { "docid": "c9840d7d0107c7194c978027d39e8ae1", "score": "0.4483822", "text": "func unaryB(io VM, A []base.Wire, isOther []base.Wire) []base.Wire {\n\tnodesInTree := 2 * (1 << uint(len(A))) // 2^len(A) leaves, 2*(2^len(A)) nodes in tree, throwing out position 0\n\tphi := make([]base.Wire, nodesInTree)\n\tphi[1] = Not(io, isOther)[0] // root, will be Anded with all nodes\n\tfor i := range A { // for each bit of A\n\t\tbitposition := len(A) - 1 - i // starting from MSB down to LSB\n\t\tleftmost := (1 << uint(i)) * 2 // get position of leftmost node of row\n\t\tfor j := leftmost; j < leftmost*2; j++ { // for each node in row\n\t\t\tswitch j % 2 {\n\t\t\tcase 0:\n\t\t\t\tphi[j] = And(io, phi[j/2:j/2+1], Not(io, A[bitposition:bitposition+1]))[0]\n\t\t\tcase 1:\n\t\t\t\tphi[j] = And(io, phi[j/2:j/2+1], A[bitposition:bitposition+1])[0]\n\t\t\t}\n\t\t}\n\t}\n\treturn phi[nodesInTree/2:]\n}", "title": "" }, { "docid": "4ac63efe07c67ddebde7756ec5123726", "score": "0.44629848", "text": "func Int16GT(v int16) predicate.FieldType {\n\treturn predicate.FieldType(sql.FieldGT(FieldInt16, v))\n}", "title": "" }, { "docid": "9b14949f1b919268465f869b8cd73c89", "score": "0.44500566", "text": "func Gcd(a, b uint64) uint64 {\n\tfor ; b != 0; b, a = a%b, b {\n\t}\n\treturn a\n}", "title": "" }, { "docid": "ceb7f011b84e9a5d63d64b51b69fb5c0", "score": "0.44481152", "text": "func Zgbtrs(trans mat.MatTrans, n, kl, ku, nrhs int, ab *mat.CMatrix, ipiv *[]int, b *mat.CMatrix) (err error) {\n\tvar lnoti, notran bool\n\tvar one complex128\n\tvar i, j, kd, l, lm int\n\n\tone = (1.0 + 0.0*1i)\n\n\t// Test the input parameters.\n\tnotran = trans == NoTrans\n\tif !notran && trans != Trans && trans != ConjTrans {\n\t\terr = fmt.Errorf(\"!notran && trans != Trans && trans != ConjTrans: trans=%s\", trans)\n\t} else if n < 0 {\n\t\terr = fmt.Errorf(\"n < 0: n=%v\", n)\n\t} else if kl < 0 {\n\t\terr = fmt.Errorf(\"kl < 0: kl=%v\", kl)\n\t} else if ku < 0 {\n\t\terr = fmt.Errorf(\"ku < 0: ku=%v\", ku)\n\t} else if nrhs < 0 {\n\t\terr = fmt.Errorf(\"nrhs < 0: nrhs=%v\", nrhs)\n\t} else if ab.Rows < (2*kl + ku + 1) {\n\t\terr = fmt.Errorf(\"ab.Rows < (2*kl + ku + 1): ab.Rows=%v, kl=%v, ku=%v\", ab.Rows, kl, ku)\n\t} else if b.Rows < max(1, n) {\n\t\terr = fmt.Errorf(\"b.Rows < max(1, n): b.Rows=%v, n=%v\", b.Rows, n)\n\t}\n\tif err != nil {\n\t\tgltest.Xerbla2(\"Zgbtrs\", err)\n\t\treturn\n\t}\n\n\t// Quick return if possible\n\tif n == 0 || nrhs == 0 {\n\t\treturn\n\t}\n\n\tkd = ku + kl + 1\n\tlnoti = kl > 0\n\n\tif notran {\n\t\t// Solve A*X = B.\n\t\t//\n\t\t// Solve L*X = B, overwriting B with X.\n\t\t//\n\t\t// L is represented as a product of permutations and unit lower\n\t\t// triangular matrices L = P(1) * L(1) * ... * P(n-1) * L(n-1),\n\t\t// where each transformation L(i) is a rank-one modification of\n\t\t// the identity matrix.\n\t\tif lnoti {\n\t\t\tfor j = 1; j <= n-1; j++ {\n\t\t\t\tlm = min(kl, n-j)\n\t\t\t\tl = (*ipiv)[j-1]\n\t\t\t\tif l != j {\n\t\t\t\t\tb.Off(j-1, 0).CVector().Swap(nrhs, b.Off(l-1, 0).CVector(), b.Rows, b.Rows)\n\t\t\t\t}\n\t\t\t\tif err = b.Off(j, 0).Geru(lm, nrhs, -one, ab.Off(kd, j-1).CVector(), 1, b.Off(j-1, 0).CVector(), b.Rows); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor i = 1; i <= nrhs; i++ {\n\t\t\t// Solve U*X = B, overwriting B with X.\n\t\t\tif err = b.Off(0, i-1).CVector().Tbsv(Upper, NoTrans, NonUnit, n, kl+ku, ab, 1); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t}\n\n\t} else if trans == Trans {\n\t\t// Solve A**T * X = B.\n\t\tfor i = 1; i <= nrhs; i++ {\n\t\t\t// Solve U**T * X = B, overwriting B with X.\n\t\t\tif err = b.Off(0, i-1).CVector().Tbsv(Upper, Trans, NonUnit, n, kl+ku, ab, 1); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t}\n\n\t\t// Solve L**T * X = B, overwriting B with X.\n\t\tif lnoti {\n\t\t\tfor j = n - 1; j >= 1; j-- {\n\t\t\t\tlm = min(kl, n-j)\n\t\t\t\tif err = b.Off(j-1, 0).CVector().Gemv(Trans, lm, nrhs, -one, b.Off(j, 0), ab.Off(kd, j-1).CVector(), 1, one, b.Rows); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t\tl = (*ipiv)[j-1]\n\t\t\t\tif l != j {\n\t\t\t\t\tb.Off(j-1, 0).CVector().Swap(nrhs, b.Off(l-1, 0).CVector(), b.Rows, b.Rows)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t} else {\n\t\t// Solve A**H * X = B.\n\t\tfor i = 1; i <= nrhs; i++ {\n\t\t\t// Solve U**H * X = B, overwriting B with X.\n\t\t\tif err = b.Off(0, i-1).CVector().Tbsv(Upper, ConjTrans, NonUnit, n, kl+ku, ab, 1); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t}\n\n\t\t// Solve L**H * X = B, overwriting B with X.\n\t\tif lnoti {\n\t\t\tfor j = n - 1; j >= 1; j-- {\n\t\t\t\tlm = min(kl, n-j)\n\t\t\t\tZlacgv(nrhs, b.Off(j-1, 0).CVector(), b.Rows)\n\t\t\t\terr = b.Off(j-1, 0).CVector().Gemv(ConjTrans, lm, nrhs, -one, b.Off(j, 0), ab.Off(kd, j-1).CVector(), 1, one, b.Rows)\n\t\t\t\tZlacgv(nrhs, b.Off(j-1, 0).CVector(), b.Rows)\n\t\t\t\tl = (*ipiv)[j-1]\n\t\t\t\tif l != j {\n\t\t\t\t\tb.Off(j-1, 0).CVector().Swap(nrhs, b.Off(l-1, 0).CVector(), b.Rows, b.Rows)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "e71c74c2f2b0c4f924d4988344ceb0d7", "score": "0.4445532", "text": "func GG1(x uint32, y uint32, z uint32) uint32 {\n\treturn ((x & y) | ((^x) & z))\n}", "title": "" }, { "docid": "0b3f6c783841fe9ea40a705de9132cac", "score": "0.4440632", "text": "func TelGT(v string) predicate.RightToTreatment {\n\treturn predicate.RightToTreatment(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldTel), v))\n\t})\n}", "title": "" }, { "docid": "8cbf02391a6ec3db24b10821fbdf96de", "score": "0.44262722", "text": "func Gt(field string, value interface{}) *Expression {\n\treturn &Expression{Type: GT, Parts: []interface{}{field, value}}\n}", "title": "" }, { "docid": "94f1a36766d898f797509ef6d0cf2cf9", "score": "0.43962547", "text": "func LowGT(v float64) predicate.BarRecord {\n\treturn predicate.BarRecord(sql.FieldGT(FieldLow, v))\n}", "title": "" }, { "docid": "2ebc934492777c9e7229cd35cb510037", "score": "0.4393649", "text": "func BigIntGT(v schema.BigInt) predicate.FieldType {\n\treturn predicate.FieldType(sql.FieldGT(FieldBigInt, v))\n}", "title": "" }, { "docid": "17b2e2a74eed72375384c1747c8c2168", "score": "0.43738878", "text": "func (r *Raw) GTE(i, j interface{}) bool {\n\treturn r.cmp(i, j) >= eq\n}", "title": "" }, { "docid": "352bf78842db0bac9598b64a47f9388d", "score": "0.43700856", "text": "func less(a, b uint32) bool {\n\treturn int32(a-b) < 0\n}", "title": "" }, { "docid": "dd9135af46d23a6222ee7128305c89b4", "score": "0.4360377", "text": "func max(a, b uint32) uint32 {\n\tif a < b {\n\t\treturn b\n\t}\n\treturn a\n}", "title": "" } ]
7eee30594c47770633ff7b33ce95e797
ToLatLon converts the Vector3d cartesian coordinates to latitude longitude according to the WGS84 datum. It returns a lat/lon coordinates struct.
[ { "docid": "a150ef9c0e331d5ef12e7a852893483f", "score": "0.8139126", "text": "func (v *Vector3d) ToLatLon(datum Datum) Coordinates {\n\taa := datum.a\n\tbb := datum.b\n\n\te2 := (aa*aa - bb*bb) / (aa * aa) // 1st eccentricity squared\n\tε2 := (aa*aa - bb*bb) / (bb * bb) // 2nd eccentricity squared\n\tp := math.Sqrt(v.x*v.x + v.y*v.y) // distance from minor axis\n\tR := math.Sqrt(p*p + v.z*v.z) // polar radius\n\n\t// parametric latitude\n\ttanβ := (bb * v.z) / (aa * p) * (1 + ε2*b/R)\n\tsinβ := tanβ / math.Sqrt(1+tanβ*tanβ)\n\tcosβ := sinβ / tanβ\n\n\t// geodetic latitude\n\tφ := math.Atan2(v.z+ε2*bb*sinβ*sinβ*sinβ, p-e2*aa*cosβ*cosβ*cosβ)\n\n\t// longitude\n\tλ := math.Atan2(v.y, v.x)\n\n\tcoords := Coordinates{\n\t\tLat: toDegrees(φ),\n\t\tLon: toDegrees(λ),\n\t}\n\n\treturn coords\n}", "title": "" } ]
[ { "docid": "c8eab6bb6b146dda88631cdc4562462c", "score": "0.5847075", "text": "func XYToLatLon(x, y float64) (float64, float64) {\n\tradius := 6371.0\n\tvar lat, lon float64\n\tlat = y / radius\n\tlon = x / (radius * math.Cos(1.))\n\n\treturn lat, lon\n}", "title": "" }, { "docid": "97beeb682359cd97d1f82ad134141803", "score": "0.58051217", "text": "func (point Point) MetersToLonLat(origin Point) Point {\n\treturn Point{\n\t\tX: point.X / 111111 / math.Cos(origin.Y * math.Pi / 180) + origin.X,\n\t\tY: point.Y / 111111 + origin.Y,\n\t}\n}", "title": "" }, { "docid": "8f4bd0da891724e81957e8317d481303", "score": "0.56432474", "text": "func (m GlobalMercator) LatLonToMeters(lat, lon float64) (mx, my float64) {\n\tmx = lon * m.originShift / 180.0\n\tmy = math.Log(math.Tan((90+lat)*math.Pi/360.0)) / (math.Pi / 180.0)\n\n\tmy = my * m.originShift / 180.0\n\treturn mx, my\n}", "title": "" }, { "docid": "37ec677a73e7351699cffb81c66cf852", "score": "0.56028557", "text": "func (m GlobalMercator) MetersToLatLon(mx, my float64) (lat, lon float64) {\n\tlon = (mx / m.originShift) * 180.0\n\tlat = (my / m.originShift) * 180.0\n\n\tlat = 180 / math.Pi * (2*math.Atan(math.Exp(lat*math.Pi/180.0)) - math.Pi/2.0)\n\treturn lat, lon\n}", "title": "" }, { "docid": "f4cf178e6f02d240165845bf025ecce8", "score": "0.5385513", "text": "func NewRoadPositionFromLonLat(stateID int, graphVertex int64, e *Edge, lon, lat float64, srid ...int) *RoadPosition {\n\tstate := RoadPosition{\n\t\tRoadPositionID: stateID,\n\t\tGraphEdge: e,\n\t\tGraphVertex: graphVertex,\n\t}\n\tif len(srid) != 0 {\n\t\tswitch srid[0] {\n\t\tcase 0:\n\t\t\tstate.Projected = NewEuclideanPoint(lon, lat)\n\t\tcase 4326:\n\t\t\tstate.Projected = NewWGS84Point(lon, lat)\n\t\tdefault:\n\t\t\tstate.Projected = NewWGS84Point(lon, lat)\n\t\t}\n\t}\n\treturn &state\n}", "title": "" }, { "docid": "8a37d512bf590588439f5038a9bfb4a4", "score": "0.5290248", "text": "func Latitude() float32 {\r\n\treturn r.Float32()*180 - 90\r\n}", "title": "" }, { "docid": "969aa4a5ec90c5b8955dd0dbf76949d5", "score": "0.5255608", "text": "func (g GeoCoord) Coord3D() Coord3D {\n\treturn Coord3D{\n\t\tX: math.Sin(g.Lon) * math.Cos(g.Lat),\n\t\tY: math.Sin(g.Lat),\n\t\tZ: math.Cos(g.Lon) * math.Cos(g.Lat),\n\t}\n}", "title": "" }, { "docid": "018ccc4f6329ac762169617e5867b57b", "score": "0.5068254", "text": "func (xy *XY) LngLat(truncate bool) Coordinate {\n\tlng, lat := xy.X*r2d/earthRadius, ((math.Pi*0.5)-2.0*math.Exp(-xy.Y/earthRadius))*r2d\n\tc := NewCoordinate(lng, lat)\n\tif truncate {\n\t\tc.Truncate()\n\t}\n\treturn c\n}", "title": "" }, { "docid": "b59363a9592da5bf76267fc4e2b0db29", "score": "0.5058634", "text": "func (g *Gps) Lat() float64 {\n\treturn float64(g.Latitude)\n}", "title": "" }, { "docid": "cc0f0bde758648bfb750adcb0fdd815e", "score": "0.5023935", "text": "func (c Coord3D) Geo() GeoCoord {\n\tif c.Norm() == 0 {\n\t\treturn GeoCoord{}\n\t}\n\tp := c.Scale(1 / c.Norm())\n\tg := GeoCoord{}\n\tg.Lat = math.Asin(p.Y)\n\tg.Lon = math.Atan2(p.X, p.Z)\n\treturn g\n}", "title": "" }, { "docid": "f8de74ca8428420af7a0b3c5ba75722e", "score": "0.4978466", "text": "func LatLonToTileTMS(zoom int, lat, lon float64) (x, y int) {\n\tn := float64(pow2(zoom))\n\tx = int(n * ((lon + 180) / 360))\n\tlatRad := lat / 180 * math.Pi\n\ty = int((math.Log(math.Tan(latRad*0.5+math.Pi/4))*1/(2*math.Pi) + 0.5) * n)\n\treturn\n}", "title": "" }, { "docid": "f5db5551a6bc6547f773840ad6a9bec7", "score": "0.4927191", "text": "func (v Vector2) ToVector3() Vector3 { return NewVector3(v.X, v.Y, 0) }", "title": "" }, { "docid": "0c9317e14309006a09e569d77b0109fd", "score": "0.49201494", "text": "func NewLatLng(lat, lng float64) *LatLng {\n\treturn &LatLng{\n\t\tObject: L.Call(\"latLng\", lat, lng),\n\t}\n}", "title": "" }, { "docid": "eb25b2b4688aad006efd75404c64f360", "score": "0.49043548", "text": "func (v Vector3) ToVector4() Vector4 { return NewVector4(v.X, v.Y, v.Z, 0) }", "title": "" }, { "docid": "923d9d6ceca650305eaa07d2d442a25f", "score": "0.48620644", "text": "func NewVector3(x, y, z float32) Vector3 { return Vector3{X: x, Y: y, Z: z} }", "title": "" }, { "docid": "a0db56fe3caf0145d0ec132e4458d38c", "score": "0.48334107", "text": "func LatLonToTileOSM(zoom int, lat, lon float64) (x, y int) {\n\tn := float64(pow2(zoom))\n\tx = int(n * ((lon + 180) / 360))\n\tlatRad := lat / 180 * math.Pi\n\ty = int(n * (1 - (math.Log(math.Tan(latRad)+1/math.Cos(latRad)) / math.Pi)) / 2)\n\treturn\n}", "title": "" }, { "docid": "4623f8869b69feb89f4ef451b5b3ff69", "score": "0.48137695", "text": "func (v *Vector3D) ToBlasVector() blas64.Vector {\n\treturn blas64.Vector{\n\t\tN: 3,\n\t\tData: []float64{v.X, v.Y, v.Z},\n\t\tInc: 1,\n\t}\n}", "title": "" }, { "docid": "5cc5ab267ebc8762bc250f202dc24b21", "score": "0.48119986", "text": "func GetPointCoordinates(feature *Feature) (float64, float64) {\n\t// long = longitude (Y)\n\t// lat = latitude (X)\n\n\t// convert coordinates from interface to []float64\n\tcoord := (feature.Geom.Coordinates).([]float64)\n\tlon := coord[0]\n\tlat := coord[1]\n\n\treturn lon, lat\n}", "title": "" }, { "docid": "f944b43e0341dc2606ef05dd0b7bfcac", "score": "0.4783415", "text": "func (g GeoCoord) Normalize() GeoCoord {\n\tp := g.Coord3D()\n\treturn p.Geo()\n}", "title": "" }, { "docid": "1a4b8a081a8fed23eb0c7a73d23674c4", "score": "0.47569543", "text": "func OSGB36ToWGS84LatLong(coord *OSGB36Coord) *cartconvert.PolarCoord {\n\n\teasting, northing := OSGB36ZoneToRefCoords(coord)\n\n\tgc := cartconvert.InverseTransverseMercator(\n\t\t&cartconvert.GeoPoint{Y: float64(northing), X: float64(easting), El: coord.El},\n\t\t49,\n\t\t-2,\n\t\t0.9996012717,\n\t\t400000,\n\t\t-100000)\n\n\tcart := cartconvert.PolarToCartesian(gc)\n\tpt := cartconvert.HelmertWGS84ToOSGB36.InverseTransform(&cartconvert.Point3D{X: cart.X, Y: cart.Y, Z: cart.Z})\n\n\treturn cartconvert.CartesianToPolar(&cartconvert.CartPoint{X: pt.X, Y: pt.Y, Z: pt.Z, El: cartconvert.WGS84Ellipsoid})\n}", "title": "" }, { "docid": "1b00a9d6b8550a7eb3528554b52862eb", "score": "0.47477555", "text": "func NewVector3(x float64, y float64, z float64) *Vector3 {\n\tvector3 := &Vector3{}\n\n\t// Create our godot vector3 object\n\tvar godotVector3 C.godot_vector3\n\n\t// Create our vector3\n\tC.godot_vector3_new(\n\t\t&godotVector3,\n\t\trealAsGodotReal(x),\n\t\trealAsGodotReal(y),\n\t\trealAsGodotReal(z),\n\t)\n\n\t// Internally set our vector3\n\tvector3.vector3 = &godotVector3\n\n\treturn vector3\n}", "title": "" }, { "docid": "ca708630e8b3e53d874bd6910ee81394", "score": "0.4719814", "text": "func (p *Point3D) AsVector() *Vector3D {\n\treturn &Vector3D{\n\t\tX: p.GetX(),\n\t\tY: p.GetY(),\n\t\tZ: p.GetZ(),\n\t}\n}", "title": "" }, { "docid": "e93434a803f1679a850277e3388ab47e", "score": "0.4716871", "text": "func LogLuvToXYZ(SLe, le, ue, ve byte) (x, y, z float64) {\n\tl := BytesToUint16(SLe, le)\n\ty = SLeToY(l)\n\n\tubis := (float64(ue) + 0.5) / 410\n\tvbis := (float64(ve) + 0.5) / 410\n\n\ts := 6*ubis - 16*vbis + 12\n\tlx := 9 * ubis / s\n\tly := 4 * vbis / s\n\n\tabsY := math.Abs(y)\n\tx = lx / ly * absY\n\tz = (1 - lx - ly) / ly * absY\n\n\treturn\n}", "title": "" }, { "docid": "85db6f296f6fc4afe24b33626c2f239e", "score": "0.47095394", "text": "func (a ArrayF32) GetVector3(pos int, v *Vector3) {\n\n\tv.X = a[pos]\n\tv.Y = a[pos+1]\n\tv.Z = a[pos+2]\n}", "title": "" }, { "docid": "dd911b061749136530b405535efc5000", "score": "0.46819437", "text": "func GetCoords() (*Coords, error) {\n\tvar db, err = distrowatch.GetDB()\n\tif err != nil {\n\t\treturn &Coords{}, err\n\t}\n\tdefer db.Close()\n\n\tvar latitude, longitude float64\n\tvar latitudeDiff, longitudeDiff float64\n\tvar latitudeTrend, longitudeTrend int\n\tvar latitudeDelta, longitudeDelta float64\n\terr = db.QueryRow(\"SELECT latitude, longitude, latitude_diff, longitude_diff, latitude_trend, longitude_trend FROM coords ORDER BY date DESC LIMIT 1\").Scan(&latitude, &longitude, &latitudeDiff, &longitudeDiff, &latitudeTrend, &longitudeTrend)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\tlatitude = 60.0\n\t\t\tlatitudeDelta = 0.0\n\t\t\tlongitude = 30.0\n\t\t\tlongitudeDelta = 0.0\n\t\t} else {\n\t\t\treturn &Coords{}, err\n\t\t}\n\t} else {\n\t\tlatitudeDelta = latitudeDiff * float64(latitudeTrend)\n\t\tlongitudeDelta = longitudeDiff * float64(longitudeTrend)\n\t}\n\n\treturn &Coords{latitude, longitude, latitudeDelta, longitudeDelta}, nil\n}", "title": "" }, { "docid": "1c0a0ce4c5250222e4ac7176c3f9845b", "score": "0.4669299", "text": "func LatLonBox(children ...Element) *CompoundElement {\n\treturn newCE(\"LatLonBox\", children)\n}", "title": "" }, { "docid": "d67fe227263219794351557f22db55f4", "score": "0.46586847", "text": "func NewQuaternionVector3ToVector3(from, too Vector3) Quaternion {\n\tcos2theta := from.DotProduct(too)\n\tcross := from.CrossProduct(too)\n\treturn Quaternion{X: cross.X, Y: cross.Y, Z: cross.Z, W: 1 + cos2theta}.Normalize()\n}", "title": "" }, { "docid": "55f76871b05f7f632451f396ad475678", "score": "0.4641357", "text": "func (c *Cluster)GetTileWithLatLon(x,y,z int) []ClusterPoint {\n\treturn c.getTile(x,y,z,true)\n}", "title": "" }, { "docid": "2127db31aac739868d6875a66c8d3c5b", "score": "0.4612398", "text": "func NewVector3(x, y, z DataType) *Vector3 {\n\treturn &Vector3{\n\t\tx: x,\n\t\ty: y,\n\t}\n}", "title": "" }, { "docid": "f82cb21a68e4092714513046fab6bd75", "score": "0.46045274", "text": "func (o LatLngResponseOutput) Latitude() pulumi.Float64Output {\n\treturn o.ApplyT(func(v LatLngResponse) float64 { return v.Latitude }).(pulumi.Float64Output)\n}", "title": "" }, { "docid": "eb8d3b2bbdde25e0e4679ac1c41a85a0", "score": "0.4586297", "text": "func (t *Transform2) toWorldPointInLocal(pointInLocal *Vector3D.Vector3D) *Vector3D.Vector3D {\n\n\t// Convert to the world frame.\n\tx := t.cosAngle*pointInLocal.X - t.sinAngle*pointInLocal.Y + t.translation.X\n\ty := t.sinAngle*pointInLocal.X + t.cosAngle*pointInLocal.Y + t.translation.Y\n\n\treturn Vector3D.NewVector(x, y, 0)\n}", "title": "" }, { "docid": "10375c4600911c22f3f7d5ddc8c89dd2", "score": "0.45786226", "text": "func GetCoordinates(target interface{}, coords interface{}) error {\n\tpoint, pointOk := target.(*geometry.Point)\n\t_, coordOk := coords.(*[]float64)\n\tif pointOk && coordOk {\n\t\terr := copyPointer(&point.Coordinates, coords)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\treturn errors.New(\"not supported geometry type\")\n}", "title": "" }, { "docid": "972dc65e5b350a8aeff1ce56157a25b0", "score": "0.45680314", "text": "func (c configuration) latLong() (float64, float64) {\n\treturn c.location[0], c.location[1]\n}", "title": "" }, { "docid": "4ac1f5cae9afb3143fed9e5148f24b72", "score": "0.45523587", "text": "func GetLatLng(gcr *GeoCodeResponse) (ll LatLng) {\n\tll.Lat = gcr.Results[0].Geometry.Location.Lat.String()\n\tll.Lng = gcr.Results[0].Geometry.Location.Lng.String()\n\treturn\n}", "title": "" }, { "docid": "b6061be166350d3fa067b913a9d38bfd", "score": "0.4546865", "text": "func GP(lat, lon float64) GeoPoint {\n\treturn GeoPoint{Lon: lon, Lat: lat}\n}", "title": "" }, { "docid": "7ccb01bc81f4eca7bcaba36f47eae0dc", "score": "0.45273456", "text": "func TestGetLat(t *testing.T) {\n\tb := City{loc.New(52.507, 13.144),\n\t\t\"Berlin\", 3470000}\n\tt.Logf(\"B.Lat() = %v\\n\", b.Lat())\n\tt.Logf(\"B.Location = %v\\n\", b.Location)\n}", "title": "" }, { "docid": "e762c6c2cdf22c01ef85a7d8f96ea68b", "score": "0.45240727", "text": "func (t *Transform2) toLocal(pointInWorld *Vector3D.Vector3D) *Vector3D.Vector3D {\n\n\t// Convert to the local frame.\n\txmt := pointInWorld.Substract(t.translation)\n\n\tx := t.cosAngle*xmt.X + t.sinAngle*xmt.Y\n\ty := -t.sinAngle*xmt.X + t.cosAngle*xmt.Y\n\treturn Vector3D.NewVector(x, y, 0)\n}", "title": "" }, { "docid": "6c08c5cb04cb9ba49eb1db0fa75b7ab3", "score": "0.44993225", "text": "func Vec3(x int, y int, z int) Vector3 {\n\treturn Vector3{\n\t\tX: x,\n\t\tY: y,\n\t\tZ: z,\n\t}\n}", "title": "" }, { "docid": "7aed9f65508012d9cfbca218aeb9a17e", "score": "0.4485939", "text": "func (v *Vector3D) GetNormalizedVector() *Vector3D {\n\tw := v.Clone()\n\tw.Normalize()\n\treturn w\n}", "title": "" }, { "docid": "083beac431650bb91345cf579c83ef98", "score": "0.4476768", "text": "func WGS84LatLongToOSGB36(gc *cartconvert.PolarCoord) (*OSGB36Coord, error) {\n\t// This sets the Ellipsoid to WGS84, regardless of the actual value set\n\tgc.El = cartconvert.WGS84Ellipsoid\n\n\tcart := cartconvert.PolarToCartesian(gc)\n\tpt := cartconvert.HelmertWGS84ToOSGB36.Transform(&cartconvert.Point3D{X: cart.X, Y: cart.Y, Z: cart.Z})\n\tpolar := cartconvert.CartesianToPolar(&cartconvert.CartPoint{X: pt.X, Y: pt.Y, Z: pt.Z, El: cartconvert.Airy1830Ellipsoid})\n\n\tgp := cartconvert.DirectTransverseMercator(\n\t\tpolar,\n\t\t49,\n\t\t-2,\n\t\t0.9996012717,\n\t\t400000,\n\t\t-100000)\n\n\treturn GridRefNumToLet(uint(gp.X+0.5), uint(gp.Y+0.5), 0, OSGB36_Max)\n}", "title": "" }, { "docid": "99d523bea8cc8b43e198cd46d942e88e", "score": "0.44737476", "text": "func convert(x string, y string) map[string]float32 {\n\trequest, err := http.NewRequest(\"GET\",\n\t\tfmt.Sprintf(\"https://developers.onemap.sg/commonapi/convert/3414to4326?X=%s&Y=%s\", x, y), nil)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(request)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\td := map[string]float32{}\n\terr = json.NewDecoder(resp.Body).Decode(&d)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// fmt.Printf(\"%+v\\n\", pos)\n\treturn d\n}", "title": "" }, { "docid": "8584bcc0b2a6c0a89f25f28ce589e8c7", "score": "0.44426084", "text": "func Latitude(value float64) *SimpleElement {\n\treturn newSEFloat(\"latitude\", value)\n}", "title": "" }, { "docid": "0240f1c7951d9bcd0d15f33508f1f98d", "score": "0.4440155", "text": "func (t Tweet) Latitude() (float64, error) {\n\tif t.HasCoordinates() {\n\t\treturn t.Coordinates.Coordinates[1], nil\n\t}\n\treturn 0, fmt.Errorf(\"No Coordinates in this Tweet\")\n}", "title": "" }, { "docid": "934829308707393dfc499dbfcdfd6000", "score": "0.4436887", "text": "func (t *Tile) BoundsLatLong() (*LongLatBbox, error) {\n\tZ2 := math.Pow(2, float64(t.z))\n\ttlLongDeg := float64(t.x)/Z2*360.0 - 180.0\n\ttlLatRad := math.Atan(math.Sinh(math.Pi * (1 - 2*float64(t.y)/Z2)))\n\ttlLatDeg := tlLatRad * mercantile.R2D\n\n\tbrLongDeg := float64(t.x+1)/Z2*360.0 - 180\n\tbrLatRad := math.Atan(math.Sinh(math.Pi * (1 - 2*float64(t.y+1)/Z2)))\n\tbrLatDeg := brLatRad * mercantile.R2D\n\n\treturn NewLongLatBbox(tlLongDeg, brLatDeg, brLongDeg, tlLatDeg)\n}", "title": "" }, { "docid": "8fd6242346bb4b535baccdd80a7591bf", "score": "0.44351953", "text": "func (o LoadBalancerPoolOutput) Latitude() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v *LoadBalancerPool) pulumi.Float64PtrOutput { return v.Latitude }).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "01798712844f13e988422a364992a300", "score": "0.44023377", "text": "func (m GlobalMercator) TileLatLonBounds(tx, ty int, zoom int) (minLat, minLon, maxLat, maxLon float64) {\n\tminx, miny, maxx, maxy := m.TileBounds(tx, ty, zoom)\n\tminLat, minLon = m.MetersToLatLon(minx, miny)\n\tmaxLat, maxLon = m.MetersToLatLon(maxx, maxy)\n\treturn minLat, minLon, maxLat, maxLon\n}", "title": "" }, { "docid": "af733a34bb2326b30bd1bb0564900b78", "score": "0.43912277", "text": "func (u Vec3) XYZ() (x, y, z float64) {\n\treturn u.X, u.Y, u.Z\n}", "title": "" }, { "docid": "91a04ea8f1d156521260863628f810d7", "score": "0.43886957", "text": "func NewVector3() *Vector3 {\n\tv := new(Vector3)\n\tv.X = 0.0\n\tv.Y = 0.0\n\tv.Z = 0.0\n\treturn v\n}", "title": "" }, { "docid": "b597042904053700febe30f42648292d", "score": "0.43823865", "text": "func convertAddressToLatLng(userAddress string) (latLng LatitudeLongitude, err error) {\n\n\t/* add escape characters to the address to avoid commas or spaces in the user address\n\texample: 1600 Amphitheatre Parkway, Mountain View, CA becomes 1600+Amphitheatre+Parkway,+Mountain+View,+CA\n\t*/\n\tescapeAddress := url.QueryEscape(userAddress)\n\n\t// format the request string according to Google API docs\n\treqURL := fmt.Sprintf(\"https://maps.googleapis.com/maps/api/geocode/json?key=%s&address=%s\",\n\t\tGoogleGeocodingAPIKey,\n\t\tescapeAddress,\n\t)\n\n\t// execute request and handle errors if any\n\tres, err := httpClient.Get(reqURL)\n\tif err != nil {\n\t\treturn latLng, err\n\t}\n\n\t// close the response body after finishing with it (required in Go docs)\n\tdefer res.Body.Close()\n\n\tvar geocodingRes GoogleGeocodeResponse\n\n\terr = json.NewDecoder(res.Body).Decode(&geocodingRes)\n\tif err != nil {\n\t\treturn latLng, err\n\t}\n\n\t// check response status and validate response\n\tif geocodingRes.Status != \"OK\" || len(geocodingRes.Results) < 1 {\n\t\treturn latLng, err\n\t}\n\n\treturn geocodingRes.Results[0].Geometry.Location, err\n}", "title": "" }, { "docid": "6abe22d28e901be6339821816b257d28", "score": "0.43812594", "text": "func TransForm(wglat, wglon float64) (float64, float64) {\n\t//note: 原始点转高德\n\t//transform(latitude,longitude) , WGS84\n\t//return (latitude,longitude) , GCJ02\n\tif OutOfChina(wglat, wglon) {\n\t\treturn wglat, wglon\n\t}\n\n\tdlat := TransFormLat(wglon-105.0, wglat-35.0)\n\tdlon := TransFormLon(wglon-105.0, wglat-35.0)\n\trad_lat := wglat / 18.0 * math.Pi\n\tmagic := math.Sin(rad_lat)\n\tmagic = 1 - ee*magic*magic\n\tsqrt_magic := math.Sqrt(magic)\n\tdlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrt_magic) * math.Pi)\n\tdlon = (dlon * 180.0) / (a / sqrt_magic * math.Cos(rad_lat) * math.Pi)\n\tmglat := wglat + dlat\n\tmglon := wglon + dlon\n\treturn mglat, mglon\n}", "title": "" }, { "docid": "02b20ea12767d22d5ee6f297a00f340a", "score": "0.4380557", "text": "func (o LatLngResponsePtrOutput) Latitude() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v *LatLngResponse) *float64 {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Latitude\n\t}).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "acf85dd1e17930916bdebaf90d17173f", "score": "0.43757993", "text": "func (c Coord3D) XY() Coord2D {\n\treturn Coord2D{X: c.X, Y: c.Y}\n}", "title": "" }, { "docid": "4d519af258028df2ceddbf04fa2fd0e1", "score": "0.43743473", "text": "func (v Vec3f) XY() Vec2f {\n\treturn Vec2f{v[0], v[1]}\n}", "title": "" }, { "docid": "51b0b752d5dfaaa5f0d9db166f3dc2e8", "score": "0.4372368", "text": "func SphericalToCartesian(radius, azimuth, inclination float32) Vec3f {\n\tsinAz, cosAz := math32.Sincos(azimuth)\n\tsinInc, cosInc := math32.Sincos(inclination)\n\n\treturn Vec3f{\n\t\tradius * sinInc * cosAz,\n\t\tradius * sinInc * sinAz,\n\t\tradius * cosInc,\n\t}\n}", "title": "" }, { "docid": "964e9ad5a995cd55f6f04e2cb2d697ad", "score": "0.4370589", "text": "func GetCoordinates(oneSide, cLatY, cLonX float64, n int) ([]float64, error) {\r\n\tif cLatY < -90 || cLatY > 90 {\r\n\t\treturn nil, errors.New(fmt.Sprintf(\"Error: Wrong latitude.\"))\r\n\t}\r\n\tif cLonX < -180 || cLonX > 180 {\r\n\t\treturn nil, errors.New(fmt.Sprintf(\"Error: Wrong longitude.\"))\r\n\t}\r\n\toneSide *= 500\r\n\tp1LatY := func(bq, cLatY1, cLonX1 float64, n int) float64 {\r\n\t\tcLatY2 := 0.0\r\n\t\tnStep := 0.01\r\n\t\tinitY := cLatY1\r\n\t\tfor rn := 1; rn <= n; rn++ {\r\n\t\t\tfor cLatY2 = initY; bq-hBase(cLatY1, cLonX1, cLatY2, cLonX1) > 0; cLatY2 += nStep {\r\n\t\t\t}\r\n\t\t\tinitY = cLatY2 - nStep\r\n\t\t\tnStep *= 0.1\r\n\t\t}\r\n\t\treturn cLatY2\r\n\t}(oneSide, cLatY, cLonX, n)\r\n\tp1LonX := func(bq, cLatY1, cLonX1 float64, n int) float64 {\r\n\t\tcLonX2 := 0.0\r\n\t\tnStep := 0.01\r\n\t\tinitX := cLonX1\r\n\t\tfor rn := 1; rn <= n; rn++ {\r\n\t\t\tfor cLonX2 = initX; bq-hBase(cLatY1, cLonX1, cLatY1, cLonX2) > 0; cLonX2 += nStep {\r\n\t\t\t}\r\n\t\t\tinitX = cLonX2 - nStep\r\n\t\t\tnStep *= 0.1\r\n\t\t}\r\n\t\treturn cLonX2\r\n\t}(oneSide, cLatY, cLonX, n)\r\n\treturn []float64{p1LatY, p1LonX, cLatY - (p1LatY - cLatY), cLonX - (p1LonX - cLonX)}, nil\r\n}", "title": "" }, { "docid": "aa74861d0612ca6231d22a18a84280e0", "score": "0.43677", "text": "func NewRoadPositionFromS2LatLng(stateID int, graphVertex int64, e *Edge, latLng *s2.LatLng, srid ...int) *RoadPosition {\n\tstate := RoadPosition{\n\t\tRoadPositionID: stateID,\n\t\tGraphEdge: e,\n\t\tGraphVertex: graphVertex,\n\t}\n\tif len(srid) != 0 {\n\t\tswitch srid[0] {\n\t\tcase 0:\n\t\t\tstate.Projected = NewEuclideanPoint(latLng.Lng.Degrees(), latLng.Lat.Degrees())\n\t\tcase 4326:\n\t\t\tstate.Projected = NewWGS84Point(latLng.Lng.Degrees(), latLng.Lat.Degrees())\n\t\tdefault:\n\t\t\tstate.Projected = NewWGS84Point(latLng.Lng.Degrees(), latLng.Lat.Degrees())\n\t\t}\n\t}\n\treturn &state\n}", "title": "" }, { "docid": "4c7f8b56c3eb67e81f9925623ae429ef", "score": "0.435088", "text": "func NewCoord3DRandNorm() Coord3D {\n\treturn Coord3D{\n\t\tX: rand.NormFloat64(),\n\t\tY: rand.NormFloat64(),\n\t\tZ: rand.NormFloat64(),\n\t}\n}", "title": "" }, { "docid": "8e42750ce0bdbac13e394b2332c3d1aa", "score": "0.43487403", "text": "func (p *Point) MidpointTo(p2 *Point) *Point {\n\tlat1 := p.Lat * math.Pi / 180.0\n\tlat2 := p2.Lat * math.Pi / 180.0\n\n\tlon1 := p.Lng * math.Pi / 180.0\n\tdLon := (p2.Lng - p.Lng) * math.Pi / 180.0\n\n\tbx := math.Cos(lat2) * math.Cos(dLon)\n\tby := math.Cos(lat2) * math.Sin(dLon)\n\n\tlat3Rad := math.Atan2(\n\t\tmath.Sin(lat1)+math.Sin(lat2),\n\t\tmath.Sqrt(math.Pow(math.Cos(lat1)+bx, 2)+math.Pow(by, 2)),\n\t)\n\tlon3Rad := lon1 + math.Atan2(by, math.Cos(lat1)+bx)\n\n\treturn &Point{\n\t\tLat: lat3Rad * 180.0 / math.Pi,\n\t\tLng: lon3Rad * 180.0 / math.Pi,\n\t}\n}", "title": "" }, { "docid": "8a58e53315cfe4e335625e9a7acffecc", "score": "0.43473753", "text": "func (g *grid) point2gcoord(row, col float32) (int, int) {\n\treturn g.val2grid(row), g.val2grid(col)\n}", "title": "" }, { "docid": "f2dbac8209826c24417147e57bf276ce", "score": "0.43405244", "text": "func (o *DetailedSegment) GetStartLatlng() []float32 {\n\tif o == nil || o.StartLatlng == nil {\n\t\tvar ret []float32\n\t\treturn ret\n\t}\n\treturn o.StartLatlng\n}", "title": "" }, { "docid": "33adc17064c9d62df9a2915433a99707", "score": "0.43333152", "text": "func XYZ(x, y, z float64) Coord3D {\n\treturn Coord3D{X: x, Y: y, Z: z}\n}", "title": "" }, { "docid": "db53c4509b53c6e5bd2c9d77ee96dde3", "score": "0.43191078", "text": "func (a Vec3) FloatXY() [2]float32 { return [2]float32{a.X, a.Y} }", "title": "" }, { "docid": "9a6cb451031997db7a45ba05074e6918", "score": "0.4299717", "text": "func CartesianToSpherical(pos Vec3f) (float32, float32, float32) {\n\tradius := pos.Length()\n\tazimuth := math32.Atan2(pos[1], pos[0])\n\tinclination := math32.Acos(pos[2] / radius)\n\treturn radius, azimuth, inclination\n}", "title": "" }, { "docid": "75d46b2313f3ffe6af6ce6a784cec768", "score": "0.4291765", "text": "func (c Cell) latitude(i, j int) float64 {\n\tvar u, v float64\n\tswitch {\n\tcase i == 0 && j == 0:\n\t\tu = c.uv.X.Lo\n\t\tv = c.uv.Y.Lo\n\tcase i == 0 && j == 1:\n\t\tu = c.uv.X.Lo\n\t\tv = c.uv.Y.Hi\n\tcase i == 1 && j == 0:\n\t\tu = c.uv.X.Hi\n\t\tv = c.uv.Y.Lo\n\tcase i == 1 && j == 1:\n\t\tu = c.uv.X.Hi\n\t\tv = c.uv.Y.Hi\n\tdefault:\n\t\tpanic(\"i and/or j is out of bound\")\n\t}\n\treturn latitude(Point{faceUVToXYZ(int(c.face), u, v)}).Radians()\n}", "title": "" }, { "docid": "b0101bc19baedabd637608252926b6be", "score": "0.42789677", "text": "func latlongHandler(request *GEOConvertRequest, latlongstrval, oformat string) (interface{}, error) {\n\n\tif len(latlongstrval) > 0 {\n\t\treturn nil, fmt.Errorf(\"Latlong doesn't accept an input value. Use the parameters 'lat' and 'long' instead\")\n\t}\n\n\tslat := getfirstValueFromURLParameters(request.Parameters, \"lat\")\n\tslong := getfirstValueFromURLParameters(request.Parameters, \"long\")\n\n\tvar lat, long float64\n\tvar err error\n\n\tlat, err = cartconvert.ADegMMSSToNum(slat)\n\tif err != nil {\n\t\tlat, err = cartconvert.ADegCommaToNum(slat)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Not a bearing: '%s'\", slat)\n\t\t}\n\t}\n\n\tlong, err = cartconvert.ADegMMSSToNum(slong)\n\tif err != nil {\n\t\tlong, err = cartconvert.ADegCommaToNum(slong)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Not a bearing: '%s'\", slong)\n\t\t}\n\t}\n\n\tlatlong := &cartconvert.PolarCoord{Latitude: lat, Longitude: long, El: cartconvert.DefaultEllipsoid}\n\treturn serialize(latlong, oformat)\n}", "title": "" }, { "docid": "9f4db621505ae67bd29f374878a8c64c", "score": "0.42761588", "text": "func OrbitToVector(orbit *Orbit) (mat.Vector, mat.Vector) {\n\n\tr, v := OrbitToVecPerifocal(orbit)\n\n\trot := QuickerRotationMatrixForOrbit(\n\t\torbit.LongitudeOfTheAscendingNode,\n\t\torbit.InclinationToTheEcliptic,\n\t\torbit.ArgumentOfPerihelion,\n\t)\n\n\tr.MulVec(rot, r)\n\tv.MulVec(rot, v)\n\n\treturn r, v\n}", "title": "" }, { "docid": "7c1f382728eb5f099e3883d22d94e453", "score": "0.4256927", "text": "func (o *LocalDTO) GetLatitude() string {\n\tif o == nil || o.Latitude.Get() == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Latitude.Get()\n}", "title": "" }, { "docid": "68253c2acaaa69f218a3185baae158a5", "score": "0.42526174", "text": "func (v Vec3i) XY() Vec2i {\n\treturn Vec2i{v[0], v[1]}\n}", "title": "" }, { "docid": "2e3b3c45a4cf5e9584d432c362ecc75f", "score": "0.42493153", "text": "func MapVec3(x map[string]interface{}, k string) mgl64.Vec3 {\n\tif val, ok := x[k]; ok {\n\t\tif i, ok := val.([]interface{}); ok {\n\t\t\tif len(i) != 3 {\n\t\t\t\treturn mgl64.Vec3{}\n\t\t\t}\n\t\t\tvar v mgl64.Vec3\n\t\t\tfor index, f := range i {\n\t\t\t\tf32, _ := f.(float32)\n\t\t\t\tv[index] = float64(f32)\n\t\t\t}\n\t\t\treturn v\n\t\t}\n\t\tif i, ok := val.([]float32); ok {\n\t\t\tif len(i) != 3 {\n\t\t\t\treturn mgl64.Vec3{}\n\t\t\t}\n\t\t\treturn mgl64.Vec3{float64(i[0]), float64(i[1]), float64(i[2])}\n\t\t}\n\t}\n\treturn mgl64.Vec3{}\n}", "title": "" }, { "docid": "760d04f0953212380cf5d70f155b3b41", "score": "0.42464665", "text": "func (s *Sphere) GetPosition() vmath.Vector3d {\n\treturn s.P\n}", "title": "" }, { "docid": "b037577a355c03929656e68d2703c4a7", "score": "0.4239427", "text": "func XY(x, y float64) Coord3D {\n\treturn Coord3D{X: x, Y: y}\n}", "title": "" }, { "docid": "a07f8f8fcee0c54ee0f481ab6ab4b67c", "score": "0.42193568", "text": "func Longitude() float32 {\r\n\treturn r.Float32()*360 - 180\r\n}", "title": "" }, { "docid": "edf99c8c3f7447f2e83be372ffcaabf8", "score": "0.42189938", "text": "func Ones(a float64) Coord3D {\n\treturn Coord3D{X: a, Y: a, Z: a}\n}", "title": "" }, { "docid": "48ca8868d4854efc9107dea0f239ae78", "score": "0.42187452", "text": "func (t *Tile) Ul() (*LongLat, error) {\n\tZ2 := math.Pow(2, float64(t.z))\n\tlongDeg := float64(t.x)/Z2*360.0 - 180.0\n\tlatRadian := math.Atan(math.Sinh(math.Pi * (1 - 2*float64(t.y)/Z2)))\n\tlatDeg := latRadian * mercantile.R2D\n\n\treturn NewLongLat(longDeg, latDeg)\n}", "title": "" }, { "docid": "7070463e85bd8aa67df663d37162cd50", "score": "0.4206507", "text": "func NewVec3(x, y, z float64) *Vec3 {\n\tv := new(Vec3)\n\tv.X = x\n\tv.Y = y\n\tv.Z = z\n\tv.Magnitude, v.magnitudeInverse = v.CalculateMagnitude()\n\n\treturn v\n}", "title": "" }, { "docid": "c78ad300c8ccb5723809a8cdadf2e306", "score": "0.4204887", "text": "func X(x float64) Coord3D {\n\treturn Coord3D{X: x}\n}", "title": "" }, { "docid": "e92e0eb918ee974839b72912637fc9c3", "score": "0.42028213", "text": "func LatLonAltBox(children ...Element) *CompoundElement {\n\treturn newCE(\"LatLonAltBox\", children)\n}", "title": "" }, { "docid": "1c4ec83fc3b23ccb6aee139a50c5a232", "score": "0.4201854", "text": "func (v *eGLView) ConvertToLocationInView(tx int, ty int, relatedPos *js.Object) Point {\n\treturn &point{v.Call(\"convertToLocationInView\", tx, ty, relatedPos)}\n}", "title": "" }, { "docid": "19f18e7f24006cd896c723d9544969e7", "score": "0.4193045", "text": "func (point Point) WKT() string {\n\tvar result string\n\tswitch len(point.Coordinates) {\n\tcase 2:\n\t\tresult = fmt.Sprintf(\"POINT (%v)\", array1ToWKTCoordinates(point.Coordinates))\n\tcase 3:\n\t\tresult = fmt.Sprintf(\"POINT Z (%v)\", array1ToWKTCoordinates(point.Coordinates))\n\tcase 4:\n\t\tresult = fmt.Sprintf(\"POINT ZM (%v)\", array1ToWKTCoordinates(point.Coordinates))\n\tdefault:\n\t\tresult = \"POINT EMPTY\"\n\t}\n\treturn result\n}", "title": "" }, { "docid": "a20004d9e6cce8e717cf1c8448560815", "score": "0.41880065", "text": "func NewBoundingBoxVector3(minimum, maximum *Vector3) *BoundingBox {\r\n\treturn (&BoundingBox{&Vector3{}, &Vector3{}, &Vector3{}, &Vector3{}}).Set(minimum, maximum)\r\n}", "title": "" }, { "docid": "83a2bee972ddeafc7bc3295edd908399", "score": "0.4184187", "text": "func NewVector3Forward() Vector3 { return Vector3{X: 0, Y: 0, Z: 1} }", "title": "" }, { "docid": "b0b4b9d6513bee74367a93a528865a2f", "score": "0.41821596", "text": "func NewPoint(x, y, z float64) Vector {\n\treturn Vector{X: x, Y: y, Z: z, W: 1}\n}", "title": "" }, { "docid": "69891176a5a72cd31afb54ccce9881ed", "score": "0.41797537", "text": "func (v Vec3i) Vec3f() Vec3f {\n\treturn Vec3f{float32(v[0]), float32(v[1]), float32(v[2])}\n}", "title": "" }, { "docid": "4b0968b9a4183db976923ca5ed4199d9", "score": "0.4177181", "text": "func (a ArrayF32) GetVec3(pos int, v *Vec3) {\n\tv.X = a[pos]\n\tv.Y = a[pos+1]\n\tv.Z = a[pos+2]\n}", "title": "" }, { "docid": "50e8b70467e3197f61c55004a08150ce", "score": "0.4174875", "text": "func (w *Writer) Vec3(x *mgl32.Vec3) {\n\tw.Float32(&x[0])\n\tw.Float32(&x[1])\n\tw.Float32(&x[2])\n}", "title": "" }, { "docid": "cbc2e89cad6def2fe2768b59a60d7d85", "score": "0.41740125", "text": "func OrbitToVecPerifocal(orbit *Orbit) (*mat.VecDense, *mat.VecDense) {\n\n\ta := orbit.SemimajorAxis * (1 - math.Pow(orbit.OrbitalEccentricity, 2))\n\tcosNu := math.Cos(orbit.MeanAnomalyEpoch)\n\tsinNu := math.Sin(orbit.MeanAnomalyEpoch)\n\n\tr := mat.NewVecDense(3, []float64{cosNu, sinNu, 0 * orbit.MeanAnomalyEpoch})\n\n\trMult := a / (1 + orbit.OrbitalEccentricity*cosNu)\n\tr.ScaleVec(rMult, r)\n\n\tv := mat.NewVecDense(3, []float64{-sinNu, orbit.OrbitalEccentricity + cosNu, 0})\n\n\tvMult := math.Sqrt(orbit.ParentGrav / a)\n\tv.ScaleVec(vMult, v)\n\n\treturn r, v\n}", "title": "" }, { "docid": "9be690e5a53af999aaca5fe4755a7454", "score": "0.4172244", "text": "func NewGeoPointFromTileNumbers(zoom, x, y int) GeoPoint {\n\tn := math.Pow(2, float64(zoom))\n\tlatRad := math.Atan(math.Sinh(Pi * (1 - (2 * float64(y) / n))))\n\n\treturn GP(latRad*180/Pi, (float64(x)/n*360)-180)\n}", "title": "" }, { "docid": "68325b2705ead33bb0ada0035555af4b", "score": "0.41675", "text": "func (a Vec3) FloatXYZ() [3]float32 { return [3]float32{a.X, a.Y, a.Z} }", "title": "" }, { "docid": "2086df909bbde0bc1137086a9e646366", "score": "0.41669992", "text": "func (mp *multiPolygon) ToGeometry() IGeometry {\n\treturn NewGeometry(MultiPolygonType, mp.Coordinates, mp.SrId)\n}", "title": "" }, { "docid": "cd70eae81c6df60df7b9c2204f3be5a6", "score": "0.41615653", "text": "func (o LocationResponseOutput) LatLng() LatLngResponseOutput {\n\treturn o.ApplyT(func(v LocationResponse) LatLngResponse { return v.LatLng }).(LatLngResponseOutput)\n}", "title": "" }, { "docid": "47f052bc21d191f23e307afb0448926e", "score": "0.41551507", "text": "func (g *Gps) Lon() float64 {\n\treturn float64(g.Longitude)\n}", "title": "" }, { "docid": "d499ead0db279f1d99c8af83c504cc9f", "score": "0.4152108", "text": "func (v *Vector3) Floor() *Vector3 {\n\treturn godotVec3AsVec3(C.godot_vector3_floor(v.vector3))\n}", "title": "" }, { "docid": "bb7d8d570b2ca638c2d2e3347081840c", "score": "0.41496724", "text": "func (s Source) GetVec3(idx int) glm.Vec3 {\n\tstride := 3\n\tfloats := s.Floats.Data[stride*idx : stride*idx+stride]\n\treturn glm.Vec3{floats[0], floats[1], floats[2]}\n}", "title": "" }, { "docid": "a23bfabe5210902f69086542b2aa48fc", "score": "0.41463718", "text": "func (id64 ID64) To3() ID3 {\n\treturn id64.ToID().To3()\n}", "title": "" }, { "docid": "ee1506870a38515e18293021d45dcaa8", "score": "0.41428578", "text": "func (gdb *DB) DistanceLatLon(lat1, lon1, lat2, lon2 float64) (distance float64) {\n\tpoint1 := haversine.Coord{Lat: lat1, Lon: lon1}\n\tpoint2 := haversine.Coord{Lat: lat2, Lon: lon2}\n\t_, distance = haversine.Distance(point1, point2)\n\n\treturn distance\n}", "title": "" }, { "docid": "b470799350879d49a52fb951a7c2ebf2", "score": "0.41390407", "text": "func (t Float32) ToTimestamp() Timestamp {\n\treturn Timestamp(t)\n}", "title": "" }, { "docid": "ba2275e035e35c8a1d042431a95f1a48", "score": "0.41335243", "text": "func (mls MultiLineString) WKT() string {\n\tvar result string\n\tswitch len(mls.Coordinates) {\n\tcase 0:\n\t\tresult = \"MULTILINESTRING EMPTY\"\n\tdefault:\n\t\tresult = fmt.Sprintf(\"MULTILINESTRING (%v)\", array3ToWKTCoordinates(mls.Coordinates))\n\t}\n\treturn result\n}", "title": "" }, { "docid": "e697a001adcd65d6572baf73b96933d7", "score": "0.4133102", "text": "func (mp MultiPoint) WKT() string {\n\tvar result string\n\tswitch len(mp.Coordinates) {\n\tcase 0:\n\t\tresult = \"MULTIPOINT EMPTY\"\n\tdefault:\n\t\tresult = fmt.Sprintf(\"MULTIPOINT (%v)\", array2ToWKTCoordinates(mp.Coordinates))\n\t}\n\treturn result\n}", "title": "" }, { "docid": "2c3ead2595fc9f7d420996fc9c93cd7d", "score": "0.41287583", "text": "func NewLunGetGeometryRequest() *LunGetGeometryRequest { return &LunGetGeometryRequest{} }", "title": "" }, { "docid": "245448bf30836f16e1fcc2d2f5929495", "score": "0.41279677", "text": "func NewLatnode() *Latnode {\n\treturn (*Latnode)(allocLatnodeMemory(1))\n}", "title": "" } ]
13d0d3a29e5870aacd112ad56d26f11b
retrieve the env variables first
[ { "docid": "fa2f15347af018815a266d7c4c844d94", "score": "0.0", "text": "func init() {\r\n\tgodotenv.Load()\r\n}", "title": "" } ]
[ { "docid": "185b339230d951aa1449b5263679fece", "score": "0.75239503", "text": "func readEnvVariables() {\n\tfor k := range vkSchemaFiles {\n\t\tif tmp := os.Getenv(k); tmp != \"\" {\n\t\t\tvkSchemaFiles[k] = tmp\n\t\t}\n\t}\n\n\tif tmp := os.Getenv(\"VK_API_SCHEMA_OUTPUT\"); tmp != \"\" {\n\t\toutputDirName = tmp\n\t}\n}", "title": "" }, { "docid": "fb107c7be8a86089b60652fbde7b63dc", "score": "0.7349296", "text": "func (vip *Viper) getEnv() {\n\tfor _, variable := range envVariables {\n\t\tvalue := os.Getenv(variable)\n\t\tif value != \"\" {\n\t\t\tviper.Set(variable, value)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "46da3eb399377449f1e8425007ba68da", "score": "0.73076755", "text": "func readFromEnv(keys ...string) string {\n\tfor _, key := range keys {\n\t\tif value, ok := os.LookupEnv(key); ok {\n\t\t\treturn value\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "46da3eb399377449f1e8425007ba68da", "score": "0.73076755", "text": "func readFromEnv(keys ...string) string {\n\tfor _, key := range keys {\n\t\tif value, ok := os.LookupEnv(key); ok {\n\t\t\treturn value\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "ac0309a45c1ace5e8938d8bc1c41c00d", "score": "0.7257844", "text": "func (system *localSystem) getEnviromentVariables() []string {\n\treturn append(os.Environ(), system.envs...)\n}", "title": "" }, { "docid": "9bd30c0b3c70ad747cdc37edb1119acd", "score": "0.72455204", "text": "func GetENV(kafkaDetails *kafkaTypes.ExperimentDetails) {\n\n\tvar ChaoslibDetail exp.ExperimentDetails\n\n\tChaoslibDetail.ExperimentName = Getenv(\"EXPERIMENT_NAME\", \"kafka-broker-pod-failure\")\n\tChaoslibDetail.ChaosNamespace = Getenv(\"CHAOS_NAMESPACE\", \"litmus\")\n\tChaoslibDetail.EngineName = Getenv(\"CHAOSENGINE\", \"\")\n\tChaoslibDetail.ChaosDuration, _ = strconv.Atoi(Getenv(\"TOTAL_CHAOS_DURATION\", \"60\"))\n\tChaoslibDetail.ChaosInterval, _ = strconv.Atoi(Getenv(\"CHAOS_INTERVAL\", \"10\"))\n\tChaoslibDetail.RampTime, _ = strconv.Atoi(Getenv(\"RAMP_TIME\", \"0\"))\n\tChaoslibDetail.ChaosLib = Getenv(\"LIB\", \"litmus\")\n\tChaoslibDetail.ChaosServiceAccount = Getenv(\"CHAOS_SERVICE_ACCOUNT\", \"\")\n\tChaoslibDetail.AppNS = Getenv(\"APP_NAMESPACE\", \"\")\n\tChaoslibDetail.AppLabel = Getenv(\"APP_LABEL\", \"\")\n\tChaoslibDetail.AppKind = Getenv(\"APP_KIND\", \"\")\n\tChaoslibDetail.ChaosUID = clientTypes.UID(Getenv(\"CHAOS_UID\", \"\"))\n\tChaoslibDetail.InstanceID = Getenv(\"INSTANCE_ID\", \"\")\n\tChaoslibDetail.ChaosPodName = Getenv(\"POD_NAME\", \"\")\n\tChaoslibDetail.Force, _ = strconv.ParseBool(Getenv(\"FORCE\", \"true\"))\n\tChaoslibDetail.Delay, _ = strconv.Atoi(Getenv(\"STATUS_CHECK_DELAY\", \"2\"))\n\tChaoslibDetail.Timeout, _ = strconv.Atoi(Getenv(\"STATUS_CHECK_TIMEOUT\", \"180\"))\n\n\tkafkaDetails.ChaoslibDetail = &ChaoslibDetail\n\tkafkaDetails.KafkaKind = Getenv(\"KAFKA_KIND\", \"statefulset\")\n\tkafkaDetails.KafkaLivenessStream = Getenv(\"KAFKA_LIVENESS_STREAM\", \"enabled\")\n\tkafkaDetails.KafkaLivenessImage = Getenv(\"KAFKA_LIVENESS_IMAGE\", \"litmuschaos/kafka-client:ci\")\n\tkafkaDetails.KafkaConsumerTimeout, _ = strconv.Atoi(Getenv(\"KAFKA_CONSUMER_TIMEOUT\", \"60000\"))\n\tkafkaDetails.KafkaInstanceName = Getenv(\"KAFKA_INSTANCE_NAME\", \"kafka\")\n\tkafkaDetails.KafkaNamespace = Getenv(\"KAFKA_NAMESPACE\", \"default\")\n\tkafkaDetails.KafkaLabel = Getenv(\"KAFKA_LABEL\", \"\")\n\tkafkaDetails.KafkaBroker = Getenv(\"KAFKA_BROKER\", \"\")\n\tkafkaDetails.KafkaRepliationFactor = Getenv(\"KAFKA_REPLICATION_FACTOR\", \"\")\n\tkafkaDetails.KafkaService = Getenv(\"KAFKA_SERVICE\", \"\")\n\tkafkaDetails.KafkaPort = Getenv(\"KAFKA_PORT\", \"9092\")\n\tkafkaDetails.ZookeeperNamespace = Getenv(\"ZOOKEEPER_NAMESPACE\", \"\")\n\tkafkaDetails.ZookeeperLabel = Getenv(\"ZOOKEEPER_LABEL\", \"\")\n\tkafkaDetails.ZookeeperService = Getenv(\"ZOOKEEPER_SERVICE\", \"\")\n\tkafkaDetails.ZookeeperPort = Getenv(\"ZOOKEEPER_PORT\", \"\")\n\tkafkaDetails.Lib = Getenv(\"LIB\", \"litmus\")\n\tkafkaDetails.RunID = Getenv(\"RunID\", \"\")\n\n}", "title": "" }, { "docid": "4cca522789930a1ac78476e3520c3698", "score": "0.7227144", "text": "func getEnv() []string {\n\tvar result = make([]string, 0)\n\tenv := os.Environ()\n\tfor _, envVar := range env {\n\t\t// filters out any variable that is not prefixed\n\t\tif strings.HasPrefix(envVar, \"PROBARE_\") {\n\t\t\tresult = append(result, envVar)\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "4187d2dc56a9af7262a3fcf08c4a78f8", "score": "0.7216618", "text": "func getEnvironmentVariables(role string, enabledPassword *bool, secretName *string, secretKey *string, persistenceEnabled *bool, extraEnv *[]corev1.EnvVar) []corev1.EnvVar {\n\tenvVars := []corev1.EnvVar{\n\t\t{Name: \"SERVER_MODE\", Value: role},\n\t\t{Name: \"SETUP_MODE\", Value: role},\n\t\t{Name: \"REDIS_ADDR\", Value: \"redis://localhost:6379\"},\n\t}\n\tif enabledPassword != nil && *enabledPassword {\n\t\tenvVars = append(envVars, corev1.EnvVar{\n\t\t\tName: \"REDIS_PASSWORD\",\n\t\t\tValueFrom: &corev1.EnvVarSource{\n\t\t\t\tSecretKeyRef: &corev1.SecretKeySelector{\n\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\t\tName: *secretName,\n\t\t\t\t\t},\n\t\t\t\t\tKey: *secretKey,\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t}\n\tif persistenceEnabled != nil && *persistenceEnabled {\n\t\tenvVars = append(envVars, corev1.EnvVar{Name: \"PERSISTENCE_ENABLED\", Value: \"true\"})\n\t}\n\n\tif extraEnv != nil {\n\t\tenvVars = append(envVars, *extraEnv...)\n\t}\n\tsort.SliceStable(envVars, func(i, j int) bool {\n\t\treturn envVars[i].Name < envVars[j].Name\n\t})\n\treturn envVars\n}", "title": "" }, { "docid": "c2f64133e5dd8dce1fa7dd3cb8850c2f", "score": "0.7161315", "text": "func getEnvArgs() (envArgs, error) {\n\tenv := envArgs{\n\t\ttoken: os.Getenv(\"PACKAGECLOUD_TOKEN\"),\n\t\thost: os.Getenv(\"PACKAGE_CLOUD_URL\"),\n\t}\n\n\tif env.token == \"\" || env.host == \"\" {\n\t\treturn envArgs{}, fmt.Errorf(\"missing 'PACKAGE_CLOUD_URL' and/or 'PACKAGECLOUD_TOKEN'\")\n\t}\n\n\treturn env, nil\n}", "title": "" }, { "docid": "26404d6b03b5452744151f1ccb4f2c50", "score": "0.7139925", "text": "func GetEnviromentVariables() {\n\n\t//get mysqlDBHost from enviroment variables\n\tvar mysqlDBHost = os.Getenv(MysqlDBHostEnvVar)\n\tif len(mysqlDBHost) > 0 && (MysqlDBHost == nil || len(*MysqlDBHost) == 0) {\n\t\tMysqlDBHost = &mysqlDBHost\n\t}\n\n\t//get mysqlDBUser from enviroments variables\n\tvar mysqlDBUser = os.Getenv(MysqlDBUserEnvVar)\n\tif len(mysqlDBUser) > 0 && (MysqlDBUser == nil || len(*MysqlDBUser) == 0) {\n\t\tMysqlDBUser = &mysqlDBUser\n\t}\n\n\t//get mysqlDBPass from enviroments variables\n\tvar mysqlDBPass = os.Getenv(MysqlDBPassEnvVar)\n\tif len(mysqlDBPass) > 0 && (MysqlDBPass == nil || len(*MysqlDBPass) == 0) {\n\t\tMysqlDBPass = &mysqlDBPass\n\t}\n\n\t//get mysqlDBAddr from enviroments variables\n\tvar mysqlDBAddr = os.Getenv(MysqlDBAddrEnvVar)\n\tif len(mysqlDBAddr) > 0 && (MysqlDBAddr == nil || len(*MysqlDBAddr) == 0) {\n\t\tMysqlDBAddr = &mysqlDBAddr\n\t}\n\n\t//get httpAddr from enviroments variables\n\tvar httpAddr = os.Getenv(HTTPPortEnvVar)\n\tif len(httpAddr) > 0 && (HTTPAddr == nil || len(*HTTPAddr) == 0) {\n\t\tHTTPAddr = &httpAddr\n\t}\n\n\t//get mysqlDBAddr from enviroments variables\n\tvar mysqlDBName = os.Getenv(MysqlDBNameEnvVar)\n\tif len(mysqlDBName) > 0 && (MysqlDBName == nil || len(*MysqlDBName) == 0) {\n\t\tMysqlDBName = &mysqlDBName\n\t}\n\n}", "title": "" }, { "docid": "f6d69e7c1184636baba4d1859c153528", "score": "0.7133779", "text": "func readenv(name string) string {\n\tvalue, has := os.LookupEnv(name)\n\tif !has {\n\t\tpanic(fmt.Sprintf(\"Environment variable %s not set\", name))\n\t}\n\n\treturn value\n}", "title": "" }, { "docid": "789cf809dd1f16cdad9b162ce54da792", "score": "0.7114942", "text": "func getEnvironmentVariables() map[string]string {\n\tvar (\n\t\tenv = os.Environ()\n\t\tm = make(map[string]string, len(env))\n\t)\n\n\tfor _, e := range env {\n\t\tkeyVal := strings.SplitN(e, \"=\", 2)\n\t\tkey, val := keyVal[0], keyVal[1]\n\t\tm[key] = val\n\t}\n\treturn m\n}", "title": "" }, { "docid": "b56139daac799f55cbd6d03425427b55", "score": "0.71148556", "text": "func getEnvironmentVariables(e env.Environment) ([]models.Variable, error) {\n\tvariables := []models.Variable{}\n\tfor k := range e.Export() {\n\t\tif !strings.HasPrefix(k, \"CASTER_VAR_\") {\n\t\t\tcontinue\n\t\t}\n\t\tvariables = append(variables, models.Variable{Env: k})\n\t}\n\treturn variables, nil\n}", "title": "" }, { "docid": "a133d1a34e3396d0e8d21b74946f719e", "score": "0.7056603", "text": "func getEnv(ctx context.Context, key, defaultValue string) string {\n\tlog := logr.FromContext(ctx)\n\n\tif value, exists := os.LookupEnv(key); exists {\n\t\tlog.Info(value)\n\n\t\treturn value\n\t}\n\treturn defaultValue\n}", "title": "" }, { "docid": "cac3b541f49d5f5011d7f2df7042447c", "score": "0.70379823", "text": "func GetEnvs() (*Envars, error) {\n\t// default env from yaml\n\tlog.Printf(\"TARGET_SERVER=%s\\n\", os.Getenv(\"TARGET_SERVER\"))\n\tlog.Printf(\"ACCESS_TOKEN=%s\\n\", os.Getenv(\"ACCESS_TOKEN\"))\n\tlog.Printf(\"SOURCE_OWNER=%s\\n\", os.Getenv(\"SOURCE_OWNER\"))\n\tlog.Printf(\"SOURCE_REPO=%s\\n\", os.Getenv(\"SOURCE_REPO\"))\n\tlog.Printf(\"SOURCE_BRANCH=%s\\n\", os.Getenv(\"SOURCE_BRANCH\"))\n\tlog.Printf(\"CHECK_FREQUENCY=%s\\n\", os.Getenv(\"CHECK_FREQUENCY\"))\n\tlog.Printf(\"UNUSED_DAYS=%s\\n\", os.Getenv(\"UNUSED_DAYS\"))\n\n\tenvars := Envars{}\n\t// if not getting any values from environment, fall back\n\t// to default constant values\n\tenvars.targetServer = os.Getenv(\"TARGET_SERVER\")\n\tif envars.targetServer == \"\" {\n\t\tenvars.targetServer = TargetServer\n\t}\n\tenvars.accessToken = os.Getenv(\"ACCESS_TOKEN\")\n\tif envars.accessToken == \"\" {\n\t\tenvars.accessToken = AccessToken\n\t}\n\tenvars.sourceOwner = os.Getenv(\"SOURCE_OWNER\")\n\tif envars.sourceOwner == \"\" {\n\t\tenvars.sourceOwner = SourceOwner\n\t}\n\tenvars.sourceRepo = os.Getenv(\"SOURCE_REPO\")\n\tif envars.sourceRepo == \"\" {\n\t\tenvars.sourceRepo = SourceRepo\n\t}\n\tenvars.sourceBranch = os.Getenv(\"SOURCE_BRANCH\")\n\tif envars.sourceBranch == \"\" {\n\t\tenvars.sourceBranch = SourceBranch\n\t}\n\tif os.Getenv(\"CHECK_FREQUENCY\") == \"\" {\n\t\tenvars.checkFrequency = CheckFrequency\n\t} else {\n\t\ti, err := strconv.ParseInt(os.Getenv(\"CHECK_FREQUENCY\"), 10, 64)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tenvars.checkFrequency = int64(i)\n\t}\n\tif os.Getenv(\"UNUSED_DAYS\") == \"\" {\n\t\tenvars.unusedDays = UnusedDays\n\t} else {\n\t\ti, err := strconv.ParseInt(os.Getenv(\"UNUSED_DAYS\"), 10, 64)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tenvars.unusedDays = int64(i)\n\t}\n\n\treturn &envars, nil\n}", "title": "" }, { "docid": "86468bc0526aa17d2284303f9c02cdac", "score": "0.7035065", "text": "func readEnvVars(vars map[string]string, prefixes []string) {\n\tenvs := os.Environ()\n\tfor _, e := range envs {\n\t\tevaluateEnvVar(vars, prefixes, e)\n\t}\n}", "title": "" }, { "docid": "0b19ec934438e39ea737a6aeea103676", "score": "0.7020723", "text": "func env(cmd *cobra.Command, args []string) error {\n\tenvVars, err := exportEnv(cmd, args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor i := range envVars {\n\t\tfmt.Println(envVars[i])\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "460c1fc37f03a00ec12019356a0294c0", "score": "0.6998652", "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": "d4afadcafc110663c3c2fe3191b9a28d", "score": "0.699584", "text": "func Getenv() map[string]string {\n\treturn map[string]string{\n\t\t\"namespace\": os.Getenv(\"NAMESPACE\"),\n\t\t\"resourceName\": os.Getenv(\"APPLICATION_NAME\"),\n\t}\n}", "title": "" }, { "docid": "615e356f404dc0230cf43daa0e44b1c5", "score": "0.6977908", "text": "func LoadEnvVariables() {\n\n\tTelegramBotToken = os.Getenv(tgBotTokenName)\n\tif TelegramBotToken == \"\" {\n\t\tlog.Fatalf(\"Missing Telegram bot token. Make sure you have it in your environment variables with the key %s\", tgBotTokenName)\n\t}\n\n\tBitlyAPIKey = os.Getenv(bAPIKeyName)\n\tif BitlyAPIKey == \"\" {\n\t\tlog.Fatalf(\"Missing Bitly API Key. Make sure you have it in your environment variables with the key %s\", bAPIKeyName)\n\t}\n\n\tReferralID = os.Getenv(refIDKeyName)\n\tif ReferralID == \"\" {\n\t\tlog.Fatalf(\"Missing referral ID. Make sure you have it in your environment variables with the key %s\", refIDKeyName)\n\t}\n\n\tAmazonDomain = os.Getenv(amazonDomain)\n\tif ReferralID == \"\" {\n\t\tlog.Fatalf(\"Missing Amazon domain. Make sure you have it in your environment variables with the key %s\", amazonDomain)\n\t}\n\n}", "title": "" }, { "docid": "cf1bcea4d26bef55a9dccc51a8a90818", "score": "0.69592524", "text": "func getEnvs() map[string]string {\n\tenvs := os.Environ()\n\tm := make(map[string]string)\n\n\tfor _, env := range envs {\n\t\tresults := strings.Split(env, \"=\")\n\t\tm[results[0]] = results[1]\n\t}\n\n\treturn m\n}", "title": "" }, { "docid": "a77c722f8e4c4148376f52cd5054daf0", "score": "0.69561255", "text": "func getEnv(key, defaultVal string) string {\n\tif value, exists := os.LookupEnv(key); exists {\n\t\treturn value\n\t}\n\treturn defaultVal\n}", "title": "" }, { "docid": "a8543ec0c05f753dc328707b3e12eac1", "score": "0.69525605", "text": "func getEnv(key, defaultValue string) string {\n\tif value, exists := os.LookupEnv(key); exists {\n\t\treturn value\n\t}\n\treturn defaultValue\n}", "title": "" }, { "docid": "a8543ec0c05f753dc328707b3e12eac1", "score": "0.69525605", "text": "func getEnv(key, defaultValue string) string {\n\tif value, exists := os.LookupEnv(key); exists {\n\t\treturn value\n\t}\n\treturn defaultValue\n}", "title": "" }, { "docid": "b2f874f715f826c28ae9855116df74e4", "score": "0.6948722", "text": "func getEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\tif fallback != \"\" {\n\t\treturn fallback\n\t}\n\tlog.Fatal(key + \" is not set\")\n\treturn \"\"\n}", "title": "" }, { "docid": "ba1e809afb6fa2f6a4d25fa41bc96139", "score": "0.69468737", "text": "func (cst *Runner) env() []string {\n\textraEnv := cst.localDaemon.ExtraEnv()\n\tif extraEnv == nil {\n\t\treturn nil\n\t}\n\n\tparentEnv := os.Environ()\n\tmergedEnv := make([]string, len(parentEnv), len(parentEnv)+len(extraEnv))\n\tcopy(mergedEnv, parentEnv)\n\treturn append(mergedEnv, extraEnv...)\n}", "title": "" }, { "docid": "0a2a281a5f46835ae1ad82b8f54df868", "score": "0.69429606", "text": "func getEnv(key string, defaultVal string) string {\r\n\tif value, exists := os.LookupEnv(key); exists {\r\n\t\treturn value\r\n\t}\r\n\r\n\treturn defaultVal\r\n}", "title": "" }, { "docid": "f73f37a8d67b43b20d0abc722ae86c07", "score": "0.6937193", "text": "func getEnv() []string {\n\tenv := os.Environ()\n\tnewEnv := []string{}\n\tfor _, i := range env {\n\t\tif !strings.HasPrefix(i, \"VAULT_\") {\n\t\t\tnewEnv = append(newEnv, i)\n\t\t}\n\t}\n\treturn newEnv\n}", "title": "" }, { "docid": "12bea2e78ed743116e664e7f4b14489c", "score": "0.6935677", "text": "func readRequireenv(name string, defaultValue string) string {\n\tvalue := os.Getenv(name)\n\tif len(value) < 1 {\n\t\tif len(defaultValue) > 0 {\n\t\t\treturn defaultValue\n\t\t}\n\t\tlog.Fatalf(\"%s needs to be specified in the environment variables.\", name)\n\t}\n\treturn value\n}", "title": "" }, { "docid": "4285c34f3a0c84c23d1a42a610b5fe66", "score": "0.69336754", "text": "func getEnv(key, fallback string) string {\n\tif loadedDotEnv == false {\n\t\terr := godotenv.Load();\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Error loading .env file\")\n\t\t}\n\t\tloadedDotEnv = true;\n\t}\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "title": "" }, { "docid": "529d1f2af0887e1e8178c12a55a258b3", "score": "0.6932132", "text": "func getEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "title": "" }, { "docid": "529d1f2af0887e1e8178c12a55a258b3", "score": "0.6932132", "text": "func getEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "title": "" }, { "docid": "529d1f2af0887e1e8178c12a55a258b3", "score": "0.6932132", "text": "func getEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "title": "" }, { "docid": "529d1f2af0887e1e8178c12a55a258b3", "score": "0.6932132", "text": "func getEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "title": "" }, { "docid": "529d1f2af0887e1e8178c12a55a258b3", "score": "0.6932132", "text": "func getEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "title": "" }, { "docid": "529d1f2af0887e1e8178c12a55a258b3", "score": "0.6932132", "text": "func getEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "title": "" }, { "docid": "529d1f2af0887e1e8178c12a55a258b3", "score": "0.6932132", "text": "func getEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "title": "" }, { "docid": "529d1f2af0887e1e8178c12a55a258b3", "score": "0.6932132", "text": "func getEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "title": "" }, { "docid": "529d1f2af0887e1e8178c12a55a258b3", "score": "0.6932132", "text": "func getEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "title": "" }, { "docid": "529d1f2af0887e1e8178c12a55a258b3", "score": "0.6932132", "text": "func getEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "title": "" }, { "docid": "3309d069492e4cc858b2900054c9f9fe", "score": "0.69274914", "text": "func getAllEnvVariables() {\n\t// Get the port that this webserver will be running upon\n\tport = getEnvOrDefault(\"PORT\", \"8000\", false)\n\n\t// Get the AWS credentials\n\tminioRegion = getEnvOrDefault(\"MINIO_REGION\", \"us-east-1\", false)\n\tminioBucket = getEnvOrDefault(\"MINIO_BUCKET\", \"test\", true)\n\tminioAccessKey = getEnvOrDefault(\"MINIO_ACCESS_KEY_ID\", \"3XT91LA1P2T17IH2VHQX\", true)\n\tminioSecretKey = getEnvOrDefault(\"MINIO_SECRET_ACCESS_KEY\", \"Zag9UH9P8sFjkEseTEYa+M2t8hq7VEmrWvkfuD+P\", true)\n\n\t// Get the path for the healthFile and the time to cache\n\thealthFile = getEnvOrDefault(\"HEALTH_FILE\", \".rest-minio-proxy\", false)\n\n\t// Get the time to wait between health checks (we dont want to hammer S3)\n\thealthIntervalString := getEnvOrDefault(\"HEALTH_CACHE_INTERVAL\", \"120\", false)\n\thealthIntervalInt, err := strconv.ParseInt(healthIntervalString, 10, 64)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\thealthCheckCacheInterval = healthIntervalInt\n\n}", "title": "" }, { "docid": "c3b04a2c8fc11204b0e04fdca0d95be3", "score": "0.6924174", "text": "func getEnv(key string, defaultValue string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\n\treturn defaultValue\n}", "title": "" }, { "docid": "d530815207edb2e7e76cdcd35345a2ab", "score": "0.69227695", "text": "func readEnv(c *gin.Context) {\n\tenv := make([]string, 0)\n\tfor _, pair := range os.Environ() {\n\t\tenv = append(env, pair)\n\t}\n\tc.JSON(200, gin.H{\n\t\t\"environments\": env,\n\t})\n}", "title": "" }, { "docid": "6e0101da1f2a37809fe9595df644fe1f", "score": "0.6911433", "text": "func (c *Config) readEnv() {\n\tfor _, envVar := range os.Environ() {\n\t\tpair := strings.Split(envVar, \"=\")\n\t\tc.properties[pair[0]] = pair[1]\n\t}\n}", "title": "" }, { "docid": "d4771f320a044fd613ca9517a0c6c346", "score": "0.6908197", "text": "func env(key string, defaultValue string) string {\n\tif value, exists := os.LookupEnv(key); exists {\n\t\treturn value\n\t}\n\n\treturn defaultValue\n}", "title": "" }, { "docid": "df3388e251dbaa81afc7976de65cccd8", "score": "0.69030786", "text": "func getEnv(key string, defaultVal string) string {\n\tif value, exists := os.LookupEnv(key); exists {\n\t\treturn value\n\t}\n\treturn defaultVal\n}", "title": "" }, { "docid": "b0b7574415ba951c4cb5ceb587913c22", "score": "0.6902429", "text": "func getEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(ForwarderPrefix + key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "title": "" }, { "docid": "fc7a6478588ecfe9a622df9dd2d406aa", "score": "0.6901843", "text": "func getEnv(key string, v ...string) string {\n\tdefaultValue := \"\"\n\tif len(v) > 0 {\n\t\tdefaultValue = v[0]\n\t}\n\n\tvalue := os.Getenv(key)\n\tif value == \"\" {\n\t\treturn defaultValue\n\t}\n\treturn value\n}", "title": "" }, { "docid": "a420051a79a3bb3eef50295d75c397cd", "score": "0.6897303", "text": "func loadEnvs(e ...string) map[string]string {\n\tenvs := make(map[string]string)\n\n\tfor _, k := range e {\n\t\tenvs[k] = os.Getenv(k)\n\t}\n\n\treturn envs\n}", "title": "" }, { "docid": "bc866e415cedbcf69eaa026c3b4f8a44", "score": "0.6896058", "text": "func getEnv(key string, defaultVal string) string {\n\tif value, exists := os.LookupEnv(key); exists {\n\t\treturn value\n\t}\n\n\treturn defaultVal\n}", "title": "" }, { "docid": "bc866e415cedbcf69eaa026c3b4f8a44", "score": "0.6896058", "text": "func getEnv(key string, defaultVal string) string {\n\tif value, exists := os.LookupEnv(key); exists {\n\t\treturn value\n\t}\n\n\treturn defaultVal\n}", "title": "" }, { "docid": "bc866e415cedbcf69eaa026c3b4f8a44", "score": "0.6896058", "text": "func getEnv(key string, defaultVal string) string {\n\tif value, exists := os.LookupEnv(key); exists {\n\t\treturn value\n\t}\n\n\treturn defaultVal\n}", "title": "" }, { "docid": "bc866e415cedbcf69eaa026c3b4f8a44", "score": "0.6896058", "text": "func getEnv(key string, defaultVal string) string {\n\tif value, exists := os.LookupEnv(key); exists {\n\t\treturn value\n\t}\n\n\treturn defaultVal\n}", "title": "" }, { "docid": "bc866e415cedbcf69eaa026c3b4f8a44", "score": "0.6896058", "text": "func getEnv(key string, defaultVal string) string {\n\tif value, exists := os.LookupEnv(key); exists {\n\t\treturn value\n\t}\n\n\treturn defaultVal\n}", "title": "" }, { "docid": "bc866e415cedbcf69eaa026c3b4f8a44", "score": "0.6896058", "text": "func getEnv(key string, defaultVal string) string {\n\tif value, exists := os.LookupEnv(key); exists {\n\t\treturn value\n\t}\n\n\treturn defaultVal\n}", "title": "" }, { "docid": "bc866e415cedbcf69eaa026c3b4f8a44", "score": "0.6896058", "text": "func getEnv(key string, defaultVal string) string {\n\tif value, exists := os.LookupEnv(key); exists {\n\t\treturn value\n\t}\n\n\treturn defaultVal\n}", "title": "" }, { "docid": "bc866e415cedbcf69eaa026c3b4f8a44", "score": "0.6896058", "text": "func getEnv(key string, defaultVal string) string {\n\tif value, exists := os.LookupEnv(key); exists {\n\t\treturn value\n\t}\n\n\treturn defaultVal\n}", "title": "" }, { "docid": "a039dcf2db029fcc061c004014e8b6e0", "score": "0.68941027", "text": "func initEnv() {\n\tif _, err := os.Stat(\"projectvars.env\"); err == nil {\n\t\terr = godotenv.Load(\"projectvars.env\")\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error loading environment.env\")\n\t\t}\n\t\tfmt.Println(\"Current environment:\", os.Getenv(\"ENV\"))\n\t}\n}", "title": "" }, { "docid": "8b83519725e23a00e831b70bf4425595", "score": "0.6886517", "text": "func getEnv(key string, defaultValue string) string {\n\tval, ok := os.LookupEnv(key)\n\tif !ok {\n\t\tval = defaultValue\n\t}\n\treturn val\n}", "title": "" }, { "docid": "f8b2b5f68c97ebf2c6b5c151e201deec", "score": "0.688419", "text": "func loadEnvVars() (env map[string]string, err error) {\n\n\tgetenvironment := func(data []string, getkeyval func(item string) (key, val string)) map[string]string {\n\t\titems := make(map[string]string)\n\t\tfor _, item := range data {\n\t\t\tkey, val := getkeyval(item)\n\t\t\titems[key] = val\n\t\t}\n\t\treturn items\n\t}\n\n\tenvironment := getenvironment(os.Environ(), func(item string) (key, val string) {\n\t\tsplits := strings.Split(item, \"=\")\n\t\tkey = splits[0]\n\t\tval = strings.Join(splits[1:], \"=\")\n\t\treturn\n\t})\n\n\treturn environment, nil\n}", "title": "" }, { "docid": "b921c6e7c597bd98e9bcec2ddd8835ef", "score": "0.6876918", "text": "func getenv(priority ...string) string {\n\tfor _, p := range priority {\n\t\tv := os.Getenv(p)\n\t\tif v != \"\" {\n\t\t\treturn v\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "f560b349327bb36f52a4ff554294723a", "score": "0.68716824", "text": "func getEnv(key string, defaultVal string) string {\n\tif value, exists := os.LookupEnv(key); exists {\n\t\treturn value\n\t}\n\n\tif isEmpty(defaultVal) {\n\t\tlog.Printf(\"environment variable %v is empty\\n\", key)\n\t\tos.Exit(0)\n\t}\n\n\treturn defaultVal\n}", "title": "" }, { "docid": "514e0ccaf25b28e989ba6ba3efe0e8a0", "score": "0.68635315", "text": "func GetEnv() {\n\tconfig.apiKey = GetEnvVar(\"APIKEY\")\n\tconfig.authKey = GetEnvVar(\"AUTHKEY\")\n\tconfig.authUrl = GetEnvVar(\"AUTHURL\")\n\tconfig.port = GetEnvVar(\"PORT\")\n}", "title": "" }, { "docid": "1e603cb01d2282660f3a291a49330328", "score": "0.68624234", "text": "func getEnv(k string) string {\n\terr := godotenv.Load(\".env\")\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\treturn (os.Getenv(k))\n}", "title": "" }, { "docid": "513adeb04ac3ff3b89677c20059a63e0", "score": "0.68441266", "text": "func getEnv(key, fallback string) string {\n\tvalue := os.Getenv(key)\n\tif value == \"\" {\n\t\tvalue = fallback\n\t}\n\treturn value\n}", "title": "" }, { "docid": "8a37a4c97a30ee9e296eff7259cdf938", "score": "0.6840063", "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.6840063", "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.6840063", "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": "2120e76a40952da3d294dce1ea497770", "score": "0.68356425", "text": "func getEnv(logger *zap.Logger, key string, optional bool) string {\n\tvalue, exists := os.LookupEnv(key)\n\n\tif !exists && optional {\n\t\tlogger.Info(\"Variable not found\", zap.String(\"variable\", key))\n\t} else if !exists {\n\t\tlogger.Fatal(\"Unable to find variable\", zap.String(\"variable\", key))\n\t}\n\treturn value\n}", "title": "" }, { "docid": "dc9ab346569f05ee7643c5807d802499", "score": "0.6832898", "text": "func (p *Plugin) getEnvs() map[string]interface{} {\n\tvar envs map[string]interface{}\n\tenvs = make(map[string]interface{})\n\tenvs[\"TPL_REPO_FULL_NAME\"] = p.Drone.Repo.FullName\n\tif p.Tpl.Repo.FullName != \"\" {\n\t\tenvs[\"TPL_REPO_FULL_NAME\"] = p.Tpl.Repo.FullName\n\t}\n\tenvs[\"TPL_REPO_SHORT_NAME\"] = p.Drone.Repo.ShortName\n\tif p.Tpl.Repo.ShortName != \"\" {\n\t\tenvs[\"TPL_REPO_SHORT_NAME\"] = p.Tpl.Repo.ShortName\n\t}\n\tenvs[\"TPL_REPO_GROUP_NAME\"] = p.Drone.Repo.GroupName\n\tenvs[\"TPL_REPO_OWNER_NAME\"] = p.Drone.Repo.OwnerName\n\tenvs[\"TPL_REPO_REMOTE_URL\"] = p.Drone.Repo.RemoteURL\n\n\tenvs[\"TPL_BUILD_STATUS\"] = p.getStatus()\n\tenvs[\"TPL_BUILD_LINK\"] = p.Drone.Build.Link\n\tenvs[\"TPL_BUILD_EVENT\"] = p.Drone.Build.Event\n\n\tvar consuming uint64\n\t// custom consuming env\n\tif p.Custom.Consuming.FinishedEnv != \"\" && p.Custom.Consuming.StartedEnv != \"\" {\n\t\tfinishedAt, _ := strconv.ParseUint(os.Getenv(p.Custom.Consuming.FinishedEnv), 10, 64)\n\t\tstartedAt, _ := strconv.ParseUint(os.Getenv(p.Custom.Consuming.StartedEnv), 10, 64)\n\t\tconsuming = finishedAt - startedAt\n\t} else {\n\t\tconsuming = p.Drone.Build.FinishedAt - p.Drone.Build.StartAt\n\t\tif consuming == 0 {\n\t\t\tconsuming = p.Drone.Stage.FinishedAt - p.Drone.Stage.StartedAt\n\t\t}\n\t}\n\tenvs[\"TPL_BUILD_CONSUMING\"] = fmt.Sprintf(\"%v\", consuming)\n\n\tenvs[\"TPL_COMMIT_SHA\"] = p.Drone.Commit.Sha\n\tenvs[\"TPL_COMMIT_REF\"] = p.Drone.Commit.Ref\n\tenvs[\"TPL_COMMIT_LINK\"] = p.Drone.Commit.Link\n\tenvs[\"TPL_COMMIT_MSG\"] = p.Drone.Commit.Message\n\tenvs[\"TPL_COMMIT_BRANCH\"] = p.Drone.Commit.Branch\n\tif p.Tpl.Commit.Branch != \"\" {\n\t\tenvs[\"TPL_COMMIT_BRANCH\"] = p.Tpl.Commit.Branch\n\t}\n\n\tenvs[\"TPL_AUTHOR_NAME\"] = p.Drone.Commit.Author.Name\n\tenvs[\"TPL_AUTHOR_USERNAME\"] = p.Drone.Commit.Author.Username\n\tenvs[\"TPL_AUTHOR_EMAIL\"] = p.Drone.Commit.Author.Email\n\tenvs[\"TPL_AUTHOR_AVATAR\"] = p.Drone.Commit.Author.Avatar\n\n\tenvs[\"TPL_STATUS_PIC\"] = p.getPicURL()\n\tenvs[\"TPL_STATUS_COLOR\"] = p.getColor()\n\tenvs[\"TPL_STATUS_EMOTICON\"] = p.getEmoticon()\n\n\treturn envs\n}", "title": "" }, { "docid": "61a025049007063cf5bb75de62e5c613", "score": "0.68328106", "text": "func GetENV(testDetails *types.TestDetails, expName, engineName string) {\n\ttestDetails.ExperimentName = expName\n\ttestDetails.EngineName = engineName\n\ttestDetails.OperatorName = Getenv(\"OPERATOR_NAME\", \"chaos-operator-ce\")\n\ttestDetails.ChaosNamespace = Getenv(\"CHAOS_NAMESPACE\", \"litmus\")\n\ttestDetails.AppNS = Getenv(\"APP_NS\", \"litmus\")\n\ttestDetails.AppLabel = Getenv(\"APP_LABEL\", \"run=nginx\")\n\ttestDetails.JobCleanUpPolicy = Getenv(\"JOB_CLEANUP_POLICY\", \"retain\")\n\ttestDetails.AnnotationCheck = Getenv(\"ANNOTATION_CHECK\", \"false\")\n\ttestDetails.ApplicationNodeName = Getenv(\"APPLICATION_NODE_NAME\", \"\")\n\ttestDetails.NodeSelectorName = Getenv(\"APPLICATION_NODE_NAME\", \"\")\n\ttestDetails.ImagePullPolicy = Getenv(\"IMAGE_PULL_POLICY\", \"Always\")\n\ttestDetails.ExperimentImagePullPolicy = Getenv(\"EXPERIMENT_IMAGE_PULL_POLICY\", \"Always\")\n\ttestDetails.ChaosDuration, _ = strconv.Atoi(Getenv(\"TOTAL_CHAOS_DURATION\", \"\"))\n\ttestDetails.ChaosServiceAccount = Getenv(\"CHAOS_SERVICE_ACCOUNT\", \"\")\n\ttestDetails.NewExperimentName = Getenv(\"NEW_EXPERIMENT_NAME\", expName)\n\ttestDetails.Delay, _ = strconv.Atoi(Getenv(\"DELAY\", \"5\"))\n\ttestDetails.Duration, _ = strconv.Atoi(Getenv(\"DURATION\", \"180\"))\n\ttestDetails.FillPercentage, _ = strconv.Atoi(Getenv(\"FILL_PERCENTAGE\", \"20\"))\n\ttestDetails.CPUKillCommand = Getenv(\"CPU_KILL_COMMAND\", \"kill -9 $(ps afx | grep \\\"[md5sum] /dev/zero\\\" | awk '{print$1}' | tr '\\\\n' ' ')\")\n\ttestDetails.MemoryKillCommand = Getenv(\"MEMORY_KILL_COMMAND\", \"kill -9 $(ps afx | grep \\\"[dd] if /dev/zero\\\" | awk '{print$1}' | tr '\\\\n' ' ')\")\n\ttestDetails.InstanceID = Getenv(\"EC2_INSTANCE_ID\", \"\")\n\ttestDetails.InstanceTag = Getenv(\"EC2_INSTANCE_TAG\", \"\")\n\ttestDetails.EBSVolumeID = Getenv(\"EBS_VOLUME_ID\", \"\")\n\ttestDetails.EBSVolumeTag = Getenv(\"EBS_VOLUME_TAG\", \"\")\n\ttestDetails.VMInstanceNames = Getenv(\"VM_INSTANCE_NAMES\", \"\")\n\ttestDetails.GCPProjectID = Getenv(\"GCP_PROJECT_ID\", \"\")\n\ttestDetails.InstanceZones = Getenv(\"INSTANCE_ZONES\", \"\")\n\ttestDetails.DiskVolumeNames = Getenv(\"DISK_VOLUME_NAMES\", \"\")\n\ttestDetails.DiskZones = Getenv(\"DISK_ZONES\", \"\")\n\ttestDetails.DeviceNames = Getenv(\"DEVICE_NAMES\", \"\")\n\ttestDetails.VMIds = Getenv(\"APP_VM_MOIDS\", \"\")\n\ttestDetails.Region = Getenv(\"REGION\", \"us-west-1\")\n\ttestDetails.UpdateWebsite = Getenv(\"UPDATE_WEBSITE\", \"false\")\n\ttestDetails.TargetNodes = Getenv(\"TARGET_NODES\", \"\")\n\ttestDetails.NodeLabel = Getenv(\"NODE_LABEL\", \"\")\n\ttestDetails.AzureResourceGroup = Getenv(\"AZURE_RESOURCE_GROUP\", \"\")\n\ttestDetails.AzureInstanceName = Getenv(\"AZURE_INSTANCE_NAME\", \"\")\n\ttestDetails.AzureDiskName = Getenv(\"AZURE_DISK_NAME\", \"\")\n\ttestDetails.AzureScaleSet = Getenv(\"AZURE_SCALE_SET\", \"\")\n\ttestDetails.ProcessIds = Getenv(\"PROCESS_IDS\", \"\")\n\ttestDetails.Args = Getenv(\"ARGS\", \"\")\n\ttestDetails.Command = Getenv(\"COMMAND\", \"\")\n\n\t//All Images for running chaos test\n\ttestDetails.AnsibleExperimentImage = Getenv(\"ANSIBLE_EXPERIMENT_IMAGE\", \"litmuschaos/ansible-runner:ci\")\n\ttestDetails.ExperimentImage = Getenv(\"EXPERIMENT_IMAGE\", \"litmuschaos/go-runner:ci\")\n\ttestDetails.OperatorImage = Getenv(\"OPERATOR_IMAGE\", \"litmuschaos/chaos-operator:ci\")\n\ttestDetails.RunnerImage = Getenv(\"RUNNER_IMAGE\", \"litmuschaos/chaos-runner:ci\")\n\ttestDetails.LibImage = Getenv(\"LIB_IMAGE\", \"\")\n\n\t// All Links for running chaos testing\n\ttestDetails.RbacPath = Getenv(\"RBAC_PATH\", \"https://hub.litmuschaos.io/api/chaos/master?file=charts/generic/\"+expName+\"/rbac.yaml\")\n\ttestDetails.ExperimentPath = Getenv(\"EXPERIMENT_PATH\", \"https://hub.litmuschaos.io/api/chaos/master?file=charts/generic/\"+expName+\"/experiment.yaml\")\n\ttestDetails.EnginePath = Getenv(\"ENGINE_PATH\", \"https://raw.githubusercontent.com/litmuschaos/chaos-charts/master/charts/generic/\"+expName+\"/engine.yaml\")\n\ttestDetails.AnsibleRbacPath = Getenv(\"ANSIBLE_RBAC_PATH\", \"https://raw.githubusercontent.com/litmuschaos/chaos-charts/master/charts/generic/\"+expName+\"/ansible/rbac.yaml\")\n\ttestDetails.AnsibleExperimentPath = Getenv(\"ANSIBLE_EXPERIMENT_PATH\", \"https://raw.githubusercontent.com/litmuschaos/chaos-charts/master/charts/generic/\"+expName+\"/ansible/experiment.yaml\")\n\ttestDetails.AnsibleEnginePath = Getenv(\"ANSIBLE_ENGINE_PATH\", \"https://raw.githubusercontent.com/litmuschaos/chaos-charts/master/charts/generic/\"+expName+\"/ansible/engine.yaml\")\n\ttestDetails.InstallLitmus = Getenv(\"INSTALL_LITMUS\", \"https://litmuschaos.github.io/litmus/litmus-operator-latest.yaml\")\n\ttestDetails.AdminRbacPath = Getenv(\"ADMIN_RBAC_PATH\", \"https://litmuschaos.github.io/litmus/litmus-admin-rbac.yaml\")\n\n\t// Portal Envs\n\ttestDetails.Version = Getenv(\"RUN_VERSION\", \"ci\")\n}", "title": "" }, { "docid": "61cb6b299fcb913885477e0bb73def42", "score": "0.6827659", "text": "func getEnv(key string, defaultVal string) string {\n\tif value, exists := os.LookupEnv(key); exists {\n\t\treturn value\n\t}\n\n\tif nextValue := os.Getenv(key); nextValue != \"\" {\n\t\treturn nextValue\n\t}\n\n\treturn defaultVal\n}", "title": "" }, { "docid": "0089b41b5efee2a4fc3516aa964a6085", "score": "0.68103915", "text": "func env(key, def string) (r string) {\n\tif r = os.Getenv(key); r == \"\" {\n\t\tr = def\n\t}\n\treturn\n}", "title": "" }, { "docid": "c65579240e6064c9c08aa32ba2aa7e2a", "score": "0.6798038", "text": "func (e *Context) Getenv() {\n\n\te.Database = os.Getenv(\"RESTAPI_DATABASENAME\")\n\te.MongoConnectionString = os.Getenv(\"RESTAPI_MONGO_CONNECTION_STRING\")\n\te.ApiPrefix = os.Getenv(\"RESTAPI_API_PREFIX\")\n\te.ApiPort = os.Getenv(\"RESTAPI_API_PORT\")\n\te.TLS = false\n\te.TLSApiPort = os.Getenv(\"RESTAPI_TLS_API_PORT\")\n\n\tif os.Getenv(\"RESTAPI_TLS\") != \"\" && strings.ToLower(os.Getenv(\"RESTAPI_TLS\")) == \"true\" {\n\t\te.TLS = true\n\t}\n\n\tif os.Getenv(\"RESTAPI_TLS_CERTIFICATE\") != \"\" {\n\t\tdecodedCert, _ := base64.StdEncoding.DecodeString(os.Getenv(\"RESTAPI_TLS_CERTIFICATE\"))\n\t\te.TLSCertificate = string(decodedCert)\n\t}\n\n\tif os.Getenv(\"RESTAPI_TLS_PRIVATE_KEY\") != \"\" {\n\t\tdecodedPrivateKey, _ := base64.StdEncoding.DecodeString(os.Getenv(\"RESTAPI_TLS_PRIVATE_KEY\"))\n\t\te.TLSPrivateKey = string(decodedPrivateKey)\n\t}\n\n\tif e.MongoConnectionString == \"\" {\n\t\te.BackendEnabled = false\n\t} else {\n\t\te.BackendEnabled = true\n\t}\n\n\tif e.Database == \"\" {\n\t\te.Database = \"restapi_demo_db\"\n\t}\n\n\tif e.ApiPort == \"\" {\n\t\te.ApiPort = \"80\"\n\t}\n\n\tif e.TLSApiPort == \"\" {\n\t\te.TLSApiPort = \"443\"\n\t}\n\n\t// if the tls is enabled but no certificate or private key then we will disable it\n\tif e.TLSCertificate == \"\" || e.TLSPrivateKey == \"\" {\n\t\te.TLS = false\n\t}\n\n\te.ApiPrefix = strings.TrimSuffix(e.ApiPrefix, \"/\")\n}", "title": "" }, { "docid": "deee1bb93d0efbe95dc7f035c61d8c42", "score": "0.67796713", "text": "func envGet(key, defaultValue string) string {\n\tprivateMutex.RLock()\n\tok := envOff\n\tprivateMutex.RUnlock()\n\tif ok {\n\t\treturn defaultValue\n\t}\n\tif v, _, _, ok := LookupEnv(key); ok {\n\t\treturn v\n\t}\n\n\treturn defaultValue\n}", "title": "" }, { "docid": "0e10c634104a5156e20bcda6d749b21f", "score": "0.6766361", "text": "func getEnvInitial() []string {\n\tif envInitial == nil {\n\t\t// Set initial environment variables\n\t\tosEnv := os.Environ()\n\t\tfor i := range osEnv {\n\t\t\tif !strings.HasPrefix(osEnv[i], \"RCLONE_\") || strings.HasPrefix(osEnv[i], rcloneTestMain) {\n\t\t\t\tenvInitial = append(envInitial, osEnv[i])\n\t\t\t}\n\t\t}\n\t}\n\treturn envInitial\n}", "title": "" }, { "docid": "67ae5da325dab4fe8aaa792d53c21880", "score": "0.6764707", "text": "func readEnv() (bucketPath string, port string) {\n\tbucketPath = os.Getenv(\"BUCKET_URI\")\n\tif bucketPath == \"\" {\n\t\tlog.Fatalln(\"No Bucket URI set.\")\n\t}\n\tport = os.Getenv(\"PORT\")\n\tif port == \"\" {\n\t\tport = \"8080\"\n\t}\n\treturn bucketPath, port\n}", "title": "" }, { "docid": "4b4fc7cc9151f0927f8229ac01c33e64", "score": "0.67496336", "text": "func readEnv() {\n\tif envdata, _ := ioutil.ReadFile(\".env\"); len(envdata) > 0 {\n\t\ts := bufio.NewScanner(bytes.NewReader(envdata))\n\t\tfor s.Scan() {\n\t\t\tparts := strings.Split(s.Text(), \"=\")\n\t\t\tif len(parts) != 2 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tstrValue := strings.Trim(parts[1], `\"`)\n\t\t\tif err := os.Setenv(parts[0], strValue); err != nil {\n\t\t\t\tlog.WithField(\"name\", parts[0]).WithError(err).Warningln(\"failed to override ENV variable\")\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "95decf390e8e66a744d800008f6129fc", "score": "0.6746415", "text": "func loadEnvironmentVariables() {\n\tpgDb = os.Getenv(\"PGDB\")\n\tif len(pgDb) == 0 {\n\t\tpanic(\"No pgDB environment variable\")\n\t}\n\n\tpgUser = os.Getenv(\"PGUSER\")\n\tif len(pgUser) == 0 {\n\t\tpanic(\"No pgUSER environment variable\")\n\t}\n\n\tpgPassword = os.Getenv(\"PGPASSWORD\")\n\tif len(pgPassword) == 0 {\n\t\tpanic(\"No pgPASSWORD environment variable\")\n\t}\n\n\tpgHost = os.Getenv(\"PGHOST\")\n\tif len(pgHost) == 0 {\n\t\tpanic(\"No pgHOST environment variable\")\n\t}\n\n\tuploadFolderPath = os.Getenv(\"UPLOAD_FOLDER_PATH\")\n\tif len(uploadFolderPath) == 0 {\n\t\tpanic(\"No UPLOAD_FOLDER_PATH environment variable\")\n\t}\n\n\tredisURL = os.Getenv(\"REDIS_URL\")\n\tif len(redisURL) == 0 {\n\t\tpanic(\"No REDIS_URL environment variable\")\n\t}\n\n\tredisPort = os.Getenv(\"REDIS_PORT\")\n\tif len(redisPort) == 0 {\n\t\tpanic(\"No REDIS_PORT environment variable\")\n\t}\n\n\tredisPassword = os.Getenv(\"REDIS_PASSWORD\")\n\tif len(redisPassword) == 0 {\n\t\tpanic(\"No REDIS_PASSWORD environment variable\")\n\t}\n\n\tredisTopic = os.Getenv(\"REDIS_TOPIC\")\n\tif len(redisTopic) == 0 {\n\t\tpanic(\"No REDIS_TOPIC environment variable\")\n\t}\n}", "title": "" }, { "docid": "b42c33dcf78f05217da493852abf21a3", "score": "0.6736852", "text": "func getEnv(key, defaultValue string) string {\n\tvalue := os.Getenv(key)\n\tif len(value) == 0 {\n\t\treturn defaultValue\n\t}\n\treturn value\n}", "title": "" }, { "docid": "01d4cad965c5e2ea75a28dcc33d20267", "score": "0.6731403", "text": "func getenv(key, fallback string) string {\n\tvalue := os.Getenv(key)\n\tif len(value) == 0 {\n\t\treturn fallback\n\t}\n\treturn value\n}", "title": "" }, { "docid": "15699b9176039db80e4b836e604512f9", "score": "0.67207915", "text": "func getenv(key string) string {\n\tif originalEnv == nil {\n\t\treturn os.Getenv(key)\n\t} else {\n\t\treturn originalEnv[key]\n\t}\n}", "title": "" }, { "docid": "aafd3ca07a15ac35bac40648de15415b", "score": "0.67206264", "text": "func main() {\n\t// Set a key/value pair with os.Setenv\n\tos.Setenv(\"FOO\", \"1\")\n\n\t// Get a value for a key with os.Getenv\n\tfmt.Println(\"FOO: \", os.Getenv(\"FOO\"))\n\t// Returns empty string if key isn't present in environment\n\tfmt.Println(\"BOO:\", os.Getenv(\"BAR\"))\n\n\tfmt.Println()\n\t// os.Environ to list all the key/value pairs in environment\n\t// in form KEY=value\n\tfor _, e := range os.Environ() {\n\t\tpair := strings.SplitN(e, \"=\", 2)\n\t\tfmt.Println(pair[0])\n\t}\n\n}", "title": "" }, { "docid": "2bf2e7e28a5f9c3206dd5678dabd8ad7", "score": "0.6709431", "text": "func getArgsEnv(p *stage1commontypes.Pod, flavor string, debug bool, n *networking.Networking) ([]string, []string, error) {\n\tvar args []string\n\tenv := os.Environ()\n\n\t// We store the pod's flavor so we can later garbage collect it correctly\n\tif err := os.Symlink(flavor, filepath.Join(p.Root, stage1initcommon.FlavorFile)); err != nil {\n\t\treturn nil, nil, errwrap.Wrap(errors.New(\"failed to create flavor symlink\"), err)\n\t}\n\n\tswitch flavor {\n\tcase \"xen\":\n\t\targs = append(args, filepath.Join(common.Stage1RootfsPath(p.Root), \"run\"))\n\t\tif p.Interactive {\n\t\t\targs = append(args, \"--interactive\")\n\t\t}\n\t\tif n == nil {\n\t\t\t\targs = append(args, fmt.Sprintf(\"pvcalls\"))\n\t\t} else {\n\t\t\tfor _, nd := range n.GetActiveNetworks() {\n\t\t\t\targs = append(args, fmt.Sprintf(\"ip=%s bridge=%s\", nd.GuestIP(), nd.IfName()))\n\n\t\t\t\tfor _, route := range nd.Routes() {\n\t\t\t\t\tgw := route.GW\n\t\t\t\t\tif gw == nil {\n\t\t\t\t\t\tgw = nd.Gateway()\n\t\t\t\t\t}\n\n\t\t\t\t\targs = append(args, fmt.Sprintf(\"route=%s gw=%s\", route.Dst.String(), gw.String()))\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\targs = append(args, p.UUID.String())\n\t\treturn args, env, nil\n\tdefault:\n\t\treturn nil, nil, fmt.Errorf(\"unrecognized stage1 flavor: %q\", flavor)\n\t}\n}", "title": "" }, { "docid": "56879caeb7ca7aeb848d363591386a4b", "score": "0.66990805", "text": "func getEnv(name, deflt string) string {\n\tval := os.Getenv(name)\n\tif val == \"\" {\n\t\treturn deflt\n\t}\n\treturn val\n}", "title": "" }, { "docid": "1d391b94e3d69930098836e828737f1c", "score": "0.66990334", "text": "func (me *Me) ShuntEnv() {\n\tenv := map[string]string{\n\t\t\"MY_APISERVER\": me.ApiServer,\n\t\t\"MY_NAME\": me.Name,\n\t\t\"MY_IP\": me.IP,\n\t\t\"MY_NODEIP\": me.NodeIP,\n\t\t\"MY_NAMESPACE\": me.Namespace,\n\t\t\"MY_SELFLINK\": me.SelfLink,\n\t\t\"MY_UID\": me.UID,\n\t}\n\tfor k, v := range env {\n\t\tos.Setenv(k, v)\n\t}\n\tvar name string\n\tfor k, v := range me.Labels {\n\t\tname = \"MY_LABEL_\" + strings.ToUpper(k)\n\t\tos.Setenv(name, v)\n\t}\n\tfor k, v := range me.Annotations {\n\t\tname = \"MY_ANNOTATION_\" + strings.ToUpper(k)\n\t\tos.Setenv(name, v)\n\t}\n}", "title": "" }, { "docid": "eee02a7ebf1b55978864a9b090dd1b0a", "score": "0.6692999", "text": "func getenv(key interface{}) (string, error) {\n\tskey, err := cast.ToStringE(key)\n\tif err != nil {\n\t\treturn \"\", nil\n\t}\n\n\treturn os.Getenv(skey), nil\n}", "title": "" }, { "docid": "f6b8f6e7a238a7c0cc56974dd9a171d9", "score": "0.6684343", "text": "func getEnv(key, defaultValue string) string {\n\tvalue := os.Getenv(key)\n\tif value == \"\" {\n\t\treturn defaultValue\n\t}\n\treturn value\n}", "title": "" }, { "docid": "aff18b222f3237d0f0c0904c831c0b9c", "score": "0.6680342", "text": "func extractValidEnv() (envs map[string]string) {\n\n\tenvs = map[string]string{}\n\tfor _, v := range os.Environ() {\n\t\t// After the first equal keep everything else together\n\t\tpair := strings.SplitN(v, \"=\", 2)\n\t\t// Extract the first unicode rune and test that it is a valid character for an env name\n\t\tenvName := []rune(pair[0])\n\t\tif len(pair) == 2 && (unicode.IsLetter(envName[0]) || unicode.IsDigit(envName[0])) {\n\t\t\tpair[1] = strings.Replace(pair[1], \"\\\"\", \"\\\\\\\"\", -1)\n\t\t\tenvs[pair[0]] = pair[1]\n\t\t} else {\n\t\t\t// The underscore is always present and represents the CWD so dont print messages about it\n\t\t\tif envName[0] != '_' {\n\t\t\t\tlogger.Debug(fmt.Sprintf(\"env var %s (%c) (%d) dropped due to conformance\", pair[0], envName[0], len(pair)))\n\t\t\t}\n\t\t}\n\t}\n\treturn envs\n}", "title": "" }, { "docid": "8b76a2ec61f00b89d14c70841a5f53ee", "score": "0.6667329", "text": "func getEnvOrMessage(key string) (result string, ok bool) {\n\tresult, ok = os.LookupEnv(key)\n\tif !ok {\n\t\tfmt.Printf(\"Environment variable %s is not set.\\n\", key)\n\t}\n\treturn\n}", "title": "" }, { "docid": "2498a29d8c0ff609cc372a11fbff87cb", "score": "0.6665355", "text": "func GetEnvVar(name, def string) string {\n\tvar err error\n\te := os.Getenv(name)\n\tif e != \"\" {\n\t\treturn e\n\t}\n\t// check if a metadata.json file exists, this is the file downloaded from google \"REST equivalent\" in metadata section\n\t// if len(metaFileItems) > 0 {\n\t// \t// see if we loaded it from a file\n\t// \tfor _, kv := range metaFileItems {\n\t// \t\tfmt.Println(kv.Key, kv.Value)\n\t// \t\tif kv.Key == name {\n\t// \t\t\treturn kv.Value\n\t// \t\t}\n\t// \t}\n\t// }\n\tif metadata.OnGCE() {\n\t\te, err = metadata.ProjectAttributeValue(name)\n\t\tif err == nil {\n\t\t\tfmt.Println(\"GOT META\", e)\n\t\t\treturn e\n\t\t}\n\t\tlog.Println(\"error on metadata.ProjectAttributeValue\", err)\n\t}\n\tif def != \"\" {\n\t\treturn def\n\t}\n\treturn e\n}", "title": "" }, { "docid": "5f13cc662935e2d8dacfdf854bc001a5", "score": "0.6661073", "text": "func (server *EnvironmentServer) GetEnvironmentVariables(req *empty.Empty, stream pb.EnvironmentService_GetEnvironmentVariablesServer) error {\n\t// create a timer to observe the duration\n\ttimer := prometheus.NewTimer(opsDuration)\n\n\t// increment the counter of total operations\n\topsProcessed.Inc()\n\n\tfor _, e := range os.Environ() {\n\t\tpair := strings.SplitN(e, \"=\", 2)\n\t\tfmt.Println(pair[0])\n\t\tvar entry pb.KeyValuePair\n\t\tentry.Key = pair[0]\n\t\tentry.Value = pair[1]\n\t\terr := stream.Send(&entry)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\ttimer.ObserveDuration()\n\n\treturn nil\n}", "title": "" }, { "docid": "53541ef4d842600e7beae960bbdeb7c0", "score": "0.66591614", "text": "func getStringEnv(key string, defaultValue string) string {\n\tv := os.Getenv(key)\n\tif v == \"\" {\n\t\treturn defaultValue\n\t}\n\treturn v\n}", "title": "" }, { "docid": "b56b2e1d1afc9fa9f854f8ee8bf2137c", "score": "0.6655663", "text": "func (ep *externalPlugin) envVars() map[string]string {\n\tcfg := ep.Context.Config()\n\tenvVars := ArgumentsToEnvVars(cfg.Verbose, ep.pluginInstance.Arguments)\n\tep.appendEnvPassthrough(envVars)\n\treturn envVars\n}", "title": "" }, { "docid": "887602095ad58c95a398d15db594a81a", "score": "0.66487795", "text": "func (cr *AppsodyApplication) GetEnv() []corev1.EnvVar {\n\treturn cr.Spec.Env\n}", "title": "" }, { "docid": "f514d9e8e2aaea9a2243bbba016fa8fe", "score": "0.6630414", "text": "func envFields(key string) []string {\n\treturn strings.Fields(os.Getenv(key))\n}", "title": "" }, { "docid": "f68788ea76cca598e2edda8d50a81c0e", "score": "0.66278756", "text": "func prepareEnvs() {\n\tgotenv.Load()\n\tEnvs[\"PORT\"] = hp.EnvCheck(\"PORT\")\n\tEnvs[\"DYNAMODB_ENDPOINT\"] = hp.EnvCheck(\"DYNAMODB_ENDPOINT\")\n\tEnvs[\"AWS_REGION\"] = hp.EnvCheck(\"AWS_REGION\")\n\tEnvs[\"TABLE_NAME\"] = hp.EnvCheck(\"TABLE_NAME\")\n}", "title": "" }, { "docid": "32378f0544c548cc27ba693f7698df50", "score": "0.66206974", "text": "func GetEnv(key ...string) string {\n\tif value, exists := os.LookupEnv(key[0]); exists {\n\t\treturn value\n\t}\n\n\tif len(key) <= 1 {\n\t\tlog.Printf(\"Variavel de ambiente '%s' não foi definida e não tem valor padrão\\n\", key[0])\n\t\tpanic(1)\n\t}\n\n\treturn key[1]\n}", "title": "" }, { "docid": "fecf8a275dc2ffe06c1488577885049c", "score": "0.6600355", "text": "func Getenv() map[string]interface{} {\n\tif _envs != nil {\n\t\treturn _envs\n\t}\n\n\t_envs = map[string]interface{}{}\n\tfor _, v := range os.Environ() {\n\t\tif strings.HasPrefix(v, envPrefix) {\n\t\t\tat := strings.IndexRune(v, '=')\n\t\t\tname := v[envPrefixLen:at]\n\t\t\tvalue := v[at+1:]\n\t\t\t_envs[name] = value\n\t\t}\n\t}\n\n\treturn _envs\n}", "title": "" }, { "docid": "596bb367112f7d9e8618b63807269eee", "score": "0.65835595", "text": "func getEnv(name, defaultVal string) string {\n\tif os.Getenv(name) != \"\" {\n\t\treturn os.Getenv(name)\n\t}\n\treturn defaultVal\n}", "title": "" }, { "docid": "8ed6bbf94a64e3e52d268ec02c999e7a", "score": "0.65828115", "text": "func lookupWorkloadIdentityEnv(tenantEnvKey, tokenEnvKey string) (tenantId, federatedTokenFile string, err error) {\n\ttenantId, tenantIdFound := mustLookupEnvValue(tenantEnvKey)\n\tfederatedTokenFile, federatedTokenFileFound := mustLookupEnvValue(tokenEnvKey)\n\tklog.V(4).Infof(\"env vars required for workload identity auth are set to: %v=%v and %v=%v\", tenantEnvKey, tenantId, tokenEnvKey, federatedTokenFile)\n\n\tif !tenantIdFound && !federatedTokenFileFound {\n\t\terr = fmt.Errorf(\"%v and %v environment variables not found or empty\", tenantEnvKey, tokenEnvKey)\n\t\treturn\n\t}\n\n\tif !tenantIdFound {\n\t\terr = fmt.Errorf(\"%v environment variable not found or empty\", tenantEnvKey)\n\t\treturn\n\t}\n\n\tif !federatedTokenFileFound {\n\t\terr = fmt.Errorf(\"%v environment variable not found or empty\", tokenEnvKey)\n\t}\n\n\treturn\n}", "title": "" } ]
a948d4e714ec601cd20670c834a2fbc9
SetReadOnly is part of the MysqlDaemon interface
[ { "docid": "2d83102eca11d5c9c92f63f30e515f51", "score": "0.84170234", "text": "func (fmd *FakeMysqlDaemon) SetReadOnly(on bool) error {\n\tfmd.ReadOnly = on\n\treturn nil\n}", "title": "" } ]
[ { "docid": "e1ff22dce2cae5c32bb8fc89e9fc6ba0", "score": "0.819017", "text": "func (mysqld *Mysqld) SetReadOnly(on bool) error {\n\t// temp logging, to be removed in v17\n\tvar newState string\n\tswitch on {\n\tcase false:\n\t\tnewState = \"ReadWrite\"\n\tcase true:\n\t\tnewState = \"ReadOnly\"\n\t}\n\tlog.Infof(\"SetReadOnly setting to : %s\", newState)\n\n\tquery := \"SET GLOBAL read_only = \"\n\tif on {\n\t\tquery += \"ON\"\n\t} else {\n\t\tquery += \"OFF\"\n\t}\n\treturn mysqld.ExecuteSuperQuery(context.TODO(), query)\n}", "title": "" }, { "docid": "1c033a8ac32fab187d216991d8ebd00e", "score": "0.74797755", "text": "func (st *fakeConn) SetReadOnly(readOnly bool) {\n\tst.readOnly = readOnly\n}", "title": "" }, { "docid": "6579b9a5c69145ee373f23b77e70329d", "score": "0.7048067", "text": "func (fmd *FakeMysqlDaemon) SetSuperReadOnly(on bool) (ResetSuperReadOnlyFunc, error) {\n\tfmd.SuperReadOnly.Store(on)\n\tfmd.ReadOnly = on\n\treturn nil, nil\n}", "title": "" }, { "docid": "fd4241911dae0d7371cda9ff4c90818e", "score": "0.6990699", "text": "func (mysqld *Mysqld) SetSuperReadOnly(on bool) (ResetSuperReadOnlyFunc, error) {\n\t// return function for switching `OFF` super_read_only\n\tvar resetFunc ResetSuperReadOnlyFunc\n\tvar disableFunc = func() error {\n\t\tquery := \"SET GLOBAL super_read_only = 'OFF'\"\n\t\terr := mysqld.ExecuteSuperQuery(context.Background(), query)\n\t\treturn err\n\t}\n\n\t// return function for switching `ON` super_read_only.\n\tvar enableFunc = func() error {\n\t\tquery := \"SET GLOBAL super_read_only = 'ON'\"\n\t\terr := mysqld.ExecuteSuperQuery(context.Background(), query)\n\t\treturn err\n\t}\n\n\tsuperReadOnlyEnabled, err := mysqld.IsSuperReadOnly()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// If non-idempotent then set the right call-back.\n\t// We are asked to turn on super_read_only but original value is false,\n\t// therefore return disableFunc, that can be used as defer by caller.\n\tif on && !superReadOnlyEnabled {\n\t\tresetFunc = disableFunc\n\t}\n\t// We are asked to turn off super_read_only but original value is true,\n\t// therefore return enableFunc, that can be used as defer by caller.\n\tif !on && superReadOnlyEnabled {\n\t\tresetFunc = enableFunc\n\t}\n\n\tquery := \"SET GLOBAL super_read_only = \"\n\tif on {\n\t\tquery += \"'ON'\"\n\t} else {\n\t\tquery += \"'OFF'\"\n\t}\n\tif err := mysqld.ExecuteSuperQuery(context.Background(), query); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resetFunc, nil\n}", "title": "" }, { "docid": "6e74f39c142b580097851a67243c0d4d", "score": "0.6728172", "text": "func (fmd *FakeMysqlDaemon) IsReadOnly() (bool, error) {\n\treturn fmd.ReadOnly, nil\n}", "title": "" }, { "docid": "cb17dbcad4ffc12ead9bd8327c18ad48", "score": "0.6463748", "text": "func (m *MessageRule) SetIsReadOnly(value *bool)() {\n m.isReadOnly = value\n}", "title": "" }, { "docid": "398f4cc0c87342726f4281247a59c545", "score": "0.6455278", "text": "func (option *Mount) SetReadOnly(value bool) {\n\toption.ReadOnly = &value\n}", "title": "" }, { "docid": "0371af73c4b0a85fe15705e4d442818d", "score": "0.63785636", "text": "func (orm *Xorm) ReadOnly(b bool) {\n\torm.readOnly = b\n}", "title": "" }, { "docid": "86480e5b30b45ae005a8239bfd2ed504", "score": "0.6354413", "text": "func (a *Access) SetReadOnly(v bool) {\n\ta.ReadOnly = v\n}", "title": "" }, { "docid": "0b3a0cf29305a5d4e1bcd7e87f4fddf6", "score": "0.61716056", "text": "func Readonly(opts *Options) {\n\topts.Readonly = true\n}", "title": "" }, { "docid": "ee90ba9042d22a13fa8101f10fda12a1", "score": "0.6130788", "text": "func (mysqld *Mysqld) IsReadOnly() (bool, error) {\n\tqr, err := mysqld.FetchSuperQuery(context.TODO(), \"SHOW VARIABLES LIKE 'read_only'\")\n\tif err != nil {\n\t\treturn true, err\n\t}\n\tif len(qr.Rows) != 1 {\n\t\treturn true, errors.New(\"no read_only variable in mysql\")\n\t}\n\tif qr.Rows[0][1].ToString() == \"ON\" {\n\t\treturn true, nil\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "36de7a18bf353dc3dc0582bfd88643d8", "score": "0.6106894", "text": "func (f *cFactory) setInstReadOnly(inst orc.Instance) error {\n\tif !inst.ReadOnly == true {\n\t\tglog.V(2).Infof(\"set instance %s read only\", inst.Key.Hostname)\n\t\treturn f.orcClient.SetHostReadOnly(inst.Key)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bb1fd3ae48ad291b01fedf4bf203d5a6", "score": "0.6043408", "text": "func UpdateWorksetReadonly(dbConn *sql.DB, setId int, isReadonly bool) error {\r\n\r\n\treturn Update(dbConn,\r\n\t\t\"UPDATE workset_lst\"+\r\n\t\t\t\" SET is_readonly = \"+toBoolSqlConst(isReadonly)+\", \"+\" update_dt = \"+ToQuoted(helper.MakeDateTime(time.Now()))+\r\n\t\t\t\" WHERE set_id =\"+strconv.Itoa(setId))\r\n}", "title": "" }, { "docid": "76afe19878059a41d6cdb8ac0d71b494", "score": "0.5975106", "text": "func (c *Conn) Readonly(dbName string) (bool, error) {\n\tcname := C.CString(dbName)\n\trv := C.sqlite3_db_readonly(c.db, cname)\n\tC.free(unsafe.Pointer(cname))\n\tif rv == -1 {\n\t\treturn false, c.specificError(\"%q is not the name of a database\", dbName)\n\t}\n\treturn rv == 1, nil\n}", "title": "" }, { "docid": "e98d107fd05768e64e09525e4fc3d265", "score": "0.5720258", "text": "func (st *fakeConn) IsReadOnly() bool {\n\treturn st.readOnly\n}", "title": "" }, { "docid": "00d4bd2ddb789202a0eae81f1c6a8393", "score": "0.56995195", "text": "func (l *Loader) SetAttrReadOnly(i Sym, v bool) {\n\tl.attrReadOnly[i] = v\n}", "title": "" }, { "docid": "9ac5ad21f02e006bcd4a76a626aa0b81", "score": "0.56353575", "text": "func SetVolReadOnly(subvol string, flag bool) {\n\tout, err := exec.Command(\"btrfs\", \"property\", \"set\", \"-ts\", subvol, \"ro\", strconv.FormatBool(flag)).CombinedOutput()\n\tlog.Check(log.FatalLevel, \"Setting readonly: \"+strconv.FormatBool(flag)+\": \"+string(out), err)\n}", "title": "" }, { "docid": "3ea68583f7ba608e884f0e10cf5c80b9", "score": "0.56217426", "text": "func ReadOnly() MountOption {\n\treturn func(conf *mountConfig) error {\n\t\tconf.options[\"ro\"] = \"\"\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "1ea9081f031d858156d5d258dab5aa49", "score": "0.5602074", "text": "func (c *Client) SetReadYourWrites(preventStaleReads bool) {\n\tc.modifyLock.Lock()\n\tdefer c.modifyLock.Unlock()\n\tc.config.modifyLock.Lock()\n\tdefer c.config.modifyLock.Unlock()\n\n\tif preventStaleReads {\n\t\tif c.replicationStateStore == nil {\n\t\t\tc.replicationStateStore = &replicationStateStore{}\n\t\t}\n\t} else {\n\t\tc.replicationStateStore = nil\n\t}\n\n\tc.config.ReadYourWrites = preventStaleReads\n}", "title": "" }, { "docid": "b0201abcd5317bdf740be99bd14af6c5", "score": "0.55674255", "text": "func (mysqld *Mysqld) IsSuperReadOnly() (bool, error) {\n\tqr, err := mysqld.FetchSuperQuery(context.TODO(), \"SELECT @@global.super_read_only\")\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif err == nil && len(qr.Rows) == 1 {\n\t\tsro := qr.Rows[0][0].ToString()\n\t\tif sro == \"1\" || sro == \"ON\" {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\n\treturn false, nil\n}", "title": "" }, { "docid": "98b542929cb3dcba4919e5abb4f4e361", "score": "0.5525209", "text": "func (c *Client) SetReadOnly(ctx context.Context, key string, isReadOnly bool, options *SetReadOnlyOptions) (SetReadOnlyResponse, error) {\n\tvar label *string\n\tvar ifMatch *azcore.ETag\n\n\tif options != nil {\n\t\tlabel = options.Label\n\t\tifMatch = options.OnlyIfUnchanged\n\t}\n\n\tsetting := Setting{Key: &key, Label: label}\n\n\tvar err error\n\tif isReadOnly {\n\t\tvar resp generated.AzureAppConfigurationClientPutLockResponse\n\t\tresp, err = c.appConfigClient.PutLock(ctx, *setting.Key, setting.toGeneratedPutLockOptions(ifMatch))\n\t\tif err == nil {\n\t\t\treturn fromGeneratedPutLock(resp), nil\n\t\t}\n\t} else {\n\t\tvar resp generated.AzureAppConfigurationClientDeleteLockResponse\n\t\tresp, err = c.appConfigClient.DeleteLock(ctx, *setting.Key, setting.toGeneratedDeleteLockOptions(ifMatch))\n\t\tif err == nil {\n\t\t\treturn fromGeneratedDeleteLock(resp), nil\n\t\t}\n\t}\n\n\treturn SetReadOnlyResponse{}, err\n}", "title": "" }, { "docid": "0842fec2d7c5d235bfc3f78c3aa80a11", "score": "0.54996955", "text": "func ReadOnly(container string, flag bool) {\n\tfor _, path := range []string{container + \"/rootfs/\", container + \"/opt\", container + \"/var\", container + \"/home\"} {\n\t\tSetVolReadOnly(config.Agent.LxcPrefix+path, flag)\n\t}\n}", "title": "" }, { "docid": "42e38bd3b4cf300f3f279bc1ba0fff7f", "score": "0.5484948", "text": "func (f *cFactory) setInstWritable(inst orc.Instance) error {\n\tif inst.ReadOnly == true {\n\t\tglog.V(2).Infof(\"set instance %s writable\", inst.Key.Hostname)\n\t\treturn f.orcClient.SetHostWritable(inst.Key)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "74f925fe4da8fd6f4d4468b00ce71f89", "score": "0.54762787", "text": "func (ks *KVSStore) ReadOnly() bool {\n\treturn false\n}", "title": "" }, { "docid": "fc025ce10e11cb60fa23a9ce88110512", "score": "0.5467539", "text": "func (c *container) ReadOnly(serverIsReadOnly bool) bool {\n\tif c.config.Linux.SecurityContext.ReadonlyRootfs {\n\t\treturn true\n\t}\n\treturn serverIsReadOnly\n}", "title": "" }, { "docid": "f4f8c2f0ce2ba7337b4404544419f56c", "score": "0.546078", "text": "func (s *Session) MysqlReadOnWrite() *Session {\n\ts = s.Copy()\n\ts.mysqlRead = s.mysqlWrite\n\treturn s\n}", "title": "" }, { "docid": "30a2d3fcdbafd868fdcb1921fd4ec3fc", "score": "0.545559", "text": "func (c *Client) ReadOnly() *Client {\n\tcfg := config{driver: &readonly{Driver: c.driver}, log: c.log}\n\treturn &Client{\n\t\tconfig: cfg,\n\t\tSchema: migrate.NewSchema(cfg.driver),\n\t\tAllocationStrategy: NewAllocationStrategyClient(cfg),\n\t\tPoolProperties: NewPoolPropertiesClient(cfg),\n\t\tProperty: NewPropertyClient(cfg),\n\t\tPropertyType: NewPropertyTypeClient(cfg),\n\t\tResource: NewResourceClient(cfg),\n\t\tResourcePool: NewResourcePoolClient(cfg),\n\t\tResourceType: NewResourceTypeClient(cfg),\n\t\tTag: NewTagClient(cfg),\n\t}\n}", "title": "" }, { "docid": "3831d8566a954b55131a6504b4e6d524", "score": "0.54137015", "text": "func SetFileReadOnly(path string, readonly bool) (err error) {\n\tif readonly {\n\t\terr = os.Chmod(path, ReadOnlyFileMode)\n\t} else {\n\t\terr = os.Chmod(path, DefaultFileMode)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "504c85f74b4623324a7200a6c466ffab", "score": "0.54095036", "text": "func (fmd *FakeMysqlDaemon) IsSuperReadOnly() (bool, error) {\n\treturn fmd.SuperReadOnly.Load(), nil\n}", "title": "" }, { "docid": "c3340199fed4018511eb6db71be69366", "score": "0.538235", "text": "func setWriteFlag(tx *bolt.Tx) {\n}", "title": "" }, { "docid": "7455f967dc5ca81d1689d40716f75eaf", "score": "0.53686154", "text": "func (s *MountPoint) SetReadOnly(v bool) *MountPoint {\n\ts.ReadOnly = &v\n\treturn s\n}", "title": "" }, { "docid": "b334fa0065bc2a5ef8f86a358ddce559", "score": "0.531587", "text": "func (o *SingleSelectFieldField) SetReadOnly(v bool) {\n\to.ReadOnly = v\n}", "title": "" }, { "docid": "a85203e007ce62554f402121a0f8868e", "score": "0.52592635", "text": "func (r *Range) ReadOnlyCmd(method string, args, reply interface{}) error {\n\tif r == nil {\n\t\treturn util.Errorf(\"invalid node specification\")\n\t}\n\treturn r.executeCmd(method, args, reply)\n}", "title": "" }, { "docid": "63070ce2133e7b9d957ea8b1916a2f65", "score": "0.52580607", "text": "func AddReadOnlyFlag(set *pflag.FlagSet, readOnly *bool) {\n\tset.BoolVarP(readOnly, \"read-only\", \"\", false, \"only do checks that dont require creating resources (i.e. port forwards)\")\n}", "title": "" }, { "docid": "7c54df79af4e678e9a1beb8c3588559a", "score": "0.5200041", "text": "func (m *Setting) SetOverwriteAllowed(value *bool)() {\n err := m.GetBackingStore().Set(\"overwriteAllowed\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "7f0ecb152905440b8751430b2857b4a3", "score": "0.519179", "text": "func BdevLvolSetReadOnly(ctx context.Context, client *Client, args BdevLvolSetReadOnlyArgs) (bool, error) {\n\tvar response bool\n\terr := client.Invoke(ctx, \"bdev_lvol_set_read_only\", args, &response)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn response, err\n}", "title": "" }, { "docid": "c7debe4b0ae0d53ec936ea61f3cea84a", "score": "0.5171802", "text": "func UpdateWorksetReadonlyByName(dbConn *sql.DB, modelId int, name string, isReadonly bool) error {\r\n\r\n\treturn Update(dbConn,\r\n\t\t\"UPDATE workset_lst\"+\r\n\t\t\t\" SET is_readonly = \"+toBoolSqlConst(isReadonly)+\", \"+\" update_dt = \"+ToQuoted(helper.MakeDateTime(time.Now()))+\r\n\t\t\t\" WHERE set_id = (\"+\r\n\t\t\t\" SELECT MIN(W.set_id) FROM workset_lst W\"+\r\n\t\t\t\" WHERE W.model_id = \"+strconv.Itoa(modelId)+\r\n\t\t\t\" AND set_name = \"+ToQuoted(name)+\r\n\t\t\t\")\")\r\n}", "title": "" }, { "docid": "7e78f0a530a4403f6576c502a91d7db2", "score": "0.5166534", "text": "func ReadOnly(ctx context.Context, trx ReadOnlyDB, trxFunc func(dbCtx context.Context) error) error {\n\tdbCtx, err := trx.GetDatabase(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn trxFunc(dbCtx)\n}", "title": "" }, { "docid": "e67a7db582163c63762131d7f26e1567", "score": "0.51595604", "text": "func (orm *Xorm) IsReadOnly() bool {\n\treturn orm.readOnly\n}", "title": "" }, { "docid": "2d46ad2bf0e62416096b2339a4520634", "score": "0.5128538", "text": "func (c *AuditClient) SetImmutable(wm WaitMode) error {\n\tstatus := AuditStatus{\n\t\tMask: AuditStatusEnabled,\n\t\tEnabled: 2,\n\t}\n\treturn c.set(status, wm)\n}", "title": "" }, { "docid": "ad116387fe83ddb523b96eabd8f8deae", "score": "0.50692874", "text": "func setLogicalLock(ctx context.Context, db *sql.DB, desired bool) error {\n\tt := time.NewTicker(1 * time.Second)\n\tdefer t.Stop()\n\n\tfor {\n\t\tresult, err := db.ExecContext(ctx, \"\"+\n\t\t\t\"update __meta set value = ? where `key` = 'locked' and value = ?\",\n\t\t\tboolToString(desired), boolToString(!desired),\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\taffected, err := result.RowsAffected()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif affected == 1 {\n\t\t\treturn nil\n\t\t}\n\n\t\tselect {\n\t\tcase <-t.C:\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "539886fec22b2b7eb8e27fa019d8f17e", "score": "0.49992624", "text": "func WithReadOnly(readOnly bool) OperationExecutorOptionFn {\n\treturn func(executor *OperationExecutor) {\n\t\texecutor.readOnly = readOnly\n\t}\n}", "title": "" }, { "docid": "2528c9fe8f59373c6b0ea0697dda98c2", "score": "0.49717557", "text": "func (rw *NopConn) SetReadDeadline(time.Time) error { return nil }", "title": "" }, { "docid": "42ccd2092fc66e27e7ce80f63afe305c", "score": "0.4962133", "text": "func ReadOnlyHandler(w http.ResponseWriter, r *http.Request, h ROHandler) {\n\tconst True, False = \"true\", \"false\"\n\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\tif r.Method == \"GET\" {\n\t\tmode, err := h.ReadOnlyMode()\n\t\tif err != core.NoError {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tfmt.Fprintf(w, \"Error getting mode: %s\", err)\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t\tif mode {\n\t\t\tw.Write([]byte(True))\n\t\t} else {\n\t\t\tw.Write([]byte(False))\n\t\t}\n\t\treturn\n\t}\n\tif r.Method != \"POST\" {\n\t\tw.WriteHeader(http.StatusMethodNotAllowed)\n\t\tfmt.Fprintln(w, \"method must be POST\")\n\t\treturn\n\t}\n\n\tleaderID := h.LeaderID()\n\tif leaderID == \"\" {\n\t\tw.WriteHeader(http.StatusServiceUnavailable)\n\t\tfmt.Fprintln(w, \"leader is unknown\")\n\t\treturn\n\t}\n\tif leaderID != h.ID() {\n\t\t// Redirect clients to the leader to be nice.\n\t\thttp.Redirect(w, r, fmt.Sprintf(\"http://%s%s\", leaderID, r.RequestURI),\n\t\t\thttp.StatusTemporaryRedirect)\n\t\treturn\n\t}\n\n\tmode := r.URL.Query().Get(\"mode\")\n\tif mode != True && mode != False {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tfmt.Fprintln(w, \"'mode' param must be 'true' or 'false'\")\n\t\treturn\n\t}\n\terr := h.SetReadOnlyMode(mode == True)\n\tif err != core.NoError {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tfmt.Fprintf(w, \"error setting read-only mode: %s\", err)\n\t\tlog.Errorf(\"error setting read-only mode: %s\", err)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\tfmt.Fprintf(w, \"set read-only mode to %s\", mode)\n\tlog.Infof(\"set read-only mode to %s\", mode)\n}", "title": "" }, { "docid": "b1573fa73d43ed4b2f526eb9df0445f5", "score": "0.49548188", "text": "func (m *ServiceUpdateMessageViewpoint) SetIsRead(value *bool)() {\n err := m.GetBackingStore().Set(\"isRead\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "033e7701ffe42665d6f0c87027730468", "score": "0.4934953", "text": "func (db *pgDB) ReadOnly(ctx context.Context) sqlbk.Tx {\n\treturn db.begin(ctx, db.readOnlyOpts)\n}", "title": "" }, { "docid": "63176c5e4a6f531e62e1e1aea71c0c6a", "score": "0.49307883", "text": "func (s *VolumeFrom) SetReadOnly(v bool) *VolumeFrom {\n\ts.ReadOnly = &v\n\treturn s\n}", "title": "" }, { "docid": "95c277d8b6570dc34a10586fc336897e", "score": "0.49027857", "text": "func (o GroupInitContainerVolumeOutput) ReadOnly() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v GroupInitContainerVolume) *bool { return v.ReadOnly }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "ff79ca024649f31686faebc1a004fa49", "score": "0.48995838", "text": "func (mysqld *Mysqld) SetSemiSyncEnabled(primary, replica bool) error {\n\tlog.Infof(\"Setting semi-sync mode: primary=%v, replica=%v\", primary, replica)\n\n\t// Convert bool to int.\n\tvar p, s int\n\tif primary {\n\t\tp = 1\n\t}\n\tif replica {\n\t\ts = 1\n\t}\n\n\terr := mysqld.ExecuteSuperQuery(context.TODO(), fmt.Sprintf(\n\t\t\"SET GLOBAL rpl_semi_sync_master_enabled = %v, GLOBAL rpl_semi_sync_slave_enabled = %v\",\n\t\tp, s))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't set semi-sync mode: %v; make sure plugins are loaded in my.cnf\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9fab43539ae815115691490390c09e44", "score": "0.4893822", "text": "func (lf *logFile) openReadOnly() error {\n\tvar err error\n\tlf.fd, err = os.OpenFile(lf.path, os.O_RDONLY, 0666)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Unable to open %q as RDONLY.\", lf.path)\n\t}\n\n\tfi, err := lf.fd.Stat()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Unable to check stat for %q\", lf.path)\n\t}\n\tlf.size = uint32(fi.Size())\n\treturn nil\n}", "title": "" }, { "docid": "9fab43539ae815115691490390c09e44", "score": "0.4893822", "text": "func (lf *logFile) openReadOnly() error {\n\tvar err error\n\tlf.fd, err = os.OpenFile(lf.path, os.O_RDONLY, 0666)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Unable to open %q as RDONLY.\", lf.path)\n\t}\n\n\tfi, err := lf.fd.Stat()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Unable to check stat for %q\", lf.path)\n\t}\n\tlf.size = uint32(fi.Size())\n\treturn nil\n}", "title": "" }, { "docid": "fe52c0c60f8e419e511b46beb6e35d6f", "score": "0.48909286", "text": "func (c *Conn) SetReadDeadline(t time.Time) error { return c.pc.SetReadDeadline(t) }", "title": "" }, { "docid": "086f5376a881281db4e96b207076bb75", "score": "0.48833576", "text": "func (c *fakeRedisConn) SetReadBuffer(bytes int) {}", "title": "" }, { "docid": "4d97ec9717a6c8041109d9bafa2cc255", "score": "0.48814538", "text": "func (c *Conn) SetReadDeadline(t time.Time) error {\n // return c.conn.SetReadDeadline(t)\n fmt.Println(\"set read deadline\", t)\n return nil\n}", "title": "" }, { "docid": "9e0aeccd23db834f7fd73482a254d57d", "score": "0.48787436", "text": "func (o GroupContainerVolumeOutput) ReadOnly() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v GroupContainerVolume) *bool { return v.ReadOnly }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "beeabc3b7858f173f59782a434dc2d34", "score": "0.48612952", "text": "func (w *ConnWrapper) SetReadDeadline(t time.Time) error {\n\t// TODO: put int Deadline\n\tvar err error\n\tswitch w.conn.(type) {\n\tcase net.Conn:\n\t\tconn := w.conn.(net.Conn)\n\t\terr = conn.SetReadDeadline(t)\n\tdefault:\n\t\tklog.Warningf(\"unsupported conn type: %T\", w.conn)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "e5f28343a9661370d8a25dd08ce51739", "score": "0.48559698", "text": "func ReadOnlySocket(ifaceIdx, queueID uint32, opts ReadOnlySocketOpts) (*ControlBlock, error) {\n\tsockfd, err := unix.Socket(unix.AF_XDP, unix.SOCK_RAW, 0)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create AF_XDP socket: %v\", err)\n\t}\n\treturn ReadOnlyFromSocket(sockfd, ifaceIdx, queueID, opts)\n}", "title": "" }, { "docid": "74a852e4b0751a9e224604356000ef75", "score": "0.48474655", "text": "func ReadOnly(handler http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\tif IsReadOnlyReq(*req) {\n\t\t\thandler.ServeHTTP(w, req)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusForbidden)\n\t\tfmt.Fprintf(w, \"This is a read-only endpoint.\")\n\t})\n}", "title": "" }, { "docid": "9fff9884ecaabbbfce64026f317c19fe", "score": "0.48211572", "text": "func (fs *FileSystem) SetUmask(umask os.FileMode) {\n\tvar data [4]byte\n\n\terr := fs.db.Update(func(tx *bolt.Tx) error {\n\t\tb := newFsBucket(tx)\n\n\t\tbinary.BigEndian.PutUint32(data[:], uint32(umask))\n\t\treturn b.Put(\"umask\", data[:])\n\t})\n\tif err != nil {\n\t\tpanic(\"don't panic! \" + err.Error())\n\t}\n\n}", "title": "" }, { "docid": "123de32572bf8e36552f2e9ed2fdb26b", "score": "0.48120183", "text": "func (c Chan) ReadOnly() ReadChan {\n\treturn (chan struct{})(c)\n}", "title": "" }, { "docid": "2ecf9f40fd55dd3be0f485bca6955ee1", "score": "0.4786391", "text": "func (my *clientConn) SetReadDeadline(t time.Time) error {\n\treturn my.conn.SetReadDeadline(t)\n}", "title": "" }, { "docid": "5b65e48287cc1181c4a8a3babb4674d8", "score": "0.47808632", "text": "func (o ClusterNamespaceOptions) ReadOnly() bool {\n\treturn o.readOnly\n}", "title": "" }, { "docid": "1d6c713b1ae00c7a43fbe0e47ecdd540", "score": "0.4762849", "text": "func (m *wasiSnapshotPreview1Impl) fdFdstatSetRights(pfd wasiFd, pfsRightsBase wasiRights, pfsRightsInheriting wasiRights) (err wasiErrno) {\n\tf, err := m.files.acquireFile(pfd, wasiRightsFdDatasync)\n\tif err != wasiErrnoSuccess {\n\t\treturn err\n\t}\n\tdefer m.files.releaseFile(pfd, f)\n\n\tif f.rights&pfsRightsBase != pfsRightsBase || f.inherit&pfsRightsInheriting != pfsRightsInheriting {\n\t\treturn wasiErrnoNotcapable\n\t}\n\n\tf.rights, f.inherit = pfsRightsBase, pfsRightsInheriting\n\treturn wasiErrnoSuccess\n}", "title": "" }, { "docid": "722974b26b9bef8d85bf4a599a919747", "score": "0.4758586", "text": "func (o FioSpecVolumeVolumeSourceRbdOutput) ReadOnly() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceRbd) *bool { return v.ReadOnly }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "63a10d214c9c031c99fb251f54c54be9", "score": "0.47561732", "text": "func (_BaseAccessWallet *BaseAccessWalletTransactor) SetAccessRights(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _BaseAccessWallet.contract.Transact(opts, \"setAccessRights\")\n}", "title": "" }, { "docid": "49bc99a7a59f3fc3381005d418b68575", "score": "0.47480705", "text": "func (v Volume) IsReadOnly() bool {\n\tfor _, o := range v.Options {\n\t\tif o == \"ro\" {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d5ac4758cdda39d63daffbe946507c43", "score": "0.47446162", "text": "func (_Bucket *BucketTransactor) SetReadPermission(opts *bind.TransactOpts, _fileId *big.Int, _entity common.Address, _permission bool) (*types.Transaction, error) {\n\treturn _Bucket.contract.Transact(opts, \"setReadPermission\", _fileId, _entity, _permission)\n}", "title": "" }, { "docid": "3e3cc2c1466d94e4e2924f1688797a0e", "score": "0.47431767", "text": "func RequestReadonly() QueryOption {\n\treturn func(q *queryOptions) error {\n\t\tq.requestProperties.Options[RequestReadonlyValue] = true\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "99a2e23030444a001f4188b256b463ee", "score": "0.47404668", "text": "func doSetAccess(targetURL string, targetPERMS accessPerms) *probe.Error {\n\tclnt, err := newClient(targetURL)\n\tif err != nil {\n\t\treturn err.Trace(targetURL)\n\t}\n\tpolicy := accessPermToString(targetPERMS)\n\tif err = clnt.SetAccess(policy, false); err != nil {\n\t\treturn err.Trace(targetURL, string(targetPERMS))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "432ed6c4d2fa84d8d57654a9dd1e9a96", "score": "0.4740087", "text": "func (rc *PerWriteDelayConn) SetReadDeadline(t time.Time) error {\n\treturn rc.conn.SetReadDeadline(t)\n}", "title": "" }, { "docid": "cae86b1bba7ef924b1ceea14e42cac27", "score": "0.47365373", "text": "func doRenameWorkset(trx *sql.Tx, setId int, newSetName string, isAnyReadonly bool) (bool, error) {\r\n\r\n\tif newSetName == \"\" {\r\n\t\treturn false, nil // exit if new name is empty: nothing to do\r\n\t}\r\n\r\n\t// \"lock\" workset to prevent update or use by the model\r\n\tsId := strconv.Itoa(setId)\r\n\r\n\terr := TrxUpdate(trx, \"UPDATE workset_lst SET is_readonly = is_readonly + 1 WHERE set_id = \"+sId)\r\n\tif err != nil {\r\n\t\treturn false, err\r\n\t}\r\n\r\n\t// check if workset exist and not readonly\r\n\tvar nRd int = 0\r\n\terr = TrxSelectFirst(trx,\r\n\t\t\"SELECT is_readonly FROM workset_lst WHERE set_id = \"+sId,\r\n\t\tfunc(row *sql.Row) error {\r\n\t\t\tif err := row.Scan(&nRd); err != nil {\r\n\t\t\t\treturn err\r\n\t\t\t}\r\n\t\t\treturn nil\r\n\t\t})\r\n\tswitch {\r\n\tcase err == sql.ErrNoRows:\r\n\t\treturn false, nil // workset not found: nothing to do\r\n\tcase err != nil:\r\n\t\treturn false, err\r\n\tcase !isAnyReadonly && nRd != 1: // return error only if read-only validation required\r\n\t\treturn false, errors.New(\"failed to update: workset is read-only: \" + sId)\r\n\t}\r\n\r\n\t// check if new name is unique\r\n\terr = TrxSelectFirst(trx,\r\n\t\t\"SELECT COUNT(*) FROM workset_lst WHERE set_id <> \"+sId+\" AND set_name = \"+ToQuoted(newSetName),\r\n\t\tfunc(row *sql.Row) error {\r\n\t\t\tnCnt := 0\r\n\t\t\tif err := row.Scan(&nCnt); err != nil {\r\n\t\t\t\treturn err\r\n\t\t\t}\r\n\t\t\tif nCnt != 0 {\r\n\t\t\t\treturn errors.New(\"failed to update: workset name must be unique: \" + newSetName)\r\n\t\t\t}\r\n\t\t\treturn nil\r\n\t\t})\r\n\tif err != nil {\r\n\t\treturn false, err\r\n\t}\r\n\r\n\t// rename workset and\r\n\t// \"unlock\" workset before commit: restore original value of is_readonly\r\n\terr = TrxUpdate(trx,\r\n\t\t\"UPDATE workset_lst\"+\r\n\t\t\t\" SET set_name = \"+toQuotedMax(newSetName, nameDbMax)+\", \"+\r\n\t\t\t\" is_readonly = is_readonly - 1,\"+\r\n\t\t\t\" update_dt = \"+ToQuoted(helper.MakeDateTime(time.Now()))+\r\n\t\t\t\" WHERE set_id =\"+sId)\r\n\tif err != nil {\r\n\t\treturn false, err\r\n\t}\r\n\r\n\treturn true, nil\r\n}", "title": "" }, { "docid": "75c0f1918d7f9ef1e0e5d53c5f513e01", "score": "0.47356787", "text": "func WithReadOnly(path string) string {\n\treturn fmt.Sprintf(\"file:%s?mode=ro\", path)\n}", "title": "" }, { "docid": "a1730401de6eb116e8b03a09df3e38b1", "score": "0.47291964", "text": "func (w *Wrapper) SetMask(c Color, m uint16) error {\n\tcurrent := w32.GetConsoleScreenBufferInfo(w.h)\n\tif current == nil {\n\t\treturn syscall.Errno(w32.GetLastError())\n\t}\n\tif !w32.SetConsoleTextAttribute(w.h, apply(current.WAttributes, uint16(c), uint16(m))) {\n\t\treturn syscall.Errno(w32.GetLastError())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "91a836527b3e03f443b084588d368580", "score": "0.47279105", "text": "func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)", "title": "" }, { "docid": "044f8dadd3493f9b7c6763cbffd174da", "score": "0.47168684", "text": "func (o IopingSpecVolumeVolumeSourceRbdOutput) ReadOnly() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v IopingSpecVolumeVolumeSourceRbd) *bool { return v.ReadOnly }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "d252ce188142b907b8b159ded94afec1", "score": "0.47104254", "text": "func (db *DB) Writable() error {\n\treturn db.master.Ping()\n}", "title": "" }, { "docid": "403ab706dafd79b18ec935bbcc93d986", "score": "0.46901459", "text": "func (o BuildStrategySpecBuildStepsVolumeMountsOutput) ReadOnly() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v BuildStrategySpecBuildStepsVolumeMounts) *bool { return v.ReadOnly }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "607f36e05afad79247ba056b24f17391", "score": "0.46796057", "text": "func (c *Conn) SetReadDeadline(t time.Time) error {\n\treturn fmt.Errorf(\"No supported\")\n}", "title": "" }, { "docid": "a7db3c028bb3bacfca62b078aba84f5b", "score": "0.4674781", "text": "func (_AccessIndexor *AccessIndexorTransactor) SetAccessRights(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _AccessIndexor.contract.Transact(opts, \"setAccessRights\")\n}", "title": "" }, { "docid": "451806e415c9b06ef83606431458bbc0", "score": "0.4670825", "text": "func (c *Container) setDirty(dirty bool) {\n\tif roaringParanoia {\n\t\tif c == nil || c.frozen() {\n\t\t\tpanic(\"setDirty on nil or frozen container\")\n\t\t}\n\t}\n\tif dirty {\n\t\tc.flags |= flagDirty\n\t} else {\n\t\tc.flags &^= flagDirty\n\t}\n}", "title": "" }, { "docid": "268a336b25d140a63e90a405ed4b6e64", "score": "0.46691954", "text": "func (c *cConn) SetReadDeadline(t time.Time) error {\n\treturn syscall.EINVAL\n}", "title": "" }, { "docid": "024db2c09abcd1234fb52fbc232fe6e5", "score": "0.46657315", "text": "func (rw *NopConn) SetWriteDeadline(time.Time) error { return nil }", "title": "" }, { "docid": "caca0d180f53893bf959570f07934afe", "score": "0.46597305", "text": "func (o DiskOutput) ReadOnly() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v Disk) *bool { return v.ReadOnly }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "b97803adb11c2f0bff828ce985d18612", "score": "0.46591833", "text": "func (fmd *FakeMysqlDaemon) SetSemiSyncEnabled(primary, replica bool) error {\n\tfmd.SemiSyncPrimaryEnabled = primary\n\tfmd.SemiSyncReplicaEnabled = replica\n\treturn nil\n}", "title": "" }, { "docid": "2196103e4eb1a4fa1c361059a6d5af4a", "score": "0.4656922", "text": "func (o ClusterBuildStrategySpecBuildStepsVolumeMountsOutput) ReadOnly() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v ClusterBuildStrategySpecBuildStepsVolumeMounts) *bool { return v.ReadOnly }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "6c3e884ec9301905618c890e4a72a2e1", "score": "0.46564895", "text": "func (cerr *CmdError) Readonly() bool {\n\treturn strings.HasPrefix(cerr.Err.Error(), \"READONLY\")\n}", "title": "" }, { "docid": "8d2d9eb407896daf9f897533ac0cba4c", "score": "0.46553135", "text": "func (c Conn) SetReadDeadline(t time.Time) error {\n\treturn c.conn.SetReadDeadline(t)\n}", "title": "" }, { "docid": "0baab8cf0fbbe1b304800b200deae937", "score": "0.46441957", "text": "func (o FioSpecVolumeVolumeSourceScaleIOOutput) ReadOnly() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceScaleIO) *bool { return v.ReadOnly }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "10a15a5163ab35af91e4b9c940ab4cfc", "score": "0.46440366", "text": "func (m *ScheduleItem) SetIsPrivate(value *bool)() {\n err := m.GetBackingStore().Set(\"isPrivate\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "039ce116690d9d230fe5e9b1c3ec8ded", "score": "0.46392635", "text": "func (o FioSpecVolumeVolumeSourceGlusterfsOutput) ReadOnly() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceGlusterfs) *bool { return v.ReadOnly }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "7a59a762ef4a3a7d86d4169d7033e295", "score": "0.46375", "text": "func (c *Conn) SetPrivs(privs map[string]bool) error {\n\treturn SetPrivs(c.Username(), privs)\n}", "title": "" }, { "docid": "e9dd0de4874877567ceabcbb68703805", "score": "0.46324173", "text": "func (o FioSpecVolumeVolumeSourceIscsiOutput) ReadOnly() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceIscsi) *bool { return v.ReadOnly }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "05e2a271b8389d3e7f1df5ef742c7a2e", "score": "0.4632224", "text": "func (o FioSpecVolumeVolumeSourceCinderOutput) ReadOnly() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceCinder) *bool { return v.ReadOnly }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "d03527e0a4dc1a61dc33d3b6cc9cff84", "score": "0.4625056", "text": "func (r *RPCTractserverTalker) SetControlFlags(ctx context.Context, addr string, root string, flags core.DiskControlFlags) core.Error {\n\treq := core.SetControlFlagsReq{Root: root, Flags: flags}\n\tvar reply core.Error\n\tif err := r.cc.Send(ctx, addr, core.SetControlFlagsMethod, req, &reply); err != nil {\n\t\tlog.Errorf(\"SetControlFlags RPC error on tractserver %s: %s\", addr, err)\n\t\treturn core.ErrRPC\n\t}\n\tif reply != core.NoError {\n\t\tlog.Errorf(\"SetControlFlags error on tractserver %s: %s\", addr, reply)\n\t}\n\treturn reply\n}", "title": "" }, { "docid": "2b2276dc1f52215efb9a4aee4b40d41c", "score": "0.4623794", "text": "func (c *RawConnectionMock) SetReadLimit(limit int64) {\n\tc.Called(limit)\n}", "title": "" }, { "docid": "a77712cfb115073de80f837b3bd50c17", "score": "0.46182123", "text": "func (c *connAttrs) SetLegacy(b bool) { c.mu.Lock(); defer c.mu.Unlock(); c._legacy = b }", "title": "" }, { "docid": "928a91ffb9f862ac225f4ea53092190d", "score": "0.46173766", "text": "func (c *ThrottledConn) SetReadDeadline(t time.Time) error {\n\treturn c.originalConn.SetReadDeadline(t)\n}", "title": "" }, { "docid": "1f572388a3e5df62a16f830cd479c5d6", "score": "0.46123308", "text": "func (d *Driver) CreateReadWrite(id, parent string, opts *graphdriver.CreateOpts) error {\n\tlogrus.Debugf(\"secureoverlay2: CreateReadWrite called w. id: %s, parent: %s, opts: %v\", id, parent, opts)\n\treturn d.Create(id, parent, opts)\n}", "title": "" }, { "docid": "4d94a17390974907e82adf2f812ca219", "score": "0.4610431", "text": "func (conn *Conn) SetReadDeadline(t time.Time) error {\n\tif conn, ok := conn.rwc.(net.Conn); ok {\n\t\treturn conn.SetReadDeadline(t)\n\t}\n\n\treturn errSetDeadline\n}", "title": "" } ]
1c819a632b424def31d48e764a73a80f
PerformerOverwritingStreamClientInterceptor calls other service explicitly as the specified user with system role
[ { "docid": "76503cc619c7315b19ab4840476414e6", "score": "0.77062744", "text": "func PerformerOverwritingStreamClientInterceptor(userID string, systemRole *roles.SystemRole) grpc.StreamClientInterceptor {\n\treturn func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) {\n\t\tctx = OverwritePerfomerContext(ctx, userID, userID, systemRole)\n\n\t\treturn streamer(ctx, desc, cc, method, opts...)\n\t}\n}", "title": "" } ]
[ { "docid": "6898da6f2ab635d854268d4356a84d4d", "score": "0.6981439", "text": "func PerformerOverwritingUnaryClientInterceptor(userID string, systemRole *roles.SystemRole) grpc.UnaryClientInterceptor {\n\treturn func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {\n\t\tctx = OverwritePerfomerContext(ctx, userID, userID, systemRole)\n\n\t\treturn invoker(ctx, method, req, reply, cc, opts...)\n\t}\n}", "title": "" }, { "docid": "da58ac012ff9df0892cb5e7d76e5751e", "score": "0.5176395", "text": "func streamInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {\n\t_, err := authenticateClient(ss.Context())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = handler(srv, ss)\n\tif err != nil {\n\t\tfmt.Errorf(\"RPC failed with error %v\", err)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "f13b39094d102cc14ec26f3f313ee0d7", "score": "0.5129967", "text": "func (f *factory) ImpersonateUser(user string) Factory {\n\tcopy := *f\n\tcopy.impersonateUser = user\n\treturn &copy\n}", "title": "" }, { "docid": "3a2f6f100e6e060bf0fcd65e22da56f3", "score": "0.50806236", "text": "func (lad *LogAggregatorDecorator) DecorateService(ctx context.Context,\n\tserviceName string,\n\ttemplate *gof.Template,\n\tlambdaFunctionCode *goflambda.Function_Code,\n\tbuildID string,\n\tawsConfig awsv2.Config,\n\tnoop bool,\n\tlogger *zerolog.Logger) (context.Context, error) {\n\n\t// Create the Kinesis Stream\n\ttemplate.Resources[lad.kinesisStreamResourceName] = lad.kinesisResource\n\n\t// Create the IAM role\n\tputRecordPriv := spartaIAMBuilder.Allow(\"kinesis:PutRecord\").\n\t\tForResource().\n\t\tAttr(lad.kinesisStreamResourceName, \"Arn\").\n\t\tToPolicyStatement()\n\tpassRolePriv := spartaIAMBuilder.Allow(\"iam:PassRole\").\n\t\tForResource().\n\t\tLiteral(\"arn:aws:iam::\").\n\t\tAccountID(\":\").\n\t\tLiteral(\"role/\").\n\t\tLiteral(lad.iamRoleNameResourceName).\n\t\tToPolicyStatement()\n\n\tstatements := make([]spartaIAM.PolicyStatement, 0)\n\tstatements = append(statements,\n\t\tputRecordPriv,\n\t\tpassRolePriv,\n\t)\n\tiamPolicyList := []gofiam.Role_Policy{\n\t\t{\n\t\t\tPolicyDocument: sparta.ArbitraryJSONObject{\n\t\t\t\t\"Version\": \"2012-10-17\",\n\t\t\t\t\"Statement\": statements,\n\t\t\t},\n\t\t\tPolicyName: \"LogAggregatorPolicy\",\n\t\t},\n\t}\n\n\tiamLogAggregatorRole := &gofiam.Role{\n\t\tRoleName: lad.iamRoleNameResourceName,\n\t\tAssumeRolePolicyDocument: LogAggregatorAssumePolicyDocument,\n\t\tPolicies: iamPolicyList,\n\t}\n\ttemplate.Resources[lad.iamRoleNameResourceName] = iamLogAggregatorRole\n\treturn ctx, nil\n}", "title": "" }, { "docid": "66ebca9b1474acc4a9f4b31f0b6e8ad8", "score": "0.4937028", "text": "func OverwritePerfomerContext(ctx context.Context, userID, targetID string, systemRole *roles.SystemRole) context.Context {\n\trb := RoleBindings(map[string]string{\n\t\t\"*\": systemRole.Name,\n\t})\n\n\tif ctx.Value(TargetIDContext) == nil {\n\t\tctx = AddTargetIDContext(ctx, targetID)\n\t}\n\n\tctx = AddUserIDContext(ctx, userID)\n\tctx = AddRolesContext(ctx, rb)\n\tctx = AddPermissionsContext(ctx, getPermissions(rb, \"\"))\n\n\treturn ctx\n}", "title": "" }, { "docid": "bc95f525d96ad018201fbbf00682167e", "score": "0.49090704", "text": "func streamClientInterceptor(logger zerolog.Logger) grpc.StreamClientInterceptor {\n\treturn func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) {\n\t\tlg := newClientLoggerFields(ctx, logger, method)\n\t\tstartTime := time.Now()\n\t\ttoctx := metadata.AppendToOutgoingContext(lg.WithContext(ctx), reqIDHeader, RequestIDFromContext(ctx))\n\t\tclientStream, err := streamer(toctx, desc, cc, method, opts...)\n\t\tlogFinalClientLine(lg, startTime, err, \"finished client streaming call\")\n\t\treturn clientStream, err\n\t}\n}", "title": "" }, { "docid": "a185c19468a6226ec7dedd1441422875", "score": "0.4871651", "text": "func (r *ServiceClusterPostRequest) Impersonate(user string) *ServiceClusterPostRequest {\n\thelpers.AddImpersonationHeader(&r.header, user)\n\treturn r\n}", "title": "" }, { "docid": "bfe68c7792860fe5a0895ecdb7904384", "score": "0.48353842", "text": "func (_e *BlockingConnectionGater_Expecter) InterceptSecured(_a0 interface{}, _a1 interface{}, _a2 interface{}) *BlockingConnectionGater_InterceptSecured_Call {\n\treturn &BlockingConnectionGater_InterceptSecured_Call{Call: _e.mock.On(\"InterceptSecured\", _a0, _a1, _a2)}\n}", "title": "" }, { "docid": "2bca61b20d7576d12cc2ca44b03c5e5b", "score": "0.4834843", "text": "func (c *UserClient) Intercept(interceptors ...Interceptor) {\n\tc.inters.User = append(c.inters.User, interceptors...)\n}", "title": "" }, { "docid": "16d3cd50791cf47e6903976e1c3d080d", "score": "0.47895637", "text": "func (r *ServiceClusterGetRequest) Impersonate(user string) *ServiceClusterGetRequest {\n\thelpers.AddImpersonationHeader(&r.header, user)\n\treturn r\n}", "title": "" }, { "docid": "a14d9eb2d601d84870f36b1d1bd8f382", "score": "0.47856882", "text": "func AssignReadAccess(w http.ResponseWriter, r *http.Request) {\n\trole := r.URL.Query().Get(\"role\");\n\tkey := r.URL.Query().Get(\"key\");\n\n\t// Validate APIKey\n\t// TODO: configure hostname and others\n\tvalidateApiKeyUrl := \"http://\" + config.EmoApiKeyHostForExistingPIIWebAppRegion + \"/tasks/api-key?action=view&APIKey=\" + adminAPIKey + \"&key=\" + key;\n\t_, response := postURL(validateApiKeyUrl);\n\tif strings.Contains(response, \"Unknown key\") {\n\t\tio.WriteString(w, \"Unknown API Key\");\n\t\treturn;\n\t}\n\n\t// Add the policy document\n\tsvc := iam.New(session.New()); // TODO: have one ready when the server starts\n\tparams := &iam.PutRolePolicyInput{\n\t\tRoleName: aws.String(role),\n\t\tPolicyName: aws.String(\"allow-stash-read\"),\n\t\tPolicyDocument: aws.String(emodbStashReadPolicyDocument),\n\t};\n\tresp, err := svc.PutRolePolicy(params);\n\tif err != nil {\n\t\tglog.Error(err.Error());\n\t\tpanic(err);\n\t\treturn;\n\t}\n\tglog.Info(resp.GoString());\n\n\t// Update APIKey\n\tattributeKey := \"read_stash\";\n\taddRoleUrl := \"http://\" + config.EmoApiKeyHostForExistingPIIWebAppRegion + \"/tasks/api-key?action=update_attribute&APIKey=\" + adminAPIKey + \"&key=\" + key + \"&attributeKey=\" + attributeKey + \"&addAttributeValue=\" + role;\n\tstatusCode, _ := postURL(addRoleUrl);\n\tif (statusCode != 200) {\n\t\tio.WriteString(w, \"There was a problem when updating the API key. Returned Response code: \" + string(statusCode));\n\t\treturn;\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\tio.WriteString(w, \"Success\");\n}", "title": "" }, { "docid": "16e4d5639c698ae0fe2941c23ef368aa", "score": "0.47677645", "text": "func (i *StaticInterceptor) StreamInterceptor(srv interface{}, ss grpc.ServerStream, _ *grpc.StreamServerInfo, handler grpc.StreamHandler) error {\n\terr := i.engines.IsAuthorized(ss.Context())\n\tif err != nil {\n\t\tif status.Code(err) == codes.PermissionDenied {\n\t\t\treturn status.Errorf(codes.PermissionDenied, \"unauthorized RPC request rejected\")\n\t\t}\n\t\treturn err\n\t}\n\treturn handler(srv, ss)\n}", "title": "" }, { "docid": "59f33cb441ecbbb5b72b60269aa357b9", "score": "0.46449786", "text": "func (c *RefreshTokenClient) Intercept(interceptors ...Interceptor) {\n\tc.inters.RefreshToken = append(c.inters.RefreshToken, interceptors...)\n}", "title": "" }, { "docid": "70d7d30d4927a561c663596136aae096", "score": "0.4642469", "text": "func (c *OAuth2ClientClient) Intercept(interceptors ...Interceptor) {\n\tc.inters.OAuth2Client = append(c.inters.OAuth2Client, interceptors...)\n}", "title": "" }, { "docid": "8ef94c7ab83dc400acbce84cc22aac48", "score": "0.463992", "text": "func (m *DeviceLogCollectionResponse) SetEnrolledByUser(value *string)() {\n err := m.GetBackingStore().Set(\"enrolledByUser\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "4ea72c39c283698ca0004f3baf4bd050", "score": "0.46272647", "text": "func (p *Proxy) Impersonate(w http.ResponseWriter, r *http.Request) {\n\tsession, err := sessions.FromContext(r.Context())\n\tif err != nil {\n\t\thttputil.ErrorResponse(w, r, err)\n\t\treturn\n\t}\n\tisAdmin, err := p.AuthorizeClient.IsAdmin(r.Context(), session)\n\tif err != nil || !isAdmin {\n\t\thttputil.ErrorResponse(w, r, httputil.Error(fmt.Sprintf(\"%s is not an administrator\", session.RequestEmail()), http.StatusForbidden, err))\n\t\treturn\n\t}\n\t// OK to impersonation\n\tsession.ImpersonateEmail = r.FormValue(\"email\")\n\tsession.ImpersonateGroups = strings.Split(r.FormValue(\"group\"), \",\")\n\n\tif err := p.sessionStore.SaveSession(w, r, session); err != nil {\n\t\thttputil.ErrorResponse(w, r, err)\n\t\treturn\n\t}\n\n\thttp.Redirect(w, r, \"/.pomerium\", http.StatusFound)\n}", "title": "" }, { "docid": "d9624c479ca754f21d53cb4cfe961238", "score": "0.46153677", "text": "func streamAuthInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {\n\t// md 的值类似于: map[:authority:[192.168.40.123:50051] authorization:[Bearer some-secret-token] content-type:[application/grpc] user-agent:[grpc-go/1.20.1]]\n\tmd, ok := metadata.FromIncomingContext(ss.Context())\n\tif !ok {\n\t\treturn status.Errorf(codes.InvalidArgument, \"missing metadata\")\n\t}\n\tfmt.Printf(\"Type of 'metadata.MD' is %T, and its value is %v \\n\", md, md)\n\n\t// 1. 判断是否存在 authorization 请求头\n\tauthorization, ok := md[\"authorization\"]\n\tif !ok {\n\t\treturn status.Errorf(codes.Unauthenticated, `missing \"Authorization\" header`)\n\t}\n\tfmt.Printf(\"Type of 'authorization' is %T, and its value is %v \\n\", authorization, authorization)\n\n\tconst prefix = \"Bearer \"\n\n\t// 2. 如果存在 authorization 请求头的话,则 md[\"authorization\"] 是一个 []string\n\tif !strings.HasPrefix(authorization[0], prefix) {\n\t\treturn status.Errorf(codes.Unauthenticated, `missing \"Bearer \" prefix in \"Authorization\" header`)\n\t}\n\n\t// 3. 验证 token 是否一致\n\tif token := strings.TrimPrefix(authorization[0], prefix); token != \"some-oauth2-secret-token\" {\n\t\treturn status.Errorf(codes.Unauthenticated, \"invalid token\")\n\t}\n\n\t// 调用 RPC\n\terr := handler(srv, ss)\n\tif err != nil {\n\t\tlog.Printf(\"failed to invoke Streaming RPC: %v\\n\", err)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "3794305cb8e589b2167d3317d10983df", "score": "0.45627612", "text": "func (client PoolClient) UpgradeOSSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client, req)\n}", "title": "" }, { "docid": "aa979b8943776439f2e98e18673df047", "score": "0.45585495", "text": "func PayloadStreamClientInterceptor(entry *logrus.Entry, decider grpc_logging.ClientPayloadLoggingDecider) grpc.StreamClientInterceptor {\n\treturn func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) {\n\t\tif !decider(ctx, method) {\n\t\t\treturn streamer(ctx, desc, cc, method, opts...)\n\t\t}\n\t\tlogEntry := entry.WithFields(newClientLoggerFields(ctx, method))\n\t\tclientStream, err := streamer(ctx, desc, cc, method, opts...)\n\t\tnewStream := &loggingClientStream{ClientStream: clientStream, entry: logEntry}\n\t\treturn newStream, err\n\t}\n}", "title": "" }, { "docid": "5be41a661b53c498f568dfb76ac2d99a", "score": "0.45311302", "text": "func proxy_auth_pipeline(message *HTTPMessage, loc *Location) {\n\n\tswitch loc.Auth.AuthType {\n\tcase \"basic\":\n\t\terr := loc.Auth.Authenticate(message.rheaders[\"Authorization\"])\n\n\t\tif err != nil {\n\t\t\tmessage.authenticated = false\n\t\t}\n\n\tdefault:\n\t\tmessage.authenticated = true\n\t}\n\n}", "title": "" }, { "docid": "18d3c73d4a313d25c01aafb7f8ed5e8f", "score": "0.4525416", "text": "func (c *ExchangeClient) Intercept(interceptors ...Interceptor) {\n\tc.inters.Exchange = append(c.inters.Exchange, interceptors...)\n}", "title": "" }, { "docid": "90151cbdb50a091d6185585d4d689d94", "score": "0.44982666", "text": "func StreamClientInterceptor(opts ...Option) grpc.StreamClientInterceptor {\n\tset := newOptionSet(rkgrpcinter.RpcTypeStreamClient, opts...)\n\n\treturn func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) {\n\t\trkgrpcinter.AddToClientContextPayload(ctx, rkgrpcinter.RpcEntryNameKey, set.EntryName)\n\n\t\t// Before invoking\n\t\tclientBefore(ctx, set)\n\n\t\t// Add outgoing md to context\n\t\tctx = rkgrpcinter.MergeToOutgoingMD(ctx, *rkgrpcinter.GetOutgoingHeadersOfClient(ctx))\n\n\t\t// Invoking\n\t\treturn streamer(ctx, desc, cc, method, opts...)\n\t}\n}", "title": "" }, { "docid": "bff0c2e4672f44c64fd0753fe12065e4", "score": "0.4480676", "text": "func StreamClientInterceptor(opts ...Option) grpc.StreamClientInterceptor {\n\to := evaluateOptions(opts)\n\treturn func(parentCtx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) {\n\t\tkv := metadataFromContext(o, parentCtx)\n\t\tif len(kv) == 0 {\n\t\t\treturn streamer(parentCtx, desc, cc, method, opts...)\n\t\t}\n\n\t\tnewCtx := metadata.AppendToOutgoingContext(parentCtx, kv...)\n\t\treturn streamer(newCtx, desc, cc, method, opts...)\n\t}\n}", "title": "" }, { "docid": "dae1dfaf62536e21cb5a9547b7069fa8", "score": "0.44653392", "text": "func translateLegacyScopeImpersonation(handler http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\tfor _, scope := range req.Header[legacyImpersonateUserScopeHeader] {\n\t\t\treq.Header[authenticationv1.ImpersonateUserExtraHeaderPrefix+authorizationv1.ScopesKey] =\n\t\t\t\tappend(req.Header[authenticationv1.ImpersonateUserExtraHeaderPrefix+authorizationv1.ScopesKey], scope)\n\t\t}\n\n\t\thandler.ServeHTTP(w, req)\n\t})\n}", "title": "" }, { "docid": "96ab1030586c1cef4a6d1890bcf8a5a4", "score": "0.44317725", "text": "func (client *NimbusClient) processSecurityProfileEvent(evt netproto.SecurityProfileEvent, reactor SecurityProfileReactor, ostream *SecurityProfileOStream) error {\n\tvar err error\n\tclient.waitGrp.Add(1)\n\tdefer client.waitGrp.Done()\n\n\t// add venice label to the object\n\tevt.SecurityProfile.ObjectMeta.Labels = make(map[string]string)\n\tevt.SecurityProfile.ObjectMeta.Labels[\"CreatedBy\"] = \"Venice\"\n\n\tlog.Infof(\"SecurityProfile: processSecurityProfileEvent | Evt: %s | SecurityProfile: %s\", evt.EventType, evt.SecurityProfile.GetKey())\n\t// unlock the object once we are done\n\tdefer client.unlockObject(evt.SecurityProfile.GetObjectKind(), evt.SecurityProfile.ObjectMeta)\n\n\t// retry till successful\n\tfor iter := 0; iter < maxOpretry; iter++ {\n\t\tswitch evt.EventType {\n\t\tcase api.EventType_CreateEvent:\n\t\t\tfallthrough\n\t\tcase api.EventType_UpdateEvent:\n\n\t\t\t_, err = reactor.HandleSecurityProfile(types.Get, evt.SecurityProfile)\n\n\t\t\tif err != nil {\n\t\t\t\t// create the SecurityProfile\n\n\t\t\t\t_, err = reactor.HandleSecurityProfile(types.Create, evt.SecurityProfile)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(errors.Wrapf(types.ErrNimbusHandling, \"Op: %s | Kind: SecurityProfile | Key: %s | Err: %v\", types.Operation(types.Create), evt.SecurityProfile.GetKey(), err))\n\t\t\t\t\tclient.debugStats.AddInt(\"CreateSecurityProfileError\", 1)\n\t\t\t\t} else {\n\t\t\t\t\tclient.debugStats.AddInt(\"CreateSecurityProfile\", 1)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// update the SecurityProfile\n\n\t\t\t\t_, err = reactor.HandleSecurityProfile(types.Update, evt.SecurityProfile)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(errors.Wrapf(types.ErrNimbusHandling, \"Op: %s | Kind: SecurityProfile | Key: %s | Err: %v\", types.Operation(types.Update), evt.SecurityProfile.GetKey(), err))\n\t\t\t\t\tclient.debugStats.AddInt(\"UpdateSecurityProfileError\", 1)\n\t\t\t\t} else {\n\t\t\t\t\tclient.debugStats.AddInt(\"UpdateSecurityProfile\", 1)\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase api.EventType_DeleteEvent:\n\t\t\t// update the SecurityProfile\n\n\t\t\t_, err = reactor.HandleSecurityProfile(types.Delete, evt.SecurityProfile)\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(errors.Wrapf(types.ErrNimbusHandling, \"Op: %s | Kind: SecurityProfile | Key: %s | Err: %v\", types.Operation(types.Delete), evt.SecurityProfile.GetKey(), err))\n\t\t\t\tclient.debugStats.AddInt(\"DeleteSecurityProfileError\", 1)\n\t\t\t} else {\n\t\t\t\tclient.debugStats.AddInt(\"DeleteSecurityProfile\", 1)\n\t\t\t}\n\t\t}\n\n\t\tif ostream == nil {\n\t\t\treturn err\n\t\t}\n\t\t// send oper status and return if there is no error\n\t\tif err == nil {\n\n\t\t\trobj := netproto.SecurityProfileEvent{\n\t\t\t\tEventType: evt.EventType,\n\t\t\t\tSecurityProfile: netproto.SecurityProfile{\n\n\t\t\t\t\tTypeMeta: evt.SecurityProfile.TypeMeta,\n\t\t\t\t\tObjectMeta: evt.SecurityProfile.ObjectMeta,\n\t\t\t\t\tStatus: evt.SecurityProfile.Status,\n\t\t\t\t},\n\t\t\t}\n\n\t\t\t// send oper status\n\t\t\tostream.Lock()\n\t\t\tmodificationTime, _ := protoTypes.TimestampProto(time.Now())\n\t\t\trobj.SecurityProfile.ObjectMeta.ModTime = api.Timestamp{Timestamp: *modificationTime}\n\n\t\t\terr := ostream.stream.Send(&robj)\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"failed to send SecurityProfile oper Status, %s\", err)\n\t\t\t\tclient.debugStats.AddInt(\"SecurityProfileOperSendError\", 1)\n\t\t\t} else {\n\t\t\t\tclient.debugStats.AddInt(\"SecurityProfileOperSent\", 1)\n\t\t\t}\n\t\t\tostream.Unlock()\n\n\t\t\treturn err\n\t\t}\n\n\t\t// else, retry after some time, with backoff\n\t\ttime.Sleep(time.Second * time.Duration(2*iter))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e99b709306c0df4e5e8a0da78a5f5e99", "score": "0.44167638", "text": "func TestSetStreamReadonlyPropagate(t *testing.T) {\n\tdefer cleanupStorage(t)\n\n\t// Configure first server.\n\ts1Config := getTestConfig(\"a\", true, 0)\n\ts1 := runServerWithConfig(t, s1Config)\n\tdefer s1.Stop()\n\n\t// Configure second server.\n\ts2Config := getTestConfig(\"b\", false, 5050)\n\ts2 := runServerWithConfig(t, s2Config)\n\tdefer s2.Stop()\n\n\t// Connect and send the request to the follower.\n\tclient, err := lift.Connect([]string{\"localhost:5050\"})\n\trequire.NoError(t, err)\n\tdefer client.Close()\n\n\tctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)\n\tdefer cancel()\n\tname := \"foo\"\n\terr = client.CreateStream(ctx, \"foo\", name)\n\trequire.NoError(t, err)\n\n\t// Set the stream as readonly on follower.\n\terr = client.SetStreamReadonly(context.Background(), name)\n\trequire.NoError(t, err)\n\n\tcheckPartitionReadonly(t, 5*time.Second, name, 0, true, s1)\n\tcheckPartitionReadonly(t, 5*time.Second, name, 0, true, s2)\n\n\t// Remove the readonly flag from the stream on follower.\n\terr = client.SetStreamReadonly(context.Background(), name, lift.Readonly(false))\n\trequire.NoError(t, err)\n\n\tcheckPartitionReadonly(t, 5*time.Second, name, 0, false, s1)\n\tcheckPartitionReadonly(t, 5*time.Second, name, 0, false, s2)\n}", "title": "" }, { "docid": "b5fa086d70c8bb60431493d3a9bfd993", "score": "0.4416537", "text": "func (s service) emitAppendPermissions(ctx context.Context, appUuid, joinedUser string) error {\n\twithCancel, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\n\tvar errC = make(chan error)\n\temitterEvent := ports.NewPermissionEvent(appUuid, joinedUser)\n\n\tgo s.emitterAppToken.EmitAppendPermissions(withCancel, emitterEvent, errC)\n\tgo s.emitterAppConf.EmitAppendPermissions(withCancel, emitterEvent, errC)\n\t// go s.emitterUserPermissions.Emit(withCancel, emitterEvent, errC)\n\n\tfor i := 0; i < 2; i++ {\n\t\terr := <-errC\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"[inviting.EmitAppendPermissions] emit cause error: %v\\n\", err)\n\t\t\t// if there is an error while emitting events\n\t\t\t// here the emiited events must succed in order for the\n\t\t\t// transaction to succeed - hence if err cancel context and\n\t\t\t// role back (if that would have been implmeneted)\n\t\t\treturn err\n\t\t}\n\t}\n\tclose(errC)\n\treturn nil\n}", "title": "" }, { "docid": "7081c67a1b3a4c3f5eafac49c38c62f5", "score": "0.44089332", "text": "func (c *AuthRequestClient) Intercept(interceptors ...Interceptor) {\n\tc.inters.AuthRequest = append(c.inters.AuthRequest, interceptors...)\n}", "title": "" }, { "docid": "c2f12512a2b30502f0ca2a79906f225e", "score": "0.44080767", "text": "func (t Tripperware) DecorateClient(client *http.Client, clone bool) *http.Client {\n\tif client == nil {\n\t\tclient = http.DefaultClient\n\t}\n\tif clone {\n\t\tc := *client\n\t\tclient = &c\n\t}\n\tif client.Transport == nil {\n\t\tclient.Transport = http.DefaultTransport\n\t}\n\tclient.Transport = t(client.Transport)\n\treturn client\n}", "title": "" }, { "docid": "2aed01ff9c690248b0e572240ec74085", "score": "0.44073078", "text": "func (c *ApiService) StreamServiceRole(ChatServiceSid string, params *ListServiceRoleParams) (chan ConversationsV1ServiceRole, chan error) {\n\tif params == nil {\n\t\tparams = &ListServiceRoleParams{}\n\t}\n\tparams.SetPageSize(client.ReadLimits(params.PageSize, params.Limit))\n\n\trecordChannel := make(chan ConversationsV1ServiceRole, 1)\n\terrorChannel := make(chan error, 1)\n\n\tresponse, err := c.PageServiceRole(ChatServiceSid, params, \"\", \"\")\n\tif err != nil {\n\t\terrorChannel <- err\n\t\tclose(recordChannel)\n\t\tclose(errorChannel)\n\t} else {\n\t\tgo c.streamServiceRole(response, params, recordChannel, errorChannel)\n\t}\n\n\treturn recordChannel, errorChannel\n}", "title": "" }, { "docid": "d7de047139bac69dae00e0dc8fc533b4", "score": "0.439607", "text": "func (c *ConnectorClient) Intercept(interceptors ...Interceptor) {\n\tc.inters.Connector = append(c.inters.Connector, interceptors...)\n}", "title": "" }, { "docid": "d3c28ff5eab1eb5896c10c67260008a4", "score": "0.43916413", "text": "func StreamClientInterceptor(opts ...Option) grpc.StreamClientInterceptor {\n\tcfg := newConfig(opts)\n\treturn func(\n\t\tctx context.Context,\n\t\tdesc *grpc.StreamDesc,\n\t\tcc *grpc.ClientConn,\n\t\tmethod string,\n\t\tstreamer grpc.Streamer,\n\t\tcallOpts ...grpc.CallOption,\n\t) (grpc.ClientStream, error) {\n\t\ti := &InterceptorInfo{\n\t\t\tMethod: method,\n\t\t\tType: StreamClient,\n\t\t}\n\t\tif cfg.Filter != nil && !cfg.Filter(i) {\n\t\t\treturn streamer(ctx, desc, cc, method, callOpts...)\n\t\t}\n\n\t\trequestMetadata, _ := metadata.FromOutgoingContext(ctx)\n\t\tmetadataCopy := requestMetadata.Copy()\n\n\t\ttracer := cfg.TracerProvider.Tracer(\n\t\t\tinstrumentationName,\n\t\t\ttrace.WithInstrumentationVersion(SemVersion()),\n\t\t)\n\n\t\tname, attr := spanInfo(method, cc.Target())\n\t\tvar span trace.Span\n\t\tctx, span = tracer.Start(\n\t\t\tctx,\n\t\t\tname,\n\t\t\ttrace.WithSpanKind(trace.SpanKindClient),\n\t\t\ttrace.WithAttributes(attr...),\n\t\t)\n\n\t\tinject(ctx, &metadataCopy, cfg.Propagators)\n\t\tctx = metadata.NewOutgoingContext(ctx, metadataCopy)\n\n\t\ts, err := streamer(ctx, desc, cc, method, callOpts...)\n\t\tif err != nil {\n\t\t\tgrpcStatus, _ := status.FromError(err)\n\t\t\tspan.SetStatus(codes.Error, grpcStatus.Message())\n\t\t\tspan.SetAttributes(statusCodeAttr(grpcStatus.Code()))\n\t\t\tspan.End()\n\t\t\treturn s, err\n\t\t}\n\t\tstream := wrapClientStream(ctx, s, desc)\n\n\t\tgo func() {\n\t\t\terr := <-stream.finished\n\n\t\t\tif err != nil {\n\t\t\t\ts, _ := status.FromError(err)\n\t\t\t\tspan.SetStatus(codes.Error, s.Message())\n\t\t\t\tspan.SetAttributes(statusCodeAttr(s.Code()))\n\t\t\t} else {\n\t\t\t\tspan.SetAttributes(statusCodeAttr(grpc_codes.OK))\n\t\t\t}\n\n\t\t\tspan.End()\n\t\t}()\n\n\t\treturn stream, nil\n\t}\n}", "title": "" }, { "docid": "b408b84948607d0ca1aa8708d9202476", "score": "0.43764263", "text": "func (c *DataSourceClient) Intercept(interceptors ...Interceptor) {\n\tc.inters.DataSource = append(c.inters.DataSource, interceptors...)\n}", "title": "" }, { "docid": "83f1c2556bbfe9d880d3a5bcfda16906", "score": "0.43644804", "text": "func (c *OfflineSessionClient) Intercept(interceptors ...Interceptor) {\n\tc.inters.OfflineSession = append(c.inters.OfflineSession, interceptors...)\n}", "title": "" }, { "docid": "f551f474b16a9d6024fe64aee5210316", "score": "0.4362618", "text": "func (r *AddonUpgradePolicyUpdateRequest) Impersonate(user string) *AddonUpgradePolicyUpdateRequest {\n\thelpers.AddImpersonationHeader(&r.header, user)\n\treturn r\n}", "title": "" }, { "docid": "17f2a6684bec1681e924aa3b8526461f", "score": "0.43571004", "text": "func (r *AddonUpgradePolicyGetRequest) Impersonate(user string) *AddonUpgradePolicyGetRequest {\n\thelpers.AddImpersonationHeader(&r.header, user)\n\treturn r\n}", "title": "" }, { "docid": "bbb2c09ae0685e0d8ce0b837e59aa3b2", "score": "0.43505296", "text": "func (s *BaseSqlBase4GoListener) EnterCurrentUserGrantor(ctx *CurrentUserGrantorContext) {}", "title": "" }, { "docid": "f014aa4fdfb48b5dd1262081c6446ff9", "score": "0.43272215", "text": "func (_EcdsaSortitionPool *EcdsaSortitionPoolFilterer) WatchChaosnetOwnerRoleTransferred(opts *bind.WatchOpts, sink chan<- *EcdsaSortitionPoolChaosnetOwnerRoleTransferred) (event.Subscription, error) {\n\n\tlogs, sub, err := _EcdsaSortitionPool.contract.WatchLogs(opts, \"ChaosnetOwnerRoleTransferred\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(EcdsaSortitionPoolChaosnetOwnerRoleTransferred)\n\t\t\t\tif err := _EcdsaSortitionPool.contract.UnpackLog(event, \"ChaosnetOwnerRoleTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "d5e4bc0ad9a7aff274c1a9c3f935ba6a", "score": "0.43162882", "text": "func authorisedFor(r *http.Request, service string) errors.Error {\n\t// only bother if trying to hit kernel\n\tif !strings.HasPrefix(service, \"com.HailoOSS.kernel.\") {\n\t\treturn nil\n\t}\n\n\tsessId := r.URL.Query().Get(\"session_id\")\n\tif sessId == \"\" {\n\t\tsessId = r.Form.Get(\"session_id\")\n\t}\n\n\tscope := auth.New()\n\tif sessId != \"\" {\n\t\tscope.RecoverSession(sessId)\n\t}\n\n\tif scope.IsAuth() && scope.AuthUser().HasRole(\"ADMIN\") {\n\t\treturn nil\n\t}\n\n\treturn errors.Forbidden(\"com.HailoOSS.api.rpc.auth\", \"Permission denied.\", \"5\")\n}", "title": "" }, { "docid": "e0c9082c374b15b1ffe99db52ed8740f", "score": "0.43031618", "text": "func ExampleClient_AttachRolePolicyRequest_shared00() {\n\tcfg, err := external.LoadDefaultAWSConfig()\n\tif err != nil {\n\t\tpanic(\"failed to load config, \" + err.Error())\n\t}\n\n\tsvc := iam.New(cfg)\n\tinput := &iam.AttachRolePolicyInput{\n\t\tPolicyArn: aws.String(\"arn:aws:iam::aws:policy/ReadOnlyAccess\"),\n\t\tRoleName: aws.String(\"ReadOnlyRole\"),\n\t}\n\n\treq := svc.AttachRolePolicyRequest(input)\n\tresult, err := req.Send(context.Background())\n\tif err != nil {\n\t\tif aerr, ok := err.(awserr.Error); ok {\n\t\t\tswitch aerr.Code() {\n\t\t\tcase iam.ErrCodeNoSuchEntityException:\n\t\t\t\tfmt.Println(iam.ErrCodeNoSuchEntityException, aerr.Error())\n\t\t\tcase iam.ErrCodeLimitExceededException:\n\t\t\t\tfmt.Println(iam.ErrCodeLimitExceededException, aerr.Error())\n\t\t\tcase iam.ErrCodeInvalidInputException:\n\t\t\t\tfmt.Println(iam.ErrCodeInvalidInputException, aerr.Error())\n\t\t\tcase iam.ErrCodeUnmodifiableEntityException:\n\t\t\t\tfmt.Println(iam.ErrCodeUnmodifiableEntityException, aerr.Error())\n\t\t\tcase iam.ErrCodePolicyNotAttachableException:\n\t\t\t\tfmt.Println(iam.ErrCodePolicyNotAttachableException, aerr.Error())\n\t\t\tcase iam.ErrCodeServiceFailureException:\n\t\t\t\tfmt.Println(iam.ErrCodeServiceFailureException, 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": "f54bbedb2d06110b239fe148c86ec19e", "score": "0.4286844", "text": "func (s service) emitRollbackAppendPermissions(ctx context.Context, appUuid, joinedUser string) error {\n\twithCancel, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\n\tvar errC = make(chan error)\n\temitterEvent := ports.NewPermissionEvent(appUuid, joinedUser)\n\n\tgo s.emitterAppToken.EmitRollbackAppendPermissions(withCancel, emitterEvent, errC)\n\tgo s.emitterAppConf.EmitRollbackAppendPermissions(withCancel, emitterEvent, errC)\n\n\t// go s.emitterUserPermissions.Emit(withCancel, emitterEvent, errC)\n\n\tfor i := 0; i < 2; i++ {\n\t\terr := <-errC\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"[inviting.EmitRollbackAppendPermissions] emit cause error: %v\\n\", err)\n\t\t\t// if there is an error while emitting the rollback event\n\t\t\t// ignore error since at least one error is to be expected since an error happend in the forward\n\t\t\t// transaction\n\t\t\tcontinue\n\t\t}\n\t}\n\tclose(errC)\n\treturn nil\n}", "title": "" }, { "docid": "27565940ae8b2f8900fae4dc0feba7e3", "score": "0.42824236", "text": "func (t Tripperwares) DecorateClient(client *http.Client, clone bool) *http.Client {\n\tif client == nil {\n\t\tclient = http.DefaultClient\n\t}\n\tif clone {\n\t\tc := *client\n\t\tclient = &c\n\t}\n\tclient.Transport = t.DecorateRoundTripper(client.Transport)\n\treturn client\n}", "title": "" }, { "docid": "d0ca9d96ce80f1c2298f06c8dfe3aec8", "score": "0.42686263", "text": "func (p *xyzProvider) StreamInvoke(_ *rpc.InvokeRequest, _ rpc.ResourceProvider_StreamInvokeServer) error {\n\treturn status.Error(codes.Unimplemented, \"StreamInvoke is not yet implemented\")\n}", "title": "" }, { "docid": "8d9db23081281d65356bf03dc7fffa14", "score": "0.42658082", "text": "func (c *RoleClient) Use(hooks ...Hook) {\n\tc.hooks.Role = append(c.hooks.Role, hooks...)\n}", "title": "" }, { "docid": "8d9db23081281d65356bf03dc7fffa14", "score": "0.42658082", "text": "func (c *RoleClient) Use(hooks ...Hook) {\n\tc.hooks.Role = append(c.hooks.Role, hooks...)\n}", "title": "" }, { "docid": "43088d6044be80bef9fb20b337cc772e", "score": "0.42628533", "text": "func (c *TodoClient) Intercept(interceptors ...Interceptor) {\n\tc.inters.Todo = append(c.inters.Todo, interceptors...)\n}", "title": "" }, { "docid": "0769bf0cb2e401a8b435ee6ac0a773bb", "score": "0.4252379", "text": "func (t tracing) PatchUser(w http.ResponseWriter, r *http.Request) {\n\tt.next.PatchUser(w, r)\n}", "title": "" }, { "docid": "2f1485dc0b17164afe380ad7fa9d86cd", "score": "0.42464074", "text": "func (sub *SubManager) Subscribe(forced bool) error {\n\tnewRole := newUserRole(sub.consensusData.GetUserRole())\n\tif newRole == sub.role && !forced { // Not forced => no need to subscribe when role stays the same\n\t\treturn nil\n\t}\n\tpubKey, _ := sub.consensusData.GetCurrentMiningPublicKey()\n\tLogger.Infof(\"role %v %v %v, key %v\", newRole.role, newRole.layer, newRole.shardID, pubKey)\n\tif (newRole.role != \"\") && (newRole.role != \"dummyRole\") {\n\t\tif pubKey == \"\" {\n\t\t\treturn errors.Errorf(\"Can not load current mining key, pub key %v role %v\", pubKey, sub.role.role)\n\t\t} else {\n\t\t\tsub.pubkey = pubKey\n\t\t}\n\t}\n\n\tLogger.Infof(\"Role changed: %v -> %v\", sub.role, newRole)\n\n\t// Registering\n\tshardIDs := getWantedShardIDs(newRole, sub.nodeMode, sub.relayShard)\n\t// Logger.Infof(\"[bftmsg] Regist\", params ...interface{})\n\tnewTopics, roleOfTopics, err := sub.registerToProxy(\n\t\tsub.pubkey,\n\t\tnewRole.layer,\n\t\tnewRole.role,\n\t\tshardIDs,\n\t)\n\tif err != nil {\n\t\treturn err // Don't save new role and topics since we need to retry later\n\t}\n\n\t// NOTE: disabled, highway always return the same role\n\t_ = roleOfTopics\n\t// if newRole != roleOfTopics {\n\t// \treturn role, topics, errors.Errorf(\"lole not matching with highway, local = %+v, highway = %+v\", newRole, roleOfTopics)\n\t// }\n\n\tLogger.Debugf(\"Received topics = %+v, oldTopics = %+v\", newTopics, sub.topics)\n\n\t// Subscribing\n\tif err := sub.subscribeNewTopics(newTopics, sub.topics, forced); err != nil {\n\t\treturn err\n\t}\n\n\tsub.role = newRole\n\tsub.topics = newTopics\n\treturn nil\n}", "title": "" }, { "docid": "3a398dbe65694f5b30b6f81c07cd891a", "score": "0.42459014", "text": "func OpenTracingClientInterceptor(tracer opentracing.Tracer, spanName string) interceptor.ClientInterceptor {\n\n\treturn func (ctx context.Context, req, rsp interface{}, ivk interceptor.Invoker) error {\n\n\t\t//var parentCtx opentracing.SpanContext\n\t\t//\n\t\t//if parent := opentracing.SpanFromContext(ctx); parent != nil {\n\t\t//\tparentCtx = parent.Context()\n\t\t//}\n\n\t\t//clientSpan := tracer.StartSpan(spanName, ext.SpanKindRPCClient, opentracing.ChildOf(parentCtx))\n\t\tclientSpan := tracer.StartSpan(spanName, ext.SpanKindRPCClient)\n\t\tdefer clientSpan.Finish()\n\n\t\tmdCarrier := &jaegerCarrier{}\n\n\t\tif err := tracer.Inject(clientSpan.Context(), opentracing.HTTPHeaders, mdCarrier); err != nil {\n\t\t\tclientSpan.LogFields(log.String(\"event\", \"Tracer.Inject() failed\"), log.Error(err))\n\t\t}\n\n\t\tclientSpan.LogFields(log.String(\"spanName\", spanName))\n\n\t\treturn ivk(ctx, req, rsp)\n\n\t}\n}", "title": "" }, { "docid": "34d25a80dbe1bae19226eb9dbff6b0a7", "score": "0.42381257", "text": "func OpenTracingClientInterceptor(tracer opentracing.Tracer, spanName string) interceptor.ClientInterceptor {\n\treturn func (ctx context.Context, req, rsp interface{}, ivk interceptor.Invoker) error {\n\n\t\t//clientSpan := tracer.StartSpan(spanName, ext.SpanKindRPCClient, opentracing.ChildOf(parentCtx))\n\t\tclientSpan := tracer.StartSpan(spanName, ext.SpanKindRPCClient)\n\t\tdefer clientSpan.Finish()\n\n\t\tmdCarrier := &jaegerCarrier{}\n\n\t\tif err := tracer.Inject(clientSpan.Context(), opentracing.HTTPHeaders, mdCarrier); err != nil {\n\t\t\tclientSpan.LogFields(log.String(\"event\", \"Tracer.Inject() failed\"), log.Error(err))\n\t\t}\n\n\t\tclientSpan.LogFields(log.String(\"spanName\", spanName))\n\n\t\treturn ivk(ctx, req, rsp)\n\n\t}\n}", "title": "" }, { "docid": "4f5331ef0d49d624a3bb526bf2c6f5aa", "score": "0.42380047", "text": "func instanceIDStreamInterceptor(instanceID string) grpc.StreamClientInterceptor {\n\treturn func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) {\n\t\treturn streamer(metadata.AppendToOutgoingContext(ctx, metadataInstanceID, instanceID), desc, cc, method, opts...)\n\t}\n}", "title": "" }, { "docid": "d7910272452ce3b0de57f637ba8710ee", "score": "0.4236223", "text": "func (client MachineLearningComputeClient) SystemUpdateResponder(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": "e9e7d5e37bfda4ffa7272c4cea4c0fce", "score": "0.42354953", "text": "func (s *Service) Rollout() error {\n\tlog.Println(\"Rollout service \" + s.Name + \" config \" + s.Version)\n\n\top, err := s.api.Services.Rollouts.Create(s.Name, &mgmt.Rollout{\n\t\tTrafficPercentStrategy: &mgmt.TrafficPercentStrategy{\n\t\t\tPercentages: map[string]float64{s.Version: 100.},\n\t\t},\n\t}).Do()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn s.AwaitDone(op)\n}", "title": "" }, { "docid": "90575a04099b95f4d24ef9e43d690bb1", "score": "0.42327487", "text": "func (mw *loggingMiddleware) AddRoleForUser(ctx context.Context, enforcer EnforcerHandler, user, role string) (result bool, err error) {\n\tdefer func() {\n\t\tmw.logger.Log(\"method\", \"AddRoleForUser\", \"enforcer\", enforcer, \"user\", user, \"role\", role, \"result\", result, \"error\", err)\n\t}()\n\treturn mw.next.AddRoleForUser(ctx, enforcer, user, role)\n}", "title": "" }, { "docid": "f9898707b853cc494e246652282ea7e1", "score": "0.42271376", "text": "func (c *FakeContext) GrantPermissionTo(addr loom.Address, token []byte, role string) {\n}", "title": "" }, { "docid": "187170bfea699d3028d6a665da093d08", "score": "0.42237344", "text": "func AddReadOnlyAccess(client kubernetes.Interface, apcache cache.Cache) {\n\taddReadOnlyClusterRole(client, apcache)\n\taddReadOnlyClusterRoleBinding(client, apcache)\n\tlog.Printf(\"Added read-only access to everyone in group 'global-read-only'.\")\n}", "title": "" }, { "docid": "eae11a2456db4ff119d661ea33102806", "score": "0.42048362", "text": "func (service *Service) AddGRPCStreamClientInterceptors(\n\tstreamInterceptors ...grpc.StreamClientInterceptor,\n) {\n\tfor _, streamInterceptor := range streamInterceptors {\n\t\tservice.streamClientInterceptors = append(\n\t\t\tservice.streamClientInterceptors, streamInterceptor,\n\t\t)\n\t}\n}", "title": "" }, { "docid": "e1bebb76d994628e44fbec133a5136f1", "score": "0.42011508", "text": "func TestImpersonationProxy(t *testing.T) { //nolint:gocyclo // yeah, it's complex.\n\tenv := library.IntegrationEnv(t)\n\n\tctx, cancel := context.WithTimeout(context.Background(), 20*time.Minute)\n\tdefer cancel()\n\n\t// Create a client using the admin kubeconfig.\n\tadminClient := library.NewKubernetesClientset(t)\n\tadminConciergeClient := library.NewConciergeClientset(t)\n\n\t// Create a WebhookAuthenticator and prepare a TokenCredentialRequestSpec using the authenticator for use later.\n\tcredentialRequestSpecWithWorkingCredentials := loginv1alpha1.TokenCredentialRequestSpec{\n\t\tToken: env.TestUser.Token,\n\t\tAuthenticator: library.CreateTestWebhookAuthenticator(ctx, t),\n\t}\n\n\t// The address of the ClusterIP service that points at the impersonation proxy's port (used when there is no load balancer).\n\tproxyServiceEndpoint := fmt.Sprintf(\"%s-proxy.%s.svc.cluster.local\", env.ConciergeAppName, env.ConciergeNamespace)\n\n\tvar mostRecentTokenCredentialRequestResponse *loginv1alpha1.TokenCredentialRequest\n\trefreshCredential := func() *loginv1alpha1.ClusterCredential {\n\t\tif mostRecentTokenCredentialRequestResponse == nil || credentialAlmostExpired(t, mostRecentTokenCredentialRequestResponse) {\n\t\t\tvar err error\n\t\t\t// Make a TokenCredentialRequest. This can either return a cert signed by the Kube API server's CA (e.g. on kind)\n\t\t\t// or a cert signed by the impersonator's signing CA (e.g. on GKE). Either should be accepted by the impersonation\n\t\t\t// proxy server as a valid authentication.\n\t\t\t//\n\t\t\t// However, we issue short-lived certs, so this cert will only be valid for a few minutes.\n\t\t\t// Cache it until it is almost expired and then refresh it whenever it is close to expired.\n\t\t\tmostRecentTokenCredentialRequestResponse, err = library.CreateTokenCredentialRequest(ctx, t, credentialRequestSpecWithWorkingCredentials)\n\t\t\trequire.NoError(t, err)\n\n\t\t\trequire.Nil(t, mostRecentTokenCredentialRequestResponse.Status.Message,\n\t\t\t\t\"expected no error message but got: %s\", library.Sdump(mostRecentTokenCredentialRequestResponse.Status.Message))\n\t\t\trequire.NotEmpty(t, mostRecentTokenCredentialRequestResponse.Status.Credential.ClientCertificateData)\n\t\t\trequire.NotEmpty(t, mostRecentTokenCredentialRequestResponse.Status.Credential.ClientKeyData)\n\n\t\t\t// At the moment the credential request should not have returned a token. In the future, if we make it return\n\t\t\t// tokens, we should revisit this test's rest config below.\n\t\t\trequire.Empty(t, mostRecentTokenCredentialRequestResponse.Status.Credential.Token)\n\t\t}\n\t\treturn mostRecentTokenCredentialRequestResponse.Status.Credential\n\t}\n\n\timpersonationProxyViaSquidKubeClientWithoutCredential := func() kubernetes.Interface {\n\t\tproxyURL := \"https://\" + proxyServiceEndpoint\n\t\tkubeconfig := impersonationProxyRestConfig(&loginv1alpha1.ClusterCredential{}, proxyURL, nil, \"\")\n\t\tkubeconfig.Proxy = kubeconfigProxyFunc(t, env.Proxy)\n\t\treturn library.NewKubeclient(t, kubeconfig).Kubernetes\n\t}\n\n\tnewImpersonationProxyClientWithCredentials := func(credentials *loginv1alpha1.ClusterCredential, impersonationProxyURL string, impersonationProxyCACertPEM []byte, doubleImpersonateUser string) *kubeclient.Client {\n\t\tkubeconfig := impersonationProxyRestConfig(credentials, impersonationProxyURL, impersonationProxyCACertPEM, doubleImpersonateUser)\n\t\tif !env.HasCapability(library.HasExternalLoadBalancerProvider) {\n\t\t\t// Send traffic through the Squid proxy\n\t\t\tkubeconfig.Proxy = kubeconfigProxyFunc(t, env.Proxy)\n\t\t}\n\t\treturn library.NewKubeclient(t, kubeconfig)\n\t}\n\n\tnewImpersonationProxyClient := func(impersonationProxyURL string, impersonationProxyCACertPEM []byte, doubleImpersonateUser string) *kubeclient.Client {\n\t\trefreshedCredentials := refreshCredential().DeepCopy()\n\t\trefreshedCredentials.Token = \"not a valid token\" // demonstrates that client certs take precedence over tokens by setting both on the requests\n\t\treturn newImpersonationProxyClientWithCredentials(refreshedCredentials, impersonationProxyURL, impersonationProxyCACertPEM, doubleImpersonateUser)\n\t}\n\n\tnewAnonymousImpersonationProxyClient := func(impersonationProxyURL string, impersonationProxyCACertPEM []byte, doubleImpersonateUser string) *kubeclient.Client {\n\t\temptyCredentials := &loginv1alpha1.ClusterCredential{}\n\t\treturn newImpersonationProxyClientWithCredentials(emptyCredentials, impersonationProxyURL, impersonationProxyCACertPEM, doubleImpersonateUser)\n\t}\n\n\toldConfigMap, err := adminClient.CoreV1().ConfigMaps(env.ConciergeNamespace).Get(ctx, impersonationProxyConfigMapName(env), metav1.GetOptions{})\n\tif !k8serrors.IsNotFound(err) {\n\t\trequire.NoError(t, err) // other errors aside from NotFound are unexpected\n\t\tt.Logf(\"stashing a pre-existing configmap %s\", oldConfigMap.Name)\n\t\trequire.NoError(t, adminClient.CoreV1().ConfigMaps(env.ConciergeNamespace).Delete(ctx, impersonationProxyConfigMapName(env), metav1.DeleteOptions{}))\n\t}\n\t// At the end of the test, clean up the ConfigMap.\n\tt.Cleanup(func() {\n\t\tctx, cancel = context.WithTimeout(context.Background(), 2*time.Minute)\n\t\tdefer cancel()\n\n\t\t// Delete any version that was created by this test.\n\t\tt.Logf(\"cleaning up configmap at end of test %s\", impersonationProxyConfigMapName(env))\n\t\terr := adminClient.CoreV1().ConfigMaps(env.ConciergeNamespace).Delete(ctx, impersonationProxyConfigMapName(env), metav1.DeleteOptions{})\n\t\tif !k8serrors.IsNotFound(err) {\n\t\t\trequire.NoError(t, err) // only not found errors are acceptable\n\t\t}\n\n\t\t// Only recreate it if it already existed at the start of this test.\n\t\tif len(oldConfigMap.Data) != 0 {\n\t\t\tt.Log(oldConfigMap)\n\t\t\toldConfigMap.UID = \"\" // cant have a UID yet\n\t\t\toldConfigMap.ResourceVersion = \"\"\n\t\t\tt.Logf(\"restoring a pre-existing configmap %s\", oldConfigMap.Name)\n\t\t\t_, err = adminClient.CoreV1().ConfigMaps(env.ConciergeNamespace).Create(ctx, oldConfigMap, metav1.CreateOptions{})\n\t\t\trequire.NoError(t, err)\n\t\t}\n\n\t\t// If we are running on an environment that has a load balancer, expect that the\n\t\t// CredentialIssuer will be updated eventually with a successful impersonation proxy frontend.\n\t\t// We do this to ensure that future tests that use the impersonation proxy (e.g.,\n\t\t// TestE2EFullIntegration) will start with a known-good state.\n\t\tif env.HasCapability(library.HasExternalLoadBalancerProvider) {\n\t\t\tperformImpersonatorDiscovery(ctx, t, env, adminConciergeClient)\n\t\t}\n\t})\n\n\tif env.HasCapability(library.HasExternalLoadBalancerProvider) { //nolint:nestif // come on... it's just a test\n\t\t// Check that load balancer has been automatically created by the impersonator's \"auto\" mode.\n\t\tlibrary.RequireEventuallyWithoutError(t, func() (bool, error) {\n\t\t\treturn hasImpersonationProxyLoadBalancerService(ctx, env, adminClient)\n\t\t}, 30*time.Second, 500*time.Millisecond)\n\t} else {\n\t\trequire.NotEmpty(t, env.Proxy,\n\t\t\t\"test cluster does not support load balancers but also doesn't have a squid proxy... \"+\n\t\t\t\t\"this is not a supported configuration for test clusters\")\n\n\t\t// Check that no load balancer has been created by the impersonator's \"auto\" mode.\n\t\tlibrary.RequireNeverWithoutError(t, func() (bool, error) {\n\t\t\treturn hasImpersonationProxyLoadBalancerService(ctx, env, adminClient)\n\t\t}, 10*time.Second, 500*time.Millisecond)\n\n\t\t// Check that we can't use the impersonation proxy to execute kubectl commands yet.\n\t\t_, err = impersonationProxyViaSquidKubeClientWithoutCredential().CoreV1().Namespaces().List(ctx, metav1.ListOptions{})\n\t\tisErr, message := isServiceUnavailableViaSquidError(err, proxyServiceEndpoint)\n\t\trequire.Truef(t, isErr, \"wanted error %q to be service unavailable via squid error, but: %s\", err, message)\n\n\t\t// Create configuration to make the impersonation proxy turn on with a hard coded endpoint (without a load balancer).\n\t\tconfigMap := configMapForConfig(t, env, impersonator.Config{\n\t\t\tMode: impersonator.ModeEnabled,\n\t\t\tEndpoint: proxyServiceEndpoint,\n\t\t})\n\t\tt.Logf(\"creating configmap %s\", configMap.Name)\n\t\t_, err = adminClient.CoreV1().ConfigMaps(env.ConciergeNamespace).Create(ctx, &configMap, metav1.CreateOptions{})\n\t\trequire.NoError(t, err)\n\t}\n\n\t// At this point the impersonator should be starting/running. When it is ready, the CredentialIssuer's\n\t// strategies array should be updated to include a successful impersonation strategy which can be used\n\t// to discover the impersonator's URL and CA certificate. Until it has finished starting, it may not be included\n\t// in the strategies array or it may be included in an error state. It can be in an error state for\n\t// awhile when it is waiting for the load balancer to be assigned an ip/hostname.\n\timpersonationProxyURL, impersonationProxyCACertPEM := performImpersonatorDiscovery(ctx, t, env, adminConciergeClient)\n\tif !env.HasCapability(library.HasExternalLoadBalancerProvider) {\n\t\t// In this case, we specified the endpoint in the configmap, so check that it was reported correctly in the CredentialIssuer.\n\t\trequire.Equal(t, \"https://\"+proxyServiceEndpoint, impersonationProxyURL)\n\t}\n\n\t// Because our credentials expire so quickly, we'll always use a new client, to give us a chance to refresh our\n\t// credentials before they expire. Create a closure to capture the arguments to newImpersonationProxyClient\n\t// so we don't have to keep repeating them.\n\t// This client performs TLS checks, so it also provides test coverage that the impersonation proxy server is generating TLS certs correctly.\n\timpersonationProxyKubeClient := func() kubernetes.Interface {\n\t\treturn newImpersonationProxyClient(impersonationProxyURL, impersonationProxyCACertPEM, \"\").Kubernetes\n\t}\n\n\tt.Run(\"positive tests\", func(t *testing.T) {\n\t\t// Create an RBAC rule to allow this user to read/write everything.\n\t\tlibrary.CreateTestClusterRoleBinding(t,\n\t\t\trbacv1.Subject{Kind: rbacv1.UserKind, APIGroup: rbacv1.GroupName, Name: env.TestUser.ExpectedUsername},\n\t\t\trbacv1.RoleRef{Kind: \"ClusterRole\", APIGroup: rbacv1.GroupName, Name: \"edit\"},\n\t\t)\n\t\t// Wait for the above RBAC rule to take effect.\n\t\tlibrary.WaitForUserToHaveAccess(t, env.TestUser.ExpectedUsername, []string{}, &v1.ResourceAttributes{\n\t\t\tVerb: \"get\", Group: \"\", Version: \"v1\", Resource: \"namespaces\",\n\t\t})\n\n\t\t// Get pods in concierge namespace and pick one.\n\t\t// this is for tests that require performing actions against a running pod. We use the concierge pod because we already have it handy.\n\t\t// We want to make sure it's a concierge pod (not cert agent), because we need to be able to \"exec echo\" and port-forward a running port.\n\t\tpods, err := adminClient.CoreV1().Pods(env.ConciergeNamespace).List(ctx, metav1.ListOptions{})\n\t\trequire.NoError(t, err)\n\t\trequire.Greater(t, len(pods.Items), 0)\n\t\tvar conciergePod *corev1.Pod\n\t\tfor _, pod := range pods.Items {\n\t\t\tpod := pod\n\t\t\tif !strings.Contains(pod.Name, \"kube-cert-agent\") {\n\t\t\t\tconciergePod = &pod\n\t\t\t}\n\t\t}\n\t\trequire.NotNil(t, conciergePod, \"could not find a concierge pod\")\n\n\t\t// Test that the user can perform basic actions through the client with their username and group membership\n\t\t// influencing RBAC checks correctly.\n\t\tt.Run(\n\t\t\t\"access as user\",\n\t\t\tlibrary.AccessAsUserTest(ctx, env.TestUser.ExpectedUsername, impersonationProxyKubeClient()),\n\t\t)\n\t\tfor _, group := range env.TestUser.ExpectedGroups {\n\t\t\tgroup := group\n\t\t\tt.Run(\n\t\t\t\t\"access as group \"+group,\n\t\t\t\tlibrary.AccessAsGroupTest(ctx, group, impersonationProxyKubeClient()),\n\t\t\t)\n\t\t}\n\n\t\tt.Run(\"kubectl port-forward and keeping the connection open for over a minute\", func(t *testing.T) {\n\t\t\tkubeconfigPath, envVarsWithProxy, _ := getImpersonationKubeconfig(t, env, impersonationProxyURL, impersonationProxyCACertPEM, credentialRequestSpecWithWorkingCredentials.Authenticator)\n\n\t\t\t// Run the kubectl port-forward command.\n\t\t\ttimeout, cancelFunc := context.WithTimeout(ctx, 2*time.Minute)\n\t\t\tdefer cancelFunc()\n\t\t\tportForwardCmd, _, portForwardStderr := kubectlCommand(timeout, t, kubeconfigPath, envVarsWithProxy, \"port-forward\", \"--namespace\", env.ConciergeNamespace, conciergePod.Name, \"8443:8443\")\n\t\t\tportForwardCmd.Env = envVarsWithProxy\n\n\t\t\t// Start, but don't wait for the command to finish.\n\t\t\terr := portForwardCmd.Start()\n\t\t\trequire.NoError(t, err, `\"kubectl port-forward\" failed`)\n\t\t\tgo func() {\n\t\t\t\tassert.EqualErrorf(t, portForwardCmd.Wait(), \"signal: killed\", `wanted \"kubectl port-forward\" to get signaled because context was cancelled (stderr: %q)`, portForwardStderr.String())\n\t\t\t}()\n\n\t\t\t// Wait to see if we time out. The default timeout is 60 seconds, but the server should recognize this this\n\t\t\t// is going to be a long-running command and keep the connection open as long as the client stays connected.\n\t\t\ttime.Sleep(70 * time.Second)\n\n\t\t\trequire.Eventually(t, func() bool {\n\t\t\t\ttimeout, cancelFunc = context.WithTimeout(ctx, 2*time.Minute)\n\t\t\t\tdefer cancelFunc()\n\t\t\t\tcurlCmd := exec.CommandContext(timeout, \"curl\", \"-k\", \"-sS\", \"https://127.0.0.1:8443\") // -sS turns off the progressbar but still prints errors\n\t\t\t\tvar curlStdOut, curlStdErr bytes.Buffer\n\t\t\t\tcurlCmd.Stdout = &curlStdOut\n\t\t\t\tcurlCmd.Stderr = &curlStdErr\n\t\t\t\terr = curlCmd.Run()\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Log(\"curl error: \" + err.Error())\n\t\t\t\t\tt.Log(\"curlStdErr: \" + curlStdErr.String())\n\t\t\t\t\tt.Log(\"stdout: \" + curlStdOut.String())\n\t\t\t\t}\n\t\t\t\t// We expect this to 403, but all we care is that it gets through.\n\t\t\t\treturn err == nil && strings.Contains(curlStdOut.String(), \"\\\"forbidden: User \\\\\\\"system:anonymous\\\\\\\" cannot get path \\\\\\\"/\\\\\\\"\\\"\")\n\t\t\t}, 1*time.Minute, 500*time.Millisecond)\n\t\t})\n\n\t\tt.Run(\"using and watching all the basic verbs\", func(t *testing.T) {\n\t\t\t// Create a namespace, because it will be easier to exercise \"deletecollection\" if we have a namespace.\n\t\t\tnamespaceName := createTestNamespace(t, adminClient)\n\n\t\t\t// Create and start informer to exercise the \"watch\" verb for us.\n\t\t\tinformerFactory := k8sinformers.NewSharedInformerFactoryWithOptions(\n\t\t\t\timpersonationProxyKubeClient(),\n\t\t\t\t0,\n\t\t\t\tk8sinformers.WithNamespace(namespaceName))\n\t\t\tinformer := informerFactory.Core().V1().ConfigMaps()\n\t\t\tinformer.Informer() // makes sure that the informer will cache\n\t\t\tstopChannel := make(chan struct{})\n\t\t\tinformerFactory.Start(stopChannel)\n\t\t\tt.Cleanup(func() {\n\t\t\t\t// Shut down the informer.\n\t\t\t\tclose(stopChannel)\n\t\t\t})\n\t\t\tinformerFactory.WaitForCacheSync(ctx.Done())\n\n\t\t\t// Use labels on our created ConfigMaps to avoid accidentally listing other ConfigMaps that might\n\t\t\t// exist in the namespace. In Kube 1.20+ there is a default ConfigMap in every namespace.\n\t\t\tconfigMapLabels := labels.Set{\n\t\t\t\t\"pinniped.dev/testConfigMap\": library.RandHex(t, 8),\n\t\t\t}\n\n\t\t\t// Test \"create\" verb through the impersonation proxy.\n\t\t\t_, err := impersonationProxyKubeClient().CoreV1().ConfigMaps(namespaceName).Create(ctx,\n\t\t\t\t&corev1.ConfigMap{ObjectMeta: metav1.ObjectMeta{Name: \"configmap-1\", Labels: configMapLabels}},\n\t\t\t\tmetav1.CreateOptions{},\n\t\t\t)\n\t\t\trequire.NoError(t, err)\n\t\t\t_, err = impersonationProxyKubeClient().CoreV1().ConfigMaps(namespaceName).Create(ctx,\n\t\t\t\t&corev1.ConfigMap{ObjectMeta: metav1.ObjectMeta{Name: \"configmap-2\", Labels: configMapLabels}},\n\t\t\t\tmetav1.CreateOptions{},\n\t\t\t)\n\t\t\trequire.NoError(t, err)\n\t\t\t_, err = impersonationProxyKubeClient().CoreV1().ConfigMaps(namespaceName).Create(ctx,\n\t\t\t\t&corev1.ConfigMap{ObjectMeta: metav1.ObjectMeta{Name: \"configmap-3\", Labels: configMapLabels}},\n\t\t\t\tmetav1.CreateOptions{},\n\t\t\t)\n\t\t\trequire.NoError(t, err)\n\n\t\t\t// Make sure that all of the created ConfigMaps show up in the informer's cache to\n\t\t\t// demonstrate that the informer's \"watch\" verb is working through the impersonation proxy.\n\t\t\trequire.Eventually(t, func() bool {\n\t\t\t\t_, err1 := informer.Lister().ConfigMaps(namespaceName).Get(\"configmap-1\")\n\t\t\t\t_, err2 := informer.Lister().ConfigMaps(namespaceName).Get(\"configmap-2\")\n\t\t\t\t_, err3 := informer.Lister().ConfigMaps(namespaceName).Get(\"configmap-3\")\n\t\t\t\treturn err1 == nil && err2 == nil && err3 == nil\n\t\t\t}, 10*time.Second, 50*time.Millisecond)\n\n\t\t\t// Test \"get\" verb through the impersonation proxy.\n\t\t\tconfigMap3, err := impersonationProxyKubeClient().CoreV1().ConfigMaps(namespaceName).Get(ctx, \"configmap-3\", metav1.GetOptions{})\n\t\t\trequire.NoError(t, err)\n\n\t\t\t// Test \"list\" verb through the impersonation proxy.\n\t\t\tlistResult, err := impersonationProxyKubeClient().CoreV1().ConfigMaps(namespaceName).List(ctx, metav1.ListOptions{\n\t\t\t\tLabelSelector: configMapLabels.String(),\n\t\t\t})\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.Len(t, listResult.Items, 3)\n\n\t\t\t// Test \"update\" verb through the impersonation proxy.\n\t\t\tconfigMap3.Data = map[string]string{\"foo\": \"bar\"}\n\t\t\tupdateResult, err := impersonationProxyKubeClient().CoreV1().ConfigMaps(namespaceName).Update(ctx, configMap3, metav1.UpdateOptions{})\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.Equal(t, \"bar\", updateResult.Data[\"foo\"])\n\n\t\t\t// Make sure that the updated ConfigMap shows up in the informer's cache.\n\t\t\trequire.Eventually(t, func() bool {\n\t\t\t\tconfigMap, err := informer.Lister().ConfigMaps(namespaceName).Get(\"configmap-3\")\n\t\t\t\treturn err == nil && configMap.Data[\"foo\"] == \"bar\"\n\t\t\t}, 10*time.Second, 50*time.Millisecond)\n\n\t\t\t// Test \"patch\" verb through the impersonation proxy.\n\t\t\tpatchResult, err := impersonationProxyKubeClient().CoreV1().ConfigMaps(namespaceName).Patch(ctx,\n\t\t\t\t\"configmap-3\",\n\t\t\t\ttypes.MergePatchType,\n\t\t\t\t[]byte(`{\"data\":{\"baz\":\"42\"}}`),\n\t\t\t\tmetav1.PatchOptions{},\n\t\t\t)\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.Equal(t, \"bar\", patchResult.Data[\"foo\"])\n\t\t\trequire.Equal(t, \"42\", patchResult.Data[\"baz\"])\n\n\t\t\t// Make sure that the patched ConfigMap shows up in the informer's cache.\n\t\t\trequire.Eventually(t, func() bool {\n\t\t\t\tconfigMap, err := informer.Lister().ConfigMaps(namespaceName).Get(\"configmap-3\")\n\t\t\t\treturn err == nil && configMap.Data[\"foo\"] == \"bar\" && configMap.Data[\"baz\"] == \"42\"\n\t\t\t}, 10*time.Second, 50*time.Millisecond)\n\n\t\t\t// Test \"delete\" verb through the impersonation proxy.\n\t\t\terr = impersonationProxyKubeClient().CoreV1().ConfigMaps(namespaceName).Delete(ctx, \"configmap-3\", metav1.DeleteOptions{})\n\t\t\trequire.NoError(t, err)\n\n\t\t\t// Make sure that the deleted ConfigMap shows up in the informer's cache.\n\t\t\trequire.Eventually(t, func() bool {\n\t\t\t\t_, getErr := informer.Lister().ConfigMaps(namespaceName).Get(\"configmap-3\")\n\t\t\t\tlist, listErr := informer.Lister().ConfigMaps(namespaceName).List(configMapLabels.AsSelector())\n\t\t\t\treturn k8serrors.IsNotFound(getErr) && listErr == nil && len(list) == 2\n\t\t\t}, 10*time.Second, 50*time.Millisecond)\n\n\t\t\t// Test \"deletecollection\" verb through the impersonation proxy.\n\t\t\terr = impersonationProxyKubeClient().CoreV1().ConfigMaps(namespaceName).DeleteCollection(ctx, metav1.DeleteOptions{}, metav1.ListOptions{})\n\t\t\trequire.NoError(t, err)\n\n\t\t\t// Make sure that the deleted ConfigMaps shows up in the informer's cache.\n\t\t\trequire.Eventually(t, func() bool {\n\t\t\t\tlist, listErr := informer.Lister().ConfigMaps(namespaceName).List(configMapLabels.AsSelector())\n\t\t\t\treturn listErr == nil && len(list) == 0\n\t\t\t}, 10*time.Second, 50*time.Millisecond)\n\n\t\t\t// There should be no ConfigMaps left.\n\t\t\tlistResult, err = impersonationProxyKubeClient().CoreV1().ConfigMaps(namespaceName).List(ctx, metav1.ListOptions{\n\t\t\t\tLabelSelector: configMapLabels.String(),\n\t\t\t})\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.Len(t, listResult.Items, 0)\n\t\t})\n\n\t\tt.Run(\"double impersonation as a regular user is blocked\", func(t *testing.T) {\n\t\t\t// Make a client which will send requests through the impersonation proxy and will also add\n\t\t\t// impersonate headers to the request.\n\t\t\tdoubleImpersonationKubeClient := newImpersonationProxyClient(impersonationProxyURL, impersonationProxyCACertPEM, \"other-user-to-impersonate\").Kubernetes\n\n\t\t\t// Check that we can get some resource through the impersonation proxy without any impersonation headers on the request.\n\t\t\t// We could use any resource for this, but we happen to know that this one should exist.\n\t\t\t_, err := impersonationProxyKubeClient().CoreV1().Secrets(env.ConciergeNamespace).Get(ctx, impersonationProxyTLSSecretName(env), metav1.GetOptions{})\n\t\t\trequire.NoError(t, err)\n\n\t\t\t// Now we'll see what happens when we add an impersonation header to the request. This should generate a\n\t\t\t// request similar to the one above, except that it will also have an impersonation header.\n\t\t\t_, err = doubleImpersonationKubeClient.CoreV1().Secrets(env.ConciergeNamespace).Get(ctx, impersonationProxyTLSSecretName(env), metav1.GetOptions{})\n\t\t\t// Double impersonation is not supported yet, so we should get an error.\n\t\t\trequire.EqualError(t, err, fmt.Sprintf(\n\t\t\t\t`users \"other-user-to-impersonate\" is forbidden: `+\n\t\t\t\t\t`User \"%s\" cannot impersonate resource \"users\" in API group \"\" at the cluster scope: `+\n\t\t\t\t\t`impersonation is not allowed or invalid verb`,\n\t\t\t\tenv.TestUser.ExpectedUsername))\n\t\t})\n\n\t\t// This is a separate test from the above double impersonation test because the cluster admin user gets special\n\t\t// authorization treatment from the Kube API server code that we are using, and we want to ensure that we are blocking\n\t\t// double impersonation even for the cluster admin.\n\t\tt.Run(\"double impersonation as a cluster admin user is blocked\", func(t *testing.T) {\n\t\t\t// Copy the admin credentials from the admin kubeconfig.\n\t\t\tadminClientRestConfig := library.NewClientConfig(t)\n\n\t\t\tif adminClientRestConfig.BearerToken == \"\" && adminClientRestConfig.CertData == nil && adminClientRestConfig.KeyData == nil {\n\t\t\t\tt.Skip(\"The admin kubeconfig does not include credentials, so skipping this test.\")\n\t\t\t}\n\n\t\t\tclusterAdminCredentials := &loginv1alpha1.ClusterCredential{\n\t\t\t\tToken: adminClientRestConfig.BearerToken,\n\t\t\t\tClientCertificateData: string(adminClientRestConfig.CertData),\n\t\t\t\tClientKeyData: string(adminClientRestConfig.KeyData),\n\t\t\t}\n\n\t\t\t// Make a client using the admin credentials which will send requests through the impersonation proxy\n\t\t\t// and will also add impersonate headers to the request.\n\t\t\tdoubleImpersonationKubeClient := newImpersonationProxyClientWithCredentials(\n\t\t\t\tclusterAdminCredentials, impersonationProxyURL, impersonationProxyCACertPEM, \"other-user-to-impersonate\",\n\t\t\t).Kubernetes\n\n\t\t\t_, err := doubleImpersonationKubeClient.CoreV1().Secrets(env.ConciergeNamespace).Get(ctx, impersonationProxyTLSSecretName(env), metav1.GetOptions{})\n\t\t\t// Double impersonation is not supported yet, so we should get an error.\n\t\t\trequire.Error(t, err)\n\t\t\trequire.Regexp(t,\n\t\t\t\t`users \"other-user-to-impersonate\" is forbidden: `+\n\t\t\t\t\t`User \".*\" cannot impersonate resource \"users\" in API group \"\" at the cluster scope: `+\n\t\t\t\t\t`impersonation is not allowed or invalid verb`,\n\t\t\t\terr.Error(),\n\t\t\t)\n\t\t})\n\n\t\tt.Run(\"WhoAmIRequests and different kinds of authentication through the impersonation proxy\", func(t *testing.T) {\n\t\t\t// Test using the TokenCredentialRequest for authentication.\n\t\t\timpersonationProxyPinnipedConciergeClient := newImpersonationProxyClient(\n\t\t\t\timpersonationProxyURL, impersonationProxyCACertPEM, \"\",\n\t\t\t).PinnipedConcierge\n\t\t\twhoAmI, err := impersonationProxyPinnipedConciergeClient.IdentityV1alpha1().WhoAmIRequests().\n\t\t\t\tCreate(ctx, &identityv1alpha1.WhoAmIRequest{}, metav1.CreateOptions{})\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.Equal(t,\n\t\t\t\texpectedWhoAmIRequestResponse(\n\t\t\t\t\tenv.TestUser.ExpectedUsername,\n\t\t\t\t\tappend(env.TestUser.ExpectedGroups, \"system:authenticated\"),\n\t\t\t\t),\n\t\t\t\twhoAmI,\n\t\t\t)\n\n\t\t\t// Test an unauthenticated request which does not include any credentials.\n\t\t\timpersonationProxyAnonymousPinnipedConciergeClient := newAnonymousImpersonationProxyClient(\n\t\t\t\timpersonationProxyURL, impersonationProxyCACertPEM, \"\",\n\t\t\t).PinnipedConcierge\n\t\t\twhoAmI, err = impersonationProxyAnonymousPinnipedConciergeClient.IdentityV1alpha1().WhoAmIRequests().\n\t\t\t\tCreate(ctx, &identityv1alpha1.WhoAmIRequest{}, metav1.CreateOptions{})\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.Equal(t,\n\t\t\t\texpectedWhoAmIRequestResponse(\n\t\t\t\t\t\"system:anonymous\",\n\t\t\t\t\t[]string{\"system:unauthenticated\"},\n\t\t\t\t),\n\t\t\t\twhoAmI,\n\t\t\t)\n\n\t\t\t// Test using a service account token. Authenticating as Service Accounts through the impersonation\n\t\t\t// proxy is not supported, so it should fail.\n\t\t\tnamespaceName := createTestNamespace(t, adminClient)\n\t\t\timpersonationProxyServiceAccountPinnipedConciergeClient := newImpersonationProxyClientWithCredentials(\n\t\t\t\t&loginv1alpha1.ClusterCredential{Token: createServiceAccountToken(ctx, t, adminClient, namespaceName)},\n\t\t\t\timpersonationProxyURL, impersonationProxyCACertPEM, \"\").PinnipedConcierge\n\t\t\t_, err = impersonationProxyServiceAccountPinnipedConciergeClient.IdentityV1alpha1().WhoAmIRequests().\n\t\t\t\tCreate(ctx, &identityv1alpha1.WhoAmIRequest{}, metav1.CreateOptions{})\n\t\t\trequire.EqualError(t, err, \"Internal error occurred: unimplemented functionality - unable to act as current user\")\n\t\t\trequire.True(t, k8serrors.IsInternalError(err), err)\n\t\t\trequire.Equal(t, &k8serrors.StatusError{\n\t\t\t\tErrStatus: metav1.Status{\n\t\t\t\t\tStatus: metav1.StatusFailure,\n\t\t\t\t\tCode: http.StatusInternalServerError,\n\t\t\t\t\tReason: metav1.StatusReasonInternalError,\n\t\t\t\t\tDetails: &metav1.StatusDetails{\n\t\t\t\t\t\tCauses: []metav1.StatusCause{\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tMessage: \"unimplemented functionality - unable to act as current user\",\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\tMessage: \"Internal error occurred: unimplemented functionality - unable to act as current user\",\n\t\t\t\t},\n\t\t\t}, err)\n\t\t})\n\n\t\tt.Run(\"kubectl as a client\", func(t *testing.T) {\n\t\t\tkubeconfigPath, envVarsWithProxy, tempDir := getImpersonationKubeconfig(t, env, impersonationProxyURL, impersonationProxyCACertPEM, credentialRequestSpecWithWorkingCredentials.Authenticator)\n\n\t\t\t// Try \"kubectl exec\" through the impersonation proxy.\n\t\t\techoString := \"hello world\"\n\t\t\tremoteEchoFile := fmt.Sprintf(\"/tmp/test-impersonation-proxy-echo-file-%d.txt\", time.Now().Unix())\n\t\t\tstdout, err := runKubectl(t, kubeconfigPath, envVarsWithProxy, \"exec\", \"--namespace\", env.ConciergeNamespace, conciergePod.Name, \"--\", \"bash\", \"-c\", fmt.Sprintf(`echo \"%s\" | tee %s`, echoString, remoteEchoFile))\n\t\t\trequire.NoError(t, err, `\"kubectl exec\" failed`)\n\t\t\trequire.Equal(t, echoString+\"\\n\", stdout)\n\n\t\t\t// run the kubectl cp command\n\t\t\tlocalEchoFile := filepath.Join(tempDir, filepath.Base(remoteEchoFile))\n\t\t\t_, err = runKubectl(t, kubeconfigPath, envVarsWithProxy, \"cp\", fmt.Sprintf(\"%s/%s:%s\", env.ConciergeNamespace, conciergePod.Name, remoteEchoFile), localEchoFile)\n\t\t\trequire.NoError(t, err, `\"kubectl cp\" failed`)\n\t\t\tlocalEchoFileData, err := ioutil.ReadFile(localEchoFile)\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.Equal(t, echoString+\"\\n\", string(localEchoFileData))\n\t\t\tdefer func() {\n\t\t\t\t_, _ = runKubectl(t, kubeconfigPath, envVarsWithProxy, \"exec\", \"--namespace\", env.ConciergeNamespace, conciergePod.Name, \"--\", \"rm\", remoteEchoFile) // cleanup remote echo file\n\t\t\t}()\n\n\t\t\t// run the kubectl logs command\n\t\t\tlogLinesCount := 10\n\t\t\tstdout, err = runKubectl(t, kubeconfigPath, envVarsWithProxy, \"logs\", \"--namespace\", env.ConciergeNamespace, conciergePod.Name, fmt.Sprintf(\"--tail=%d\", logLinesCount))\n\t\t\trequire.NoError(t, err, `\"kubectl logs\" failed`)\n\t\t\trequire.Equalf(t, logLinesCount, strings.Count(stdout, \"\\n\"), \"wanted %d newlines in kubectl logs output:\\n%s\", logLinesCount, stdout)\n\n\t\t\t// run the kubectl attach command\n\t\t\tnamespaceName := createTestNamespace(t, adminClient)\n\t\t\tattachPod := library.CreatePod(ctx, t, \"impersonation-proxy-attach\", namespaceName, corev1.PodSpec{\n\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t{\n\t\t\t\t\t\tName: \"impersonation-proxy-attach\",\n\t\t\t\t\t\tImage: conciergePod.Spec.Containers[0].Image,\n\t\t\t\t\t\tCommand: []string{\"bash\"},\n\t\t\t\t\t\tArgs: []string{\"-c\", `while true; do read VAR; echo \"VAR: $VAR\"; done`},\n\t\t\t\t\t\tStdin: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\t\t\ttimeout, cancelFunc := context.WithTimeout(ctx, 2*time.Minute)\n\t\t\tdefer cancelFunc()\n\t\t\tattachCmd, attachStdout, attachStderr := kubectlCommand(timeout, t, kubeconfigPath, envVarsWithProxy, \"attach\", \"--stdin=true\", \"--namespace\", namespaceName, attachPod.Name, \"-v=10\")\n\t\t\tattachCmd.Env = envVarsWithProxy\n\t\t\tattachStdin, err := attachCmd.StdinPipe()\n\t\t\trequire.NoError(t, err)\n\n\t\t\t// start but don't wait for the attach command\n\t\t\terr = attachCmd.Start()\n\t\t\trequire.NoError(t, err)\n\t\t\tattachExitCh := make(chan struct{})\n\t\t\tgo func() {\n\t\t\t\tassert.NoError(t, attachCmd.Wait())\n\t\t\t\tclose(attachExitCh)\n\t\t\t}()\n\n\t\t\t// write to stdin on the attach process\n\t\t\t_, err = attachStdin.Write([]byte(echoString + \"\\n\"))\n\t\t\trequire.NoError(t, err)\n\n\t\t\t// see that we can read stdout and it spits out stdin output back to us\n\t\t\twantAttachStdout := fmt.Sprintf(\"VAR: %s\\n\", echoString)\n\t\t\trequire.Eventuallyf(t, func() bool { return attachStdout.String() == wantAttachStdout }, time.Second*60, time.Millisecond*250, `got \"kubectl attach\" stdout: %q, wanted: %q (stderr: %q)`, attachStdout.String(), wantAttachStdout, attachStderr.String())\n\n\t\t\t// close stdin and attach process should exit\n\t\t\terr = attachStdin.Close()\n\t\t\trequire.NoError(t, err)\n\t\t\trequireClose(t, attachExitCh, time.Second*20)\n\t\t})\n\n\t\tt.Run(\"websocket client\", func(t *testing.T) {\n\t\t\tnamespaceName := createTestNamespace(t, adminClient)\n\n\t\t\timpersonationRestConfig := impersonationProxyRestConfig(refreshCredential(), impersonationProxyURL, impersonationProxyCACertPEM, \"\")\n\t\t\ttlsConfig, err := rest.TLSConfigFor(impersonationRestConfig)\n\t\t\trequire.NoError(t, err)\n\n\t\t\twantConfigMapLabelKey, wantConfigMapLabelValue := \"some-label-key\", \"some-label-value\"\n\t\t\tdest, _ := url.Parse(impersonationProxyURL)\n\t\t\tdest.Scheme = \"wss\"\n\t\t\tdest.Path = \"/api/v1/namespaces/\" + namespaceName + \"/configmaps\"\n\t\t\tdest.RawQuery = url.Values{\n\t\t\t\t\"watch\": {\"1\"},\n\t\t\t\t\"labelSelector\": {fmt.Sprintf(\"%s=%s\", wantConfigMapLabelKey, wantConfigMapLabelValue)},\n\t\t\t\t\"resourceVersion\": {\"0\"},\n\t\t\t}.Encode()\n\t\t\tdialer := websocket.Dialer{\n\t\t\t\tTLSClientConfig: tlsConfig,\n\t\t\t}\n\t\t\tif !env.HasCapability(library.HasExternalLoadBalancerProvider) {\n\t\t\t\tdialer.Proxy = func(req *http.Request) (*url.URL, error) {\n\t\t\t\t\tproxyURL, err := url.Parse(env.Proxy)\n\t\t\t\t\trequire.NoError(t, err)\n\t\t\t\t\tt.Logf(\"passing request for %s through proxy %s\", req.URL, proxyURL.String())\n\t\t\t\t\treturn proxyURL, nil\n\t\t\t\t}\n\t\t\t}\n\t\t\tc, r, err := dialer.Dial(dest.String(), http.Header{\"Origin\": {dest.String()}})\n\t\t\tif r != nil {\n\t\t\t\tdefer func() {\n\t\t\t\t\trequire.NoError(t, r.Body.Close())\n\t\t\t\t}()\n\t\t\t}\n\t\t\tif err != nil && r != nil {\n\t\t\t\tbody, _ := ioutil.ReadAll(r.Body)\n\t\t\t\tt.Logf(\"websocket dial failed: %d:%s\", r.StatusCode, body)\n\t\t\t}\n\t\t\trequire.NoError(t, err)\n\n\t\t\t// perform a create through the admin client\n\t\t\twantConfigMap := &corev1.ConfigMap{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"configmap-1\", Labels: map[string]string{wantConfigMapLabelKey: wantConfigMapLabelValue}},\n\t\t\t}\n\t\t\twantConfigMap, err = adminClient.CoreV1().ConfigMaps(namespaceName).Create(ctx,\n\t\t\t\twantConfigMap,\n\t\t\t\tmetav1.CreateOptions{},\n\t\t\t)\n\t\t\trequire.NoError(t, err)\n\t\t\tt.Cleanup(func() {\n\t\t\t\trequire.NoError(t, adminClient.CoreV1().ConfigMaps(namespaceName).\n\t\t\t\t\tDeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{}))\n\t\t\t})\n\n\t\t\t// see if the websocket client received an event for the create\n\t\t\t_, message, err := c.ReadMessage()\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"Unexpected error: %v\", err)\n\t\t\t}\n\t\t\tvar got watchJSON\n\t\t\terr = json.Unmarshal(message, &got)\n\t\t\trequire.NoError(t, err)\n\t\t\tif got.Type != watch.Added {\n\t\t\t\tt.Errorf(\"Unexpected type: %v\", got.Type)\n\t\t\t}\n\t\t\tvar actualConfigMap corev1.ConfigMap\n\t\t\trequire.NoError(t, json.Unmarshal(got.Object, &actualConfigMap))\n\t\t\tactualConfigMap.TypeMeta = metav1.TypeMeta{} // This isn't filled out in the wantConfigMap we got back from create.\n\t\t\trequire.Equal(t, *wantConfigMap, actualConfigMap)\n\t\t})\n\n\t\tt.Run(\"http2 client\", func(t *testing.T) {\n\t\t\tnamespaceName := createTestNamespace(t, adminClient)\n\n\t\t\twantConfigMapLabelKey, wantConfigMapLabelValue := \"some-label-key\", \"some-label-value\"\n\t\t\twantConfigMap := &corev1.ConfigMap{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"configmap-1\", Labels: map[string]string{wantConfigMapLabelKey: wantConfigMapLabelValue}},\n\t\t\t}\n\t\t\twantConfigMap, err = adminClient.CoreV1().ConfigMaps(namespaceName).Create(ctx,\n\t\t\t\twantConfigMap,\n\t\t\t\tmetav1.CreateOptions{},\n\t\t\t)\n\t\t\trequire.NoError(t, err)\n\t\t\tt.Cleanup(func() {\n\t\t\t\t_ = adminClient.CoreV1().ConfigMaps(namespaceName).DeleteCollection(ctx, metav1.DeleteOptions{}, metav1.ListOptions{})\n\t\t\t})\n\n\t\t\t// create rest client\n\t\t\trestConfig := impersonationProxyRestConfig(refreshCredential(), impersonationProxyURL, impersonationProxyCACertPEM, \"\")\n\n\t\t\ttlsConfig, err := rest.TLSConfigFor(restConfig)\n\t\t\trequire.NoError(t, err)\n\t\t\thttpTransport := http.Transport{\n\t\t\t\tTLSClientConfig: tlsConfig,\n\t\t\t}\n\t\t\tif !env.HasCapability(library.HasExternalLoadBalancerProvider) {\n\t\t\t\thttpTransport.Proxy = func(req *http.Request) (*url.URL, error) {\n\t\t\t\t\tproxyURL, err := url.Parse(env.Proxy)\n\t\t\t\t\trequire.NoError(t, err)\n\t\t\t\t\tt.Logf(\"passing request for %s through proxy %s\", req.URL, proxyURL.String())\n\t\t\t\t\treturn proxyURL, nil\n\t\t\t\t}\n\t\t\t}\n\t\t\terr = http2.ConfigureTransport(&httpTransport)\n\t\t\trequire.NoError(t, err)\n\n\t\t\thttpClient := http.Client{\n\t\t\t\tTransport: &httpTransport,\n\t\t\t}\n\n\t\t\tdest, _ := url.Parse(impersonationProxyURL)\n\t\t\tdest.Path = \"/api/v1/namespaces/\" + namespaceName + \"/configmaps/configmap-1\"\n\t\t\tgetConfigmapRequest, err := http.NewRequestWithContext(ctx, http.MethodGet, dest.String(), nil)\n\t\t\trequire.NoError(t, err)\n\t\t\tresponse, err := httpClient.Do(getConfigmapRequest)\n\t\t\trequire.NoError(t, err)\n\t\t\tbody, _ := ioutil.ReadAll(response.Body)\n\t\t\tt.Logf(\"http2 status code: %d, proto: %s, message: %s\", response.StatusCode, response.Proto, body)\n\t\t\trequire.Equal(t, \"HTTP/2.0\", response.Proto)\n\t\t\trequire.Equal(t, http.StatusOK, response.StatusCode)\n\t\t\tdefer func() {\n\t\t\t\trequire.NoError(t, response.Body.Close())\n\t\t\t}()\n\t\t\tvar actualConfigMap corev1.ConfigMap\n\t\t\trequire.NoError(t, json.Unmarshal(body, &actualConfigMap))\n\t\t\tactualConfigMap.TypeMeta = metav1.TypeMeta{} // This isn't filled out in the wantConfigMap we got back from create.\n\t\t\trequire.Equal(t, *wantConfigMap, actualConfigMap)\n\n\t\t\t// watch configmaps\n\t\t\tdest.Path = \"/api/v1/namespaces/\" + namespaceName + \"/configmaps\"\n\t\t\tdest.RawQuery = url.Values{\n\t\t\t\t\"watch\": {\"1\"},\n\t\t\t\t\"labelSelector\": {fmt.Sprintf(\"%s=%s\", wantConfigMapLabelKey, wantConfigMapLabelValue)},\n\t\t\t\t\"resourceVersion\": {\"0\"},\n\t\t\t}.Encode()\n\t\t\twatchConfigmapsRequest, err := http.NewRequestWithContext(ctx, http.MethodGet, dest.String(), nil)\n\t\t\trequire.NoError(t, err)\n\t\t\tresponse, err = httpClient.Do(watchConfigmapsRequest)\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.Equal(t, \"HTTP/2.0\", response.Proto)\n\t\t\trequire.Equal(t, http.StatusOK, response.StatusCode)\n\t\t\tdefer func() {\n\t\t\t\trequire.NoError(t, response.Body.Close())\n\t\t\t}()\n\n\t\t\t// decode\n\t\t\tdecoder := json.NewDecoder(response.Body)\n\t\t\tvar got watchJSON\n\t\t\terr = decoder.Decode(&got)\n\t\t\trequire.NoError(t, err)\n\t\t\tif got.Type != watch.Added {\n\t\t\t\tt.Errorf(\"Unexpected type: %v\", got.Type)\n\t\t\t}\n\t\t\terr = json.Unmarshal(got.Object, &actualConfigMap)\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.Equal(t, \"configmap-1\", actualConfigMap.Name)\n\t\t\tactualConfigMap.TypeMeta = metav1.TypeMeta{} // This isn't filled out in the wantConfigMap we got back from create.\n\t\t\trequire.Equal(t, *wantConfigMap, actualConfigMap)\n\t\t})\n\t})\n\n\tt.Run(\"manually disabling the impersonation proxy feature\", func(t *testing.T) {\n\t\t// Update configuration to force the proxy to disabled mode\n\t\tconfigMap := configMapForConfig(t, env, impersonator.Config{Mode: impersonator.ModeDisabled})\n\t\tif env.HasCapability(library.HasExternalLoadBalancerProvider) {\n\t\t\tt.Logf(\"creating configmap %s\", configMap.Name)\n\t\t\t_, err := adminClient.CoreV1().ConfigMaps(env.ConciergeNamespace).Create(ctx, &configMap, metav1.CreateOptions{})\n\t\t\trequire.NoError(t, err)\n\t\t} else {\n\t\t\tt.Logf(\"updating configmap %s\", configMap.Name)\n\t\t\t_, err := adminClient.CoreV1().ConfigMaps(env.ConciergeNamespace).Update(ctx, &configMap, metav1.UpdateOptions{})\n\t\t\trequire.NoError(t, err)\n\t\t}\n\n\t\tif env.HasCapability(library.HasExternalLoadBalancerProvider) {\n\t\t\t// The load balancer should have been deleted when we disabled the impersonation proxy.\n\t\t\t// Note that this can take kind of a long time on real cloud providers (e.g. ~22 seconds on EKS).\n\t\t\tlibrary.RequireEventuallyWithoutError(t, func() (bool, error) {\n\t\t\t\thasService, err := hasImpersonationProxyLoadBalancerService(ctx, env, adminClient)\n\t\t\t\treturn !hasService, err\n\t\t\t}, 2*time.Minute, 500*time.Millisecond)\n\t\t}\n\n\t\t// Check that the impersonation proxy port has shut down.\n\t\t// Ideally we could always check that the impersonation proxy's port has shut down, but on clusters where we\n\t\t// do not run the squid proxy we have no easy way to see beyond the load balancer to see inside the cluster,\n\t\t// so we'll skip this check on clusters which have load balancers but don't run the squid proxy.\n\t\t// The other cluster types that do run the squid proxy will give us sufficient coverage here.\n\t\tif env.Proxy != \"\" {\n\t\t\trequire.Eventually(t, func() bool {\n\t\t\t\t// It's okay if this returns RBAC errors because this user has no role bindings.\n\t\t\t\t// What we want to see is that the proxy eventually shuts down entirely.\n\t\t\t\t_, err := impersonationProxyViaSquidKubeClientWithoutCredential().CoreV1().Namespaces().List(ctx, metav1.ListOptions{})\n\t\t\t\tisErr, _ := isServiceUnavailableViaSquidError(err, proxyServiceEndpoint)\n\t\t\t\treturn isErr\n\t\t\t}, 20*time.Second, 500*time.Millisecond)\n\t\t}\n\n\t\t// Check that the generated TLS cert Secret was deleted by the controller because it's supposed to clean this up\n\t\t// when we disable the impersonator.\n\t\trequire.Eventually(t, func() bool {\n\t\t\t_, err := adminClient.CoreV1().Secrets(env.ConciergeNamespace).Get(ctx, impersonationProxyTLSSecretName(env), metav1.GetOptions{})\n\t\t\treturn k8serrors.IsNotFound(err)\n\t\t}, 10*time.Second, 250*time.Millisecond)\n\n\t\t// Check that the generated CA cert Secret was not deleted by the controller because it's supposed to keep this\n\t\t// around in case we decide to later re-enable the impersonator. We want to avoid generating new CA certs when\n\t\t// possible because they make their way into kubeconfigs on client machines.\n\t\t_, err := adminClient.CoreV1().Secrets(env.ConciergeNamespace).Get(ctx, impersonationProxyCASecretName(env), metav1.GetOptions{})\n\t\trequire.NoError(t, err)\n\n\t\t// At this point the impersonator should be stopped. The CredentialIssuer's strategies array should be updated to\n\t\t// include an unsuccessful impersonation strategy saying that it was manually configured to be disabled.\n\t\trequireDisabledByConfigurationStrategy(ctx, t, env, adminConciergeClient)\n\n\t\tif !env.HasCapability(library.ClusterSigningKeyIsAvailable) {\n\t\t\t// This cluster does not support the cluster signing key strategy, so now that we've manually disabled the\n\t\t\t// impersonation strategy, we should be left with no working strategies.\n\t\t\t// Given that there are no working strategies, a TokenCredentialRequest which would otherwise work should now\n\t\t\t// fail, because there is no point handing out credentials that are not going to work for any strategy.\n\t\t\ttokenCredentialRequestResponse, err := library.CreateTokenCredentialRequest(ctx, t, credentialRequestSpecWithWorkingCredentials)\n\t\t\trequire.NoError(t, err)\n\n\t\t\trequire.NotNil(t, tokenCredentialRequestResponse.Status.Message, \"expected an error message but got nil\")\n\t\t\trequire.Equal(t, \"authentication failed\", *tokenCredentialRequestResponse.Status.Message)\n\t\t\trequire.Nil(t, tokenCredentialRequestResponse.Status.Credential)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "aadc9dc9d026ac067e3c917c6c41820b", "score": "0.41998345", "text": "func (client PersonClient) AddFaceFromStreamResponder(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": "6f5cf20f386d2392141e0bb4bcb85505", "score": "0.41968438", "text": "func TestSyncServiceWithNoManagedBy(t *testing.T) {\n\tsvc := newService(\"test-service\", 80, map[string]string{\n\t\tv1alpha1.DefaultRolloutUniqueLabelKey: \"abc\",\n\t})\n\tro := &v1alpha1.Rollout{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"test\",\n\t\t\tNamespace: metav1.NamespaceDefault,\n\t\t},\n\t\tSpec: v1alpha1.RolloutSpec{\n\t\t\tStrategy: v1alpha1.RolloutStrategy{\n\t\t\t\tBlueGreen: &v1alpha1.BlueGreenStrategy{\n\t\t\t\t\tActiveService: \"test-service\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tctrl, kubeclient, client, _ := newFakeServiceController(svc, ro)\n\n\terr := ctrl.syncService(context.Background(), \"default/test-service\")\n\tassert.NoError(t, err)\n\tactions := kubeclient.Actions()\n\tassert.Len(t, actions, 0)\n\t// No argo api call since the controller reads from the indexer\n\targoActions := client.Actions()\n\tassert.Len(t, argoActions, 0)\n}", "title": "" }, { "docid": "06ce4099695ba7c74c68b3a595dcc6c8", "score": "0.41913724", "text": "func WithImpersonation(handler http.Handler, a authorizer.Authorizer, s runtime.NegotiatedSerializer) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\timpersonationRequests, err := buildImpersonationRequests(req.Header)\n\t\tif err != nil {\n\t\t\tklog.V(4).Infof(\"%v\", err)\n\t\t\tresponsewriters.InternalError(w, req, err)\n\t\t\treturn\n\t\t}\n\t\tif len(impersonationRequests) == 0 {\n\t\t\thandler.ServeHTTP(w, req)\n\t\t\treturn\n\t\t}\n\n\t\tctx := req.Context()\n\t\trequestor, exists := request.UserFrom(ctx)\n\t\tif !exists {\n\t\t\tresponsewriters.InternalError(w, req, errors.New(\"no user found for request\"))\n\t\t\treturn\n\t\t}\n\n\t\t// if groups are not specified, then we need to look them up differently depending on the type of user\n\t\t// if they are specified, then they are the authority (including the inclusion of system:authenticated/system:unauthenticated groups)\n\t\tgroupsSpecified := len(req.Header[authenticationv1.ImpersonateGroupHeader]) > 0\n\n\t\t// make sure we're allowed to impersonate each thing we're requesting. While we're iterating through, start building username\n\t\t// and group information\n\t\tusername := \"\"\n\t\tgroups := []string{}\n\t\tuserExtra := map[string][]string{}\n\t\tuid := \"\"\n\t\tfor _, impersonationRequest := range impersonationRequests {\n\t\t\tgvk := impersonationRequest.GetObjectKind().GroupVersionKind()\n\t\t\tactingAsAttributes := &authorizer.AttributesRecord{\n\t\t\t\tUser: requestor,\n\t\t\t\tVerb: \"impersonate\",\n\t\t\t\tAPIGroup: gvk.Group,\n\t\t\t\tAPIVersion: gvk.Version,\n\t\t\t\tNamespace: impersonationRequest.Namespace,\n\t\t\t\tName: impersonationRequest.Name,\n\t\t\t\tResourceRequest: true,\n\t\t\t}\n\n\t\t\tswitch gvk.GroupKind() {\n\t\t\tcase v1.SchemeGroupVersion.WithKind(\"ServiceAccount\").GroupKind():\n\t\t\t\tactingAsAttributes.Resource = \"serviceaccounts\"\n\t\t\t\tusername = serviceaccount.MakeUsername(impersonationRequest.Namespace, impersonationRequest.Name)\n\t\t\t\tif !groupsSpecified {\n\t\t\t\t\t// if groups aren't specified for a service account, we know the groups because its a fixed mapping. Add them\n\t\t\t\t\tgroups = serviceaccount.MakeGroupNames(impersonationRequest.Namespace)\n\t\t\t\t}\n\n\t\t\tcase v1.SchemeGroupVersion.WithKind(\"User\").GroupKind():\n\t\t\t\tactingAsAttributes.Resource = \"users\"\n\t\t\t\tusername = impersonationRequest.Name\n\n\t\t\tcase v1.SchemeGroupVersion.WithKind(\"Group\").GroupKind():\n\t\t\t\tactingAsAttributes.Resource = \"groups\"\n\t\t\t\tgroups = append(groups, impersonationRequest.Name)\n\n\t\t\tcase authenticationv1.SchemeGroupVersion.WithKind(\"UserExtra\").GroupKind():\n\t\t\t\textraKey := impersonationRequest.FieldPath\n\t\t\t\textraValue := impersonationRequest.Name\n\t\t\t\tactingAsAttributes.Resource = \"userextras\"\n\t\t\t\tactingAsAttributes.Subresource = extraKey\n\t\t\t\tuserExtra[extraKey] = append(userExtra[extraKey], extraValue)\n\n\t\t\tcase authenticationv1.SchemeGroupVersion.WithKind(\"UID\").GroupKind():\n\t\t\t\tuid = string(impersonationRequest.Name)\n\t\t\t\tactingAsAttributes.Resource = \"uids\"\n\n\t\t\tdefault:\n\t\t\t\tklog.V(4).InfoS(\"unknown impersonation request type\", \"request\", impersonationRequest)\n\t\t\t\tresponsewriters.Forbidden(ctx, actingAsAttributes, w, req, fmt.Sprintf(\"unknown impersonation request type: %v\", impersonationRequest), s)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tdecision, reason, err := a.Authorize(ctx, actingAsAttributes)\n\t\t\tif err != nil || decision != authorizer.DecisionAllow {\n\t\t\t\tklog.V(4).InfoS(\"Forbidden\", \"URI\", req.RequestURI, \"reason\", reason, \"err\", err)\n\t\t\t\tresponsewriters.Forbidden(ctx, actingAsAttributes, w, req, reason, s)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif username != user.Anonymous {\n\t\t\t// When impersonating a non-anonymous user, include the 'system:authenticated' group\n\t\t\t// in the impersonated user info:\n\t\t\t// - if no groups were specified\n\t\t\t// - if a group has been specified other than 'system:authenticated'\n\t\t\t//\n\t\t\t// If 'system:unauthenticated' group has been specified we should not include\n\t\t\t// the 'system:authenticated' group.\n\t\t\taddAuthenticated := true\n\t\t\tfor _, group := range groups {\n\t\t\t\tif group == user.AllAuthenticated || group == user.AllUnauthenticated {\n\t\t\t\t\taddAuthenticated = false\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif addAuthenticated {\n\t\t\t\tgroups = append(groups, user.AllAuthenticated)\n\t\t\t}\n\t\t} else {\n\t\t\taddUnauthenticated := true\n\t\t\tfor _, group := range groups {\n\t\t\t\tif group == user.AllUnauthenticated {\n\t\t\t\t\taddUnauthenticated = false\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif addUnauthenticated {\n\t\t\t\tgroups = append(groups, user.AllUnauthenticated)\n\t\t\t}\n\t\t}\n\n\t\tnewUser := &user.DefaultInfo{\n\t\t\tName: username,\n\t\t\tGroups: groups,\n\t\t\tExtra: userExtra,\n\t\t\tUID: uid,\n\t\t}\n\t\treq = req.WithContext(request.WithUser(ctx, newUser))\n\n\t\toldUser, _ := request.UserFrom(ctx)\n\t\thttplog.LogOf(req, w).Addf(\"%v is impersonating %v\", userString(oldUser), userString(newUser))\n\n\t\tae := audit.AuditEventFrom(ctx)\n\t\taudit.LogImpersonatedUser(ae, newUser)\n\n\t\t// clear all the impersonation headers from the request\n\t\treq.Header.Del(authenticationv1.ImpersonateUserHeader)\n\t\treq.Header.Del(authenticationv1.ImpersonateGroupHeader)\n\t\treq.Header.Del(authenticationv1.ImpersonateUIDHeader)\n\t\tfor headerName := range req.Header {\n\t\t\tif strings.HasPrefix(headerName, authenticationv1.ImpersonateUserExtraHeaderPrefix) {\n\t\t\t\treq.Header.Del(headerName)\n\t\t\t}\n\t\t}\n\n\t\thandler.ServeHTTP(w, req)\n\t})\n}", "title": "" }, { "docid": "48f78f20c19110572ce8b43186cbfa15", "score": "0.41889855", "text": "func (_ERC20PresetMinterPauser *ERC20PresetMinterPauserFilterer) WatchRoleGranted(opts *bind.WatchOpts, sink chan<- *ERC20PresetMinterPauserRoleGranted, role [][32]byte, account []common.Address, sender []common.Address) (event.Subscription, error) {\n\n\tvar roleRule []interface{}\n\tfor _, roleItem := range role {\n\t\troleRule = append(roleRule, roleItem)\n\t}\n\tvar accountRule []interface{}\n\tfor _, accountItem := range account {\n\t\taccountRule = append(accountRule, accountItem)\n\t}\n\tvar senderRule []interface{}\n\tfor _, senderItem := range sender {\n\t\tsenderRule = append(senderRule, senderItem)\n\t}\n\n\tlogs, sub, err := _ERC20PresetMinterPauser.contract.WatchLogs(opts, \"RoleGranted\", roleRule, accountRule, senderRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(ERC20PresetMinterPauserRoleGranted)\n\t\t\t\tif err := _ERC20PresetMinterPauser.contract.UnpackLog(event, \"RoleGranted\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "48f78f20c19110572ce8b43186cbfa15", "score": "0.41889855", "text": "func (_ERC20PresetMinterPauser *ERC20PresetMinterPauserFilterer) WatchRoleGranted(opts *bind.WatchOpts, sink chan<- *ERC20PresetMinterPauserRoleGranted, role [][32]byte, account []common.Address, sender []common.Address) (event.Subscription, error) {\n\n\tvar roleRule []interface{}\n\tfor _, roleItem := range role {\n\t\troleRule = append(roleRule, roleItem)\n\t}\n\tvar accountRule []interface{}\n\tfor _, accountItem := range account {\n\t\taccountRule = append(accountRule, accountItem)\n\t}\n\tvar senderRule []interface{}\n\tfor _, senderItem := range sender {\n\t\tsenderRule = append(senderRule, senderItem)\n\t}\n\n\tlogs, sub, err := _ERC20PresetMinterPauser.contract.WatchLogs(opts, \"RoleGranted\", roleRule, accountRule, senderRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(ERC20PresetMinterPauserRoleGranted)\n\t\t\t\tif err := _ERC20PresetMinterPauser.contract.UnpackLog(event, \"RoleGranted\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "12a1dbbe87e2654153e758746e473eb2", "score": "0.4183242", "text": "func (s *Server) UseStream(interceptors ...grpc.StreamServerInterceptor) *Server {\n\ts.streamInterceptors = append(s.streamInterceptors, interceptors...)\n\treturn s\n}", "title": "" }, { "docid": "8f2ed66264823e7381e0aed1e2552790", "score": "0.41753983", "text": "func (c *AuthCodeClient) Intercept(interceptors ...Interceptor) {\n\tc.inters.AuthCode = append(c.inters.AuthCode, interceptors...)\n}", "title": "" }, { "docid": "4058b8f65b02c439c991c06aca32b466", "score": "0.4173966", "text": "func (c *TradeTimeRangeClient) Intercept(interceptors ...Interceptor) {\n\tc.inters.TradeTimeRange = append(c.inters.TradeTimeRange, interceptors...)\n}", "title": "" }, { "docid": "288418efa594d6a573c8758fcc5970f2", "score": "0.4173435", "text": "func (m *randomStreamClient) RegisterInterception(fn InterceptFn) {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\tm.mu.interceptors = append(m.mu.interceptors, fn)\n}", "title": "" }, { "docid": "b6d475d5aaaaf5594e581b25ae51e949", "score": "0.4172726", "text": "func RemoveReadAccess(w http.ResponseWriter, r *http.Request) {\n\t//role := r.URL.Path[\"/stash-read/remove/\":];\n\trole := r.URL.Query().Get(\"role\");\n\tkey := r.URL.Query().Get(\"key\");\n\n\t// Validate APIKey\n\t// TODO: configure hostname and others\n\tvalidateApiKeyUrl := \"http://\" + config.EmoApiKeyHostForExistingPIIWebAppRegion + \"/tasks/api-key?action=view&APIKey=\" + adminAPIKey + \"&key=\" + key;\n\t_, response := postURL(validateApiKeyUrl);\n\tif strings.Contains(response, \"Unknown key\") {\n\t\tio.WriteString(w, \"Unknown API Key\");\n\t\treturn;\n\t}\n\n\t// Delete the policy document\n\tsvc := iam.New(session.New()); // TODO: have one ready when the server starts\n\tparams := &iam.DeleteRolePolicyInput{\n\t\tRoleName: aws.String(role),\n\t\tPolicyName: aws.String(\"allow-stash-read\"),\n\t};\n\tresp, err := svc.DeleteRolePolicy(params);\n\tif err != nil {\n\t\tglog.Error(err.Error());\n\t\tpanic(err);\n\t\treturn\n\t}\n\tglog.Info(resp);\n\n\t// Update APIKey\n\tattributeKey := \"read_stash\";\n\tremoveRoleUrl := \"http://\" + config.EmoApiKeyHostForExistingPIIWebAppRegion + \"/tasks/api-key?action=update_attribute&APIKey=\" + adminAPIKey + \"&key=\" + key + \"&attributeKey=\" + attributeKey + \"&removeAttributeValue=\" + role;\n\tstatusCode, _ := postURL(removeRoleUrl);\n\tif (statusCode != 200) {\n\t\tio.WriteString(w, \"There was a problem when updating the API key. Returned Response code: \" + string(statusCode));\n\t\treturn;\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\tio.WriteString(w, \"Success\");\n}", "title": "" }, { "docid": "76816ecac13a92415f7832cc8f0a2b40", "score": "0.4158117", "text": "func serviceCaster(kernel webkernel.Webkernel) func(ws *websocket.Conn) {\n\t\t\t\t\n\tcount := 0\t\n\t\t\n\treturn func(ws *websocket.Conn){\n\t\t\n\t\tcount += 1\n\t\trs := webkernel.CreateRShell(ws)\n\t\n\t\n\t\tkernel.LinkRs(rs)\t\t\t\n\t\trs.Run()\n\t}\n\t\n\n}", "title": "" }, { "docid": "c87665ea56fba821fd203816549a9ac5", "score": "0.4156437", "text": "func (_Token *TokenCaller) PAUSERROLE(opts *bind.CallOpts) ([32]byte, error) {\n\tvar (\n\t\tret0 = new([32]byte)\n\t)\n\tout := ret0\n\terr := _Token.contract.Call(opts, out, \"PAUSER_ROLE\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "ace06bb9e3c925a767c4c3435238090c", "score": "0.4149939", "text": "func (e *Enforcer) AddRoleForUser(user string, role string) {\n\te.AddGroupingPolicy([]string{user, role})\n}", "title": "" }, { "docid": "f0ab67e59bf77dc75b4bc16856a73e38", "score": "0.41416952", "text": "func elevateKubeSystemPrivileges(client kubernetes.Interface) error {\n\tstart := time.Now()\n\tclusterRoleBinding := &rbac.ClusterRoleBinding{\n\t\tObjectMeta: meta.ObjectMeta{\n\t\t\tName: rbacName,\n\t\t},\n\t\tSubjects: []rbac.Subject{\n\t\t\t{\n\t\t\t\tKind: \"ServiceAccount\",\n\t\t\t\tName: \"default\",\n\t\t\t\tNamespace: \"kube-system\",\n\t\t\t},\n\t\t},\n\t\tRoleRef: rbac.RoleRef{\n\t\t\tKind: \"ClusterRole\",\n\t\t\tName: \"cluster-admin\",\n\t\t},\n\t}\n\n\tif _, err := client.RbacV1beta1().ClusterRoleBindings().Get(rbacName, meta.GetOptions{}); err == nil {\n\t\tglog.Infof(\"Role binding %s already exists. Skipping creation.\", rbacName)\n\t\treturn nil\n\t}\n\tif _, err := client.RbacV1beta1().ClusterRoleBindings().Create(clusterRoleBinding); err != nil {\n\t\tnetErr, ok := err.(net.Error)\n\t\tif ok && netErr.Timeout() {\n\t\t\treturn &retry.RetriableError{Err: errors.Wrap(err, \"creating clusterrolebinding\")}\n\t\t}\n\t\treturn errors.Wrap(err, \"creating clusterrolebinding\")\n\t}\n\tglog.Infof(\"duration metric: took %s to wait for elevateKubeSystemPrivileges.\", time.Since(start))\n\treturn nil\n}", "title": "" }, { "docid": "3f8591c8f6ee389654786d79175df632", "score": "0.41344035", "text": "func (c *Client) Intercept(interceptors ...Interceptor) {\n\tc.Todo.Intercept(interceptors...)\n}", "title": "" }, { "docid": "fd25eeba33b063c68176ead1ea3cf415", "score": "0.41329122", "text": "func (_EcdsaSortitionPool *EcdsaSortitionPoolFilterer) FilterChaosnetOwnerRoleTransferred(opts *bind.FilterOpts) (*EcdsaSortitionPoolChaosnetOwnerRoleTransferredIterator, error) {\n\n\tlogs, sub, err := _EcdsaSortitionPool.contract.FilterLogs(opts, \"ChaosnetOwnerRoleTransferred\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &EcdsaSortitionPoolChaosnetOwnerRoleTransferredIterator{contract: _EcdsaSortitionPool.contract, event: \"ChaosnetOwnerRoleTransferred\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "4f5462bb77b4ebfd68f2e7075be9268d", "score": "0.4130865", "text": "func (c *TradeRecordClient) Intercept(interceptors ...Interceptor) {\n\tc.inters.TradeRecord = append(c.inters.TradeRecord, interceptors...)\n}", "title": "" }, { "docid": "16930a16978b7722acffeaa840ce964e", "score": "0.41302288", "text": "func ForwardOauthIdentity() Option {\n\treturn func(datasource *Prometheus) error {\n\t\tdatasource.builder.JSONData.(map[string]interface{})[\"oauthPassThru\"] = true\n\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "fc0047191ac680eb34f65992250c6199", "score": "0.4124142", "text": "func StreamServerInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {\n\tlog.Printf(\"before handling. Info: %+v\", info)\n\terr := handler(srv, ss)\n\tlog.Printf(\"after handling. err: %v\", err)\n\treturn err\n}", "title": "" }, { "docid": "4a9d1773f7aaecef5cccd0596f0e8ab9", "score": "0.41226333", "text": "func (c *DeviceTokenClient) Intercept(interceptors ...Interceptor) {\n\tc.inters.DeviceToken = append(c.inters.DeviceToken, interceptors...)\n}", "title": "" }, { "docid": "18d88e9b716bd91d3cccd37f683dc335", "score": "0.41184172", "text": "func NewMyServiceThreadsafeClient(t thrift.Transport, iprot thrift.Protocol, oprot thrift.Protocol) *MyServiceThreadsafeClient {\n return NewMyServiceClient(t, iprot, oprot)\n}", "title": "" }, { "docid": "1b12487fb1bf6895272d3af3e6408837", "score": "0.411525", "text": "func TestBasicFlowsWithOriginatingIdentity(t *testing.T) {\n\t// Enable the OriginatingIdentity feature\n\tutilfeature.DefaultFeatureGate.Set(fmt.Sprintf(\"%v=true\", scfeatures.OriginatingIdentity))\n\tdefer utilfeature.DefaultFeatureGate.Set(fmt.Sprintf(\"%v=false\", scfeatures.OriginatingIdentity))\n\n\tcreateChangeUsernameFunc := func(username string) func(*controllerTest) {\n\t\treturn func(ct *controllerTest) {\n\t\t\tcatalogClient, err := changeUsernameForCatalogClient(ct.catalogClient, ct.catalogClientConfig, username)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"could not change the username for the catalog client: %v\", err)\n\t\t\t}\n\t\t\tct.catalogClient = catalogClient\n\t\t\tct.client = catalogClient.ServicecatalogV1beta1()\n\t\t}\n\t}\n\n\tcreateVerifyUsernameFunc := func(actionType fakeosb.ActionType, username string) func(*controllerTest) {\n\t\treturn func(ct *controllerTest) {\n\t\t\tverifyUsernameInLastBrokerAction(ct.t, ct.osbClient, actionType, username)\n\t\t}\n\t}\n\n\tct := &controllerTest{\n\t\tt: t,\n\t\tbroker: getTestBroker(),\n\t\tinstance: getTestInstance(),\n\t\tbinding: getTestBinding(),\n\t\tpreCreateInstance: createChangeUsernameFunc(\"instance-creator\"),\n\t\tpostCreateInstance: createVerifyUsernameFunc(fakeosb.ProvisionInstance, \"instance-creator\"),\n\t\tpreDeleteInstance: createChangeUsernameFunc(\"instance-deleter\"),\n\t\tpostDeleteInstance: createVerifyUsernameFunc(fakeosb.DeprovisionInstance, \"instance-deleter\"),\n\t\tpreCreateBinding: createChangeUsernameFunc(\"binding-creator\"),\n\t\tpostCreateBinding: createVerifyUsernameFunc(fakeosb.Bind, \"binding-creator\"),\n\t\tpreDeleteBinding: createChangeUsernameFunc(\"binding-deleter\"),\n\t\tpostDeleteBinding: createVerifyUsernameFunc(fakeosb.Unbind, \"binding-deleter\"),\n\t}\n\tct.run(func(ct *controllerTest) {\n\t\t// Update Instance\n\t\tcreateChangeUsernameFunc(\"instance-updater\")(ct)\n\n\t\tct.instance.Spec.UpdateRequests = ct.instance.Spec.UpdateRequests + 1\n\t\tif _, err := ct.client.ServiceInstances(testNamespace).Update(ct.instance); err != nil {\n\t\t\tt.Fatalf(\"error updating Instance: %v\", err)\n\t\t}\n\n\t\tif err := util.WaitForInstanceProcessedGeneration(ct.client, testNamespace, testInstanceName, ct.instance.Status.ReconciledGeneration+1); err != nil {\n\t\t\tt.Fatalf(\"error waiting for instance to reconcile: %v\", err)\n\t\t}\n\n\t\tverifyUsernameInLastBrokerAction(t, ct.osbClient, fakeosb.UpdateInstance, \"instance-updater\")\n\t})\n}", "title": "" }, { "docid": "d8528b7ac937ea4d079d7cccad913cf1", "score": "0.4112214", "text": "func (m *UnifiedRoleManagementPolicy) SetLastModifiedBy(value Identityable)() {\n m.lastModifiedBy = value\n}", "title": "" }, { "docid": "6287e8d1ff267371b3d88ce07d5ad97d", "score": "0.4109835", "text": "func createExtensiveAuthorizer() *Authorizer {\n\tnodeWatcher := Role{\n\t\tName: \"node-watcher\",\n\t\tRules: []Rule{\n\t\t\t{\n\t\t\t\tVerbs: []string{\"get\", \"list\", \"watch\"},\n\t\t\t\tResources: []string{\"nodes\", \"locations\"},\n\t\t\t},\n\t\t\t{\n\t\t\t\tVerbs: []string{\"get\", \"update\", \"delete\"},\n\t\t\t\tResources: []string{\"nodes/states\"},\n\t\t\t\tResourceNames: []string{\"linux\"},\n\t\t\t},\n\t\t},\n\t}\n\treadonly := Role{\n\t\tName: \"readonly\",\n\t\tRules: []Rule{\n\t\t\t{\n\t\t\t\tVerbs: []string{\"get\", \"list\", \"watch\"},\n\t\t\t\tResources: []string{\"nodes\", \"locations\"},\n\t\t\t},\n\t\t},\n\t}\n\n\tlinuxNodeWatchers := RoleBinding{\n\t\tName: \"linux-node-watchers\",\n\t\tNamespace: \"linux\",\n\t\tRole: \"node-watcher\",\n\t\tSubjects: []Subject{\n\t\t\t{\n\t\t\t\tKind: User,\n\t\t\t\tName: \"bofh\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tKind: ServiceAccount,\n\t\t\t\tName: \"integrator\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tKind: Group,\n\t\t\t\tName: \"system:core\",\n\t\t\t},\n\t\t},\n\t}\n\n\tglobalNodeWatchers := RoleBinding{\n\t\tName: \"global-node-watchers\",\n\t\tRole: \"node-watcher\",\n\t\tSubjects: []Subject{\n\t\t\t{\n\t\t\t\tKind: Group,\n\t\t\t\tName: \"superusers\",\n\t\t\t},\n\t\t},\n\t}\n\n\treadOnlyServices := RoleBinding{\n\t\tName: \"readonly-services\",\n\t\tRole: \"readonly\",\n\t\tSubjects: []Subject{\n\t\t\t{\n\t\t\t\tKind: ServiceAccount,\n\t\t\t\tName: \"auditor\",\n\t\t\t},\n\t\t},\n\t}\n\n\ta := New()\n\terr := a.SetRole(nodeWatcher)\n\tif err != nil {\n\t\tpanic(\"SetRole failed\")\n\t}\n\n\terr = a.SetRole(readonly)\n\tif err != nil {\n\t\tpanic(\"SetRole failed\")\n\t}\n\n\terr = a.SetRoleBinding(linuxNodeWatchers)\n\tif err != nil {\n\t\tpanic(\"SetRoleBinding failed\")\n\t}\n\n\terr = a.SetRoleBinding(globalNodeWatchers)\n\tif err != nil {\n\t\tpanic(\"SetRoleBinding failed\")\n\t}\n\n\terr = a.SetRoleBinding(readOnlyServices)\n\tif err != nil {\n\t\tpanic(\"SetRoleBinding failed\")\n\t}\n\n\treturn a\n}", "title": "" }, { "docid": "42505972f16146c20038d59c0233f7fc", "score": "0.41067225", "text": "func (client AppsClient) UpdateScmAllowedResponder(resp *http.Response) (result CsmPublishingCredentialsPoliciesEntity, 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": "eba80509b41ca7800146818bee0bf635", "score": "0.40982103", "text": "func (c *Conn) UseStream(interceptors ...grpc.StreamClientInterceptor) *Conn {\n\tc.streamInterceptors = append(c.streamInterceptors, interceptors...)\n\treturn c\n}", "title": "" }, { "docid": "c87ea03839319e7cd24af44305c1aa03", "score": "0.40964034", "text": "func AddSudoersRoleForUser(user string) error {\n\tcmdName := instanceState.Config.OcPath\n\tcmdArgs := []string{\"login\", \"-u\", \"system:admin\"}\n\tif _, err := runner.Output(cmdName, cmdArgs...); err != nil {\n\t\treturn err\n\t}\n\t// https://docs.openshift.org/latest/architecture/additional_concepts/authentication.html#authentication-impersonation\n\tcmdArgs = []string{\"adm\", \"policy\", \"add-cluster-role-to-user\", \"sudoer\", user}\n\tif _, err := runner.Output(cmdName, cmdArgs...); err != nil {\n\t\treturn err\n\t}\n\tcmdArgs = []string{\"login\", \"-u\", user}\n\tif _, err := runner.Output(cmdName, cmdArgs...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1645336d78ab6db77a3eb5058e37caec", "score": "0.40883198", "text": "func (p *Proxy) Impersonate(w http.ResponseWriter, r *http.Request) {\n\tif r.Method == http.MethodPost {\n\t\tif err := r.ParseForm(); err != nil {\n\t\t\thttputil.ErrorResponse(w, r, err)\n\t\t\treturn\n\t\t}\n\t\tsession, err := p.sessionStore.LoadSession(r)\n\t\tif err != nil {\n\t\t\thttputil.ErrorResponse(w, r, err)\n\t\t\treturn\n\t\t}\n\t\t// authorization check -- is this user an admin?\n\t\tisAdmin, err := p.AuthorizeClient.IsAdmin(r.Context(), session)\n\t\tif err != nil || !isAdmin {\n\t\t\thttputil.ErrorResponse(w, r, httputil.Error(fmt.Sprintf(\"%s is not an administrator\", session.Email), http.StatusForbidden, err))\n\t\t\treturn\n\t\t}\n\t\t// CSRF check -- did this request originate from our form?\n\t\tc, err := p.csrfStore.GetCSRF(r)\n\t\tif err != nil {\n\t\t\thttputil.ErrorResponse(w, r, err)\n\t\t\treturn\n\t\t}\n\t\tp.csrfStore.ClearCSRF(w, r)\n\t\tencryptedCSRF := c.Value\n\t\tdecryptedCSRF := new(StateParameter)\n\t\tif err = p.cipher.Unmarshal(encryptedCSRF, decryptedCSRF); err != nil {\n\t\t\thttputil.ErrorResponse(w, r, err)\n\t\t\treturn\n\t\t}\n\t\tif decryptedCSRF.SessionID != r.FormValue(\"csrf\") {\n\t\t\thttputil.ErrorResponse(w, r, httputil.Error(\"CSRF mismatch\", http.StatusBadRequest, nil))\n\t\t\treturn\n\t\t}\n\n\t\t// OK to impersonation\n\t\tsession.ImpersonateEmail = r.FormValue(\"email\")\n\t\tsession.ImpersonateGroups = strings.Split(r.FormValue(\"group\"), \",\")\n\n\t\tif err := p.sessionStore.SaveSession(w, r, session); err != nil {\n\t\t\thttputil.ErrorResponse(w, r, err)\n\t\t\treturn\n\t\t}\n\t}\n\thttp.Redirect(w, r, \"/.pomerium\", http.StatusFound)\n}", "title": "" }, { "docid": "d1f5448dbc46c323aba9241cf5ca5ca9", "score": "0.40795124", "text": "func (r *ServiceClusterDeleteRequest) Impersonate(user string) *ServiceClusterDeleteRequest {\n\thelpers.AddImpersonationHeader(&r.header, user)\n\treturn r\n}", "title": "" }, { "docid": "c8e938b7c8d51b1250d3e02e7a078dfa", "score": "0.40784523", "text": "func (ssc StreamServerChain) Append(interceptors ...grpc.StreamServerInterceptor) StreamServerChain {\n\tins := make([]grpc.StreamServerInterceptor, 0, len(ssc.interceptors)+len(interceptors))\n\tins = append(ins, ssc.interceptors...)\n\tins = append(ins, interceptors...)\n\n\treturn StreamServerChain{interceptors: ins}\n}", "title": "" }, { "docid": "bcc5255e9f53e54e08d8b3496d0f2720", "score": "0.407678", "text": "func (client BaseClient) UpdateSupervisorSender(req *http.Request) (*http.Response, error) {\n sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n return autorest.SendWithSender(client, req, sd...)\n }", "title": "" }, { "docid": "140517e14017fd2c21c0ad647919ac9b", "score": "0.4073884", "text": "func (c *Conn) Use(interceptors ...grpc.UnaryClientInterceptor) *Conn {\n\tc.interceptors = append(c.interceptors, interceptors...)\n\treturn c\n}", "title": "" }, { "docid": "59fc6d4d8e60c86082265391c83d9391", "score": "0.4067717", "text": "func (s *SysServices) InjectInterceptors(unaryInterceptors []grpc.UnaryServerInterceptor, streamInterceptors []grpc.StreamServerInterceptor) ([]grpc.UnaryServerInterceptor, []grpc.StreamServerInterceptor) {\n\trecoveryOptions := []grpcRecovery.Option{\n\t\tgrpcRecovery.WithRecoveryHandler(s.recoveryHandler()),\n\t}\n\t// inject unary interceptors\n\tunaryInterceptors = append(\n\t\tunaryInterceptors,\n\t\tgrpcRecovery.UnaryServerInterceptor(recoveryOptions...),\n\t\ts.logger.GetServerUnaryInterceptor(),\n\t)\n\t// inject stream interceptors\n\tstreamInterceptors = append(\n\t\tstreamInterceptors,\n\t\tgrpcRecovery.StreamServerInterceptor(recoveryOptions...),\n\t\ts.logger.GetServerStreamInterceptor(),\n\t)\n\t// inject grpc auth\n\tunaryInterceptors, streamInterceptors = s.SysAccountSvc.InjectInterceptors(unaryInterceptors, streamInterceptors)\n\treturn unaryInterceptors, streamInterceptors\n}", "title": "" }, { "docid": "b7695fcd86bf1b3ae5b2992d003603a8", "score": "0.40664402", "text": "func StreamInterceptor(l Logger) grpc.StreamServerInterceptor {\n\treturn func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {\n\t\tcorrelationID, _ := contextutil.CorrelationIDFromContext(ss.Context())\n\t\tlogger := l.Fields(CorrelationID, correlationID, \"method\", info.FullMethod)\n\t\tnewCtx := NewContext(ss.Context(), logger)\n\t\twrapped := grpc_middleware.WrapServerStream(ss)\n\t\twrapped.WrappedContext = newCtx\n\t\t_, err := runWithLog(logger, info.FullMethod, func() (interface{}, error) {\n\t\t\terr := handler(srv, wrapped)\n\t\t\treturn nil, err\n\t\t})\n\t\treturn err\n\t}\n}", "title": "" }, { "docid": "2b0e54cf57668b2823ba741ea24f3d14", "score": "0.40646538", "text": "func rateLimitStreamServerInterceptor() grpc.StreamServerInterceptor {\n\treturn func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {\n\t\tctx := context.Background()\n\t\tparts := strings.Split(info.FullMethod, \"/\")\n\t\tinterfaceName := parts[len(parts)-1]\n\n\t\t// 暂时不支持按照调用方限流\n\t\tcaller := UNSPECIFIED_CALLER\n\t\terr := rateLimitRegistry.InterfaceRateLimit(ctx, interfaceName, caller)\n\t\tif err != nil {\n\t\t\tif err == rate_limit.ErrRateLimited {\n\t\t\t\txlog.Warnf(ctx, \"rate limited: method=%s, caller=%s\", info.FullMethod, caller)\n\t\t\t}\n\t\t\treturn err\n\t\t} else {\n\t\t\treturn handler(ctx, ss)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2b14d7772026c88574822aa7db94b7dd", "score": "0.40632418", "text": "func (i *interceptor) streamTracerInterceptor(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) (err error) {\n\tstart := time.Now()\n\tctx := stream.Context()\n\tmeta, ok := metadata.FromIncomingContext(ctx)\n\tif !ok {\n\t\treturn grpc.Errorf(codes.Aborted, \"missing context metadata\")\n\t}\n\n\tif metaDisableTrace := meta.Get(candihelper.HeaderDisableTrace); len(metaDisableTrace) > 0 {\n\t\tisDisableTrace, _ := strconv.ParseBool(metaDisableTrace[0])\n\t\tif isDisableTrace {\n\t\t\treturn handler(srv, &wrappedServerStream{\n\t\t\t\tServerStream: stream, wrappedContext: tracer.SkipTraceContext(ctx),\n\t\t\t})\n\t\t}\n\t}\n\n\tglobalTracer := opentracing.GlobalTracer()\n\topName := fmt.Sprintf(\"GRPC-STREAM: %s\", info.FullMethod)\n\n\tvar span opentracing.Span\n\tif spanCtx, err := globalTracer.Extract(opentracing.HTTPHeaders, tracer.GRPCMetadataReaderWriter(meta)); err != nil {\n\t\tspan, ctx = opentracing.StartSpanFromContext(ctx, opName)\n\t\text.SpanKindRPCServer.Set(span)\n\t} else {\n\t\tspan = globalTracer.StartSpan(opName, opentracing.ChildOf(spanCtx), ext.SpanKindRPCClient)\n\t\tctx = opentracing.ContextWithSpan(ctx, span)\n\t}\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\terr = grpc.Errorf(codes.Aborted, \"%v\", r)\n\t\t\ttracer.SetError(ctx, err)\n\t\t}\n\t\ti.logInterceptor(start, err, info.FullMethod, \"GRPC-STREAM\")\n\t\tlogger.LogGreen(\"grpc_stream > trace_url: \" + tracer.GetTraceURL(ctx))\n\t\tspan.Finish()\n\t}()\n\n\tif meta, ok := metadata.FromIncomingContext(ctx); ok {\n\t\tspan.SetTag(\"metadata\", string(candihelper.ToBytes(meta)))\n\t}\n\n\terr = handler(srv, &wrappedServerStream{ServerStream: stream, wrappedContext: ctx})\n\tif err != nil {\n\t\ttracer.SetError(ctx, err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "36bd9d4fa0e15ab6d5f073c05f91f16b", "score": "0.40582022", "text": "func (m *userManager) broadcastRevoked(token string) {\n\tconf.Cluster.mtx.RLock()\n\tif len(conf.Cluster.Conf) == 0 {\n\t\tconf.Cluster.mtx.RUnlock()\n\t\tglog.Warning(\"primary proxy is not defined\")\n\t\treturn\n\t}\n\tconf.Cluster.mtx.RUnlock()\n\n\ttokenList := ais.TokenList{Tokens: []string{token}}\n\tbody := cmn.MustMarshal(tokenList)\n\n\tm.broadcast(http.MethodDelete, cmn.Tokens, body)\n}", "title": "" }, { "docid": "95c44dc0658b98e0742b8e4708507abe", "score": "0.4053874", "text": "func (o SessionOutput) ServiceRole() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Session) pulumi.StringOutput { return v.ServiceRole }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d234ffc40cdad1a9e6016fce92448e38", "score": "0.40520126", "text": "func role(c *bm.Context) {\n\tvar (\n\t\tparams = c.Request.Form\n\t\tsystem string\n\t)\n\tif system = params.Get(\"system\"); system == \"\" {\n\t\tc.JSON(nil, ecode.RequestErr)\n\t\treturn\n\t}\n\tc.JSON(svr.Role(c, system), nil)\n}", "title": "" }, { "docid": "0dde634096e1a9e57a57ab2d2afe7429", "score": "0.40501946", "text": "func (client PersonClient) AddFaceFromStreamSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client,\n\t\treq,\n\t\tautorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "title": "" }, { "docid": "d02e3b156763688bcc57b7f485908d5d", "score": "0.40489167", "text": "func createPayableAuthenticationInterceptorWithMockService(PayableResourceService *service.PayableResourceService) PayableAuthenticationInterceptor {\n\treturn PayableAuthenticationInterceptor{\n\t\tService: *PayableResourceService,\n\t}\n}", "title": "" }, { "docid": "493d02eafe3bb263a5295c93830f3e81", "score": "0.40367207", "text": "func (a *Authenticator) StreamServerInterceptor() grpc.StreamServerInterceptor {\n\treturn grpc_auth.StreamServerInterceptor(a.authFunc)\n}", "title": "" } ]
b4ad679005e060066c313a9404143f8e
getRandomIPinSubnet returns a pseudorandom net.IP in the same subnet as the IP passed
[ { "docid": "f1df3b092eb78cabf95ecbf893da9def", "score": "0.8261225", "text": "func getRandomIPinSubnet(d *Driver, baseIP net.IP) (net.IP, error) {\n\tvar dhcpAddr net.IP\n\n\tnAddr := baseIP.To4()\n\t// select pseudo-random DHCP addr; make sure not to clash with the host\n\t// only try 5 times and bail if no random received\n\tfor i := 0; i < 5; i++ {\n\t\tn := d.randomInter.RandomInt(24) + 1\n\t\tif byte(n) != nAddr[3] {\n\t\t\tdhcpAddr = net.IPv4(nAddr[0], nAddr[1], nAddr[2], byte(n))\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif dhcpAddr == nil {\n\t\treturn nil, ErrUnableToGenerateRandomIP\n\t}\n\n\treturn dhcpAddr, nil\n}", "title": "" } ]
[ { "docid": "b55330ca1b113b46f1b324ce79ee7484", "score": "0.7447741", "text": "func createRandomIPNetwork() *net.IPNet {\n\ta := make([]int, 4)\n\tfor {\n\t\ta[0] = 1 + rand.Intn(223)\n\t\tfor i := 1; i < 4; i++ {\n\t\t\ta[i] = createRandom8BitIPAddress()\n\t\t}\n\t\tif a[0] != 169 || a[1] != 254 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tcidr := fmt.Sprintf(\"%d.%d.%d.%d/%d\", a[0], a[1], a[2], a[3], createRandomCIDRMask())\n\t_, ipn, err := net.ParseCIDR(cidr)\n\tif err != nil {\n\t\tpanic(\"Failed to net.ParseCIDR(): \" + err.Error())\n\t}\n\n\treturn ipn\n}", "title": "" }, { "docid": "b38094e27d63a470b9da737602092440", "score": "0.7147656", "text": "func (g *V6Gen) IP() net.IP {\n\t// First get a completely random IP\n\tip := make(net.IP, 16)\n\tidx := rand.Intn(len(g.subnets))\n\n\tfor i := range ip {\n\t\tip[i] = byte(rand.Intn(255))\n\t\tip[i] &= g.masks[idx][i]\n\t\tip[i] |= g.ips[idx][i]\n\t}\n\treturn ip\n}", "title": "" }, { "docid": "79bf81c2b4f131e41b6cfc78f9a77b59", "score": "0.7049262", "text": "func randomIP() net.IP {\n\ti := rand.Uint32()\n\ta := byte(i)\n\tb := byte(i >> 8)\n\tc := byte(i >> 16)\n\td := byte(i >> 24)\n\treturn net.IPv4(a, b, c, d)\n}", "title": "" }, { "docid": "bab1c3c17e1fa2695e8a5b0f58d3db60", "score": "0.6980748", "text": "func randomIP() net.IP {\n\trandBuf := make([]byte, 4)\n\tsecureRand.Read(randBuf)\n\n\t// Ensure non-zeros with various bitmasks\n\treturn net.IPv4(randBuf[0]|0x10, randBuf[1]|0x10, randBuf[2]|0x1, randBuf[3]|0x10)\n}", "title": "" }, { "docid": "4251a94722ede08e72f4626b6f597a3e", "score": "0.67445004", "text": "func (g *V4Gen) IP() net.IP {\n\t// First get a completely random IP\n\tip := make(net.IP, 4)\n\tidx := rand.Intn(len(g.subnets))\n\tbinary.BigEndian.PutUint32(ip, (rand.Uint32()&g.masks[idx])|g.ips[idx])\n\treturn ip\n}", "title": "" }, { "docid": "4ae9a8d0b307466a16070eec7c05872d", "score": "0.6431725", "text": "func randAddr(t *testing.T) *wire.NetAddress {\n\tt.Helper()\n\n\tipv4 := rand.Intn(2) == 0\n\tvar ip net.IP\n\tif ipv4 {\n\t\tvar b [4]byte\n\t\tif _, err := rand.Read(b[:]); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tip = b[:]\n\t} else {\n\t\tvar b [16]byte\n\t\tif _, err := rand.Read(b[:]); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tip = b[:]\n\t}\n\n\treturn &wire.NetAddress{\n\t\tServices: protocol.ServiceFlag(rand.Uint64()),\n\t\tIP: ip,\n\t\tPort: uint16(rand.Uint32()),\n\t}\n}", "title": "" }, { "docid": "814181dded76145b0f98532eb666754c", "score": "0.643013", "text": "func (a Anonymizer) GetRandomIp() string {\n\tif a.rand.Intn(2) == 1 {\n\t\treturn fmt.Sprintf(\"%x:%x:%x:%x:%x:%x:%x:%x\",\n\t\t\ta.rand.Intn(65535)+1,\n\t\t\ta.rand.Intn(65535)+1,\n\t\t\ta.rand.Intn(65535)+1,\n\t\t\ta.rand.Intn(65535)+1,\n\t\t\ta.rand.Intn(65535)+1,\n\t\t\ta.rand.Intn(65535)+1,\n\t\t\ta.rand.Intn(65535)+1,\n\t\t\ta.rand.Intn(65535)+1,\n\t\t)\n\t}\n\n\treturn fmt.Sprintf(\"%d.%d.%d.%d\",\n\t\ta.rand.Intn(255)+1,\n\t\ta.rand.Intn(255)+1,\n\t\ta.rand.Intn(255)+1,\n\t\ta.rand.Intn(255)+1,\n\t)\n}", "title": "" }, { "docid": "6d07ae4a312f163ff8a2049edbc38f4d", "score": "0.63419443", "text": "func randAddr(t *testing.T) *wire.NetAddressV2 {\n\tt.Helper()\n\n\tipv4 := rand.Intn(2) == 0\n\tvar ip net.IP\n\tif ipv4 {\n\t\tvar b [4]byte\n\t\tif _, err := rand.Read(b[:]); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tip = b[:]\n\t} else {\n\t\tvar b [16]byte\n\t\tif _, err := rand.Read(b[:]); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tip = b[:]\n\t}\n\n\tservices := wire.ServiceFlag(rand.Uint64())\n\tport := uint16(rand.Uint32())\n\n\treturn wire.NetAddressV2FromBytes(\n\t\ttime.Now(), services, ip, port,\n\t)\n}", "title": "" }, { "docid": "496ef242decb7dfb750f0d000ee0ed35", "score": "0.63350123", "text": "func GetRandomChinaIP(wg RandomGenerator) string {\n\td1 := wg.Next(len(seed))\n\td2 := wg.Next(int(seed[d1][1] - seed[d1][0]))\n\treturn int2ip(seed[d1][0] + int32(d2))\n}", "title": "" }, { "docid": "b82b0b95bbc3a9a6949635e504d2b00f", "score": "0.6334778", "text": "func generateRange() (ipRange string, insideIP string) {\n\n\tconst minIP = math.MaxInt32 / 128 // don't want empty IP bytes\n\tconst maxIP = math.MaxInt32 / 2\n\n\tconst randBorder = maxIP - minIP\n\n\trand.Seed(time.Now().UnixNano())\n\tlow := minIP + rand.Int63n(randBorder)\n\n\trand.Seed(time.Now().UnixNano())\n\thigh := minIP + rand.Int63n(randBorder)\n\n\tif low > high {\n\t\tlow, high = high, low\n\t}\n\n\tbetween := generateBetween(low, high)\n\n\tif between < low || high < between {\n\t\tpanic(\"invalid ip generated\")\n\t}\n\n\tlowIP := netaddr.MustNewIPAddress(low).String()\n\thighIP := netaddr.MustNewIPAddress(high).String()\n\n\ttestregex := regexp.MustCompile(`[.:0-9]+`)\n\n\tif !(testregex.MatchString(lowIP) && testregex.MatchString(highIP)) {\n\t\tpanic(fmt.Errorf(\"invalid ip generatred: low: %q high: %q\", lowIP, highIP))\n\t}\n\n\tbetweenIPStr := netaddr.MustNewIPAddress(between).String()\n\n\thyphenRange := fmt.Sprintf(\"%s - %s\", lowIP, highIP)\n\n\trand.Seed(time.Now().UnixNano())\n\n\tif rand.Int()%2 == 0 {\n\t\treturn hyphenRange, betweenIPStr\n\t}\n\n\trand.Seed(time.Now().UnixNano())\n\tmask := rand.Intn(32-1) + 1\n\n\tcidrRange := fmt.Sprintf(\"%s/%d\", lowIP, mask)\n\n\tnet := netaddr.MustNewIPNetwork(cidrRange)\n\n\tlowerInt := net.First().BigInt().Int64()\n\thigherInt := net.Last().BigInt().Int64()\n\n\tbetween = generateBetween(lowerInt, higherInt)\n\n\tif between < lowerInt || higherInt < between {\n\t\tpanic(\"invalid ip generated\")\n\t}\n\n\tbetweenIP := netaddr.MustNewIPAddress(between)\n\n\treturn cidrRange, betweenIP.String()\n}", "title": "" }, { "docid": "b40699837c09cc2e37acba09846d7510", "score": "0.6192418", "text": "func (tree *Tree) GetRandomNetwork(rnum *rand.Rand) *net.IPNet {\n\ttree.mtx.RLock()\n\tdefer tree.mtx.RUnlock()\n\tsubnets := tree.roots\n\tfor _, root := range tree.roots {\n\t\tsubnets = append(subnets, getSubnetChildren(root.children, []*subnet{})...)\n\t}\n\tallChoices := make([]randutil.WeightedObj, len(subnets))\n\tfor i := range allChoices {\n\t\t_, numZeros := subnets[i].network.Mask.Size()\n\t\tallChoices[i] = randutil.WeightedObj{\n\t\t\tWeight: numZeros,\n\t\t\tObject: subnets[i],\n\t\t}\n\t}\n\tif len(allChoices) == 0 {\n\t\ttime.Sleep(time.Second)\n\t\treturn nil\n\t}\n\tchoice, err := randutil.WeightedChoice(allChoices, rnum)\n\tif err != nil {\n\t\tlog.Fatal(\"weightedChoice:\", err.Error())\n\t}\n\treturn subnetmath.DuplicateNetwork(choice.Object.(*subnet).network)\n}", "title": "" }, { "docid": "4e33f6a16b6e648af98d95d90ddbf37d", "score": "0.5862724", "text": "func random() string {\n\treturn getLocalIp() + strconv.Itoa(\n\t\trand.New(\n\t\t\trand.NewSource(\n\t\t\t\ttime.Now().UnixNano(),\n\t\t\t),\n\t\t).Int(),\n\t)\n}", "title": "" }, { "docid": "249c08b800b0ea71ad9d3ca6d47a00e3", "score": "0.5852004", "text": "func IPv6Address() string { return ipv6Address(globalFaker.Rand) }", "title": "" }, { "docid": "7e34c8d7b99d57c98eb3d8b51bac77b7", "score": "0.57323515", "text": "func IPsFromSubnet(arg string) (res []string) {\n\tgen, err := ipnetgen.New(arg)\n\tif err != nil {\n\t\tlog.FATAL.Fatal(\"could not create iterator\")\n\t}\n\n\tfor ip := gen.Next(); ip != nil; ip = gen.Next() {\n\t\tres = append(res, ip.String())\n\t}\n\t// remove network and broadcast address\n\treturn res[1 : len(res)-1]\n}", "title": "" }, { "docid": "739574101f13e84342fe0ebcb25648a2", "score": "0.5644789", "text": "func (f *Faker) IPv6Address() string { return ipv6Address(f.Rand) }", "title": "" }, { "docid": "7e4c3facc461dda64d64cfd014724635", "score": "0.56314343", "text": "func (r Network_Subnet_IpAddress) GetSubnet() (resp datatypes.Network_Subnet, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Subnet_IpAddress\", \"getSubnet\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "ebc79854890ff60eb870acb9cceca9cd", "score": "0.56074405", "text": "func GetRandomSSHPort(podIP string) string {\n\tparts := strings.Split(podIP, \".\")\n\trdm := parts[len(parts)-1]\n\n\tif len(rdm) == 1 {\n\t\trdm = fmt.Sprintf(\"0%s\", rdm)\n\t}\n\n\tif len(rdm) > 2 {\n\t\trdm = rdm[len(rdm)-2:]\n\t}\n\n\treturn fmt.Sprintf(\"22%s\", rdm)\n}", "title": "" }, { "docid": "2df1e9785a5d21e83716b946eaa05abf", "score": "0.55674374", "text": "func RandomAddress() (*common.Address, error) {\n bytes := make([]byte, common.AddressLength)\n _, err := rand.Read(bytes)\n if err != nil {\n return nil, err\n }\n address := common.BytesToAddress(bytes)\n return &address, nil\n}", "title": "" }, { "docid": "f0bdd6d121b48106d3ef48fa836a7ddf", "score": "0.5544879", "text": "func (m *Mechanism) GenerateRandomVNI() (uint32, error) {\n\tif m.SrcIP() != nil && m.DstIP() != nil {\n\t\tvni := rand.Uint32() // #nosec\n\t\tif m.EvenVNI() {\n\t\t\tvni = (2 * vni) & 0x00FFFFFF\n\t\t} else {\n\t\t\tvni = (2*vni + 1) & 0x00FFFFFF\n\t\t}\n\t\treturn vni, nil\n\t}\n\treturn 0, errors.Errorf(\"both srcIP(%s) and dstIP(%s) must be non-nil\", m.SrcIP(), m.DstIP())\n}", "title": "" }, { "docid": "39a30fb40394069d10892dc1e8fca2ef", "score": "0.5538509", "text": "func generatedIP() string {\n\tvar arr [4]int\n\tfor i := 0; i < 4; i++ {\n\t\trand.Seed(time.Now().UnixNano())\n\t\tarr[i] = rand.Intn(256)\n\t}\n\tid = fmt.Sprintf(\"http://%d.%d.%d.%d\", arr[0], arr[1], arr[2], arr[3])\n\treturn id\n}", "title": "" }, { "docid": "1a0dabb3e4a49828e6035f6248d7de56", "score": "0.552542", "text": "func (r Network_Subnet) GetSubnetForIpAddress(ipAddress *string) (resp datatypes.Network_Subnet, err error) {\n\tparams := []interface{}{\n\t\tipAddress,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Subnet\", \"getSubnetForIpAddress\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "bfb9671d266dd28799c5c9ea20225cbd", "score": "0.5426686", "text": "func NewSubnet(pool iplib.IPNet) (*Subnet, error) {\n\tif pool == nil {\n\t\treturn nil, errors.New(\"Allocated address pool is empty\")\n\t}\n\n\treturn &Subnet{ID: makeRandomString(16), Pool: pool.String(), V: uint8(pool.Version()), Idx: 1}, nil\n}", "title": "" }, { "docid": "7fc7ed4407ccc6e4b08fdb2b7ddc5482", "score": "0.54083437", "text": "func PublicSubnet_FromSubnetId(scope constructs.Construct, id *string, subnetId *string) ISubnet {\n\t_init_.Initialize()\n\n\tvar returns ISubnet\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_ec2.PublicSubnet\",\n\t\t\"fromSubnetId\",\n\t\t[]interface{}{scope, id, subnetId},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "02d967bcfb7c69b07e9f72424e99d41f", "score": "0.5386924", "text": "func (s *DhcpServer) findMatchingSubnet(ipAddr net.IP) *subnetType {\n\tfor _, subnet := range s.subnets {\n\t\tsubnetMask := net.IPMask(subnet.IpMask)\n\t\tsubnetAddr := subnet.IpGateway.Mask(subnetMask)\n\t\tif ipAddr.Mask(subnetMask).Equal(subnetAddr) {\n\t\t\treturn subnet\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2ecd6d467d98db39ceca166168c3bab9", "score": "0.53577274", "text": "func (i *Internet) IP() string {\n\tresult := []string{}\n\n\tfor i := 0; i < 4; i++ {\n\t\tresult = append(result, string(random(255)))\n\t}\n\n\treturn strings.Join(result, \".\")\n}", "title": "" }, { "docid": "f774133a1707e5aae5a95a2d300f81b6", "score": "0.5354643", "text": "func GetRandomListenAddress(currentAddress string) (string, error) {\n\taddrOrig, _, err := net.SplitHostPort(currentAddress)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tnewPort, err := freeport.GetFreePort()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn net.JoinHostPort(addrOrig, fmt.Sprintf(\"%d\", newPort)), nil\n}", "title": "" }, { "docid": "bbf2880096eae32b3f0c530c8eed1ad9", "score": "0.53343594", "text": "func IPv4Address() string { return ipv4Address(globalFaker.Rand) }", "title": "" }, { "docid": "60cf98f658ae12f5f32ff42de6d8b2d4", "score": "0.5298137", "text": "func RandLoopAddr() (string, error) {\n\t// When port 0 is specified, net.ListenTCP will automatically choose a port\n\taddr, err := net.ResolveTCPAddr(\"tcp\", \"localhost:0\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tln, err := net.ListenTCP(\"tcp\", addr)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tdefer func() {\n\t\t_ = ln.Close()\n\t}()\n\n\treturn ln.Addr().String(), nil\n}", "title": "" }, { "docid": "e69c2e37f77f4b9713e54151a330060e", "score": "0.5296053", "text": "func GetNetworkSubnetIpAddressService(sess *session.Session) Network_Subnet_IpAddress {\n\treturn Network_Subnet_IpAddress{Session: sess}\n}", "title": "" }, { "docid": "2d66931a720cfc148ee125dd59a5b7e0", "score": "0.52940387", "text": "func NewSubnet(ctx *pulumi.Context,\n\tname string, args *SubnetArgs, opts ...pulumi.ResourceOption) (*Subnet, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ResourceGroupName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ResourceGroupName'\")\n\t}\n\tif args.VirtualNetworkName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'VirtualNetworkName'\")\n\t}\n\taliases := pulumi.Aliases([]pulumi.Alias{\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20180201:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20150501preview:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20150501preview:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20150615:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20150615:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20160330:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20160330:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20160601:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20160601:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20160901:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20160901:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20161201:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20161201:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20170301:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20170301:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20170601:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20170601:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20170801:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20170801:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20170901:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20170901:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20171001:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20171001:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20171101:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20171101:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20180101:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20180101:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20180401:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20180401:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20180601:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20180601:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20180701:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20180701:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20180801:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20180801:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20181001:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20181001:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20181101:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20181101:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20181201:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20181201:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20190201:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20190201:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20190401:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20190401:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20190601:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20190601:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20190701:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20190701:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20190801:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20190801:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20190901:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20190901:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20191101:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20191101:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20191201:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20191201:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20200301:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20200301:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20200401:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20200401:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20200501:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20200501:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20200601:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20200601:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20200701:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20200701:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20200801:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20200801:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20201101:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20201101:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20210201:Subnet\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20210201:Subnet\"),\n\t\t},\n\t})\n\topts = append(opts, aliases)\n\tvar resource Subnet\n\terr := ctx.RegisterResource(\"azure-native:network/v20180201:Subnet\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "3b910eb24d9c4c904bd547285a0b8307", "score": "0.52734363", "text": "func (nc *NetworkConfig) RandomAddress() *Address {\n\trand.Seed(int64(time.Now().Nanosecond()))\n\tindex := rand.Intn(len(nc.Nodes))\n\treturn nc.Nodes[index]\n}", "title": "" }, { "docid": "e1bf9ade1593a62b28af1213dfde30ab", "score": "0.5261097", "text": "func (r Network_Subnet_IpAddress) GetByIpAddress(ipAddress *string) (resp datatypes.Network_Subnet_IpAddress, err error) {\n\tparams := []interface{}{\n\t\tipAddress,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Subnet_IpAddress\", \"getByIpAddress\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "ba6b808bc5485f4b117a9956444cb76b", "score": "0.52414817", "text": "func (n *Network) GetNextIp(mask string) (string, error) {\n\tip := n.ipnet.IP\n\n\t// TODO: better algorithm for this all. github.com/apparentlymart/go-cidr looks decent\n\tn.nextIp++\n\n\tipn := big.NewInt(0).SetBytes([]byte(ip))\n\tipn.Add(ipn, big.NewInt(n.nextIp))\n\n\tb := ipn.Bytes()\n\tsubnetMask := net.IPMask(net.ParseIP(mask))\n\tif subnetMask == nil {\n\t\tsubnetMask = net.IPMask(net.ParseIP(n.BindMask))\n\t\tif subnetMask == nil {\n\t\t\tsubnetMask = n.ipnet.Mask\n\t\t}\n\t}\n\tout := net.IPNet{\n\t\tIP: net.IPv4(b[0], b[1], b[2], b[3]),\n\t\tMask: subnetMask,\n\t}\n\treturn out.String(), nil\n}", "title": "" }, { "docid": "07eb2a01314b599a1251a79f9fc562b2", "score": "0.5238696", "text": "func RandomWeightedV6Generator(count int) (*V6Gen, error) {\n\tvar subnets []*net.IPNet\n\n\t// First generate a small subnet that will make most of our IPs\n\tnetstr := rd.IpV6Address() + fmt.Sprintf(\"/%d\", 112+rand.Intn(12))\n\t_, n, err := net.ParseCIDR(netstr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Now put that subnet in several times\n\tfor i := 0; i < int(3*count/10); i++ {\n\t\tsubnets = append(subnets, n)\n\t}\n\n\t// Now generate a few more that will be pretty frequent\n\tfor i := 0; i < 2+rand.Intn(3); i++ {\n\t\tnetstr = rd.IpV6Address() + fmt.Sprintf(\"/%d\", 104+rand.Intn(20))\n\t\t_, n, err = net.ParseCIDR(netstr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Now put that subnet in several times\n\t\tfor j := 0; j < int(count/10); j++ {\n\t\t\tsubnets = append(subnets, n)\n\t\t}\n\t}\n\n\t// Now add some more one-offs\n\tfor len(subnets) < count {\n\t\tnetstr = rd.IpV6Address() + fmt.Sprintf(\"/%d\", 64+rand.Intn(60))\n\t\t_, n, err = net.ParseCIDR(netstr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsubnets = append(subnets, n)\n\t}\n\treturn NewV6Generator(subnets)\n}", "title": "" }, { "docid": "c47b585348e67c92780db32cf9122c71", "score": "0.52351296", "text": "func randMACAddress() net.HardwareAddr {\n\tmacAddr := make([]byte, 6)\n\trand.Read(macAddr)\n\tmacAddr[0] &= 0xfe; // clear multicast bit\n\tmacAddr[0] |= 0x02 // set local assignment bit (IEEE802)\n\treturn net.HardwareAddr(macAddr)\n}", "title": "" }, { "docid": "472733ec15b5d3538539282910b04187", "score": "0.5228877", "text": "func (w *Wireguard) getNextIPNet() (*net.IPNet, error) {\n\taddress := \"10.8.0.3/32\"\n\t_, ipNet, err := net.ParseCIDR(address)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to parse ip with mask\")\n\t}\n\treturn ipNet, nil\n}", "title": "" }, { "docid": "12adf91b6f9eeb9f9544daace971621c", "score": "0.52242965", "text": "func randAddr(addrs []string) (string, int) {\n\tsize := len(addrs)\n\tif size == 0 {\n\t\treturn \"\", 0\n\t}\n\tidx := rand.Intn(size)\n\treturn addrs[idx], idx\n}", "title": "" }, { "docid": "6df196748b297e47ad33ebba8da4633c", "score": "0.52135694", "text": "func getNextIP(originalIP net.IP, mask net.IPMask) (net.IP, bool) {\n\tisIpv4 := originalIP.To4() != nil\n\n\tfixArraySize := func(ip net.IP) net.IP {\n\t\tif isIpv4 {\n\t\t\treturn utils.TakeLastNItemsFromByteArray(ip, net.IPv4len)\n\t\t}\n\t\treturn utils.TakeLastNItemsFromByteArray(ip, net.IPv6len)\n\t}\n\n\t// for ipv4 take last 4 bytes because IPv4 can be represented as IPv6 internally\n\toriginalIP = fixArraySize(originalIP)\n\n\tintValue := big.NewInt(0)\n\n\tfor byteIndex, byteValue := range originalIP {\n\t\tshiftTo := uint((len(originalIP) - byteIndex - 1) * 8)\n\t\tintValue = intValue.Or(\n\t\t\tintValue, big.NewInt(0).Lsh(big.NewInt(int64(byteValue)), shiftTo),\n\t\t)\n\t}\n\n\tintValue = intValue.Add(intValue, big.NewInt(1))\n\n\tresultIP := net.IP(intValue.Bytes())\n\n\t// adding one can overflow the value leading to an array of 5 or 17 elements\n\t// and there is an options where we don't have enough leading zeros\n\tresultIP = fixArraySize(resultIP)\n\n\toriginalIPNetwork := originalIP.Mask(mask)\n\tresultIPNetwork := resultIP.Mask(mask)\n\n\tif !originalIPNetwork.Equal(resultIPNetwork) {\n\t\t// network differs, there was an overflow\n\t\t// we still want networks to be the same\n\t\tvar invertedMask net.IPMask\n\t\tfor _, maskByte := range mask {\n\t\t\tinvertedMask = append(invertedMask, maskByte^255)\n\t\t}\n\n\t\tresultHostIP := resultIP.Mask(invertedMask)\n\n\t\t// combine original IP's network part and result IP's host part\n\t\tintValue := big.NewInt(0).SetBytes(originalIPNetwork)\n\t\tintValue = intValue.Or(intValue, big.NewInt(0).SetBytes(resultHostIP))\n\n\t\treturn intValue.Bytes(), true\n\t}\n\n\treturn resultIP, false\n}", "title": "" }, { "docid": "6df196748b297e47ad33ebba8da4633c", "score": "0.52135694", "text": "func getNextIP(originalIP net.IP, mask net.IPMask) (net.IP, bool) {\n\tisIpv4 := originalIP.To4() != nil\n\n\tfixArraySize := func(ip net.IP) net.IP {\n\t\tif isIpv4 {\n\t\t\treturn utils.TakeLastNItemsFromByteArray(ip, net.IPv4len)\n\t\t}\n\t\treturn utils.TakeLastNItemsFromByteArray(ip, net.IPv6len)\n\t}\n\n\t// for ipv4 take last 4 bytes because IPv4 can be represented as IPv6 internally\n\toriginalIP = fixArraySize(originalIP)\n\n\tintValue := big.NewInt(0)\n\n\tfor byteIndex, byteValue := range originalIP {\n\t\tshiftTo := uint((len(originalIP) - byteIndex - 1) * 8)\n\t\tintValue = intValue.Or(\n\t\t\tintValue, big.NewInt(0).Lsh(big.NewInt(int64(byteValue)), shiftTo),\n\t\t)\n\t}\n\n\tintValue = intValue.Add(intValue, big.NewInt(1))\n\n\tresultIP := net.IP(intValue.Bytes())\n\n\t// adding one can overflow the value leading to an array of 5 or 17 elements\n\t// and there is an options where we don't have enough leading zeros\n\tresultIP = fixArraySize(resultIP)\n\n\toriginalIPNetwork := originalIP.Mask(mask)\n\tresultIPNetwork := resultIP.Mask(mask)\n\n\tif !originalIPNetwork.Equal(resultIPNetwork) {\n\t\t// network differs, there was an overflow\n\t\t// we still want networks to be the same\n\t\tvar invertedMask net.IPMask\n\t\tfor _, maskByte := range mask {\n\t\t\tinvertedMask = append(invertedMask, maskByte^255)\n\t\t}\n\n\t\tresultHostIP := resultIP.Mask(invertedMask)\n\n\t\t// combine original IP's network part and result IP's host part\n\t\tintValue := big.NewInt(0).SetBytes(originalIPNetwork)\n\t\tintValue = intValue.Or(intValue, big.NewInt(0).SetBytes(resultHostIP))\n\n\t\treturn intValue.Bytes(), true\n\t}\n\n\treturn resultIP, false\n}", "title": "" }, { "docid": "293717e8b664f72adf7e4cd2c45e4a5f", "score": "0.5184466", "text": "func get_random_network_node() (rand_num int64){\n\tdefer map_lock.Unlock()\n\n map_lock.Lock()\n for(true){\n rand_num := rand.Intn(number_of_network_nodes)\n //If we generated a channel id that is in use in the network, return the number\n if val, ok := network[int64(rand_num)]; ok {\n _ = val\n return int64(rand_num)\n }\n }\n return int64(rand_num)\n}", "title": "" }, { "docid": "4938c4f2084fc13f31cc75fb5a3e353b", "score": "0.51696604", "text": "func IsIpWithSubnet(ip string) (b bool) {\n\tif ip == \"\" {\n\t\treturn true\n\t}\n\tif m, _ := regexp.MatchString(\"^(25[0-5]|2[0-4]\\\\d|[0-1]\\\\d{2}|[1-9]?\\\\d)\\\\.(25[0-5]|2[0-4]\\\\d|[0-1]\\\\d{2}|[1-9]?\\\\d)\\\\.(25[0-5]|2[0-4]\\\\d|[0-1]\\\\d{2}|[1-9]?\\\\d)\\\\.(25[0-5]|2[0-4]\\\\d|[0-1]\\\\d{2}|[1-9]?\\\\d)/(25[0-5]|2[0-4]\\\\d|[0-1]\\\\d{2}|[1-9]?\\\\d)$\", ip); !m {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "d9101acaedf6f49952c9c914e3920fb1", "score": "0.5164896", "text": "func Start(subnet *net.IPNet) net.IP {\n\tif subnet == nil {\n\t\treturn nil\n\t}\n\treturn subnet.IP.Mask(subnet.Mask)\n}", "title": "" }, { "docid": "168a9606f1d732d6c66f2b5314788c9c", "score": "0.5164093", "text": "func RandEmail() string {\n\treturn fmt.Sprintf(\"test.user.%s@userkit.co\", RandStr(8))\n}", "title": "" }, { "docid": "fe7c727316416cde2b57b64e4f5b1f9b", "score": "0.51623917", "text": "func (sn *Subnet) ReturnAddress(ip string) error {\n\t// if we get ip with mask\n\tip = strings.Split(ip, \"/\")[0]\n\n\tsn.Lock()\n\tdefer sn.Unlock()\n\n\tfor k, v := range sn.Allocated {\n\t\tif v == ip {\n\t\t\tsn.Allocated[k] = sn.Allocated[len(sn.Allocated)-1]\n\t\t\tsn.Allocated = sn.Allocated[:len(sn.Allocated)-1]\n\t\t\tsn.Free = append(sn.Free, ip)\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn errors.New(\"Returned address not found in block \" + sn.ID)\n}", "title": "" }, { "docid": "68aa9aca8bb63c328510ac1aa1e2d947", "score": "0.51384467", "text": "func TestKicCustomSubnet(t *testing.T) {\n\tif !KicDriver() {\n\t\tt.Skip(\"only runs with docker/podman driver\")\n\t}\n\n\tprofile := UniqueProfileName(\"custom-subnet\")\n\tctx, cancel := context.WithTimeout(context.Background(), Minutes(5))\n\tdefer Cleanup(t, profile, cancel)\n\n\tsubnet := \"192.168.60.0/24\"\n\tstartArgs := []string{\"start\", \"-p\", profile, fmt.Sprintf(\"--subnet=%s\", subnet)}\n\tc := exec.CommandContext(ctx, Target(), startArgs...)\n\trr, err := Run(t, c)\n\tif err != nil {\n\t\tt.Fatalf(\"%v failed: %v\\n%v\", rr.Command(), err, rr.Output())\n\t}\n\n\tverifySubnet(ctx, t, profile, subnet)\n}", "title": "" }, { "docid": "9c1179ec50c56b699ccc3b031c67f7b4", "score": "0.5135026", "text": "func (snr *subnetAllocatorRange) allocateNetwork() *net.IPNet {\n\tnetMaskSize, addrLen := snr.network.Mask.Size()\n\tnumSubnets := uint32(1) << snr.subnetBits\n\tif snr.subnetBits > 24 {\n\t\t// We need to make sure that the uint32 math below won't overflow. If\n\t\t// snr.subnetBits > 32 then numSubnets has already overflowed, but also if\n\t\t// numSubnets is between 1<<24 and 1<<32 then \"base << (snr.hostBits % 8)\"\n\t\t// below could overflow if snr.hostBits%8 is non-0. So we cap numSubnets\n\t\t// at 1<<24. \"16M subnets ought to be enough for anybody.\"\n\t\tnumSubnets = 1 << 24\n\t}\n\n\tvar i uint32\n\tfor i = 0; i < numSubnets; i++ {\n\t\tn := (i + snr.next) % numSubnets\n\t\tbase := n\n\t\tif snr.leftShift != 0 {\n\t\t\tbase = ((base << snr.leftShift) & snr.leftMask) | ((base >> snr.rightShift) & snr.rightMask)\n\t\t} else if addrLen == 128 && snr.subnetBits >= 16 {\n\t\t\t// Skip the 0 subnet (and other subnets with all 0s in the low word)\n\t\t\t// since the extra 0 word will get compressed out and make the address\n\t\t\t// look different from addresses on other subnets.\n\t\t\tif (base & 0xFFFF) == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tgenIP := append([]byte{}, []byte(snr.network.IP)...)\n\t\tsubnetBits := base << (snr.hostBits % 8)\n\t\tb := (uint32(addrLen) - snr.hostBits - 1) / 8\n\t\tfor subnetBits != 0 {\n\t\t\tgenIP[b] |= byte(subnetBits)\n\t\t\tsubnetBits >>= 8\n\t\t\tb--\n\t\t}\n\n\t\tgenSubnet := &net.IPNet{IP: genIP, Mask: net.CIDRMask(int(snr.subnetBits)+netMaskSize, addrLen)}\n\t\tif !snr.allocMap[genSubnet.String()] {\n\t\t\tsnr.allocMap[genSubnet.String()] = true\n\t\t\tsnr.next = n + 1\n\t\t\treturn genSubnet\n\t\t}\n\t}\n\n\tsnr.next = 0\n\treturn nil\n}", "title": "" }, { "docid": "1aa9fb3e74c83edf3a93a17fea0a6ff0", "score": "0.51218647", "text": "func randPort(min int, max int) string {\n\treturn strconv.Itoa(rand.Intn(max-min) + min)\n}", "title": "" }, { "docid": "c6b81594a090e9d346d39c3dbf0429fa", "score": "0.5120861", "text": "func get_random_ring_node() (rand_num int64) {\n for(true){\n rand_num := rand.Intn(number_of_network_nodes)\n //If we generated a channel id that is in use in the ring, return the number\n if len(ring_nodes.ring_nodes) == 0 {\n return -1\n }\n\n if val, ok := ring_nodes.Load(int64(rand_num)); ok {\n _ = val\n return int64(rand_num)\n }\n }\n return int64(rand_num)\n}", "title": "" }, { "docid": "c1bf01b6bafe825432ca7e7d53a446e2", "score": "0.5116416", "text": "func GenerateNodeSubnetName(clusterName string) string {\n\treturn fmt.Sprintf(\"%s-%s\", clusterName, \"node-subnet\")\n}", "title": "" }, { "docid": "972759a9e5197cd27b287172643f3ecc", "score": "0.5115562", "text": "func IntnInRange(min int, max int) int {\n\treturn rand.Intn(max-min+1) + min\n}", "title": "" }, { "docid": "ca88e9be04cd1ba287ca2be030a99068", "score": "0.51068443", "text": "func Subnet_FromSubnetId(scope constructs.Construct, id *string, subnetId *string) ISubnet {\n\t_init_.Initialize()\n\n\tvar returns ISubnet\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_ec2.Subnet\",\n\t\t\"fromSubnetId\",\n\t\t[]interface{}{scope, id, subnetId},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "3747c2a8f0d91a62d0b446fba641f254", "score": "0.51059973", "text": "func RandomSubspaceID(r *rand.Rand) string {\n\tindex := r.Intn(len(ids))\n\treturn ids[index]\n}", "title": "" }, { "docid": "14b11832467c1bdfe64804a835fef046", "score": "0.5104502", "text": "func shuffleIPs(slice []string) {\n\trand.Seed(time.Now().UTC().UnixNano())\n\tfor i := range slice {\n\t\tj := rand.Intn(i + 1)\n\t\tslice[i], slice[j] = slice[j], slice[i]\n\t}\n}", "title": "" }, { "docid": "0900d418a22d75e8509151c221b2d247", "score": "0.50974137", "text": "func (cm *CityMap) PickRandomNeighbor(city *CityNode) *CityNode {\n\tneighborCitiesMap := cm.connections[*city]\n\tneighborCities := make([]*CityNode, 0)\n\tfor _, city := range neighborCitiesMap {\n\t\tif city != nil {\n\t\t\tneighborCities = append(neighborCities, city)\n\t\t}\n\t}\n\t// fmt.Println(neighborCities)\n\ts := rand.NewSource(time.Now().Unix())\n\tr := rand.New(s) // initialize local pseudorandom generator\n\trandNeighborIdx := r.Intn(len(neighborCities))\n\treturn neighborCities[randNeighborIdx]\n}", "title": "" }, { "docid": "5b7e705fc986dcf256856d4fd8439751", "score": "0.5094753", "text": "func (r Network_Storage_Allowed_Host_IpAddress) GetSourceSubnet() (resp string, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Storage_Allowed_Host_IpAddress\", \"getSourceSubnet\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "99e00396c0ef1ebe81c8d9c9d7e40d29", "score": "0.508658", "text": "func CalculateSubnetIPs(cidr string, maxAddresses int) []string {\n\tvar ips = []string{}\n\n\tip, ipnet, err := net.ParseCIDR(cidr)\n\tif err != nil {\n\t\treturn ips\n\t}\n\n\tfor ip := ip.Mask(ipnet.Mask); ipnet.Contains(ip); inc(ip) {\n\t\tips = append(ips, ip.String())\n\t\tif len(ips) > maxAddresses {\n\t\t\treturn ips[1:] // remove network address\n\t\t}\n\t}\n\n\t// remove network address and broadcast address\n\tif len(ips) > 1 {\n\t\treturn ips[1 : len(ips)-1]\n\t}\n\treturn ips\n}", "title": "" }, { "docid": "4b702df0e07ccd8719e2bf3f0e78d6fa", "score": "0.50811833", "text": "func PrivateSubnet_FromSubnetId(scope constructs.Construct, id *string, subnetId *string) ISubnet {\n\t_init_.Initialize()\n\n\tvar returns ISubnet\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_ec2.PrivateSubnet\",\n\t\t\"fromSubnetId\",\n\t\t[]interface{}{scope, id, subnetId},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "837adf8e192f7aca013f409d11ed0f4f", "score": "0.50805885", "text": "func get_subnet_netmask(subnet uint) []int {\n m32 := 0xffffffff\n bits := m32 & (m32 >> subnet)\n n := m32 ^ bits\n\n b1 := (n >> 24) & 0xff\n b2 := (n >> 16) & 0xff\n b3 := (n >> 8) & 0xff\n b4 := (n >> 0) & 0xff\n return []int{b1, b2, b3, b4}\n}", "title": "" }, { "docid": "0cbf392006566033b50de6a7595b896a", "score": "0.5078426", "text": "func GetNetworkSubnetIpAddressGlobalService(sess *session.Session) Network_Subnet_IpAddress_Global {\n\treturn Network_Subnet_IpAddress_Global{Session: sess}\n}", "title": "" }, { "docid": "2ed278df1ad676ef83af802973232627", "score": "0.5062789", "text": "func (i *Internet) IPv6() string {\n\tresult := []string{}\n\n\tfor i := 0; i < 8; i++ {\n\t\tresult = append(result, randHash())\n\t}\n\n\treturn strings.Join(result, \".\")\n}", "title": "" }, { "docid": "cd84f67ec0b0e1694c26e36a7d55c281", "score": "0.50595206", "text": "func randomMACAddress() (string, error) {\n\tbuf := make([]byte, 6)\n\t_, err := rand.Read(buf)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// set local bit and unicast\n\tbuf[0] = (buf[0] | 2) & 0xfe\n\t// Set the local bit\n\tbuf[0] |= 2\n\n\t// avoid libvirt-reserved addresses\n\tif buf[0] == 0xfe {\n\t\tbuf[0] = 0xee\n\t}\n\n\treturn fmt.Sprintf(\"%02x:%02x:%02x:%02x:%02x:%02x\",\n\t\tbuf[0], buf[1], buf[2], buf[3], buf[4], buf[5]), nil\n}", "title": "" }, { "docid": "3698603808b3ea791c1cf95ed1651dff", "score": "0.505555", "text": "func checkSubnet(APIstub shim.ChaincodeStubInterface, prefix string, ipType int) (bool, bool) {\n\tresultsIterator, _ := APIstub.GetStateByPartialCompositeKey(\"MASK\", []string{})\n\t//100.10.10.10/24 = 100.10.10.0/24\n\t//100.10.10.30/25 = 100.10.10.0/25\n\t//Loop to go through every IP prefix stored\n\tfor resultsIterator.HasNext() {\n\t\tqueryResponse, _ := resultsIterator.Next()\n\n\t\t_, compositeKeyParts, _ := APIstub.SplitCompositeKey(queryResponse.GetKey())\n\n\t\t//Reconstruct according to the IP type that is stored\n\t\tvar reconstructedPrefix string\n\t\tif len(compositeKeyParts) == 5 {\n\t\t\treconstructedPrefix = reconstructPrefix(compositeKeyParts, 0)\n\t\t} else if len(compositeKeyParts) == 9 {\n\t\t\treconstructedPrefix = reconstructPrefix(compositeKeyParts, 1)\n\t\t}\n\n\t\t//reconstructedPrefix := reconstructPrefix(compositeKeyParts, ipType)\n\t\tfoundIP, foundPrefix, _ := net.ParseCIDR(reconstructedPrefix)\n\t\tfoundMask, _ := strconv.Atoi(strings.Split(foundPrefix.String(), \"/\")[1])\n\t\tgivenIP, givenPrefix, _ := net.ParseCIDR(prefix)\n\t\tgivenMask, _ := strconv.Atoi(strings.Split(givenPrefix.String(), \"/\")[1])\n\n\t\tfmt.Println(\"found prefix: \" + foundPrefix.String())\n\t\tfmt.Println(\"given prefix: \" + givenPrefix.String())\n\n\t\t//Given prefix and found prefix are the same - WON'T BE INSERTED BUT AS PATH CAN BE UPDATED\n\t\tif givenPrefix.String() == foundPrefix.String() {\n\t\t\treturn true, true\n\t\t}\n\n\t\t//Given prefix is a supernet of one already in the blockchain - CAN'T BE INSERTED\n\t\tif givenPrefix.Contains(foundIP) && givenMask < foundMask {\n\t\t\treturn true, false\n\t\t}\n\n\t\t//Given prefix is a subtnet of one already in the blockchain - CAN BE INSERTED IN THE BLOCKCHAIN (IP LIST ONLY)\n\t\tif foundPrefix.Contains(givenIP) {\n\t\t\treturn false, true\n\t\t}\n\t}\n\t//Given prefix isn't a subnet or a supernet of a stored one - CAN BE INSERTED IN THE BLOCKCHAIN (BOTH IP AND MASK LISTS)\n\treturn false, false\n}", "title": "" }, { "docid": "0b97a51f8b62748aa362bbb1bdddc024", "score": "0.5055432", "text": "func (instance *Host) GetPrivateIPOnSubnet(subnetID string) (ip string, xerr fail.Error) {\n\tdefer fail.OnPanic(&xerr)\n\n\tip = \"\"\n\tif instance == nil || instance.IsNull() {\n\t\treturn ip, fail.InvalidInstanceError()\n\t}\n\tif subnetID = strings.TrimSpace(subnetID); subnetID == \"\" {\n\t\treturn ip, fail.InvalidParameterError(\"subnetID\", \"cannot be empty string\")\n\t}\n\n\tinstance.lock.RLock()\n\tdefer instance.lock.RUnlock()\n\n\txerr = instance.Inspect(func(_ data.Clonable, props *serialize.JSONProperties) fail.Error {\n\t\treturn props.Inspect(hostproperty.NetworkV2, func(clonable data.Clonable) fail.Error {\n\t\t\thostNetworkV2, ok := clonable.(*propertiesv2.HostNetworking)\n\t\t\tif !ok {\n\t\t\t\treturn fail.InconsistentError(\"'*propertiesv2.HostNetworking' expected, '%s' provided\", reflect.TypeOf(clonable).String())\n\t\t\t}\n\t\t\tif ip, ok = hostNetworkV2.IPv4Addresses[subnetID]; !ok {\n\t\t\t\treturn fail.InvalidRequestError(\"Host '%s' does not have an IP address on subnet '%s'\", instance.GetName(), subnetID)\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t})\n\treturn ip, xerr\n}", "title": "" }, { "docid": "35a1763db061c657d99df6ce0d4db705", "score": "0.5053652", "text": "func RandMaskToken(s string, n int) string {\n\tl := len(s)\n\tb := make([]byte, n)\n\tfor i := range b {\n\t\tb[i] = s[rand.Intn(l)]\n\t}\n\treturn string(b)\n}", "title": "" }, { "docid": "c50eebdb4a7cd4d05a3128f2a9a42b97", "score": "0.50480634", "text": "func CreateSubnetWithSubnetPoolNoCIDR(t *testing.T, client *gophercloud.ServiceClient, networkID string, subnetPoolID string) (*subnets.Subnet, error) {\n\tsubnetName := tools.RandomString(\"TESTACC-\", 8)\n\tcreateOpts := subnets.CreateOpts{\n\t\tNetworkID: networkID,\n\t\tIPVersion: 4,\n\t\tName: subnetName,\n\t\tEnableDHCP: gophercloud.Disabled,\n\t\tSubnetPoolID: subnetPoolID,\n\t}\n\n\tt.Logf(\"Attempting to create subnet: %s\", subnetName)\n\n\tsubnet, err := subnets.Create(client, createOpts).Extract()\n\tif err != nil {\n\t\treturn subnet, err\n\t}\n\n\tt.Logf(\"Successfully created subnet.\")\n\n\tth.AssertEquals(t, subnet.Name, subnetName)\n\n\treturn subnet, nil\n}", "title": "" }, { "docid": "6ecd073f6ae06e0b8d58e845a56ec123", "score": "0.5046431", "text": "func checkSubnetContains(sub, ip *net.IPNet) error {\n\tif !sub.Contains(ip.IP) {\n\t\treturn fmt.Errorf(\"wgipam: subnet %q cannot contain IP %q\", sub, ip)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d0debb257ff4572533c08d8f32828eea", "score": "0.5044497", "text": "func MacAddress() string { return macAddress(globalFaker.Rand) }", "title": "" }, { "docid": "e6da5ec72cba2f36705e3becfa671a9b", "score": "0.50377625", "text": "func randomInt(min, max int) int {\n return min + rand.Intn(max-min)\n}", "title": "" }, { "docid": "e6da5ec72cba2f36705e3becfa671a9b", "score": "0.50377625", "text": "func randomInt(min, max int) int {\n return min + rand.Intn(max-min)\n}", "title": "" }, { "docid": "3da540ca333c4e57e4ffec203b65d31b", "score": "0.5027896", "text": "func (ip IP6) Netaddr() netaddr.IP {\n\treturn netaddr.IPFrom16(ip)\n}", "title": "" }, { "docid": "96f49cacfded833a820683d667ef12bf", "score": "0.5020961", "text": "func findIp() (string, error) {\n\t/*\n\t\t# we get a UDP-socket for the TEST-networks reserved by IANA.\n\t\t# It is highly unlikely, that there is special routing used\n\t\t# for these networks, hence the socket later should give us\n\t\t# the ip address of the default route.\n\t\t# We're doing multiple tests, to guard against the computer being\n\t\t# part of a test installation.\n\t*/\n\tvar (\n\t\tlocalIp string\n\t\tcandidates = make([]string, 3)\n\t)\n\n\tfor _, testIp := range []string{\"192.0.2.0\", \"198.51.100.0\", \"203.0.113.0\"} {\n\t\tudpAddr, err := net.ResolveUDPAddr(\"udp\", testIp+\":80\")\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"%w\", err)\n\t\t}\n\n\t\tudpconn, err := net.DialUDP(\"udp\", nil, udpAddr)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"%w\", err)\n\t\t}\n\n\t\tlocalIp = strings.Split(udpconn.LocalAddr().String(), \":\")[0]\n\t\tfor _, ip := range candidates {\n\t\t\tif ip == localIp {\n\t\t\t\treturn localIp, nil\n\t\t\t}\n\t\t}\n\t\tcandidates = append(candidates[:], localIp)\n\t}\n\treturn candidates[0], nil\n}", "title": "" }, { "docid": "d6f69957c2784d1d4e8cbb5141e85c72", "score": "0.501977", "text": "func RandIntn(n int) int { return rand.Intn(n) }", "title": "" }, { "docid": "f2913e86d1345000ca37299b9f492a9e", "score": "0.5003121", "text": "func deriveGatewayIP(subnetIP net.IP) string {\n\taddr := subnetIP.To4()\n\treturn net.IPv4(addr[0], addr[1], addr[2], addr[3]+1).String()\n}", "title": "" }, { "docid": "f69a6173ec10bec4973510cd739f4d13", "score": "0.49828556", "text": "func trySubnetCreate(s *Sandbox, name, ipCidrRange, purpose string) error {\n\tnetworkID := cloud.ResourceID{ProjectID: s.f.Project, Resource: \"networks\", Key: meta.GlobalKey(s.f.Network)}\n\n\tsubnet := &computebeta.Subnetwork{\n\t\tName: name,\n\t\tIpCidrRange: ipCidrRange,\n\t\tPurpose: purpose,\n\t\tNetwork: networkID.SelfLink(meta.VersionBeta),\n\t\tRole: \"ACTIVE\",\n\t}\n\n\terr := s.f.Cloud.BetaSubnetworks().Insert(context.Background(), meta.RegionalKey(subnet.Name, s.f.Region), subnet)\n\tif err != nil {\n\t\t// GCE returns a 409 when the subnet *with the same name* already exists\n\t\tif utils.IsHTTPErrorCode(err, http.StatusConflict) {\n\t\t\tklog.V(3).Infof(\"subnet %s already exists: %v\", name, err)\n\t\t\treturn ErrSubnetExists\n\t\t}\n\t\treturn fmt.Errorf(\"Error creating subnet %s: %v\", name, err)\n\t}\n\n\tklog.V(3).Infof(\"Subnet %s created in region %q: %v\", name, s.f.Region, subnet)\n\treturn nil\n}", "title": "" }, { "docid": "5aa463a536f876a333c7915f3909f798", "score": "0.49793568", "text": "func newSubnet(net resource.Network, cfg *config.Subnet, c *ec2.EC2) (*subnet, error) {\n\tlog.Debug(\"Initializing AWS Subnet %q\", cfg.Name())\n\n\tn, ok := net.ProviderNetwork().(*network)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"AWS newSubnet: Unable to obtain network\")\n\t}\n\n\ts := &subnet{\n\t\tSubnet: cfg,\n\t\tec2: c,\n\t\tnetwork: n,\n\t}\n\ts.set(n.subnetCache.find(s))\n\n\treturn s, nil\n}", "title": "" }, { "docid": "ad4d77a9065d76b66019defb1a7a166c", "score": "0.4970996", "text": "func (f *Faker) IPv4Address() string { return ipv4Address(f.Rand) }", "title": "" }, { "docid": "b978e25d5e43b65be85cbf5cec7f7f74", "score": "0.49657688", "text": "func randListen(listenAddr string) (string, error) {\n\treturn randListenFn(listenAddr, netutil.RandPort)\n}", "title": "" }, { "docid": "f838c303ef83b14d4ab9ca8c06377b0d", "score": "0.49627164", "text": "func SubnetMaskGT(v string) predicate.IPAddress {\n\treturn predicate.IPAddress(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldSubnetMask), v))\n\t})\n}", "title": "" }, { "docid": "b5ea1c9ef66fff718a02e5d34bf385a5", "score": "0.49602985", "text": "func TestEc2APIHelper_GetSubnet(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tec2ApiHelper, mockWrapper := getMockWrapper(ctrl)\n\tmockWrapper.EXPECT().DescribeSubnets(describeSubnetInput).Return(describeSubnetOutput, nil)\n\n\tsubnet, err := ec2ApiHelper.GetSubnet(&subnetId)\n\tassert.NoError(t, err)\n\tassert.Equal(t, subnetId, *subnet.SubnetId)\n}", "title": "" }, { "docid": "136734e3fe75dda429424e49a9629f65", "score": "0.49584234", "text": "func RandInRange(min, max int) int {\n\treturn min + rand.Intn(max-min+1)\n}", "title": "" }, { "docid": "62eefbae93325fec6c336aaf67a91650", "score": "0.4956513", "text": "func RandInRange(min int, max int) int {\n\treturn rand.Intn((max-min)+1) + min\n}", "title": "" }, { "docid": "b90935d5aaa9f0bd7d7b6e75eafb3e82", "score": "0.49541274", "text": "func PickRandomBase() string {\n return string(DNA_ALPHABET[rand.Intn(len(DNA_ALPHABET))])\n}", "title": "" }, { "docid": "aa6a4753f4371ad6951467ea4a1421d3", "score": "0.49491698", "text": "func TestOverlappingSubnets(t *testing.T) {\n\n\t// Non-overlapping subnet for same tenant - vlan & gateway\n\tcheckCreateNetwork(t, false, \"default\", \"contiv1\", \"\", \"vlan\", \"10.1.1.0/24\", \"10.1.1.220\", 1, \"\", \"\")\n\tcheckCreateNetwork(t, false, \"default\", \"contiv2\", \"\", \"vlan\", \"10.1.2.0/24\", \"10.1.2.254\", 2, \"\", \"\")\n\tcheckInspectNetwork(t, false, \"default\", \"contiv1\", \"10.1.1.220\", 1, 0)\n\tcheckInspectNetwork(t, false, \"default\", \"contiv2\", \"10.1.2.254\", 2, 0)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv1\")\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv2\")\n\n\t// overlapping subnet for same tenant -- vlan - vxlan combination\n\tcheckCreateNetwork(t, false, \"default\", \"contiv\", \"\", \"vlan\", \"10.1.1.0/24\", \"\", 1, \"\", \"\")\n\tcheckCreateNetwork(t, true, \"default\", \"contiv1\", \"\", \"vxlan\", \"10.1.1.0/24\", \"\", 2, \"\", \"\")\n\tcheckInspectNetwork(t, false, \"default\", \"contiv\", \"\", 1, 0)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv\")\n\n\t// Overlapping subnet for same tenant - vxlan\n\tcheckCreateNetwork(t, false, \"default\", \"contiv\", \"\", \"vxlan\", \"10.1.1.0/24\", \"\", 1, \"\", \"\")\n\tcheckCreateNetwork(t, true, \"default\", \"contiv1\", \"\", \"vxlan\", \"10.1.1.0/24\", \"\", 2, \"\", \"\")\n\tcheckInspectNetwork(t, false, \"default\", \"contiv\", \"\", 1, 0)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv\")\n\n\t// Overlapping subnet for same tenant - including gateway\n\tcheckCreateNetwork(t, false, \"default\", \"contiv\", \"\", \"vlan\", \"10.1.1.0/24\", \"\", 1, \"\", \"\")\n\tcheckCreateNetwork(t, true, \"default\", \"contiv1\", \"\", \"vlan\", \"10.1.1.0/24\", \"10.1.1.233\", 2, \"\", \"\")\n\tcheckInspectNetwork(t, false, \"default\", \"contiv\", \"\", 1, 0)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv\")\n\n\t// Overlapping subnet for same tenant - vlan\n\tcheckCreateNetwork(t, false, \"default\", \"contiv\", \"\", \"vlan\", \"10.1.1.0/16\", \"\", 1, \"\", \"\")\n\tcheckCreateNetwork(t, true, \"default\", \"contiv1\", \"\", \"vlan\", \"10.1.2.0/24\", \"\", 2, \"\", \"\")\n\tcheckInspectNetwork(t, false, \"default\", \"contiv\", \"\", 1, 0)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv\")\n\n\t// Overlapping subnet for different tenant - vlan\n\tcheckCreateNetwork(t, false, \"default\", \"contiv\", \"\", \"vlan\", \"10.1.1.0/24\", \"\", 1, \"\", \"\")\n\tcheckCreateTenant(t, false, \"tenant1\")\n\tcheckCreateNetwork(t, false, \"tenant1\", \"contiv1\", \"\", \"vlan\", \"10.1.0.0/16\", \"\", 2, \"\", \"\")\n\tcheckInspectNetwork(t, false, \"default\", \"contiv\", \"\", 1, 0)\n\tcheckInspectNetwork(t, false, \"tenant1\", \"contiv1\", \"\", 2, 0)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv\")\n\tcheckDeleteNetwork(t, false, \"tenant1\", \"contiv1\")\n\tcheckDeleteTenant(t, false, \"tenant1\")\n\n\t// Non-overlapping subnet ranges for same tenant\n\tcheckCreateNetwork(t, false, \"default\", \"contiv\", \"\", \"vlan\", \"20.1.1.10-20.1.1.45/24\", \"\", 1, \"\", \"\")\n\tcheckCreateNetwork(t, false, \"default\", \"contiv2\", \"\", \"vlan\", \"20.1.1.46-20.1.1.100/24\", \"\", 2, \"\", \"\")\n\tcheckCreateNetwork(t, false, \"default\", \"contiv3\", \"\", \"vlan\", \"20.1.1.0-20.1.1.9/24\", \"\", 3, \"\", \"\")\n\tcheckInspectNetwork(t, false, \"default\", \"contiv\", \"\", 1, 0)\n\tcheckInspectNetwork(t, false, \"default\", \"contiv2\", \"\", 2, 0)\n\tcheckInspectNetwork(t, false, \"default\", \"contiv3\", \"\", 3, 0)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv\")\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv2\")\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv3\")\n\n\t// Overlapping subnet ranges for same tenant\n\tcheckCreateNetwork(t, false, \"default\", \"contiv\", \"\", \"vlan\", \"20.1.1.10-20.1.1.45/24\", \"\", 1, \"\", \"\")\n\tcheckCreateNetwork(t, true, \"default\", \"contiv2\", \"\", \"vlan\", \"20.1.1.45-20.1.1.100/24\", \"\", 2, \"\", \"\")\n\tcheckCreateNetwork(t, true, \"default\", \"contiv3\", \"\", \"vlan\", \"20.1.1.0-20.1.1.10/24\", \"\", 3, \"\", \"\")\n\tcheckInspectNetwork(t, false, \"default\", \"contiv\", \"\", 1, 0)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv\")\n\n\t// Non-Overlapping subnetv6 for same tenant\n\tcheckCreateNetwork(t, false, \"default\", \"contiv\", \"\", \"vlan\", \"20.1.1.0/24\", \"\", 1, \"::/64\", \"\")\n\tcheckCreateNetwork(t, false, \"default\", \"contiv1\", \"\", \"vlan\", \"20.1.2.0/24\", \"\", 2, \"1::/64\", \"\")\n\tcheckInspectNetwork(t, false, \"default\", \"contiv\", \"\", 1, 0)\n\tcheckInspectNetwork(t, false, \"default\", \"contiv1\", \"\", 2, 0)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv\")\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv1\")\n\n\t// Overlapping subnetv6 for same tenant\n\tcheckCreateNetwork(t, false, \"default\", \"contiv\", \"\", \"vlan\", \"20.1.1.0/24\", \"\", 1, \"2001:3332:3244:2422::/64\", \"\")\n\tcheckCreateNetwork(t, true, \"default\", \"contiv1\", \"\", \"vlan\", \"20.1.2.0/24\", \"\", 2, \"2001:3332:3244:2422::/64\", \"\")\n\tcheckInspectNetwork(t, false, \"default\", \"contiv\", \"\", 1, 0)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv\")\n\n\t// Overlapping subnetv6 for same tenant - vxlan\n\tcheckCreateNetwork(t, false, \"default\", \"contiv\", \"\", \"vxlan\", \"10.1.1.0/16\", \"\", 1, \"2001:2000::/32\", \"\")\n\tcheckCreateNetwork(t, true, \"default\", \"contiv1\", \"\", \"vxlan\", \"10.2.0.0/16\", \"\", 2, \"2001:2000:1234:4422::/64\", \"\")\n\tcheckInspectNetwork(t, false, \"default\", \"contiv\", \"\", 1, 0)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv\")\n\n\t// Oerlapping subnetv6 for different tenant\n\tcheckCreateNetwork(t, false, \"default\", \"contiv\", \"\", \"vlan\", \"10.1.1.0/24\", \"\", 1, \"ffff:ffff:ffff::/48\", \"\")\n\tcheckCreateTenant(t, false, \"tenant1\")\n\tcheckCreateNetwork(t, false, \"tenant1\", \"contiv1\", \"\", \"vlan\", \"10.1.0.0/16\", \"\", 2, \"ffff:ffff:ffff::/48\", \"\")\n\tcheckInspectNetwork(t, false, \"default\", \"contiv\", \"\", 1, 0)\n\tcheckInspectNetwork(t, false, \"tenant1\", \"contiv1\", \"\", 2, 0)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv\")\n\tcheckDeleteNetwork(t, false, \"tenant1\", \"contiv1\")\n\tcheckDeleteTenant(t, false, \"tenant1\")\n\n}", "title": "" }, { "docid": "e37f9fd4e200eadd31015cb1eb1d71ec", "score": "0.49469873", "text": "func Rand() UUID {\n\tvar x [16]byte\n\tRandBytes(x[:])\n\tx[6] = (x[6] & 0x0F) | 0x40\n\tx[8] = (x[8] & 0x3F) | 0x80\n\treturn x\n}", "title": "" }, { "docid": "087f90cedc7f6d22e73329257d16bcad", "score": "0.49454913", "text": "func (m *NetworkInfo) GetSubnet()(*string) {\n return m.subnet\n}", "title": "" }, { "docid": "9db0287d05bf2b4f242281fd28d1104f", "score": "0.4934598", "text": "func TestEc2APIHelper_GetSubnet_NoSubnetReturned(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tec2ApiHelper, mockWrapper := getMockWrapper(ctrl)\n\tmockWrapper.EXPECT().DescribeSubnets(describeSubnetInput).Return(&ec2.DescribeSubnetsOutput{Subnets: []*ec2.Subnet{}}, nil)\n\n\t_, err := ec2ApiHelper.GetSubnet(&subnetId)\n\tassert.NotNil(t, err)\n}", "title": "" }, { "docid": "f1b0878b9ece541b957d517c4d385723", "score": "0.49304855", "text": "func (n *common) DHCPv6Subnet() *net.IPNet {\n\treturn nil\n}", "title": "" }, { "docid": "94f679a431ae2655d1b14f4d99513fe4", "score": "0.49285224", "text": "func newIPNet(ipNet net.IPNet) net.IPNet {\n\treturn net.IPNet{\n\t\tIP: newIP(ipNet.IP),\n\t\tMask: net.IPv4Mask(ipNet.Mask[0], ipNet.Mask[1], ipNet.Mask[2], ipNet.Mask[3]),\n\t}\n}", "title": "" }, { "docid": "c9afbd3ebaa9a04ef0db8da085055ae0", "score": "0.49266535", "text": "func (m *SubnetType) Net() (*net.IPNet, error) {\n\tcidr := m.IPPrefix + \"/\" + strconv.Itoa(int(m.IPPrefixLen))\n\t_, n, err := net.ParseCIDR(cidr)\n\treturn n, errors.Wrap(err, \"couldn't parse cidr\")\n}", "title": "" }, { "docid": "7eb3beb9eaafa6ddbf71b8c4ede1160d", "score": "0.4926549", "text": "func GetBroadcastIpFromNetwork(ip, netmask string) string {\n\tvar brAddress []string\n\tips := strings.Split(ip, \".\")\n\tmasks := strings.Split(netmask, \".\")\n\n\tfor i := 0; i < 4; i++ {\n\t\tipByte, err := strconv.Atoi(ips[i])\n\t\tPanicOnError(err)\n\t\tmaskByte, err := strconv.Atoi(masks[i])\n\t\tPanicOnError(err)\n\t\tipByte = ipByte & maskByte\n\t\tmaskByte = maskByte ^ 0xFF\n\n\t\tbrAddress = append(brAddress, fmt.Sprintf(\"%d\", (byte)(ipByte^maskByte)))\n\t}\n\n\treturn strings.Join(brAddress, \".\")\n}", "title": "" }, { "docid": "98a309be0bd8af053593c8f32efc83e5", "score": "0.49230495", "text": "func GetIPNets(address net.IP, subnet *net.IPNet) (*net.IPNet, *net.IPNet) {\n\tsna := &net.IPNet{\n\t\tIP: address,\n\t\tMask: address.DefaultMask(),\n\t}\n\n\t//address in big subnet\n\tif subnet != nil {\n\t\tsna.Mask = subnet.Mask\n\t}\n\n\tif sna.Mask == nil {\n\t\tsna.Mask = net.CIDRMask(128, 128)\n\t}\n\n\t_, ml := sna.Mask.Size()\n\ta := &net.IPNet{\n\t\tIP: address,\n\t\tMask: net.CIDRMask(ml, ml),\n\t}\n\n\treturn sna, a\n}", "title": "" }, { "docid": "fae4d585c7b5851c04c3efcfba089b9c", "score": "0.49205163", "text": "func lastIP(subnet net.IPNet) net.IP {\n\tvar end net.IP\n\tfor i := 0; i < len(subnet.IP); i++ {\n\t\tend = append(end, subnet.IP[i]|^subnet.Mask[i])\n\t}\n\tif subnet.IP.To4() != nil {\n\t\tend[3]--\n\t}\n\n\treturn end\n}", "title": "" }, { "docid": "160ad55a3b1b2c2c6baf52f866dee022", "score": "0.492023", "text": "func (sn *Subnet) GetAddress() (string, error) {\n\tsn.Lock()\n\tdefer sn.Unlock()\n\n\tip, err := sn.getFromFreePool()\n\tif err == nil {\n\t\tsn.Allocated = append(sn.Allocated, ip)\n\t\treturn ip, err\n\t}\n\n\tip, err = sn.getFromMainPool()\n\tif err == nil {\n\t\tsn.Allocated = append(sn.Allocated, ip)\n\t\treturn ip, err\n\t}\n\n\treturn \"\", errors.New(\"Can't get ip from '\" + sn.ID + \"' allocated pool: \" + sn.Pool)\n}", "title": "" }, { "docid": "72807eea8e09a53a9935d2491ea9d29e", "score": "0.491974", "text": "func GetRandomDevAddr(p *redis.Pool, netID lorawan.NetID) (lorawan.DevAddr, error) {\n\tvar d lorawan.DevAddr\n\tb := make([]byte, len(d))\n\tif _, err := rand.Read(b); err != nil {\n\t\treturn d, fmt.Errorf(\"could not read from random reader: %s\", err)\n\t}\n\tcopy(d[:], b)\n\td[0] = d[0] & 1 // zero out 7 msb\n\td[0] = d[0] ^ (netID.NwkID() << 1) // set 7 msb to NwkID\n\n\tc := p.Get()\n\tdefer c.Close()\n\n\tkey := \"node_session_\" + d.String()\n\tval, err := redis.Int(c.Do(\"EXISTS\", key))\n\tif err != nil {\n\t\treturn lorawan.DevAddr{}, fmt.Errorf(\"test DevAddr %s exist error: %s\", d, err)\n\t}\n\tif val == 1 {\n\t\treturn lorawan.DevAddr{}, fmt.Errorf(\"DevAddr %s already exists\", d)\n\t}\n\treturn d, nil\n}", "title": "" }, { "docid": "9c81c3fca968630c2c918a9c1d71004c", "score": "0.49195015", "text": "func RandomAddresses(n int) ([]common.Address, error) {\n addresses := make([]common.Address, n)\n for i := range addresses {\n ptr, err := RandomAddress()\n addresses[i] = *ptr\n if err != nil {\n return nil, err\n }\n }\n return addresses, nil\n}", "title": "" }, { "docid": "ea0f60caf227b96f38c0b39e44a9b107", "score": "0.49153578", "text": "func (n *common) DHCPv4Subnet() *net.IPNet {\n\treturn nil\n}", "title": "" }, { "docid": "0061cb9177110b52f270d54b9d794b2f", "score": "0.49100882", "text": "func buildSubnetAddress(vpc *ec2.Vpc) ([]string, error) {\n\tlogrus.Info(fmt.Sprintf(\"calculating subnet mask and address for vpc cidr %s\", *vpc.CidrBlock))\n\tif *vpc.CidrBlock == \"\" {\n\t\treturn nil, errorUtil.New(\"vpc cidr block can't be empty\")\n\t}\n\n\t// reduce subnet mask to /20\n\treducedMask := strings.SplitAfter(*vpc.CidrBlock, \"/\")\n\tif len(reducedMask) != 2 {\n\t\treturn nil, errorUtil.New(fmt.Sprintf(\"returned cidr %s from aws is not valid\", *vpc.CidrBlock))\n\t}\n\treducedMask[1] = \"20\"\n\n\t// split cidr by octet\n\tsplitCidr := strings.SplitAfter(strings.Join(reducedMask[:], \"\"), \".\")\n\tvar subnets []string\n\n\t// build subnet address increments\n\tvar ipIncrements []int\n\tincrement := 0\n\tfor increment < 255 {\n\t\tipIncrements = append(ipIncrements, increment)\n\t\tincrement = increment + 16\n\t}\n\n\t// replace 3rd octet with increments\n\tfor _, val := range ipIncrements {\n\t\tsplitCidr[2] = fmt.Sprintf(\"%s.\", strconv.Itoa(val))\n\t\tsubnets = append(subnets, strings.Join(splitCidr[:], \"\"))\n\t}\n\n\treturn subnets, nil\n}", "title": "" }, { "docid": "9555362b1dd1d0ce4d877b6b8c681b8e", "score": "0.490496", "text": "func TestRandomPick(t *testing.T) {\n\tl := &randomLoadbalancer{}\n\tctx := context.Background()\n\tins := []*discovery.Instance{\n\t\t{\n\t\t\tAddr: \"127.0.0.1\",\n\t\t},\n\t\t{\n\t\t\tAddr: \"127.0.0.2\",\n\t\t},\n\t\t{\n\t\t\tAddr: \"127.0.0.3\",\n\t\t},\n\t}\n\tp := l.NewPicker(ctx, ins)\n\tfor i := 0; i < 10; i++ {\n\t\tinstance, _ := p.Pick(ctx)\n\t\tt.Logf(\"index: %d, addr: %s\", i, instance.Addr)\n\t}\n}", "title": "" }, { "docid": "3f2b9f71508876133ee5ac1d34894dd0", "score": "0.4902547", "text": "func (tcps *TCPServer) RandomPeer() Address {\n\taddrs := tcps.AddressBook()\n\tif len(addrs) == 0 {\n\t\tpanic(ErrNoPeers)\n\t}\n\treturn addrs[rand.Intn(len(addrs))]\n}", "title": "" }, { "docid": "8bc89c46895bc39bdca8dbdf5033ab2f", "score": "0.49016368", "text": "func RandomPublicEndpoint() string {\n\tport, err := FreeTCPPort()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tip, err := FindPublicIPv4()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn fmt.Sprintf(\"%s:%d\", ip, port)\n}", "title": "" } ]
04696d94e647b63f2220889380435314
NewPlayer is a shorthand of creating a Context by NewContext and a Player by the context's NewPlayer.
[ { "docid": "0eeb33f349b8f433fccc9546c801adf1", "score": "0.6247663", "text": "func NewPlayer(sampleRate, channelNum, bitDepthInBytes, bufferSizeInBytes int) (*Player, error) {\n\tc, err := NewContext(sampleRate, channelNum, bitDepthInBytes, bufferSizeInBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.NewPlayer(), nil\n}", "title": "" } ]
[ { "docid": "e472c402bd24b113510bfa4f99b122d4", "score": "0.749365", "text": "func (c *Context) NewPlayer() *Player {\n\tp := newPlayer(c)\n\tc.mux.AddSource(p.r)\n\treturn p\n}", "title": "" }, { "docid": "c467b8addb24a800821c50b6611b418c", "score": "0.6824153", "text": "func NewPlayer() Player {\n\tp := Player{}\n\treturn p\n}", "title": "" }, { "docid": "3f355a0cb8c739a13352afe4c840d2a0", "score": "0.6791177", "text": "func NewPlayer(char rune, height int, width int, name string, mapType string, fps float64, customSeed int64, numRooms int) *Player {\n\tplayer := &Player{\n\t\tEntity: tl.NewEntity(0, 0, 1, 1),\n\t\tColor: tl.ColorRed,\n\t\tCurrentLevel: 0,\n\t\tBaseText: string(char) + name,\n\t\tText: tl.NewText(0, height+1, \"\", tl.ColorCyan, tl.ColorBlack),\n\t\tGame: tl.NewGame(),\n\t\tWidth: width,\n\t\tHeight: height,\n\t\tMapType: mapType,\n\t\tFps: fps,\n\t\tChar: char,\n\t\tCustomSeed: customSeed,\n\t\tNumRooms: numRooms,\n\t}\n\tplayer.Game.Screen().SetFps(fps)\n\tplayer.newLevel()\n\tplayer.Game.Screen().AddEntity(player.Text)\n\n\tplayer.setMessage(\"Welcome to the game!\")\n\treturn player\n}", "title": "" }, { "docid": "caa7bd23174ce32a6ecfb4ff8d20df8c", "score": "0.6776553", "text": "func NewPlayer (wpn *Weapon) *Player {\n\tply := new (Player)\n\tply.currentWeapon = wpn\n\n\treturn ply\n}", "title": "" }, { "docid": "cfeff861cecff907c57b21a87ff88d83", "score": "0.6759817", "text": "func newPlayer(name string) *player {\n\treturn &player{\n\t\tName: name,\n\t\tdone: make(chan struct{}),\n\t}\n}", "title": "" }, { "docid": "28b5bbe272babc326d0213861c8dbd8f", "score": "0.67221963", "text": "func (mock Mock) NewPlayer(ID string, tx datastore.Transact) error {\n\treturn mock.OnNewPlayer(ID, tx)\n}", "title": "" }, { "docid": "9c4ce4e17dd9768345273fbe04663d0f", "score": "0.6574543", "text": "func (s *PlayersService) New(player *Player) error {\n\treq, err := s.c.NewRequest(\"POST\", \"/players\", player)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar res struct {\n\t\tSuccess bool `json:\"success\"`\n\t\tId string `json:\"id\"`\n\t}\n\t_, err = s.c.Do(req, &res)\n\tif err != nil {\n\t\treturn err\n\t}\n\tplayer.Id = res.Id\n\treturn nil\n}", "title": "" }, { "docid": "4dd30eb8531eed0737a163133ccc5031", "score": "0.65054417", "text": "func NewPlayer(name string, initials string) Player {\n\tvar player *Player\n\tplayer = new(Player)\n\tplayer.ID = uuid.NewV4()\n\tplayer.Name = name\n\tplayer.Initials = initials\n\n\treturn *player\n}", "title": "" }, { "docid": "01b53c544b8e5d0e53cd111eb7d71496", "score": "0.649562", "text": "func NewPlayer(cfg *Cfg) Player {\n\tp := Player{}\n\tp.cfg = cfg\n\n\tplayerCmd := strings.Split(cfg.PlayerCmd, \" \")\n\tp.playerCmd = playerCmd[:1][0]\n\tp.playerArgs = playerCmd[1:]\n\n\treturn p\n}", "title": "" }, { "docid": "51043cde5e4b1441003d65b70c6cc0dd", "score": "0.6465976", "text": "func NewPlayer() *Player {\n\tvar input = input.GetInstance()\n\tvar playerID, _ = input.GetInt()\n\tvar x, _ = input.GetInt()\n\tvar y, _ = input.GetInt()\n\treturn &Player{playerID, NewShipyard(playerID, &Position{x, y}), 0, nil, nil}\n}", "title": "" }, { "docid": "a381d4119fb9728db85a726ab9bb899a", "score": "0.6404483", "text": "func NewPlayer(id int) *Player {\n\treturn &Player{id: id}\n}", "title": "" }, { "docid": "d80f03f6de64dc2573363c61bcdc39c4", "score": "0.6306012", "text": "func NewPlayer(name string, x, y int) *Player {\n\treturn &Player{\n\t\tPoint: Point{x, y},\n\t\tName: name,\n\t}\n}", "title": "" }, { "docid": "c4dacec35f24d5f38d96327bfc0f65d6", "score": "0.62860703", "text": "func (g *Game) NewPlayer(ID string, name string, admin bool) (player.Player, error) {\n\tplayer := player.Player{ID: ID, Name: name, Admin: admin}\n\n\t// Select a country that are not already in use\n\tcountries := []int{}\n\n\tfor i := range country.Countries {\n\t\tcountries = append(countries, i)\n\t}\n\n\t// Loop through players and remove countries that have been chosen\n\tfor _, player := range g.Players {\n\t\tfor i, country := range countries {\n\n\t\t\tif player.Country.ID == country {\n\t\t\t\tif i == 0 {\n\t\t\t\t\tcountries = countries[1:]\n\t\t\t\t} else if i == len(countries)-1 {\n\t\t\t\t\tcountries = countries[:len(countries)-1]\n\t\t\t\t} else {\n\t\t\t\t\tcountries = append(countries[:i], countries[i+1:]...)\n\t\t\t\t}\n\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(countries) == 0 {\n\t\treturn player, ErrFull\n\t}\n\n\t// Seed the RNG\n\trand.Seed(time.Now().UnixNano())\n\t// Select a country from the array of remaining countries.\n\tplayer.Country = country.Countries[countries[rand.Intn(len(countries))]]\n\tplayer.Money = player.Country.InitialMoney\n\n\t// Add player to game\n\tg.Players = append(g.Players, player)\n\n\treturn player, nil\n}", "title": "" }, { "docid": "c8c032ca63b8d3b3b6245a6973857ad0", "score": "0.6272477", "text": "func NewPlayer(id int, x float32, y float32, conn Connection) *Player {\n\tplayer := &Player{\n\t\tID: id,\n\t\tHealth: 100,\n\t\tCollider: NewRectCollider(x, y, width, depth),\n\t\tClient: &Client{\n\t\t\tNetworkOut: make(chan []byte, 100),\n\t\t\tNetworkIn: make(chan NetworkMessage, 100),\n\t\t\tConnection: conn,\n\t\t},\n\t}\n\tplayer.Weapons = []*Weapon{NewWeapon(player)}\n\treturn player\n}", "title": "" }, { "docid": "1a25eb5401ff9464752e2b51f8214bc4", "score": "0.6267326", "text": "func NewPlayer(n string) *Player {\n\treturn &Player{Name: n}\n}", "title": "" }, { "docid": "43e554c8d1e22fce3eb7473f3620c087", "score": "0.62212384", "text": "func New(opts ...Option) IPlayer {\n\tp := new(Player)\n\tfor _, opt := range opts {\n\t\topt(p)\n\t}\n\treturn p\n}", "title": "" }, { "docid": "81f3d369b9dffd80bcd881d9f1167851", "score": "0.6171757", "text": "func NewPlayer(id int, name string, pos int, h *Hand, f int) (*Player, error) {\n\treturn &Player{ID: id, Name: name, Pos: pos, Hand: h, Config: f}, nil\n}", "title": "" }, { "docid": "d6ec3a88ea1a7320dbf45b26a966e4b1", "score": "0.608267", "text": "func newPlayer(s sender, tape tape, scheme insolar.PlatformCryptographyScheme, pulseAccessor pulse.Accessor) *player {\n\treturn &player{\n\t\tsender: s,\n\t\ttape: tape,\n\t\tscheme: scheme,\n\t\tpulseAccessor: pulseAccessor,\n\t}\n}", "title": "" }, { "docid": "e8dffae8fcb9cd5a1a8b4d97e902d0e7", "score": "0.60109127", "text": "func New(prefix string) Player {\n\tdefaultTexture, err := common.LoadedSprite(\"textures/dev_16x16.png\")\n\tif err != nil {\n\t\tlog.Println(\"Unable to load texture: \" + err.Error())\n\t}\n\n\tentity := Player{BasicEntity: ecs.NewBasic()}\n\tentity.SpaceComponent = common.SpaceComponent{\n\t\tPosition: engo.Point{0, 0},\n\t\tWidth: PlayerSizeX,\n\t\tHeight: PlayerSizeY,\n\t}\n\tentity.PlayerStateComponent = components.PlayerStateComponent{\n\t\tSpeed: PlayerSpeed,\n\t\tHealth: 100,\n\t\tInventory: map[string]interface{}{},\n\t}\n\tentity.RenderComponent = common.RenderComponent{\n\t\tDrawable: defaultTexture,\n\t\tScale: engo.Point{1, 1},\n\t}\n\tentity.CollisionComponent = common.CollisionComponent{\n\t\tMain: v1.CollisionsPlayer | v1.CollisionsPlayerPickup,\n\t}\n\n\treturn entity\n}", "title": "" }, { "docid": "f500250ed37224ff777259c8471cb001", "score": "0.5999092", "text": "func New(n int) *Player {\n\treturn &Player{\n\t\tcash: 6000,\n\t\tnumber: n,\n\t\tshares: map[interfaces.Corporation]int{},\n\t}\n}", "title": "" }, { "docid": "27186a124b52ce76d5757a15e5b39da4", "score": "0.59861726", "text": "func NewPlayer(playerID int64, isUser bool, teamLayer navmesh.LayerMask,\n\tstartPosition *vec2.T) *Player {\n\treturn &Player{\n\t\tID: playerID,\n\t\tIsUser: isUser,\n\t\tTeamLayer: teamLayer,\n\t\tStartPosition: startPosition,\n\t\tSubmarineParams: &SubmarineParams{\n\t\t\tactorParams: &actorParams{\n\t\t\t\tactorType: battleAPI.ActorType_Submarine,\n\t\t\t\thasLight: true,\n\t\t\t\tisAlwaysVisible: false,\n\t\t\t\taccelMaxSpeed: 6,\n\t\t\t\taccelDuration: 2 * time.Second,\n\t\t\t},\n\t\t\tTorpedoCount: 2,\n\t\t\tTorpedoCooldownSeconds: 15,\n\t\t\tPingerCooldownSeconds: 60,\n\t\t\tPingerIntervalSeconds: 10,\n\t\t\tWatcherCooldownSeconds: 80,\n\t\t},\n\t\tTorpedoParams: &TorpedoParams{\n\t\t\tactorParams: &actorParams{\n\t\t\t\tactorType: battleAPI.ActorType_Torpedo,\n\t\t\t\thasLight: false,\n\t\t\t\tisAlwaysVisible: true,\n\t\t\t\taccelMaxSpeed: 10,\n\t\t\t\taccelDuration: 1 * time.Second,\n\t\t\t},\n\t\t\tStartOffsetDistance: 1.2,\n\t\t},\n\t\tWatcherParams: &WatcherParams{\n\t\t\tactorParams: &actorParams{\n\t\t\t\tactorType: battleAPI.ActorType_Watcher,\n\t\t\t\thasLight: true,\n\t\t\t\tisAlwaysVisible: false,\n\t\t\t\taccelMaxSpeed: 0,\n\t\t\t\taccelDuration: 0,\n\t\t\t},\n\t\t\tUptimeSeconds: 60,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "999e458e4cb47b4cf01293c68206fee9", "score": "0.593662", "text": "func NewPlayer(index int, ip string) *Player {\n\tp := &Player{Mob: &Mob{Entity: &Entity{Index: index, Location: Lumbridge.Clone()}, AttributeList: entity.NewAttributeList()},\n\t\tAttributes: entity.NewAttributeList(), LocalPlayers: NewMobList(), LocalNPCs: NewMobList(), LocalObjects: &entityList{},\n\t\tAppearance: DefaultAppearance(), FriendList: &FriendsList{friendSet: make(friendSet)}, KnownAppearances: make(map[int]int),\n\t\tInventory: &Inventory{Capacity: 30}, TradeOffer: &Inventory{Capacity: 12}, DuelOffer: &Inventory{Capacity: 8},\n\t\tLocalItems: &entityList{}, OutgoingPackets: make(chan *net.Packet, 20), KillC: make(chan struct{})}\n\tp.SetVar(\"currentIP\", ip)\n\tp.SetVar(\"viewRadius\", 16)\n\tp.SetVar(\"skills\", &entity.SkillTable{})\n\tp.SetVar(\"bank\", &Inventory{Capacity: 48 * 4, stackEverything: true})\n\n\tp.Equips[0] = p.Appearance.Head\n\tp.Equips[1] = p.Appearance.Body\n\tp.Equips[2] = p.Appearance.Legs\n\tp.Inventory.Owner = p\n\treturn p\n}", "title": "" }, { "docid": "2102e332fbd37ab096a3b6fb0e72b419", "score": "0.58662", "text": "func New(ctx context.Context) (g *Game) {\n\tg = new(Game)\n\tg.Header = game.NewHeader(ctx, g)\n\tg.State = newState()\n\tg.Parent = pk(ctx)\n\tg.Type = gType.Tammany\n\treturn\n}", "title": "" }, { "docid": "cfb98c3c8f69a6aaf150e5275220924b", "score": "0.5858746", "text": "func CreatePlayer(con *websocket.Conn) Player {\n\tp := Player{}\n\tp.SetID()\n\tp.SetConnection(con)\n\treturn p\n}", "title": "" }, { "docid": "1e510837b98f35ac2f9b79d2bc4aa6bd", "score": "0.58527356", "text": "func NewPlayer(w http.ResponseWriter, r *http.Request, pool *redis.Pool) {\n\tplayer := Player{}\n\tplayer.PlayerId = util.GenerateId(16)\n\tfmt.Println(\"PlayerId: \", player.PlayerId)\n\n\tvar upgrader = websocket.Upgrader{\n\t\tCheckOrigin: func(r *http.Request) bool { return true },\n\t}\n\n\t// Create Player's Websocket\n\tws, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn\n\t}\n\tplayer.Ws = ws\n\twsLock := sync.RWMutex{}\n\tplayer.WsLock = &wsLock\n\n\t// Open connection to Redis\n\tPSconn := pool.Get()\n\tconn := pool.Get()\n\tdefer PSconn.Close()\n\tdefer conn.Close()\n\n\n\n\t// Block until receive player info\n\t// Todo: timeout?\n\tvar newPlayerMsg contracts.NewPlayerRequestMessage\n\terr = ws.ReadJSON(&newPlayerMsg)\n\tif err != nil {\n\t\tfmt.Println(\"error decoding newPlayerMessage\")\n\t\treturn\n\t}\n\n\tplayer.Name = newPlayerMsg.Name\n\tplayer.GameId = newPlayerMsg.GameId\n\n\t//Check that room exists\n\texists, err := redis.Bool(conn.Do(\"EXISTS\", newPlayerMsg.GameId))\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tif exists {\n\t\tfmt.Println(\"game found\")\n\t\t// Request to join game\n\t\tjoinGameRequest := contracts.PlayerRequestJoin{\n\t\t\tPlayerId: player.PlayerId,\n\t\t\tPassword: newPlayerMsg.Password,\n\t\t\tName: newPlayerMsg.Name,\n\t\t}\n\t\treq := util.ObjectToString(player.PlayerId, player.GameId, joinGameRequest)\n\n\t\t// Subscribe to redis channel\n\t\tpsc := redis.PubSubConn{Conn: PSconn}\n\t\terr = psc.Subscribe(newPlayerMsg.GameId)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t} else {\n\t\t\tdefer psc.Close()\n\t\t}\n\n\t\tfmt.Println(\"publishing join game request\")\n\t\t_, err = conn.Do(\"PUBLISH\", newPlayerMsg.GameId, req)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\n\t\tfor {\n\t\t\tswitch v := psc.Receive().(type) {\n\t\t\tcase redis.Message:\n\t\t\t\tfmt.Println(\"Player has received a redis message: \", v.Channel, v.Data)\n\n\t\t\t\tvar redisMessage contracts.RedisMessage\n\t\t\t\terr = json.Unmarshal(v.Data, &redisMessage)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(\"error decoding redis message: \", err)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\t// Only forward messages meant for player or all\n\t\t\t\tif redisMessage.ReceiverId == player.PlayerId || (redisMessage.ReceiverId == \"\") {\n\t\t\t\t\t// Successfully joined game\n\t\t\t\t\tfmt.Println(redisMessage.Type)\n\t\t\t\t\tif redisMessage.Type == \"contracts.GameInfo\" {\n\t\t\t\t\t\t// Join game request accepted\n\t\t\t\t\t\tvar gameInfo contracts.GameInfo\n\t\t\t\t\t\terr = json.Unmarshal([]byte(redisMessage.Data), &gameInfo)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tfmt.Println(\"error decoding GameInfo: \", err)\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif gameInfo.Error == \"\" {\n\t\t\t\t\t\t\tgo handleIncomingMessages(pool, ws, player)\n\t\t\t\t\t\t\tresponseMessage := contracts.OutgoingWsMessage{}\n\t\t\t\t\t\t\tresponseMessage.PlayerId = player.PlayerId\n\t\t\t\t\t\t\tresponseMessage.GameId = player.GameId\n\t\t\t\t\t\t\tresponseMessage.Code = 201\n\t\t\t\t\t\t\tresponseMessage.Data = gameInfo\n\t\t\t\t\t\t\tplayer.WsLock.Lock()\n\t\t\t\t\t\t\tws.WriteJSON(responseMessage)\n\t\t\t\t\t\t\tplayer.WsLock.Unlock()\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Todo: proper exit and cleanup\n\t\t\t\t\t\t\tplayer.WsLock.Lock()\n\t\t\t\t\t\t\t// Write error?\n\t\t\t\t\t\t\tws.WriteJSON(redisMessage.Data)\n\t\t\t\t\t\t\tplayer.WsLock.Unlock()\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else if redisMessage.Type == \"contracts.UpdatePlayerMessage\" {\n\t\t\t\t\t\thandlePlayerUpdate(redisMessage, &player)\n\t\t\t\t\t} else if redisMessage.Type == \"contracts.OutgoingWsMessage\" {\n\t\t\t\t\t\tplayer.WsLock.Lock()\n\t\t\t\t\t\t// Write error?\n\t\t\t\t\t\tvar message contracts.OutgoingWsMessage\n\t\t\t\t\t\terr := json.Unmarshal([]byte(redisMessage.Data), &message)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tfmt.Println(\"error decoding OutgoingWsMessage: \", err)\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfmt.Println(\"writing out message to player\")\n\t\t\t\t\t\tws.WriteJSON(message)\n\t\t\t\t\t\tplayer.WsLock.Unlock()\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\tcase redis.Subscription:\n\t\t\t\tfmt.Printf(\"%s: %s %d\\n\", v.Channel, v.Kind, v.Count)\n\t\t\tcase error:\n\t\t\t\tfmt.Println(v)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "93661db839cf4473e9772112de033022", "score": "0.5851878", "text": "func New() *Team {\n\tteam := Team{}\n\tplayers := make([]*player.Player, 2)\n\tteam.Players = players\n\treturn &team\n}", "title": "" }, { "docid": "039b773c82b7089c45cef18599f879b3", "score": "0.5834162", "text": "func NewPlayer(size float64) *element.Element2d {\n\tp := &element.Element2d{}\n\n\tp.Active = true\n\n\tp.AddComponent(twod.NewSquareRenderer(p, size, 100, 100, 150, 255))\n\n\tp.AddComponent(&snakeMover{\n\t\tcontainer: p,\n\t\tspeed: 1,\n\t})\n\n\treturn p\n}", "title": "" }, { "docid": "5a32a7af0f275a9e91c71829dfffcf31", "score": "0.5818401", "text": "func New(parent context.Context) types.Context {\n\treturn newContext(parent, nil, nil, nil, nil)\n}", "title": "" }, { "docid": "f214e06ae6115231f6b8888e5f563c09", "score": "0.5808769", "text": "func New(id string) *GamePlayer {\n\tp := &GamePlayer{\n\t\tID: id,\n\t\trole: &role.Role{},\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "05e0866ab536ef43e618b20e9c223b5c", "score": "0.5765443", "text": "func (playerController PlayerController) Create(context *gin.Context) {\r\n\t// Validate input\r\n\tvar player models.Player\r\n\tif err := context.ShouldBindJSON(&player); err != nil {\r\n\t\tcontext.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\r\n\t\treturn\r\n\t}\r\n\t// Create player\r\n\tplayer.PlayerID = 0\r\n\ttmpGameID, err := strconv.Atoi(context.Param(\"game_id\"))\r\n\tif err != nil {\r\n\t\tcontext.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\r\n\t\treturn\r\n\t}\r\n\tplayer.GameID = uint(tmpGameID)\r\n\tif err := playerController.Database.Create(&player).Error; err != nil {\r\n\t\tcontext.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\r\n\t\treturn\r\n\t}\r\n\tcontext.JSON(http.StatusCreated, player)\r\n}", "title": "" }, { "docid": "ec755b512a990521aed6ae987cdb8246", "score": "0.57488006", "text": "func NewPlayer(room *Room, id int, uuid string) *Player {\n\treturn &Player {room: room, ID: id, UUID: uuid}\n}", "title": "" }, { "docid": "e0de0c75944d5aa3348d2e1d88dd2700", "score": "0.5746935", "text": "func New(ctx context.Context) (*Game, error) {\n\tw, err := world.New(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tuserAddition := make(chan *User)\n\tupdateList := make(chan listUpdate, 10)\n\n\t//Managed logged in user list\n\tgo loggedInUsers(ctx, updateList)\n\n\tgo handleNewUsers(ctx, userAddition, updateList, w)\n\n\treturn &Game{\n\t\tUsers: userAddition,\n\t\tCtx: ctx,\n\t}, nil\n}", "title": "" }, { "docid": "1818289a3f539d1adfab3f4d28fc455d", "score": "0.5736534", "text": "func CreatePlayer(c echo.Context) (interface{}, errs.Custom) {\n\t// Db := db.New()\n\t// defer Db.Close()\n\n\tp := new(models.Player)\n\terr := c.Bind(p)\n\tif err != nil {\n\t\treturn nil, errs.NewCustom(errs.ErrUsr, errs.ErrMsg[\"Bind\"], err)\n\t}\n\n\tp.Entry, _ = generics.Entry()\n\n\tres := map[string]interface{}{\n\t\t\"message\": \"player created correctly\",\n\t\t\"player\": p,\n\t\t\"success\": true,\n\t}\n\n\treturn res, nil\n\n}", "title": "" }, { "docid": "c5ff619334776edcccb62fb5e5aa10c0", "score": "0.56858927", "text": "func CreatePlayer(conn *websocket.Conn) *Player {\n\tplayer := Player{\n\t\tID: GenerateRandomID(),\n\t\tConn: conn,\n\t}\n\treturn &player\n}", "title": "" }, { "docid": "9d415202c2efea5e8c89b3eca4af93df", "score": "0.56514317", "text": "func newPlayer(aName string, aPlayerNum int, maxTime float64, seed int) Player {\n p := Player{\n name: aName,\n playerNum: aPlayerNum,\n timeLim: maxTime,\n }\n rand.Seed(int64(seed))\n return p\n}", "title": "" }, { "docid": "ceed922298b10c541eae0ebdef9a43f6", "score": "0.56319845", "text": "func (world *World) JoinNewPlayer() int {\n\n\tworld.playersMux.Lock()\n\n\tshape := box2d.MakeB2CircleShape()\n\tshape.M_radius = 5.0 / PixelsPerMeter\n\n\tfd := box2d.MakeB2FixtureDef()\n\tfd.Shape = &shape\n\tfd.Density = 1\n\tfd.Restitution = 0\n\tfd.Friction = 0\n\tfd.Filter = box2d.MakeB2Filter()\n\n\tbd := box2d.MakeB2BodyDef()\n\tbd.Position.Set(50*32/PixelsPerMeter, 50*32/PixelsPerMeter)\n\tbd.Type = box2d.B2BodyType.B2_dynamicBody\n\tbd.FixedRotation = true\n\tbd.AllowSleep = false\n\n\tbody := world.box2dWorld.CreateBody(&bd)\n\tbody.CreateFixtureFromDef(&fd)\n\n\tplayer := Player{\n\t\tSpriteSetNum: rand.Intn(2),\n\t\tX: 0,\n\t\tY: 0,\n\t\tSpeedX: 0,\n\t\tSpeedY: 0,\n\t}\n\tplayer.box2dBody = body\n\n\t//\tplayer.box2dBody.SetUserData(world.lastPlayerID)\n\n\tworld.Players[world.lastPlayerID] = player\n\n\tworld.lastPlayerID++\n\n\tworld.playersMux.Unlock()\n\n\treturn world.lastPlayerID - 1\n}", "title": "" }, { "docid": "91a404ac5969ef5cec96c55552cb3ea5", "score": "0.55792147", "text": "func NewPlayer(sampleRate, channelNum, bytesPerSample, bufferSizeInBytes int) (*Player, error) {\n\tp, err := newPlayer(sampleRate, channelNum, bytesPerSample, bufferSizeInBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Player{\n\t\tplayer: p,\n\t\tsampleRate: sampleRate,\n\t\tchannelNum: channelNum,\n\t\tbytesPerSample: bytesPerSample,\n\t\tbufferSize: bufferSizeInBytes,\n\t}, nil\n}", "title": "" }, { "docid": "eec879c0113df536d58107a4e0567ce4", "score": "0.55522186", "text": "func NewContext(ctx context.Context, p *Peer) context.Context {\n\treturn context.WithValue(ctx, peerKey{}, p)\n}", "title": "" }, { "docid": "8215931db6250352f9a60e0e76f0f07a", "score": "0.5540788", "text": "func New(id string, ctrl datastore.Controller) (*Entry, error) {\n\ttx, err := ctrl.Transaction()\n\tif err != nil {\n\t\ttx.Rollback()\n\t\treturn nil, err\n\t}\n\n\tentry := &Entry{Controller: ctrl}\n\n\tplayer, err := ctrl.FindPlayer(id, tx)\n\tif err != nil {\n\t\terr = ctrl.NewPlayer(id, tx)\n\t\tif err != nil {\n\t\t\ttx.Rollback()\n\t\t\treturn nil, err\n\t\t}\n\t\tplayer = &model.Player{ID: id}\n\t}\n\tentry.Player = *player\n\n\terr = tx.Commit()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn entry, nil\n}", "title": "" }, { "docid": "3420fd63ec59ce2cd9c28acb1ac48bb7", "score": "0.54993427", "text": "func NewMarketPlayer(id int, startingBalance float64, v bool) MarketPlayer {\n\tmp := MarketPlayer{id, startingBalance, make(map[string]markets.Contract), make(map[string]markets.PoolToken)}\n\tif v {\n\t\tfmt.Println(\"New MarketPlayer\")\n\t\tfmt.Println(\"id:\", id)\n\t\tfmt.Println(\"startingBalance:\", startingBalance)\n\t\tfmt.Println()\n\t}\n\n\treturn mp\n}", "title": "" }, { "docid": "f84b1ca597e1b4c0f149933704fb4856", "score": "0.54599005", "text": "func (b *Bot) NewContext(u Update) Context {\n\treturn &nativeContext{\n\t\tb: b,\n\t\tu: u,\n\t}\n}", "title": "" }, { "docid": "f919941734338333527bf35917f763ef", "score": "0.543377", "text": "func New(ctx context.Context) *Game {\n\tg := new(Game)\n\tg.Header = game.NewHeader(ctx, g)\n\tg.State = newState()\n\tg.Parent = pk(ctx)\n\tg.Type = gType.GOT\n\treturn g\n}", "title": "" }, { "docid": "d9938a2ac0e580d7b8151ecda8122894", "score": "0.53624547", "text": "func NewPlay(ctx context.Context, p ari.Player, opts ...OptionFunc) (*Options, error) {\n\to := NewDefaultOptions()\n\terr := o.ApplyOptions(opts...)\n\n\treturn o, err\n}", "title": "" }, { "docid": "79ea32ca8d6c0e9a4b0f45bfcb7950b8", "score": "0.5322636", "text": "func NewPlayerServer(store PlayerStore) *PlayerServer {\n\tp := new(PlayerServer)\n\n\tp.store = store\n\n\trouter := http.NewServeMux()\n\trouter.Handle(\"/league\", http.HandlerFunc(p.leagueHandler))\n\trouter.Handle(\"/players/\", http.HandlerFunc(p.playersHandler))\n\tp.Handler = router\n\treturn p\n}", "title": "" }, { "docid": "6dcea2791ec548c6516e0b9cfd5c4a66", "score": "0.5299405", "text": "func (r *SessionPlayerRepo) Create(playerID, sessionID, rating, form, formChange int) (*models.SessionPlayer, error) {\n\tsession := models.SessionPlayer{\n\t\tPlayerID: playerID,\n\t\tSessionID: sessionID,\n\t\tRating: rating,\n\t\tForm: form,\n\t\tFormChange: formChange,\n\t}\n\tvar createdSessionPlayer models.SessionPlayer\n\tresult := db.DB.Create(&session).Scan(&createdSessionPlayer)\n\tif result.Error != nil {\n\t\treturn nil, result.Error\n\t}\n\treturn &createdSessionPlayer, nil\n}", "title": "" }, { "docid": "1e85d90952d0ce664b24dee997ed345d", "score": "0.5296024", "text": "func (dk *DependencyKit) CreatePlayer(position Position, gender Gender, displayName character.DisplayName, userGroup character.UserGroup) *Player {\n\treturn dk.game.CreatePlayer(position, gender, displayName, userGroup)\n}", "title": "" }, { "docid": "73e6ffd4a4cede6bd2b5870fd550b567", "score": "0.52728564", "text": "func New() *Context {\n\treturn &Context{}\n}", "title": "" }, { "docid": "725d8569ff684357ec4568027d3758cc", "score": "0.5258173", "text": "func newContext(parent context.Context, w http.ResponseWriter, r *http.Request) *Context {\n\tctx := contextPool.Get().(*Context)\n\tctx.Context = parent\n\tctx.ResponseWriter = w\n\tctx.Request = r\n\treturn ctx\n}", "title": "" }, { "docid": "5d204c385f0b38c539e00a3706a4a164", "score": "0.52468157", "text": "func New() *Context {\n\tctx := &Context{}\n\tctx.Init()\n\treturn ctx\n}", "title": "" }, { "docid": "a2bdaec24ca97058f951702d36ec7bb0", "score": "0.5246544", "text": "func NewContext(parent context.Context, opts ...ContextOption) (context.Context, context.CancelFunc) {\n\tctx, cancel := context.WithCancel(parent)\n\n\tc := &Context{}\n\tif pc := FromContext(parent); pc != nil {\n\t\tc.Allocator = pc.Allocator\n\t\tc.Browser = pc.Browser\n\t\t// don't inherit SessionID, so that NewContext can be used to\n\t\t// create a new tab on the same browser.\n\t}\n\n\tfor _, o := range opts {\n\t\to(c)\n\t}\n\tif c.Allocator == nil {\n\t\tWithExecAllocator(\n\t\t\tNoFirstRun,\n\t\t\tNoDefaultBrowserCheck,\n\t\t\tHeadless,\n\t\t)(&c.Allocator)\n\t}\n\n\tctx = context.WithValue(ctx, contextKey{}, c)\n\treturn ctx, cancel\n}", "title": "" }, { "docid": "d7cbe6204e4c07e6e12e324b62fd90ab", "score": "0.5235258", "text": "func (factory *EntityFactory) CreatePlayer(position Position, gender Gender, displayName character.DisplayName, userGroup character.UserGroup) *entity.Entity {\n\treturn factory.world.\n\t\tCreateEntity().\n\t\tWith(&TransformComponent{MovementQueue: NewMovementQueue(position)}).\n\t\tWith(&UsernameComponent{DisplayName: displayName}).\n\t\tWith(&RankComponent{UserGroup: userGroup}).\n\t\tWith(&TrackingComponent{}).\n\t\tWith(&MapViewComponent{MapView: NewMapView()}).\n\t\tWith(&BicycleComponent{BicycleType: NoBike}).\n\t\tWith(&CanRunComponent{}).\n\t\tWith(&KindComponent{Kind: PlayerKind}).\n\t\tWith(&CoinBagComponent{CoinBag: NewCoinBag()}).\n\t\tWith(&PartyBeltComponent{PartyBelt: NewPartyBelt()}).\n\t\tWith(&WaryOfTimeComponent{}).\n\t\tBuild()\n}", "title": "" }, { "docid": "8de7b36070619a82124e39c3eabed7c7", "score": "0.51989716", "text": "func NewPlayerAction(player int, action int) *PlayerAction {\n\tpa := &PlayerAction{\n\t\tPlayer: player,\n\t\tAction: action,\n\t\tTime: time.Now(),\n\t}\n\treturn pa\n}", "title": "" }, { "docid": "0c7bf8d5011c331dccd1d482557a0a36", "score": "0.5185413", "text": "func GetNew() Context {\n\treturn newCtx(savedDriver)\n}", "title": "" }, { "docid": "e278cff38d01ea8dbfb9bf00c498d493", "score": "0.5175083", "text": "func New() *Context {\n\tc := new(Context)\n\tc.c = new(C.gl_wrap_context)\n\tc.batching = false\n\treturn c\n}", "title": "" }, { "docid": "16ecaf3915c0fe67121495e2293f466d", "score": "0.5150277", "text": "func NewPlayerAction(player int32, action int32) *PlayerAction {\n\tpa := &PlayerAction{\n\t\tPlayer: player,\n\t\tAction: action,\n\t\tTime: time.Now(),\n\t}\n\treturn pa\n}", "title": "" }, { "docid": "6f351aea9491bb83887614ae22f97ee0", "score": "0.5148703", "text": "func NewMainPlayer() (*Spaceship, error) {\n\t// Load main player sprite.\n\tsprite, err := utils.LoadSprite(\"./assets/images/spaceship.png\")\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tplayer := new(Spaceship)\n\n\tplayer.sprite = sprite\n\n\treturn player, nil\n}", "title": "" }, { "docid": "197b87fc0b297d900b875c7fb310b127", "score": "0.5135025", "text": "func NewContext(parent *Context) *Context {\n\treturn &Context{\n\t\tparent: parent,\n\t}\n}", "title": "" }, { "docid": "b0a0f3462e227b3bd75aec9c6872bf8f", "score": "0.5115848", "text": "func (m *Manager) New(ctx context.Context, sessionId ...string) *Session {\n\tvar id string\n\tif len(sessionId) > 0 && sessionId[0] != \"\" {\n\t\tid = sessionId[0]\n\t}\n\treturn &Session{\n\t\tid: id,\n\t\tctx: ctx,\n\t\tmanager: m,\n\t}\n}", "title": "" }, { "docid": "7c4579abbbb3baabefb42d6c672496e2", "score": "0.50814724", "text": "func newContext(s *Server) *Context {\n\treturn &Context{\n\t\tserver: s,\n\t\tparams: make(Entries, 0),\n\t}\n}", "title": "" }, { "docid": "b521e0cfdce155c4401ce8ceae9df82c", "score": "0.50755626", "text": "func NewContext(release string, namespace string) Context {\n\tif release == \"\" {\n\t\tbabbler := babble.NewBabbler()\n\t\tbabbler.Count = 2\n\t\tbabbler.Separator = \"-\"\n\t\trelease = strings.ToLower(babbler.Babble())\n\t}\n\n\tif namespace == \"\" {\n\t\tnamespace = \"default\"\n\t}\n\n\tparameters := make(ParametersType)\n\n\treturn Context{\n\t\tRelease: release,\n\t\tNamespace: namespace,\n\t\tParameters: parameters,\n\t}\n}", "title": "" }, { "docid": "ce2d9df7a94119fd792f38e14232a0d5", "score": "0.50733453", "text": "func (pl *PlayerList) New() (int, *Player, error) {\n\tfor k, _ := range pl.Players {\n\t\ttemppl := &pl.Players[k]\n\t\tif temppl.Used != 1 {\n\t\t\ttemppl.Used = 1\n\t\t\ttemppl.Free = 1\n\t\t\treturn k, temppl, nil\n\t\t}\n\t}\n\treturn 0, nil, errors.New(\"There are too many players.Please Wait.\")\n}", "title": "" }, { "docid": "d61ea9c6d942390e3ca9d28b70a5aff7", "score": "0.5061798", "text": "func NewContext(close CloseFunc) Context {\n\treturn &closerContext{\n\t\tclose: close,\n\t}\n}", "title": "" }, { "docid": "922b3ede85d5960828c831fa4c722040", "score": "0.50583225", "text": "func New(ctx context.Context) (*Group, context.Context) {\n\tctx, cancel := context.WithCancel(ctx)\n\treturn &Group{cancelCtx: cancel}, ctx\n}", "title": "" }, { "docid": "7326ef655eae18e5375640c1ff469294", "score": "0.50541586", "text": "func newContext(c *cli.Context) (ctx *Context, err error) {\n\tctx = &Context{\n\t\tContext: c,\n\t\tnetCtx: context.Background(),\n\t}\n\n\tctx.reporter, err = newReporter(ctx)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tctx.logger, err = newLogger(ctx)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tctx.stats, err = newStats(ctx)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tctx.netCtx = ctx.embed(ctx.netCtx)\n\n\treturn\n}", "title": "" }, { "docid": "63a59cf83fdc2b39bfbb0eb57c1be0c3", "score": "0.5053804", "text": "func (p *Player) NewPlayers() (players []*Player) {\n\tfor _, r := range surroundingRegions(p.X(), p.Y()) {\n\t\tr.Players.RangePlayers(func(p1 *Player) bool {\n\t\t\tif !p.LocalPlayers.Contains(p1) && p != p1 && p.WithinRange(p1.Location, 15) {\n\t\t\t\tplayers = append(players, p1)\n\t\t\t}\n\t\t\treturn false\n\t\t})\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "b9d6d44a03a3999ef7c2d022e7f8ea12", "score": "0.50529826", "text": "func newGame(tmId string) *Game {\n\tvar err error\n\tif err = db.open(); err != nil {\n\t\treturn nil\n\t}\n\tdefer db.close()\n\n\ttm := db.getTeam(tmId)\n\tif tm == nil {\n\t\treturn nil\n\t}\n\treturn &Game{TeamId: tmId}\n}", "title": "" }, { "docid": "915bf72a88bc2fe84e49f858625514f8", "score": "0.5048081", "text": "func New(parent context.Context) Context {\n\treturn newShisaCtx(parent)\n}", "title": "" }, { "docid": "9b638ece88392a86fb2eac897186ab59", "score": "0.5037272", "text": "func NewContext(parent context.Context, lc *LambdaContext) context.Context {\n\treturn context.WithValue(parent, contextKey, lc)\n}", "title": "" }, { "docid": "04ed03c17ee4d65ddb47e53ab3709957", "score": "0.5024466", "text": "func New(length int) *PlayerList {\n\tplayer := make([]Player, 0)\n\tfor i := 0; i < length; i++ {\n\t\tanyplayer := make(chan int)\n\t\tlastround := make(chan card.GameState) //independent state for chan\n\t\tnewplayer := Player{AnyPlayer: anyplayer, LastRound: lastround, Used: 0, Free: 0} //initial state\n\t\tplayer = append(player, newplayer)\n\t}\n\treturn &PlayerList{Players: player}\n}", "title": "" }, { "docid": "3ffc66d909249b11f4dec12163b0b1b9", "score": "0.50224465", "text": "func NewContext(ctx context.Context, u uint) context.Context {\n\treturn context.WithValue(ctx, userKey, u)\n}", "title": "" }, { "docid": "17489bedf24908d3d0679001e9031eea", "score": "0.50203824", "text": "func GetPlayer() *Player {\n\tp := &Player{}\n\treturn p\n}", "title": "" }, { "docid": "9b955476530c7292b9f0399f6a9776d0", "score": "0.50168794", "text": "func New(pc protocol.Client) *ServerContext {\n\treturn &ServerContext{\n\t\tProtocolClient: pc,\n\t\tBlockchainClient: mocks.NewMockBlockchainClient(nil),\n\t\tOpQueue: &opqueue.MemQueue{},\n\t}\n}", "title": "" }, { "docid": "f25d1fe25d408e0788c1fc5d2e1080f8", "score": "0.5002645", "text": "func New() *Game {\n\treturn &Game{}\n}", "title": "" }, { "docid": "6833437d2658d0da6c2558051dfe4d9d", "score": "0.4975557", "text": "func NewPlayer(spriteSheet *utils.SpriteSheet, soundmgr *utils.SoundMgr, stage interfaces.IStageNotificable) *Player {\n\tplayer := &Player{}\n\n\tplayer.spriteSheet = spriteSheet\n\tplayer.soundmgr = soundmgr\n\tplayer.stage = stage\n\n\t//Animations.\n\tplayer.animations = make(map[string]*utils.Animation)\n\n\t//Down.\n\tanimDown := utils.NewAnimation()\n\tanimDown.AddFrame(spriteSheet.GetFrameByName(\"player-0.png\"))\n\tanimDown.AddFrame(spriteSheet.GetFrameByName(\"player-1.png\"))\n\tanimDown.AddFrame(spriteSheet.GetFrameByName(\"player-2.png\"))\n\tanimDown.AddFrame(spriteSheet.GetFrameByName(\"player-1.png\"))\n\tplayer.animations[\"down\"] = animDown\n\n\t//Left.\n\tanimLeft := utils.NewAnimation()\n\tanimLeft.AddFrame(spriteSheet.GetFrameByName(\"player-3.png\"))\n\tanimLeft.AddFrame(spriteSheet.GetFrameByName(\"player-4.png\"))\n\tanimLeft.AddFrame(spriteSheet.GetFrameByName(\"player-5.png\"))\n\tanimLeft.AddFrame(spriteSheet.GetFrameByName(\"player-4.png\"))\n\tplayer.animations[\"left\"] = animLeft\n\n\t//Right.\n\tanimRight := utils.NewAnimation()\n\tanimRight.AddFrame(spriteSheet.GetFrameByName(\"player-6.png\"))\n\tanimRight.AddFrame(spriteSheet.GetFrameByName(\"player-7.png\"))\n\tanimRight.AddFrame(spriteSheet.GetFrameByName(\"player-8.png\"))\n\tanimRight.AddFrame(spriteSheet.GetFrameByName(\"player-7.png\"))\n\tplayer.animations[\"right\"] = animRight\n\n\t//Up.\n\tanimUp := utils.NewAnimation()\n\tanimUp.AddFrame(spriteSheet.GetFrameByName(\"player-9.png\"))\n\tanimUp.AddFrame(spriteSheet.GetFrameByName(\"player-10.png\"))\n\tanimUp.AddFrame(spriteSheet.GetFrameByName(\"player-11.png\"))\n\tanimUp.AddFrame(spriteSheet.GetFrameByName(\"player-10.png\"))\n\tplayer.animations[\"up\"] = animUp\n\n\tplayer.currentDir = \"down\"\n\n\treturn player\n}", "title": "" }, { "docid": "fff7f515d9d076063c0c9eddb194762b", "score": "0.4972365", "text": "func NewContext(label string) (c Context, err error) {\n\tif len(label) == 0 {\n\t\treturn c, nil\n\t}\n\tcon := strings.SplitN(label, \":\", 4)\n\tif len(con) < 3 {\n\t\treturn c, trace.BadParameter(\"invalid label\")\n\t}\n\tc.User = con[0]\n\tc.Role = con[1]\n\tc.Type = con[2]\n\tif len(con) > 3 {\n\t\tc.Level = con[3]\n\t}\n\treturn c, nil\n}", "title": "" }, { "docid": "550e24425f8bad8849b6b2c54fdfdf49", "score": "0.4964665", "text": "func New() Node {\n\tn := Node{isOpponent: false}\n\treturn n\n}", "title": "" }, { "docid": "968dfe276dcbd54844919eb09b0d64b7", "score": "0.49558085", "text": "func NewGame(p1, p2 Player) *Coordinator {\n\treturn &Coordinator{\n\t\tp1: &Game{\n\t\t\tplayer: p1,\n\t\t\tstate: GameState{\n\t\t\t\tTargetBoard: newBoard(),\n\t\t\t\tSourceBoard: newBoard(),\n\t\t\t},\n\t\t},\n\t\tp2: &Game{\n\t\t\tplayer: p2,\n\t\t\tstate: GameState{\n\t\t\t\tTargetBoard: newBoard(),\n\t\t\t\tSourceBoard: newBoard(),\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "c089b02e79eded51979acbb51f4298eb", "score": "0.49409917", "text": "func (this apiContext) NewContext(charId int, corpId int, testServer bool) (ctx apiContext, err error) {\n\tthis.charId = charId\n\tthis.corpId = corpId\n\tthis.testServer = testServer\n\t// lookup charId\n\t// lookup corpId\n\treturn this, status\n}", "title": "" }, { "docid": "5488655668ca4f6e1ba56b5a2e1f9edc", "score": "0.49356553", "text": "func New() context.Context {\n\treturn WithCtx(processCtx)\n}", "title": "" }, { "docid": "bd27d37fd66ffe48636a221af21248d2", "score": "0.49258098", "text": "func (c Context) New() Context {\n\tdata := c.data\n\tdata = append(data, map[string]interface{}{})\n\treturn Context{\n\t\tdata: data,\n\t}\n}", "title": "" }, { "docid": "7654405816a33256bfbd0b40a0ed0529", "score": "0.4912276", "text": "func NewHumanPlayer(n string, m string) *HumanPlayer {\n\treturn &HumanPlayer{\n\t\tname: n,\n\t\tmark: m,\n\t}\n}", "title": "" }, { "docid": "7184062c5c36e37ab73ab5ed750ceb37", "score": "0.49027047", "text": "func DummyPlayer() Player {\r\n\tExPlayer := Player{\r\n\t\tSteamID: \"STEAM_0:1:32729848\", //Every player has a STEAM ID given by valve. Can be used for information using Valve's API.\r\n\t\tTeamID: 123, //Used to link a player to a team. And for algorithm logic.\r\n\t\tUsername: \"Nargles\", //Username is the players in-game name.\r\n\t\tUni: \"Michigan State University\", //University name they are associated with.\r\n\t\tUniID: 1, //University ID they are associated with.\r\n\t\tStats: DummyStats(), //Stats block primarily used for webservices.\r\n\t}\r\n\treturn ExPlayer\r\n}", "title": "" }, { "docid": "a9de7a8d252c2ce00a8a9da22043fd34", "score": "0.48966768", "text": "func AddNewPlayer(connection net.Conn, username string, players *Types.TcpPlayers) {\n\n\tcandidate := Types.TcpPlayer{\n\t\tIP: connection.RemoteAddr().String(),\n\t\tUsername: username,\n\t}\n\n\tif !сontains(players, candidate) {\n\t\tplayers.Push(candidate)\n\t}\n\n}", "title": "" }, { "docid": "7c3dda87be027b32c927ce6edfc59e39", "score": "0.48962978", "text": "func NewContext(parent context.Context, r *http.Request) Context {\n\treturn &libstorContext{parent, r}\n}", "title": "" }, { "docid": "8194ba54067e0c713cec37135a43ec68", "score": "0.4875405", "text": "func NewContext(ctx context.Context, s *Session) context.Context {\n\treturn context.WithValue(ctx, contextKey, s)\n}", "title": "" }, { "docid": "4cd1656ed33300ad16a048bcb7276045", "score": "0.48668402", "text": "func (husky *Husky) NewContext(w http.ResponseWriter, r *http.Request) *CTX {\n\treturn &CTX{\n\t\tRequest: r,\n\t\tResponse: NewResponse(w),\n\t}\n}", "title": "" }, { "docid": "ff74fcf6ad3762cb2626538a057cbafc", "score": "0.48549873", "text": "func NewContext(r Renderer) *Context {\n\treturn &Context{\n\t\tRenderer: r,\n\t\tpath: &Path{},\n\t\tContextState: ContextState{\n\t\t\tStyle: DefaultStyle,\n\t\t\tview: Identity,\n\t\t\tcoordView: Identity,\n\t\t\tcoordSystem: CartesianI,\n\t\t},\n\t\tstack: nil,\n\t}\n}", "title": "" }, { "docid": "1f3485e26f31b21cec157b319e4ac511", "score": "0.48474264", "text": "func NewGame(w http.ResponseWriter, r *http.Request) {\n\tw = setContentType(w)\n\tvar request requests.NewGameRequest\n\terr := json.NewDecoder(r.Body).Decode(&request)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\tlog.Panic(err.Error())\n\t\treturn\n\t}\n\tif request.PlayerOne == \"\" || request.PlayerTwo == \"\" {\n\t\tmessage := \"Two players required\"\n\t\thttp.Error(w, message, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tnewGame, response, err := services.CreateGame(request.PlayerOne, request.PlayerTwo)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tGames = append(Games, newGame)\n\tjson.NewEncoder(w).Encode(response)\n}", "title": "" }, { "docid": "bc207009d8121d24f4f444f01453a957", "score": "0.48452562", "text": "func NewContext(app *App, set *flag.FlagSet, parentCtx *Context) *Context {\n\tc := &Context{App: app, flagSet: set, parentContext: parentCtx}\n\tif parentCtx != nil {\n\t\tc.Context = parentCtx.Context\n\t\tc.shellComplete = parentCtx.shellComplete\n\t\tif parentCtx.flagSet == nil {\n\t\t\tparentCtx.flagSet = &flag.FlagSet{}\n\t\t}\n\t}\n\n\tc.Command = &Command{}\n\n\tif c.Context == nil {\n\t\tc.Context = context.Background()\n\t}\n\n\treturn c\n}", "title": "" }, { "docid": "482a8193bb64c65521ec9e8e22cbe1e7", "score": "0.48280516", "text": "func NewContext(ctx *pulumi.Context,\n\tname string, args *ContextArgs, opts ...pulumi.ResourceOption) (*Context, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.EnvironmentId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'EnvironmentId'\")\n\t}\n\tif args.Name == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Name'\")\n\t}\n\tif args.SessionId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'SessionId'\")\n\t}\n\tif args.UserId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'UserId'\")\n\t}\n\treplaceOnChanges := pulumi.ReplaceOnChanges([]string{\n\t\t\"environmentId\",\n\t\t\"location\",\n\t\t\"project\",\n\t\t\"sessionId\",\n\t\t\"userId\",\n\t})\n\topts = append(opts, replaceOnChanges)\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Context\n\terr := ctx.RegisterResource(\"google-native:dialogflow/v2beta1:Context\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "c3e5cdb6ee676d17ba04d76449575884", "score": "0.48214892", "text": "func New(ctx context.Context) (context.Context, *Data) {\n\td := &Data{\n\t\tdat: map[string]string{},\n\t}\n\treturn context.WithValue(ctx, contextKey{}, d), d\n}", "title": "" }, { "docid": "ed9f33516fc9e8d0df5eb542f8eaf582", "score": "0.48171636", "text": "func NewContext() (ctx *Context, err error) {\n\tif ctx = (*Context)(C.swr_alloc()); ctx == nil {\n\t\terr = fmt.Errorf(\"cannot allocate context\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "12219d51dc208d9c1a7d3a3bbf45707f", "score": "0.48138666", "text": "func ForPlayerAdd(player *player.Player) Player {\n\treturn &playerAdd{player}\n}", "title": "" }, { "docid": "0bcb7f36f55ab238bfb3e3fb272baba5", "score": "0.48053274", "text": "func NewContext(ctx context.Context, u *models.User) context.Context {\n\treturn context.WithValue(ctx, userKey, u)\n}", "title": "" }, { "docid": "61807800ec1c1490f9a69320711e6338", "score": "0.4804201", "text": "func NewContext(parent context.Context) context.Context {\n\treturn &wrapper{parent}\n}", "title": "" }, { "docid": "ff5d81946d0c41c9a8fdc20ee07a4e72", "score": "0.48023584", "text": "func NewContext(root Command) *Context {\n\treturn &Context{\n\t\tRoot: root,\n\t\tNamed: map[string]interface{}{},\n\t\tPositional: []string{},\n\t}\n}", "title": "" }, { "docid": "88880fb86c888507def62d304c952da7", "score": "0.48008808", "text": "func NewContext(sampleRate, channelNum, bitDepthInBytes, bufferSizeInBytes int) (*Context, error) {\n\tcontextM.Lock()\n\tdefer contextM.Unlock()\n\n\tif theContext != nil {\n\t\tpanic(\"oto: NewContext can be called only once\")\n\t}\n\n\td, err := newDriver(sampleRate, channelNum, bitDepthInBytes, bufferSizeInBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdw := &driverWriter{\n\t\tdriver: d,\n\t\tbufferSize: bufferSizeInBytes,\n\t\tbytesPerSecond: sampleRate * channelNum * bitDepthInBytes,\n\t}\n\tc := &Context{\n\t\tdriverWriter: dw,\n\t\tmux: mux.New(channelNum, bitDepthInBytes),\n\t\terrCh: make(chan error),\n\t}\n\ttheContext = c\n\tgo func() {\n\t\tif _, err := io.Copy(c.driverWriter, c.mux); err != nil {\n\t\t\tc.errCh <- err\n\t\t}\n\t\tclose(c.errCh)\n\t}()\n\treturn c, nil\n}", "title": "" }, { "docid": "7efcb1565e0bc05c1eded077b6c91f5f", "score": "0.4797787", "text": "func newUser(username, password string) User {\n\treturn User{\n\t\tUserID: 1,\n\t\tUsername: username,\n\t\tPassword: password,\n\t}\n}", "title": "" }, { "docid": "522dbd014e248f94ab9f053ca7ff9a86", "score": "0.47968477", "text": "func NewContext(\n\tnodes map[string]bool,\n\tleader string,\n\tmasterNode string,\n\tmyIP string,\n\tch chan Chunk) *Context {\n\tctx := &Context{\n\t\tnodes: nodes,\n\t\tleader: leader,\n\t\tmasterNode: masterNode,\n\t\tmyIP: myIP,\n\t\tch: ch,\n\t\tfinalSort: false,\n\t}\n\tctx.workLoad = make(map[string]chan bool)\n\tfor k := range ctx.nodes {\n\t\tctx.workLoad[k] = make(chan bool, 2)\n\t}\n\tctx.deadLeader = make(chan bool, 1)\n\treturn ctx\n}", "title": "" }, { "docid": "e2d7fe17d659d28f1dffe748395701d9", "score": "0.47708762", "text": "func NewContext(opts ...ContextOption) Context {\n\tdefaultContext := &context{\n\t\tdelimLeft: \"{{\",\n\t\tdelimRight: \"}}\",\n\t\tname: \"root\",\n\t\tsecretReaders: []SecretReaderFunc{},\n\t\tstrictMode: true,\n\t}\n\n\t// Apply functions\n\tfor _, opt := range opts {\n\t\topt(defaultContext)\n\t}\n\n\t// Return modified context\n\treturn defaultContext\n}", "title": "" } ]
c2099ef49108883b91dc60540d352e3e
AsRecoveryPlanA2AFailoverInput is the BasicRecoveryPlanProviderSpecificFailoverInput implementation for RecoveryPlanHyperVReplicaAzureFailbackInput.
[ { "docid": "b5ef9f0ace9d243a541e90568f1805a3", "score": "0.8268784", "text": "func (rphvrafi RecoveryPlanHyperVReplicaAzureFailbackInput) AsRecoveryPlanA2AFailoverInput() (*RecoveryPlanA2AFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" } ]
[ { "docid": "2e4bc457049e36d05dbb9dedd12aaaf6", "score": "0.79375374", "text": "func (hvrafpi HyperVReplicaAzureFailbackProviderInput) AsA2AFailoverProviderInput() (*A2AFailoverProviderInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "355fceffc451738f974965ac375f56e6", "score": "0.7902578", "text": "func (rphvrafi RecoveryPlanHyperVReplicaAzureFailoverInput) AsRecoveryPlanA2AFailoverInput() (*RecoveryPlanA2AFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "39db776d36d46c2eef42c61d1aaa2d94", "score": "0.780364", "text": "func (rppsfi RecoveryPlanProviderSpecificFailoverInput) AsRecoveryPlanA2AFailoverInput() (*RecoveryPlanA2AFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "2d3aedb43839494b78c0e736100c68ec", "score": "0.77569544", "text": "func (rpafi RecoveryPlanA2AFailoverInput) AsRecoveryPlanHyperVReplicaAzureFailbackInput() (*RecoveryPlanHyperVReplicaAzureFailbackInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "580f1c0ae1f8aea7d16348c4cc798313", "score": "0.7580897", "text": "func (afpi A2AFailoverProviderInput) AsHyperVReplicaAzureFailbackProviderInput() (*HyperVReplicaAzureFailbackProviderInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e81a84278c7c5550719da30f95794d47", "score": "0.7552692", "text": "func (rpafi RecoveryPlanA2AFailoverInput) AsRecoveryPlanHyperVReplicaAzureFailoverInput() (*RecoveryPlanHyperVReplicaAzureFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "cb5233990298969571963056b040da2a", "score": "0.7497082", "text": "func (rpimavfi RecoveryPlanInMageAzureV2FailoverInput) AsRecoveryPlanA2AFailoverInput() (*RecoveryPlanA2AFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "2d15b7692ea0ef53d86345d22f3da0e0", "score": "0.7364099", "text": "func (afpi A2AFailoverProviderInput) AsHyperVReplicaAzureFailoverProviderInput() (*HyperVReplicaAzureFailoverProviderInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "fe705856d546c1f33f087043755708bd", "score": "0.72734797", "text": "func (hvrafpi HyperVReplicaAzureFailoverProviderInput) AsA2AFailoverProviderInput() (*A2AFailoverProviderInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "0f0a904c348b121c9e8436e49d6ec06a", "score": "0.7253367", "text": "func (rpimrfi RecoveryPlanInMageRcmFailoverInput) AsRecoveryPlanA2AFailoverInput() (*RecoveryPlanA2AFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "800ceb86eee7eeee13f04552150a0af4", "score": "0.71818143", "text": "func (rpimfi RecoveryPlanInMageFailoverInput) AsRecoveryPlanA2AFailoverInput() (*RecoveryPlanA2AFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "bce17b6a0f194b91888d42f91aa7c037", "score": "0.71785396", "text": "func (rpimavfi RecoveryPlanInMageAzureV2FailoverInput) AsRecoveryPlanHyperVReplicaAzureFailbackInput() (*RecoveryPlanHyperVReplicaAzureFailbackInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "4478e795f787c668a0423dae51c5440c", "score": "0.71453005", "text": "func (rppsfi RecoveryPlanProviderSpecificFailoverInput) AsRecoveryPlanHyperVReplicaAzureFailbackInput() (*RecoveryPlanHyperVReplicaAzureFailbackInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "d72fc745a31ec8c704d3c4ee5bcff23e", "score": "0.71301264", "text": "func (rpafi RecoveryPlanA2AFailoverInput) AsRecoveryPlanProviderSpecificFailoverInput() (*RecoveryPlanProviderSpecificFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "4109c799a7bc32d58a823d1b4071707d", "score": "0.71247566", "text": "func (hvrafpi HyperVReplicaAzureFailbackProviderInput) AsInMageAzureV2FailoverProviderInput() (*InMageAzureV2FailoverProviderInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "dc1b06fd1acb10b540c55a9482abc514", "score": "0.70941085", "text": "func (hvraufi HyperVReplicaAzureUnplannedFailoverInput) AsA2AUnplannedFailoverInput() (*A2AUnplannedFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "ddae69346c4dce8abf4cca31bee26c88", "score": "0.70701283", "text": "func (rpafi RecoveryPlanA2AFailoverInput) AsRecoveryPlanA2AFailoverInput() (*RecoveryPlanA2AFailoverInput, bool) {\n\treturn &rpafi, true\n}", "title": "" }, { "docid": "d5ef72ccbb24be8bf0570c32c4db6e2d", "score": "0.70369375", "text": "func (hvratfi HyperVReplicaAzureTestFailoverInput) AsA2ATestFailoverInput() (*A2ATestFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "835aced348a1b8b1928b2deb3824d29a", "score": "0.70263445", "text": "func (rpafi RecoveryPlanA2AFailoverInput) AsRecoveryPlanInMageAzureV2FailoverInput() (*RecoveryPlanInMageAzureV2FailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "d1c0784ea0506c5ac0d3e1d99acce9bd", "score": "0.700381", "text": "func (imavfpi InMageAzureV2FailoverProviderInput) AsHyperVReplicaAzureFailbackProviderInput() (*HyperVReplicaAzureFailbackProviderInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "59ae6199d72039d2d450ce90224b495a", "score": "0.6990517", "text": "func (rpimavfi RecoveryPlanInMageAzureV2FailoverInput) AsRecoveryPlanHyperVReplicaAzureFailoverInput() (*RecoveryPlanHyperVReplicaAzureFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "59627444abfe2c373f1d92c6b3aa27b4", "score": "0.694423", "text": "func (rphvrafi RecoveryPlanHyperVReplicaAzureFailbackInput) AsRecoveryPlanInMageAzureV2FailoverInput() (*RecoveryPlanInMageAzureV2FailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e59860f9cf07e506eb5136fd69b3ff64", "score": "0.68545747", "text": "func (afpi A2AFailoverProviderInput) AsProviderSpecificFailoverInput() (*ProviderSpecificFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "35040c02c620d293f76409df18529b16", "score": "0.6850886", "text": "func (psfi ProviderSpecificFailoverInput) AsHyperVReplicaAzureFailbackProviderInput() (*HyperVReplicaAzureFailbackProviderInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "ee679b0def50d9fc5b6b1d0247774159", "score": "0.68441", "text": "func (hvrafpi HyperVReplicaAzureFailbackProviderInput) AsHyperVReplicaAzureFailoverProviderInput() (*HyperVReplicaAzureFailoverProviderInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "44396dc1f7595ea6064e3a0fe1222b42", "score": "0.6844083", "text": "func (imavfpi InMageAzureV2FailoverProviderInput) AsA2AFailoverProviderInput() (*A2AFailoverProviderInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "96cd5cf4ffa37b7a0910142725eaa884", "score": "0.68386716", "text": "func (rphvrafi RecoveryPlanHyperVReplicaAzureFailbackInput) AsRecoveryPlanHyperVReplicaAzureFailoverInput() (*RecoveryPlanHyperVReplicaAzureFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "be88a1841e14275a462a3ab3781aaefa", "score": "0.6835904", "text": "func (psfi ProviderSpecificFailoverInput) AsA2AFailoverProviderInput() (*A2AFailoverProviderInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "3d97727859eea650f98439da439078d9", "score": "0.6832161", "text": "func (rphvrafi RecoveryPlanHyperVReplicaAzureFailoverInput) AsRecoveryPlanHyperVReplicaAzureFailbackInput() (*RecoveryPlanHyperVReplicaAzureFailbackInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "2dc105dac53b881de66267cfdab363e2", "score": "0.6825614", "text": "func (hvraarpi HyperVReplicaAzureApplyRecoveryPointInput) AsA2AApplyRecoveryPointInput() (*A2AApplyRecoveryPointInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "3134921ef53523f04f202db7c6beb398", "score": "0.6789116", "text": "func (imavufi InMageAzureV2UnplannedFailoverInput) AsA2AUnplannedFailoverInput() (*A2AUnplannedFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "4dd5307a3939304c0da818aeb487105f", "score": "0.67604065", "text": "func (rphvrafi RecoveryPlanHyperVReplicaAzureFailbackInput) AsRecoveryPlanProviderSpecificFailoverInput() (*RecoveryPlanProviderSpecificFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "ff6555d9926dceb4164a68fec0c84811", "score": "0.6745959", "text": "func (hvrafpi HyperVReplicaAzureFailoverProviderInput) AsHyperVReplicaAzureFailbackProviderInput() (*HyperVReplicaAzureFailbackProviderInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "d8d41084a42e08939fc312ce56ad0939", "score": "0.6738684", "text": "func (imavtfi InMageAzureV2TestFailoverInput) AsA2ATestFailoverInput() (*A2ATestFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "912da0fc03a3b8b2444d678c7cfe4e11", "score": "0.6733599", "text": "func (hvrafpi HyperVReplicaAzureFailbackProviderInput) AsProviderSpecificFailoverInput() (*ProviderSpecificFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "cff446a7b81acd93cd96490405620a76", "score": "0.6730729", "text": "func (rppsfi RecoveryPlanProviderSpecificFailoverInput) AsRecoveryPlanInMageAzureV2FailoverInput() (*RecoveryPlanInMageAzureV2FailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "3b97f8ae0592f90dd2b4a0dfc6687491", "score": "0.66619587", "text": "func (ufpsi UnplannedFailoverProviderSpecificInput) AsA2AUnplannedFailoverInput() (*A2AUnplannedFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e7b455e3c95b33bc17d4187d5d133f43", "score": "0.66565555", "text": "func (tfpsi TestFailoverProviderSpecificInput) AsA2ATestFailoverInput() (*A2ATestFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "5db0fe686de218ded59b8cf018aeac7b", "score": "0.66415197", "text": "func (rppsfi RecoveryPlanProviderSpecificFailoverInput) AsRecoveryPlanHyperVReplicaAzureFailoverInput() (*RecoveryPlanHyperVReplicaAzureFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "de9b036fdc0aeaccc8352b0ccaeece29", "score": "0.6631282", "text": "func (rpimrfi RecoveryPlanInMageRcmFailoverInput) AsRecoveryPlanHyperVReplicaAzureFailbackInput() (*RecoveryPlanHyperVReplicaAzureFailbackInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "38ea4e343d020aea34c13d5b119e067e", "score": "0.6612598", "text": "func (rpimrfi RecoveryPlanInMageRcmFailoverInput) AsRecoveryPlanInMageAzureV2FailoverInput() (*RecoveryPlanInMageAzureV2FailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "8ba959b05e86802da73511cb66090007", "score": "0.66084886", "text": "func (aufi A2AUnplannedFailoverInput) AsHyperVReplicaAzureUnplannedFailoverInput() (*HyperVReplicaAzureUnplannedFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "dba51e5fe4773e343de29feb13d061c1", "score": "0.66000295", "text": "func (rpafi RecoveryPlanA2AFailoverInput) AsBasicRecoveryPlanProviderSpecificFailoverInput() (BasicRecoveryPlanProviderSpecificFailoverInput, bool) {\n\treturn &rpafi, true\n}", "title": "" }, { "docid": "a82e8d7334215fe894a581b79f470d26", "score": "0.6599221", "text": "func (afpi A2AFailoverProviderInput) AsA2AFailoverProviderInput() (*A2AFailoverProviderInput, bool) {\n\treturn &afpi, true\n}", "title": "" }, { "docid": "58df617e617bf754f4a820835cddabc3", "score": "0.65858155", "text": "func (atfi A2ATestFailoverInput) AsHyperVReplicaAzureTestFailoverInput() (*HyperVReplicaAzureTestFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "1a7a6bb77d8b3e116e39898f139ebe08", "score": "0.65653074", "text": "func (afpi A2AFailoverProviderInput) AsInMageAzureV2FailoverProviderInput() (*InMageAzureV2FailoverProviderInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "b329bbececa29161cf705902d846cae1", "score": "0.6543799", "text": "func (imfpi InMageFailoverProviderInput) AsA2AFailoverProviderInput() (*A2AFailoverProviderInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "ed120f1d51a6e805603ad742bb6b3376", "score": "0.6528836", "text": "func (atfi A2ATestFailoverInput) AsA2ATestFailoverInput() (*A2ATestFailoverInput, bool) {\n\treturn &atfi, true\n}", "title": "" }, { "docid": "ea28f1fcf26d503df8ae8d4ed0883036", "score": "0.6516539", "text": "func (imavfpi InMageAzureV2FailoverProviderInput) AsHyperVReplicaAzureFailoverProviderInput() (*HyperVReplicaAzureFailoverProviderInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "a18e5166307076a3b75de0205b402277", "score": "0.6504959", "text": "func (imrtfi InMageRcmTestFailoverInput) AsA2ATestFailoverInput() (*A2ATestFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "860ac31a894fe0bc16522cb9502cf270", "score": "0.6472885", "text": "func (imufi InMageUnplannedFailoverInput) AsA2AUnplannedFailoverInput() (*A2AUnplannedFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e611e3879768dc8e581aeefc79f750e9", "score": "0.64728016", "text": "func (rphvrafi RecoveryPlanHyperVReplicaAzureFailoverInput) AsRecoveryPlanInMageAzureV2FailoverInput() (*RecoveryPlanInMageAzureV2FailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "726466ddcee194ad3a8a15604a44400f", "score": "0.6434415", "text": "func (imrufi InMageRcmUnplannedFailoverInput) AsA2AUnplannedFailoverInput() (*A2AUnplannedFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e0a034d731069a2c00d86272a5fffe73", "score": "0.6412773", "text": "func (rpimavfi RecoveryPlanInMageAzureV2FailoverInput) AsRecoveryPlanProviderSpecificFailoverInput() (*RecoveryPlanProviderSpecificFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "592a9decce722865d751f9978432547c", "score": "0.6402419", "text": "func (rpimfi RecoveryPlanInMageFailoverInput) AsRecoveryPlanHyperVReplicaAzureFailbackInput() (*RecoveryPlanHyperVReplicaAzureFailbackInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "3d033474dffc50c98c1cbef270108a88", "score": "0.6378111", "text": "func (rppsi RecoveryPlanProviderSpecificInput) AsRecoveryPlanA2AInput() (*RecoveryPlanA2AInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "fa05b97380ad4dadaf875df00588eff1", "score": "0.6376103", "text": "func (hvrafpi HyperVReplicaAzureFailoverProviderInput) AsInMageAzureV2FailoverProviderInput() (*InMageAzureV2FailoverProviderInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "7009025a92c9bc0288bdafda60026e2f", "score": "0.6365216", "text": "func (aufi A2AUnplannedFailoverInput) AsA2AUnplannedFailoverInput() (*A2AUnplannedFailoverInput, bool) {\n\treturn &aufi, true\n}", "title": "" }, { "docid": "2fa614f6c5249a83121c1d96bc0c7b11", "score": "0.63648796", "text": "func (imfpi InMageFailoverProviderInput) AsHyperVReplicaAzureFailbackProviderInput() (*HyperVReplicaAzureFailbackProviderInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "1332ad01fd1beb823292c3cc46fa5e22", "score": "0.63606066", "text": "func (imavtfi InMageAzureV2TestFailoverInput) AsHyperVReplicaAzureTestFailoverInput() (*HyperVReplicaAzureTestFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "73262242175dcbb9f2eaf0be590967c1", "score": "0.63552076", "text": "func (rpimfi RecoveryPlanInMageFailoverInput) AsRecoveryPlanInMageAzureV2FailoverInput() (*RecoveryPlanInMageAzureV2FailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "fbe03595131d8416f987abc60be66540", "score": "0.63530314", "text": "func (imtfi InMageTestFailoverInput) AsA2ATestFailoverInput() (*A2ATestFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "9f5d0915b453cb4c68ba09ba0aea54ea", "score": "0.63436365", "text": "func (afpi A2AFailoverProviderInput) AsBasicProviderSpecificFailoverInput() (BasicProviderSpecificFailoverInput, bool) {\n\treturn &afpi, true\n}", "title": "" }, { "docid": "e183ee60d2bf48f38021368a1efc97fb", "score": "0.6302467", "text": "func (rphvrafi RecoveryPlanHyperVReplicaAzureFailbackInput) AsBasicRecoveryPlanProviderSpecificFailoverInput() (BasicRecoveryPlanProviderSpecificFailoverInput, bool) {\n\treturn &rphvrafi, true\n}", "title": "" }, { "docid": "54444d1f6a0f1cb655645c826cc1d942", "score": "0.6300794", "text": "func (aarpi A2AApplyRecoveryPointInput) AsHyperVReplicaAzureApplyRecoveryPointInput() (*HyperVReplicaAzureApplyRecoveryPointInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "3231cb8666467cff521e9f36a81bfdb8", "score": "0.628865", "text": "func (hvrafpi HyperVReplicaAzureFailbackProviderInput) AsBasicProviderSpecificFailoverInput() (BasicProviderSpecificFailoverInput, bool) {\n\treturn &hvrafpi, true\n}", "title": "" }, { "docid": "7c1a21bd72b69a92839463646c89ddec", "score": "0.624939", "text": "func (rpafi RecoveryPlanA2AFailoverInput) AsRecoveryPlanInMageFailoverInput() (*RecoveryPlanInMageFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "4b2d3faa708087b5a2e9751df0f35637", "score": "0.62458783", "text": "func (imavarpi InMageAzureV2ApplyRecoveryPointInput) AsA2AApplyRecoveryPointInput() (*A2AApplyRecoveryPointInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "a9bc99ba6861bd10049110610000c600", "score": "0.6223488", "text": "func (psfi ProviderSpecificFailoverInput) AsHyperVReplicaAzureFailoverProviderInput() (*HyperVReplicaAzureFailoverProviderInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "75e4ccc05f65c52b05fb125dde7f0c5f", "score": "0.620418", "text": "func (imavufi InMageAzureV2UnplannedFailoverInput) AsHyperVReplicaAzureUnplannedFailoverInput() (*HyperVReplicaAzureUnplannedFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "a2ffa27c8160c1958cae3dcf0ea048b4", "score": "0.619027", "text": "func (hvraufi HyperVReplicaAzureUnplannedFailoverInput) AsInMageAzureV2UnplannedFailoverInput() (*InMageAzureV2UnplannedFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "303c10bfd5bb2d76d5e27fa8c11649a2", "score": "0.61821157", "text": "func (rpimrfi RecoveryPlanInMageRcmFailoverInput) AsRecoveryPlanHyperVReplicaAzureFailoverInput() (*RecoveryPlanHyperVReplicaAzureFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "0614e83e06a453ba017884102d153eda", "score": "0.6141473", "text": "func (hvrafpi HyperVReplicaAzureFailoverProviderInput) AsProviderSpecificFailoverInput() (*ProviderSpecificFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "af6c2e41fc725b5c9ebb8b43de7388dd", "score": "0.61375916", "text": "func (rphvrafi RecoveryPlanHyperVReplicaAzureFailoverInput) AsRecoveryPlanProviderSpecificFailoverInput() (*RecoveryPlanProviderSpecificFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "6192ab3e80a68c56607b0a808e0b82a0", "score": "0.6132608", "text": "func (hvratfi HyperVReplicaAzureTestFailoverInput) AsInMageAzureV2TestFailoverInput() (*InMageAzureV2TestFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "43f1b8dccebdf5956f4e04ac31be8f7e", "score": "0.61304325", "text": "func (rphvrafi RecoveryPlanHyperVReplicaAzureFailoverInput) AsRecoveryPlanHyperVReplicaAzureFailoverInput() (*RecoveryPlanHyperVReplicaAzureFailoverInput, bool) {\n\treturn &rphvrafi, true\n}", "title": "" }, { "docid": "72ea619b4ff8dc37f143ae15d99d95a9", "score": "0.6118412", "text": "func (rphvrafi RecoveryPlanHyperVReplicaAzureFailbackInput) AsRecoveryPlanHyperVReplicaAzureFailbackInput() (*RecoveryPlanHyperVReplicaAzureFailbackInput, bool) {\n\treturn &rphvrafi, true\n}", "title": "" }, { "docid": "de9a7554fa6b180ee677033a949623c8", "score": "0.6105381", "text": "func (tfpsi TestFailoverProviderSpecificInput) AsHyperVReplicaAzureTestFailoverInput() (*HyperVReplicaAzureTestFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "1b5eef2eff02ef1fdf77c371bc0f8d97", "score": "0.6095957", "text": "func (arppsi ApplyRecoveryPointProviderSpecificInput) AsA2AApplyRecoveryPointInput() (*A2AApplyRecoveryPointInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "fd836f3173b4cc0c5ad68520b5536518", "score": "0.6088793", "text": "func (aufi A2AUnplannedFailoverInput) AsInMageAzureV2UnplannedFailoverInput() (*InMageAzureV2UnplannedFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "7992ceaca7210642453e499da97e2204", "score": "0.6063448", "text": "func (rpimfi RecoveryPlanInMageFailoverInput) AsRecoveryPlanHyperVReplicaAzureFailoverInput() (*RecoveryPlanHyperVReplicaAzureFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "dd7e3c8465d1c737ef4a1c88527ffb39", "score": "0.6059575", "text": "func (rpafi RecoveryPlanA2AFailoverInput) AsRecoveryPlanInMageRcmFailoverInput() (*RecoveryPlanInMageRcmFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "fca8a5068a4959be85958ea1c041b46a", "score": "0.6053618", "text": "func (imavfpi InMageAzureV2FailoverProviderInput) AsProviderSpecificFailoverInput() (*ProviderSpecificFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "8bde6c78b4681276e1c183b4308260fd", "score": "0.6048395", "text": "func (rphvrafi RecoveryPlanHyperVReplicaAzureFailbackInput) AsRecoveryPlanInMageFailoverInput() (*RecoveryPlanInMageFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "48b7630bc00b326999a6f241c88f4d9e", "score": "0.6037035", "text": "func (imufi InMageUnplannedFailoverInput) AsInMageAzureV2UnplannedFailoverInput() (*InMageAzureV2UnplannedFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "5aa89dfe93c23c4cb2ce047563620ff3", "score": "0.6018145", "text": "func (hvrafpi HyperVReplicaAzureFailbackProviderInput) AsInMageFailoverProviderInput() (*InMageFailoverProviderInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "cb3732298d402e595e40fdd74244b9c7", "score": "0.6004677", "text": "func (imrufi InMageRcmUnplannedFailoverInput) AsInMageAzureV2UnplannedFailoverInput() (*InMageAzureV2UnplannedFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e34dda129255e268517ab350a635aad4", "score": "0.59961796", "text": "func (ufpsi UnplannedFailoverProviderSpecificInput) AsInMageAzureV2UnplannedFailoverInput() (*InMageAzureV2UnplannedFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "ed2bb5f457e0bba2a75212ef33ee49be", "score": "0.5980058", "text": "func (hvrari HyperVReplicaAzureReprotectInput) AsA2AReprotectInput() (*A2AReprotectInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "2a0e3716e25ddc255bd3bf5fb58f5585", "score": "0.59796536", "text": "func (hvrafpi HyperVReplicaAzureFailbackProviderInput) AsHyperVReplicaAzureFailbackProviderInput() (*HyperVReplicaAzureFailbackProviderInput, bool) {\n\treturn &hvrafpi, true\n}", "title": "" }, { "docid": "1bdff7e15524e3715d582f7bbbf56c65", "score": "0.5954731", "text": "func (imrtfi InMageRcmTestFailoverInput) AsHyperVReplicaAzureTestFailoverInput() (*HyperVReplicaAzureTestFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "f0f03d00bf6971545e01a090cf199451", "score": "0.59468085", "text": "func (rpimavfi RecoveryPlanInMageAzureV2FailoverInput) AsRecoveryPlanInMageFailoverInput() (*RecoveryPlanInMageFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "76c75b31bb4e8d641b77dc9086ee9003", "score": "0.59281707", "text": "func (imrtfi InMageRcmTestFailoverInput) AsInMageAzureV2TestFailoverInput() (*InMageAzureV2TestFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "0ea79082d4f48e1f49fb23f766e258b8", "score": "0.5919883", "text": "func (hvrafpi HyperVReplicaAzureFailoverProviderInput) AsHyperVReplicaAzureFailoverProviderInput() (*HyperVReplicaAzureFailoverProviderInput, bool) {\n\treturn &hvrafpi, true\n}", "title": "" }, { "docid": "c133d9f77d83a9eca132ff5bf2793419", "score": "0.59149605", "text": "func (tfpsi TestFailoverProviderSpecificInput) AsInMageAzureV2TestFailoverInput() (*InMageAzureV2TestFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e63edfc46f679a8243c90d22e4049765", "score": "0.5914307", "text": "func (rpimavfi RecoveryPlanInMageAzureV2FailoverInput) AsRecoveryPlanInMageAzureV2FailoverInput() (*RecoveryPlanInMageAzureV2FailoverInput, bool) {\n\treturn &rpimavfi, true\n}", "title": "" }, { "docid": "d270396c85e86fa5a01c1207b5048660", "score": "0.59105927", "text": "func (aarpi A2AApplyRecoveryPointInput) AsA2AApplyRecoveryPointInput() (*A2AApplyRecoveryPointInput, bool) {\n\treturn &aarpi, true\n}", "title": "" }, { "docid": "134895014dfa8377964cf340ae90c678", "score": "0.5879711", "text": "func (imtfi InMageTestFailoverInput) AsHyperVReplicaAzureTestFailoverInput() (*HyperVReplicaAzureTestFailoverInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "1a165c4ddb4aac05386ed086b7c65be4", "score": "0.5878144", "text": "func (imavarpi InMageAzureV2ApplyRecoveryPointInput) AsHyperVReplicaAzureApplyRecoveryPointInput() (*HyperVReplicaAzureApplyRecoveryPointInput, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "9cf91b18a7e44ead41eb32d9c80e9087", "score": "0.58589673", "text": "func (psfi ProviderSpecificFailoverInput) AsInMageAzureV2FailoverProviderInput() (*InMageAzureV2FailoverProviderInput, bool) {\n\treturn nil, false\n}", "title": "" } ]
b21c4cb12bee8c645f5dda1954c44207
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
[ { "docid": "f418d2bfbdf6ebb7ee50fc60076ad46d", "score": "0.0", "text": "func (in *ConfigDbDaemonSetList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "3cee8e63dba247e583a5b625e95a431c", "score": "0.731832", "text": "func (in *DaytonaBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "675e5e28e56c71e29896b320559d020e", "score": "0.71620226", "text": "func (in *JindoRuntime) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6cf361172e2241cf4d904f6f03f23593", "score": "0.7117203", "text": "func (in *AlluxioRuntime) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "21cbfd2584e847f4087af6094895c42c", "score": "0.7067021", "text": "func (in *Binding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "21cbfd2584e847f4087af6094895c42c", "score": "0.7067021", "text": "func (in *Binding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "eeab186f262253478f9ee38397059be1", "score": "0.70514596", "text": "func (in *EchoFlask) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "457a1ac4c15680c73ba842bf834a8310", "score": "0.7029272", "text": "func (in *Echo) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8945a0f25f613503ebbe6f64a7f56555", "score": "0.7022904", "text": "func (in *DaytonaBindingList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6e5329988d86ca278f511d8b4d305a84", "score": "0.70082676", "text": "func (in *Greeter) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "92334c3f674342ee45d4712097fcf341", "score": "0.70008576", "text": "func (in *KnativeEventing) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "99ce2d691b1913b2d28471ff735b1f5e", "score": "0.6995332", "text": "func (in *EFCRuntime) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "27e06b2ad7feeba3e20ea53e01daa1bd", "score": "0.699005", "text": "func (in *StarterKit) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6c00c0112c04c51bbbec6878dbbf674f", "score": "0.698232", "text": "func (in *DxHostedPrivateVirtualInterface) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4e9772d01d6c9f67ebe3eca6bc69d0f8", "score": "0.6974092", "text": "func (in *Vhost) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a1d4c6527b916e54ba0777a054d7629a", "score": "0.6968264", "text": "func (in *Extension) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e79dac2a2bb5859c630f2bd07870d946", "score": "0.6951929", "text": "func (in *Execution) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e748610314b47cccc859a9f50b8b9450", "score": "0.69461906", "text": "func (in *Myresouce) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "43d4f85b65b720d80097b3ac6b1dc0bc", "score": "0.69459426", "text": "func (in *VerneMQ) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ba9aee5d2bf2f5fd1b9a0342c4bd5ce8", "score": "0.69414586", "text": "func (in *DxBgpPeer) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3b34bd869d85653be9c7d5bad86c49b6", "score": "0.69405174", "text": "func (in *ThinRuntime) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2532a0fc2b3f337dcaf07b387fa6d090", "score": "0.69384223", "text": "func (in *VPCLink) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3ab63a87d8a60f11da5f6bfc7f5c70d4", "score": "0.6896794", "text": "func (in *Demo) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "74ba9764bd2378a183f9b3b0e3540d2b", "score": "0.68887025", "text": "func (in *DxBgpPeerList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1ced4151745d908e17d9dcef3eee8318", "score": "0.68870807", "text": "func (in *Engine) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1c8bfd881383e0d7074c046711e3dcf6", "score": "0.6872975", "text": "func (in *VirtualEnvironment) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2bcafaeb27de619dc016772c808d58d7", "score": "0.68696874", "text": "func (in *Ring) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9b670c60ccf1879954c943051cf3b348", "score": "0.6868126", "text": "func (in *Seed) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9b670c60ccf1879954c943051cf3b348", "score": "0.6868126", "text": "func (in *Seed) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "12f7baa569981785eda0f2f461b6db62", "score": "0.6863595", "text": "func (in *DxHostedPrivateVirtualInterfaceList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "291a7eb5a1e8b7890e3a643863b0b8ae", "score": "0.68553615", "text": "func (in *DockerMachine) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ae81b7a60d6066ed227f4703117a89e4", "score": "0.6853895", "text": "func (in *ExecService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "14875a2efb414d191dd088fb5643a920", "score": "0.6853208", "text": "func (in *Talk) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fcec147463a8b6def53689cdecd8e90f", "score": "0.68452173", "text": "func (in *KogitoRuntime) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b78141dcf60c82b2b32199f1620f05a8", "score": "0.6844884", "text": "func (x *Interact) DeepCopyObject() runtime.Object {\n\tif c := x.DeepCopy(); c != nil {\n\t\treturn c\n\t} else {\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "47873f0593624111dc977964e679e6b1", "score": "0.6837139", "text": "func (in *Build) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "481742939809cbd8004acee92686e5e8", "score": "0.68362427", "text": "func (in *AlluxioRuntimeList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "770aca74c07b964a5e617d9a980193d7", "score": "0.6835647", "text": "func (in *TektonInstallation) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9facf9aeb66f2a69e7d3ff7dcef72c85", "score": "0.68355685", "text": "func (in *JuiceFSRuntime) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9ce4494bcf223366cae1a86094020740", "score": "0.68298864", "text": "func (in *TestRun) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b40d62941763c1d416e9d31ab26c911f", "score": "0.6828011", "text": "func (in *Redis) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b40d62941763c1d416e9d31ab26c911f", "score": "0.6828011", "text": "func (in *Redis) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ef5bb17c0e49c4ae9b346443b8498af1", "score": "0.68272334", "text": "func (in *TektonAddon) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a265141112547fcd98d0b7b53401d509", "score": "0.6822024", "text": "func (in *EngineImage) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "662cc69dc31cab4e7bde2e440db71c6a", "score": "0.6821241", "text": "func (in *ServiceBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "24e15e83ce04e8d91506b826811caaa3", "score": "0.6821062", "text": "func (in *BindingList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "24e15e83ce04e8d91506b826811caaa3", "score": "0.6821062", "text": "func (in *BindingList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fe23113b6735f6d23368bab2a071efec", "score": "0.6820091", "text": "func (in *Blueprint) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "79c60012cbd61c06ec0132ae3da3da11", "score": "0.681977", "text": "func (in *GossipProtocol) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "30091e4bbf1de8588f4e5e8f09eb026e", "score": "0.68183774", "text": "func (in *Ikshvaku) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "43c9fe23376cfe9b4f397755827b989b", "score": "0.68177783", "text": "func (in *Exchange) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6aac3adb91ece013f35c1b2d5785ef80", "score": "0.68157506", "text": "func (in *JobRun) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "79337e2a5f35bc506e246238cd1c28b2", "score": "0.68120736", "text": "func (in *RocketMQSource) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f689f4fbfa36d94aa700a292b1cb7588", "score": "0.6799561", "text": "func (in *ChumichMachine) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c63dc406d086ea370f35c8fa2f7c0ee8", "score": "0.6796411", "text": "func (in *Vegeta) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aa4f2cc0e83f01ed511372d3e8d2cd2b", "score": "0.6794357", "text": "func (in *WordpressRuntime) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e4a069c05507bf2e8c0c3796b61e2141", "score": "0.6793585", "text": "func (in *VirtualService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e4a069c05507bf2e8c0c3796b61e2141", "score": "0.6793585", "text": "func (in *VirtualService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e4a069c05507bf2e8c0c3796b61e2141", "score": "0.6793585", "text": "func (in *VirtualService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c0e5cf45f51606470d2efd83f239fd9b", "score": "0.67925984", "text": "func (in *SeedList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c0e5cf45f51606470d2efd83f239fd9b", "score": "0.67925984", "text": "func (in *SeedList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ce0985149657d76851cb4142a0a97635", "score": "0.67921984", "text": "func (in *ImageBuildEnv) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "08851f577beff8b9a55605234a10b571", "score": "0.6790508", "text": "func (in *Machine) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c2c3d62f91dfb2c52bcbacf4c854e7b5", "score": "0.6789913", "text": "func (in *Flow) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e8d3edbc4aafe3a0e94ec1c46a354361", "score": "0.67896837", "text": "func (in *ExtensionList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aec0160aeaed48f4776e80a21e8bcdc7", "score": "0.6785463", "text": "func (in *Interface) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7572d69b2dd2c987a0dab55ee5c453ea", "score": "0.6782944", "text": "func (in *ExecutionList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "76f1e54550c239312aded69671699b83", "score": "0.67796296", "text": "func (in *ActiveMQArtemis) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "25a155b2a12099e23ed2847a7c8cff50", "score": "0.67779684", "text": "func (in *Addon) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "63d7bf45bfd47300b209cea5e9e1340f", "score": "0.677183", "text": "func (in *ActiveMQArtemisScaledown) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "63d7bf45bfd47300b209cea5e9e1340f", "score": "0.677183", "text": "func (in *ActiveMQArtemisScaledown) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "71be996d37cf4ff464659ad96488ac08", "score": "0.67695504", "text": "func (in *KnativeEventingList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b46c1bb6a69219d846ce44aeeb10899e", "score": "0.67691165", "text": "func (in *ChaosTest) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9ff753207c42e62a353fd18b2f7dbe93", "score": "0.6768062", "text": "func (x *InteractList) DeepCopyObject() runtime.Object {\n\tif c := x.DeepCopy(); c != nil {\n\t\treturn c\n\t} else {\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "aef3554cea2d1627b1b7e24f76a4f485", "score": "0.676783", "text": "func (in *JindoRuntimeList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1afc46c4cf63be7c598f87109cf3b385", "score": "0.67643076", "text": "func (in *Coredump) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t} else {\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "4e4e0a30a1cdb10078cb2cbf6f300a94", "score": "0.6762439", "text": "func (in *ImageList) DeepCopyObject() runtime.Object {\n\treturn in.DeepCopy()\n}", "title": "" }, { "docid": "c031df5c919611d8d87e7ccc277b96d4", "score": "0.6760573", "text": "func (in *EFCRuntimeList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f15c31310dacda55d391d4d64f965e40", "score": "0.675485", "text": "func (in *IAFDemo) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7a1f0279191485c832989cf99b164ba2", "score": "0.67532027", "text": "func (in *WireGuardPeer) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "78926fbc155c85ad2f33f9c3ede72b48", "score": "0.67532", "text": "func (in *KogitoRuntimeList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aa5bfb4228a9289e9d4b7e037c5511a0", "score": "0.67524904", "text": "func (in *Entrypoint) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "118dd76ec47f6b12955afde02f68289b", "score": "0.67524475", "text": "func (in *ELB) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4a4766209e4015d3a4af169282213f11", "score": "0.6750077", "text": "func (in *Docker) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t} else {\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "c78f75caaa730c54594a38a4c529cf7f", "score": "0.67496175", "text": "func (in *Builder) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f9a8c3e1101326cc84345d76a2004394", "score": "0.67421865", "text": "func (in *VPCLinkList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "afc759a5719bc951372c75f64e423500", "score": "0.67396003", "text": "func (in *TektonChain) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ffb7ee075d003d884c6708fc7694c95", "score": "0.67388374", "text": "func (in *User) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ffb7ee075d003d884c6708fc7694c95", "score": "0.67388374", "text": "func (in *User) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "55068b053e58dc243a5d414fe2448d27", "score": "0.6735094", "text": "func (in *EchoList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a9f7ad13b6e9ff9a93148ccd4a24095d", "score": "0.6734406", "text": "func (in *DataLoad) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d33300b3a9f69c76eb651f27fe82d30f", "score": "0.6730859", "text": "func (in *VerneMQList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "374ba6fb8a35852e5fbb42d1d55812aa", "score": "0.672734", "text": "func (in *EngineList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9627694de541850f9c27086b0183bb89", "score": "0.6726646", "text": "func (in *DeviceAccess) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6dc969eb216aae0081ea5f9cc0e192c8", "score": "0.6725677", "text": "func (in *DataLoadList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d0797e3a3ffe6caaff04a97f170949cd", "score": "0.6722882", "text": "func (in *GreeterList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c0c82bd02c82d6a1628ad3bc187d5184", "score": "0.67228", "text": "func (in *MicroFrontend) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f1ae492b5af1e6f9af82fec556ec8137", "score": "0.6722446", "text": "func (t *Trait) DeepCopyObject() runtime.Object {\n\tout := &Trait{}\n\tj, err := json.Marshal(t)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_ = json.Unmarshal(j, out)\n\treturn out\n}", "title": "" }, { "docid": "338039015f024caa1da7d370617f1015", "score": "0.6718876", "text": "func (in *TalkList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e5ab4bd6e629dbeaf40e354470ccd36a", "score": "0.6718053", "text": "func (in *DataObject) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c4a8cdf850115fad46d5d4cd97ae221a", "score": "0.671715", "text": "func (in *GooseFSRuntime) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a4dcace8701a3abadfe58a8807fa8d67", "score": "0.6715841", "text": "func (in *EchoFlaskList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" } ]
cfe3a77c4bb225e20153aac0ffa5357a
NewMachineDigestList generates a new empty MachineDigestList instance
[ { "docid": "ac559d8930dfebc37a10fefe2a41ee9f", "score": "0.7861968", "text": "func NewMachineDigestList() *MachineDigestList {\n\treturn &MachineDigestList{\n\t\tObjectListMeta: ObjectListMeta{\n\t\t\tKind: RESOURCE_MACHINE_DIGEST,\n\t\t},\n\t}\n}", "title": "" } ]
[ { "docid": "e371f709e347248d822c504878253c30", "score": "0.6759951", "text": "func NewMachineDigest() *MachineDigest {\n\treturn &MachineDigest{\n\t\tObjectMeta: ObjectMeta{Kind: RESOURCE_MACHINE_DIGEST},\n\t}\n}", "title": "" }, { "docid": "ee755b31db6506b0b26ab5c5128c881f", "score": "0.5996601", "text": "func NewMachineList() *MachineList {\n\treturn &MachineList{\n\t\tObjectListMeta: ObjectListMeta{\n\t\t\tKind: RESOURCE_MACHINE,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "874a7a4e670e29cc82fddfe2cec2e6fa", "score": "0.5663915", "text": "func (in *MachineDigestList) AppendRaw(dAtA []byte) error {\n\tcv := NewMachineDigest()\n\tif err := json.Unmarshal(dAtA, cv); err != nil {\n\t\treturn err\n\t}\n\tin.Members = append(in.Members, *cv)\n\treturn nil\n}", "title": "" }, { "docid": "3d83cecefce897bcf1d3adae35b9b40b", "score": "0.54893565", "text": "func NewMachineSnapshotList() *MachineSnapshotList {\n\treturn &MachineSnapshotList{\n\t\tObjectListMeta: ObjectListMeta{\n\t\t\tKind: RESOURCE_MACHINE_SNAPSHOT,\n\t\t\tIsolated: true,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "37503edec0eb9500d59d9a64580c5bd7", "score": "0.5481589", "text": "func createNewMembershipList() *MembershipList {\n\t// initialize the membership list, used when the process is born\n\tvar mbl MembershipList\n\tmbl.Lock = &sync.Mutex{}\n\tmbl.Members = []membershipEntry{{HOSTNAME, time.Now().Unix(), 0, true, 2}}\n\treturn &mbl\n}", "title": "" }, { "docid": "209d1015caf00da03e7de095a02ab39c", "score": "0.5457334", "text": "func newMAList() maList {\n\treturn make(map[peer.ID]Node)\n}", "title": "" }, { "docid": "78e6873dd89795abde4cb8fd205d4c68", "score": "0.5350044", "text": "func New() hash.Hash64 {\n\td := &digest{}\n\td.Reset()\n\treturn d\n}", "title": "" }, { "docid": "646016ac0af06738f218be82703222cb", "score": "0.52150387", "text": "func NewHashes()(*Hashes) {\n m := &Hashes{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "title": "" }, { "docid": "6c47a053e85cab5456e6ea07ba323620", "score": "0.5203625", "text": "func New() hash.Hash {\n\td := new(Digest)\n\td.Reset()\n\treturn d\n}", "title": "" }, { "docid": "4d0734e7939a712cd1f647784756f05c", "score": "0.5179916", "text": "func newRegistryEntries() *entries {\n\treturn &entries{\n\t\tentries: make([]Renewable, 0, entriesCap),\n\t}\n}", "title": "" }, { "docid": "85e1ffc4db88b6c6fa369339e5776252", "score": "0.5163899", "text": "func New() hash.Digest {\n\tref := &digest{}\n\tref.Reset()\n\treturn ref\n}", "title": "" }, { "docid": "85e1ffc4db88b6c6fa369339e5776252", "score": "0.5163899", "text": "func New() hash.Digest {\n\tref := &digest{}\n\tref.Reset()\n\treturn ref\n}", "title": "" }, { "docid": "36d6c36fa7f6457e50178d94fbd63891", "score": "0.5146629", "text": "func initMachineId() {\n\tvar sum [3]byte\n\thostname, err := os.Hostname()\n\tif err != nil {\n\t\tpanic(\"Failed to get hostname: \" + err.Error())\n\t}\n\thw := md5.New()\n\thw.Write([]byte(hostname))\n\tcopy(sum[:3], hw.Sum(nil))\n\tmachineId = sum[:]\n}", "title": "" }, { "docid": "296dc6a84b9ce344221f1d7d6525c06d", "score": "0.5138065", "text": "func newMachine(cluster *clusterv1.Cluster, name string) *clusterv1.Machine {\n\tgeneratedName := fmt.Sprintf(\"%s-%s\", name, util.RandomString(5))\n\tmachine := &clusterv1.Machine{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Machine\",\n\t\t\tAPIVersion: clusterv1.GroupVersion.String(),\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: \"default\",\n\t\t\tName: generatedName,\n\t\t},\n\t\tSpec: clusterv1.MachineSpec{\n\t\t\tBootstrap: clusterv1.Bootstrap{\n\t\t\t\tConfigRef: &corev1.ObjectReference{\n\t\t\t\t\tKind: \"EKSConfig\",\n\t\t\t\t\tAPIVersion: eksbootstrapv1.GroupVersion.String(),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tif cluster != nil {\n\t\tmachine.Spec.ClusterName = cluster.Name\n\t\tmachine.ObjectMeta.Labels = map[string]string{\n\t\t\tclusterv1.ClusterNameLabel: cluster.Name,\n\t\t}\n\t}\n\treturn machine\n}", "title": "" }, { "docid": "9a7265b154de8623df370430047c653b", "score": "0.5104148", "text": "func New() hash.Hash {\n\td := &digest{}\n\td.Reset()\n\treturn d\n}", "title": "" }, { "docid": "9a7265b154de8623df370430047c653b", "score": "0.5104148", "text": "func New() hash.Hash {\n\td := &digest{}\n\td.Reset()\n\treturn d\n}", "title": "" }, { "docid": "7f7e436dc9d33779830ccffbc78ad83d", "score": "0.50583917", "text": "func getNewMachine(mp *expv1.MachinePool, infraMachine *unstructured.Unstructured) *clusterv1.Machine {\n\tinfraRef := corev1.ObjectReference{\n\t\tAPIVersion: infraMachine.GetAPIVersion(),\n\t\tKind: infraMachine.GetKind(),\n\t\tName: infraMachine.GetName(),\n\t\tNamespace: infraMachine.GetNamespace(),\n\t}\n\n\tmachine := &clusterv1.Machine{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: names.SimpleNameGenerator.GenerateName(fmt.Sprintf(\"%s-\", mp.Name)),\n\t\t\t// Note: by setting the ownerRef on creation we signal to the Machine controller that this is not a stand-alone Machine.\n\t\t\tOwnerReferences: []metav1.OwnerReference{*metav1.NewControllerRef(mp, mp.GroupVersionKind())},\n\t\t\tNamespace: mp.Namespace,\n\t\t\tLabels: make(map[string]string),\n\t\t\tAnnotations: make(map[string]string),\n\t\t},\n\t\tSpec: clusterv1.MachineSpec{\n\t\t\tClusterName: mp.Spec.ClusterName,\n\t\t\tInfrastructureRef: infraRef,\n\t\t},\n\t}\n\n\tfor k, v := range mp.Spec.Template.Annotations {\n\t\tmachine.Annotations[k] = v\n\t}\n\n\t// Set the labels from machinePool.Spec.Template.Labels as labels for the new Machine.\n\t// Note: We can't just set `machinePool.Spec.Template.Labels` directly and thus \"share\" the labels\n\t// map between Machine and machinePool.Spec.Template.Labels. This would mean that adding the\n\t// MachinePoolNameLabel later on the Machine would also add the labels to machinePool.Spec.Template.Labels\n\t// and thus modify the labels of the MachinePool.\n\tfor k, v := range mp.Spec.Template.Labels {\n\t\tmachine.Labels[k] = v\n\t}\n\n\t// Enforce that the MachinePoolNameLabel and ClusterNameLabel are present on the Machine.\n\tmachine.Labels[clusterv1.MachinePoolNameLabel] = format.MustFormatValue(mp.Name)\n\tmachine.Labels[clusterv1.ClusterNameLabel] = mp.Spec.ClusterName\n\n\treturn machine\n}", "title": "" }, { "docid": "5b652d8bfac63cf9f3c2efb9343f3856", "score": "0.5057945", "text": "func newMachine(acc wallet.Account, params Params) (*machine, error) {\n\tidx := wallet.IndexOfAddr(params.Parts, acc.Address())\n\tif idx < 0 {\n\t\treturn nil, errors.New(\"account not part of participant set\")\n\t}\n\n\treturn &machine{\n\t\tphase: InitActing,\n\t\tacc: acc,\n\t\tidx: Index(idx),\n\t\tparams: params,\n\t\tEmbedding: log.MakeEmbedding(log.WithField(\"ID\", params.id)),\n\t}, nil\n}", "title": "" }, { "docid": "2c767a30b0b770a3bc3ebfda69ab251a", "score": "0.5046012", "text": "func NewMachine(name, mac, uuid string) *Machine {\n\treturn &Machine{\n\t\tName: name,\n\t\tMAC: mac,\n\t\tUUID: uuid,\n\t}\n}", "title": "" }, { "docid": "f3331c8f7a9401d91a73154634fc35d9", "score": "0.5032392", "text": "func createNewMachine(machineName string) []byte {\n\tcmd := exec.Command(\"sh\", \"-c\", fmt.Sprintf(createNewMachineCommand, machineName))\n\n\tstdout, _ := cmd.StdoutPipe()\n\tcmd.Start()\n\tscanner := bufio.NewScanner(stdout)\n\tfor scanner.Scan() {\n\t\tm := scanner.Text()\n\t\tfmt.Println(m)\n\t}\n\tcmd.Wait()\n\n\tout, _ := cmd.Output()\n\treturn out\n}", "title": "" }, { "docid": "26f39750bfb87f22c94d5e7d5439ecfe", "score": "0.50321794", "text": "func New() hash.Hash {\n\td := new(digest)\n\td.Reset()\n\treturn d\n}", "title": "" }, { "docid": "26f39750bfb87f22c94d5e7d5439ecfe", "score": "0.50321794", "text": "func New() hash.Hash {\n\td := new(digest)\n\td.Reset()\n\treturn d\n}", "title": "" }, { "docid": "34d194b5f1e7338c1949c09b1ac8bc26", "score": "0.50291884", "text": "func NewDigest() *Digest {\n\ttableInitOnce.Do(func() { crc32cTable = crc32.MakeTable(crc32.Castagnoli) })\n\treturn &Digest{\n\t\tmd5: md5.New(),\n\t\tcrc32c: crc32.New(crc32cTable),\n\t}\n}", "title": "" }, { "docid": "b486ca82cc41fc5011f45287eb7aa094", "score": "0.5011383", "text": "func New() hash.Hash {\n\td := new(digest)\n\td.Reset()\n\td.ver = 1\n\treturn d\n}", "title": "" }, { "docid": "a445c18b39aa3a86b15c319cf62877a0", "score": "0.50083065", "text": "func New(tab *Table) hash.Hash8 { return &digest{0, tab} }", "title": "" }, { "docid": "cda91372c3cd818dc06b9eb7b2c5b799", "score": "0.5004382", "text": "func newHostDeviceSet() (*hostDeviceSet, error) {\n\thosts, err := hostlist.CreateSet(\"\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &hostDeviceSet{\n\t\tHosts: hosts,\n\t}, nil\n}", "title": "" }, { "docid": "4471b411a8dc4131b78957b699ecbdfb", "score": "0.5004011", "text": "func CreateNewHashCollection() *HashCollection {\n\th := new(HashCollection)\n\th.Crc32c = crc32.New(crc32.MakeTable(crc32.Castagnoli))\n\th.Md5 = md5.New()\n\th.Sha1 = sha1.New()\n\th.Sha256 = sha256.New()\n\th.Sha512 = sha512.New()\n\treturn h\n}", "title": "" }, { "docid": "85f6849b2caabd949a94b99b4ba75754", "score": "0.49898273", "text": "func New(key []byte) hash.Hash64 {\n\treturn newDigest(Size, key)\n}", "title": "" }, { "docid": "388df52ebc7831a6410958758e9de397", "score": "0.49765903", "text": "func NewMachine() *Machine {\n\treturn &Machine{\n\t\tObjectMeta: ObjectMeta{Kind: RESOURCE_MACHINE},\n\t}\n}", "title": "" }, { "docid": "52ab4d92eba627d2979df25ee09acad4", "score": "0.49695703", "text": "func newDigest(size int, key []byte) *digest {\n\tif size != Size && size != Size128 {\n\t\tpanic(\"size must be 8 or 16\")\n\t}\n\td := new(digest)\n\td.k0 = uint64(key[0]) | uint64(key[1])<<8 | uint64(key[2])<<16 | uint64(key[3])<<24 |\n\t\tuint64(key[4])<<32 | uint64(key[5])<<40 | uint64(key[6])<<48 | uint64(key[7])<<56\n\td.k1 = uint64(key[8]) | uint64(key[9])<<8 | uint64(key[10])<<16 | uint64(key[11])<<24 |\n\t\tuint64(key[12])<<32 | uint64(key[13])<<40 | uint64(key[14])<<48 | uint64(key[15])<<56\n\td.size = size\n\td.Reset()\n\treturn d\n}", "title": "" }, { "docid": "8586ac4f1a4fa2a7aada312d007448a7", "score": "0.49685526", "text": "func New(tab *Table) hash.Hash64 { return &digest{0, tab} }", "title": "" }, { "docid": "8b8f270382934944fdef3959369da4be", "score": "0.49519664", "text": "func NewMachine(ctx context.Context, md *MachineDefinition) *Machine {\n\treturn &Machine{ctx, md}\n}", "title": "" }, { "docid": "bfefd85e165d1679c3c800c94e90c37d", "score": "0.4943941", "text": "func New() hash.Hash {\n\tresult := new(digest)\n\tresult.Reset()\n\treturn result\n}", "title": "" }, { "docid": "25a3750df16831250098ddbd7c16c967", "score": "0.49135932", "text": "func NewMachine(modelFile string) *Machine {\n\treturn &Machine{\n\t\tmodel: machine.NewModel(modelFile),\n\t}\n}", "title": "" }, { "docid": "3661cb1572ed22c43d25e76505789e3e", "score": "0.48952147", "text": "func buildInternet() (*Machine, []*Machine) {\n\t\n\tr := rand.New(rand.NewSource(999))\n\t\n\t// builds up a fake internet of machines.\n\n\tmasterList := make([]*Machine, 0, 0)\n\ttoExpand := make([]*Machine, 0, 0)\n\troot := NewMachine(randIP(r))\n\n\ttoExpand = append(toExpand, root)\n\tmasterList = append(masterList, root)\n\n\tfor n := 0; n < 50; n++ {\n\n\t\t// pick a random node, m, to expand\n\n\t\tif len(toExpand) == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\ti := r.Intn(len(toExpand))-1\n\n\t\tif i < 0 {\n\t\t\ti = 0\n\t\t}\n\n\t\tm := toExpand[i]\n\t\ttoExpand = append(toExpand[:i], toExpand[i+1:]...)\n\n\t\t// generate 10 machines, n, to attach to m\n\n\t\tfor q := 0; q < 10; q++ {\n\t\t\tn := NewMachine(randIP(r))\n\t\t\tn.Attach(m)\n\t\t\ttoExpand = append(toExpand, n)\n\t\t\tmasterList = append(masterList, n)\n\t\t}\n\n\t}\n\n\treturn root, masterList\n\n}", "title": "" }, { "docid": "10f48d71f7196f362860b0e480655896", "score": "0.48822773", "text": "func NewDigest(dig string) (Digest, error) {\n\td, err := digest.Parse(dig)\n\tif err != nil {\n\t\treturn EmptyDigest, err\n\t}\n\treturn Digest{d}, nil\n}", "title": "" }, { "docid": "f49205fd031ddd311f5b0753360b44c8", "score": "0.48781183", "text": "func NewMachine(id string) knox.Principal {\n\treturn machine(id)\n}", "title": "" }, { "docid": "effc89b49ed8a3f505dda63d61285221", "score": "0.48691797", "text": "func TestNewMachine(t *testing.T) {\n\tm, err := NewMachine(\n\t\tcontext.Background(),\n\t\tConfig{\n\t\t\tDisableValidation: true,\n\t\t\tMachineCfg: models.MachineConfiguration{\n\t\t\t\tVcpuCount: Int64(1),\n\t\t\t\tMemSizeMib: Int64(100),\n\t\t\t\tCPUTemplate: models.CPUTemplate(models.CPUTemplateT2),\n\t\t\t\tHtEnabled: Bool(false),\n\t\t\t},\n\t\t},\n\t\tWithLogger(fctesting.NewLogEntry(t)))\n\tif err != nil {\n\t\tt.Fatalf(\"failed to create new machine: %v\", err)\n\t}\n\n\tm.Handlers.Validation = m.Handlers.Validation.Clear()\n\n\tif m == nil {\n\t\tt.Errorf(\"NewMachine did not create a Machine\")\n\t}\n}", "title": "" }, { "docid": "c1e0898fe4ca9d4495900c8be9a6966f", "score": "0.48680937", "text": "func initMachineId() []byte {\n\tvar sum [3]byte\n\tid := sum[:]\n\thostname, err1 := os.Hostname()\n\tif err1 != nil {\n\t\t_, err2 := io.ReadFull(rand.Reader, id)\n\t\tif err2 != nil {\n\t\t\tpanic(fmt.Errorf(\"cannot get hostname: %v; %v\", err1, err2))\n\t\t}\n\t\treturn id\n\t}\n\thw := md5.New()\n\thw.Write([]byte(hostname))\n\tcopy(id, hw.Sum(nil))\n\treturn id\n}", "title": "" }, { "docid": "e7198a455698f39fec91dcad42756700", "score": "0.48537263", "text": "func NewMembership(host string, addrs []string) *Membership {\n\tlist := make(MList)\n\tordered := set.NewSet()\n\tcurTime := int(time.Now().UnixNano())\n\tfor _, addr := range addrs {\n\t\tnewHb := NewHeartbeat()\n\t\tnewHb.timeStamp = curTime\n\t\tlist[addr] = newHb\n\t\tordered.Add(addr)\n\t}\n\treturn &Membership{\n\t\tlist: list,\n\t\taddrs: *ordered,\n\t\thostAddr: host,\n\t\tdead: 20000000000,\n\t\tkill: 20000000000,\n\t\ttime: int(time.Now().UnixNano())}\n}", "title": "" }, { "docid": "07ae4cab4afe302ee8a2c24a76f8feb1", "score": "0.4832056", "text": "func BuildMachine(listVMNames []string, runningVMNames []string, inputJson map[string]interface{}) ([]*VirtualMachine, error) {\n\tvar virtualMachines []*VirtualMachine\n\n\tfor name, configure := range inputJson {\n\t\tmachineExist := false\n\t\tfor _, vmName := range listVMNames {\n\t\t\tif strings.Compare(vmName, name) != 0 {\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\tmachineExist = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif !machineExist {\n\t\t\treturn nil, errors.New(\"virtual machine \" + name + \" hasn't be created\")\n\t\t}\n\n\t\t// The virtual machine is here\n\t\t// Whether the machine is running\n\t\thaveStart := false\n\t\tfor _, runningName := range runningVMNames{\n\t\t\tif strings.Compare(runningName, name) != 0 {\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\thaveStart = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tbytes, _ := json.Marshal(configure)\n\t\tvmc := VirtualMachineConfigure{}\n\t\terr := json.Unmarshal(bytes, &vmc)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvirtualMachine := NewVirtualMachine(name, haveStart, vmc)\n\t\tvirtualMachines = append(virtualMachines, virtualMachine)\n\n\t}\n\n\treturn virtualMachines, nil\n}", "title": "" }, { "docid": "0e1135e7be6ff88e6ec762061179aa54", "score": "0.48253182", "text": "func (in *MachineList) AppendRaw(dAtA []byte) error {\n\tcv := NewMachine()\n\tif err := json.Unmarshal(dAtA, cv); err != nil {\n\t\treturn err\n\t}\n\tin.Members = append(in.Members, *cv)\n\treturn nil\n}", "title": "" }, { "docid": "a5d8dda1e2490d666ce53a57d43d00db", "score": "0.48056576", "text": "func New(tab *Table) hash.Hash32 { return &digest{0, tab} }", "title": "" }, { "docid": "bb71406c20ff37d4a5df70f0d028a6c8", "score": "0.48029065", "text": "func (prvdr Provider) List() (machines []db.Machine, err error) {\n\tfloatingIPListOpt := &godo.ListOptions{}\n\tfloatingIPs := map[int]string{}\n\tfor {\n\t\tips, resp, err := prvdr.ListFloatingIPs(floatingIPListOpt)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"list floating IPs: %s\", err)\n\t\t}\n\n\t\tfor _, ip := range ips {\n\t\t\tif ip.Droplet == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfloatingIPs[ip.Droplet.ID] = ip.IP\n\t\t}\n\n\t\tif resp.Links == nil || resp.Links.IsLastPage() {\n\t\t\tbreak\n\t\t}\n\t\tfloatingIPListOpt.Page++\n\t}\n\n\tdropletListOpt := &godo.ListOptions{} // Keep track of the page we're on.\n\t// DigitalOcean's API has a paginated list of droplets.\n\tfor {\n\t\tdroplets, resp, err := prvdr.ListDroplets(dropletListOpt)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"list droplets: %s\", err)\n\t\t}\n\n\t\tfor _, d := range droplets {\n\t\t\tif d.Name != prvdr.namespace || d.Region.Slug != prvdr.region {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tpubIP, err := d.PublicIPv4()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"get public IP: %s\", err)\n\t\t\t}\n\n\t\t\tprivIP, err := d.PrivateIPv4()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"get private IP: %s\", err)\n\t\t\t}\n\n\t\t\tmachine := db.Machine{\n\t\t\t\tCloudID: strconv.Itoa(d.ID),\n\t\t\t\tPublicIP: pubIP,\n\t\t\t\tPrivateIP: privIP,\n\t\t\t\tFloatingIP: floatingIPs[d.ID],\n\t\t\t\tSize: d.SizeSlug,\n\t\t\t\tPreemptible: false,\n\t\t\t}\n\t\t\tmachines = append(machines, machine)\n\t\t}\n\n\t\tif resp.Links == nil || resp.Links.IsLastPage() {\n\t\t\tbreak\n\t\t}\n\n\t\tdropletListOpt.Page++\n\t}\n\treturn machines, nil\n}", "title": "" }, { "docid": "d0c3ec81516439f89792dab047a65c19", "score": "0.47908613", "text": "func New(key *[32]byte) hash.Hash {\n\td := new(digest)\n\td.key = key\n\td.Reset()\n\treturn d\n}", "title": "" }, { "docid": "eb26b617b3c0cdd53cd2b4df8e610922", "score": "0.4789455", "text": "func ListNew() *List {\n return &List{0, nil, nil}\n}", "title": "" }, { "docid": "5bcadfb511bd0288d5583148e423827d", "score": "0.47762695", "text": "func (p *Provider) ListMachines(ctx context.Context, req *driver.ListMachinesRequest) (*driver.ListMachinesResponse, error) {\n\t// Log messages to track start and end of request\n\tklog.V(2).Infof(\"List machines request has been recieved for %q\", req.MachineClass.Name)\n\tdefer klog.V(2).Infof(\"List machines request has been recieved for %q\", req.MachineClass.Name)\n\n\tvar (\n\t\tmachineClass = req.MachineClass\n\t\tsecret = req.Secret\n\t\tfolderID = string(secret.Data[api.YandexFolderID])\n\t)\n\n\tctx, cancelFunc := context.WithTimeout(context.Background(), apiTimeout)\n\tdefer cancelFunc()\n\n\tySDK, err := p.YandexSDK.GetSession(ctx, secret)\n\tif err != nil {\n\t\treturn nil, mcmstatus.Error(mcmcodes.Internal, err.Error())\n\t}\n\n\tlistOfVMs := make(map[string]string)\n\n\tclusterName := \"\"\n\tnodeRole := \"\"\n\n\tfor key := range machineClass.Labels {\n\t\tif strings.Contains(key, \"kubernetes-io-cluster-\") {\n\t\t\tclusterName = key\n\t\t} else if strings.Contains(key, \"kubernetes-io-role-\") {\n\t\t\tnodeRole = key\n\t\t}\n\t}\n\n\tif clusterName == \"\" || nodeRole == \"\" {\n\t\treturn nil, mcmstatus.Error(mcmcodes.InvalidArgument, fmt.Sprintf(`no \"kubernetes-io-cluster\" or \"kubernetes-io-role-\" labels found in the MachineClass %s/%s`,\n\t\t\tmachineClass.Namespace, machineClass.Name))\n\t}\n\n\t// TODO: Replace this abomination with something more Go-like\n\tvar instances []*compute.Instance\n\tinstanceIterator := ySDK.Compute().Instance().InstanceIterator(ctx, folderID)\ninstanceIteration:\n\tfor {\n\t\tnext := instanceIterator.Next()\n\t\tswitch next {\n\t\tcase true:\n\t\t\tinstances = append(instances, instanceIterator.Value())\n\t\tcase false:\n\t\t\tbreak instanceIteration\n\t\t}\n\t}\n\tif instanceIterator.Error() != nil {\n\t\treturn nil, mcmstatus.Error(mcmcodes.Internal, fmt.Sprintf(\"could not list instances for FolderID %q: %s\", folderID, instanceIterator.Error()))\n\t}\n\n\tfor _, instance := range instances {\n\t\tmatchedCluster := false\n\t\tmatchedRole := false\n\t\tfor label := range instance.Labels {\n\t\t\tswitch label {\n\t\t\tcase clusterName:\n\t\t\t\tmatchedCluster = true\n\t\t\tcase nodeRole:\n\t\t\t\tmatchedRole = true\n\t\t\t}\n\t\t}\n\t\tif matchedCluster && matchedRole {\n\t\t\tlistOfVMs[encodeMachineID(instance.ZoneId, instance.Name)] = instance.Name\n\t\t}\n\t}\n\n\treturn &driver.ListMachinesResponse{MachineList: listOfVMs}, nil\n}", "title": "" }, { "docid": "6777d8ca3aefef93889a8b9186405649", "score": "0.47678876", "text": "func (in *ECPMachineList) DeepCopy() *ECPMachineList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ECPMachineList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a764671bb76f2a9607fa36eadf25b926", "score": "0.47676057", "text": "func NewMemoryStorage() *MemoryStorage {\n\treturn &MemoryStorage{\n\t\t// When starting from scratch populate the list with a dummy entry at term zero.\n\t\tents: make([]pb.Entry, 1),\n\t}\n}", "title": "" }, { "docid": "9f93d668a829cfe967bb1ac74894919f", "score": "0.47567427", "text": "func New() hash.Hash {\n\tif blockfunc != blockfuncGeneric {\n\t\td := new(digest)\n\t\td.Reset()\n\t\treturn d\n\t}\n\t// Fallback to the standard golang implementation\n\t// if no features were found.\n\treturn sha256.New()\n}", "title": "" }, { "docid": "9f93d668a829cfe967bb1ac74894919f", "score": "0.47567427", "text": "func New() hash.Hash {\n\tif blockfunc != blockfuncGeneric {\n\t\td := new(digest)\n\t\td.Reset()\n\t\treturn d\n\t}\n\t// Fallback to the standard golang implementation\n\t// if no features were found.\n\treturn sha256.New()\n}", "title": "" }, { "docid": "336e6c6c3b515056e140773f052fba43", "score": "0.4745474", "text": "func newMachineScope(params machineScopeParams) (*machineScope, error) {\n\tproviderSpec, err := v1beta1.ProviderSpecFromRawExtension(params.machine.Spec.ProviderSpec.Value)\n\tif err != nil {\n\t\treturn nil, machineapierros.InvalidMachineConfiguration(\"failed to get machine config: %v\", err)\n\t}\n\n\tproviderStatus, err := v1beta1.ProviderStatusFromRawExtension(params.machine.Status.ProviderStatus)\n\tif err != nil {\n\t\treturn nil, machineapierros.InvalidMachineConfiguration(\"failed to get machine provider status: %v\", err.Error())\n\t}\n\n\tserviceAccountJSON, err := getCredentialsSecret(params.coreClient, *params.machine, *providerSpec)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprojectID := providerSpec.ProjectID\n\tif len(projectID) == 0 {\n\t\tprojectID, err = getProjectIDFromJSONKey([]byte(serviceAccountJSON))\n\t\tif err != nil {\n\t\t\treturn nil, machineapierros.InvalidMachineConfiguration(\"error getting project from JSON key: %v\", err)\n\t\t}\n\t}\n\n\toauthClient, err := createOauth2Client(serviceAccountJSON, compute.CloudPlatformScope)\n\tif err != nil {\n\t\treturn nil, machineapierros.InvalidMachineConfiguration(\"error creating oauth client: %v\", err)\n\t}\n\n\tcomputeService, err := computeservice.NewComputeService(oauthClient)\n\tif err != nil {\n\t\treturn nil, machineapierros.InvalidMachineConfiguration(\"error creating compute service: %v\", err)\n\t}\n\treturn &machineScope{\n\t\tcoreClient: params.coreClient,\n\t\tprojectID: projectID,\n\t\t// https://github.com/kubernetes/kubernetes/blob/8765fa2e48974e005ad16e65cb5c3acf5acff17b/staging/src/k8s.io/legacy-cloud-providers/gce/gce_util.go#L204\n\t\tproviderID: fmt.Sprintf(\"gce://%s/%s/%s\", projectID, providerSpec.Zone, params.machine.Name),\n\t\tcomputeService: computeService,\n\t\t// Deep copy the machine since it is changed outside\n\t\t// of the machine scope by consumers of the machine\n\t\t// scope (e.g. reconciler).\n\t\tmachine: params.machine.DeepCopy(),\n\t\tproviderSpec: providerSpec,\n\t\tproviderStatus: providerStatus,\n\t\t// Once set, they can not be changed. Otherwise, status change computation\n\t\t// might be invalid and result in skipping the status update.\n\t\torigMachine: params.machine.DeepCopy(),\n\t\torigProviderStatus: providerStatus.DeepCopy(),\n\t\tmachineToBePatched: controllerclient.MergeFrom(params.machine.DeepCopy()),\n\t}, nil\n}", "title": "" }, { "docid": "aae63cef3430c6f1b1b8d6cd54356a12", "score": "0.47446662", "text": "func New(PrivateKey *[ed25519.PrivateKeySize]byte, address string, duration, newKeyFrequency int64, safedir string) *KeyList {\n\tkl := new(KeyList)\n\tkl.PrivateKey = PrivateKey\n\tpubkey := getPubKey(PrivateKey)\n\tkl.PublicKey = pubkey\n\tkl.Keys = make(KeyMap)\n\tkl.Address = address\n\tkl.NewKeyFrequency = newKeyFrequency\n\tkl.Duration = duration\n\tkl.Safedir = safedir\n\tos.MkdirAll(safedir, 0700)\n\tkl.mutex = new(sync.Mutex)\n\tkl.stopchan = make(chan bool)\n\treturn kl\n}", "title": "" }, { "docid": "d4b750690b912e399714e4f827ddb6fd", "score": "0.4733588", "text": "func newMachineTemplates(c *MachineV1alpha1Client, namespace string) *machineTemplates {\n\treturn &machineTemplates{\n\t\tclient: c.RESTClient(),\n\t\tns: namespace,\n\t}\n}", "title": "" }, { "docid": "cac4f53547872591b4c0ab90a3684d17", "score": "0.4728511", "text": "func NewDiscoveredMachines() *DiscoveredMachines {\n\treturn &DiscoveredMachines{\n\t\tObjectMeta: ObjectMeta{\n\t\t\tKind: RESOURCE_DISCOVERED_MACHINES,\n\t\t\tName: \"latest\",\n\t\t},\n\t}\n}", "title": "" }, { "docid": "e02d0168c3fd3e03be82d444d99202ce", "score": "0.47088507", "text": "func NewThingList() *ThingList { return new(ThingList).Init() }", "title": "" }, { "docid": "2977e6c7334a58bf8ab4fe4ab1f80c5b", "score": "0.47064424", "text": "func New(hosts []string) (m *Maglev, err error) {\n\tif len(hosts) == 0 {\n\t\terr = errors.New(\"Empty hosts\")\n\t\treturn\n\t}\n\n\tlogger := logging.NewLoggerTag(\"maglev\")\n\n\tm = &Maglev{\n\t\tb: new(bytes.Buffer),\n\t\thosts: make([][]byte, 0),\n\t\tpreferences: make([]int, 0),\n\t}\n\tfor i := 0; i < len(hosts); i++ {\n\t\tm.hosts = append(m.hosts, []byte(hosts[i]))\n\t}\n\tm.computePreferences()\n\tlogger.Info(\n\t\t\"Maglev for %v:\\nhosts: %v\\npreferences: %v\\n\",\n\t\thosts,\n\t\tm.hosts,\n\t\tm.preferences,\n\t)\n\treturn\n}", "title": "" }, { "docid": "46337f561fc30882c0443bb7cc3edc7d", "score": "0.4696694", "text": "func NewMachine(outlets int) {\n\tcoffeeMachine = &CoffeeMachine{\n\t\tbeverages: make(map[string]Beverage),\n\t\tingredients: make(map[string]Ingredient),\n\t\toutlets: outlets,\n\t\ttimeToPrepare: prepareTime,\n\t\tprepareBeverageChannel: make(chan string),\n\t\torderChannel: make(chan string),\n\t}\n}", "title": "" }, { "docid": "c1d213a430ab59523f848fc7cd58c69f", "score": "0.46954322", "text": "func (s *md5Server) NewHash() Hasher {\n\tuid := atomic.AddUint64(&s.uidCounter, 1)\n\tblockCh := make(chan blockInput, buffersPerLane)\n\ts.newInput <- newClient{\n\t\tuid: uid,\n\t\tinput: blockCh,\n\t}\n\treturn &md5Digest{\n\t\tuid: uid,\n\t\tbuffers: s.buffers,\n\t\tblocksCh: blockCh,\n\t\tcycleServer: s.cycle,\n\t}\n}", "title": "" }, { "docid": "259b3c3e89df9e9ffc3ba2e9fe06f25a", "score": "0.46941826", "text": "func NewMemoryStorage() *MemoryStorage {\n\treturn &MemoryStorage{\n\t\t// When starting from scratch populate the list with a dummy entry at term zero.\n\t\tents: make([]Entry, 1), //初始化时第一个是 dumpy entry, 如果有快照的话,第一个entry对应快照的index和term信息\n\t}\n}", "title": "" }, { "docid": "c75fc07d765f617b35ad522762fa7afe", "score": "0.46852145", "text": "func New() *List { return new(List).Init() }", "title": "" }, { "docid": "c75fc07d765f617b35ad522762fa7afe", "score": "0.46852145", "text": "func New() *List { return new(List).Init() }", "title": "" }, { "docid": "c75fc07d765f617b35ad522762fa7afe", "score": "0.46852145", "text": "func New() *List { return new(List).Init() }", "title": "" }, { "docid": "87a340d73e68df3649677988f56db446", "score": "0.46835816", "text": "func New() hash.Hash {\n\th := &hidriveHash{}\n\th.Reset()\n\treturn h\n}", "title": "" }, { "docid": "ac899bdef989163bfd078bdc6f65f5e6", "score": "0.4682852", "text": "func (r *MachinePoolReconciler) createMachinesIfNotExists(ctx context.Context, mp *expv1.MachinePool, machines []clusterv1.Machine, infraMachines []unstructured.Unstructured) ([]clusterv1.Machine, error) {\n\tlog := ctrl.LoggerFrom(ctx)\n\n\t// Construct a set of names of infraMachines that already have a Machine.\n\tinfraRefNames := sets.Set[string]{}\n\tfor _, machine := range machines {\n\t\tinfraRef := machine.Spec.InfrastructureRef\n\t\tinfraRefNames.Insert(infraRef.Name)\n\t}\n\n\tcreatedMachines := []clusterv1.Machine{}\n\tvar errs []error\n\tfor i := range infraMachines {\n\t\tinfraMachine := &infraMachines[i]\n\t\t// If infraMachine already has a Machine, skip it.\n\t\tif infraRefNames.Has(infraMachine.GetName()) {\n\t\t\tlog.V(4).Info(\"Machine already exists for infraMachine\", \"infraMachine\", klog.KObj(infraMachine))\n\t\t\tcontinue\n\t\t}\n\t\t// Otherwise create a new Machine for the infraMachine.\n\t\tlog.Info(\"Creating new Machine for infraMachine\", infraMachine.GroupVersionKind().Kind, klog.KObj(infraMachine))\n\t\tmachine := getNewMachine(mp, infraMachine)\n\t\tif err := r.Client.Create(ctx, machine); err != nil {\n\t\t\terrs = append(errs, errors.Wrapf(err, \"failed to create new Machine for infraMachine %q in namespace %q\", infraMachine.GetName(), infraMachine.GetNamespace()))\n\t\t\tcontinue\n\t\t}\n\t\tcreatedMachines = append(createdMachines, *machine)\n\t}\n\tmachines = append(machines, createdMachines...)\n\tif err := r.waitForMachineCreation(ctx, createdMachines); err != nil {\n\t\terrs = append(errs, errors.Wrapf(err, \"failed to wait for machines to be created\"))\n\t}\n\tif len(errs) > 0 {\n\t\treturn nil, kerrors.NewAggregate(errs)\n\t}\n\n\treturn machines, nil\n}", "title": "" }, { "docid": "a4d2dbc7f32bbd3d57d8bb6ef13c1c8c", "score": "0.46741322", "text": "func (s ServiceInfoReply) NewEntries(n int32) (ServiceInfoReplyEntry_List, error) {\n\tl, err := NewServiceInfoReplyEntry_List(s.Struct.Segment(), n)\n\tif err != nil {\n\t\treturn ServiceInfoReplyEntry_List{}, err\n\t}\n\terr = s.Struct.SetPtr(0, l.List.ToPtr())\n\treturn l, err\n}", "title": "" }, { "docid": "bcc361e03162a4fd4a86b3003875d4e2", "score": "0.4671965", "text": "func New() *List { return new(List) }", "title": "" }, { "docid": "343edf110a5da2f9b3fcf149cedde7f6", "score": "0.4668988", "text": "func NewDigestTree(leaves [][]byte) ([]byte, []BatchResidue, error) {\n\ttrees := make([]BatchResidue, len(leaves))\n\tfor i := 0; i < len(leaves); i++ {\n\t\ttrees[i].leafDigest = leaves[i]\n\t}\n\n\tleafRootDigests := make([][]byte, len(leaves))\n\tfor i := 0; i < len(leaves); i++ {\n\t\tleafRootDigests[i] = leaves[i]\n\t}\n\n\tfor i := uint(0); (1 << i) < len(leaves); i++ {\n\t\tsubtreeSize := 1 << (i + 1)\n\t\thalfSubtreeSize := 1 << i\n\t\t// l.Infof(\"i=%v (subtrees of size %v)\\n\", i, subtreeSize)\n\t\tfor j := 0; len(leaves) > j+halfSubtreeSize; j += subtreeSize {\n\t\t\t// l.Infof(\" i=%v j=%v\\n\", i, j)\n\t\t\tleftDigest := leafRootDigests[j]\n\t\t\trightDigest := leafRootDigests[j+halfSubtreeSize]\n\t\t\tfor k := j; k < j+halfSubtreeSize; k++ {\n\t\t\t\ttrees[k].addPathSegment(true, rightDigest)\n\t\t\t}\n\t\t\tfor k := j + halfSubtreeSize; (k < j+subtreeSize) && k < len(trees); k++ {\n\t\t\t\ttrees[k].addPathSegment(false, leftDigest)\n\t\t\t}\n\n\t\t\td := nodeDigest(leftDigest, rightDigest)\n\t\t\tleafRootDigests[j] = d\n\t\t\tleafRootDigests[j+halfSubtreeSize] = d\n\t\t}\n\t}\n\n\tvar rootDigest []byte\n\tif len(leafRootDigests) > 0 {\n\t\trootDigest = leafRootDigests[0]\n\t}\n\treturn rootDigest, trees, nil\n}", "title": "" }, { "docid": "9a0c81198b7db58b8ca60fadf13e488a", "score": "0.46661583", "text": "func NewMemoryStorage() MemoryStorage {\n\tms := MemoryStorage{\n\t\t// When starting from scratch populate the list with a dummy entry at term zero.\n\t\tents: make([]Entry, 1),\n\t}\n\tms.ents[0] = Entry{\n\t\tTerm:0,\n\t\tIndex:0,\n\t\tData: 0,\n\t}\n\treturn ms \n}", "title": "" }, { "docid": "7b1289ae1ec8d1920eaea64775014eb8", "score": "0.46502328", "text": "func newHistorian(storages *storage.Storage, nTilesToBackfill int) (*historian, error) {\n\tret := &historian{\n\t\tstorages: storages,\n\t}\n\n\t// Start running the background process to gather digestinfo.\n\tif err := ret.start(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// There is at least one tile to backfill digestinfo then start the process.\n\tif nTilesToBackfill > 0 {\n\t\tret.backFillDigestInfo(nTilesToBackfill)\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "577c42c07bcde668d27d6c90832c7f9e", "score": "0.46318275", "text": "func newMachinePool(cluster *clusterv1.Cluster, name string) *v1beta1.MachinePool {\n\tgeneratedName := fmt.Sprintf(\"%s-%s\", name, util.RandomString(5))\n\tmp := &v1beta1.MachinePool{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"MachinePool\",\n\t\t\tAPIVersion: v1beta1.GroupVersion.String(),\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: \"default\",\n\t\t\tName: generatedName,\n\t\t},\n\t\tSpec: v1beta1.MachinePoolSpec{\n\t\t\tTemplate: clusterv1.MachineTemplateSpec{\n\t\t\t\tSpec: clusterv1.MachineSpec{\n\t\t\t\t\tBootstrap: clusterv1.Bootstrap{\n\t\t\t\t\t\tConfigRef: &corev1.ObjectReference{\n\t\t\t\t\t\t\tKind: \"EKSConfig\",\n\t\t\t\t\t\t\tAPIVersion: eksbootstrapv1.GroupVersion.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\tif cluster != nil {\n\t\tmp.Spec.ClusterName = cluster.Name\n\t\tmp.ObjectMeta.Labels = map[string]string{\n\t\t\tclusterv1.ClusterNameLabel: cluster.Name,\n\t\t}\n\t}\n\treturn mp\n}", "title": "" }, { "docid": "09562cabbaae23f9de26c79610c22c27", "score": "0.46296337", "text": "func newHashWriters(diskCount int, algo HashAlgo) []hash.Hash {\n\thashWriters := make([]hash.Hash, diskCount)\n\tfor index := range hashWriters {\n\t\thashWriters[index] = newHash(algo)\n\t}\n\treturn hashWriters\n}", "title": "" }, { "docid": "6f354f648e9571caac9efd2eee136866", "score": "0.46011543", "text": "func newBareMetalMachineClient(subID string, authorizer auth.Authorizer) (*client, error) {\n\tc, err := wssdcloudclient.GetBareMetalMachineClient(&subID, authorizer)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &client{c}, nil\n}", "title": "" }, { "docid": "ac96364cbd5303cd6c83a1a28d2cc4e1", "score": "0.45978615", "text": "func NewMerkleTree(hashes []common.Uint256) (*MerkleTree, error) {\n\tif len(hashes) == 0 {\n\t\treturn nil, errors.New(\"NewMerkleTree input no item error.\")\n\t}\n\tvar height uint\n\n\theight = 1\n\tnodes := generateLeaves(hashes)\n\tfor len(nodes) > 1 {\n\t\tnodes = levelUp(nodes)\n\t\theight += 1\n\t}\n\tmt := &MerkleTree{\n\t\tRoot: nodes[0],\n\t\tDepth: height,\n\t}\n\treturn mt, nil\n\n}", "title": "" }, { "docid": "2cdb53abb452f69ba9943493ad74b127", "score": "0.459468", "text": "func newDiscoveryRegistry(maxEntries, maxActive int) *discoveryRegistry {\r\n\tif maxActive > maxEntries {\r\n\t\tmaxEntries = maxActive\r\n\t}\r\n\td := &discoveryRegistry{}\r\n\td.maxEntries, d.maxActive = maxEntries, maxActive\r\n\td.entries = make(map[uuid.UUID]*discoveryEntry)\r\n\td.ctx, d.cancel = context.WithCancel(context.Background())\r\n\treturn d\r\n}", "title": "" }, { "docid": "496274457c4943478bd708d2348cc327", "score": "0.4584739", "text": "func New(storage list.List) LUT {\n\treturn &lut{storage: storage}\n}", "title": "" }, { "docid": "92c727a061f8cb1f95bcc5d938a907d6", "score": "0.45776105", "text": "func (a *Actions) ListMachines() {\n\tsetup, err := loadSetup(a.path)\n\tif err != nil {\n\t\tfmt.Println(\"ERROR: \" + err.Error())\n\t}\n\n\tfor _, machine := range setup.Machines {\n\t\tfmt.Println(machine.Id)\n\t\tfmt.Printf(\"\\t%s@%s:%s (%s)\\n\", machine.User, machine.Address, machine.Port, machine.PrivateKey)\n\t}\n}", "title": "" }, { "docid": "3f0e7b7178a791ea8379a4db7663a001", "score": "0.45747995", "text": "func New(initState State, stateCount, eventCount uint) *StateMachine {\n\t// Allocate enough space for the handlers.\n\ttable := make([][]*list.List, stateCount)\n\n\tfor i := range table {\n\t\ttable[i] = make([]*list.List, eventCount)\n\n\t\tfor j := range table[i] {\n\t\t\ttable[i][j] = list.New()\n\t\t}\n\t}\n\n\tsm := StateMachine{\n\t\tstate: initState,\n\t\thandlers: table,\n\t\tcmdCh: make(chan *command),\n\t\tterminatedCh: make(chan struct{}),\n\t}\n\n\t// Start background goroutine.\n\tgo sm.loop()\n\n\treturn &sm\n}", "title": "" }, { "docid": "2bd054e19ed1fd10ec731c42134259d7", "score": "0.45737803", "text": "func newMockFilesystem(items []string) *MockFilesystem {\n\tm := &MockFilesystem{\n\t\tFiles: make(map[string]*MockFile),\n\t}\n\n\tfor _, item := range items {\n\t\tm.Add(item)\n\t}\n\n\treturn m\n}", "title": "" }, { "docid": "25193114b0621cbae934df84fb1e1f4c", "score": "0.45711234", "text": "func newMemoryMailBox() *memoryMailBox {\n\tbox := &memoryMailBox{\n\t\twireMessages: list.New(),\n\t\thtlcPkts: list.New(),\n\t\tmessageOutbox: make(chan lnwire.Message),\n\t\tpktOutbox: make(chan *htlcPacket),\n\t\tmsgReset: make(chan chan struct{}, 1),\n\t\tpktReset: make(chan chan struct{}, 1),\n\t\tpktIndex: make(map[CircuitKey]*list.Element),\n\t\tquit: make(chan struct{}),\n\t}\n\tbox.wireCond = sync.NewCond(&box.wireMtx)\n\tbox.pktCond = sync.NewCond(&box.pktMtx)\n\n\treturn box\n}", "title": "" }, { "docid": "e41fc3c42e07a9fd3889d452a8d454de", "score": "0.45596892", "text": "func (p *Provider) CreateMachine(ctx context.Context, req *driver.CreateMachineRequest) (*driver.CreateMachineResponse, error) {\n\t// Log messages to track request\n\tklog.V(2).Infof(\"Machine creation request has been recieved for %q\", req.Machine.Name)\n\tdefer klog.V(2).Infof(\"Machine creation request has been processed for %q\", req.Machine.Name)\n\n\tvar (\n\t\tmachine = req.Machine\n\t\tsecret = req.Secret\n\t\tmachineClass = req.MachineClass\n\t)\n\n\tctx, cancelFunc := context.WithTimeout(context.Background(), apiTimeout)\n\tdefer cancelFunc()\n\n\tySDK, err := p.YandexSDK.GetSession(ctx, secret)\n\tif err != nil {\n\t\treturn nil, mcmstatus.Error(mcmcodes.Internal, err.Error())\n\t}\n\n\tspec, err := unmarshalYandexProviderSpec(machineClass)\n\tif err != nil {\n\t\treturn nil, mcmstatus.Error(mcmcodes.InvalidArgument, err.Error())\n\t}\n\n\tvar instanceMetadata = make(map[string]string)\n\tif spec.Metadata != nil {\n\t\tinstanceMetadata = spec.Metadata\n\t}\n\n\tuserData, exists := secret.Data[\"userData\"]\n\tif !exists {\n\t\treturn nil, mcmstatus.Error(mcmcodes.InvalidArgument, \"userData doesn't exist\")\n\t}\n\tinstanceMetadata[\"user-data\"] = string(userData)\n\n\tvar networkInterfaceSpecs []*compute.NetworkInterfaceSpec\n\tfor _, netIf := range spec.NetworkInterfaceSpecs {\n\t\tvar natSpec *compute.OneToOneNatSpec\n\t\tif netIf.AssignPublicIPAddress {\n\t\t\tnatSpec = &compute.OneToOneNatSpec{\n\t\t\t\tIpVersion: compute.IpVersion_IPV4,\n\t\t\t}\n\t\t}\n\n\t\tvar externalIPv4Address = &compute.PrimaryAddressSpec{\n\t\t\tOneToOneNatSpec: natSpec,\n\t\t}\n\n\t\tnetworkInterfaceSpecs = append(networkInterfaceSpecs, &compute.NetworkInterfaceSpec{\n\t\t\tSubnetId: netIf.SubnetID,\n\t\t\tPrimaryV4AddressSpec: externalIPv4Address,\n\t\t})\n\t}\n\n\tcreateInstanceParams := &compute.CreateInstanceRequest{\n\t\tFolderId: string(secret.Data[api.YandexFolderID]),\n\t\tName: machine.Name,\n\t\tHostname: machine.Name,\n\t\tLabels: spec.Labels,\n\t\tMetadata: instanceMetadata,\n\t\tZoneId: spec.ZoneID,\n\t\tPlatformId: spec.PlatformID,\n\t\tResourcesSpec: &compute.ResourcesSpec{\n\t\t\tMemory: spec.ResourcesSpec.Memory,\n\t\t\tCores: spec.ResourcesSpec.Cores,\n\t\t\tCoreFraction: spec.ResourcesSpec.CoreFraction,\n\t\t\tGpus: spec.ResourcesSpec.GPUs,\n\t\t},\n\t\tBootDiskSpec: &compute.AttachedDiskSpec{\n\t\t\tMode: compute.AttachedDiskSpec_READ_WRITE,\n\t\t\tAutoDelete: spec.BootDiskSpec.AutoDelete,\n\t\t\tDisk: &compute.AttachedDiskSpec_DiskSpec_{\n\t\t\t\tDiskSpec: &compute.AttachedDiskSpec_DiskSpec{\n\t\t\t\t\tTypeId: spec.BootDiskSpec.TypeID,\n\t\t\t\t\tSize: spec.BootDiskSpec.Size,\n\t\t\t\t\tSource: &compute.AttachedDiskSpec_DiskSpec_ImageId{\n\t\t\t\t\t\tImageId: spec.BootDiskSpec.ImageID,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tNetworkInterfaceSpecs: networkInterfaceSpecs,\n\t\tSchedulingPolicy: &compute.SchedulingPolicy{\n\t\t\tPreemptible: spec.SchedulingPolicy.Preemptible,\n\t\t},\n\t}\n\n\tresult, _, err := waitForResult(ctx, ySDK, func() (*operation.Operation, error) {\n\t\treturn ySDK.Compute().Instance().Create(ctx, createInstanceParams)\n\t})\n\tif err != nil {\n\t\treturn nil, mcmstatus.Error(mcmcodes.InvalidArgument, err.Error())\n\t}\n\n\tnewInstance, ok := result.(*compute.Instance)\n\tif !ok {\n\t\treturn nil, mcmstatus.Error(mcmcodes.Internal, fmt.Sprintf(\"Yandex.Cloud API returned %q instead of \\\"*compute.Instance\\\". That shouldn't happen\", reflect.TypeOf(result).String()))\n\t}\n\n\treturn &driver.CreateMachineResponse{ProviderID: encodeMachineID(newInstance.ZoneId, newInstance.Name), NodeName: machine.Name}, nil\n}", "title": "" }, { "docid": "e78144a71d49ce20258e5257c2add07c", "score": "0.45595682", "text": "func New(prev uint32, tab *crc32.Table) hash.Hash32 { return &digest{prev, tab} }", "title": "" }, { "docid": "213cbfba674b19d31725e0dd260e48ef", "score": "0.45562854", "text": "func TestHashNewHash(t *testing.T) {\n\tdata := [][]byte{\n\t\t{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}, // 32 bytes\n\t\t{16, 223, 34, 4, 35, 63, 73, 48, 69, 10, 11, 182, 183, 144, 150, 160, 17, 183, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}, // 32 bytes\n\t}\n\n\tfor _, item := range data {\n\t\thashObj, err := Hash{}.NewHash(item)\n\n\t\tassert.Equal(t, nil, err)\n\t\tassert.Equal(t, item, hashObj[:])\n\t}\n}", "title": "" }, { "docid": "de27f7de083ddbc1ef3665032146129d", "score": "0.45534775", "text": "func stubEmptyMachine() *machinev1.Machine {\n\tmachinePc := stubProviderSpec()\n\n\tproviderSpec, _ := ovirtconfigv1.RawExtensionFromProviderSpec(machinePc)\n\n\tmachine := &machinev1.Machine{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: machineName,\n\t\t\tNamespace: utils.NAMESPACE,\n\t\t\tLabels: map[string]string{\n\t\t\t\tmachinev1.MachineClusterIDLabel: stubClusterID,\n\t\t\t\t\"machine.openshift.io/cluster-api-machine-role\": \"worker\",\n\t\t\t},\n\t\t\tAnnotations: map[string]string{\n\t\t\t\t// skip node draining since it's not mocked\n\t\t\t\tmachinecontroller.ExcludeNodeDrainingAnnotation: \"\",\n\t\t\t},\n\t\t},\n\t\tSpec: machinev1.MachineSpec{\n\t\t\tProviderID: nil,\n\t\t\tProviderSpec: machinev1.ProviderSpec{\n\t\t\t\tValue: providerSpec,\n\t\t\t},\n\t\t},\n\t}\n\treturn machine\n}", "title": "" }, { "docid": "f60b81155ed7813e59b7bc5fb049c182", "score": "0.4549129", "text": "func (s SegTypeHopReply) NewEntries(n int32) (SegTypeHopReplyEntry_List, error) {\n\tl, err := NewSegTypeHopReplyEntry_List(s.Struct.Segment(), n)\n\tif err != nil {\n\t\treturn SegTypeHopReplyEntry_List{}, err\n\t}\n\terr = s.Struct.SetPtr(0, l.List.ToPtr())\n\treturn l, err\n}", "title": "" }, { "docid": "ba63b9cd44c43bb3f447fe60797458e4", "score": "0.45356005", "text": "func newThreadsList(threads []threadsapi.Thread) *threadsList {\n\tlist := tui.NewList()\n\n\tfor _, v := range threads {\n\t\tcomment := []rune(utils.FormatHTML(v.Comment, false))\n\n\t\tcommentWidth := len(comment)\n\t\tif commentWidth > maxCommentWidth {\n\t\t\tcommentWidth = maxCommentWidth\n\t\t}\n\n\t\tlist.AddItems(fmt.Sprintf(\"%s %s\", v.Id, string(comment[:commentWidth])))\n\t}\n\n\treturn &threadsList{\n\t\tthreads: threads,\n\t\tList: list,\n\t}\n}", "title": "" }, { "docid": "3c261c8b707d11733e3b823803cdcfc4", "score": "0.4529265", "text": "func Machines(clusterID string, config *types.InstallConfig, pool *types.MachinePool, osImage, role, userDataSecret string) ([]machineapi.Machine, error) {\n\tif configPlatform := config.Platform.Name(); configPlatform != ovirt.Name {\n\t\treturn nil, fmt.Errorf(\"non-ovirt configuration: %q\", configPlatform)\n\t}\n\tif poolPlatform := pool.Platform.Name(); poolPlatform != ovirt.Name {\n\t\treturn nil, fmt.Errorf(\"non-ovirt machine-pool: %q\", poolPlatform)\n\t}\n\tplatform := config.Platform.Ovirt\n\n\ttotal := int64(1)\n\tif pool.Replicas != nil {\n\t\ttotal = *pool.Replicas\n\t}\n\tprovider := provider(platform, pool, userDataSecret, clusterID, osImage)\n\tvar machines []machineapi.Machine\n\tfor idx := int64(0); idx < total; idx++ {\n\t\tmachine := machineapi.Machine{\n\t\t\tTypeMeta: metav1.TypeMeta{\n\t\t\t\tAPIVersion: \"machine.openshift.io/v1beta1\",\n\t\t\t\tKind: \"Machine\",\n\t\t\t},\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tNamespace: \"openshift-machine-api\",\n\t\t\t\tName: fmt.Sprintf(\"%s-%s-%d\", clusterID, pool.Name, idx),\n\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\"machine.openshift.io/cluster-api-cluster\": clusterID,\n\t\t\t\t\t\"machine.openshift.io/cluster-api-machine-role\": role,\n\t\t\t\t\t\"machine.openshift.io/cluster-api-machine-type\": role,\n\t\t\t\t},\n\t\t\t},\n\t\t\tSpec: machineapi.MachineSpec{\n\t\t\t\tProviderSpec: machineapi.ProviderSpec{\n\t\t\t\t\tValue: &runtime.RawExtension{Object: provider},\n\t\t\t\t},\n\t\t\t\t// we don't need to set Versions, because we control those via cluster operators.\n\t\t\t},\n\t\t}\n\t\tmachines = append(machines, machine)\n\t}\n\n\treturn machines, nil\n}", "title": "" }, { "docid": "9a05e7305cb616c85a4a665b164cfcd6", "score": "0.45255947", "text": "func NewMachineSnapshot() *MachineSnapshot {\n\treturn &MachineSnapshot{\n\t\tObjectMeta: ObjectMeta{Kind: RESOURCE_MACHINE_SNAPSHOT},\n\t}\n}", "title": "" }, { "docid": "7afe80c4e13780c0d0bece0d70674016", "score": "0.4522853", "text": "func NewMachineHandler(w http.ResponseWriter, r *http.Request) {\n\tprofiles, err := GetProfiles()\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t}\n\tdata := struct {\n\t\tProfiles []Profile\n\t}{\n\t\tProfiles: profiles,\n\t}\n\tp := &Page{\n\t\tData: data,\n\t\tTitle: \"Create a Machine\",\n\t}\n\trenderTemplate(w, \"templates/machines/create.html\", p)\n}", "title": "" }, { "docid": "356d0cc3bc9457c542707013c9addc0c", "score": "0.45208865", "text": "func newHashTable() *hashTable {\n\tht := &hashTable{}\n\tfor i := 0; i < size; i++ {\n\t\tht.bucket[i] = &linkedList{}\n\t}\n\treturn ht\n}", "title": "" }, { "docid": "ba58db84139d5afba580ed8ecbf07353", "score": "0.45155314", "text": "func (s PathReply) NewEntries(n int32) (PathReplyEntry_List, error) {\n\tl, err := NewPathReplyEntry_List(s.Struct.Segment(), n)\n\tif err != nil {\n\t\treturn PathReplyEntry_List{}, err\n\t}\n\terr = s.Struct.SetPtr(0, l.List.ToPtr())\n\treturn l, err\n}", "title": "" }, { "docid": "65ba031958234b7c2637b03e9bc029dc", "score": "0.4507977", "text": "func New(maxBytes int64,onEvicted func(string,Value))*Cache{\n\treturn &Cache{\n\t\tmaxBytes:maxBytes,\n\t\tll: list.New(),\n\t\tcache : make(map[string]*list.Element),\n\t\tOnEvicted: onEvicted,\n\t}\n}", "title": "" }, { "docid": "f0e4100f4f9f9c8a92a74b9f816585d4", "score": "0.45069948", "text": "func NewMachine(ctx context.Context, cluster *clusterv1.Cluster, machine string, filterLabels map[string]string) (*Machine, error) {\n\tif cluster == nil {\n\t\treturn nil, errors.New(\"cluster is required when creating a docker.Machine\")\n\t}\n\tif cluster.Name == \"\" {\n\t\treturn nil, errors.New(\"cluster name is required when creating a docker.Machine\")\n\t}\n\tif machine == \"\" {\n\t\treturn nil, errors.New(\"machine is required when creating a docker.Machine\")\n\t}\n\n\tfilters := container.FilterBuilder{}\n\tfilters.AddKeyNameValue(filterLabel, clusterLabelKey, cluster.Name)\n\tfilters.AddKeyValue(filterName, fmt.Sprintf(\"^%s$\", machineContainerName(cluster.Name, machine)))\n\tfor key, val := range filterLabels {\n\t\tfilters.AddKeyNameValue(filterLabel, key, val)\n\t}\n\n\tnewContainer, err := getContainer(ctx, filters)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tipFamily, err := cluster.GetIPFamily()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"create docker machine: %s\", err)\n\t}\n\n\treturn &Machine{\n\t\tcluster: cluster.Name,\n\t\tmachine: machine,\n\t\tipFamily: ipFamily,\n\t\tcontainer: newContainer,\n\t\tnodeCreator: &Manager{},\n\t}, nil\n}", "title": "" }, { "docid": "c77659ceeae84f848a98a8c9dcffaf79", "score": "0.4500148", "text": "func FromMultihash(ctx context.Context, ipfs core_iface.CoreAPI, hash cid.Cid, provider identityprovider.Interface) (iface.IPFSLogEntry, error) {\n\tio, err := cbor.IO(&Entry{}, &LamportClock{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn FromMultihashWithIO(ctx, ipfs, hash, provider, io)\n}", "title": "" }, { "docid": "9787e4ea5a0383b5ab6b27882ad1344a", "score": "0.4495001", "text": "func newAccessList() accessList {\n\treturn make(map[common.Address]accessListSlots)\n}", "title": "" }, { "docid": "361a7ab554de5fa3950aa580d983b1cf", "score": "0.44919184", "text": "func (c *certManifest) makeDigest(){\n c.Once.Do(func() {\n bytesBuf, _ := yaml.Marshal(*c)\n hasher := sha256.New()\n hasher.Write(bytesBuf)\n desc := fmt.Sprintf(\"%s:%s\",\n base64.URLEncoding.EncodeToString(hasher.Sum(nil)),\n c.Description)\n c.Description = desc\n })\n}", "title": "" }, { "docid": "6cbe920ce3f599cbe3e2aec255a6d238", "score": "0.44859302", "text": "func (x *fastReflection_ContentHashes) New() protoreflect.Message {\n\treturn new(fastReflection_ContentHashes)\n}", "title": "" }, { "docid": "509c00b53b940f1758ee79fddb8ce780", "score": "0.44837826", "text": "func newList() *list {\n\n\treturn &list{\n\t\tlength: 0,\n\t\thead: nil,\n\t\ttail: nil,\n\t}\n}", "title": "" }, { "docid": "adfb89cb7ddea9b2c7c6a0528997c8bb", "score": "0.4481964", "text": "func NewMockMachines(ctrl *gomock.Controller) *MockMachines {\n\tmock := &MockMachines{ctrl: ctrl}\n\tmock.recorder = &MockMachinesMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "8bd302bc42ee9a0a56942ffdf19c73af", "score": "0.44764113", "text": "func (w *workerDelegate) MachineClassList() client.ObjectList {\n\treturn &machinev1alpha1.MachineClassList{}\n}", "title": "" } ]
35cbda04115dd2ee484dca6d8526eaec
bindInbox binds a generic wrapper to an already deployed contract.
[ { "docid": "7a544a8d53bb9788ccc6ecd8b86c35d5", "score": "0.8215185", "text": "func bindInbox(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(InboxABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" } ]
[ { "docid": "a98c68780672f485e4256993764c78a4", "score": "0.7513525", "text": "func bindIInbox(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(IInboxABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "880bc9154b0b33f94511f450bc4f2256", "score": "0.6955658", "text": "func bindGlobalInbox(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(GlobalInboxABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "ebf6996a97893461b70fef2be965605e", "score": "0.6699865", "text": "func DeployInbox(auth *bind.TransactOpts, backend bind.ContractBackend, _bridge common.Address) (common.Address, *types.Transaction, *Inbox, error) {\n\tparsed, err := abi.JSON(strings.NewReader(InboxABI))\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\n\taddress, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(InboxBin), backend, _bridge)\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\treturn address, tx, &Inbox{InboxCaller: InboxCaller{contract: contract}, InboxTransactor: InboxTransactor{contract: contract}, InboxFilterer: InboxFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "22ad98cdd804e6405a2d4c9d47ab683f", "score": "0.6678842", "text": "func DeployInbox(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Inbox, error) {\n\tparsed, err := abi.JSON(strings.NewReader(InboxABI))\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\n\taddress, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(InboxBin), backend)\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\treturn address, tx, &Inbox{InboxCaller: InboxCaller{contract: contract}, InboxTransactor: InboxTransactor{contract: contract}, InboxFilterer: InboxFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "309c0d1fa6d21b036d436f6492c47331", "score": "0.6179147", "text": "func bindOutbox(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(OutboxABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "6d21449f29ccbc0ec24c54c3cd69dc59", "score": "0.5815416", "text": "func bindWrapper(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(WrapperABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "62eaf4378a7598953d73eceab42a3465", "score": "0.558951", "text": "func bindOutboxEntry(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(OutboxEntryABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "b917566d23c0278dae8e652bbeea403d", "score": "0.552451", "text": "func (_Bridge *BridgeTransactor) SetInbox(opts *bind.TransactOpts, inbox common.Address, enabled bool) (*types.Transaction, error) {\n\treturn _Bridge.contract.Transact(opts, \"setInbox\", inbox, enabled)\n}", "title": "" }, { "docid": "b917566d23c0278dae8e652bbeea403d", "score": "0.552451", "text": "func (_Bridge *BridgeTransactor) SetInbox(opts *bind.TransactOpts, inbox common.Address, enabled bool) (*types.Transaction, error) {\n\treturn _Bridge.contract.Transact(opts, \"setInbox\", inbox, enabled)\n}", "title": "" }, { "docid": "25b018eebdda76dcf6f104af54471244", "score": "0.54884744", "text": "func NewInbox(address common.Address, backend bind.ContractBackend) (*Inbox, error) {\n\tcontract, err := bindInbox(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Inbox{InboxCaller: InboxCaller{contract: contract}, InboxTransactor: InboxTransactor{contract: contract}, InboxFilterer: InboxFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "25b018eebdda76dcf6f104af54471244", "score": "0.54884744", "text": "func NewInbox(address common.Address, backend bind.ContractBackend) (*Inbox, error) {\n\tcontract, err := bindInbox(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Inbox{InboxCaller: InboxCaller{contract: contract}, InboxTransactor: InboxTransactor{contract: contract}, InboxFilterer: InboxFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "81f0290cc889351b244bf7965d9cb9a1", "score": "0.54483706", "text": "func DeployGlobalInbox(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *GlobalInbox, error) {\n\tparsed, err := abi.JSON(strings.NewReader(GlobalInboxABI))\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\n\taddress, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(GlobalInboxBin), backend)\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\treturn address, tx, &GlobalInbox{GlobalInboxCaller: GlobalInboxCaller{contract: contract}, GlobalInboxTransactor: GlobalInboxTransactor{contract: contract}, GlobalInboxFilterer: GlobalInboxFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "70c434850377e5ab2e5655bbfad73edb", "score": "0.54120725", "text": "func (obj Resource) Inbox() interface{} { return GetInbox(obj) }", "title": "" }, { "docid": "45cd7fc315809d7a42ab837f75eed408", "score": "0.53940934", "text": "func (_PangolinManager *PangolinManagerTransactor) Bind(opts *bind.TransactOpts, addr [32]byte) (*types.Transaction, error) {\n\treturn _PangolinManager.contract.Transact(opts, \"bind\", addr)\n}", "title": "" }, { "docid": "5787a61907aa97fd313aae29102b0189", "score": "0.5393811", "text": "func (_Rollup *RollupTransactor) SetInbox(opts *bind.TransactOpts, _inbox common.Address, _enabled bool) (*types.Transaction, error) {\n\treturn _Rollup.contract.Transact(opts, \"setInbox\", _inbox, _enabled)\n}", "title": "" }, { "docid": "a9d6618f1d45318b37fb5829c441a1eb", "score": "0.53932565", "text": "func (c *nsqContext) Bind(v interface{}) error {\n\treturn json.Unmarshal(c.msg.Body, v)\n}", "title": "" }, { "docid": "489d3ff38a1dab93fceb30537785a156", "score": "0.5321077", "text": "func bindEthvault(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, ) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(EthvaultABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, nil), nil\n}", "title": "" }, { "docid": "4275219351091d093061a26e2ab881e8", "score": "0.52911127", "text": "func (obj Page) Inbox() interface{} { return GetInbox(obj) }", "title": "" }, { "docid": "8cccd71cd3cbb731abaf2bc2030f1302", "score": "0.52783126", "text": "func bindBinding(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(BindingABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "cab44881969589ef0b4d9de84a626241", "score": "0.52651083", "text": "func (w *ServerInterfaceWrapper) GetInbox(ctx echo.Context) error {\n\tvar err error\n\n\tctx.Set(BearerAuthScopes, []string{\"\"})\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.GetInbox(ctx)\n\treturn err\n}", "title": "" }, { "docid": "faf31e2365c65f9421e0ca1b286ae8dd", "score": "0.52639014", "text": "func bindIp(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(IpABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "5aff39c2905a5f0cea98cbc90afecd18", "score": "0.5203195", "text": "func bindContracts(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(ContractsABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "c554be675861c0ab61000df16e619087", "score": "0.51994926", "text": "func bindTipscontract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(TipscontractABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "c1f909031af516d5145f8c00eb090b57", "score": "0.519619", "text": "func NewIInbox(address common.Address, backend bind.ContractBackend) (*IInbox, error) {\n\tcontract, err := bindIInbox(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &IInbox{IInboxCaller: IInboxCaller{contract: contract}, IInboxTransactor: IInboxTransactor{contract: contract}, IInboxFilterer: IInboxFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "f09c65aa72ef5f1c6b4002d92a73f06c", "score": "0.5180161", "text": "func (_IInbox *IInboxCaller) Bridge(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _IInbox.contract.Call(opts, &out, \"bridge\")\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": "9ba11ec55ffa8a5aaabacc978146846a", "score": "0.5167382", "text": "func (_PangolinManager *PangolinManagerTransactorSession) Bind(addr [32]byte) (*types.Transaction, error) {\n\treturn _PangolinManager.Contract.Bind(&_PangolinManager.TransactOpts, addr)\n}", "title": "" }, { "docid": "b25fede89f5ac3d8de439e17778d5713", "score": "0.51637405", "text": "func bindNftholder(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(NftholderABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "9f5c65669a579f3da5c28fa4ed45cf39", "score": "0.5154935", "text": "func Bind(c echo.Context, i interface{}) error {\n\n\tif err := c.Bind(i); err != nil {\n\t\treturn errors.Wrap(err, \"error while binding body\")\n\t}\n\tif err := c.Validate(i); err != nil {\n\t\treturn errors.Wrap(err, \"invalid body for given struct\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "01ddf05fe53be6b4a5baa4f09fa9799d", "score": "0.51305395", "text": "func bindTipcontract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(TipcontractABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "f15f06572607f921eaf23e80bbc78f92", "score": "0.5126785", "text": "func bindPinStorage(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(PinStorageABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "ea701b85f5ac76a2b454fcb0664b746e", "score": "0.51234716", "text": "func bindListener(g *G.Gilmour) {\n\tg.ReplyTo(\"test.handler.one\", fetchReply(g), nil)\n}", "title": "" }, { "docid": "f1279278b1ce39e1d5299edf94f76de7", "score": "0.5121051", "text": "func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(ContractABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "f1279278b1ce39e1d5299edf94f76de7", "score": "0.5121051", "text": "func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(ContractABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "f1279278b1ce39e1d5299edf94f76de7", "score": "0.5121051", "text": "func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(ContractABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "f1279278b1ce39e1d5299edf94f76de7", "score": "0.5121051", "text": "func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(ContractABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "f1279278b1ce39e1d5299edf94f76de7", "score": "0.5121051", "text": "func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(ContractABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "f91fc8d8b8b4d32aa846417871c649b7", "score": "0.51178026", "text": "func PersonInbox(ctx *context.APIContext) {\n\t// swagger:operation POST /activitypub/user-id/{user-id}/inbox activitypub activitypubPersonInbox\n\t// ---\n\t// summary: Send to the inbox\n\t// produces:\n\t// - application/json\n\t// parameters:\n\t// - name: user-id\n\t// in: path\n\t// description: user ID of the user\n\t// type: integer\n\t// required: true\n\t// responses:\n\t// \"204\":\n\t// \"$ref\": \"#/responses/empty\"\n\n\tctx.Status(http.StatusNoContent)\n}", "title": "" }, { "docid": "153e0255c90fdb92154209e684a74ec9", "score": "0.51043755", "text": "func (_PangolinManager *PangolinManagerSession) Bind(addr [32]byte) (*types.Transaction, error) {\n\treturn _PangolinManager.Contract.Bind(&_PangolinManager.TransactOpts, addr)\n}", "title": "" }, { "docid": "0e507940156d6c9fc681a4a3692c15c8", "score": "0.5075841", "text": "func (_Inbox *InboxRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Inbox.Contract.InboxTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "0e507940156d6c9fc681a4a3692c15c8", "score": "0.5075841", "text": "func (_Inbox *InboxRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Inbox.Contract.InboxTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "c6fe98842b701f05a70f732b70cd01bf", "score": "0.50682074", "text": "func (serviceBroker *ServiceBroker) Bind(ctx context.Context, instanceID, bindingID string, details brokerapi.BindDetails, asyncAllowed bool) (brokerapi.Binding, error) {\n\tvar binding brokerapi.Binding\n\tlog.Println(\"Bind a new Service\")\n\n\terr := cf.Bind(serviceBroker.Host, details.BindResource.AppGuid, details.BindResource.SpaceGuid, serviceBroker.Config.CloudFoundry.Username, serviceBroker.Config.CloudFoundry.Password, serviceBroker.Config.DNS.Domain)\n\tif err != nil {\n\t\t//return binding, err\n\t\tlog.Printf(\"Error: %s\", err)\n\t\treturn binding, nil\n\t}\n\n\treturn binding, nil\n}", "title": "" }, { "docid": "e9eb2608cc3b170828396d920f6e6b8e", "score": "0.5052165", "text": "func (mq *RabbitMQ) Bind(exchange string) {\n\terr := mq.channel.QueueBind(\n\t\tmq.Name,\n\t\t\"\",\n\t\texchange,\n\t\tfalse,\n\t\tnil,\n\t)\n\tFailOnError(err, \"bind channel fail\")\n\tmq.exchange = exchange\n}", "title": "" }, { "docid": "460c15bff7aa7dc18f205b159aa56120", "score": "0.5048186", "text": "func (_IInbox *IInboxRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _IInbox.Contract.IInboxTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "946fb7ec0c562e7dc9fca0856a2997e8", "score": "0.50429183", "text": "func (_SystemConfig *SystemConfigCaller) BatchInbox(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _SystemConfig.contract.Call(opts, &out, \"batchInbox\")\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": "66dd700dc5a498c214659083572a5f29", "score": "0.5038921", "text": "func (_Inbox *InboxCaller) Bridge(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Inbox.contract.Call(opts, &out, \"bridge\")\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": "8eacc03a098fb25eead8e744b8ce0d2f", "score": "0.501532", "text": "func bindIdentityContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(IdentityContractABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "3f59aef96b4784fe287b829ab043ce1c", "score": "0.50078374", "text": "func bindExchange(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(ExchangeABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "3f59aef96b4784fe287b829ab043ce1c", "score": "0.50078374", "text": "func bindExchange(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(ExchangeABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "e23940d9c5cd9d68472377f046b2b307", "score": "0.50073314", "text": "func (b *Binder) Bind(i interface{}, c echo.Context) error {\n\t// validate with default binder\n\tdb := new(echo.DefaultBinder)\n\tif err := db.Bind(i, c); err != echo.ErrUnsupportedMediaType {\n\t\treturn err\n\t}\n\n\treq := c.Request()\n\n\t// check content type\n\tif !strings.HasPrefix(req.Header.Get(echo.HeaderContentType), mime) {\n\t\treturn echo.ErrUnsupportedMediaType\n\t}\n\n\t// decode MessagePack body\n\tif err := msgpack.NewDecoder(req.Body).Decode(i); err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, err.Error()).SetInternal(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dd3bd9f3c877f84b0f8a47f4c8bd4dc4", "score": "0.50064456", "text": "func bindEthoFSHostingContracts(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(EthoFSHostingContractsABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "1468e85bc54f77738805b4438454b7cc", "score": "0.49952224", "text": "func (q *Queue) bind() error {\n\treturn q.exchange.channel.QueueBind(\n\t\tq.name, // name\n\t\tq.routingKey, // key\n\t\tq.exchange.Name, // exchange\n\t\tfalse, // noWait\n\t\tnil, // args\n\t)\n}", "title": "" }, { "docid": "5bb7df2660edb0c56dc69f549e163fe3", "score": "0.49869782", "text": "func bindIWrappedCoin(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(IWrappedCoinABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "7e4aaee4c72bf945e36815f9bcddc403", "score": "0.49748603", "text": "func bindNotary(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(NotaryABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "065ace650a314ac92eaf495feafc7044", "score": "0.49610963", "text": "func (o *GetContractsListParams) bindAccountDelegate(rawData []string, hasKey bool, formats strfmt.Registry) error {\n\n\t// CollectionFormat: multi\n\taccountDelegateIC := rawData\n\n\tif len(accountDelegateIC) == 0 {\n\t\treturn nil\n\t}\n\n\tvar accountDelegateIR []string\n\tfor _, accountDelegateIV := range accountDelegateIC {\n\t\taccountDelegateI := accountDelegateIV\n\n\t\taccountDelegateIR = append(accountDelegateIR, accountDelegateI)\n\t}\n\n\to.AccountDelegate = accountDelegateIR\n\n\treturn nil\n}", "title": "" }, { "docid": "b5278782fd7dbfe8648fdc76b624cdbb", "score": "0.49570963", "text": "func (t *InMemoryTransport) Bind(bindingType usrv.BindingType, endpoint string) (*usrv.Binding, error) {\n\tt.Lock()\n\tdefer t.Unlock()\n\n\tif (t.failMask & FailBind) == FailBind {\n\t\treturn nil, errors.New(\"Bind failed\")\n\t}\n\n\tvar binding *usrv.Binding\n\n\t// Use a buffered channel so tests do not block\n\tmsgChan := make(chan usrv.TransportMessage, 1)\n\n\tif bindingType == usrv.ServerBinding {\n\t\tbinding = &usrv.Binding{\n\t\t\tType: bindingType,\n\t\t\tName: endpoint,\n\t\t\tMessages: msgChan,\n\t\t}\n\t} else {\n\t\t// Generate a random name for the client binding\n\t\tbinding = &usrv.Binding{\n\t\t\tType: bindingType,\n\t\t\tName: uuid.New(),\n\t\t\tMessages: msgChan,\n\t\t}\n\t}\n\n\tt.bindings[binding.Name] = binding\n\tcnt := 0\n\tfor _ = range t.bindings {\n\t\tcnt++\n\t}\n\treturn binding, nil\n}", "title": "" }, { "docid": "c1cad136cd235ae51e627d8285d344c6", "score": "0.49543336", "text": "func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := ContractMetaData.GetAbi()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "5db7af7b823ca65e29c3bf2f3e4fec32", "score": "0.495213", "text": "func TestDeployInbox(t *testing.T) {\n\n\t//Setup simulated block chain\n\tkey, _ := crypto.GenerateKey()\n\tauth := bind.NewKeyedTransactor(key)\n\talloc := make(core.GenesisAlloc)\n\talloc[auth.From] = core.GenesisAccount{Balance: big.NewInt(1000000000)}\n\tblockchain := backends.NewSimulatedBackend(alloc, 0)\n\n\t//Deploy contract\n\taddress, _, _, err := DeployInbox(\n\t\tauth,\n\t\tblockchain,\n\t\t\"Hello World\",\n\t)\n\t// commit all pending transactions\n\tblockchain.Commit()\n\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to deploy the Inbox contract: %v\", err)\n\t}\n\n\tif len(address.Bytes()) == 0 {\n\t\tt.Error(\"Expected a valid deployment address. Received empty address byte array instead\")\n\t}\n\n}", "title": "" }, { "docid": "f577ac463a6b3bd6ffea06258a150bf1", "score": "0.4949629", "text": "func (obj PageSortCriterion) Inbox() interface{} { return GetInbox(obj) }", "title": "" }, { "docid": "88c068eca010628f1c9bde63c9b32de6", "score": "0.49450335", "text": "func inbox(w http.ResponseWriter, r *http.Request) {\n\tvar connections data.Connections\n\tstop := make(chan struct{})\n\tdefer close(stop)\n\tcurrentConnections, err := comm.Sent(stop)\n\tif err != nil {\n\t\tpackageLogger.WithFields(log.Fields{\n\t\t\t\"executor\": \"#inbox\",\n\t\t\t\"error\": err,\n\t\t}).Error(\"failed to generate inbox\")\n\t\treturn\n\t}\n\tfor connection := range currentConnections {\n\t\tconnections.Connections = append(connections.Connections, connection)\n\t}\n\tpackageLogger.WithFields(log.Fields{\n\t\t\"executor\": \"#inbox\",\n\t\t\"mail\": connections.Connections,\n\t}).Info(fmt.Sprintf(\"inbox has %v items\", len(connections.Connections)))\n\tresponse := &Response{\n\t\tMessage: \"Current connections\",\n\t\tStatusCode: http.StatusOK}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tresponseBytes, err := json.Marshal(connections)\n\tresponse.Json = string(responseBytes)\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(response)\n}", "title": "" }, { "docid": "fabb43040ee95b0639f011e9cae8a4fb", "score": "0.4940536", "text": "func (_Bridge *BridgeSession) SetInbox(inbox common.Address, enabled bool) (*types.Transaction, error) {\n\treturn _Bridge.Contract.SetInbox(&_Bridge.TransactOpts, inbox, enabled)\n}", "title": "" }, { "docid": "fabb43040ee95b0639f011e9cae8a4fb", "score": "0.4940536", "text": "func (_Bridge *BridgeSession) SetInbox(inbox common.Address, enabled bool) (*types.Transaction, error) {\n\treturn _Bridge.Contract.SetInbox(&_Bridge.TransactOpts, inbox, enabled)\n}", "title": "" }, { "docid": "b6d5deae5082dc9860555f61f2f6effd", "score": "0.49398133", "text": "func (_Inbox *InboxRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Inbox.Contract.InboxTransactor.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "b6d5deae5082dc9860555f61f2f6effd", "score": "0.49398133", "text": "func (_Inbox *InboxRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Inbox.Contract.InboxTransactor.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "97c1188112054723ff6524c94f7f6710", "score": "0.49345157", "text": "func NewInboxTransactor(address common.Address, transactor bind.ContractTransactor) (*InboxTransactor, error) {\n\tcontract, err := bindInbox(address, nil, transactor, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &InboxTransactor{contract: contract}, nil\n}", "title": "" }, { "docid": "97c1188112054723ff6524c94f7f6710", "score": "0.49345157", "text": "func NewInboxTransactor(address common.Address, transactor bind.ContractTransactor) (*InboxTransactor, error) {\n\tcontract, err := bindInbox(address, nil, transactor, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &InboxTransactor{contract: contract}, nil\n}", "title": "" }, { "docid": "eec8aac9b18c97c46df548883e04a96e", "score": "0.49344316", "text": "func bindLivepeerETHTicketBroker(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(LivepeerETHTicketBrokerABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "b8f02d4ee515cfbbbcd0afe2495e608d", "score": "0.49238524", "text": "func (_Bridge *BridgeTransactorSession) SetInbox(inbox common.Address, enabled bool) (*types.Transaction, error) {\n\treturn _Bridge.Contract.SetInbox(&_Bridge.TransactOpts, inbox, enabled)\n}", "title": "" }, { "docid": "b8f02d4ee515cfbbbcd0afe2495e608d", "score": "0.49238524", "text": "func (_Bridge *BridgeTransactorSession) SetInbox(inbox common.Address, enabled bool) (*types.Transaction, error) {\n\treturn _Bridge.Contract.SetInbox(&_Bridge.TransactOpts, inbox, enabled)\n}", "title": "" }, { "docid": "4cf5b40420b2af8543a9cfe4a5612144", "score": "0.48874444", "text": "func (_IInbox *IInboxRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _IInbox.Contract.IInboxTransactor.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "c377a93a7928a6304d47545d5bf171df", "score": "0.48860985", "text": "func (c *APIGatewayProxyContext) Bind(v interface{}) error {\n\treturn bind([]byte(c.Request.Body), v)\n}", "title": "" }, { "docid": "639726bfba978761a06a3c5d30f061fa", "score": "0.48860115", "text": "func (q *RabbitQueue) Bind(queue, exchange, routingKey string) error {\n\tif err := q.channel.QueueBind(queue, routingKey, exchange, false, nil); err != nil {\n\t\treturn errors.Wrapf(\n\t\t\terr,\n\t\t\t\"failed to bind queue %s to exchange %s with routing key %s\",\n\t\t\tqueue,\n\t\t\troutingKey,\n\t\t\texchange,\n\t\t)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "de9d6597176bdde3bd8f5c28b266929c", "score": "0.48678428", "text": "func bindIFeeWindow(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(IFeeWindowABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "0684eb33555b2926eabaddfbdb32b632", "score": "0.48640382", "text": "func bindILibSignatures(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(ILibSignaturesABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "6ef7839b3a241b573ffe612de1643e8f", "score": "0.48561904", "text": "func (o *GetContractsListParams) bindNetwork(rawData []string, hasKey bool, formats strfmt.Registry) error {\n\tvar raw string\n\tif len(rawData) > 0 {\n\t\traw = rawData[len(rawData)-1]\n\t}\n\n\t// Required: true\n\t// Parameter is provided by construction from the route\n\n\to.Network = raw\n\n\treturn nil\n}", "title": "" }, { "docid": "890c1ce46adf605e9e5d507bc4710011", "score": "0.48395255", "text": "func (gcpBroker *GCPServiceBroker) Bind(instanceID string, bindingID string, details models.BindDetails) (models.Binding, error) {\n\n\tserviceId := details.ServiceID\n\n\t// check for existing binding\n\n\tvar count int\n\tvar err error\n\n\tif err = db_service.DbConnection.Model(&models.ServiceBindingCredentials{}).Where(\"service_instance_id = ? and binding_id = ?\", instanceID, bindingID).Count(&count).Error; err != nil {\n\t\treturn models.Binding{}, fmt.Errorf(\"Error checking for existing binding: %s\", err)\n\t}\n\tif count > 0 {\n\t\treturn models.Binding{}, models.ErrBindingAlreadyExists\n\t}\n\n\t// create binding\n\tnewCreds, err := gcpBroker.ServiceBrokerMap[serviceId].Bind(instanceID, bindingID, details)\n\tif err != nil {\n\t\treturn models.Binding{}, err\n\t}\n\n\t// save binding to database\n\tnewCreds.ServiceInstanceId = instanceID\n\tnewCreds.BindingId = bindingID\n\tnewCreds.ServiceId = details.ServiceID\n\n\tif err := db_service.DbConnection.Create(&newCreds).Error; err != nil {\n\t\treturn models.Binding{}, fmt.Errorf(\"Error saving credentials to database: %s. WARNING: these credentials cannot be unbound through cf. Please contact your operator for cleanup\",\n\t\t\terr)\n\t}\n\n\t// get existing service instance details\n\tvar instanceRecord models.ServiceInstanceDetails\n\tif err = db_service.DbConnection.Where(\"id = ?\", instanceID).First(&instanceRecord).Error; err != nil {\n\t\treturn models.Binding{}, fmt.Errorf(\"Error retrieving service instance details: %s\", err)\n\t}\n\n\tupdatedCreds, err := gcpBroker.ServiceBrokerMap[serviceId].BuildInstanceCredentials(newCreds, instanceRecord)\n\tif err != nil {\n\t\treturn models.Binding{}, err\n\t}\n\n\treturn models.Binding{\n\t\tCredentials: updatedCreds,\n\t\tSyslogDrainURL: \"\",\n\t\tRouteServiceURL: \"\",\n\t}, nil\n}", "title": "" }, { "docid": "e15d52346b81becee0f9fea970ffd3cb", "score": "0.48360413", "text": "func bind(a command, self cell.I) *binding {\n\treturn &binding{a, self}\n}", "title": "" }, { "docid": "f76f6194b9930a20a2e4e5ef0b8d77ff", "score": "0.48338464", "text": "func (cl *Client) bind(bindAdv *bindIq) {\n\tres := cl.Jid.Resource\n\tbindReq := &bindIq{}\n\tif res != \"\" {\n\t\tbindReq.Resource = &res\n\t}\n\tmsg := &Iq{Type: \"set\", Id: <-Id, Nested: []interface{}{bindReq}}\n\tf := func(st Stanza) bool {\n\t\tif st.GetType() == \"error\" {\n\t\t\tif Log != nil {\n\t\t\t\tLog.Println(\"Resource binding failed\")\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tvar bindRepl *bindIq\n\t\tfor _, ele := range st.GetNested() {\n\t\t\tif b, ok := ele.(*bindIq); ok {\n\t\t\t\tbindRepl = b\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif bindRepl == nil {\n\t\t\tif Log != nil {\n\t\t\t\tLog.Printf(\"Bad bind reply: %v\", st)\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tjidStr := bindRepl.Jid\n\t\tif jidStr == nil || *jidStr == \"\" {\n\t\t\tif Log != nil {\n\t\t\t\tLog.Println(\"Can't bind empty resource\")\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tjid := new(JID)\n\t\tif err := jid.Set(*jidStr); err != nil {\n\t\t\tif Log != nil {\n\t\t\t\tLog.Println(err.Error())\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcl.Jid = *jid\n\t\tif Log != nil && Loglevel >= syslog.LOG_INFO {\n\t\t\tLog.Println(\"Bound resource: \" + cl.Jid.String())\n\t\t}\n\t\tcl.bindDone()\n\t\treturn false\n\t}\n\tcl.HandleStanza(msg.Id, f)\n\tcl.xmlOut <- msg\n}", "title": "" }, { "docid": "171a8c704a565fb8b59551cea46c23b6", "score": "0.48322028", "text": "func NewIInboxTransactor(address common.Address, transactor bind.ContractTransactor) (*IInboxTransactor, error) {\n\tcontract, err := bindIInbox(address, nil, transactor, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &IInboxTransactor{contract: contract}, nil\n}", "title": "" }, { "docid": "1c51b58dc15f1a4a4d77d9ec74ce5def", "score": "0.48139632", "text": "func bindLocking(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(LockingABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "5c4e31232423e02d0b39a6a49aca7f6f", "score": "0.4806893", "text": "func bindISwap(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(ISwapABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "93795f56a48814c497e13e8b3f2fa9bb", "score": "0.480672", "text": "func (ch *Channel) ExchangeBind(dest, src, routingKey string, noWait bool) error {\n\treturn ch.call(\n\t\t&proto.ExchangeBind{\n\t\t\tDestination: dest,\n\t\t\tSource: src,\n\t\t\tRoutingKey: routingKey,\n\t\t\tNoWait: noWait,\n\t\t},\n\t\t&proto.ExchangeBindOk{},\n\t)\n}", "title": "" }, { "docid": "0574fe21bf1f4ff76f28e3274ebd0db7", "score": "0.48045343", "text": "func (b *BrokerOperations) Bind(instance_id, binding_id string, breq *openservicebroker.BindRequest) *openservicebroker.Response {\n\t// Find the service instance that is being bound to\n\tsi, err := b.Client.ServiceInstances(broker.Namespace).Get(instance_id, metav1.GetOptions{})\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\treturn &openservicebroker.Response{http.StatusGone, &openservicebroker.BindResponse{}, nil}\n\t\t}\n\t\treturn &openservicebroker.Response{http.StatusInternalServerError, nil, err}\n\t}\n\n\t// in principle, bind should alter state somewhere\n\n\t// Create some credentials to return. In this case the credentials are\n\t// pulled from the service instance but a real broker might\n\t// return unique credentials for each binding so that multiple users\n\t// of a service instance are not sharing credentials.\n\tcredentials := map[string]interface{}{}\n\tcredentials[\"credential\"] = si.Spec.Credential\n\n\treturn &openservicebroker.Response{\n\t\tCode: http.StatusCreated,\n\t\tBody: &openservicebroker.BindResponse{Credentials: credentials},\n\t\tErr: nil,\n\t}\n}", "title": "" }, { "docid": "d9f45f12a81b77f90c2bf0ea73a97c94", "score": "0.48021668", "text": "func bindDropkitContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(DropkitContractABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "50616990f9ecb3d558e3244ebe40964f", "score": "0.48015657", "text": "func bindTanshell(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(TanshellABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "749756e4d16a72bb086b4366af202a9a", "score": "0.47988817", "text": "func bindHotel_Interface(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(Hotel_InterfaceABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor), nil\n}", "title": "" }, { "docid": "1869b412efb1c5817bca085976d22c9b", "score": "0.4790545", "text": "func NewIInboxCaller(address common.Address, caller bind.ContractCaller) (*IInboxCaller, error) {\n\tcontract, err := bindIInbox(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &IInboxCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "67d3597aeedbc867956e89bf3f66e1a2", "score": "0.47869253", "text": "func bindBerryTransfer(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(BerryTransferABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "5a4d31ca89fe7e471985a3243c0d2fb9", "score": "0.47868028", "text": "func bindLockContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(LockContractABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "45a66bd48be97598a1172598667bb30c", "score": "0.47808427", "text": "func (r *DummyRequest) Bind(out interface{}) error {\n\terr := binding.Default(r.req.Method, r.ContentType()).Bind(r.req, out)\n\tr.setReqBody()\n\treturn err\n}", "title": "" }, { "docid": "18e814355449f972e048e15d4c16bd34", "score": "0.4768979", "text": "func bindIotCloudlab(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(IotCloudlabABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "c20239e60e3e1140a7a1ccb806e87065", "score": "0.47663683", "text": "func bindIContractRegistry(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(IContractRegistryABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "f23753aeedc73d7da2313e0c35677519", "score": "0.476178", "text": "func bindBattleQueue(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(BattleQueueABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "f6f5dc6dc0e3477c1fc208ae651de18b", "score": "0.47606477", "text": "func bindBigBoard(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(BigBoardABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "40c1f8e1d9283d6065a9f37862081124", "score": "0.4756253", "text": "func bindAuction(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(AuctionABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "84b88d73b0557c5defbda8b18901c9f8", "score": "0.47528946", "text": "func bindLendingPoolContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(LendingPoolContractABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "e66bf328cda7481a237bea179df41ab8", "score": "0.4750763", "text": "func NewInboxCaller(address common.Address, caller bind.ContractCaller) (*InboxCaller, error) {\n\tcontract, err := bindInbox(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &InboxCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "e66bf328cda7481a237bea179df41ab8", "score": "0.4750763", "text": "func NewInboxCaller(address common.Address, caller bind.ContractCaller) (*InboxCaller, error) {\n\tcontract, err := bindInbox(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &InboxCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "73cea0ee8165d51fa3b477e3149f7b04", "score": "0.47507352", "text": "func bind(ifaceName string, fipStr string, lipStr string) error {\n\tsetInterfaceIP(ifaceName, fipStr)\n\tfipStr = clearIPMask(fipStr)\n\tlipStr = clearIPMask(lipStr)\n\tdnat := []string{\n\t\tpreRoutingChainName, \"-t\", \"nat\",\n\t\t\"-d\", fipStr,\n\t\t\"-j\", \"DNAT\",\n\t\t \"--to-destination\", lipStr,\n\t}\n\tif _, err := iptables.Raw(\n\t\tappend([]string{\"-C\"}, dnat...)...,\n\t); err != nil {\n\t\tincl := append([]string{\"-I\"}, dnat...)\n\t\tif _, err = iptables.Raw(incl...); err != nil {\n\t\t\tlog.Fatalf(\"Can not add rule: %s\",strings.Join(incl, \" \") )\n\t\t}\n\t}\n\tlog.Debugf(\"Add a DNAT rule to iptables %s chain: %s to %s \", preRoutingChainName, fipStr, lipStr)\n\n\tsnat := []string{\n\t\tpostRoutingChainName, \"-t\", \"nat\",\n\t\t\"-s\", lipStr,\n\t\t\"-j\", \"SNAT\",\n\t\t\"--to-source\", fipStr,\n\t}\n\tif _, err := iptables.Raw(\n\t\tappend([]string{\"-C\"}, snat...)...,\n\t); err != nil {\n\t\tincl := append([]string{\"-I\"}, snat...)\n\t\tif _, err = iptables.Raw(incl...); err != nil {\n\t\t\tlog.Fatalf(\"Can not add rule %s\",strings.Join(incl, \" \") )\n\t\t}\n\t}\n\tlog.Debugf(\"Add a SNAT rule to iptables %s chain: %s to %s \", postRoutingChainName, lipStr, fipStr)\n\treturn nil\n}", "title": "" }, { "docid": "fb0829928f426d89b93300e280e5d8e5", "score": "0.47507304", "text": "func (_GlobalInbox *GlobalInboxRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _GlobalInbox.Contract.GlobalInboxTransactor.contract.Transact(opts, method, params...)\n}", "title": "" } ]
69648d384844ad8dfd418078aa70811b
runActionCommand executes the action command passing the provided inputs as environment variables. It analyzes the standard output of the command looking for 'key=value' where the key is present in the provided outputs map and sets the corresponding map value.
[ { "docid": "df83dbc6db462bfee62ffdf171fac32a", "score": "0.61439955", "text": "func runActionCommand(\n\tctx context.Context,\n\tactionType string,\n\th *policy.ActionCommand,\n\tinputs []string,\n\tcaptures map[string]string,\n\tworkDir string,\n) error {\n\tcmd, cancel, err := prepareCommandForAction(ctx, actionType, h, workDir)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error preparing command\")\n\t}\n\n\tdefer cancel()\n\n\tcmd.Env = append(os.Environ(), inputs...)\n\tcmd.Stderr = os.Stderr\n\n\tif h.Mode == \"async\" {\n\t\treturn errors.Wrap(cmd.Start(), \"error starting action command asynchronously\")\n\t}\n\n\tv, err := cmd.Output()\n\tif err != nil {\n\t\tif h.Mode == \"essential\" {\n\t\t\treturn errors.Wrap(err, \"essential action failed\")\n\t\t}\n\n\t\tuploadLog(ctx).Errorf(\"error running non-essential action command: %v\", err)\n\t}\n\n\treturn parseCaptures(v, captures)\n}", "title": "" } ]
[ { "docid": "5d263ff97617f47ebb73217e2967a8b8", "score": "0.5415366", "text": "func (a *Action) Run(ctx context.Context, input map[string]interface{}) (map[string]interface{}, error) {\n\tcode, mData, err := core.Execute(a.id, input, a.microgateway, a.IOMetadata(), a.logger)\n\toutput := make(map[string]interface{}, 8)\n\toutput[\"code\"] = code\n\toutput[\"data\"] = mData\n\n\treturn output, err\n}", "title": "" }, { "docid": "6498f538cdc3f903d1d2af8d415ce9c4", "score": "0.5231192", "text": "func (f *FakeCommandRunner) SetCommandToOutput(cmdToOutput map[string]string) {\n\tfor k, v := range cmdToOutput {\n\t\tklog.Infof(\"fake command %q -> %q\", k, v)\n\t\tf.cmdMap.Store(k, v)\n\t}\n}", "title": "" }, { "docid": "d018a3528727fa719847ed4bd764cbdc", "score": "0.5152057", "text": "func (c *GetCommand) Execute(args []string) ExecutionStatus {\n\tlog.Tracef(\"Executing command '%s': args: '%v'\\n\", c.Name, args)\n\n\t// Parse arguments\n\tvar key = \"_\"\n\tvar argsMap = make(map[string][]string)\n\tfor _, arg := range args {\n\t\tif string(arg[0]) == \"-\" {\n\t\t\tkey = arg\n\t\t\tcontinue\n\t\t}\n\t\tif argsMap[key] == nil {\n\t\t\targsMap[key] = make([]string, 0)\n\t\t}\n\t\targsMap[key] = append(argsMap[key], arg)\n\t\tkey = \"_\"\n\t}\n\n\t// Service Name\n\tvar name = \"\"\n\tif argsMap[\"-n\"] != nil && argsMap[\"--name\"] != nil {\n\t\tui.Failed(\"Can't use both '--name' and '-n' at the same time\")\n\t\treturn Failure\n\t}\n\tif argsMap[\"-n\"] != nil {\n\t\targsMap[\"--name\"] = argsMap[\"-n\"]\n\t}\n\tif argsMap[\"--name\"] != nil {\n\t\tif len(argsMap[\"--name\"]) != 1 {\n\t\t\tui.Failed(\"Incorrect number of arguments for APP_HOST_NAME option (expected: 1, actual: %d). For help see [cf html5-get --help]\", len(argsMap[\"--name\"]))\n\t\t\treturn Failure\n\t\t}\n\t\tif len(argsMap[\"--all\"]) > 0 || len(argsMap[\"_\"]) == 2 {\n\t\t\tui.Failed(\"Can't use both '--name' and APP_HOST_ID at the same time\")\n\t\t\treturn Failure\n\t\t}\n\t\tname = argsMap[\"--name\"][0]\n\t}\n\n\t// Output\n\tvar output = \"\"\n\tif argsMap[\"-o\"] != nil && argsMap[\"--out\"] != nil {\n\t\tui.Failed(\"Can't use both '--out' and '-o' at the same time\")\n\t\treturn Failure\n\t}\n\tif argsMap[\"-o\"] != nil {\n\t\targsMap[\"--out\"] = argsMap[\"-o\"]\n\t}\n\tif argsMap[\"--out\"] != nil {\n\t\tif len(argsMap[\"--out\"]) != 1 {\n\t\t\tui.Failed(\"Incorrect number of arguments for OUTPUT option (expected: 1, actual: %d). For help see [cf html5-get --help]\", len(argsMap[\"--out\"]))\n\t\t\treturn Failure\n\t\t}\n\t\toutput = argsMap[\"--out\"][0]\n\t}\n\n\t// Get all apps in app-host by name\n\tif len(argsMap[\"--all\"]) == 0 && len(argsMap[\"_\"]) == 0 && name != \"\" {\n\t\treturn c.GetAppHostFilesContents(output, name, true)\n\t}\n\n\t// Get all apps in app-host-id\n\tif len(argsMap[\"--all\"]) == 1 {\n\t\treturn c.GetAppHostFilesContents(output, argsMap[\"--all\"][0], false)\n\t}\n\n\t// Define app-host Name or GUID\n\tvar appHostNameOrGUID = name\n\tif len(argsMap[\"_\"]) == 2 {\n\t\tappHostNameOrGUID = argsMap[\"_\"][1]\n\t}\n\n\t// Get application files or single file\n\tif len(argsMap[\"_\"]) == 1 || len(argsMap[\"_\"]) == 2 {\n\t\tvar parts = strings.Split(argsMap[\"_\"][0], \"/\")\n\t\tif len(parts) == 1 {\n\t\t\t// Get application\n\t\t\tvar appKeyParts = strings.Split(argsMap[\"_\"][0], \"-\")\n\t\t\tif len(appKeyParts) == 1 {\n\t\t\t\tappKeyParts = append(appKeyParts, \"\")\n\t\t\t}\n\t\t\treturn c.GetApplicationFilesContents(output, appKeyParts[0], appKeyParts[1], appHostNameOrGUID, name != \"\")\n\t\t}\n\t\t// Get single file\n\t\treturn c.GetFileContents(output, argsMap[\"_\"][0], appHostNameOrGUID, name != \"\")\n\t}\n\n\tui.Failed(\"Incorrect number of arguments passed. See [cf html5-get --help] for more details\")\n\treturn Failure\n}", "title": "" }, { "docid": "fd3d734c08cf32ad7804a2f5d81fdfbb", "score": "0.49718082", "text": "func (a *testAction) Run(ctx context.Context, inputs map[string]*data.Attribute) (map[string]*data.Attribute, error) {\n\ta.f()\n\treturn nil, nil\n}", "title": "" }, { "docid": "9d0a443e767308c5709f2221408eb260", "score": "0.4951914", "text": "func (c Action) Execute(o *landingzone.Options) error {\n\tconsole.Successf(\"Running custom action: %s %s\\n\", c.Name, o.SourcePath)\n\targs := []string{}\n\n\t// This implements a simple variable subsistution syntax\n\tfor _, argDefined := range c.command.Arguments {\n\t\tif argDefined == \"{{SOURCE_DIR}}\" {\n\t\t\targs = append(args, o.SourcePath)\n\t\t\tcontinue\n\t\t}\n\t\tif argDefined == \"{{CONFIG_DIR}}\" {\n\t\t\targs = append(args, o.ConfigPath)\n\t\t\tcontinue\n\t\t}\n\t\tif argDefined == \"{{LEVEL}}\" {\n\t\t\targs = append(args, o.Level)\n\t\t\tcontinue\n\t\t}\n\t\tif argDefined == \"{{STATE_NAME}}\" {\n\t\t\targs = append(args, o.StateName)\n\t\t\tcontinue\n\t\t}\n\t\tif argDefined == \"{{CAF_ENV}}\" {\n\t\t\targs = append(args, o.CafEnvironment)\n\t\t\tcontinue\n\t\t}\n\t\tif argDefined == \"{{WORKSPACE}}\" {\n\t\t\targs = append(args, o.Workspace)\n\t\t\tcontinue\n\t\t}\n\t\targs = append(args, argDefined)\n\t}\n\n\tcmd := command.NewCommand(c.command.Executable, args)\n\tcmd.Silent = false\n\terr := cmd.Execute()\n\n\tconsole.Error(cmd.StdErr)\n\tconsole.Success(cmd.StdOut)\n\n\t// NOTE: When running across multiple levels/stacks\n\t// We will exit early when we hit first error, this could be improved\n\tcobra.CheckErr(err)\n\n\treturn nil\n}", "title": "" }, { "docid": "94fd485e728ede3984ce1b9a13f7e8b0", "score": "0.49011362", "text": "func ActionExecute(cmd *cobra.Command) Action {\n\treturn ActionCallback(func(c Context) Action {\n\t\targs := []string{\"_carapace\", \"export\", cmd.Name()}\n\t\targs = append(args, c.Args...)\n\t\targs = append(args, c.Value)\n\t\tcmd.SetArgs(args)\n\n\t\tGen(cmd).PreInvoke(func(cmd *cobra.Command, flag *pflag.Flag, action Action) Action {\n\t\t\treturn ActionCallback(func(_c Context) Action {\n\t\t\t\t_c.Env = c.Env\n\t\t\t\t_c.Dir = c.Dir\n\t\t\t\treturn action.Invoke(_c).ToA()\n\t\t\t})\n\t\t})\n\n\t\tvar stdout, stderr bytes.Buffer\n\t\tcmd.SetOut(&stdout)\n\t\tcmd.SetErr(&stderr)\n\n\t\tif err := cmd.Execute(); err != nil {\n\t\t\treturn ActionMessage(err.Error())\n\t\t}\n\t\treturn ActionImport(stdout.Bytes())\n\t})\n}", "title": "" }, { "docid": "fe580c558b0c5c272bb179cba6423a10", "score": "0.48671162", "text": "func actionRun(_ *core.Command, args []string) int {\n\tgps := getGoPath()\n\tif len(gps) == 0 {\n\t\tcore.LogError(\"$GOPATH not found, Please set $GOPATH in your environment variables.\")\n\t\tos.Exit(2)\n\t}\n\n\texit := make(chan bool)\n\tcwd, _ := os.Getwd()\n\tappName := path.Base(cwd)\n\n\tcore.Log.Print(\"\")\n\tif len(args) > 0 {\n\t\tcalled := args[0]\n\n\t\tif called != \"\" {\n\t\t\tappName = called\n\t\t}\n\t}\n\n\tvar paths []string\n\tvar files []string\n\n\treadDirectory(cwd, &paths)\n\tcore.Watch(appName, paths, files)\n\tcore.Build()\n\n\tfor {\n\t\tselect {\n\t\tcase <-exit:\n\t\t\truntime.Goexit()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "597963db73ac7ca05324eee47fd06034", "score": "0.48570064", "text": "func (app *script) Execute(input map[string]computable.Value) (string, error) {\n\tlangRef := app.script.Language()\n\tlang := langRef.Language()\n\tapplication := lang.Application()\n\tinVar := langRef.Input()\n\tcode := app.script.Code()\n\tinStr, err := app.valueBuilder.Create().WithString(code).Now()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tinput[inVar] = inStr\n\tmachine, err := app.machineBuilder.Create().WithInput(input).WithLanguage(lang).Now()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tstackFrame, err := execute(machine, application)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\toutVar := langRef.Output()\n\toutVal, err := stackFrame.Current().Fetch(outVar)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif !outVal.IsString() {\n\t\tstr := fmt.Sprintf(\"the output variable (%s) was expected to be a string\", outVar)\n\t\treturn \"\", errors.New(str)\n\t}\n\n\treturn outVal.StringRepresentation(), nil\n}", "title": "" }, { "docid": "a6590817cc33e2b7189c3913ca7b852b", "score": "0.48308834", "text": "func (me *ModelExecutor) Run(inputs map[string]interface{}) (map[string]interface{}, error) {\n\texecutorInputs := make(map[influunt.Node]interface{}, len(inputs))\n\n\tfor name, node := range me.model.Inputs {\n\t\tinput, ok := inputs[name]\n\t\tif !ok {\n\t\t\treturn nil, errors.Wrapf(ErrMissingInput, \"missing input variable %s\", name)\n\t\t}\n\n\t\texecutorInputs[node] = input\n\t}\n\n\tresults, err := me.executor.Run(executorInputs, me.outputs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toutputs := make(map[string]interface{}, len(me.outputs))\n\tfor i, name := range me.outputNames {\n\t\toutputs[name] = results[i]\n\t}\n\n\treturn outputs, nil\n}", "title": "" }, { "docid": "45e4237619c07cc046d6d5d69fa0b2af", "score": "0.48157364", "text": "func commandMap(cmd *command, args []string) map[string]interface{} {\n\targMap := make(map[string]interface{})\n\tfor i, a := range cmd.arguments {\n\t\tif len(args) <= i {\n\t\t\tbreak\n\t\t}\n\t\tif !a.isLiteral() {\n\t\t\tif !a.isVariable() {\n\t\t\t\targMap[a.identifier] = args[i]\n\t\t\t} else {\n\t\t\t\tif len(cmd.arguments) == len(args) {\n\t\t\t\t\targMap[a.identifier] = args[i]\n\t\t\t\t} else {\n\t\t\t\t\targMap[a.identifier] = args[i:]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn argMap\n}", "title": "" }, { "docid": "a3523791fb91696575d129154f9a72a3", "score": "0.47649068", "text": "func getInputForAction(key string) string {\n\treturn os.Getenv(fmt.Sprintf(\"INPUT_%s\", strings.ToUpper(key)))\n}", "title": "" }, { "docid": "39d4abb80dc3786a62465429b95305c4", "score": "0.47536653", "text": "func SetAction(c *cli.Context) error {\n\t// Generic --key and --value specification.\n\tkey := c.Parameter(0)\n\tvalue := defs.True\n\n\tif equals := strings.Index(key, \"=\"); equals >= 0 {\n\t\tvalue = key[equals+1:]\n\t\tkey = key[:equals]\n\t}\n\n\t// Sanity check -- if it is a privileged setting, is it valid?\n\tif invalidKeyError := validateKey(key); invalidKeyError != nil {\n\t\treturn invalidKeyError\n\t}\n\n\tsettings.Set(key, value)\n\n\tmsg := i18n.M(\"config.written\", map[string]interface{}{\"key\": key})\n\n\tui.Say(\"%s\", msg)\n\n\treturn nil\n}", "title": "" }, { "docid": "dc2afc8c522b332256b2bc2fba2422f6", "score": "0.46909997", "text": "func setGitHubActionsOutput(key, value string) {\n\tvalue = strings.ReplaceAll(value, \"%\", \"%25\")\n\tvalue = strings.ReplaceAll(value, \"\\r\", \"%0D\")\n\tvalue = strings.ReplaceAll(value, \"\\n\", \"%0A\")\n\tfmt.Printf(\"::set-output name=%s::%s\\n\", key, value)\n}", "title": "" }, { "docid": "0f1f05b5a1bf06c01b660bcfcbcfe764", "score": "0.46906543", "text": "func SetAction(c *cli.Context) error {\n\n\t// Generic --key and --value specification\n\tkey := c.Parameter(0)\n\tvalue := \"true\"\n\n\tif equals := strings.Index(key, \"=\"); equals >= 0 {\n\t\tvalue = key[equals+1:]\n\t\tkey = key[:equals]\n\t}\n\tpersistence.Set(key, value)\n\tui.Say(\"Profile key %s written\", key)\n\n\treturn nil\n}", "title": "" }, { "docid": "6814870239e77bf33b4900e2dea90eb5", "score": "0.46876872", "text": "func (c *DecodeCommand) Execute(args []string) error {\n\tif opts.HmacKey == \"\" {\n\t\treturn errors.New(\"empty HMAC\")\n\t}\n\n\tif len(c.Positional.Url) == 0 {\n\t\treturn errors.New(\"no url argument provided\")\n\t}\n\n\thmacKeyBytes := []byte(opts.HmacKey)\n\n\tu, err := url.Parse(c.Positional.Url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcomp := strings.SplitN(u.Path, \"/\", 3)\n\tdecURL, valid := encoding.DecodeURL(hmacKeyBytes, comp[1], comp[2])\n\tif !valid {\n\t\treturn errors.New(\"hmac is invalid\")\n\t}\n\tfmt.Println(decURL)\n\treturn nil\n}", "title": "" }, { "docid": "9488040f9f3acdfe8e25ac80eca51336", "score": "0.468694", "text": "func actionRunner(command string, state *ServerState) {\n\t// check if feature enabled\n\tif command == \"\" {\n\t\treturn\n\t}\n\tparts := strings.Fields(command)\n\tlogInfo(\"Failure action:\", parts)\n\n\t// wait for deadline\n\tfor ticker := time.NewTicker(time.Second * 5); ; <-ticker.C {\n\t\t// check if canary on server\n\t\tstate.canaryLock.RLock()\n\t\tif state.latestCanary == nil {\n\t\t\tstate.canaryLock.RUnlock()\n\t\t\tcontinue\n\t\t}\n\n\t\t// check time\n\t\tnow := time.Now()\n\t\texpiry := state.latestCanary.Expiry.Time()\n\t\tstate.canaryLock.RUnlock()\n\t\tif now.After(expiry) {\n\t\t\tlogInfo(\"Running failure action\")\n\t\t\tout, err := exec.Command(parts[0], parts[1:]...).Output()\n\t\t\tif err != nil {\n\t\t\t\tlogWarning(\"Failed to execute failure action:\", err)\n\t\t\t}\n\t\t\tlogInfo(\"Failure action output:\\n\" + string(out))\n\t\t\tselect {} // wait forever\n\t\t}\n\n\t\t// sleep\n\t\tlogDebug(\"Action Runner going to sleep:\", expiry.Sub(now).Seconds())\n\t\ttime.Sleep(expiry.Sub(now))\n\t\tlogDebug(\"Woke from sleep\")\n\t}\n}", "title": "" }, { "docid": "78b0c1867bbf9c9ca735265ae0594129", "score": "0.46855515", "text": "func (a *Actions) ExecuteAction(actionId string) error {\n\tsetup, err := loadSetup(a.path)\n\tif err != nil {\n\t\tfmt.Println(\"ERROR: \" + err.Error())\n\t}\n\n\t// Find the action\n\tvar action Action\n\tfound := false\n\tfor _, a := range setup.Actions {\n\t\tif a.Id == actionId {\n\t\t\taction = a\n\t\t\tfound = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// Check if no action matched\n\tif !found {\n\t\treturn errors.New(\"No action with the given id was found\")\n\t}\n\n\tvar cmd *exec.Cmd\n\n\tif action.Machine == \"local\" {\n\t\t// If the script is to be executed locally, do so\n\t\tcmd = exec.Command(action.Command)\n\t} else {\n\t\t// If not to be executed locally, find the machine\n\t\tvar machine Machine\n\t\tfound = false\n\t\tfor _, m := range setup.Machines {\n\t\t\tif m.Id == action.Machine {\n\t\t\t\tmachine = m\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\t// Check if no machine matched\n\t\tif !found {\n\t\t\treturn errors.New(\"No machine with the given id was found\")\n\t\t}\n\n\t\t// Do the execution\n\t\tsshCommand := fmt.Sprintf(\n\t\t\t\"ssh -tt -o 'StrictHostKeyChecking no' -o 'BatchMode yes' %s@%s -p %s -i %s '%s'\",\n\t\t\tmachine.User,\n\t\t\tmachine.Address,\n\t\t\tmachine.Port,\n\t\t\ta.path+\"/keys/\"+machine.PrivateKey,\n\t\t\taction.Command,\n\t\t)\n\t\tcmd = exec.Command(\"/bin/bash\", \"-c\", sshCommand)\n\t}\n\n\tcmd.Stdin = os.Stdin\n\tcmd.Stdout = os.Stdout\n\tcmd.Stderr = os.Stderr\n\n\treturn cmd.Run()\n}", "title": "" }, { "docid": "2a2a3fb37aee48318e6a8cfd9cce5b59", "score": "0.46741658", "text": "func (a *Agent) runCommand(config resourced_config.Config) ([]byte, error) {\n\tcmd := libprocess.NewCmd(config.Command)\n\n\tif config.Kind == \"writer\" {\n\t\t// Get readers data.\n\t\treadersData := make(map[string]interface{})\n\n\t\tfor _, readerPath := range config.ReaderPaths {\n\t\t\treaderJsonBytes, err := a.GetRunByPath(a.pathWithReaderPrefix(readerPath))\n\n\t\t\tif err == nil {\n\t\t\t\tvar data interface{}\n\t\t\t\terr := json.Unmarshal(readerJsonBytes, &data)\n\t\t\t\tif err == nil {\n\t\t\t\t\treadersData[readerPath] = data\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treadersDataJsonBytes, err := json.Marshal(readersData)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tcmd.Stdin = bytes.NewReader(readersDataJsonBytes)\n\t}\n\n\treturn cmd.Output()\n}", "title": "" }, { "docid": "1ba2fa38c47cbeb126c6702b868ee248", "score": "0.46540803", "text": "func (p *Plugin) runCommands(pluginID string, pluginInput PSModulePluginInput, orchestrationDirectory string, cancelFlag task.CancelFlag, output iohandler.IOHandler) {\n\tvar err error\n\tlog := p.context.Log()\n\n\t// TODO:MF: This subdirectory is only needed because we could be running multiple sets of properties for the same plugin - otherwise the orchestration directory would already be unique\n\torchestrationDir := fileutil.BuildPath(orchestrationDirectory, pluginInput.ID)\n\tlog.Debugf(\"Running commands %v in workingDirectory %v; orchestrationDir %v \", pluginInput.ParsedCommands, pluginInput.WorkingDirectory, orchestrationDir)\n\n\t// create orchestration dir if needed\n\tif err = fileutil.MakeDirsWithExecuteAccess(orchestrationDir); err != nil {\n\t\tlog.Debug(\"failed to create orchestrationDir directory\", orchestrationDir)\n\t\toutput.MarkAsFailed(err)\n\t\treturn\n\t}\n\n\t// Create script file path\n\tscriptPath := filepath.Join(orchestrationDir, appconfig.RunCommandScriptName)\n\tlog.Debugf(\"Writing commands %v to file %v\", pluginInput, scriptPath)\n\n\t// Create script file\n\tif err = pluginutil.CreateScriptFile(log, scriptPath, pluginInput.ParsedCommands, fileutil.ByteOrderMarkSkip); err != nil {\n\t\toutput.MarkAsFailed(fmt.Errorf(\"failed to create script file. %v\", err))\n\t\treturn\n\t}\n\n\tif pluginInput.Source != \"\" {\n\t\t//change hash type to be default sha256\n\t\tpluginInput.SourceHashType = Sha256SourceHashType\n\t\t// Download file from source if available\n\t\tdownloadOutput, err := pluginutil.DownloadFileFromSource(p.context, pluginInput.Source, pluginInput.SourceHash, pluginInput.SourceHashType)\n\t\tif err != nil || downloadOutput.IsHashMatched == false || downloadOutput.LocalFilePath == \"\" {\n\t\t\toutput.MarkAsFailed(fmt.Errorf(\"failed to download file reliably %v\", pluginInput.Source))\n\t\t\t// Only delete the file if source is not a local path\n\t\t\tif exists, err := fileutil.LocalFileExist(pluginInput.Source); err == nil && !exists {\n\t\t\t\t// delete downloaded file, if it exists\n\t\t\t\tpluginutil.CleanupFile(log, downloadOutput.LocalFilePath)\n\t\t\t}\n\t\t\treturn\n\t\t} else {\n\t\t\t// Uncompress the zip file received\n\t\t\tif err = fileutil.Uncompress(log, downloadOutput.LocalFilePath, PowerShellModulesDirectory); err != nil {\n\t\t\t\toutput.MarkAsFailed(fmt.Errorf(\"Failed to uncompress %v to %v: %v\", downloadOutput.LocalFilePath, PowerShellModulesDirectory, err.Error()))\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Only delete the file if source is not a local path\n\t\t\tif exists, err := fileutil.LocalFileExist(pluginInput.Source); err == nil && !exists {\n\t\t\t\t// delete downloaded file, if it exists\n\t\t\t\tpluginutil.CleanupFile(log, downloadOutput.LocalFilePath)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Set execution time\n\texecutionTimeout := pluginutil.ValidateExecutionTimeout(log, pluginInput.TimeoutSeconds)\n\n\t// Construct Command Name and Arguments\n\tcommandName := pluginutil.GetShellCommand()\n\tcommandArguments := append(pluginutil.GetShellArguments(), scriptPath)\n\n\t// Execute Command\n\texitCode, err := p.CommandExecuter.NewExecute(p.context, pluginInput.WorkingDirectory, output.GetStdoutWriter(), output.GetStderrWriter(), cancelFlag, executionTimeout, commandName, commandArguments, make(map[string]string))\n\n\t// Set output status\n\toutput.SetExitCode(exitCode)\n\toutput.SetStatus(pluginutil.GetStatus(exitCode, cancelFlag))\n\n\tif err != nil {\n\t\tstatus := output.GetStatus()\n\t\tif status != contracts.ResultStatusCancelled &&\n\t\t\tstatus != contracts.ResultStatusTimedOut &&\n\t\t\tstatus != contracts.ResultStatusSuccessAndReboot {\n\t\t\toutput.MarkAsFailed(fmt.Errorf(\"failed to run commands: %v\", err))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "23c1aaa3ae5a48f9e68cffce464fc10e", "score": "0.45963573", "text": "func (c *Hvals) Execute(args ...string) Reply {\n\tif len(args) != 1 {\n\t\treturn ErrReply{Value: ErrWrongArgsNumber}\n\t}\n\n\tvalue, err := c.strg.Get(storage.Key(args[0]))\n\tif err != nil {\n\t\tif err == storage.ErrKeyNotExists {\n\t\t\treturn NilReply{}\n\t\t}\n\t\treturn ErrReply{Value: err}\n\t}\n\tif value.Type() != storage.MapDataType {\n\t\treturn ErrReply{Value: ErrWrongTypeOp}\n\t}\n\tm := value.Data().(map[string]string)\n\tvals := make([]string, 0, len(m))\n\tfor _, v := range m {\n\t\tvals = append(vals, v)\n\t}\n\treturn SliceReply{Value: vals}\n}", "title": "" }, { "docid": "bdf3f65de768796b650f7712a3f06f2b", "score": "0.45947304", "text": "func mapArguments(args []parameters.Argument, input *Input) error {\n\tvar unmappedArguments []parameters.Argument\n\n\tfor i, arg := range args {\n\t\tif len(input.Arguments) == i {\n\t\t\tunmappedArguments = append(unmappedArguments, args[i:]...)\n\t\t\tbreak\n\t\t}\n\n\t\tvalue := input.Arguments[i].Value\n\n\t\tif err := arg.Value.Set(value); err != nil {\n\t\t\treturn fmt.Errorf(\"console: Invalid value '%s' for argument '%s'. Error: %s\", value, arg.Name, err)\n\t\t}\n\t}\n\n\tfor _, uarg := range unmappedArguments {\n\t\tif uarg.Required {\n\t\t\treturn fmt.Errorf(\"console: Argument '%s' is required\", uarg.Name)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fc134920ad911088a0727ea12c8bfa9a", "score": "0.4588295", "text": "func (b Run) Action(c *cli.Context) {\n\tif len(c.Args()) != 1 {\n\t\tlog.Println(\"Failed to get file: \", c.Args())\n\t\tos.Exit(-1)\n\t}\n\tfile := c.Args()[0]\n\tvar content []byte\n\tentryPoint := c.String(\"entrypoint\")\n\tcontent, isWasm, err := arbor.LoadFile(file, c.Bool(\"wasm\"))\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(-1)\n\t}\n\tif isWasm {\n\t\tret, err := arbor.RunWasm(content, entryPoint, \"stdlib.so\")\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tret = -1\n\t\t}\n\t\tos.Exit(int(ret))\n\t}\n\tret, err := arbor.RunArbor(content, entryPoint)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tret = -1\n\t}\n\tos.Exit(int(ret))\n}", "title": "" }, { "docid": "414620ec45e0929b6e21d41d13423147", "score": "0.45864135", "text": "func (r *ExecRunner) Run(key string,\n\ttraceID string,\n\tendpointParams string,\n\tinputMap map[*openapi.AlgoInputSpec][]types.InputData) (err error) {\n\n\t// Create the runner logger\n\tnotifType := openapi.LOGTYPES_ALGO\n\talgoLogger := logging.NewLogger(\n\t\t&openapi.LogEntryModel{\n\t\t\tType: &notifType,\n\t\t\tVersion: \"1\",\n\t\t\tData: map[string]interface{}{\n\t\t\t\t\"TraceId\": traceID,\n\t\t\t\t\"DeploymentOwner\": r.Config.DeploymentOwner,\n\t\t\t\t\"DeploymentName\": r.Config.DeploymentName,\n\t\t\t\t\"AlgoOwner\": r.Config.Owner,\n\t\t\t\t\"AlgoName\": r.Config.Name,\n\t\t\t\t\"AlgoVersion\": r.Config.Version,\n\t\t\t\t\"AlgoIndex\": r.Config.Index,\n\t\t\t\t\"AlgoInstanceName\": r.InstanceName,\n\t\t\t},\n\t\t},\n\t\tr.Metrics)\n\n\ttargetCmd := r.newExecCmd()\n\n\tstartTime := time.Now()\n\n\tsigchan := make(chan os.Signal)\n\tsignal.Notify(sigchan, syscall.SIGINT, syscall.SIGTERM)\n\t// setup termination on kill signals\n\tgo func() {\n\t\tsig := <-sigchan\n\n\t\tr.Logger.Error(fmt.Sprintf(\"Caught signal %v. Killing algo process: %s\", sig, r.Config.Entrypoint), nil)\n\n\t\tif targetCmd != nil && targetCmd.Process != nil {\n\t\t\terr := targetCmd.Process.Kill()\n\t\t\tif err != nil {\n\t\t\t\talgoLogger.Error(fmt.Sprintf(\"Killed algo process: %s\", r.Config.Entrypoint), err)\n\t\t\t}\n\t\t}\n\t}()\n\n\t// Write to the topic as error if no value\n\tif inputMap == nil {\n\t\tr.Logger.Error(\"Attempted to run but input data is empty.\", errors.New(\"Input data was empty\"))\n\n\t\treturn\n\t}\n\n\tvar timer *time.Timer\n\n\t// Set the timeout routine\n\tif r.Config.TimeoutSeconds > 0 {\n\t\ttimer = time.NewTimer(time.Duration(r.Config.TimeoutSeconds) * time.Second)\n\n\t\tgo func() {\n\t\t\t<-timer.C\n\n\t\t\tr.Logger.Error(fmt.Sprintf(\"Algo timed out. Timeout value: %d seconds\", r.Config.TimeoutSeconds), nil)\n\n\t\t\tif targetCmd != nil && targetCmd.Process != nil {\n\t\t\t\terr := targetCmd.Process.Kill()\n\t\t\t\tif err != nil {\n\t\t\t\t\tr.Logger.Error(fmt.Sprintf(\"Killed algo process due to timeout: %s\", r.Config.Entrypoint), err)\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\n\t// Set the endpoint params as an environment variable\n\ttargetCmd.Env = append(targetCmd.Env, fmt.Sprintf(\"ENDPOINT_PARAMS=%s\", endpointParams))\n\n\t// Write the stdin data or set the arguments for the input\n\tfor input, inputData := range inputMap {\n\n\t\tswitch inputDeliveryType := *input.InputDeliveryType; inputDeliveryType {\n\t\tcase openapi.INPUTDELIVERYTYPES_STD_IN:\n\n\t\t\t// get the writer for stdin\n\t\t\twriter, _ := targetCmd.StdinPipe()\n\t\t\tfor _, data := range inputData {\n\t\t\t\t// Write to stdin pipe\n\t\t\t\twriter.Write(data.Data)\n\t\t\t}\n\t\t\twriter.Close()\n\n\t\tcase openapi.INPUTDELIVERYTYPES_FILE_PARAMETER:\n\n\t\t\tif input.Parameter != \"\" {\n\t\t\t\ttargetCmd.Args = append(targetCmd.Args, input.Parameter)\n\t\t\t}\n\t\t\tfor _, data := range inputData {\n\t\t\t\ttargetCmd.Args = append(targetCmd.Args, path.Join(\"/input\", data.FileReference.File))\n\t\t\t}\n\n\t\tcase \"delimitedparameter\":\n\n\t\t\tif input.Parameter != \"\" {\n\t\t\t\ttargetCmd.Args = append(targetCmd.Args, input.Parameter)\n\t\t\t}\n\t\t\tvar buffer bytes.Buffer\n\t\t\tfor i := 0; i < len(inputData); i++ {\n\t\t\t\tbuffer.WriteString(path.Join(\"/input\", inputData[i].FileReference.File))\n\t\t\t\tif i != len(inputData)-1 {\n\t\t\t\t\tbuffer.WriteString(input.ParameterDelimiter)\n\t\t\t\t}\n\t\t\t}\n\t\t\ttargetCmd.Args = append(targetCmd.Args, buffer.String())\n\t\t}\n\t}\n\n\t// Iterate the fileParameters to append the traceid as the filename\n\tfor parameter, folder := range r.fileParameters {\n\t\tfileFolder := path.Join(folder, traceID)\n\n\t\ttargetCmd.Args = append(targetCmd.Args, parameter)\n\t\ttargetCmd.Args = append(targetCmd.Args, fileFolder)\n\t}\n\n\tstdout, err := targetCmd.StdoutPipe()\n\tif err != nil {\n\t\t// log.Fatal(err)\n\t}\n\tstderr, err := targetCmd.StderrPipe()\n\tif err != nil {\n\t\t// log.Fatal(err)\n\t}\n\n\tstdoutBytes, _ := ioutil.ReadAll(stdout)\n\tfmt.Printf(\"%s\\n\", stdoutBytes)\n\n\tstderrBytes, _ := ioutil.ReadAll(stderr)\n\tfmt.Printf(\"%s\\n\", stderrBytes)\n\n\tif err := targetCmd.Start(); err != nil {\n\t\t// log.Fatal(err)\n\t}\n\n\tcmdErr := targetCmd.Wait()\n\n\tif timer != nil {\n\t\ttimer.Stop()\n\t}\n\n\tif cmdErr != nil {\n\t\tr.Logger.Error(\"Erro occurred running Algo\", cmdErr)\n\t}\n\n\t// Reminder: Successful outputs are handled by the output file watcher\n\n\texecDuration := time.Since(startTime)\n\tr.Metrics.AlgoRuntimeHistogram.WithLabelValues(r.Metrics.DeploymentLabel,\n\t\tr.Metrics.PipelineLabel,\n\t\tr.Metrics.ComponentLabel,\n\t\tr.Metrics.AlgoLabel,\n\t\tr.Metrics.AlgoVersionLabel,\n\t\tr.Metrics.AlgoIndexLabel).Observe(execDuration.Seconds())\n\n\treturn nil\n\n}", "title": "" }, { "docid": "8c81f29ec85bf824d0e5194865f8a67d", "score": "0.45744482", "text": "func ProcessAddonAction(action string, dict map[string]interface{}, bashPath string, verbose bool) error {\n\taction = \"set -eu -o pipefail\\n\" + action\n\tt, err := template.New(\"ProcessAddonAction\").Funcs(sprig.TxtFuncMap()).Parse(action)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not parse action '%s': %v\", action, err)\n\t}\n\n\tvar doc bytes.Buffer\n\terr = t.Execute(&doc, dict)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not parse/execute action '%s': %v\", action, err)\n\t}\n\taction = doc.String()\n\n\tdesc := GetAddonDdevDescription(action)\n\tif verbose {\n\t\taction = \"set -x; \" + action\n\t}\n\tout, err := exec.RunHostCommand(bashPath, \"-c\", action)\n\tif len(out) > 0 {\n\t\tutil.Warning(out)\n\t}\n\tif err != nil {\n\t\tutil.Warning(\"%c %s\", '\\U0001F44E', desc)\n\t\treturn fmt.Errorf(\"Unable to run action %v: %v, output=%s\", action, err, out)\n\t}\n\tif desc != \"\" {\n\t\tutil.Success(\"%c %s\", '\\U0001F44D', desc)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aaf1e4f222a26e5560d59d152088f119", "score": "0.45497337", "text": "func runMapperReducer() {\n\n\tif taskOption.Mapper != \"\" {\n\t\tif fn, ok := mappers[taskOption.Mapper]; ok {\n\t\t\tif err := ProcessMapper(fn); err != nil {\n\t\t\t\tlog.Fatalf(\"Failed to execute mapper %v: %v\", os.Args, err)\n\t\t\t}\n\t\t\treturn\n\t\t} else {\n\t\t\tlog.Fatalf(\"Failed to find mapper function for %v\", taskOption.Mapper)\n\t\t}\n\t}\n\n\tif taskOption.Reducer != \"\" {\n\t\tif taskOption.KeyFields == \"\" {\n\t\t\tlog.Fatalf(\"Also expecting values for -gleam.keyFields! Actual arguments: %v\", os.Args)\n\t\t}\n\t\tif fn, ok := reducers[taskOption.Reducer]; ok {\n\n\t\t\tkeyPositions := strings.Split(taskOption.KeyFields, \",\")\n\t\t\tvar keyIndexes []int\n\t\t\tfor _, keyPosition := range keyPositions {\n\t\t\t\tkeyIndex, keyIndexError := strconv.Atoi(keyPosition)\n\t\t\t\tif keyIndexError != nil {\n\t\t\t\t\tlog.Fatalf(\"Failed to parse key index positions %v: %v\", taskOption.KeyFields, keyIndexError)\n\t\t\t\t}\n\t\t\t\tkeyIndexes = append(keyIndexes, keyIndex)\n\t\t\t}\n\n\t\t\tif err := ProcessReducer(fn, keyIndexes); err != nil {\n\t\t\t\tlog.Fatalf(\"Failed to execute reducer %v: %v\", os.Args, err)\n\t\t\t}\n\n\t\t\treturn\n\t\t} else {\n\t\t\tlog.Fatalf(\"Failed to find reducer function for %v\", taskOption.Reducer)\n\t\t}\n\t}\n\n\tlog.Fatalf(\"Failed to find function to execute. Args: %v\", os.Args)\n}", "title": "" }, { "docid": "ecf1077752e9a2be2de1ccb5667b0a98", "score": "0.45335662", "text": "func handleArgs(args []string) (string, []string, Action, error) {\n\tremaining, found, err := kssh.ParseArgs(args, cliArguments)\n\tif err != nil {\n\t\treturn \"\", nil, 0, fmt.Errorf(\"Failed to parse provided arguments: %v\", err)\n\t}\n\n\tteam := \"\"\n\taction := SSH\n\tfor _, arg := range found {\n\t\tif arg.Argument.Name == \"--bot\" {\n\t\t\tteam = arg.Value\n\t\t}\n\t\tif arg.Argument.Name == \"--set-default-user\" {\n\t\t\terr := kssh.SetDefaultSSHUser(arg.Value)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Failed to set the default ssh user: %v\\n\", err)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t\tfmt.Println(\"Set default ssh user, exiting...\")\n\t\t\tos.Exit(0)\n\t\t}\n\t\tif arg.Argument.Name == \"--clear-default-user\" {\n\t\t\terr := kssh.SetDefaultSSHUser(\"\")\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Failed to clear the default ssh user: %v\\n\", err)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t\tfmt.Println(\"Cleared default ssh user, exiting...\")\n\t\t\tos.Exit(0)\n\t\t}\n\t\tif arg.Argument.Name == \"--set-default-bot\" {\n\t\t\t// We exit immediately after setting the default bot\n\t\t\terr := kssh.SetDefaultBot(arg.Value)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Failed to set the default bot: %v\\n\", err)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t\tfmt.Println(\"Set default bot, exiting...\")\n\t\t\tos.Exit(0)\n\t\t}\n\t\tif arg.Argument.Name == \"--clear-default-bot\" {\n\t\t\terr := kssh.SetDefaultBot(\"\")\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Failed to clear the default bot: %v\\n\", err)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t\tfmt.Println(\"Cleared default bot, exiting...\")\n\t\t\tos.Exit(0)\n\t\t}\n\t\tif arg.Argument.Name == \"--set-keybase-binary\" {\n\t\t\terr := kssh.SetKeybaseBinaryPath(arg.Value)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Failed to set the keybase binary: %v\\n\", err)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t\tfmt.Println(\"Set keybase binary, exiting...\")\n\t\t\tos.Exit(0)\n\t\t}\n\t\tif arg.Argument.Name == \"--provision\" {\n\t\t\taction = Provision\n\t\t}\n\t\tif arg.Argument.Name == \"--help\" {\n\t\t\tfmt.Println(generateHelpPage())\n\t\t\tos.Exit(0)\n\t\t}\n\t\tif arg.Argument.Name == \"-v\" {\n\t\t\tlog.SetLevel(log.DebugLevel)\n\t\t}\n\t}\n\treturn team, remaining, action, nil\n}", "title": "" }, { "docid": "ba787942044ba4c05b057829013f1d79", "score": "0.4529342", "text": "func Run(ps *pubsub.PubSub, loggerArg *logrus.Logger, logArg *base.LogObject, arguments []string) int {\n\tlogger = loggerArg\n\tlog = logArg\n\t// Report nano timestamps\n\tformatter := logrus.JSONFormatter{\n\t\tTimestampFormat: time.RFC3339Nano,\n\t}\n\tlogger.SetFormatter(&formatter)\n\n\t// Context to pass around\n\tctx := commandAgentState{}\n\tagentbase.Init(&ctx, logger, log, agentName,\n\t\tagentbase.WithArguments(arguments))\n\n\ttimeLimit = *ctx.timeLimitPtr\n\tcombinedOutput = *ctx.combinedPtr\n\tdontWait = *ctx.dontWaitPtr\n\tif *ctx.environPtr != \"\" {\n\t\t// XXX Syntax to add multiple? This is just for testing\n\t\tenviron = append(environ, *ctx.environPtr)\n\t}\n\tif *ctx.quietPtr {\n\t\tloggerArg.SetLevel(logrus.WarnLevel)\n\t}\n\n\thdl, err := execlib.New(ps, log, agentName, \"executor\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tr := bufio.NewReader(os.Stdin)\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\tfmt.Fprintf(os.Stderr, \"Read failed: %s\\n\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\ttokens := strings.Split(strings.TrimSpace(line), \" \")\n\t\tif len(tokens) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\texecute(hdl, tokens[0], tokens[1:])\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "0d30c4a87877931e66e701f875579edb", "score": "0.45149678", "text": "func Action(_ *cobra.Command, _ []string) error {\n\ttp := VarStringSliceType\n\tc := VarBoolCache\n\teasy := VarBoolEasy\n\to := strings.TrimSpace(VarStringDir)\n\ts := VarStringStyle\n\thome := VarStringHome\n\tremote := VarStringRemote\n\tbranch := VarStringBranch\n\n\tif len(remote) > 0 {\n\t\trepo, _ := file.CloneIntoGitHome(remote, branch)\n\t\tif len(repo) > 0 {\n\t\t\thome = repo\n\t\t}\n\t}\n\n\tif len(home) > 0 {\n\t\tpathx.RegisterGoctlHome(home)\n\t}\n\n\tif len(tp) == 0 {\n\t\treturn errors.New(\"missing type\")\n\t}\n\n\tcfg, err := config.NewConfig(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ta, err := filepath.Abs(o)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = pathx.MkdirIfNotExist(a); err != nil {\n\t\treturn err\n\t}\n\n\treturn generate.Do(&generate.Context{\n\t\tTypes: tp,\n\t\tCache: c,\n\t\tEasy: easy,\n\t\tOutput: a,\n\t\tCfg: cfg,\n\t})\n}", "title": "" }, { "docid": "ce61d99d571a654a7cb08d171933e314", "score": "0.45025778", "text": "func cliCommandMap(cmd *cobra.Command, args []string) {\n\tvar err error\n\n\tlog.Info(aurora.Bold(aurora.Yellow(fmt.Sprint(\"Enabling log level: \",\n\t\tstrings.ToUpper(viper.GetString(\"log-level\"))))))\n\n\t// Check to make sure schema-prefix and schema are used in conjunction with each other\n\tif len(viper.GetString(\"map.schema-prefix\")) > 0 && len(viper.GetStringSlice(\"map.schema\")) < 1 {\n\t\tlog.Fatal(\"If a using --schema-prefix=schema_name_ you must add --schema=schema_name as well\")\n\t}\n\n\tif len(viper.GetStringSlice(\"map.exclude-table\")) > 0 {\n\t\tlog.Info(aurora.Bold(aurora.Magenta(\"Excluding the following tables:\")))\n\t\tfor _, t := range viper.GetStringSlice(\"map.exclude-table\") {\n\t\t\tlog.Info(\"\\t\\t\", t)\n\t\t}\n\t}\n\n\tif len(viper.GetStringSlice(\"map.exclude-table-data\")) > 0 {\n\t\tlog.Info(aurora.Bold(aurora.Magenta(\"Excluding data from the following tables:\")))\n\t\tfor _, t := range viper.GetStringSlice(\"map.exclude-table-data\") {\n\t\t\tlog.Info(\"\\t\\t\", t)\n\t\t}\n\t}\n\n\tif len(viper.GetString(\"map.password\")) < 1 {\n\t\tlog.Debug(\"Password is empty. Asking user for password\")\n\t\tviper.SetDefault(\"map.password\", GetPassword())\n\t}\n\n\tdbConf, _ := GetDb(\n\t\tviper.GetString(\"map.host\"),\n\t\tviper.GetString(\"map.username\"),\n\t\tviper.GetString(\"map.password\"),\n\t\tviper.GetString(\"map.database\"),\n\t\tviper.GetInt32(\"map.port\"),\n\t\tviper.GetBool(\"map.disable-ssl\"),\n\t)\n\terr = runMap(\n\t\tdbConf,\n\t\tviper.GetString(\"map.map-file\"),\n\t\tviper.GetString(\"map.schema-prefix\"),\n\t\tviper.GetStringSlice(\"map.exclude-table\"),\n\t\tviper.GetStringSlice(\"map.exclude-table-data\"),\n\t\tviper.GetStringSlice(\"map.schema\"),\n\t)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\tlog.Error(\"❌ Gonymizer did not exit properly. See above for errors ❌\")\n\t\tos.Exit(1)\n\t} else {\n\t\tlog.Info(\"🦄 \", aurora.Bold(aurora.Green(\"-- SUCCESS --\")), \" 🌈\")\n\t}\n}", "title": "" }, { "docid": "8a69ab4e323d2a43218a88952611b553", "score": "0.45011187", "text": "func Execute() {\n\tvar cfg Config\n\tvar rootCmd = &cobra.Command{Use: \"app\"}\n\tvar cmdRecord = &cobra.Command{\n\t\tUse: \"record\",\n\t\tShort: \"Run in record mode\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tverifyFlags(cfg, cmd)\n\t\t\tcfg.outFile = getDumpFile(cfg.outFile, cfg.service, cfg.testCmd)\n\t\t\trunRecord(cfg)\n\t\t},\n\t}\n\tvar cmdReplay = &cobra.Command{\n\t\tUse: \"replay\",\n\t\tShort: \"Run in replay mode\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tverifyFlags(cfg, cmd)\n\t\t\tcfg.outFile = getDumpFile(cfg.outFile, cfg.service, cfg.testCmd)\n\t\t\trunReplay(cfg)\n\t\t},\n\t}\n\n\t// Flags for record and replay mode\n\trootCmd.PersistentFlags().BoolVar(\n\t\t&cfg.proxyOnly, \"proxyOnly\", false, \"Only start proxy in stand-alone mode\")\n\trootCmd.PersistentFlags().StringVar(\n\t\t&cfg.service, serviceFlag, \"\", \"Docker setService name to test (required when not run in stand-alone proxy mode)\")\n\trootCmd.PersistentFlags().StringVar(\n\t\t&cfg.testCmd, testCmdFlag, \"\", \"Test command to execute (required when not run in stand-alone proxy mode)\")\n\trootCmd.PersistentFlags().IntVar(\n\t\t&cfg.port, \"port\", 9999, \"Port to use for the MITM proxy\")\n\trootCmd.PersistentFlags().StringVar(\n\t\t&cfg.serviceCompose, \"compose\", \"./docker-compose.yml\", \"Default docker-compose file for the services\")\n\trootCmd.PersistentFlags().StringVar(\n\t\t&cfg.outFile, outFileFlag, \"\", \"File name for the mitm output file (required when run in stand-alone proxy mode)\")\n\trootCmd.PersistentFlags().StringVar(\n\t\t&cfg.dumpDir, \"directory\", \"replay-dumps\", \"Directory to store the test dumps in\")\n\trootCmd.PersistentFlags().IntVar(\n\t\t&cfg.dockerSleep, \"sleep\", 0, \"Time to wait after starting docker services in ms\")\n\n\trootCmd.AddCommand(cmdRecord, cmdReplay)\n\trootCmd.Execute()\n}", "title": "" }, { "docid": "d7b394fa166145d89fb6a0726b7a0e79", "score": "0.4489352", "text": "func (a *Amigo) Action(action map[string]string) (map[string]string, error) {\n\tif !a.Connected() {\n\t\treturn nil, errNotConnected\n\t}\n\n\ta.mutex.Lock()\n\tdefer a.mutex.Unlock()\n\tresult := a.ami.exec(action)\n\tif a.capitalizeProps {\n\t\te := map[string]string{}\n\t\tfor k, v := range result {\n\t\t\te[strings.ToUpper(k)] = v\n\t\t}\n\t\treturn e, nil\n\t}\n\n\tif strings.ToLower(action[\"Action\"]) == \"logoff\" {\n\t\ta.ami.reconnect = false\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "771bebcdb70cffb6b870367b7aaf190c", "score": "0.44703162", "text": "func (ExecuteAction) Process(h Hook, r Request, b *bolt.Bucket) error {\n\tcommand := b.Get([]byte(fmt.Sprintf(\"%s-command\", h.ID)))\n\tif command == nil {\n\t\treturn errors.New(\"forward request action not initialized\")\n\t}\n\n\tout, err := exec.Command(\"sh\", \"-c\", string(command)).CombinedOutput()\n\tlog.Printf(\"[command-action][%s] executing command: %s\\n --- STARTOUTPUT --- \\n %s \\n --- ENDOUTPUT ---\", h.ID, command, out)\n\tif err != nil {\n\t\tlog.Printf(\"[command-action][%s] error: %s\", h.ID, err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a84356e9ad740fb4ec74b6481b1ce8ff", "score": "0.4470294", "text": "func DoAction(serviceName, action string) (string, error) {\n\tout, err := exec.Command(SupervisorController, action, serviceName).Output()\n\tif err != nil {\n\t\tlog.Printf(\"%s\", err)\n\t\treturn \"\", err\n\t}\n\tlog.Printf(\"Supervisor %s action=%s action result: %s\\n\", serviceName, action, out)\n\treturn string(out), nil\n}", "title": "" }, { "docid": "d6f4d6b69be3997b30a261c339945165", "score": "0.446783", "text": "func (p *Program) Execute() {\n\tif len(os.Args) <= 1 {\n\t\tfmt.Printf(\"You must specify a command\\n\")\n\t\tp.PrintHelp()\n\t\tos.Exit(1)\n\t}\n\tfor _, a := range p.Actions {\n\t\tif a.Name == os.Args[1] {\n\t\t\tp.StartTime = time.Now()\n\t\t\tos.Exit(a.Func(os.Args[2:]))\n\t\t}\n\t}\n\tfmt.Printf(\"Invalid command '%s'\\n\", os.Args[1])\n\tp.PrintHelp()\n\tos.Exit(1)\n}", "title": "" }, { "docid": "c8a213980a2c12bcad8289c25fa28047", "score": "0.44641733", "text": "func (c *ListCommand) Execute(args []string) ExecutionStatus {\n\tlog.Tracef(\"Executing command '%s': args: '%v'\\n\", c.Name, args)\n\n\t// List apps in the space\n\tif len(args) == 0 {\n\t\treturn c.ListApps(nil)\n\t}\n\n\t// Parse arguments\n\tvar key = \"_\"\n\tvar argsMap = make(map[string][]string)\n\tfor _, arg := range args {\n\t\tif string(arg[0]) == \"-\" {\n\t\t\tkey = arg\n\t\t\tif argsMap[key] == nil {\n\t\t\t\targsMap[key] = make([]string, 0)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\targsMap[key] = append(argsMap[key], arg)\n\t\tkey = \"_\"\n\t}\n\n\t// Service Name\n\tvar name = \"\"\n\tif argsMap[\"-n\"] != nil && argsMap[\"--name\"] != nil {\n\t\tui.Failed(\"Can't use both '--name' and '-n' at the same time\")\n\t\treturn Failure\n\t}\n\tif argsMap[\"-n\"] != nil {\n\t\targsMap[\"--name\"] = argsMap[\"-n\"]\n\t}\n\tif argsMap[\"--name\"] != nil {\n\t\tif len(argsMap[\"--name\"]) != 1 {\n\t\t\tui.Failed(\"Incorrect number of arguments for APP_HOST_NAME option (expected: 1, actual: %d). For help see [cf html5-list --help]\", len(argsMap[\"--name\"]))\n\t\t\treturn Failure\n\t\t}\n\t\tif len(argsMap[\"_\"]) != 2 {\n\t\t\tui.Failed(\"HTML5 application name and version are required, when using '--name' option\")\n\t\t\treturn Failure\n\t\t}\n\t\tname = argsMap[\"--name\"][0]\n\t}\n\n\t// App\n\tvar app = \"\"\n\tif argsMap[\"-a\"] != nil && argsMap[\"--app\"] != nil {\n\t\tui.Failed(\"Can't use both '--app' and '-a' at the same time\")\n\t\treturn Failure\n\t}\n\tif argsMap[\"-a\"] != nil {\n\t\targsMap[\"--app\"] = argsMap[\"-a\"]\n\t}\n\tif argsMap[\"--app\"] != nil {\n\t\tif len(argsMap[\"--app\"]) != 1 {\n\t\t\tui.Failed(\"Incorrect number of arguments for CF_APP_NAME option (expected: 1, actual: %d). For help see [cf html5-list --help]\", len(argsMap[\"--app\"]))\n\t\t\treturn Failure\n\t\t}\n\t\tapp = argsMap[\"--app\"][0]\n\t}\n\n\t// Show URLs\n\tvar showUrls = false\n\tif argsMap[\"-u\"] != nil || argsMap[\"--url\"] != nil {\n\t\tshowUrls = true\n\t}\n\n\t// Runtime (cpp, launchpad, wzr)\n\tvar runtime = \"\"\n\tif argsMap[\"-rt\"] != nil && argsMap[\"--runtime\"] != nil {\n\t\tui.Failed(\"Can't use both '--runtime' and '-rt' at the same time\")\n\t\treturn Failure\n\t}\n\tif argsMap[\"-rt\"] != nil {\n\t\targsMap[\"--runtime\"] = argsMap[\"-rt\"]\n\t}\n\tif argsMap[\"--runtime\"] != nil {\n\t\truntime = argsMap[\"--runtime\"][0]\n\t}\n\n\t// Destination (subaccount)\n\tvar destination = false\n\tif argsMap[\"-d\"] != nil || argsMap[\"--destination\"] != nil {\n\t\tdestination = true\n\t}\n\n\t// Destination (instance)\n\tvar destinationInstance = \"\"\n\tif argsMap[\"-di\"] != nil && argsMap[\"--destination-instance\"] != nil {\n\t\tui.Failed(\"Can't use both '--destination-instance' and '-di' at the same time\")\n\t\treturn Failure\n\t}\n\tif argsMap[\"-di\"] != nil {\n\t\targsMap[\"--destination-instance\"] = argsMap[\"-di\"]\n\t}\n\tif argsMap[\"--destination-instance\"] != nil {\n\t\tif len(argsMap[\"--destination-instance\"]) != 1 {\n\t\t\tui.Failed(\"Incorrect number of arguments for DESTINATION_SERVICE_INSTANCE_NAME option (expected: 1, actual: %d). For help see [cf html5-list --help]\", len(argsMap[\"--destination-instance\"]))\n\t\t\treturn Failure\n\t\t}\n\t\tdestinationInstance = argsMap[\"--destination-instance\"][0]\n\t}\n\n\tif app != \"\" {\n\t\t// List HTML5 applications available in CF application context\n\t\treturn c.ListAppApps(app, showUrls)\n\t} else if destination || destinationInstance != \"\" {\n\t\t// List HTML5 applications available via destinations with\n\t\t// sap.cloud.service and html5-apps-repo.app_host_id properties\n\t\treturn c.ListDestinationApps(destinationInstance, showUrls, runtime)\n\t} else if len(argsMap[\"_\"]) == 3 {\n\t\t// List files paths of application with version from app-host-id\n\t\treturn c.ListAppFiles(argsMap[\"_\"][0], argsMap[\"_\"][1], argsMap[\"_\"][2], false)\n\t} else if len(argsMap[\"_\"]) == 2 {\n\t\t// List files paths of application with version\n\t\treturn c.ListAppFiles(argsMap[\"_\"][0], argsMap[\"_\"][1], name, name != \"\")\n\t} else if len(argsMap[\"_\"]) == 1 {\n\t\t// Check if passed argument is app-host-id\n\t\tlog.Tracef(\"Checking if '%s' is an app-host-id\\n\", argsMap[\"_\"][0])\n\t\tmatch, err := regexp.MatchString(\"^[A-Za-z0-9]{8}-([A-Za-z0-9]{4}-){3}[A-Za-z0-9]{12}$\", argsMap[\"_\"][0])\n\t\tif err != nil {\n\t\t\tui.Failed(\"Regular expression check failed: %+v\", err)\n\t\t\treturn Failure\n\t\t}\n\t\tif match {\n\t\t\t// List files paths of applications from app-host-id\n\t\t\treturn c.ListApps(&argsMap[\"_\"][0])\n\t\t}\n\t\t// List files paths of application default version\n\t\treturn c.ListAppFiles(argsMap[\"_\"][0], \"\", \"\", false)\n\t}\n\n\tui.Failed(\"Too many arguments. See [cf html5-list --help] for more details\")\n\treturn Failure\n}", "title": "" }, { "docid": "51539d4ec3636cc8e77656abbb84f3a8", "score": "0.4463434", "text": "func ActionProcesses(path string) carapace.Action {\n\treturn carapace.ActionCallback(func(c carapace.Context) carapace.Action {\n\t\tif path == \"\" {\n\t\t\tvar err error\n\t\t\tif path, err = configPath(c); err != nil {\n\t\t\t\treturn carapace.ActionMessage(err.Error())\n\t\t\t}\n\t\t}\n\n\t\treturn carapace.ActionExecCommandE(\"supervisorctl\", \"--configuration\", path, \"status\")(func(output []byte, err error) carapace.Action {\n\t\t\tif err != nil {\n\t\t\t\tconst NOT_RUNNING = 3\n\t\t\t\tif exitErr, ok := err.(*exec.ExitError); !ok || exitErr.ExitCode() != NOT_RUNNING {\n\t\t\t\t\tif len(exitErr.Stderr) > 0 {\n\t\t\t\t\t\treturn carapace.ActionMessage(string(exitErr.Stderr))\n\t\t\t\t\t}\n\t\t\t\t\tif len(output) > 0 {\n\t\t\t\t\t\treturn carapace.ActionMessage(string(output))\n\t\t\t\t\t}\n\t\t\t\t\treturn carapace.ActionMessage(string(output))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlines := strings.Split(string(output), \"\\n\")\n\t\t\tvals := make([]string, 0)\n\n\t\t\tr := regexp.MustCompile(`^(?P<name>[^ ]+) +(?P<status>[^ ]+) +(?P<description>.*)$`)\n\t\t\tfor _, line := range lines {\n\t\t\t\tif matches := r.FindStringSubmatch(line); matches != nil {\n\t\t\t\t\tvals = append(vals, matches[1], matches[3], style.ForKeyword(matches[2], c))\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn carapace.ActionStyledValuesDescribed(vals...)\n\t\t})\n\t})\n}", "title": "" }, { "docid": "79171259f462bf886243c99167c0a75e", "score": "0.44588003", "text": "func (c *SetBit) Execute(args ...string) Reply {\n\tif len(args) != 3 {\n\t\treturn ErrReply{Value: ErrWrongArgsNumber}\n\t}\n\n\toffset, err := c.parseOffset(args)\n\tif err != nil {\n\t\treturn ErrReply{Value: err}\n\t}\n\n\tbitValue, err := c.parseValue(args)\n\tif err != nil {\n\t\treturn ErrReply{Value: err}\n\t}\n\n\tsetter := func(old *storage.Value) (*storage.Value, error) {\n\t\tvar value []uint64\n\t\tif old != nil {\n\t\t\tif old.Type() != storage.BitMapDataType {\n\t\t\t\treturn nil, ErrWrongTypeOp\n\t\t\t}\n\t\t\tvalue = old.Data().([]uint64)\n\t\t}\n\n\t\tvalue = c.growSlice(value, offset)\n\t\tidx := c.resolveIndex(offset)\n\n\t\tif bitValue == 1 {\n\t\t\tvalue[idx] = value[idx] | 1<<(offset%64)\n\t\t} else {\n\t\t\tvalue[idx] = value[idx] & ^(1 << (offset % 64))\n\t\t}\n\t\tif c.isZeroSlice(value) {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn storage.NewBitMap(value), nil\n\t}\n\n\tif err := c.strg.Put(storage.Key(args[0]), setter); err != nil {\n\t\treturn ErrReply{Value: err}\n\t}\n\treturn OkReply{}\n}", "title": "" }, { "docid": "00621404b520e0c900fa5b4f16cf8fc8", "score": "0.44557866", "text": "func (c *InfoCommand) Execute(args []string) ExecutionStatus {\n\tlog.Tracef(\"Executing command '%s': args: '%v'\\n\", c.Name, args)\n\n\tflagSet := flag.NewFlagSet(\"html5-info\", flag.ContinueOnError)\n\tvar appHostNames stringSlice\n\tflagSet.Var(&appHostNames, \"name\", \"Name of html5-apps-repo app-host service instance\")\n\tflagSet.Var(&appHostNames, \"n\", \"Name of html5-apps-repo app-host service instance (alias)\")\n\tflagSet.Parse(args)\n\n\tappHostGUIDs := flagSet.Args()\n\treturn c.GetServiceInfos(appHostGUIDs, appHostNames)\n}", "title": "" }, { "docid": "546b9c5ac974f3fa3bdf9429bdb0cf48", "score": "0.44477886", "text": "func (t *Tool) RunAction(name string, argv []string) {\n\terr := t.runActionInternal(name, argv)\n\tif err != nil {\n\t\tfmt.Println(name+\": ERROR:\", err.Error())\n\t}\n}", "title": "" }, { "docid": "bc24a9a94a134036620d154ea495df85", "score": "0.44453877", "text": "func AssertOutputs(t *testing.T, options *terraform.Options, expectedOutputs map[string]interface{}) {\n\tAssertOutputsWithLookup(t, options, expectedOutputs, map[string]string{})\n}", "title": "" }, { "docid": "0e3583e6c8f29fa6707518a8d4618ca5", "score": "0.4438236", "text": "func (cmd *Command) Execute(args []string) {\n\tv, err := cmd.parseP(args)\n\tif err != nil {\n\t\tfmt.Printf(\"%s %v\\n\", term.Red(\"[arg error]\"), err)\n\t\tcmd.ShowUsage()\n\t\tos.Exit(1)\n\t}\n\n\terr = cmd.Action(v)\n\tif err != nil {\n\t\tfmt.Printf(\"%s %v\\n\", term.Red(\"[error]\"), err)\n\t\terrors.ShowCompile(err)\n\t\tos.Exit(1)\n\t}\n\tos.Exit(0)\n}", "title": "" }, { "docid": "3e96e5ad94034bb8c28803a7081303a7", "score": "0.44286174", "text": "func runAction(clicontext *cli.Context) error {\n\tif clicontext.NArg() < 1 {\n\t\treturn errors.New(\"image name needs to be specified\")\n\t}\n\n\tclient, ctx, cancel, err := newClient(clicontext)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer cancel()\n\tensured, err := ensureImage(ctx, client, clicontext.App.Writer, clicontext.Args().First(), clicontext.String(\"pull\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar (\n\t\topts []oci.SpecOpts\n\t\tcOpts []containerd.NewContainerOpts\n\t\tid = genID()\n\t)\n\topts = append(opts,\n\t\toci.WithDefaultSpec(),\n\t\toci.WithDefaultUnixDevices,\n\t\toci.WithImageConfig(ensured.Image),\n\t)\n\tcOpts = append(cOpts,\n\t\tcontainerd.WithImage(ensured.Image),\n\t\tcontainerd.WithSnapshotter(ensured.Snapshotter),\n\t\tcontainerd.WithNewSnapshot(id, ensured.Image),\n\t\tcontainerd.WithImageStopSignal(ensured.Image, \"SIGTERM\"),\n\t)\n\tif clicontext.NArg() > 1 {\n\t\topts = append(opts, oci.WithProcessArgs(clicontext.Args().Tail()...))\n\t}\n\n\tif !clicontext.Bool(\"i\") || !clicontext.Bool(\"t\") {\n\t\treturn errors.New(\"currently -i and -t need to be always specified (FIXME)\")\n\t}\n\topts = append(opts, oci.WithTTY)\n\n\tvar cniNetwork gocni.CNI\n\tswitch netstr := clicontext.String(\"network\"); netstr {\n\tcase \"none\":\n\t\t// NOP\n\tcase \"host\":\n\t\topts = append(opts, oci.WithHostNamespace(specs.NetworkNamespace), oci.WithHostHostsFile, oci.WithHostResolvconf)\n\tcase \"bridge\":\n\t\tif cniNetwork, err = gocni.New(gocni.WithConfListBytes([]byte(defaultBridgeNetwork))); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tresolvConf, err := ioutil.TempFile(\"\", \"nerdctl-resolvconf\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer os.RemoveAll(resolvConf.Name())\n\t\tif _, err = resolvConf.Write([]byte(\"search localdomain\\n\")); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, dns := range clicontext.StringSlice(\"dns\") {\n\t\t\tif net.ParseIP(dns) == nil {\n\t\t\t\treturn errors.Errorf(\"invalid dns %q\", dns)\n\t\t\t}\n\t\t\tif _, err = resolvConf.Write([]byte(\"nameserver \" + dns + \"\\n\")); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\topts = append(opts, withCustomResolvConf(resolvConf.Name()))\n\tdefault:\n\t\treturn errors.Errorf(\"unknown network %q\", netstr)\n\t}\n\n\tsecurityOptsMaps := ConvertKVStringsToMap(clicontext.StringSlice(\"security-opt\"))\n\tif secOpts, err := generateSecurityOpts(securityOptsMaps); err != nil {\n\t\treturn err\n\t} else {\n\t\topts = append(opts, secOpts...)\n\t}\n\n\tif clicontext.Bool(\"privileged\") {\n\t\topts = append(opts, privilegedOpts...)\n\t}\n\n\tvar s specs.Spec\n\tspec := containerd.WithSpec(&s, opts...)\n\tcOpts = append(cOpts, spec)\n\n\tcontainer, err := client.NewContainer(ctx, id, cOpts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif clicontext.Bool(\"rm\") {\n\t\tdefer container.Delete(ctx, containerd.WithSnapshotCleanup)\n\t}\n\n\tcon := console.Current()\n\tdefer con.Reset()\n\tif err := con.SetRaw(); err != nil {\n\t\treturn err\n\t}\n\n\ttask, err := tasks.NewTask(ctx, client, container, \"\", con, false, \"\", nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif cniNetwork != nil {\n\t\t\tif err := cniNetwork.Remove(ctx, fullID(ctx, container), \"\"); err != nil {\n\t\t\t\tlogrus.WithError(err).Error(\"network review\")\n\t\t\t}\n\t\t}\n\t\ttask.Delete(ctx)\n\t}()\n\tstatusC, err := task.Wait(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif cniNetwork != nil {\n\t\tif _, err := cniNetwork.Setup(ctx, fullID(ctx, container), fmt.Sprintf(\"/proc/%d/ns/net\", task.Pid())); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err := task.Start(ctx); err != nil {\n\t\treturn err\n\t}\n\tif err := tasks.HandleConsoleResize(ctx, task, con); err != nil {\n\t\tlogrus.WithError(err).Error(\"console resize\")\n\t}\n\tstatus := <-statusC\n\tcode, _, err := status.Result()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, err := task.Delete(ctx); err != nil {\n\t\treturn err\n\t}\n\tif code != 0 {\n\t\treturn cli.NewExitError(\"\", int(code))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "adc42489a2b47d2c74875043d744fb3e", "score": "0.44248316", "text": "func doAction(action string, value string, actionOn Node) *Result{\n\t//This should be 1 or 0. The aregument can just simply call something without an arg sometimes.\n\tlen := 1\n\tif value == \"\" {\n\t\tlen = 0\n\t}\n\tinputs := make([]reflect.Value, len) //The call requirers an array of reflect.Values?!?\n\t\n\t//do not need it if the function is to be called without an argument\n\tif len > 0 {\n\t\tinputs[0] = reflect.ValueOf(value)//but they add the args to the function\n\t}\n\n\t//Everything that is supposed to be called as an action needs to return a result\n\tresult := reflect.ValueOf(actionOn).MethodByName(action).Call(inputs)[0].Interface().(*Result)\n\treturn result\n\n}", "title": "" }, { "docid": "172ef11f05622c2d583b61514892987f", "score": "0.4424588", "text": "func runCommand(cmd string, args []string, aliases map[string]string) error {\n\tswitch cmd {\n\n\tcase \"alias\":\n\t\treturn runCommand_alias(args, aliases)\n\n\tcase \"list\":\n\t\treturn runCommand_list(args, aliases)\n\n\tcase \"remove\":\n\t\treturn runCommand_remove(args, aliases)\n\n\tcase \"wake\":\n\t\treturn runCommand_wake(args, aliases)\n\n\tdefault:\n\t\tpanic(\"Invalid command passed to runCommand\")\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e2efe1f467cc9a64c0072274d5f1a913", "score": "0.44171545", "text": "func Execute(fmap map[string]string, comm string) {\n\n\tvar arg string\n\t// generate corrisponding argument to qscamel\n\tif _, has := fmap[\"config\"]; has == true {\n\t\targ = strings.Join([]string{\"-c\", fmap[\"config\"]}, \" \")\n\t}\n\targs := strings.Split(arg, \" \")\n\n\tswitch comm {\n\tcase \"run\":\n\t\targ = strings.Join([]string{\"run\", fmap[\"name\"], \"-t\", fmap[\"task\"], arg}, \" \")\n\tcase \"delete\":\n\t\targ = strings.Join([]string{comm, fmap[\"delname\"], arg}, \" \")\n\tdefault:\n\t\targ = strings.Join([]string{comm, arg}, \" \")\n\t}\n\n\t// remove \"\"\n\targs = strings.Split(arg, \" \")\n\tif args[len(args)-1] == \"\" {\n\t\targs = args[:len(args)-1]\n\t}\n\n\tvar c *exec.Cmd\n\tswitch runtime.GOOS {\n\tcase \"windows\":\n\t\t// TODO\n\tdefault:\n\t\tc = cmdOnUnix(\"qscamel\", args...)\n\t}\n\n\t// set output file\n\tout, err := ioutil.TempFile(fmap[\"dir\"], comm+\"*.output\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer out.Close()\n\n\tfmap[\"output\"] = out.Name()\n\tc.Stdout = out\n\tc.Stderr = out\n\n\t// run command\n\tif err = c.Run(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n}", "title": "" }, { "docid": "1f4b0261d18b0b898920eb444cdc2729", "score": "0.44127047", "text": "func (x *ConfigCommand) Execute(args []string) error {\n\tconf, err := NewDefaultConfigClient(&DefaultSystem{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif configCommand.List {\n\t\tall, err := conf.GetAll()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor k, v := range all {\n\t\t\tfmt.Printf(\"%s = %s\\n\", k, v)\n\t\t}\n\t} else if configCommand.Unset {\n\t\terr := conf.Unset(configCommand.System, configCommand.Args.Key)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tif len(configCommand.Args.Value) > 0 {\n\t\t\treturn conf.Set(configCommand.System, configCommand.Args.Key, configCommand.Args.Value)\n\t\t} else if len(configCommand.Args.Key) > 0 {\n\t\t\tval, err := conf.Get(configCommand.Args.Key)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfmt.Println(val)\n\t\t} else {\n\t\t\treturn errors.New(\"Specify a key and optional value to set or pass --help for more information\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fd4226f08cc6b71a380ad264821c565f", "score": "0.4407887", "text": "func (t BaseEnvCollectEnvVars) Execute(options tasks.Options, upstream map[string]tasks.Result) tasks.Result {\n\tvar result tasks.Result\n\tenvVars, err := tasks.GetShellEnvVars()\n\n\tif err != nil {\n\t\tlog.Debug(err.Error())\n\t\tresult.Status = tasks.Error\n\t\tresult.Summary = \"Unable to gather any Environment Variables from the current shell. Error found: \" + err.Error()+ tasks.NotifyIssueSummary\n\t\treturn result\n\t}\n\n\tfilteredEnvVars := envVars.WithDefaultFilter()\n\n\tresult.Payload = filteredEnvVars\n\tresult.Status = tasks.Info\n\tresult.Summary = \"Gathered Environment variables of current shell.\"\n\n\treturn result\n}", "title": "" }, { "docid": "8377be050a2b07fe8a571f548fb026cc", "score": "0.44075134", "text": "func (c *extractCommand) Run(debugger util.ECALDebugger, args []string) (interface{}, error) {\n\tif len(args) != 3 {\n\t\treturn nil, fmt.Errorf(\"Need a thread ID, a variable name and a destination variable name\")\n\t}\n\n\tthreadID, err := c.AssertNumParam(1, args[0])\n\n\tif err == nil {\n\t\tif !parser.NamePattern.MatchString(args[1]) || !parser.NamePattern.MatchString(args[2]) {\n\t\t\terr = fmt.Errorf(\"Variable names may only contain [a-zA-Z] and [a-zA-Z0-9] from the second character\")\n\t\t}\n\n\t\tif err == nil {\n\t\t\terr = debugger.ExtractValue(threadID, args[1], args[2])\n\t\t}\n\t}\n\n\treturn nil, err\n}", "title": "" }, { "docid": "33ec75ba9eb1ca9055687eb0a39a64cd", "score": "0.44068056", "text": "func (e *Executor) Execute(cmds []Command) error {\n\te.Lock()\n\tdefer e.Unlock()\n\n\tfor _, cmd := range cmds {\n\t\ta, ok := e.actions[cmd.Key]\n\t\tif !ok {\n\t\t\treturn &Error{\n\t\t\t\tMessage: fmt.Sprintf(\"Key %q is not defined\", cmd.Key),\n\t\t\t\tErr: ErrKeyNotDefined,\n\t\t\t}\n\t\t}\n\n\t\tif e.BeforeAction != nil {\n\t\t\tif err := e.BeforeAction(cmd.Key, cmd.Parameters...); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tif err := a(cmd.Key, cmd.Parameters...); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif e.AfterAction != nil {\n\t\t\tif err := e.AfterAction(cmd.Key, cmd.Parameters...); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "aff664742e78d4638f45615514e861b1", "score": "0.44063717", "text": "func (cmd *Command) Execute(input []string) (ExitStatus, error) {\n\tctx := cmd.NewContext()\n\n\t// if SetFlags function has been set, call it\n\tif cmd.SetFlags != nil {\n\t\tcmd.SetFlags(ctx)\n\t}\n\n\t// Parse flagSet\n\tif err := ctx.FlagSet().Parse(input[1:]); err != nil {\n\t\treturn ExitCmd, &ErrParseFlags{Name: cmd.Name, Err: err}\n\t}\n\n\texitStatus := cmd.Main(ctx)\n\t// if exitStatus is ExitUsage, print Usage string\n\tif exitStatus == ExitUsage {\n\t\tcmd.app.Println(cmd.Usage)\n\t}\n\n\treturn exitStatus, nil\n}", "title": "" }, { "docid": "75db435b7a983d012fdbb9517d5d7097", "score": "0.44011205", "text": "func (c *EncodeCommand) Execute(args []string) error {\n\tif opts.HmacKey == \"\" {\n\t\treturn errors.New(\"empty HMAC\")\n\t}\n\n\tif len(c.Positional.Url) == 0 {\n\t\treturn errors.New(\"no url argument provided\")\n\t}\n\n\thmacKeyBytes := []byte(opts.HmacKey)\n\tvar outURL string\n\tswitch c.Base {\n\tcase \"base64\":\n\t\toutURL = encoding.B64EncodeURL(hmacKeyBytes, c.Positional.Url)\n\tcase \"hex\":\n\t\toutURL = encoding.HexEncodeURL(hmacKeyBytes, c.Positional.Url)\n\tdefault:\n\t\treturn errors.New(\"invalid base provided\")\n\t}\n\tfmt.Println(strings.TrimRight(c.Prefix, \"/\") + outURL)\n\treturn nil\n}", "title": "" }, { "docid": "e720eed35cec0a9dfc7bf96d37d6e6f3", "score": "0.43973005", "text": "func Run(c *status.Cluster, action string, options ...Option) error {\n\tflags := &RunOptions{}\n\tfor _, o := range options {\n\t\to(flags)\n\t}\n\n\tif a, ok := actionRegistry[action]; ok {\n\t\treturn a(c, flags)\n\t}\n\n\treturn errors.Errorf(\"%s is not a valid action name. Use one of %s\", action, KnownActions())\n}", "title": "" }, { "docid": "f3f64fafb952fd7982ef4a8eedd62c18", "score": "0.4392436", "text": "func Execute() {\n\n\targuments := os.Args[1:]\n\t// arguments := strings.Split(\"get -c user.quote.yaml -s morningstarit:33\", \" \")\n\n\tvar (\n\t\tapp *simpleflag.App\n\t\tcfg *Config // TODO rename in appConfig\n\t\targs *appArgs\n\t)\n\n\targs = &appArgs{}\n\n\tapp = initApp(args)\n\n\t// NOTE: if app.Parse ha success, as a side effect\n\t// the args struct is initialized\n\terr := app.Parse(arguments)\n\n\t// get configuration\n\tif err == nil {\n\t\tcfg, err = GetConfig(args, quote.Sources())\n\t}\n\n\tif err == nil {\n\t\tswitch app.CommandName() {\n\t\tcase \"get\":\n\t\t\terr = execGet(args, cfg)\n\t\tcase \"tor\":\n\t\t\terr = execTor(args, cfg)\n\t\tcase \"sources\":\n\t\t\terr = execSources(args, cfg)\n\t\t}\n\t}\n\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "14a49ab49ba1d5d79d57019f3898cfa6", "score": "0.4392347", "text": "func runCommand_alias(args []string, aliases map[string]string) error {\n\tif len(args) >= 2 {\n\t\t// TODO: Validate mac address\n\t\talias, mac := args[0], args[1]\n\t\taliases[alias] = mac\n\t\treturn flushUserAliases(aliases)\n\t}\n\treturn errors.New(\"alias command requires a <name> and a <mac>\")\n}", "title": "" }, { "docid": "d54a22840e7e587dfddf39bc9a44b488", "score": "0.43878892", "text": "func RunCmd(cmd []string, env map[string]string) int {\n\n\tfor k, v := range env {\n\t\tfmt.Printf(\"key: %s, value: %s,\\n\", k, v)\n\t}\n\n\tcmdRun := exec.Command(cmd[0], cmd[1:]...)\n\n\tfor k, v := range env {\n\t\tos.Setenv(k, v)\n\t}\n\n\tcmdOut, err := cmdRun.CombinedOutput()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn 1\n\t}\n\tfmt.Println(string(cmdOut))\n\treturn 0\n}", "title": "" }, { "docid": "60f0f78429a1c2e895b208e4179606a3", "score": "0.43858278", "text": "func main() {\n\n\tif len(os.Args) != 2 {\n\t\tlog.Fatal(\"wrong args nbr\")\n\t} else if os.Args[1] == \"-h\" {\n\t\tprintHelp()\n\t\tos.Exit(0)\n\t}\n\n\tmyMap := getArg()\n\tmyMap = reHeading(myMap)\n\toriMap := strings.Split(myMap, \"\\n\")\n\tmyMap = parsing(myMap)\n\tmyMapS := strings.Split(myMap, \"\\n\")\n\tmyMapS = monitoring(myMapS, oriMap)\n}", "title": "" }, { "docid": "aa6ce2a3ea0090759f8b1e9a45576173", "score": "0.4382125", "text": "func (cmd Command) Execute(args []string) {\n\tregs, err := helpers.GetLocalRegisters()\n\tif regs == nil && err != nil {\n\t\tpanic(err)\n\t}\n\thelpers.PrintRegisters(regs)\n\n\tif len(*cmd.outputFile) > 0 {\n\t\tb, err := json.Marshal(regs)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"failed to marshal registers into json, err: %v\", err))\n\t\t}\n\t\terr = ioutil.WriteFile(*cmd.outputFile, b, 0666)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"failed to write data to file %s, err: %v\", *cmd.outputFile, err))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "42450d9e999713d66e543cd1762a2a59", "score": "0.4381611", "text": "func FlagSetApplyFromAction(action interface{}, flagSet *flag.FlagSet, parentCommand string) {\n\tcliApp := cmd.Shell{}\n\tapp := cmd.NewApp(&cliApp)\n\n\tfoundName := parentCommand == \"\"\n\tactionFuncName := getFuncName(action)\n\n\tfor _, command := range app.Commands {\n\t\tflags := recursiveFindFlagsWithName(actionFuncName, command, parentCommand, foundName)\n\n\t\tif flags != nil {\n\t\t\tfor _, flag := range flags {\n\t\t\t\tflag.Apply(flagSet)\n\t\t\t}\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "4ffc7228ef95212d1e309921362eac35", "score": "0.43776762", "text": "func (t DotNetCoreEnvVersions) Execute(options tasks.Options, upstream map[string]tasks.Result) tasks.Result {\n\n\tif upstream[\"Base/Env/CollectEnvVars\"].Status != tasks.Info {\n\t\treturn tasks.Result{\n\t\t\tStatus: tasks.None,\n\t\t\tSummary: \"No environment variables found. This task did not run\",\n\t\t}\n\t}\n\n\t// Gather env variables from upstream\n\tenvVars, ok := upstream[\"Base/Env/CollectEnvVars\"].Payload.(map[string]string) //This is a type assertion to cast my upstream results back into data I know the structure of and can now work with. In this case, I'm casting it back to the map[string]string I know it should return\n\tif !ok {\n\t\treturn tasks.Result{\n\t\t\tStatus: tasks.Error,\n\t\t\tSummary: tasks.AssertionErrorSummary,\n\t\t}\n\t}\n\tversions, errorMessage := checkVersions(envVars)\n\n\tif len(versions) < 1 {\n\t\treturn tasks.Result{\n\t\t\tStatus: tasks.Error,\n\t\t\tSummary: errorMessage,\n\t\t}\n\t}\n\treturn tasks.Result{\n\t\tStatus: tasks.Info,\n\t\tSummary: strings.Join(versions, \", \"),\n\t\tPayload: versions,\n\t}\n}", "title": "" }, { "docid": "372585e74d7123bee69f154032c93a19", "score": "0.43732175", "text": "func Run(tab map[string]common.AppletFunc, args []string) int {\n\n\tflagSet := flag.NewFlagSet(\"printenv\", flag.ContinueOnError)\n\thelp := flagSet.Bool(\"h\", false, \"Show command-line help\")\n\n\tif err := flagSet.Parse(args); err != nil {\n\t\tusage(flagSet)\n\t\treturn 1 // exit status\n\t}\n\n\tif *help {\n\t\tusage(flagSet)\n\t\treturn 2 // exit status\n\t}\n\n\tif flagSet.NArg() < 1 {\n\t\tfor _, e := range os.Environ() {\n\t\t\tfmt.Println(e)\n\t\t}\n\t\treturn 0 // exit status\n\t}\n\n\tvar status int\n\n\tfor _, v := range flagSet.Args() {\n\t\tvv := os.Getenv(v)\n\t\tif vv == \"\" {\n\t\t\tstatus = 3\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Println(vv)\n\t}\n\n\treturn status // exit status\n}", "title": "" }, { "docid": "7c5fa7d84fca4cd6a4666a5af48d6308", "score": "0.43712384", "text": "func (e *EnvTest) Apply(envVars map[string]string) {\n\tfor key, value := range envVars {\n\t\tif !e.isManagedKey(key) {\n\t\t\tpanic(fmt.Sprintf(\"Unauthorized action, the env var %s is not managed.\", key))\n\t\t}\n\n\t\tif value == \"\" {\n\t\t\tos.Unsetenv(key)\n\t\t} else {\n\t\t\tos.Setenv(key, value)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4b3edd9144710bc859e41055eecc76b2", "score": "0.43701458", "text": "func (a *setupAction) Execute(ctx node.Context) error {\n\troster, err := a.readMembers(ctx)\n\tif err != nil {\n\t\treturn xerrors.Errorf(\"failed to read roster: %v\", err)\n\t}\n\n\tvar actor dkg.Actor\n\terr = ctx.Injector.Resolve(&actor)\n\tif err != nil {\n\t\treturn xerrors.Errorf(\"failed to resolve actor: %v\", err)\n\t}\n\n\tpubkey, err := actor.Setup(roster, roster.Len())\n\tif err != nil {\n\t\treturn xerrors.Errorf(\"failed to setup DKG: %v\", err)\n\t}\n\n\tpubkeyBuf, err := pubkey.MarshalBinary()\n\tif err != nil {\n\t\treturn xerrors.Errorf(\"failed to encode pubkey: %v\", err)\n\t}\n\n\tdela.Logger.Info().\n\t\tHex(\"DKG public key\", pubkeyBuf).\n\t\tMsg(\"DKG public key\")\n\n\treturn nil\n}", "title": "" }, { "docid": "60c2c835bb9d806ba4367945b3d3fb6c", "score": "0.43670303", "text": "func (action *GetAction) Run(\n\tctx context.Context,\n\tlogger lager.Logger,\n\trepository *worker.ArtifactRepository,\n) error {\n\tversion, err := action.VersionSource.GetVersion()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsource, err := action.Source.Evaluate()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tparams, err := action.Params.Evaluate()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresourceCache, err := action.dbResourceCacheFactory.FindOrCreateResourceCache(\n\t\tlogger,\n\t\tdb.ForBuild(action.buildID),\n\t\taction.Type,\n\t\tversion,\n\t\tsource,\n\t\tparams,\n\t\taction.resourceTypes,\n\t)\n\tif err != nil {\n\t\tlogger.Error(\"failed-to-create-resource-cache\", err)\n\t\treturn err\n\t}\n\n\tresourceInstance := resource.NewResourceInstance(\n\t\tresource.ResourceType(action.Type),\n\t\tversion,\n\t\tsource,\n\t\tparams,\n\t\taction.resourceTypes,\n\t\tresourceCache,\n\t\tdb.NewBuildStepContainerOwner(action.buildID, action.planID),\n\t)\n\n\tversionedSource, err := action.resourceFetcher.Fetch(\n\t\tctx,\n\t\tlogger,\n\t\tresource.Session{\n\t\t\tMetadata: action.containerMetadata,\n\t\t},\n\t\taction.Tags,\n\t\taction.teamID,\n\t\taction.resourceTypes,\n\t\tresourceInstance,\n\t\taction.stepMetadata,\n\t\taction.buildStepDelegate,\n\t)\n\tif err != nil {\n\t\tlogger.Error(\"failed-to-fetch-resource\", err)\n\t\tif err, ok := err.(resource.ErrResourceScriptFailed); ok {\n\t\t\taction.exitStatus = ExitStatus(err.ExitStatus)\n\t\t\treturn nil\n\t\t}\n\n\t\treturn err\n\t}\n\n\tfor _, outputName := range action.Outputs {\n\t\trepository.RegisterSource(worker.ArtifactName(outputName), &getArtifactSource{\n\t\t\tlogger: logger,\n\t\t\tresourceInstance: resourceInstance,\n\t\t\tversionedSource: versionedSource,\n\t\t})\n\t}\n\n\taction.versionInfo = VersionInfo{\n\t\tVersion: versionedSource.Version(),\n\t\tMetadata: versionedSource.Metadata(),\n\t}\n\taction.exitStatus = ExitStatus(0)\n\n\treturn nil\n}", "title": "" }, { "docid": "05227ad221c8f3bcb275448b9ff11b8e", "score": "0.4363657", "text": "func (st *State) Execute(key int, value []byte) bool {\n\tvaluePlaintext := string(value)\n\tvalueHashed := HashValue(valuePlaintext)\n\tvalueArr := &CommandJSON{\n\t\tValuePlainText: valuePlaintext,\n\t\tValueHashed: valueHashed}\n\tvalueJSON, _ := json.Marshal(valueArr)\n\t_, loaded := st.Map.LoadOrStore(key, valueJSON)\n\treturn !loaded\n}", "title": "" }, { "docid": "5c6cd28d6f8f02ece9d0e4a70fa3cd47", "score": "0.43603805", "text": "func (e *Engine) ExecAction(ctx context.Context, actionKey ActionKey, opts map[string]string) (map[string]string, error) {\n\tif opts == nil {\n\t\topts = make(map[string]string)\n\t}\n\n\te.statsIncrActionCountAndLog(actionKey)\n\n\taction := actions[actionKey]\n\tst := clock.Now()\n\n\tlogEntry := &LogEntry{\n\t\tStartTime: st,\n\t\tEngineTimestamp: e.getTimestampS(),\n\t\tAction: actionKey,\n\t\tActionOpts: opts,\n\t}\n\n\t// Execute the action n times\n\terr := robustness.ErrNoOp // Default to no-op error\n\n\t// TODO: return more than the last output\n\tvar out map[string]string\n\n\tn := robustness.GetOptAsIntOrDefault(ActionRepeaterField, opts, defaultActionRepeats)\n\tfor i := 0; i < n; i++ {\n\t\tout, err = action.f(ctx, e, opts, logEntry)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// If error was just a no-op, don't bother logging the action\n\tswitch {\n\tcase errors.Is(err, robustness.ErrNoOp):\n\t\te.statsUpdateCounters(statsIncrNoOp)\n\n\t\treturn out, err\n\n\tcase err != nil:\n\t\tlog.Printf(\"error=%q\", err.Error())\n\t}\n\n\te.statsUpdatePerAction(actionKey, st, err)\n\te.logCompleted(logEntry, err)\n\n\treturn out, err\n}", "title": "" }, { "docid": "f155612c273ed11e01aafdaecab63d23", "score": "0.433942", "text": "func (a *exportInfoAction) Execute(ctx node.Context) error {\n\tvar m mino.Mino\n\terr := ctx.Injector.Resolve(&m)\n\tif err != nil {\n\t\treturn xerrors.Errorf(\"injector: %v\", err)\n\t}\n\n\taddr, err := m.GetAddress().MarshalText()\n\tif err != nil {\n\t\treturn xerrors.Errorf(\"failed to marshal address: %v\", err)\n\t}\n\tvar pubkey kyber.Point\n\n\terr = ctx.Injector.Resolve(&pubkey)\n\tif err != nil {\n\t\treturn xerrors.Errorf(\"injector: %v\", err)\n\t}\n\n\tpubkeyMarshalled, err := pubkey.MarshalBinary()\n\tif err != nil {\n\t\treturn xerrors.Errorf(\"failed to marshal public key: %v\", err)\n\t}\n\n\tdesc := base64.StdEncoding.EncodeToString(addr) + separator + base64.StdEncoding.EncodeToString(pubkeyMarshalled)\n\n\tfmt.Fprint(ctx.Out, desc)\n\n\treturn nil\n}", "title": "" }, { "docid": "3948f2d064f11b526a714ef53d8f3deb", "score": "0.43372208", "text": "func Execute() {\n\tvar contextInput, commandInput string\n\trt := runtime.GetRunTime()\n\tcommandMap := rt.GetCommandMap()\n\tconfigData := rt.GetConfig()\n\tcommandAccepted := false\n\tfor commandAccepted == false {\n\t\tcolor.Info.Println(\"Input the command context seperated by :\")\n\t\tfmt.Println(\" eg : (server:nginx:start)\")\n\t\tfmt.Print(\"> \")\n\t\tfmt.Scan(&contextInput)\n\t\tif _, found := commandMap[contextInput]; found {\n\t\t\tfmt.Println()\n\t\t\tcolor.Error.Println(\"Duplicate context !\")\n\t\t\tfmt.Println()\n\t\t} else {\n\t\t\tcommandAccepted = true\n\n\t\t}\n\t}\n\n\tfmt.Printf(\"Input the command you need to run for %s \", contextInput)\n\tfmt.Println()\n\tfmt.Print(\"> \")\n\tscanner := bufio.NewScanner(os.Stdin)\n\tscanner.Scan()\n\tcommandInput = scanner.Text()\n\n\tfmt.Println()\n\tfmt.Println()\n\tcolor.LightCyan.Println(\"Context : \" + contextInput)\n\tfmt.Println()\n\tcolor.LightCyan.Println(\"Command : \" + commandInput)\n\tfmt.Println()\n\tfmt.Println()\n\tcolor.Info.Print(\" > Are you sure to add this [Y/n] ? \")\n\tvar proceed = \"y\"\n\tfmt.Scan(&proceed)\n\tif strings.ToLower(proceed) != \"y\" {\n\t\tcommandAccepted = false\n\t}\n\n\tif commandAccepted {\n\t\tnewCommand := types.Command{\n\t\t\tContext: contextInput + \":\",\n\t\t\tProgram: commandInput,\n\t\t}\n\t\tconfigData.Commands = append(configData.Commands, newCommand)\n\t\tconfig.WriteConfig(configData)\n\t\tfmt.Println()\n\t\tfmt.Println()\n\t\tcolor.Info.Tips(\"Added new command\")\n\t} else {\n\t\tcolor.Magenta.Println(\"No changes have been made\")\n\t}\n\n}", "title": "" }, { "docid": "74b75449b9eb7c25faf43b0c0b17b25f", "score": "0.4331469", "text": "func executeCommand(cx *cli.Context, action func(*cli.Context) error) {\n\tif cx.GlobalBool(\"verbose\") {\n\t\tlog.SetLevel(log.DebugLevel)\n\t}\n\t// step: ensure we capture any panics\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tprintUsage(fmt.Sprintf(\"%s\", r))\n\t\t}\n\t}()\n\tif err := action(cx); err != nil {\n\t\tprintUsage(err.Error())\n\t}\n}", "title": "" }, { "docid": "cb8b90d37f42f40d25f3f02eeae9f8ad", "score": "0.43268755", "text": "func (cmd *MemdCommandGet) Execute(app *App, w io.Writer) error {\n\tvalues := make([]string, len(cmd.Keys))\n\tfor i := range cmd.Keys {\n\t\tvalues[i] = xid.New().String()\n\t}\n\n\t// WriteTo writes content of MemdValue to io.Writer.\n\t// Its format is compatible to memcached protocol.\n\tfor i, key := range cmd.Keys {\n\t\tw.Write(memdValHeader)\n\t\tio.WriteString(w, key)\n\t\tw.Write(memdSpc)\n\t\tio.WriteString(w, strconv.Itoa(0)) // flag\n\t\tw.Write(memdSpc)\n\t\tio.WriteString(w, strconv.Itoa(len(values[i])))\n\t\tw.Write(memdSep)\n\t\tio.WriteString(w, values[i])\n\t\tw.Write(memdSep)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d846870b18eda9f7b6c06ec634485bcf", "score": "0.43237543", "text": "func RunExecD(execDMap map[string]ExecD, options ...Option) {\n\tconfig := Config{\n\t\targuments: os.Args,\n\t\texecdWriter: internal.NewExecDWriter(),\n\t\texitHandler: internal.NewExitHandler(),\n\t}\n\n\tfor _, option := range options {\n\t\tconfig = option(config)\n\t}\n\n\tif len(config.arguments) == 0 {\n\t\tconfig.exitHandler.Error(fmt.Errorf(\"expected command name\"))\n\n\t\treturn\n\t}\n\n\tc := filepath.Base(config.arguments[0])\n\te, ok := execDMap[c]\n\tif !ok {\n\t\tconfig.exitHandler.Error(fmt.Errorf(\"unsupported command %s\", c))\n\t\treturn\n\t}\n\n\tr, err := e.Execute()\n\tif err != nil {\n\t\tconfig.exitHandler.Error(err)\n\t\treturn\n\t}\n\n\tif err := config.execdWriter.Write(r); err != nil {\n\t\tconfig.exitHandler.Error(err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "9712f55f5b753eab42551e17b2141b24", "score": "0.4323476", "text": "func processOutputs(ctx context.Context, outputsRef *swarmingAPI.SwarmingRpcsFilesRef, testIDPrefix string, inv *pb.Invocation, req *pb.DeriveInvocationRequest) (results []*pb.TestResult, err error) {\n\tisoClient := isolatedclient.New(\n\t\tnil, internal.HTTPClient(ctx), outputsRef.Isolatedserver, outputsRef.Namespace, nil, nil)\n\n\t// Get the isolated outputs.\n\toutputs, err := GetOutputs(ctx, isoClient, outputsRef)\n\tif err != nil {\n\t\treturn nil, errors.Annotate(err, \"getting isolated outputs\").Err()\n\t}\n\n\t// Fetch the output.json file itself and convert it.\n\toutputJSON, err := FetchOutputJSON(ctx, isoClient, outputs)\n\tif err != nil {\n\t\treturn nil, errors.Annotate(err, \"getting output JSON file\").Err()\n\t}\n\n\t// Convert the isolated.File outputs to pb.Artifacts for later processing.\n\toutputArtifacts := make(map[string]*pb.Artifact, len(outputs))\n\tfor path, f := range outputs {\n\t\tart := util.IsolatedFileToArtifact(\n\t\t\toutputsRef.Isolatedserver, outputsRef.Namespace, path, &f)\n\t\tif art == nil {\n\t\t\tlogging.Warningf(ctx, \"Could not process artifact %q\", path)\n\t\t}\n\n\t\toutputArtifacts[util.NormalizeIsolatedPath(path)] = art\n\t}\n\n\t// Convert the output JSON.\n\tif results, err = ConvertOutputJSON(ctx, inv, testIDPrefix, outputJSON, outputArtifacts); err != nil {\n\t\treturn nil, attachInvalidTaskf(err, \"invalid output: %s\", err)\n\t}\n\n\t// TODO(crbug/1032779): Mark artifacts we know we may not process.\n\t// TODO(crbug/1032779): Mark artifacts that have been processed.\n\n\treturn results, nil\n}", "title": "" }, { "docid": "920a81a8e9f1730a9acae3b259e8036c", "score": "0.43070188", "text": "func Run(\n\ts Scope,\n\tm Actionable,\n) error {\n\ttype behavior interface {\n\t\tdo(Scope) error\n\t}\n\n\tfor _, act := range m.GetActions() {\n\t\tif err := act.GetBehavior().(behavior).do(s); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e04618c8ad2e57c2503638d7d1b27aa3", "score": "0.4297247", "text": "func run() error {\n\t// use GOPACKAGE (set by go generate) as default package name if available\n\tpkg := os.Getenv(\"GOPACKAGE\")\n\tif pkg == \"\" {\n\t\tpkg = \"main\"\n\t}\n\n\tvar out, prefix string\n\tfs := flag.NewFlagSet(\"bindata\", flag.ExitOnError)\n\tfs.StringVar(&out, \"o\", \"\", \"output file (default: stdout)\")\n\tfs.StringVar(&vars.Pkg, \"p\", pkg, \"name of the package\")\n\tfs.StringVar(&vars.Map, \"m\", \"bindata\", \"name of the map variable\")\n\tfs.StringVar(&prefix, \"r\", \"\", \"root path for map keys\")\n\tfs.BoolVar(&vars.AsString, \"s\", false, \"save data as strings\")\n\tif err := fs.Parse(os.Args[1:]); err != nil {\n\t\treturn err\n\t}\n\n\tvars.Files = make(map[string]fmt.Formatter)\n\tfor _, path := range fs.Args() {\n\t\tif err := AddPath(path, prefix); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvar file *os.File\n\tif out != \"\" {\n\t\tvar err error\n\t\tif file, err = os.Create(out); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tfile = os.Stdout\n\t}\n\n\treturn tmpl.Execute(file, vars)\n}", "title": "" }, { "docid": "d2fe365d667c557f293f08ba3765a541", "score": "0.42962247", "text": "func (a *CreateUpdateNodePoolStackAction) ExecuteAction(input interface{}) (output interface{}, err error) {\n\n\terrorChan := make(chan error, len(a.nodePools))\n\tdefer close(errorChan)\n\n\tfor _, nodePool := range a.nodePools {\n\t\tgo a.createUpdateNodePool(nodePool, errorChan)\n\t}\n\n\tvar errs []error\n\t// wait for goroutines to finish\n\tfor i := 0; i < len(a.nodePools); i++ {\n\t\terrs = append(errs, <-errorChan)\n\t}\n\n\treturn nil, errors.Combine(errs...)\n}", "title": "" }, { "docid": "8b8d94ff83935f9646cb7fe37588c776", "score": "0.42952275", "text": "func Run(serviceName string, action ActionType) error {\n\tif !checkSafe(action) {\n\t\treturn ErrNotSupportAction\n\t}\n\tcmd := exec.Command(\"systemctl\", string(action), serviceName)\n\treturn cmd.Run()\n}", "title": "" }, { "docid": "58276b5c82d4b937a40c90e6a9d522d4", "score": "0.42781812", "text": "func (c *Client) doKeysAction(ctx context.Context, id string, action string, keysActionReq *KeysActionRequest) (*KeysActionRequest, error) {\n\tkeyActionRsp := KeysActionRequest{}\n\n\tv := url.Values{}\n\tv.Set(\"action\", action)\n\n\treq, err := c.newRequest(\"POST\", fmt.Sprintf(\"keys/%s\", id), keysActionReq)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.URL.RawQuery = v.Encode()\n\n\t_, err = c.do(ctx, req, &keyActionRsp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &keyActionRsp, nil\n}", "title": "" }, { "docid": "f67e3a84719fec1f4769522772c7a39b", "score": "0.4277871", "text": "func runCommand(keys string, aws, azu, azuR, gcp bool, filenames []string) error {\n\tm := initServices(keys, aws, azu, azuR, gcp)\n\n\twd, err := os.Getwd()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tstdout := log.New(os.Stdout, \"\", 0)\n\tstderr := log.New(os.Stderr, \"\", 0)\n\n\terrs := make([]error, 0)\n\tfor _, filename := range filenames {\n\t\tif err := runOCR(filename, wd, stdout, stderr, m); err != nil {\n\t\t\terrs = append(errs, err)\n\t\t}\n\t}\n\n\tif len(errs) > 0 {\n\t\tallErr := errs[0]\n\t\tfor err := range errs[1:] {\n\t\t\tallErr = fmt.Errorf(\"%v\\n\\n%v\", allErr, err)\n\t\t}\n\t\treturn allErr\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "31e7da197055d2c7b893d56c07c3e7b7", "score": "0.4274043", "text": "func (c *consensus) executeCommand(cmd interface{} ) (*Result , error){\n\tinCmd, ok := cmd.(Command)\n\tif ok == false {\n\t\tif LOG >= INFO {\n\t\t\tc.logger.Printf(\"Raft %v : Command format not supported\\n\")\n\t\t}\n\t\terr := fmt.Errorf(\"Command Format not supported\")\n\t\treturn nil, err\n\t} \n\t\n\tvar newCmd kvs.Command\n\t\n\tnewCmd.Cmd = inCmd.Cmd\n\tnewCmd.Key = inCmd.Key\n\tnewCmd.Value = inCmd.Value\n\t\n\tvalue, err := c.kvStore.ExecuteCommand(&newCmd)\n\t\n\tresult := Result {Error : err, Value : value}\n\t\n\treturn &result, err\n}", "title": "" }, { "docid": "0d4d326e4274d3d3a6773020ef713e96", "score": "0.42736036", "text": "func (m *TaskGroupRunner) runOutput(values map[string]interface{}) (output []byte, err error) {\n\n\tif m.outputTask == nil || len(m.outputTask.Spec.Task) == 0 {\n\t\t// nothing needs to be done\n\t\treturn\n\t}\n\n\tte, err := newExecutor(m.outputTask, values)\n\tif err != nil {\n\t\treturn\n\t}\n\n\toutput, err = te.Output()\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"failed to execute output task:\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "7b7b0593cc513d3242c3551bad579626", "score": "0.42699635", "text": "func RunCommand(cmd []string, env map[string]string) int {\n\tenvStrings := make([]string, 0, len(env))\n\tfor key, val := range env {\n\t\tenvStrings = append(envStrings, fmt.Sprintf(\"%s=%s\", key, val))\n\t}\n\n\tcommand := exec.Command(cmd[0], cmd[1:]...)\n\tcommand.Env = envStrings\n\tcommand.Stdout = os.Stdout\n\n\tif command.Run() != nil {\n\t\treturn 1\n\t}\n\n\treturn 0\n}", "title": "" }, { "docid": "6987959ab3d86cb30858135038190383", "score": "0.42680174", "text": "func (handler TestRunnerCommand) Action(c *cli.Context) error {\n\tpath := c.Args().Get(0)\n\n\tif c.Bool(\"discover\") {\n\t\thandler.service.DiscoverTests(path)\n\t} else {\n\t\twatch := c.Bool(\"watch\")\n\t\t// args []string\n\t\targs := []string{}\n\t\tif c.Args().Len() > 1 {\n\t\t\targs = c.Args().Slice()[1:]\n\t\t}\n\n\t\terr := handler.service.RunTests(path, watch, args)\n\n\t\tif err != nil {\n\t\t\t// Exit code will be printed with the same message so we can return\n\t\t\t// an empty value\n\t\t\treturn cli.Exit(\"\", 1)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2eb3cb15565c08d203baa5cee74673fb", "score": "0.42623574", "text": "func actionMain(flags *flag.FlagSet, args []string) error {\n\tvar name string\n\tflags.StringVar(&name, \"name\", \"motemen\", \"hello!\")\n\n\tflags.Parse(args)\n\tlog.Printf(\"hello! %s :bow:\\n\", name)\n\treturn nil\n}", "title": "" }, { "docid": "38057a4be58dfb3c37cd81b92483f2c3", "score": "0.425799", "text": "func (t *AlfredScriptFilterTranslator) Execute(w io.Writer, s Storage, list string, key string, value string) {\n\tfmt.Fprintf(w, \"<item uid=\\\"%s:%s:%s\\\" arg=\\\"%s %s\\\">\\n\", list, key, value, list, key)\n\tfmt.Fprintf(w, \"<title>%s</title>\\n\", key)\n\tfmt.Fprintf(w, \"<subtitle>%s</subtitle>\\n\", value)\n\tfmt.Fprintf(w, \"<icon type=\\\"fileicon\\\">alfredhat.png</icon>\\n\")\n\tfmt.Fprint(w, \"</item>\\n\")\n}", "title": "" }, { "docid": "c7d70f7a62344239a4a6d2cc174e0547", "score": "0.42570546", "text": "func (m *TaskGroupRunner) runOutput(values map[string]interface{}) (output []byte, err error) {\n\tif len(m.outputTaskSpec.taskYml) == 0 {\n\t\tglog.Warningf(\"did not run output: empty output task was provided\")\n\t\treturn\n\t}\n\n\tte, err := newTaskExecutor(m.outputTaskSpec.identity, m.outputTaskSpec.metaTaskYml, m.outputTaskSpec.taskYml, values)\n\tif err != nil {\n\t\treturn\n\t}\n\n\toutput, err = te.Output()\n\treturn\n}", "title": "" }, { "docid": "8c7a06a426d55decb24fb1997257e849", "score": "0.4256954", "text": "func execSet(_ int, p *gop.Context) {\n\targs := p.GetArgs(2)\n\tret := flag.Set(args[0].(string), args[1].(string))\n\tp.Ret(2, ret)\n}", "title": "" }, { "docid": "f58ba0dd9516875545b7a4e6a1e57d61", "score": "0.42528304", "text": "func processArgs(args []string) {\n\tif len(args) < 1 {\n\t\tfmt.Println(\"Invalid command\")\n\t}\n\n\t_, isSingleCmd := singleCmds[args[0]]\n\tif len(args) == 1 && !isSingleCmd {\n\t\texecFile(args[0])\n\t}\n\n\tif len(args) > 0 {\n\t\t_, isValidCmd := funcMapper[args[0]]\n\t\tif !isValidCmd {\n\t\t\tfmt.Println(\"Unknown command\")\n\t\t\treturn\n\t\t}\n\t\tCallRespFunc(args, funcMapper[args[0]])\n\t}\n}", "title": "" }, { "docid": "46cf1b2e25fad266f9acef2364e92def", "score": "0.4246555", "text": "func (r FakeRunner) Run() (string, error) {\n\tcmd := strings.Join(r.args, \" \")\n\treturn KubectlResponse[cmd], nil\n}", "title": "" }, { "docid": "85928a59c1cb89169b30f42653b6bcd2", "score": "0.42430827", "text": "func ChassisExecuteActions(c *gin.Context) {\n\thost := c.Param(\"host\")\n\tif host == \"\" {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"message\": fmt.Sprintf(\"invalid host: %s\", host)})\n\t\treturn\n\t}\n\n\tbmc, err := connectToChassis(viper.GetString(\"bmc_user\"), viper.GetString(\"bmc_pass\"), host)\n\tif err != nil {\n\t\tc.JSON(http.StatusPreconditionFailed, gin.H{\"message\": err.Error()})\n\t\treturn\n\t}\n\tdefer bmc.Close()\n\n\tjson := &Request{}\n\tvar response []gin.H\n\tif err := c.ShouldBindJSON(json); err == nil {\n\t\tfor _, action := range json.ActionSequence {\n\t\t\tif strings.HasPrefix(action, \"sleep\") {\n\t\t\t\terr := actions.Sleep(action)\n\t\t\t\tif err != nil {\n\t\t\t\t\tresponse = append(response, gin.H{\"action\": action, \"status\": false, \"error\": err.Error()})\n\t\t\t\t\tc.JSON(http.StatusExpectationFailed, response)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tresponse = append(response, gin.H{\"action\": action, \"status\": true, \"message\": \"ok\"})\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tvar status bool\n\t\t\tswitch action {\n\t\t\tcase actions.PowerCycle:\n\t\t\t\tstatus, err = bmc.PowerCycle()\n\t\t\tcase actions.PowerOn:\n\t\t\t\tstatus, err = bmc.PowerOn()\n\t\t\tdefault:\n\t\t\t\tresponse = append(response, gin.H{\"action\": action, \"error\": \"unknown action\"})\n\t\t\t\tc.JSON(http.StatusBadRequest, response)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\tresponse = append(response, gin.H{\"action\": action, \"status\": status, \"error\": err.Error()})\n\t\t\t\tc.JSON(http.StatusExpectationFailed, response)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tresponse = append(response, gin.H{\"action\": action, \"status\": status, \"message\": \"ok\"})\n\t\t}\n\t} else {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, response)\n}", "title": "" }, { "docid": "e7232e0e760fbb4dfcc9dfce64cf6b85", "score": "0.4242098", "text": "func (watcher *Watcher) Execute() error {\n\tcontext, err := watcher.client.GetMaps(watcher.prefix, watcher.context, true)\n\tif err != nil {\n\t\twatcher.logger.Error(\"%s failed to retrieve context: %s\", watcher.Name(), err)\n\t\treturn err\n\t}\n\n\twatcher.logger.Debug(\"context: %v\\n\", context)\n\tchanged := true\n\tif watcher.renderer != nil {\n\t\tchanged, err = watcher.renderer.Render(context)\n\t\tif err != nil {\n\t\t\twatcher.logger.Error(\"%s failed to render: %s\", watcher.Name(), err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif changed {\n\t\terr = watcher.runCommand()\n\t\tif err != nil {\n\t\t\twatcher.logger.Error(\"%s failed to run command: %s\", watcher.Name(), err)\n\t\t\treturn err\n\t\t}\n\t\twatcher.logger.Info(\"%s executed\", watcher.Name())\n\t} else {\n\t\twatcher.logger.Info(\"%s skipped execution\", watcher.Name())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9e0745d87ce1bb0e58072e654532b20c", "score": "0.42412364", "text": "func (ps *ParamSet) Run() error {\n\tvalue, err := params.DecodeValue(ps.rawValue)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"value is invalid\")\n\t}\n\n\tif ps.envName != \"\" {\n\t\tif ps.name != \"\" {\n\t\t\treturn ps.setEnvFn(ps.app, ps.envName, ps.name, ps.rawPath, ps.rawValue)\n\t\t}\n\t\treturn ps.setGlobalEnvFn(ps.app, ps.envName, ps.rawPath, ps.rawValue)\n\t}\n\n\tpath := strings.Split(ps.rawPath, \".\")\n\n\tif ps.global {\n\t\treturn ps.setGlobal(path, value)\n\t}\n\n\treturn ps.setLocal(path, value)\n}", "title": "" }, { "docid": "82abe1ebadb85b66254a6e4bf4f1943f", "score": "0.42374083", "text": "func executeTransition(p *Plugin, c *plugin.Context, header *model.CommandArgs, args ...string) *model.CommandResponse {\n\tinstanceURL, args, err := p.parseCommandFlagInstanceURL(args)\n\tif err != nil {\n\t\treturn p.responsef(header, \"Failed to load your connection to Jira. Error: %v.\", err)\n\t}\n\tif len(args) < 2 {\n\t\treturn p.help(header)\n\t}\n\tissueKey := strings.ToUpper(args[0])\n\ttoState := strings.Join(args[1:], \" \")\n\tmattermostUserID := types.ID(header.UserId)\n\n\t_, instanceID, err := p.ResolveUserInstanceURL(mattermostUserID, instanceURL)\n\tif err != nil {\n\t\treturn p.responsef(header, \"Failed to identify Jira instance %s. Error: %v.\", instanceURL, err)\n\t}\n\n\tmsg, err := p.TransitionIssue(&InTransitionIssue{\n\t\tInstanceID: instanceID,\n\t\tmattermostUserID: mattermostUserID,\n\t\tIssueKey: issueKey,\n\t\tToState: toState,\n\t})\n\tif err != nil {\n\t\treturn p.responsef(header, err.Error())\n\t}\n\n\treturn p.responsef(header, msg)\n}", "title": "" }, { "docid": "61ab85d5c2acf517eaa38ca5a6e76e1c", "score": "0.4235952", "text": "func (c *Command) doExecute(args []string) (err error) {\n\t// collect and binding named argument\n\tDebugf(\"cmd: %s - collect and binding named argument\", c.Name)\n\tif err := c.ParseArgs(args); err != nil {\n\t\tc.Fire(EvtCmdRunError, err)\n\t\tLogf(VerbCrazy, \"binding command '%s' arguments err: <red>%s</>\", c.Name, err.Error())\n\t\treturn err\n\t}\n\n\tc.Fire(EvtCmdRunBefore, args)\n\n\t// do call command handler func\n\tif c.Func == nil {\n\t\tLogf(VerbWarn, \"the command '%s' no handler func to running\", c.Name)\n\t} else {\n\t\t// err := c.Func.Run(c, args)\n\t\terr = c.Func(c, args)\n\t}\n\n\tif err != nil {\n\t\tc.Fire(EvtCmdRunError, err)\n\t} else {\n\t\tc.Fire(EvtCmdRunAfter, nil)\n\t}\n\treturn\n}", "title": "" }, { "docid": "7ceda1e60c0f1d1e038a74d5d8623d98", "score": "0.42346573", "text": "func parseAction(args []string) Action {\n\tif len(args) < 2 {\n\t\tfmt.Println(\"run or solve subcommand required\")\n\t\tos.Exit(1)\n\t}\n\tswitch args[1] {\n\tcase \"run\":\n\t\tfmt.Println(\"Running Project Euler problems ...\")\n\t\treturn RUN\n\tcase \"solve\":\n\t\tfmt.Println(\"Solving Project Euler problems ...\")\n\t\treturn SOLVE\n\tdefault:\n\t\tfmt.Printf(\"unknown subcommand: %s\", os.Args[1])\n\t\tos.Exit(1)\n\t}\n\treturn SOLVE\n}", "title": "" }, { "docid": "465aa6af27707982c6a3f2551e534761", "score": "0.42325506", "text": "func (a *API) doKeysAction(ctx context.Context, id *string, action string, keysActionReq *KeysActionRequest) (*KeysActionRequest, error) {\n\tkeyActionRsp := KeysActionRequest{}\n\n\tv := url.Values{}\n\tv.Set(\"action\", action)\n\n\terr := a.doHTTPRequest(ctx, \"POST\", keysBase, id, v, nil, keysActionReq, &keyActionRsp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &keyActionRsp, nil\n}", "title": "" }, { "docid": "ef90d628be57490a60f8a23ee206560f", "score": "0.42289677", "text": "func ChassisBladeExecuteActionsByPosition(c *gin.Context) {\n\thost := c.Param(\"host\")\n\tif host == \"\" {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"message\": fmt.Sprintf(\"invalid host: %s\", host)})\n\n\t\treturn\n\t}\n\n\tposString := c.Param(\"pos\")\n\tpos, err := strconv.Atoi(posString)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"message\": fmt.Sprintf(\"invalid position: %s\", posString)})\n\t\treturn\n\t}\n\n\tbmc, err := connectToChassis(viper.GetString(\"bmc_user\"), viper.GetString(\"bmc_pass\"), host)\n\tif err != nil {\n\t\tc.JSON(http.StatusPreconditionFailed, gin.H{\"message\": err.Error()})\n\t\treturn\n\t}\n\tdefer bmc.Close()\n\n\tjson := &Request{}\n\tvar response []gin.H\n\tif err := c.ShouldBindJSON(json); err == nil {\n\t\tfor _, action := range json.ActionSequence {\n\t\t\tif strings.HasPrefix(action, \"sleep\") {\n\t\t\t\terr := actions.Sleep(action)\n\t\t\t\tif err != nil {\n\t\t\t\t\tresponse = append(response, gin.H{\"action\": action, \"status\": false, \"error\": err.Error()})\n\t\t\t\t\tc.JSON(http.StatusExpectationFailed, response)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tresponse = append(response, gin.H{\"action\": action, \"status\": true, \"message\": \"ok\"})\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tvar status bool\n\t\t\tswitch action {\n\t\t\tcase actions.PowerCycle:\n\t\t\t\tstatus, err = bmc.PowerCycleBlade(pos)\n\t\t\tcase actions.IsOn:\n\t\t\t\tstatus, err = bmc.IsOnBlade(pos)\n\t\t\tcase actions.PxeOnce:\n\t\t\t\tstatus, err = bmc.PxeOnceBlade(pos)\n\t\t\tcase actions.PowerCycleBmc:\n\t\t\t\tstatus, err = bmc.PowerCycleBmcBlade(pos)\n\t\t\tcase actions.PowerOn:\n\t\t\t\tstatus, err = bmc.PowerOnBlade(pos)\n\t\t\tcase actions.PowerOff:\n\t\t\t\tstatus, err = bmc.PowerOffBlade(pos)\n\t\t\tcase actions.Reseat:\n\t\t\t\tstatus, err = bmc.ReseatBlade(pos)\n\t\t\tdefault:\n\t\t\t\tresponse = append(response, gin.H{\"action\": action, \"error\": \"unknown action\"})\n\t\t\t\tc.JSON(http.StatusBadRequest, response)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\tresponse = append(response, gin.H{\"action\": action, \"status\": status, \"error\": err.Error()})\n\t\t\t\tc.JSON(http.StatusExpectationFailed, response)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tresponse = append(response, gin.H{\"action\": action, \"status\": status, \"message\": \"ok\"})\n\t\t}\n\t} else {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, response)\n}", "title": "" }, { "docid": "861498295af6de1f3c0cdaf9908979e3", "score": "0.42279822", "text": "func Actions() *Command {\n\tcmd := &Command{\n\t\tCommand: &cobra.Command{\n\t\t\tUse: \"action\",\n\t\t\tShort: \"action commands\",\n\t\t\tLong: \"action is used to access action commands\",\n\t\t},\n\t\tDocCategories: []string{\"action\"},\n\t\tIsIndex: true,\n\t}\n\n\tCmdBuilder(cmd, RunCmdActionGet, \"get ACTIONID\", \"get action\", Writer,\n\t\taliasOpt(\"g\"), displayerType(&action{}), docCategories(\"action\"))\n\n\tcmdActionList := CmdBuilder(cmd, RunCmdActionList, \"list\", \"list actions\", Writer,\n\t\taliasOpt(\"ls\"), displayerType(&action{}), docCategories(\"action\"))\n\tAddStringFlag(cmdActionList, doit.ArgActionResourceType, \"\", \"Action resource type\")\n\tAddStringFlag(cmdActionList, doit.ArgActionRegion, \"\", \"Action region\")\n\tAddStringFlag(cmdActionList, doit.ArgActionAfter, \"\", \"Action completed after in RFC3339 format\")\n\tAddStringFlag(cmdActionList, doit.ArgActionBefore, \"\", \"Action completed before in RFC3339 format\")\n\tAddStringFlag(cmdActionList, doit.ArgActionStatus, \"\", \"Action status\")\n\tAddStringFlag(cmdActionList, doit.ArgActionType, \"\", \"Action type\")\n\n\tcmdActionWait := CmdBuilder(cmd, RunCmdActionWait, \"wait ACTIONID\", \"wait for action to complete\", Writer,\n\t\taliasOpt(\"w\"), displayerType(&action{}), docCategories(\"action\"))\n\tAddIntFlag(cmdActionWait, doit.ArgPollTime, 5, \"Re-poll time in seconds\")\n\n\treturn cmd\n}", "title": "" }, { "docid": "b1d145b8a6aceb717d2b859211ec83a7", "score": "0.42208272", "text": "func (c *injectCommand) Run(debugger util.ECALDebugger, args []string) (interface{}, error) {\n\tif len(args) < 3 {\n\t\treturn nil, fmt.Errorf(\"Need a thread ID, a variable name and an expression\")\n\t}\n\n\tthreadID, err := c.AssertNumParam(1, args[0])\n\n\tif err == nil {\n\t\tvarName := args[1]\n\t\texpression := strings.Join(args[2:], \" \")\n\n\t\terr = debugger.InjectValue(threadID, varName, expression)\n\t}\n\n\treturn nil, err\n}", "title": "" }, { "docid": "ea899c91b559ccd3f7541c436cbd6a7c", "score": "0.42163098", "text": "func runCommand(stdout, stderr io.Writer, workingDirectory string, environmentVariables []string, command string, args ...string) {\n\n\t// Create the command\n\tcmdName := fmt.Sprintf(\"%s %s\", command, strings.Join(args, \" \"))\n\tcmd := exec.Command(command, args...)\n\n\t// Set the working directory\n\tcmd.Dir = workingDirectory\n\n\t// set environment variables\n\tcmd.Env = environmentVariables\n\n\t// Capture the output\n\tcmd.Stdout = stdout\n\tcmd.Stderr = stderr\n\n\tif *verboseFlagIsSet {\n\t\tlog.Printf(\"Running %s\", cmdName)\n\t}\n\n\t// execute the command\n\terr := cmd.Run()\n\tif err != nil {\n\t\tlog.Fatalf(\"Error running %s: %v\", cmdName, err)\n\t}\n}", "title": "" }, { "docid": "4e622a0695bb3b7067117a9310bdbde3", "score": "0.42157418", "text": "func (ExecuteAction) Params(h Hook, b *bolt.Bucket) map[string]string {\n\tm := make(map[string]string)\n\tfor _, k := range []string{\"command\"} {\n\t\tm[k] = string(b.Get([]byte(fmt.Sprintf(\"%s-%s\", h.ID, k))))\n\t}\n\treturn m\n}", "title": "" }, { "docid": "c5c49c3ad1687be82e121036a13f5221", "score": "0.42130962", "text": "func RunEditConfigMap(cmd *cobra.Command, f cmdutil.Factory, args []string, cmdOut, errOut io.Writer, options *resource.FilenameOptions) error {\n\tdataFile := cmdutil.GetFlagString(cmd, \"config-map-data\")\n\tif len(dataFile) == 0 {\n\t\t// We need to add the resource type back on to the front\n\t\targs = append([]string{\"configmap\"}, args...)\n\t\treturn RunEdit(f, cmdOut, errOut, cmd, args, options)\n\t}\n\tcmdNamespace, _, err := f.DefaultNamespace()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcs, err := f.ClientSet()\n\tif err != nil {\n\t\treturn err\n\t}\n\tconfigMap, err := cs.Core().ConfigMaps(cmdNamespace).Get(args[0], v1.GetOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvalue, found := configMap.Data[dataFile]\n\tif !found {\n\t\tkeys := []string{}\n\t\tfor key := range configMap.Data {\n\t\t\tkeys = append(keys, key)\n\t\t}\n\t\treturn fmt.Errorf(\"No such data file (%s), filenames are: %v\\n\", dataFile, keys)\n\t}\n\tedit := editor.NewDefaultEditor(os.Environ())\n\tdata, file, err := edit.LaunchTempFile(fmt.Sprintf(\"%s-edit-\", dataFile), \"\", bytes.NewBuffer([]byte(value)))\n\tdefer func() {\n\t\tos.Remove(file)\n\t}()\n\tif err != nil {\n\t\treturn err\n\t}\n\tconfigMap.Data[dataFile] = string(data)\n\n\tif _, err := cs.Core().ConfigMaps(cmdNamespace).Update(configMap); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" } ]
38b2ff5b2773ef70655e5be06c53a212
WriteOne adds an item to the end of the buffer, growing it if it is full.
[ { "docid": "c6b2f8221daf8ab8ccb68fe11de3fc93", "score": "0.7674273", "text": "func (r *RingGrowing) WriteOne(data interface{}) {\n\tif r.readable == r.n {\n\t\t// Time to grow\n\t\tnewN := r.n * 2\n\t\tnewData := make([]interface{}, newN)\n\t\tto := r.beg + r.readable\n\t\tif to <= r.n {\n\t\t\tcopy(newData, r.data[r.beg:to])\n\t\t} else {\n\t\t\tcopied := copy(newData, r.data[r.beg:])\n\t\t\tcopy(newData[copied:], r.data[:(to%r.n)])\n\t\t}\n\t\tr.beg = 0\n\t\tr.data = newData\n\t\tr.n = newN\n\t}\n\tr.data[(r.readable+r.beg)%r.n] = data\n\tr.readable++\n}", "title": "" } ]
[ { "docid": "dbf67db98a69f99ebc7d38d46db05c64", "score": "0.748622", "text": "func (r *RingBuffer) WriteOne(val int) error {\n\tr.m.Lock()\n\tdefer r.m.Unlock()\n\tif r.isFull {\n\t\treturn ErrIsFull\n\t}\n\tr.buf[r.w] = val\n\tr.w = (r.w + 1) % r.size\n\tif r.w == r.r {\n\t\tr.isFull = true\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dd4376b5d0545b6665b1a30698736c4e", "score": "0.6806567", "text": "func (d *DiskQueue) writeOne(data []byte) error {\n\tvar err error\n\tvar buf bytes.Buffer\n\n\td.writeMutex.Lock()\n\tdefer d.writeMutex.Unlock()\n\n\tif !d.open {\n\t\treturn errors.New(\"E_CLOSED\")\n\t}\n\n\tif d.writePos > d.maxBytesPerFile {\n\t\tif d.writeFile != nil {\n\t\t\td.writeFile.Close()\n\t\t\td.writeFile = nil\n\t\t}\n\n\t\td.metaMutex.Lock()\n\t\td.writeFileNum++\n\t\td.writePos = 0\n\t\td.metaMutex.Unlock()\n\t\terr = d.persistMetaData()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif d.writeFile == nil {\n\t\tcurFileName := d.fileName(d.writeFileNum)\n\t\td.writeFile, err = os.OpenFile(curFileName, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0600)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif d.writePos > 0 {\n\t\t\t_, err = d.writeFile.Seek(d.writePos, 0)\n\t\t\tif err != nil {\n\t\t\t\td.writeFile.Close()\n\t\t\t\td.writeFile = nil\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tdataLen := len(data)\n\n\terr = binary.Write(&buf, binary.BigEndian, int32(dataLen))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = buf.Write(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = d.writeFile.Write(buf.Bytes())\n\tif err != nil {\n\t\td.writeFile.Close()\n\t\td.writeFile = nil\n\t\treturn err\n\t}\n\n\terr = d.writeFile.Sync()\n\tif err != nil {\n\t\td.writeFile.Close()\n\t\td.writeFile = nil\n\t\treturn err\n\t}\n\n\ttotalBytes := 4 + dataLen\n\td.metaMutex.Lock()\n\td.writePos += int64(totalBytes)\n\td.depth++\n\td.metaMutex.Unlock()\n\n\td.writeContinueChan <- 1\n\n\t// log.Printf(\"DISK: wrote %d bytes - readFileNum=%d writeFileNum=%d readPos=%d writePos=%d\\n\",\n\t// \ttotalBytes, d.readFileNum, d.writeFileNum, d.readPos, d.writePos)\n\n\treturn nil\n}", "title": "" }, { "docid": "c19b02aa58a32d133368b5f62ec6f776", "score": "0.614895", "text": "func (q *Queue) AppendOne(f Feed) {\n\tq.queue = append(q.queue, f)\n}", "title": "" }, { "docid": "d28d3c89b30591c38c610af21d99dc55", "score": "0.5821533", "text": "func (s *Slot) AddOne(src *Slot) (changed bool) {\n if src.IsEmpty() {\n return\n }\n maxStack := src.MaxStack()\n\n if !s.IsSameType(src) && !s.IsEmpty() {\n return\n }\n\n if s.Count >= maxStack {\n return\n }\n\n changed = true\n s.setCount(s.Count + 1)\n s.ItemTypeId = src.ItemTypeId\n s.Data = src.Data\n src.setCount(src.Count - 1)\n\n return\n}", "title": "" }, { "docid": "be3222912b208a86618b7b18accb2c56", "score": "0.5767512", "text": "func WriteOne(file *os.File, uno byte) {\n\ts1 := &uno\n\tvar binario2 bytes.Buffer\n\tbinary.Write(&binario2, binary.BigEndian, s1)\n\tfile.Write(binario2.Bytes())\n}", "title": "" }, { "docid": "abf44fd079193ddddc014a3dac3dc23c", "score": "0.5747558", "text": "func (s *RingBuf) Write(i interface{}) {\n\tif s.Cap() == 0 {\n\t\treturn\n\t}\n\ts.val.Index(s.index).Set(reflect.ValueOf(i))\n\ts.index++\n\ts.index %= s.Cap()\n\tif s.count < s.Cap() {\n\t\ts.count++\n\t}\n}", "title": "" }, { "docid": "bb9cec3d10d4e80824e093c6740ef112", "score": "0.5631289", "text": "func (eb *RingBuffer) Add(e interface{}) {\n\tif eb.maxSize == 0 {\n\t\treturn\n\t}\n\tif eb.isFull() {\n\t\teb.buffer[eb.next] = e\n\t\teb.incr()\n\t\treturn\n\t}\n\teb.incr()\n\teb.buffer = append(eb.buffer, e)\n}", "title": "" }, { "docid": "1b2eecd22eee192c199ed776f3fc7d1a", "score": "0.55343056", "text": "func (w *RingBufferWriter) Write(p []byte) (int, error) {\n\tw.ring.append(p...)\n\treturn len(p), nil\n}", "title": "" }, { "docid": "7cd5e3b770cb6fbad34ae1403a82a2cb", "score": "0.54888916", "text": "func (q *Queue) Push(item interface{}) {\n\tif q.len == len(q.buf) {\n\t\tq.extend()\n\t}\n\tq.buf[(q.start+q.len)%len(q.buf)] = item\n\tq.len++\n}", "title": "" }, { "docid": "23f3095c93633bc3b0f81770c6591a37", "score": "0.5455977", "text": "func (t *freezerTable) Append(item uint64, blob []byte) error {\n\t// Read lock prevents competition with truncate\n\tt.lock.RLock()\n\t// Ensure the table is still accessible\n\tif t.index == nil || t.head == nil {\n\t\tt.lock.RUnlock()\n\t\treturn errClosed\n\t}\n\t// Ensure only the next item can be written, nothing else\n\tif atomic.LoadUint64(&t.items) != item {\n\t\tt.lock.RUnlock()\n\t\treturn fmt.Errorf(\"appending unexpected item: want %d, have %d\", t.items, item)\n\t}\n\t// Encode the blob and write it into the data file\n\tif !t.noCompression {\n\t\tblob = snappy.Encode(nil, blob)\n\t}\n\tbLen := uint32(len(blob))\n\tif t.headBytes+bLen < bLen ||\n\t\tt.headBytes+bLen > t.maxFileSize {\n\t\t// we need a new file, writing would overflow\n\t\tt.lock.RUnlock()\n\t\tt.lock.Lock()\n\t\tnextID := atomic.LoadUint32(&t.headId) + 1\n\t\t// We open the next file in truncated mode -- if this file already\n\t\t// exists, we need to start over from scratch on it\n\t\tnewHead, err := t.openFile(nextID, openFreezerFileTruncated)\n\t\tif err != nil {\n\t\t\tt.lock.Unlock()\n\t\t\treturn err\n\t\t}\n\t\t// Close old file, and reopen in RDONLY mode\n\t\tt.releaseFile(t.headId)\n\t\tt.openFile(t.headId, openFreezerFileForReadOnly)\n\n\t\t// Swap out the current head\n\t\tt.head = newHead\n\t\tatomic.StoreUint32(&t.headBytes, 0)\n\t\tatomic.StoreUint32(&t.headId, nextID)\n\t\tt.lock.Unlock()\n\t\tt.lock.RLock()\n\t}\n\n\tdefer t.lock.RUnlock()\n\tif _, err := t.head.Write(blob); err != nil {\n\t\treturn err\n\t}\n\tnewOffset := atomic.AddUint32(&t.headBytes, bLen)\n\tidx := indexEntry{\n\t\tfilenum: atomic.LoadUint32(&t.headId),\n\t\toffset: newOffset,\n\t}\n\t// Write indexEntry\n\tt.index.Write(idx.marshallBinary())\n\n\tt.writeMeter.Mark(int64(bLen + indexEntrySize))\n\tt.sizeGauge.Inc(int64(bLen + indexEntrySize))\n\n\tatomic.AddUint64(&t.items, 1)\n\treturn nil\n}", "title": "" }, { "docid": "4bcfef6ce41ecdd8e46a8873d7dadf86", "score": "0.5455617", "text": "func (r *Ring) Append(item interface{}) {\n\tif r.size == r.cap {\n\t\tif bufcap := r.cap * 2; bufcap <= highWatermark {\n\t\t\tr.cap = bufcap\n\t\t} else {\n\t\t\tr.cap += highWatermark\n\t\t}\n\t\tr.resize()\n\t}\n\n\tr.tail = r.next(r.tail)\n\tr.items[r.tail] = item\n\tr.size++\n}", "title": "" }, { "docid": "ed5f6134c5a8bb28ce71888e5e37163a", "score": "0.54196215", "text": "func (q *UnsafeQueue) Add(item interface{}) {\n\t// check if item is valid\n\tif item == nil {\n\t\tpanic(\"can not add nil item to fifo queue\")\n\t}\n\n\t// if the tail chunk is full, create a new one and add it to the queue.\n\tif q.tail.last >= chunkSize {\n\t\tq.tail.next = new(chunk)\n\t\tq.tail = q.tail.next\n\t}\n\n\t// add item to the tail chunk at the last position\n\tq.tail.items[q.tail.last] = item\n\tq.tail.last++\n\tq.count++\n}", "title": "" }, { "docid": "9d4f6ba2268776055521f2efe1a6441c", "score": "0.5418462", "text": "func (s *simple) AddOne() int {\n\tvar l sync.Mutex\n\tl.Lock()\n\tdefer l.Unlock()\n\ts.value += 1\n\treturn s.value\n}", "title": "" }, { "docid": "a4cff14b05f4d2921a5112352037d62d", "score": "0.5402626", "text": "func appendOne(arr1 []byte, oneByte byte) []byte {\n\tresult := make([]byte, len(arr1) + 1);\n\tfor i:= 0; i < len(arr1); i++ {\n\t\tresult[i] = arr1[i];\n\t};\n\tresult[len(result) - 1] = oneByte;\n\treturn result;\n}", "title": "" }, { "docid": "3631f1f45a8381b5d650a558b0fed6a2", "score": "0.5388977", "text": "func (b *Buffer) Add(key uint32, item []byte) {\n\tif (b.memoryCounter + b.itemSize) <= b.memoryLimit {\n\t\tb.addInMemory(key, item)\n\t} else {\n\t\tb.addOnDisk(key, item)\n\t}\n}", "title": "" }, { "docid": "942d16eee1aa75a9013f5cee2c418b07", "score": "0.53886855", "text": "func (r *RingBuffer[T]) Add(element T) {\n\tr.mutex.Lock()\n\tdefer r.mutex.Unlock()\n\n\tr.buffer[r.pos] = element\n\tr.pos = (r.pos + 1) % r.capacity\n\n\tif r.size < r.capacity {\n\t\tr.size = r.size + 1\n\t}\n}", "title": "" }, { "docid": "05cbc6c23ed896ec9d7a7a525cac53fd", "score": "0.5318511", "text": "func (b *brownBearGobWriter) AddItem(item interface{}) (id int64, err error) {\n\terr = b.e.Encode(item)\n\tinfo := newDataInfo(b.buff.Len())\n\n\tb.db.rwlock.Lock()\n\tdefer b.db.rwlock.Unlock()\n\n\tid = b.db.size()\n\tb.w.Offset = id\n\tinfo.WriteTo(b.w)\n\tb.buff.WriteTo(b.w)\n\n\treturn\n}", "title": "" }, { "docid": "0f4b9ecaec885b9af9709b7bc1a65819", "score": "0.53082323", "text": "func (itemc ItemController) ItemsCreateOne(w http.ResponseWriter, r *http.Request) {\n\titem := models.Item{}\n\n\tjson.NewDecoder(r.Body).Decode(&item)\n\titemc.db.InsertItem(itemc.collection, &item)\n\n\titemj, _ := json.Marshal(item)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusCreated)\n\tfmt.Fprintf(w, \"%s\\n\", itemj)\n}", "title": "" }, { "docid": "7180c5965613e7f50e35ad12adc52cba", "score": "0.52826667", "text": "func (r *Ring) Add(val *RingItem) {\n\tcnt := 0\n\tfor {\n\t\tif cnt > r.tryMax {\n\t\t\tr.alerter(cnt) // alert\n\t\t\tbreak\n\t\t}\n\n\t\twIdx := atomic.AddUint64(&r.wIdx, 1)\n\t\tidx := wIdx & r.mask\n\t\tptr := atomic.LoadPointer(&(r.buffer[idx]))\n\n\t\t// when not nil, try next slot\n\t\tif ptr != nil && (*RingItem)(ptr) != nil {\n\t\t\tcnt++\n\t\t\tlog.Printf(\"ring collision %d-%d: consider using a larger buf \\n\", cnt, idx)\n\t\t\tcontinue\n\t\t}\n\n\t\tval.seq = wIdx\n\n\t\t// multi add on one slot\n\t\tif !atomic.CompareAndSwapPointer(&r.buffer[idx], ptr, unsafe.Pointer(val)) {\n\t\t\tcnt++\n\t\t\tlog.Printf(\"ring collision %d-%d: atomic\\n\", cnt, idx)\n\t\t\tcontinue\n\t\t}\n\n\t\tbreak\n\t}\n}", "title": "" }, { "docid": "b042ceb83f92da73319a288a206e7b7f", "score": "0.52633864", "text": "func (q Qalam) write(b []byte) (int, error) {\n\tif q.bytesAvailable() < len(b) {\n\t\tq.bw.Flush()\n\t}\n\treturn q.bw.Write(b)\n}", "title": "" }, { "docid": "ecb03c842db7f0ce94f25cc5c8f0b67a", "score": "0.5249494", "text": "func (queue *SafeQueue) Push(item *amqp.Message) {\n\tqueue.Lock()\n\tdefer queue.Unlock()\n\n\tqueue.tail[queue.tailPos] = item\n\tqueue.tailPos++\n\tqueue.length++\n\n\tif queue.tailPos == queue.shardSize {\n\t\tqueue.tailPos = 0\n\t\tqueue.tailIdx = len(queue.shards)\n\n\t\tbuffer := make([][]*amqp.Message, len(queue.shards)+1)\n\t\tbuffer[queue.tailIdx] = make([]*amqp.Message, queue.shardSize)\n\t\tcopy(buffer, queue.shards)\n\n\t\tqueue.shards = buffer\n\t\tqueue.tail = queue.shards[queue.tailIdx]\n\t}\n}", "title": "" }, { "docid": "c2cccbae2e96fa04bdc66d261bb6d98b", "score": "0.524102", "text": "func (a *ExpandableWriter) Write(v []byte) {\n\ta.bytes = append(a.bytes, v...)\n\ta.currentIndex += len(v)\n}", "title": "" }, { "docid": "430489d598aeb2729ff314839f059f12", "score": "0.5221803", "text": "func (r *Ring) Push(obj interface{}) error {\n\tif r.length == 1 {\n\t\treturn r.rings[0].Push(obj)\n\t}\n\n\tidx := goid.GetPid() % r.length\n\tfor i := 0; i < r.length; i, idx = i+1, (idx+1)%r.length {\n\t\terr := r.rings[idx].Push(obj)\n\t\tif err == nil {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn ErrRingFull\n}", "title": "" }, { "docid": "d71defc92427294d1b1dfe7734db4cae", "score": "0.52213037", "text": "func (rb *RingBuffer) Write(buf []byte) (n int, err error) {\n\trb.written += len(buf)\n\tif len(buf) > rb.size {\n\t\tbuf = buf[len(buf)-rb.size:]\n\t}\n\tcopy(rb.data[rb.cursor:], buf)\n\tremain := rb.size - rb.cursor\n\tif len(buf) > remain {\n\t\tcopy(rb.data, buf[remain:])\n\t}\n\trb.cursor = (rb.cursor + len(buf)) % rb.size\n\treturn len(buf), nil\n}", "title": "" }, { "docid": "4143f867739a653e3aacda8bbdcbc97a", "score": "0.52137214", "text": "func (rw *RingedWriter) Write(p []byte) (n int, err error) {\n\tnewData := fillBytes(len(p), func() []byte {return p})\n\t*rw.ring = make([]byte, 0, len(*newData))\n\t*rw.ring = append(*rw.ring, (*newData)[:]...)\n\trw.resetNowOn()\n\n\treturn len(p), nil\n}", "title": "" }, { "docid": "f8d951a6d2b3132f8db8341f9036eb6d", "score": "0.5212367", "text": "func (a *FixedWriter) Write(v []byte) {\n\tcopy(a.bytes[a.currentIndex:], v)\n\ta.currentIndex += len(v)\n}", "title": "" }, { "docid": "50955281bc213028e4c28eda8bc37a61", "score": "0.5196829", "text": "func (s *syncInstrument) RecordOne(ctx context.Context, num number.Number, kvs []attribute.KeyValue) {\n\th := s.acquireHandle(kvs, nil)\n\tdefer h.Unbind()\n\th.RecordOne(ctx, num)\n}", "title": "" }, { "docid": "60b3c725a9a9a54e2d4b8a984f1b64da", "score": "0.5195381", "text": "func (queue *SafeQueue) PushHead(item *amqp.Message) {\n\tqueue.Lock()\n\tdefer queue.Unlock()\n\n\tif queue.headPos == 0 {\n\t\tbuffer := make([][]*amqp.Message, len(queue.shards)+1)\n\t\tcopy(buffer[1:], queue.shards)\n\t\tbuffer[queue.headIdx] = make([]*amqp.Message, queue.shardSize)\n\n\t\tqueue.shards = buffer\n\t\tqueue.tailIdx++\n\t\tqueue.headPos = queue.shardSize\n\t\tqueue.tail = queue.shards[queue.tailIdx]\n\t\tqueue.head = queue.shards[queue.headIdx]\n\t}\n\tqueue.length++\n\tqueue.headPos--\n\tqueue.head[queue.headPos] = item\n}", "title": "" }, { "docid": "2e5cad1db96978b7609c2024ad7e66de", "score": "0.5194539", "text": "func (np *Pool) SendOne(handler SendHandler) *Node {\n\tnodes := np.shuffleNodesLock(false)\n\treturn np.sendOne(handler, nodes)\n}", "title": "" }, { "docid": "5107007bcb0c4def90c14268e6fc006a", "score": "0.5188058", "text": "func (d *Dao) PushOppoOne(c context.Context, info *model.PushInfo, m *oppo.Message, token string) (res *oppo.Response, err error) {\n\tvar index int\n\tif index, err = d.roundIndex(info.APPID, model.PlatformOppo); err != nil {\n\t\treturn\n\t}\n\tif res, err = d.clientsOppo[info.APPID][index].PushOne(m, token); err != nil {\n\t\tlog.Error(\"push oppo one task(%s) token(%s) result(%+v) error(%v)\", info.TaskID, token, res, err)\n\t\treturn\n\t}\n\tlog.Info(\"push oppo one task(%s) token(%s) result(%+v) success\", info.TaskID, token, res)\n\treturn\n}", "title": "" }, { "docid": "f0fe2b03b36aee6dc2b4c5496ef42f2d", "score": "0.51675916", "text": "func (b *ringBuffer) Write(p []byte) (int, error) {\n\tfor _, c := range p {\n\t\tb.buffer[b.end] = c\n\t\tb.end = (b.end + 1) % b.size\n\t\tif !b.full && b.end == 0 {\n\t\t\tb.full = true\n\t\t}\n\t}\n\treturn len(p), nil\n}", "title": "" }, { "docid": "ef466251d8e4f128755a95c478ea1f0f", "score": "0.51617104", "text": "func (d *DiskBuffer) Add(ctx context.Context, newEntry *entry.Entry) error {\n\tvar buf bytes.Buffer\n\tvar err error\n\tenc := json.NewEncoder(&buf)\n\tif err := enc.Encode(newEntry); err != nil {\n\t\treturn err\n\t}\n\n\tif err = d.diskSizeSemaphore.Acquire(ctx, int64(buf.Len())); err != nil {\n\t\treturn err\n\t}\n\n\td.Lock()\n\tdefer d.Unlock()\n\n\t// Seek to end of the file if we're not there\n\tif err = d.seekToEnd(); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err = d.data.Write(buf.Bytes()); err != nil {\n\t\treturn err\n\t}\n\n\td.addUnreadCount(1)\n\n\treturn nil\n}", "title": "" }, { "docid": "987ddf18017a79e327ff028ecb5cda61", "score": "0.51549786", "text": "func (r *RingBuffer) ReadOne() (val int, err error) {\n\tr.m.Lock()\n\tdefer r.m.Unlock()\n\tif r.r == r.w && !r.isFull {\n\t\treturn 0, ErrIsEmpty\n\t}\n\tval = r.buf[r.r]\n\tr.r = (r.r + 1) % r.size\n\tr.isFull = false\n\treturn\n}", "title": "" }, { "docid": "550afd1fde7b8e6bdfd6623df0f7b22a", "score": "0.51390624", "text": "func (m *MessageWithFieldOneMutation) AddFieldOne(i int32) {\n\tif m.addfield_one != nil {\n\t\t*m.addfield_one += i\n\t} else {\n\t\tm.addfield_one = &i\n\t}\n}", "title": "" }, { "docid": "209589a2b6acc833bb06c7592ab3ea7c", "score": "0.51358336", "text": "func (a *AWSet) AddOne(value string, replica string) bool {\n\tnewTime := a.Version.Incr(replica)\n\tentry := causality.CreateVersionVector()\n\tentry.Witness(replica, newTime)\n\n\ta.l.Lock()\n\t_, alreadyExists := a.entries[value]\n\ta.entries[value] = entry\n\ta.l.Unlock()\n\n\treturn !alreadyExists\n}", "title": "" }, { "docid": "abd7915c67d4d038d43e8cb8b41f9d31", "score": "0.510436", "text": "func (_m *PartitionedOutput) WriteOne(ctx context.Context, msg stream.WritableMessage) error {\n\tret := _m.Called(ctx, msg)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, stream.WritableMessage) error); ok {\n\t\tr0 = rf(ctx, msg)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "3b03e778243f952b39872f4112ba34e4", "score": "0.5100515", "text": "func (s *syncInstrument) RecordOne(ctx context.Context, num number.Number, kvs []attribute.KeyValue) {\n\th := s.acquireHandle(kvs)\n\tdefer h.unbind()\n\th.captureOne(ctx, num)\n}", "title": "" }, { "docid": "c8b12f68ef4b70eafdb26774a82e8db3", "score": "0.50960624", "text": "func (b *buffer) Push(i *Info) {\n\tb.Lock()\n\tdefer b.Unlock()\n\n\tb.ring[b.end] = i\n\n\tb.end = (b.end + 1) % len(b.ring)\n\n\tswitch b.size {\n\tcase len(b.ring): // We erased something, move the start up.\n\t\tb.start = (b.start + 1) % len(b.ring)\n\tdefault:\n\t\tb.size++\n\t}\n}", "title": "" }, { "docid": "2d41b3f4ebd404bb177a04f59added5e", "score": "0.5089039", "text": "func (w *Writer) Write(b []byte) (int, error) {\n\tif w.withErr != nil {\n\t\treturn 0, w.withErr\n\t}\n\ttime.Sleep(time.Nanosecond * 200)\n\tw.b = append(w.b, b...)\n\treturn len(b), nil\n}", "title": "" }, { "docid": "bea06c4fd4c7351b14943743f14ecdcd", "score": "0.5087945", "text": "func (pq *pendingWriteQueue) Push(x interface{}) {\n\t*pq = append(*pq, x.(*writeIndexReq))\n}", "title": "" }, { "docid": "7b4475d767b8e3177719895040cabedf", "score": "0.5081505", "text": "func (u *UsageStat) AccumOne(change int, usage UsageType) {\n\tif change == 0 {\n\t\treturn\n\t}\n\tif usage == UsageMDWrite || usage >= NumUsage {\n\t\treturn\n\t}\n\tu.Bytes[usage] += int64(change)\n\tif change > 0 {\n\t\tu.Blocks[usage]++\n\t} else {\n\t\tu.Blocks[usage]--\n\t}\n}", "title": "" }, { "docid": "00e19778bd0741662e74395ed3e1539b", "score": "0.50718117", "text": "func (rm *responseModifier) Write(b []byte) (int, error) {\n\tif rm.hijacked {\n\t\treturn rm.rw.Write(b)\n\t}\n\n\tif len(rm.body)+len(b) > maxBufferSize {\n\t\trm.Flush()\n\t}\n\trm.body = append(rm.body, b...)\n\treturn len(b), nil\n}", "title": "" }, { "docid": "bf0ccf82e39ebce0facb7ee15624166d", "score": "0.5067569", "text": "func (hw *Sha1HashWriter) Write(b []byte) (int, error) {\n\t_, err := hw.cksum.Write(b)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"updating checksum failed\")\n\t}\n\treturn hw.dest.Write(b)\n}", "title": "" }, { "docid": "3c4f441d71ea771264111a84cfc7c8d7", "score": "0.50656796", "text": "func (q *Queue) Add(elem interface{}) {\n\tif q.count == len(q.buf) {\n\t\tq.resize()\n\t}\n\n\tq.buf[q.tail] = elem\n\tq.tail = (q.tail + 1) % len(q.buf)\n\tq.count++\n}", "title": "" }, { "docid": "6d7c1be250080485b9920bfe74acb5be", "score": "0.5054477", "text": "func (socket *TcpSocket) AddToBuffer(buf []byte, nbyte int) int {\n\t//block till writing up to nbyte\n\tvar size int\n\tfor {\n\t\tsize = socket.SendWindow.Write(buf, nbyte)\n\t\t//logging.Printf(\"[TcpSocket] AddToBuffer socketfd:%d write size :%d\", socket.Fd, size)\n\t\tif size > 0 {\n\t\t\t//logging.Printf(\"[TcpSocket] AddToBuffer socketfd:%d write size :%d\", socket.Fd, size)\n\t\t}\n\t\tif size == nbyte {\n\t\t\tbreak\n\t\t} else {\n\t\t\tbuf = buf[size:]\n\t\t\tnbyte = nbyte - size\n\t\t}\n\t}\n\treturn size\n}", "title": "" }, { "docid": "3359193afb108b4f1f67b6d902b708ac", "score": "0.5042492", "text": "func (c *Client) writeFull(conn net.Conn, bts []byte) error {\n\tsize := len(bts)\n\tbase := make([]byte, 4)\n\tbinary.BigEndian.PutUint32(base, uint32(size))\n\tbase = append(base, bts...)\n\n\t// Same as server.\n\twriter := bufio.NewWriterSize(conn, size)\n\t_, err := writer.Write(base)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Flush data to be sure that all bts was sent.\n\treturn writer.Flush()\n}", "title": "" }, { "docid": "2071093c7c38d968daa738c9e8a202d7", "score": "0.50420386", "text": "func (b *bufferedConsulWriter) Write(p []byte) (nn int, err error) {\n\tb.buf = append(b.buf, p...)\n\treturn len(p), nil\n}", "title": "" }, { "docid": "85c99f814caa0a92e89c1a17e565e2b6", "score": "0.50304943", "text": "func (f *Buffer) Write(p []byte) (n int, err error) {\n\tif f.isClosed {\n\t\treturn 0, os.ErrClosed\n\t}\n\tif f.Index < 0 {\n\t\treturn 0, io.EOF\n\t}\n\t// we might have rewinded, let's reset the buffer before appending to it\n\tidx := int(f.Index)\n\tbuffLen := f.Buff.Len()\n\tif idx != buffLen && idx <= buffLen {\n\t\tf.Buff = bytes.NewBuffer(f.Bytes()[:f.Index])\n\t}\n\tn, err = f.Buff.Write(p)\n\n\tf.Index += int64(n)\n\treturn n, err\n}", "title": "" }, { "docid": "83304cb58f058712e5d55dbb77d57936", "score": "0.50204563", "text": "func (id *CircularBuffer) Add(value interface{}) {\n\t// defer id.lock.Unlock()\n\t// id.lock.Lock()\n\n\tid.end++\n\t// loop check\n\tif id.end >= id.Capacity {\n\t\tid.end = 0\n\t}\n\n\t// when buffer is empty (Length == 0, to be 1), allow start == end\n\tif id.end == id.start && id.Length != 0 {\n\t\tid.start++\n\t}\n\n\t// start loop check\n\tif id.start >= id.Capacity {\n\t\tid.start = 0\n\t}\n\n\t// append the value and increase Length\n\tid.buffer[id.end] = value\n\tif id.Length < id.Capacity {\n\t\tid.Length++\n\t}\n}", "title": "" }, { "docid": "9d1f294c976669ab95c9986ea5a40d4e", "score": "0.50192565", "text": "func (b *blockWriter) Write(p []byte) (int, error) {\n\tc := atomic.AddInt32(&b.count, 1)\n\tif c == 1 {\n\t\ttime.Sleep(100 * time.Millisecond)\n\t}\n\tatomic.AddInt32(&b.Writes, 1)\n\treturn len(p), nil\n}", "title": "" }, { "docid": "df4b04e7bf8add571e3c5ec5e45d2794", "score": "0.49994907", "text": "func (b *brownBearGobWriter) AddItems(items ...interface{}) (id int64, err error) {\n\tfor _, item := range items {\n\t\terr = b.e.Encode(item)\n\t\tif err != nil {\n\t\t\treturn -1, err\n\t\t}\n\t}\n\tinfo := newDataInfo(b.buff.Len())\n\n\tb.db.rwlock.Lock()\n\tdefer b.db.rwlock.Unlock()\n\n\tid = b.db.size()\n\tb.w.Offset = id\n\tinfo.WriteTo(b.w)\n\tb.buff.WriteTo(b.w)\n\treturn\n}", "title": "" }, { "docid": "62cdc3c0754ae29e534b025a976ea880", "score": "0.49825582", "text": "func (w *Unbuffered) Add(writer io.WriteCloser) {\n\tw.mu.Lock()\n\tw.writers = append(w.writers, writer)\n\tw.mu.Unlock()\n}", "title": "" }, { "docid": "0aa46d5b4422c28eaf7f055b85b5c57d", "score": "0.49774367", "text": "func (rb *RingBuffer) Put(val byte) bool {\n\tif rb.Used() != bufferSize {\n\t\trb.head++\n\t\trb.rxbuffer[rb.head%bufferSize] = val\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "442166e21d0c747d136a4b4506a29b01", "score": "0.49751562", "text": "func (mf *MessageFifo) Write(msg *model.Message) {\n\tselect {\n\tcase mf.fifo <- msg:\n\tdefault:\n\t\t//discard a old message\n\t\t<- mf.fifo\n\t\tmf.fifo <- msg\n\t\tklog.Warningf(\"too many message, we discard a old message\")\n\t}\n}", "title": "" }, { "docid": "bf211a33f8e8ddf2bfc3644ba38333a9", "score": "0.49672195", "text": "func (x *MQQueueManager) Put1(good *MQOD, gomd *MQMD,\n\tgopmo *MQPMO, buffer []byte) (MQReturn, error) {\n\tvar mqrc C.MQLONG\n\tvar mqcc C.MQLONG\n\tvar mqmd C.MQMD\n\tvar mqpmo C.MQPMO\n\tvar mqod C.MQOD\n\tvar ptr C.PMQVOID\n\n\tcopyODtoC(&mqod, good)\n\tcopyMDtoC(&mqmd, gomd)\n\tcopyPMOtoC(&mqpmo, gopmo)\n\n\tbufflen := len(buffer)\n\n\tif bufflen > 0 {\n\t\tptr = (C.PMQVOID)(unsafe.Pointer(&buffer[0]))\n\t} else {\n\t\tptr = nil\n\t}\n\n\tC.MQPUT1(x.hConn, (C.PMQVOID)(unsafe.Pointer(&mqod)),\n\t\t(C.PMQVOID)(unsafe.Pointer(&mqmd)),\n\t\t(C.PMQVOID)(unsafe.Pointer(&mqpmo)),\n\t\t(C.MQLONG)(bufflen),\n\t\tptr,\n\t\t&mqcc, &mqrc)\n\n\tcopyODfromC(&mqod, good)\n\tcopyMDfromC(&mqmd, gomd)\n\tcopyPMOfromC(&mqpmo, gopmo)\n\n\tmqreturn := MQReturn{MQCC: int32(mqcc),\n\t\tMQRC: int32(mqrc),\n\t}\n\n\tif mqcc == C.MQCC_FAILED {\n\t\treturn mqreturn, mqstrerror(\"MQPUT1\", mqcc, mqrc)\n\t}\n\n\treturn mqreturn, nil\n\n}", "title": "" }, { "docid": "d2b3764cc3bc56b05d0c46a7dd491787", "score": "0.49535292", "text": "func (t *tokenBuffer) append(item *tok.Item) int {\n\tif item == nil {\n\t\treturn -1\n\t}\n\tfor i := 0; i < len(t.buf)-1; i++ {\n\t\tif t.buf[i] == nil {\n\t\t\tt.buf[i] = item\n\t\t\treturn i\n\t\t}\n\t}\n\t// The buffer has reached capacity\n\tt.buf = append(t.buf, item)\n\treturn len(t.buf) - 1\n}", "title": "" }, { "docid": "6cc6753f63289ed24ba721507dd18942", "score": "0.4950307", "text": "func Write(buffer *[]byte, v byte) {\n\t*buffer = append(*buffer, v)\n}", "title": "" }, { "docid": "16a6eda4381dafa96a6f858c99a28624", "score": "0.49414438", "text": "func (_dataConstruct DataConstruct) AddOne() error {\n\tresult := connection.Create(_dataConstruct.Payload)\n\n\tif result.Error != nil {\n\t\treturn result.Error\n\t}\n\n\tlog.Println(\"Rows: \", result.RowsAffected)\n\n\treturn nil\n}", "title": "" }, { "docid": "3d732c88a031146a4319dbd7ae5390a4", "score": "0.4938377", "text": "func (k *Writer) WriteU1(v uint8) error {\n\tk.buf[0] = v\n\t_, err := k.Write(k.buf[:1])\n\treturn err\n}", "title": "" }, { "docid": "b40e762082c9313f72de0d271e1ede75", "score": "0.4930177", "text": "func (bitMap *BitMap) SetOne(pos uint64) error {\n\tif pos > bitMap.size {\n\t\treturn errors.New(\"pos out of size\")\n\t}\n\n\tbitMap.data[pos/64] |= 1 << (pos % 64)\n\treturn nil\n}", "title": "" }, { "docid": "b84c0b0b2354da6d82ac36eb0b6adaeb", "score": "0.4924366", "text": "func (obj *AVObject) Write(p []byte) (int, error) {\n\tif len(p) == 0 {\n\t\treturn 0, nil\n\t}\n\tif obj.length+len(p) > obj.size {\n\t\tpanic(\"write out of range\")\n\t}\n\n\tC.copybytes(obj.ptr, C.int(obj.length), unsafe.Pointer(&p[0]), C.int(len(p)))\n\tobj.length += len(p)\n\n\treturn len(p), nil\n}", "title": "" }, { "docid": "689cf7c61c664e7acda63939511fe971", "score": "0.49232352", "text": "func (c *Client) OneShot(ctx context.Context) error {\n\treturn c.ok(ctx, \"single\", \"oneshot\")\n}", "title": "" }, { "docid": "13a3cffe71b0b425e6dbd9ed469277b0", "score": "0.49169713", "text": "func (writer *bulkWriter) Buffer(key []byte, value []byte) error {\n\tif writer.wb == nil {\n\t\twriter.wb = gorocksdb.NewWriteBatch()\n\t}\n\twriter.wb.Put(pbytes.Copy(key), pbytes.Copy(value))\n\treturn writer.flushIfNeeded()\n}", "title": "" }, { "docid": "5187873771815206e9b6801ff3ca50dc", "score": "0.491605", "text": "func (c *BankItemClient) UpdateOne(bi *BankItem) *BankItemUpdateOne {\n\treturn c.UpdateOneID(bi.ID)\n}", "title": "" }, { "docid": "51955e490053fcb4ab3291e47040b092", "score": "0.49152696", "text": "func (u *s3Uploader) write(buf []byte) {\n\tif len(buf) == 0 {\n\t\tpanic(\"empty buf in write\")\n\t}\n\tfor len(buf) > 0 {\n\t\tif len(u.curBuf) == 0 {\n\t\t\tu.curBuf = u.bufPool.Get().([]byte)\n\t\t\tu.curBuf = u.curBuf[:0]\n\t\t}\n\t\tif cap(u.curBuf) != uploadPartSize {\n\t\t\tpanic(\"empty buf\")\n\t\t}\n\t\tspace := u.curBuf[len(u.curBuf):cap(u.curBuf)]\n\t\tn := len(buf)\n\t\tif n < len(space) {\n\t\t\tcopy(space, buf)\n\t\t\tu.curBuf = u.curBuf[0 : len(u.curBuf)+n]\n\t\t\treturn\n\t\t}\n\t\tcopy(space, buf)\n\t\tbuf = buf[len(space):]\n\t\tu.curBuf = u.curBuf[0:cap(u.curBuf)]\n\t\tu.reqCh <- uploadChunk{client: u.client, uploadID: u.uploadID, partNum: u.nextPartNum, buf: u.curBuf}\n\t\tu.nextPartNum++\n\t\tu.curBuf = nil\n\t}\n}", "title": "" }, { "docid": "61a2e544d2a8e143577036f404011ba6", "score": "0.4914729", "text": "func (q *Queue) Add(item interface{}) error {\n\tlength := len(q.items)\n\tif length == q.maxLen {\n\t\treturn fmt.Errorf(\"Queue is full (%v/%v)\", length, q.maxLen)\n\t}\n\tq.items = append(q.items, item)\n\tlog.Debugf(\"Added an item to the queue. (len: %v)\", length)\n\tlog.Debugf(\"queue: %+v\", q.items)\n\treturn nil\n}", "title": "" }, { "docid": "644420962614abab550bc3d3133b6b61", "score": "0.49106672", "text": "func (bufPool *BufioWriterPool) Put(b *bufio.Writer) {\n\tb.Reset(nil)\n\tbufPool.pool.Put(b)\n}", "title": "" }, { "docid": "c7960611fb58d5004f8f2f48c54dfaeb", "score": "0.4907605", "text": "func (conn *Connection) WriteOneParameterized(statement ParameterizedStatement) (wr WriteResult, err error) {\n\twra, err := conn.WriteParameterized([]ParameterizedStatement{statement})\n\treturn wra[0], err\n}", "title": "" }, { "docid": "bea6ac4554842bd3f570278ad32a85fc", "score": "0.4906774", "text": "func (buffer *Buffer) Write(p []byte) (int, error) {\n\tif p == nil || len(p) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif buffer.writeableLen() < len(p) {\n\t\tbuffer.grow(len(p))\n\t}\n\n\tbuff := buffer.bytes[len(buffer.bytes):cap(buffer.bytes)]\n\tnWrote := copy(buff, p)\n\tbuffer.bytes = buffer.bytes[:len(buffer.bytes)+nWrote]\n\n\treturn nWrote, nil\n}", "title": "" }, { "docid": "311bbe984880e39d9d06127d28ff8e74", "score": "0.49061662", "text": "func (w *Writer) Write(p []byte) (n int, err error) {\n\tif w.closed {\n\t\terr = ErrWriteAfterClose\n\t\treturn\n\t}\n\toverwrite := false\n\tif int64(len(p)) > w.nb {\n\t\tp = p[0:w.nb]\n\t\toverwrite = true\n\t}\n\tn, err = w.w.Write(p)\n\tw.nb -= int64(n)\n\tif err == nil && overwrite {\n\t\terr = ErrWriteTooLong\n\t\treturn\n\t}\n\tw.err = err\n\treturn\n}", "title": "" }, { "docid": "56b2a126358cc99a01e627cd7dea6222", "score": "0.4901397", "text": "func (b *IoBuffer) Write(p []byte) (n int, err error) {\n\tb.lastRead = opInvalid\n\tm, ok := b.tryGrowByReslice(len(p))\n\tif !ok {\n\t\tm = b.grow(len(p))\n\t}\n\treturn copy(b.buf[m:], p), nil\n}", "title": "" }, { "docid": "91d34912c54ac64c5f46d180c0a2a9ad", "score": "0.4899709", "text": "func (wb *bufferedWriter) Write(msg []byte) {\n\twb.buffer <- &BufferContainer{b: msg}\n}", "title": "" }, { "docid": "afd721ca0852e7f8702049bc7ab83bc2", "score": "0.48986715", "text": "func (q *Queue) Push(elem interface{}) {\n\tq.Lock()\n\tdefer q.Unlock()\n\n\tq.growIfFull()\n\n\tq.buf[q.tail] = elem\n\t// Calculate new tail position.\n\tq.tail = q.next(q.tail)\n\tq.count++\n}", "title": "" }, { "docid": "0b182c272bd1f67ca39184c5efa1b958", "score": "0.48943114", "text": "func (w *bufferWriterAt) WriteAt(p []byte, off int64) (int, error) {\n\t// First, make sure the requested fits within the slice.\n\tif (off < 0) || (len(p) + int(off) > len(w.buffer)) {\n\t\tw.buffer = w.buffer[0:len(p) + int(off)]\n\t}\n\n\t// Do a simple copy loop, incrementing the offset as we go.\n\tfor _, b := range p {\n\t\tw.buffer[off] = b\n\t\toff++\n\t}\n\treturn len(p), nil\n}", "title": "" }, { "docid": "bb8667eb4b084d4415517413cd7562de", "score": "0.4890253", "text": "func (k Keeper) AppendItem(\n\tctx sdk.Context,\n\titem types.Item,\n) uint64 {\n\t// Create the item\n\tcount := k.GetItemCount(ctx)\n\n\t// Set the ID of the appended value\n\titem.Id = count\n\n\tstore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ItemKey))\n\tappendedValue := k.cdc.MustMarshal(&item)\n\tstore.Set(GetItemIDBytes(item.Id), appendedValue)\n\n\t// Update item count\n\tk.SetItemCount(ctx, count+1)\n\n\treturn count\n}", "title": "" }, { "docid": "a62ac74b98685bfba55e8b0546692ec4", "score": "0.48896042", "text": "func (b *Writer) Flush() (err error) {\n\tb.mu.Lock()\n\tdefer b.mu.Unlock()\n\n\tif len(b.buf) > 0 {\n\t\t_, err = b.w.Write(b.buf)\n\t\tb.log(\"FLUSH\", func() string { return fmt.Sprintf(\"explicit: %d\", len(b.buf)) })\n\t\tb.buf = b.buf[:0]\n\t\tatomic.StoreUint32(&b.empty, 0)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "8f3fed66086dce25a8ad805b3b787492", "score": "0.48882937", "text": "func (r *RingBuffer) Add(key uint64, ev *event.Event) {\n\t// fast return if disabled\n\tif !r.enabled() {\n\t\treturn\n\t}\n\n\texpiration := time.Now().Add(r.ttl)\n\tbe := &BufferEvent{\n\t\tEvent: ev,\n\t\texpires: &expiration,\n\t}\n\n\tr.Lock()\n\t// check if we have an existing event at this position\n\toldKey := r.itemOrder[r.position]\n\tif oldKey != 0 {\n\t\t// If the key at the current position is associated with an event\n\t\t// in the buffer, remove it. Otherwise, this delete is a NOOP.\n\t\tdelete(r.items, oldKey)\n\t}\n\n\t// add event to map and order array\n\tr.items[key] = be\n\tr.itemOrder[r.position] = key\n\n\t// increment position\n\tr.position++\n\tif r.position >= r.size {\n\t\tr.position = 0\n\t}\n\tr.Unlock()\n}", "title": "" }, { "docid": "d64bd1cdbe134d9c678fc429aa47b1f9", "score": "0.48873243", "text": "func (r *RingGrowing) ReadOne() (data interface{}, ok bool) {\n\tif r.readable == 0 {\n\t\treturn nil, false\n\t}\n\tr.readable--\n\telement := r.data[r.beg]\n\tr.data[r.beg] = nil // Remove reference to the object to help GC\n\tif r.beg == r.n-1 {\n\t\t// Was the last element\n\t\tr.beg = 0\n\t} else {\n\t\tr.beg++\n\t}\n\treturn element, true\n}", "title": "" }, { "docid": "14599f641300e5d1828d5c17fd90fdc9", "score": "0.48872516", "text": "func (cb *CappedBuffer) Write(p []byte) (n int, err error) {\n\tif cb.cap > 0 && cb.Len()+len(p) > cb.cap {\n\t\treturn 0, ErrBufferOverflow\n\t}\n\treturn cb.Buffer.Write(p)\n}", "title": "" }, { "docid": "b7a2e1e41b2ba4e57bbf7c6f8e9eb0bf", "score": "0.48865706", "text": "func (itemc ItemController) ItemsUpdateOne(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\titemId := vars[\"itemId\"]\n\tpartialItem := models.Item{}\n\tjson.NewDecoder(r.Body).Decode(&partialItem)\n\tif err := itemc.db.UpdateItemById(itemc.collection, itemId, &partialItem); err != nil {\n\t\tswitch err {\n\t\tcase db.ErrInvalidId:\n\t\tcase db.ErrUnequalUpdateIds:\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tcase db.ErrCouldNotUpdateDoc:\n\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\tdefault:\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t}\n\t\tfmt.Fprintln(w, \"Error:\", err)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\tfmt.Fprintf(w, \"Item %s udpated.\\n\", itemId)\n}", "title": "" }, { "docid": "3618512564a97f534efa6f8d700f58c4", "score": "0.48806554", "text": "func (pr *pktRing) Write(pkt []byte, block bool) int {\n\tn, _ := pr.ring.Write(ringbuf.EntryList{pkt}, block)\n\treturn n\n}", "title": "" }, { "docid": "120ce3e16bdb1f099e46a5a5a2ac30dc", "score": "0.4875523", "text": "func (q *queue) Push(item interface{}) {\n\tq.debug(\"Before push\")\n\tif q.size+1 > len(q.data) {\n\t\tlogrus.Debugf(\"Current size is %d. Resizing current length %d to new length %d\", q.size, len(q.data), 2*len(q.data))\n\t\t// make double length queue\n\t\tnewQueue := make([]interface{}, len(q.data)*2)\n\t\tcopy(newQueue, q.data[q.head:])\n\t\tif q.head+q.size > len(q.data) {\n\t\t\twrapLength := q.head + q.size - len(q.data)\n\t\t\tcopy(newQueue[len(q.data[q.head:]):], q.data[:wrapLength])\n\t\t}\n\t\tq.data = newQueue\n\t\tq.head = 0\n\t}\n\tq.data[(q.size+q.head)%len(q.data)] = item\n\tq.size++\n\tq.debug(\"After push\")\n}", "title": "" }, { "docid": "09db3b399b66e4637b9a671a4aae0b84", "score": "0.48751122", "text": "func (s *Statistics) PlusOne() {\n\ts.statistics <- true\n}", "title": "" }, { "docid": "3d6f27f5b85716f20406343b8abb5426", "score": "0.48653322", "text": "func (w DelimitedWriter) Put(record []byte) error {\n\t_, err := w.WriteRecord(record)\n\treturn err\n}", "title": "" }, { "docid": "7b8ffd51755f62e77ee4880381a71bfd", "score": "0.48651785", "text": "func (a *asyncInstrument) ObserveOne(ctx context.Context, num number.Number, attrs []attribute.KeyValue) {\n\th := a.acquireHandle(attrs)\n\tdefer h.unbind()\n\th.captureOne(ctx, num)\n}", "title": "" }, { "docid": "9c9c62f06fe4e7aaf532616b4e9b79f4", "score": "0.48624182", "text": "func (b *Buffer) Write(p []byte) (n int, err error) {\n\tn = len(p)\n\tb.Grow(n)\n\tassert(n == copy(b.buf[b.offset:], p))\n\tb.offset += uint64(n)\n\treturn n, nil\n}", "title": "" }, { "docid": "5d4c1586bcda50a7b17695ddebe1376f", "score": "0.4848493", "text": "func (t *MyType) Write(p []byte) (n int, err error){\n\treturn t.buffer.Write(p)\n}", "title": "" }, { "docid": "5aa781d09abdffa1701cab24ad40cdeb", "score": "0.48416716", "text": "func (w *BufferedWriter) Write(p []byte) (int, error) {\n\tw.mu.Lock()\n\tdefer w.mu.Unlock()\n\treturn w.w.Write(p)\n}", "title": "" }, { "docid": "6194e71ecc7b4f06eec21eea0a07ed51", "score": "0.4839825", "text": "func (log *Log) AppendSingle(ctx context.Context, data []byte) (blog.Index, error) {\n\tindexes, err := log.Append(ctx, [][]byte{data})\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn indexes[0], nil\n}", "title": "" }, { "docid": "d48a85a4533acd34fd44c03cbac33029", "score": "0.4816652", "text": "func (rw *Writer) Write(p []byte) (n int, err error) {\n\trw.Conn.Send(\"LPUSH\", rw.Logname, string(p[:]))\n\trw.Conn.Send(\"LTRIM\", rw.Logname, 0, rw.EntryLimit)\n\tif err := rw.Conn.Flush(); err != nil {\n\t\treturn 0, err\n\t}\n\treturn 1, nil\n}", "title": "" }, { "docid": "a2be426a8b4b16d69867d6f2491b0fc3", "score": "0.48154598", "text": "func (q *queue) writeHead(value uint16) (uint16) {\n\tatomicstore16(&q.e.regions[q.region].data[q.ringOffset + descHeadOffset], value)\n\treturn value\n}", "title": "" }, { "docid": "929c2356dc51e6d98ba945ca0c3729d2", "score": "0.48119724", "text": "func (q *Queue) Push(object interface{}) error {\n\tq.Lock()\n\tdefer q.Unlock()\n\n\tif q.maxLen == 0 || q.len() < q.maxLen {\n\t\tq.queue = append(q.queue, object)\n\t\treturn nil\n\t}\n\n\t// q.maxLen > 0 && q.len() == q.maxLen\n\n\tswitch q.mode {\n\tcase modeNormal:\n\t\treturn ErrQueueOverflowed\n\tcase modeDrop:\n\t\tif _, err := q.pop(); err != nil {\n\t\t\treturn ErrFailedToDrop(err)\n\t\t}\n\t\tq.queue = append(q.queue, object)\n\t\treturn nil\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "34a79b1183ab114b37cae9b65d5b9654", "score": "0.48087856", "text": "func (this *LinkedBlockingDeque) PutFirst(e interface{}) {\n\tif e == nil {\n\t\treturn\n\t}\n\tthis.lock.Lock()\n\tdefer this.lock.Unlock()\n\tfor !this.linkFirst(e) {\n\t\tthis.notFull.Wait()\n\t}\n}", "title": "" }, { "docid": "fd2cccd22acf6d2b2c6403820f0857f2", "score": "0.48052564", "text": "func (b *Builder) Write(p []byte) (int, error) {}", "title": "" }, { "docid": "72770e944a5327103071f47a44e8982c", "score": "0.47995514", "text": "func (buf *CircularBuffer) Push(n int) {\n\tif buf.l == len(buf.buffer) {\n\t\tfmt.Println(\"Circular Buffer is full\")\n\t\treturn\n\t}\n\n\tbuf.buffer[(buf.s+buf.l)%len(buf.buffer)] = n\n\tbuf.l++\n}", "title": "" }, { "docid": "6eb2965eaad8f691d5e716fb836ca78c", "score": "0.47906092", "text": "func (b *Writer) Flush() error {}", "title": "" }, { "docid": "8d0e713ed04c6d07640d544d471798af", "score": "0.47883725", "text": "func (fs *OneFile) Write(ctx context.Context, name, event string) (int, error) {\n\tvar err error\n\n\tif !strings.HasSuffix(event, \"\\n\") {\n\t\tevent = event + \"\\n\"\n\t}\n\n\tn, err := fs.r.Write([]byte(event))\n\tif err != nil {\n\t\treturn n, errors.Wrap(err, \"fs.file.write\")\n\t}\n\treturn n, nil\n}", "title": "" }, { "docid": "b241365cdd4eb2900371449ff5510acc", "score": "0.47873548", "text": "func (h *HeapUint64) Push(item *ItemUint64) {\n\tn := len(*h)\n\titem.index = n\n\t*h = append(*h, item)\n\th.up(h.Len() - 1)\n}", "title": "" }, { "docid": "29692064634a09e894d6531a004be685", "score": "0.4785238", "text": "func (q *Queue) Push(elem Elem) {\n\tif q.count == len(q.buf) {\n\t\tq.resize()\n\t}\n\n\tq.buf[q.tail] = elem\n\t// bitwise modulus\n\tq.tail = (q.tail + 1) & (len(q.buf) - 1)\n\tq.count++\n}", "title": "" }, { "docid": "5db233f71e28d6e3de20c3852759d56f", "score": "0.47844663", "text": "func (s *SafeBuffer) Write(p []byte) (n int, err error) {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\treturn s.buffer.Write(p)\n}", "title": "" } ]
008ccfedf24e99be0239199b2a1d7a29
Logger indicates an expected call of Logger.
[ { "docid": "d57594c6d42a00a5e521079fcfd84900", "score": "0.6854616", "text": "func (mr *MockAgentManagerMockRecorder) Logger() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Logger\", reflect.TypeOf((*MockAgentManager)(nil).Logger))\n}", "title": "" } ]
[ { "docid": "d47c77fbb3936d3709fcfd2d503f180a", "score": "0.69084764", "text": "func (mr *MockDashMockRecorder) Logger() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Logger\", reflect.TypeOf((*MockDash)(nil).Logger))\n}", "title": "" }, { "docid": "db1d8f77be6b5c406f44a69ab6fce958", "score": "0.6848678", "text": "func (mr *MockNsxNetworkProvisionerMockRecorder) Logger() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Logger\", reflect.TypeOf((*MockNsxNetworkProvisioner)(nil).Logger))\n}", "title": "" }, { "docid": "546ea879bc8d9dc4421aff0f6b9e4dcc", "score": "0.6730798", "text": "func (mr *MockContextMockRecorder) Logger() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Logger\", reflect.TypeOf((*MockContext)(nil).Logger))\n}", "title": "" }, { "docid": "daeec91241db42c67565905784de6d40", "score": "0.6513448", "text": "func (f *FakeEnv) Logger() adapter.Logger { panic(\"should not be called\") }", "title": "" }, { "docid": "d68de790b2ebfd6aa9092cb544dcd55c", "score": "0.63383114", "text": "func (mr *MockNsxNetworkProvisionerMockRecorder) SetLogger(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetLogger\", reflect.TypeOf((*MockNsxNetworkProvisioner)(nil).SetLogger), arg0)\n}", "title": "" }, { "docid": "dfd9064b6ca6a0d73166a3a3bccb3072", "score": "0.61246294", "text": "func TestOwnLogger(t *testing.T) {\n\tassert := asserts.NewTestingAsserts(t, true)\n\townLogger := &testLogger{[]string{}}\n\n\tapplog.SetLevel(applog.LevelDebug)\n\tapplog.SetLogger(ownLogger)\n\n\tapplog.Debugf(\"Debug.\")\n\tapplog.Infof(\"Info.\")\n\tapplog.Warningf(\"Warning.\")\n\tapplog.Errorf(\"Error.\")\n\tapplog.Criticalf(\"Critical.\")\n\n\tassert.Length(ownLogger.logs, 5, \"Everything logged.\")\n}", "title": "" }, { "docid": "a44cc02c55555a2624ab945986f74fb1", "score": "0.5834252", "text": "func (mr *MockWriterMockRecorder) LogMissingCompanyName(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"LogMissingCompanyName\", reflect.TypeOf((*MockWriter)(nil).LogMissingCompanyName), arg0)\n}", "title": "" }, { "docid": "4c57ccaf4da7c8108bf5921206a6903b", "score": "0.5814643", "text": "func (mr *MockManagerMockRecorder) GetLogger() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetLogger\", reflect.TypeOf((*MockManager)(nil).GetLogger))\n}", "title": "" }, { "docid": "18f7714e97f2bedec274538f96843611", "score": "0.5800933", "text": "func (lc MockLogger) Info(_ string, _ ...interface{}) {\n}", "title": "" }, { "docid": "acfebba715c2430ce5725b9bc505ccca", "score": "0.57587576", "text": "func (d *defaultLogger) log(level, caller, msg string) {\n\tif !d.shouldLog(caller) {\n\t\t// return\n\t}\n\tt := time.Now()\n\tfmt.Println(\n\t\t\"[\"+level+\"]\",\n\t\tt.Format(time.RFC3339),\n\t\tcaller,\n\t\t\"▶ \",\n\t\tmsg,\n\t)\n}", "title": "" }, { "docid": "d9ed19eb693fd28681ad17480209e4f5", "score": "0.5734369", "text": "func (lc MockLogger) Trace(_ string, _ ...interface{}) {\n}", "title": "" }, { "docid": "3b7dca56e7798300cc40455dd06d6343", "score": "0.57088834", "text": "func (c *Config) Logger() tools.FieldLogger { return c.MockLogger }", "title": "" }, { "docid": "eaa49bbc6079e48660b7c0be6894622a", "score": "0.5706531", "text": "func (lc MockLogger) Debug(_ string, _ ...interface{}) {\n}", "title": "" }, { "docid": "b1258eb03592efc35efe8de63d2ae8d7", "score": "0.5675069", "text": "func TestGlobalLogger(t *testing.T) {\n\tbuffer := bytes.NewBuffer(make([]byte, 0, 1024))\n\n\toptions := []Option{\n\t\tOptions().WithDebugLevel(),\n\t\tOptions().WithAppender(appender.Json()),\n\t\tOptions().WithWriter(buffer),\n\t\tOptions().WithCaller(),\n\t\tOptions().WithMsgKey(\"msg\"),\n\t\tOptions().WithTimeKey(\"\"),\n\t\tOptions().WithLevelKey(\"level\"),\n\t\tOptions().WithPIDKey(\"pid\"),\n\t\tOptions().WithFileKey(\"file\"),\n\t\tOptions().WithLineKey(\"line\"),\n\t\tOptions().WithFuncKey(\"func\"),\n\t\tOptions().WithErrorKey(\"err\"),\n\t\tOptions().WithTimeFormat(\"060102\"),\n\t}\n\n\tlogger := NewLogger(options...).SetToGlobal()\n\n\tDebug(\"debug...\").String(\"trace\", \"xxx\").Int(\"id\", 123).Float64(\"pi\", 3.14).Any(\"any\", map[string]interface{}{\"a\": 1, \"b\": \"bbb\"}).Log()\n\tError(errors.New(\"我是错误\"), \"error...\").Byte(\"b\", 'a').Byte(\"es\", '\\n').Runes(\"words\", []rune(\"我是中国人\")).Log()\n\tError(nil, \"error with %d...\", 666).String(\"trace\", \"xxx\").Int(\"id\", 123).Float64(\"pi\", 3.14).Log()\n\tWarn(\"\\\"warn\\\"...\\r\\b\\t\\n\").Strings(\"s\\tb\\nd\\b\", []string{\"abc\\r\", \"efg\\n\"}).Log()\n\tInfo(\"info...\").Bools(\"bools\", []bool{true, false}).Bytes(\"bytes\", []byte{'\\b', '\\t', 'a', 'b', 'c', '\"', '\\n'}).Int16s(\"int16s\", []int16{123, 4567, 8901}).Float32s(\"float32s\", []float32{3.14, 6.18}).Log()\n\tlogger.Close()\n\n\tfile, _, _ := runtime.Caller(1)\n\n\tlogs := `{\"level\":\"debug\",\"file\":\"` + file + `\",\"line\":44,\"func\":\"github.com/FishGoddess/logit.TestGlobalLogger\",\"msg\":\"debug...\",\"trace\":\"xxx\",\"id\":123,\"pi\":3.14,\"any\":{\"a\":1,\"b\":\"bbb\"}}\n{\"level\":\"error\",\"file\":\"` + file + `\",\"line\":45,\"func\":\"github.com/FishGoddess/logit.TestGlobalLogger\",\"msg\":\"error...\",\"err\":\"我是错误\",\"b\":\"a\",\"es\":\"\\n\",\"words\":[\"我\",\"是\",\"中\",\"国\",\"人\"]}\n{\"level\":\"error\",\"file\":\"` + file + `\",\"line\":46,\"func\":\"github.com/FishGoddess/logit.TestGlobalLogger\",\"msg\":\"error with 666...\",\"err\":null,\"trace\":\"xxx\",\"id\":123,\"pi\":3.14}\n{\"level\":\"warn\",\"file\":\"` + file + `\",\"line\":47,\"func\":\"github.com/FishGoddess/logit.TestGlobalLogger\",\"msg\":\"\\\"warn\\\"...\\r\\b\\t\\n\",\"s\\tb\\nd\\b\":[\"abc\\r\",\"efg\\n\"]}\n{\"level\":\"info\",\"file\":\"` + file + `\",\"line\":48,\"func\":\"github.com/FishGoddess/logit.TestGlobalLogger\",\"msg\":\"info...\",\"bools\":[true,false],\"bytes\":[\"\\b\",\"\\t\",\"a\",\"b\",\"c\",\"\\\"\",\"\\n\"],\"int16s\":[123,4567,8901],\"float32s\":[3.140000104904175,6.179999828338623]}\n`\n\n\toutput := buffer.String()\n\tif output != logs {\n\t\tt.Errorf(\"logs %s is wrong with %s\", output, logs)\n\t}\n\n\tbuffer = bytes.NewBuffer(make([]byte, 0, 1024))\n\toptions = []Option{\n\t\tOptions().WithDebugLevel(),\n\t\tOptions().WithAppender(appender.Json()),\n\t\tOptions().WithWriter(buffer),\n\t\tOptions().WithCaller(),\n\t\tOptions().WithMsgKey(\"msg\"),\n\t\tOptions().WithTimeKey(\"\"),\n\t\tOptions().WithLevelKey(\"level\"),\n\t\tOptions().WithPIDKey(\"pid\"),\n\t\tOptions().WithFileKey(\"file\"),\n\t\tOptions().WithLineKey(\"\"),\n\t\tOptions().WithFuncKey(\"func\"),\n\t\tOptions().WithErrorKey(\"err\"),\n\t\tOptions().WithTimeFormat(\"060102\"),\n\t}\n\n\tlogger = NewLogger(options...).SetToGlobal()\n\tdefer logger.Close()\n\n\tDebug(\"debug...\").String(\"trace\", \"xxx\").Int(\"id\", 123).Float64(\"pi\", 3.14).Any(\"any\", map[string]interface{}{\"a\": 1, \"b\": \"bbb\"}).Log()\n\tError(errors.New(\"我是错误\"), \"error...\").Byte(\"b\", 'a').Byte(\"es\", '\\n').Runes(\"words\", []rune(\"我是中国人\")).Log()\n\tError(nil, \"error with %d...\", 666).String(\"trace\", \"xxx\").Int(\"id\", 123).Float64(\"pi\", 3.14).Log()\n\tWarn(\"\\\"warn\\\"...\\r\\b\\t\\n\").Strings(\"s\\tb\\nd\\b\", []string{\"abc\\r\", \"efg\\n\"}).Log()\n\tInfo(\"info...\").Bools(\"bools\", []bool{true, false}).Bytes(\"bytes\", []byte{'\\b', '\\t', 'a', 'b', 'c', '\"', '\\n'}).Int16s(\"int16s\", []int16{123, 4567, 8901}).Float32s(\"float32s\", []float32{3.14, 6.18}).Log()\n\n\ttestBuffer := bytes.NewBuffer(make([]byte, 0, 1024))\n\ttestLogger := NewLogger(append(options, Options().WithWriter(testBuffer))...)\n\n\ttestLogger.Debug(\"debug...\").String(\"trace\", \"xxx\").Int(\"id\", 123).Float64(\"pi\", 3.14).Any(\"any\", map[string]interface{}{\"a\": 1, \"b\": \"bbb\"}).Log()\n\ttestLogger.Error(errors.New(\"我是错误\"), \"error...\").Byte(\"b\", 'a').Byte(\"es\", '\\n').Runes(\"words\", []rune(\"我是中国人\")).Log()\n\ttestLogger.Error(nil, \"error with %d...\", 666).String(\"trace\", \"xxx\").Int(\"id\", 123).Float64(\"pi\", 3.14).Log()\n\ttestLogger.Warn(\"\\\"warn\\\"...\\r\\b\\t\\n\").Strings(\"s\\tb\\nd\\b\", []string{\"abc\\r\", \"efg\\n\"}).Log()\n\ttestLogger.Info(\"info...\").Bools(\"bools\", []bool{true, false}).Bytes(\"bytes\", []byte{'\\b', '\\t', 'a', 'b', 'c', '\"', '\\n'}).Int16s(\"int16s\", []int16{123, 4567, 8901}).Float32s(\"float32s\", []float32{3.14, 6.18}).Log()\n\n\toutput = buffer.String()\n\ttestOutput := testBuffer.String()\n\n\tif output != testOutput {\n\t\tt.Errorf(\"logs %s is wrong with %s\", output, testOutput)\n\t}\n}", "title": "" }, { "docid": "3cdd40a5a3370c65dfb904ae72058b60", "score": "0.5645291", "text": "func (fl *FakeLogger) Debug(...interface{}) {}", "title": "" }, { "docid": "22c2c7cf2f2283ce6c66ecc831b352b1", "score": "0.5586541", "text": "func testLogger() (model.Logger, *atomic.Int64) {\n\tn := &atomic.Int64{}\n\tlog := &mocks.Logger{\n\t\tMockInfof: func(format string, v ...interface{}) {\n\t\t\tn.Add(1)\n\t\t},\n\t}\n\treturn log, n\n}", "title": "" }, { "docid": "a797f6f3211b9fdbf773ae75613620dc", "score": "0.5578322", "text": "func (d *defaultLogger) shouldLog(caller string) bool {\n\tshouldLog := false\n\td.ensureNamespaces()\n\tfor _, namespace := range d.namespaces {\n\t\tif namespace == \"all\" {\n\t\t\tshouldLog = true\n\t\t}\n\t\tif strings.Contains(caller, namespace) {\n\t\t\tshouldLog = true\n\t\t}\n\t}\n\n\treturn shouldLog\n}", "title": "" }, { "docid": "b1b76177758e5bad48fd50f53425b0b9", "score": "0.55726486", "text": "func TestLog(t *testing.T) {\n\tlog.SetPrefix(\"bar:\")\n\tlog.SetFlags(log.Llongfile | log.LstdFlags)\n\tt.Log(log.Flags())\n\tlog.Println(\"hh\")\n\t//log.Panic(\"help\")\n\t//log.Fatal(\"fatal\")\n}", "title": "" }, { "docid": "906888ec1aa97fc93e95571e0a781e51", "score": "0.5557153", "text": "func (t *TestLogger) AssertCalled(level int, message string) bool {\n\tfor _, m := range t.messages {\n\t\tif m.level == level && m.m == message {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4a14e569b4bf4f68572c4a2ccba69c28", "score": "0.55538386", "text": "func (d *defaultLogger)Trace(v ...interface{}){\n\n}", "title": "" }, { "docid": "dd6f42af52257165098217c599d58f63", "score": "0.5535245", "text": "func (lc MockLogger) Infof(_ string, _ ...interface{}) {\n}", "title": "" }, { "docid": "9d4ebd9fcb66ffba6a5a9c8c2560301c", "score": "0.55238146", "text": "func logCaller(inspect string) {}", "title": "" }, { "docid": "0a3b91ce3f7cb13303f061c5005d8d6f", "score": "0.55111945", "text": "func TestChaincodeLogging(t *testing.T) {\n\n\t// From start() - We can't call start() from this test\n\tformat := logging.MustStringFormatter(\"%{time:15:04:05.000} [%{module}] %{level:.4s} : %{message}\")\n\tbackend := logging.NewLogBackend(os.Stderr, \"\", 0)\n\tbackendFormatter := logging.NewBackendFormatter(backend, format)\n\tlogging.SetBackend(backendFormatter).SetLevel(logging.Level(shimLoggingLevel), \"shim\")\n\n\tfoo := NewLogger(\"foo\")\n\tbar := NewLogger(\"bar\")\n\n\tfoo.Debugf(\"Foo is debugging: %d\", 10)\n\tbar.Infof(\"Bar is informational? %s.\", \"Yes\")\n\tfoo.Noticef(\"NOTE NOTE NOTE\")\n\tbar.Warningf(\"Danger, Danger %s %s\", \"Will\", \"Robinson!\")\n\tfoo.Errorf(\"I'm sorry Dave, I'm afraid I can't do that.\")\n\tbar.Criticalf(\"PI is not equal to 3.14, we computed it as %.2f\", 4.13)\n\n\tbar.Debug(\"Foo is debugging:\", 10)\n\tfoo.Info(\"Bar is informational?\", \"Yes.\")\n\tbar.Notice(\"NOTE NOTE NOTE\")\n\tfoo.Warning(\"Danger, Danger\", \"Will\", \"Robinson!\")\n\tbar.Error(\"I'm sorry Dave, I'm afraid I can't do that.\")\n\tfoo.Critical(\"PI is not equal to\", 3.14, \", we computed it as\", 4.13)\n\n\tfoo.SetLevel(LogWarning)\n\tif foo.IsEnabledFor(LogDebug) {\n\t\tt.Errorf(\"'foo' should not be enabled for LogDebug\")\n\t}\n\tif !foo.IsEnabledFor(LogCritical) {\n\t\tt.Errorf(\"'foo' should be enabled for LogCritical\")\n\t}\n\tbar.SetLevel(LogCritical)\n\tif bar.IsEnabledFor(LogDebug) {\n\t\tt.Errorf(\"'bar' should not be enabled for LogDebug\")\n\t}\n\tif !bar.IsEnabledFor(LogCritical) {\n\t\tt.Errorf(\"'bar' should be enabled for LogCritical\")\n\t}\n}", "title": "" }, { "docid": "0a3b91ce3f7cb13303f061c5005d8d6f", "score": "0.55111945", "text": "func TestChaincodeLogging(t *testing.T) {\n\n\t// From start() - We can't call start() from this test\n\tformat := logging.MustStringFormatter(\"%{time:15:04:05.000} [%{module}] %{level:.4s} : %{message}\")\n\tbackend := logging.NewLogBackend(os.Stderr, \"\", 0)\n\tbackendFormatter := logging.NewBackendFormatter(backend, format)\n\tlogging.SetBackend(backendFormatter).SetLevel(logging.Level(shimLoggingLevel), \"shim\")\n\n\tfoo := NewLogger(\"foo\")\n\tbar := NewLogger(\"bar\")\n\n\tfoo.Debugf(\"Foo is debugging: %d\", 10)\n\tbar.Infof(\"Bar is informational? %s.\", \"Yes\")\n\tfoo.Noticef(\"NOTE NOTE NOTE\")\n\tbar.Warningf(\"Danger, Danger %s %s\", \"Will\", \"Robinson!\")\n\tfoo.Errorf(\"I'm sorry Dave, I'm afraid I can't do that.\")\n\tbar.Criticalf(\"PI is not equal to 3.14, we computed it as %.2f\", 4.13)\n\n\tbar.Debug(\"Foo is debugging:\", 10)\n\tfoo.Info(\"Bar is informational?\", \"Yes.\")\n\tbar.Notice(\"NOTE NOTE NOTE\")\n\tfoo.Warning(\"Danger, Danger\", \"Will\", \"Robinson!\")\n\tbar.Error(\"I'm sorry Dave, I'm afraid I can't do that.\")\n\tfoo.Critical(\"PI is not equal to\", 3.14, \", we computed it as\", 4.13)\n\n\tfoo.SetLevel(LogWarning)\n\tif foo.IsEnabledFor(LogDebug) {\n\t\tt.Errorf(\"'foo' should not be enabled for LogDebug\")\n\t}\n\tif !foo.IsEnabledFor(LogCritical) {\n\t\tt.Errorf(\"'foo' should be enabled for LogCritical\")\n\t}\n\tbar.SetLevel(LogCritical)\n\tif bar.IsEnabledFor(LogDebug) {\n\t\tt.Errorf(\"'bar' should not be enabled for LogDebug\")\n\t}\n\tif !bar.IsEnabledFor(LogCritical) {\n\t\tt.Errorf(\"'bar' should be enabled for LogCritical\")\n\t}\n}", "title": "" }, { "docid": "e8b92eefa433f6afee6e0cd09ffcdcb1", "score": "0.5505516", "text": "func TestNewLogger(t *testing.T) {\n\tt.Run(\"Construct new logger\", func(t *testing.T) {\n\t\tcfg := logConfig(false)\n\t\tl, err := NewLogger(cfg)\n\t\tassert.NoError(t, err)\n\t\tassert.Equal(t, logrus.InfoLevel, l.GetLevel())\n\t})\n\n\tt.Run(\"Logger format\", func(t *testing.T) {\n\t\tcfg := logConfig(false)\n\t\tcfg.Format = \"du'soley\"\n\t\tl, err := NewLogger(cfg)\n\t\tassert.NoError(t, err)\n\t\tassert.Equal(t, &logrus.JSONFormatter{TimestampFormat: time.RFC3339}, l.Formatter)\n\t})\n\n\tt.Run(\"good sentry config\", func(t *testing.T) {\n\t\tcfg := logConfig(true)\n\t\tl, err := NewLogger(cfg)\n\t\tassert.NoError(t, err)\n\t\tassert.Equal(t, len(l.Hooks), len(sentryLevels[:getLoggerLevel(cfg)]))\n\t})\n\n\tt.Run(\"bad sentry config\", func(t *testing.T) {\n\t\tcfg := logConfig(true)\n\t\tcfg.Sentry.DSN = \"bad dsn\"\n\t\t_, err := NewLogger(cfg)\n\t\tassert.Error(t, err)\n\t})\n\n}", "title": "" }, { "docid": "84f4261f1338d232048f69994af5b5da", "score": "0.55005336", "text": "func Logger(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\tstart := time.Now()\n\n\tlog.Printf(\n\t\t\"%s\\t%s\\t%s\",\n\t\tr.Method,\n\t\tr.RequestURI,\n\t\ttime.Since(start),\n\t)\n\n\tnext(w, r)\n}", "title": "" }, { "docid": "861e3b1a0e43cbcd4becfd737cd4c090", "score": "0.54741025", "text": "func TestSysLogger(t *testing.T) {\n\tcheckPrivledges(t)\n\tlogger := NewSysLogger(false, false)\n\tif logger.debug {\n\t\tt.Fatalf(\"Expected %t, received %t\\n\", false, logger.debug)\n\t}\n\n\tif logger.trace {\n\t\tt.Fatalf(\"Expected %t, received %t\\n\", false, logger.trace)\n\t}\n\tlogger.Noticef(\"%s\", \"Noticef\")\n\tif !lastLogEntryContains(t, \"[NOTICE]: Noticef\") {\n\t\tt.Fatalf(\"missing log entry\")\n\t}\n\n\tlogger.Errorf(\"%s\", \"Errorf\")\n\tif !lastLogEntryContains(t, \"[ERROR]: Errorf\") {\n\t\tt.Fatalf(\"missing log entry\")\n\t}\n\n\tlogger.Tracef(\"%s\", \"Tracef\")\n\tif lastLogEntryContains(t, \"Tracef\") {\n\t\tt.Fatalf(\"should not contain log entry\")\n\t}\n\n\tlogger.Debugf(\"%s\", \"Debugf\")\n\tif lastLogEntryContains(t, \"Debugf\") {\n\t\tt.Fatalf(\"should not contain log entry\")\n\t}\n}", "title": "" }, { "docid": "5ebc0de0b6bef3c02d8ad0c69fed0f11", "score": "0.54700375", "text": "func (_m *mockApp) Loginfof(_a0 string, _a1 ...interface{}) {\n\t_m.Called(_a0, _a1)\n}", "title": "" }, { "docid": "0934833637465e5a6d00836b80ef61ee", "score": "0.5465223", "text": "func TestShimLogging(t *testing.T) {\n\tSetLoggingLevel(LogCritical)\n\tif shimLoggingLevel != LogCritical {\n\t\tt.Errorf(\"shimLoggingLevel is not LogCritical as expected\")\n\t}\n\tif chaincodeLogger.IsEnabledFor(logging.DEBUG) {\n\t\tt.Errorf(\"The chaincodeLogger should not be enabled for DEBUG\")\n\t}\n\tif !chaincodeLogger.IsEnabledFor(logging.CRITICAL) {\n\t\tt.Errorf(\"The chaincodeLogger should be enabled for CRITICAL\")\n\t}\n\tvar level LoggingLevel\n\tvar err error\n\tlevel, err = LogLevel(\"debug\")\n\tif err != nil {\n\t\tt.Errorf(\"LogLevel(debug) failed\")\n\t}\n\tif level != LogDebug {\n\t\tt.Errorf(\"LogLevel(debug) did not return LogDebug\")\n\t}\n\tlevel, err = LogLevel(\"INFO\")\n\tif err != nil {\n\t\tt.Errorf(\"LogLevel(INFO) failed\")\n\t}\n\tif level != LogInfo {\n\t\tt.Errorf(\"LogLevel(INFO) did not return LogInfo\")\n\t}\n\tlevel, err = LogLevel(\"Notice\")\n\tif err != nil {\n\t\tt.Errorf(\"LogLevel(Notice) failed\")\n\t}\n\tif level != LogNotice {\n\t\tt.Errorf(\"LogLevel(Notice) did not return LogNotice\")\n\t}\n\tlevel, err = LogLevel(\"WaRnInG\")\n\tif err != nil {\n\t\tt.Errorf(\"LogLevel(WaRnInG) failed\")\n\t}\n\tif level != LogWarning {\n\t\tt.Errorf(\"LogLevel(WaRnInG) did not return LogWarning\")\n\t}\n\tlevel, err = LogLevel(\"ERRor\")\n\tif err != nil {\n\t\tt.Errorf(\"LogLevel(ERRor) failed\")\n\t}\n\tif level != LogError {\n\t\tt.Errorf(\"LogLevel(ERRor) did not return LogError\")\n\t}\n\tlevel, err = LogLevel(\"critiCAL\")\n\tif err != nil {\n\t\tt.Errorf(\"LogLevel(critiCAL) failed\")\n\t}\n\tif level != LogCritical {\n\t\tt.Errorf(\"LogLevel(critiCAL) did not return LogCritical\")\n\t}\n\tlevel, err = LogLevel(\"foo\")\n\tif err == nil {\n\t\tt.Errorf(\"LogLevel(foo) did not fail\")\n\t}\n\tif level != LogError {\n\t\tt.Errorf(\"LogLevel(foo) did not return LogError\")\n\t}\n}", "title": "" }, { "docid": "0934833637465e5a6d00836b80ef61ee", "score": "0.5465223", "text": "func TestShimLogging(t *testing.T) {\n\tSetLoggingLevel(LogCritical)\n\tif shimLoggingLevel != LogCritical {\n\t\tt.Errorf(\"shimLoggingLevel is not LogCritical as expected\")\n\t}\n\tif chaincodeLogger.IsEnabledFor(logging.DEBUG) {\n\t\tt.Errorf(\"The chaincodeLogger should not be enabled for DEBUG\")\n\t}\n\tif !chaincodeLogger.IsEnabledFor(logging.CRITICAL) {\n\t\tt.Errorf(\"The chaincodeLogger should be enabled for CRITICAL\")\n\t}\n\tvar level LoggingLevel\n\tvar err error\n\tlevel, err = LogLevel(\"debug\")\n\tif err != nil {\n\t\tt.Errorf(\"LogLevel(debug) failed\")\n\t}\n\tif level != LogDebug {\n\t\tt.Errorf(\"LogLevel(debug) did not return LogDebug\")\n\t}\n\tlevel, err = LogLevel(\"INFO\")\n\tif err != nil {\n\t\tt.Errorf(\"LogLevel(INFO) failed\")\n\t}\n\tif level != LogInfo {\n\t\tt.Errorf(\"LogLevel(INFO) did not return LogInfo\")\n\t}\n\tlevel, err = LogLevel(\"Notice\")\n\tif err != nil {\n\t\tt.Errorf(\"LogLevel(Notice) failed\")\n\t}\n\tif level != LogNotice {\n\t\tt.Errorf(\"LogLevel(Notice) did not return LogNotice\")\n\t}\n\tlevel, err = LogLevel(\"WaRnInG\")\n\tif err != nil {\n\t\tt.Errorf(\"LogLevel(WaRnInG) failed\")\n\t}\n\tif level != LogWarning {\n\t\tt.Errorf(\"LogLevel(WaRnInG) did not return LogWarning\")\n\t}\n\tlevel, err = LogLevel(\"ERRor\")\n\tif err != nil {\n\t\tt.Errorf(\"LogLevel(ERRor) failed\")\n\t}\n\tif level != LogError {\n\t\tt.Errorf(\"LogLevel(ERRor) did not return LogError\")\n\t}\n\tlevel, err = LogLevel(\"critiCAL\")\n\tif err != nil {\n\t\tt.Errorf(\"LogLevel(critiCAL) failed\")\n\t}\n\tif level != LogCritical {\n\t\tt.Errorf(\"LogLevel(critiCAL) did not return LogCritical\")\n\t}\n\tlevel, err = LogLevel(\"foo\")\n\tif err == nil {\n\t\tt.Errorf(\"LogLevel(foo) did not fail\")\n\t}\n\tif level != LogError {\n\t\tt.Errorf(\"LogLevel(foo) did not return LogError\")\n\t}\n}", "title": "" }, { "docid": "63a76cff738f7332100a661e6f01ac33", "score": "0.5460017", "text": "func (fl *FakeLogger) Info(...interface{}) {}", "title": "" }, { "docid": "c36a1df0b44a8322a1c8ea5d9b80b17d", "score": "0.54532313", "text": "func TestStdLoggerTraceWithOutDebug(t *testing.T) {\n\texpectOutput(t, func() {\n\t\tlogger := NewStdLogger(false, false, false, false, false)\n\t\tlogger.Tracef(\"foo\")\n\t}, \"\")\n}", "title": "" }, { "docid": "ba4db7e4ce0a4d491ff1c6b3ffd735e2", "score": "0.54490864", "text": "func Logger(start time.Time, r *http.Request) {\n\tlog.Printf(\n\t\t\"%s\\t%s\\t%s\",\n\t\tr.Method,\n\t\tr.RequestURI,\n\t\ttime.Since(start),\n\t)\n}", "title": "" }, { "docid": "84d69ce4d227d3b2c6325de10d5ecc6b", "score": "0.5444716", "text": "func (m *MockLoggable) Logger() Logger {\n\treturn m.l\n}", "title": "" }, { "docid": "bfa8c2f3fd6b8186c54b3f2be7f32dbe", "score": "0.5421969", "text": "func TestGoLogger(t *testing.T) {\n\tlog.SetOutput(os.Stdout)\n\n\tapplog.SetLevel(applog.LevelDebug)\n\tapplog.SetLogger(applog.GoLogger{})\n\n\tapplog.Debugf(\"Debug.\")\n\tapplog.Infof(\"Info.\")\n\tapplog.Warningf(\"Warning.\")\n\tapplog.Errorf(\"Error.\")\n\tapplog.Criticalf(\"Critical.\")\n}", "title": "" }, { "docid": "9cdd76e2ba6c29b966f2b8c0a162304a", "score": "0.5420345", "text": "func Logger(logFunc func(...interface{})) {\n\tlogger = logFunc\n}", "title": "" }, { "docid": "958440ca043764ffee4118be2adb3f08", "score": "0.5418675", "text": "func (_m *MockLogger) Fatal(args ...interface{}) {\n\tvar _ca []interface{}\n\t_ca = append(_ca, args...)\n\t_m.Called(_ca...)\n}", "title": "" }, { "docid": "989494dbf99b133a78b7a042d34b7db8", "score": "0.54095995", "text": "func (m *MockNsxNetworkProvisioner) Logger() logrus.FieldLogger {\n\tret := m.ctrl.Call(m, \"Logger\")\n\tret0, _ := ret[0].(logrus.FieldLogger)\n\treturn ret0\n}", "title": "" }, { "docid": "2efc21b6bb3f6ac47adec9666038877d", "score": "0.5404045", "text": "func (mr *MockDeploymentMockRecorder) getLog() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"getLog\", reflect.TypeOf((*MockDeployment)(nil).getLog))\n}", "title": "" }, { "docid": "f863a24a5ca870cd01e13994722bcfe3", "score": "0.5380295", "text": "func (mr *MockBeaconMockRecorder) Loggable() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Loggable\", reflect.TypeOf((*MockBeacon)(nil).Loggable))\n}", "title": "" }, { "docid": "7145d071579e225d2dd57c23471fb975", "score": "0.5377956", "text": "func log(message string)", "title": "" }, { "docid": "1e3a5daeb2d8fd9784248275b19f75af", "score": "0.5368662", "text": "func (_Rollup *RollupCaller) Logger(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Rollup.contract.Call(opts, out, \"logger\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "70fd7f276b8e7a54a3078587fcfe8400", "score": "0.5364785", "text": "func (l NamedLogger) Err(format string, args ...interface{}) {\n\tv := klog.V(1)\n\tif v {\n\t\tv.Infof(\"[Error] %s\\n\", fmt.Sprintf(format, args...))\n\t}\n}", "title": "" }, { "docid": "aca7ddc93057dec3cc9f3a1c1793198f", "score": "0.536149", "text": "func ShouldLogCaller() bool {\n\treturn configManager.GetBool(\"log.caller\")\n}", "title": "" }, { "docid": "e8cf951618ddaa80581ecc611a19e486", "score": "0.5358887", "text": "func (mw *Middleware) Logger(before web.Handler) web.Handler {\n\th := func(ctx context.Context, log *log.Logger, w http.ResponseWriter, r *http.Request, params map[string]string) error {\n\t\tctx, span := trace.StartSpan(ctx, \"internal.mid.Logger\")\n\t\tdefer span.End()\n\n\t\t// If the context is missing this value, request the service\n\t\t// to be shutdown gracefully.\n\t\tv, ok := ctx.Value(web.KeyValues).(*web.Values)\n\t\tif !ok {\n\t\t\treturn web.Shutdown(\"web value missing from context\")\n\t\t}\n\n\t\terr := before(ctx, log, w, r, params)\n\n\t\tlog.Printf(\"%s : (%d) : %s %s -> %s (%s)\\n\",\n\t\t\tv.TraceID,\n\t\t\tv.StatusCode,\n\t\t\tr.Method, r.URL.Path,\n\t\t\tr.RemoteAddr, time.Since(v.Now),\n\t\t)\n\n\t\t// For consistency return the error we received.\n\t\treturn err\n\t}\n\n\treturn h\n}", "title": "" }, { "docid": "644c9c55c49988d14f3a30c26172439c", "score": "0.5346843", "text": "func TestLogging(t *testing.T) {\n\n}", "title": "" }, { "docid": "a73ccfdb735bb66ce64c5b5a35eee52c", "score": "0.53406614", "text": "func TestLogger(t *testing.T) {\n\ta := assert.New(t)\n\tr := require.New(t)\n\tlogger := NewLogger()\n\tbuff := bytes.NewBufferString(\"\")\n\tlogger.SetOutput(buff)\n\n\tn := negroni.New()\n\tn.Use(logger)\n\n\tcodes := []int{100, 200, 300, 400, 500}\n\tfor _, code := range codes {\n\t\tn.UseHandler(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {\n\t\t\trw.WriteHeader(code)\n\t\t}))\n\n\t\treq, err := http.NewRequest(\"GET\", \"http://localhost:3000/foobar\", nil)\n\t\ta.NoError(err)\n\n\t\tn.ServeHTTP(httptest.NewRecorder(), req)\n\t\tr.NotEqual(0, buff.Len())\n\t\ta.Contains(buff.String(), \"GET\")\n\t\ta.Contains(buff.String(), \"/foobar\")\n\t}\n\n\tmethods := []string{\"GET\", \"POST\", \"PUT\", \"DELETE\", \"PATCH\", \"HEAD\", \"OPTIONS\", \"OTHER\"}\n\tfor _, method := range methods {\n\t\treq, err := http.NewRequest(method, \"http://localhost:3000/foobar\", nil)\n\t\ta.NoError(err)\n\n\t\tn.ServeHTTP(httptest.NewRecorder(), req)\n\t\tr.NotEqual(0, buff.Len())\n\t\ta.Contains(buff.String(), method)\n\t\ta.Contains(buff.String(), \"/foobar\")\n\t}\n}", "title": "" }, { "docid": "a0da198b89f0510eb22bb2e0ce898075", "score": "0.5337613", "text": "func Logger(next http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tlog.Printf(\"Hit at: %s, Request type = %s, Cookie = %s\", r.URL.Path, r.Method, logCookie(r))\n\t\tnext(w, r)\n\t}\n}", "title": "" }, { "docid": "cef7d7df3d451ee5fb752d4bbf3667ce", "score": "0.5318043", "text": "func TestStdLoggerDebugWithOutDebug(t *testing.T) {\n\texpectOutput(t, func() {\n\t\tlogger := NewStdLogger(false, false, false, false, false)\n\t\tlogger.Debugf(\"foo\")\n\t}, \"\")\n}", "title": "" }, { "docid": "e31a3428eeb283fe872412b839ba910c", "score": "0.531334", "text": "func (d *DefaultLogger) LogEnabled() bool {\n\tif d == nil {\n\t\treturn false\n\t}\n\treturn d.enabled\n}", "title": "" }, { "docid": "a5c7bca1b1619860701762e744dd2593", "score": "0.53115207", "text": "func Logger(c *Context) {\n\tstart := time.Now()\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tlog.Println(\"PANIC\", r, \"-\", c.Request.Method, \"->\", c.Request.URL.String())\n\t\t\tpanic(r)\n\t\t}\n\t}()\n\n\tc.Next()\n\tdur := time.Now().Sub(start)\n\tlog.Println(c.Request.Method, \"-\", dur.String(), \"->\", c.Request.URL.String())\n}", "title": "" }, { "docid": "0555e04860453d7c9b4eec9c568a49ad", "score": "0.5292217", "text": "func (lc MockLogger) Debugf(_ string, _ ...interface{}) {\n}", "title": "" }, { "docid": "4f3f6a902139296becfe533e6f597e69", "score": "0.5285662", "text": "func (mr *MockLoggableMockRecorder) Loggable() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Loggable\", reflect.TypeOf((*MockLoggable)(nil).Loggable))\n}", "title": "" }, { "docid": "0ab067b1557fae751313b468c21ffc86", "score": "0.5284201", "text": "func UseLogger(newLogger seelog.LoggerInterface) {\n\tlogger = newLogger\n\tnewLogger.SetAdditionalStackDepth(2)\n}", "title": "" }, { "docid": "25bb0b8cceb3d3a59f9e7161f8f6a7bf", "score": "0.5274773", "text": "func TestServiceLogger(t *testing.T) {\n\tl := newMemLogger(true, true)\n\trunTestWithLogger(t, l, func(s *Session) {\n\t\tif s.Logger() != l {\n\t\t\tt.Errorf(\"expected Logger to return the logger passed to SetLogger, but it didn't\")\n\t\t}\n\t}, nil)\n}", "title": "" }, { "docid": "c6d6bb403a507345d5e33adafeaf4e0d", "score": "0.52640676", "text": "func RequestLogger(req *restful.Request, resp *restful.Response, chain *restful.FilterChain) {\n\tchain.ProcessFilter(req, resp)\n\tlogger.Printf(\"%s - \\\"%s %s %s\\\" %d\",\n\t\ttime.Now().Format(time.Stamp),\n\t\treq.Request.Method,\n\t\treq.Request.RequestURI,\n\t\treq.Request.Proto,\n\t\tresp.StatusCode(),\n\t)\n}", "title": "" }, { "docid": "a4110a90e3bde61309e8762dadf82321", "score": "0.52560014", "text": "func (s *synchronizedContext) Logger(name string) (io.Writer, bool) {\n\ts.mutex.RLock()\n\tdefer s.mutex.RUnlock()\n\treturn s.cxt.Logger(name)\n}", "title": "" }, { "docid": "ba51b55405edb45f5916f257216653b4", "score": "0.5247481", "text": "func (mr *MockStrategyMockRecorder) Loggable() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Loggable\", reflect.TypeOf((*MockStrategy)(nil).Loggable))\n}", "title": "" }, { "docid": "a36cc90d9af1f207be744cd491c908b5", "score": "0.5245951", "text": "func logger(format string, a ...any) {\n\tfmt.Printf(\"LOG:\\t\"+format+\"\\n\", a...)\n}", "title": "" }, { "docid": "29eac0d2af3e3df832a18a0b6b29f020", "score": "0.5238549", "text": "func (dummyHandler) Log(r *log.Record) error {\n\treturn nil\n}", "title": "" }, { "docid": "081b723697f71976d77cd7a45b5cbe26", "score": "0.52379894", "text": "func (mr *MockLoggerMockRecorder) Info(format interface{}, args ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{format}, args...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Info\", reflect.TypeOf((*MockLogger)(nil).Info), varargs...)\n}", "title": "" }, { "docid": "897160bb5449076ad9a9edf07521b8b5", "score": "0.5232534", "text": "func testLogger() *log.Logger {\n\n\tlogger := log.New(os.Stderr, \"[test] \", log.Ltime)\n\t// suppress the regular output from app\n\tlogger.SetOutput(io.Discard)\n\treturn logger\n}", "title": "" }, { "docid": "930ad9a9d368923ba83b2274c82744ea", "score": "0.5231633", "text": "func (m *MockDash) Logger() log.Logger {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Logger\")\n\tret0, _ := ret[0].(log.Logger)\n\treturn ret0\n}", "title": "" }, { "docid": "7961f9276b328a134701a209b7cb45bd", "score": "0.5231409", "text": "func (m *Middleware) Logger(next http.Handler) http.Handler {\n\tconst defaultFields = 3\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tstart := time.Now()\n\t\tww := middleware.NewWrapResponseWriter(w, r.ProtoMajor)\n\n\t\tnext.ServeHTTP(ww, r)\n\n\t\tfields := make([]zap.Field, defaultFields+len(m.f))\n\t\tfields[0] = requestFields(r)\n\t\tfields[1] = responseFields(ww)\n\t\tfields[2] = zap.Duration(\"duration\", time.Since(start))\n\t\tvar ctx = r.Context()\n\t\tfor i, fn := range m.f {\n\t\t\tfields[i+defaultFields] = fn(ctx)\n\t\t}\n\n\t\tm.l.Info(r.Method+\" \"+r.URL.Path+\": request completed\", fields...)\n\t})\n}", "title": "" }, { "docid": "99f540d9680c0800ff4f3da1cec58d6e", "score": "0.52283186", "text": "func Log(logger func(format string, a ...interface{})) {\n\tif isRunning {\n\t\tpanic(\"GRACE PANIC set log after running.\")\n\t}\n\tdefaultLogger = logger\n}", "title": "" }, { "docid": "2a961a6bbaa52c18c0f0c2dfdfb769ba", "score": "0.5222366", "text": "func (m *MockAgentManager) Logger() *logrus.Entry {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Logger\")\n\tret0, _ := ret[0].(*logrus.Entry)\n\treturn ret0\n}", "title": "" }, { "docid": "38727e3a6e34e3b86a82141a3cab1ac1", "score": "0.5221739", "text": "func (*NopLogger) Debug(args ...interface{}) {}", "title": "" }, { "docid": "2f1b9ca32c587bbeeec551293a8302fc", "score": "0.52171046", "text": "func (_m *mockApp) Logwarnf(_a0 string, _a1 ...interface{}) {\n\t_m.Called(_a0, _a1)\n}", "title": "" }, { "docid": "b23ba9e733417271ebadb4bfb879bd34", "score": "0.5211356", "text": "func (n *NopLogger) Fatal(args ...interface{}) {}", "title": "" }, { "docid": "d7179f3653cc6fceb3c1a971213cbf2e", "score": "0.5200571", "text": "func (k *Keeper) Logger(ctx context.Context) log.Logger {\n\tsdkCtx := sdk.UnwrapSDKContext(ctx)\n\treturn sdkCtx.Logger().With(\"module\", \"x/\"+types.ModuleName)\n}", "title": "" }, { "docid": "ab2535e5db4c2a9628226a054be7d6ad", "score": "0.5198644", "text": "func NewLogger() *Logger { return &Logger{prefix: \"[anirip] \"} }", "title": "" }, { "docid": "3f76344b3571fe904d00149decf58fdf", "score": "0.51908857", "text": "func logger(errType string, text string) {\n\terrText := \"\"\n\tif (errType == \"error\") || (errType == \"fatal\") || (verbose == true) {\n\t\terrText = \"AHOY! [\" + errType + \"] ==> \" + text + \"\\n\"\n\t\tlog.Print(errText)\n\t}\n\tif errType == \"fatal\" {\n\t\tpanic(errText)\n\t}\n}", "title": "" }, { "docid": "220791765e9966fcb524b434051bf846", "score": "0.5190044", "text": "func Logger(next http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tlog.Printf(\"\\n %s %s %s\", r.Method, r.RequestURI, r.Host)\n\t\tnext(w, r)\n\t}\n}", "title": "" }, { "docid": "4513a4fdcf8eb9c9c5ace966fce591c1", "score": "0.51894027", "text": "func Logger(next echo.HandlerFunc) echo.HandlerFunc {\n\treturn func(context echo.Context) error {\n\t\tcurrent := time.Now()\n\t\terr := next(context)\n\t\telapsed := time.Now().Sub(current)\n\t\tif err != nil {\n\t\t\tglobal.MyLogger.Println(elapsed)\n\t\t\treturn err\n\t\t}\n\t\tglobal.MyLogger.Println(elapsed)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "27367cecece2b703932b7120fd783a2d", "score": "0.5182875", "text": "func setup(name string, logger *logging.Logger) {\n\tshouldLog := false\n\n\t// Check to see if name should be logged.\n\tfor _, l := range Available {\n\t\tif l == name {\n\t\t\tshouldLog = true\n\t\t}\n\n\t\t// If \"all\" is in our list of available logging, enable all logging.\n\t\tif l == \"all\" {\n\t\t\tshouldLog = true\n\t\t}\n\t}\n\n\t// Set up backend if we should log.\n\tif shouldLog {\n\t\tlogger.SetBackend(Backend)\n\t} else {\n\t\tnullBackend := logging.NewLogBackend(ioutil.Discard, \"\", 0)\n\t\tbackendLeveled := logging.AddModuleLevel(nullBackend)\n\t\tbackendLeveled.SetLevel(logging.CRITICAL, \"\")\n\t\tlogger.SetBackend(backendLeveled)\n\t}\n}", "title": "" }, { "docid": "9db3dd3e980c66b1832f1fcb4b31b4ff", "score": "0.5179652", "text": "func (d *DiscardLogger) Fail(args ...interface{}) {}", "title": "" }, { "docid": "4fc0fdc05d9ea50398a5a1ec0e8fe1c2", "score": "0.5179418", "text": "func (_m *mockApp) Logcritf(_a0 string, _a1 ...interface{}) {\n\t_m.Called(_a0, _a1)\n}", "title": "" }, { "docid": "0e37e6d55a3aeb15f968db53494fe743", "score": "0.5172835", "text": "func UseLogger(zl zerolog.Logger) {\n\tlogger = zl\n}", "title": "" }, { "docid": "e8636cb4ff0ab4c5a28f1e83e09ac4fe", "score": "0.5169364", "text": "func (mr *MockContextMockRecorder) Log() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Log\", reflect.TypeOf((*MockContext)(nil).Log))\n}", "title": "" }, { "docid": "37f716b96543f114ae6eda008c94f0ba", "score": "0.51692843", "text": "func (mr *MockLoggerMockRecorder) Info(arg0 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Info\", reflect.TypeOf((*MockLogger)(nil).Info), arg0...)\n}", "title": "" }, { "docid": "b1e51de2b62b406843053f07b0d64710", "score": "0.51578516", "text": "func SetupLogger(level string) {\n\tif flag.Lookup(\"test.v\") != nil {\n\t\tsetupTestLogger()\n\t} else {\n\t\tsetupMainLogger(level)\n\t}\n}", "title": "" }, { "docid": "43d936810f8b128161cbb6662f4fd063", "score": "0.5156617", "text": "func (lc MockLogger) Tracef(_ string, _ ...interface{}) {\n}", "title": "" }, { "docid": "c2bcf8b2583d0fc19f6da75d6227bec8", "score": "0.5149719", "text": "func (mr *MockLoggerMockRecorder) Fatal(arg0 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Fatal\", reflect.TypeOf((*MockLogger)(nil).Fatal), arg0...)\n}", "title": "" }, { "docid": "2f764dce32d44af2edbfd7f3b228a098", "score": "0.51451635", "text": "func (_Rollup *RollupCallerSession) Logger() (common.Address, error) {\n\treturn _Rollup.Contract.Logger(&_Rollup.CallOpts)\n}", "title": "" }, { "docid": "720df252c7bbd86ca97f728b5b4b4621", "score": "0.51433957", "text": "func (l *log) log(level Level, msg string, fields ...zap.Field) {\n\tif ce := l.internalLogger.Check(zapcore.Level(level), msg); ce != nil {\n\t\tce.Write(fields...)\n\t}\n}", "title": "" }, { "docid": "e00d527538484ab7b22da302c2934b49", "score": "0.5141151", "text": "func (logger *EmptyLogger) WithStack(error) Logger { return logger }", "title": "" }, { "docid": "4c5b7bb53cd770a995d8d997192e8b98", "score": "0.51400495", "text": "func Logger() Middleware {\n\treturn func(next ship.Handler) ship.Handler {\n\t\treturn func(ctx *ship.Context) (err error) {\n\t\t\tstart := time.Now()\n\t\t\terr = next(ctx)\n\t\t\tcost := time.Since(start)\n\n\t\t\tcode := ctx.StatusCode()\n\t\t\tif err != nil && !ctx.IsResponded() {\n\t\t\t\tif hse, ok := err.(ship.HTTPServerError); ok {\n\t\t\t\t\tcode = hse.Code\n\t\t\t\t} else {\n\t\t\t\t\tcode = http.StatusInternalServerError\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar logf func(string, ...interface{})\n\t\t\tif code < 400 {\n\t\t\t\tlogf = ctx.Infof\n\t\t\t} else if code < 500 {\n\t\t\t\tlogf = ctx.Warnf\n\t\t\t} else {\n\t\t\t\tlogf = ctx.Errorf\n\t\t\t}\n\n\t\t\treq := ctx.Request()\n\t\t\tlogf(logfmt, req.RemoteAddr, req.Method, req.URL.RequestURI(),\n\t\t\t\tcode, start.Unix(), cost, err)\n\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2c5d18fa34b65eb6496a7426423f9415", "score": "0.51384306", "text": "func hello_again(logger *log.Logger) int {\n\tlogger.Printf(\"hello again\\n\")\n\treturn 222\n}", "title": "" }, { "docid": "7b8f6d992fe0604babfeebcd0cd1ba29", "score": "0.5137845", "text": "func TestStdLoggerWithDebugTraceAndTime(t *testing.T) {\n\tlogger := NewStdLogger(true, true, true, false, false)\n\n\tflags := logger.logger.Flags()\n\tif flags != log.LstdFlags|log.Lmicroseconds {\n\t\tt.Fatalf(\"Expected %d, received %d\\n\", log.LstdFlags, flags)\n\t}\n\n\tif !logger.debug {\n\t\tt.Fatalf(\"Expected %t, received %t\\n\", true, logger.debug)\n\t}\n\n\tif !logger.trace {\n\t\tt.Fatalf(\"Expected %t, received %t\\n\", true, logger.trace)\n\t}\n}", "title": "" }, { "docid": "2355a2e239e02806f368c1d133215a94", "score": "0.5133919", "text": "func (mr *MockAuditLoggerMockRecorder) Log(arg0, arg1, arg2 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Log\", reflect.TypeOf((*MockAuditLogger)(nil).Log), arg0, arg1, arg2)\n}", "title": "" }, { "docid": "e165c6379d11bd4805e5b7d02d5cb6cc", "score": "0.51272285", "text": "func Logger(ctx context.Context) Adapter {\n\tcanceled := false\n\tselect {\n\tcase <-ctx.Done():\n\t\tcanceled = true\n\tdefault:\n\t}\n\tvar keyvals []interface{}\n\tif v := ctx.Value(logKey); v != nil {\n\t\tif false {\n\t\t\tif f, ok := fnName(1); ok {\n\t\t\t\tkeyvals = []interface{}{\"from\", f}\n\t\t\t} else {\n\t\t\t\tkeyvals = []interface{}{\"from_file\", caller(1)}\n\t\t\t}\n\t\t}\n\t\tif canceled {\n\t\t\treturn ErrorToInfo(v.(Adapter).New(keyvals...), \"Context cancelled:\")\n\t\t}\n\t\treturn v.(Adapter).New(keyvals...)\n\t}\n\ta := DefaultLogger().New(keyvals)\n\ta.Error(\"no logger in context\", caller(1))\n\treturn a\n}", "title": "" }, { "docid": "c713ac06041a6cf652758d4b5692f5a1", "score": "0.51200056", "text": "func UseLogger(newLogger seelog.LoggerInterface) {\r\n\tLogger = newLogger\r\n}", "title": "" }, { "docid": "60f25678166d5a8dc80e6bb8c239cdff", "score": "0.5119036", "text": "func (p *BasicOperator) Logger() *zap.SugaredLogger {\n\treturn p.SugaredLogger\n}", "title": "" }, { "docid": "2158d3f1ab4cf057cac21d46bc987bbd", "score": "0.5115689", "text": "func (*NopLogger) Info(args ...interface{}) {}", "title": "" }, { "docid": "85b46ddab44a07345ff298d95927d349", "score": "0.511251", "text": "func (d *defaultLogger) Debug(caller, msg string) {\n\t//d.log(\"DEBUG\", caller, msg)\n}", "title": "" }, { "docid": "39c3e020329fafcf19d754cdb6cb94e7", "score": "0.51088065", "text": "func Flags() int { return std.Logger.Flags() }", "title": "" }, { "docid": "d526b12fdf79dc5f1b91eb3f780805c4", "score": "0.5107271", "text": "func (mr *MockloggerMockRecorder) Infof(msg interface{}, args ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{msg}, args...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Infof\", reflect.TypeOf((*Mocklogger)(nil).Infof), varargs...)\n}", "title": "" }, { "docid": "471c82206914e11c295275dcc290a83c", "score": "0.5104604", "text": "func TestDefault(t *testing.T) {\n\tlogger, err := NewStdErr(\"myapp: \")\n\tif err != nil {\n\t\tt.Fatalf(\"log: error creating default logger :%s\", err)\n\t}\n\n\t// Record what is written for testing\n\tvar recorder bytes.Buffer\n\tlogger.Writer = &recorder\n\n\t// Test levels\n\tlogger.Level = LevelError\n\n\t// Add to our list of outputs\n\tAdd(logger)\n\n\t// Add another logger just to check\n\tauxillaryLogger, err := NewStdErr(\"auxillary: \")\n\tif err != nil {\n\t\tt.Fatalf(\"log: error creating aux logger :%s\", err)\n\t}\n\tvar recorder2 bytes.Buffer\n\tauxillaryLogger.Writer = &recorder2\n\tauxillaryLogger.Level = LevelDebug\n\tAdd(auxillaryLogger)\n\n\t// Write out a string at debug level\n\tDebug(logTests[0].values)\n\tDebug(logTests[1].values)\n\n\tresult, err := recorder.ReadString('\\n')\n\tif err != nil && err != io.EOF {\n\t\tt.Fatalf(\"log: error on default logger %s\", err)\n\t}\n\tif len(result) > 0 {\n\t\tt.Fatalf(\"log: debug logging wrote to logger got:%s\", result)\n\t}\n\n\t// Test the auxillary logger for output\n\tresult, err = recorder2.ReadString('\\n')\n\tif err != nil {\n\t\tt.Fatalf(\"log: error on aux logger %s\", err)\n\t}\n\tif len(result) == 0 {\n\t\tt.Fatalf(\"log: aux log empty got:%s\", result)\n\t}\n\n\t// Check that logging has the expected results\n\tfor _, test := range logTests {\n\n\t\t// Write to log\n\t\tError(test.values)\n\n\t\t// Test reading recorder line\n\t\tresult, err := recorder.ReadString('\\n')\n\t\tif err != nil && err != io.EOF {\n\t\t\tt.Fatalf(\"log: error on default logger %s\", err)\n\t\t}\n\t\t// Check expected strings\n\t\tif !strings.Contains(result, test.expected) {\n\t\t\tt.Fatalf(\"log: mismatch on default logger expected:%s got:%s\", test.expected, result)\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "4d3cc7f9b265e8bc8b3ef8595c3b3fd5", "score": "0.5100741", "text": "func (fl *FakeLogger) Infof(string, ...interface{}) {}", "title": "" }, { "docid": "079070d1e15cf9a903f6a981f4b9031c", "score": "0.51005477", "text": "func (k *Keeper) Logger(ctx sdk.Context) log.Logger {\n\treturn ctx.Logger().With(\"module\", \"x/\"+types.ModuleName)\n}", "title": "" } ]
f1c30b22b90a98c11a98c77a17a6b276
GetCustomLinks returns the custom links, namely the self link.
[ { "docid": "270b6a3ac1a337f96bb05d58ddf53036", "score": "0.77432764", "text": "func (workItem WorkItem) GetCustomLinks(linkURL string) jsonapi.Links {\n\tlinks := jsonapi.Links {\n\t\t\"self\": jsonapi.Link { linkURL, nil, },\n\t\t\"sourceLinkTypes\": jsonapi.Link { linkURL + \"/source-link-types\", nil, },\n\t\t\"targetLinkTypes\": jsonapi.Link { linkURL + \"/target-link-types\", nil, },\n\t}\n\treturn links\n}", "title": "" } ]
[ { "docid": "3c7f824dc1dbb692bbcb946f10435cb1", "score": "0.78690386", "text": "func (area Area) GetCustomLinks(linkURL string) jsonapi.Links {\n\tlinks := jsonapi.Links {\n\t\t\"self\": jsonapi.Link { linkURL, nil, },\n\t}\n\treturn links\n}", "title": "" }, { "docid": "ec890aaf5dcc52233d09bdb0dbc91479", "score": "0.78107256", "text": "func (link Link) GetCustomLinks(linkURL string) jsonapi.Links {\n\tlinks := jsonapi.Links {\n\t\t\"self\": jsonapi.Link { linkURL, nil, },\n\t}\n\treturn links\n}", "title": "" }, { "docid": "81fedd24c7de04cdcca37eb7d17dc9cc", "score": "0.71741843", "text": "func (space Space) GetCustomLinks(linkURL string) jsonapi.Links {\n\tvar re = regexp.MustCompile(\"(.*)/\" + space.GetCollectionName() + \"/.*\")\n\tbaseLink := re.ReplaceAllString(linkURL, `$1`)\n\tlinks := jsonapi.Links {\n\t\t\"self\": jsonapi.Link { linkURL, nil, },\n\t\t\"base\": jsonapi.Link { baseLink, nil, },\n\t\t\"reorderEndpoint\": jsonapi.Link { baseLink + \"/reorder\", nil, },\n\t\t\"filters\": jsonapi.Link { baseLink + \"/filters\", nil, },\n\t\t\"workitemlinktypes\": jsonapi.Link { linkURL + \"/linktypes\", nil, },\n\t\t\"workitemtypes\": jsonapi.Link { linkURL + \"/workitemtypes\", nil, },\n\t\t\"workitemlinkcategories\": jsonapi.Link { linkURL + \"/workitemlinkcategories\", nil, },\n\t\t// TODO \"filters\": \"https://xxx/api/filters\",\n\t}\n\t/*\n\t\tWe don't do this bs, the backlog is already the root iteration:\n\t\t\t\"backlog\": {\n\t\t\t\t\"meta\": {\n\t\t\t\t\t\"totalCount\": 0\n\t\t\t\t},\n\t\t\t\t\t\"self\": \"https://xxx/api/spaces/xxxSpaceId/backlog\"\n\t\t\t\t},\n\t*/\n\treturn links\n}", "title": "" }, { "docid": "f26a4d140dff221d8039bc931c377439", "score": "0.6909038", "text": "func (o *BitlinkBody) GetCustomBitlinks() []string {\n\tif o == nil || o.CustomBitlinks == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\treturn *o.CustomBitlinks\n}", "title": "" }, { "docid": "f7906ac38418902c2233ddf45f70a7bb", "score": "0.6833287", "text": "func (o *BitlinkUpdate) GetCustomBitlinks() []string {\n\tif o == nil || o.CustomBitlinks == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\treturn *o.CustomBitlinks\n}", "title": "" }, { "docid": "f941cfcc36549c2746a1d500346a7316", "score": "0.6332226", "text": "func (in CustomLinks) DeepCopy() CustomLinks {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CustomLinks)\n\tin.DeepCopyInto(out)\n\treturn *out\n}", "title": "" }, { "docid": "78b85ad79d1168f0617ac9de251b7ef1", "score": "0.5951272", "text": "func (o *BitlinkBody) SetCustomBitlinks(v []string) {\n\to.CustomBitlinks = &v\n}", "title": "" }, { "docid": "e1c624a8783521e6a6ffc77a2b000a4f", "score": "0.588656", "text": "func (o *BitlinkUpdate) SetCustomBitlinks(v []string) {\n\to.CustomBitlinks = &v\n}", "title": "" }, { "docid": "439be4242ff71b316452f0891421ab8c", "score": "0.5668468", "text": "func (o *BitlinkBody) GetCustomBitlinksOk() (*[]string, bool) {\n\tif o == nil || o.CustomBitlinks == nil {\n\t\treturn nil, false\n\t}\n\treturn o.CustomBitlinks, true\n}", "title": "" }, { "docid": "5e16155c41dea4bc06e79649805cb552", "score": "0.5516249", "text": "func (c *Channel) GetLinks() []string {\n\tlinks := make([]string, 0)\n\tlinks = helpers.AppendIfMissing(links, c.requestedURL)\n\tlinks = helpers.AppendIfMissing(links, c.URL)\n\n\tif len(c.Feed.Links) > 0 {\n\t\tlinks = helpers.AppendIfMissing(links, c.Feed.Links[0].Href)\n\t}\n\n\treturn links\n}", "title": "" }, { "docid": "0dc7499ff33da913aa754ea4b4027a0b", "score": "0.55073315", "text": "func (o *BitlinkUpdate) GetCustomBitlinksOk() (*[]string, bool) {\n\tif o == nil || o.CustomBitlinks == nil {\n\t\treturn nil, false\n\t}\n\treturn o.CustomBitlinks, true\n}", "title": "" }, { "docid": "4e0272864a01e453f8766557adb023e1", "score": "0.5458938", "text": "func (o *AmazonConnectionsPage) GetLinks() []Link {\n\tif o == nil || o.Links == nil {\n\t\tvar ret []Link\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "title": "" }, { "docid": "7f320c15d570efa461e39726412f7194", "score": "0.5429027", "text": "func (o LookupKubernetesClusterResultOutput) CustomCaTrustCertificatesBase64s() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v LookupKubernetesClusterResult) []string { return v.CustomCaTrustCertificatesBase64s }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "467481d027693da3f7a9d9c2f0d941f9", "score": "0.54132026", "text": "func (o *LicensedWorkload) GetLinks() []Link {\n\tif o == nil || o.Links == nil {\n\t\tvar ret []Link\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "title": "" }, { "docid": "fd3cd98489e8540d2419301f96420d8b", "score": "0.54041183", "text": "func (o *LicenseNotifications) GetLinks() []Link {\n\tif o == nil || o.Links == nil {\n\t\tvar ret []Link\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "title": "" }, { "docid": "d8a4fb238c7e3414357d4fe0136acaa2", "score": "0.5281214", "text": "func (o *CloudNetworksPage) GetLinks() []Link {\n\tif o == nil || o.Links == nil {\n\t\tvar ret []Link\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "title": "" }, { "docid": "1f564c8702f7e9a5889f5e84e25eb2bc", "score": "0.5234794", "text": "func (c Customer) JSONAPILinks() *jsonapi.Links {\n\treturn &jsonapi.Links{\n\t\t\"self\": fmt.Sprintf(\"%s/%d\",host, c.ID),\n\t}\n}", "title": "" }, { "docid": "178f71d779766f8af3d553679f0e234b", "score": "0.5225467", "text": "func (o *LicenseInfo) GetLinks() []Link {\n\tif o == nil || o.Links == nil {\n\t\tvar ret []Link\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "title": "" }, { "docid": "7375905ffbd83f2526d82f4d35cd77ea", "score": "0.51899266", "text": "func (in *CustomLink) DeepCopy() *CustomLink {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CustomLink)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "41857666163b5c55cf0312f137b15ee4", "score": "0.51845735", "text": "func (o *BitlinkBody) HasCustomBitlinks() bool {\n\tif o != nil && o.CustomBitlinks != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "df25e2413fd70d4d1a9b17169c290449", "score": "0.5163127", "text": "func (p *providerUI) GetURLLinks() string {\n\treturn createDashboardURL(URILinks)\n}", "title": "" }, { "docid": "4acba2b82d626f585fc810eab61be1e1", "score": "0.5159655", "text": "func (workItem WorkItem) GetCustomMeta(linkURL string) jsonapi.Metas {\n\thasChildren, _ := utils.DatabaseMetaService.HasChildren(workItem.GetCollectionName(), workItem.ID)\n\tmeta := map[string]map[string]interface{} {\n\t\t\"children\": map[string]interface{} {\n\t\t\t\"hasChildren\": hasChildren,\n\t\t},\n\t}\n\treturn meta\n}", "title": "" }, { "docid": "ef76e30366ba13c76300fb8e19b74ae0", "score": "0.5140546", "text": "func (o *ServiceAccountSettings) GetLinks() []Link {\n\tif o == nil || o.Links == nil {\n\t\tvar ret []Link\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "title": "" }, { "docid": "f9d205ee18762411991b240680c5f5bc", "score": "0.5115975", "text": "func (r *stripRenderer) GetLinks() []string {\n\treturn r.links\n}", "title": "" }, { "docid": "a07aa1bcea19a7f5c5f2798b7b63e741", "score": "0.5114348", "text": "func (o EmailNotificationResponsePtrOutput) CustomEmails() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *EmailNotificationResponse) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.CustomEmails\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "78213d9d44377d0d60e086a29d08dbac", "score": "0.51134", "text": "func (r *MarkdownStripper) GetLinks() []string {\n\treturn r.links\n}", "title": "" }, { "docid": "6dbec3c7c2347bf03107807118626c0e", "score": "0.50897855", "text": "func (o *CommentCommentsResponseIncluded) GetLinks() map[string]ViewLinkItem {\n\tif o == nil || o.Links == nil {\n\t\tvar ret map[string]ViewLinkItem\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "title": "" }, { "docid": "3ef0398a3f663b05424c4949b932d9b2", "score": "0.5076658", "text": "func GetLinks(zone, app, tenant string) ([]Link, error) {\n\ttenantStr := func() string {\n\t\tif len(tenant) == 0 {\n\t\t\treturn \"\"\n\t\t}\n\t\treturn \"-tenant=\" + tenant\n\t}()\n\toutput, err := RunCmd(fmt.Sprintf(\"%s api -zone %s -app %s -fetch-links %s\", ActlPath, zone, app, tenantStr))\n\tif err != nil {\n\t\treturn []Link{}, err\n\t}\n\tlistOfLinks := []Link{}\n\tyaml.Unmarshal([]byte(output), &listOfLinks)\n\treturn listOfLinks, nil\n}", "title": "" }, { "docid": "d558684528a7272c5edb29a42c83f309", "score": "0.5024963", "text": "func (o EmailNotificationPtrOutput) CustomEmails() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *EmailNotification) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.CustomEmails\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "1d960b54745738aded8cf5e9080849b5", "score": "0.501574", "text": "func (o *BitlinkUpdate) HasCustomBitlinks() bool {\n\tif o != nil && o.CustomBitlinks != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "db9393b83eb0babbe576f39b0a0d500c", "score": "0.50075465", "text": "func (o RuleEmailActionResponseOutput) CustomEmails() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v RuleEmailActionResponse) []string { return v.CustomEmails }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "7cea92f91eb8330e9c5b9988e8a2a1d2", "score": "0.4992563", "text": "func (collect Collect) Links(request *colly.Request) (links []string) {\n\t// a[href] selector should be slower\n\tcollect.doc.Find(\"a\").Each(func(i int, node *goquery.Selection) {\n\t\thref, exist := node.Attr(\"href\")\n\t\tif exist == false {\n\t\t\treturn\n\t\t}\n\n\t\tlinks = append(links, request.AbsoluteURL(href))\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "06122fc622e0566d70d91dab8f3c6355", "score": "0.49912333", "text": "func NewLinkCustom(config *LinkConfig, hdr session.RequestHandler) *Link {\n\treturn newLink(config, hdr)\n}", "title": "" }, { "docid": "f48594489e657d4c333bff7424ae5b9b", "score": "0.49826726", "text": "func (o RuleEmailActionOutput) CustomEmails() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v RuleEmailAction) []string { return v.CustomEmails }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "47416eadb6a135c41bc59d3ffbdea0b4", "score": "0.49569026", "text": "func (o *MicrosoftGraphOnenotePagePreview) GetLinks() AnyOfmicrosoftGraphOnenotePagePreviewLinks {\n\tif o == nil || o.Links == nil {\n\t\tvar ret AnyOfmicrosoftGraphOnenotePagePreviewLinks\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "title": "" }, { "docid": "c736283452863841f62086026b00bb87", "score": "0.4944596", "text": "func (n *Node) GetLinks() []string {\n\treturn strings.Split(n.links, \"\")\n}", "title": "" }, { "docid": "67648c78105a0213bbf2a18323a092c2", "score": "0.49404788", "text": "func (o EmailNotificationResponseOutput) CustomEmails() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v EmailNotificationResponse) []string { return v.CustomEmails }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "efba3effdb69b78f64c69d22cd696023", "score": "0.49147907", "text": "func (o EmailNotificationOutput) CustomEmails() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v EmailNotification) []string { return v.CustomEmails }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "1a3e2a10f1b9a5fc354d9c5645b7eae1", "score": "0.48691726", "text": "func (o GetAppResultOutput) Links() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetAppResult) string { return v.Links }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e57c86dfa5e0cfc2fbf15ffec41310b6", "score": "0.4863258", "text": "func GetLinks(offset int, requestLimit int) ([]string, error) {\n\tvar (\n\t\terr error\n\t\tbaseURL = \"https://www.hltv.org/results\"\n\t\turl = fmt.Sprintf(\"%s?offset=%d&content=demo\", baseURL, offset)\n\t)\n\n\tc := colly.NewCollector()\n\tlinkCollector := c.Clone()\n\n\tlimitRule := &colly.LimitRule{\n\t\tDomainGlob: \".*hltv.*\",\n\t\tDelay: 2000 * time.Millisecond,\n\t\tRandomDelay: 2000 * time.Millisecond,\n\t}\n\n\terr = linkCollector.Limit(limitRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = c.Limit(limitRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn crawl(url, requestLimit, c, linkCollector)\n}", "title": "" }, { "docid": "58d7649695872f02c20b24e152041b46", "score": "0.48626304", "text": "func (am *AnalyticsIndexManager) GetLinks(opts *GetAnalyticsLinksOptions) ([]AnalyticsLink, error) {\n\tif opts == nil {\n\t\topts = &GetAnalyticsLinksOptions{}\n\t}\n\n\tif opts.Name != \"\" && opts.Dataverse == \"\" {\n\t\treturn nil, makeInvalidArgumentsError(\"when name is set then dataverse must also be set\")\n\t}\n\n\tstart := time.Now()\n\tdefer am.meter.ValueRecord(meterValueServiceManagement, \"manager_analytics_get_all_links\", start)\n\n\ttimeout := opts.Timeout\n\tif timeout == 0 {\n\t\ttimeout = am.globalTimeout\n\t}\n\n\tvar querystring []string\n\tvar endpoint string\n\tif strings.Contains(opts.Dataverse, \"/\") {\n\t\tendpoint = fmt.Sprintf(\"/analytics/link/%s\", url.PathEscape(opts.Dataverse))\n\n\t\tif opts.Name != \"\" {\n\t\t\tendpoint = fmt.Sprintf(\"%s/%s\", endpoint, opts.Name)\n\t\t}\n\t\tif opts.LinkType != \"\" {\n\t\t\tquerystring = append(querystring, fmt.Sprintf(\"type=%s\", opts.LinkType))\n\t\t}\n\t} else {\n\t\tendpoint = \"/analytics/link\"\n\n\t\tif opts.Dataverse != \"\" {\n\t\t\tquerystring = append(querystring, \"dataverse=\"+opts.Dataverse)\n\t\t\tif opts.Name != \"\" {\n\t\t\t\tquerystring = append(querystring, \"name=\"+opts.Name)\n\t\t\t}\n\t\t}\n\t\tif opts.LinkType != \"\" {\n\t\t\tquerystring = append(querystring, fmt.Sprintf(\"type=%s\", opts.LinkType))\n\t\t}\n\t}\n\n\tif len(querystring) > 0 {\n\t\tendpoint = endpoint + \"?\" + strings.Join(querystring, \"&\")\n\t}\n\n\tspan := createSpan(am.tracer, opts.ParentSpan, \"manager_analytics_get_all_links\", \"management\")\n\tspan.SetAttribute(\"db.operation\", \"GET \"+endpoint)\n\tdefer span.End()\n\n\treq := mgmtRequest{\n\t\tService: ServiceTypeAnalytics,\n\t\tMethod: \"GET\",\n\t\tPath: endpoint,\n\t\tRetryStrategy: opts.RetryStrategy,\n\t\tTimeout: timeout,\n\t\tparentSpanCtx: span.Context(),\n\t\tIsIdempotent: true,\n\t}\n\n\tresp, err := am.doMgmtRequest(opts.Context, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn nil, am.tryParseLinkErrorMessage(&req, resp)\n\t}\n\n\tvar jsonLinks []map[string]interface{}\n\tjsonDec := json.NewDecoder(resp.Body)\n\terr = jsonDec.Decode(&jsonLinks)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar links []AnalyticsLink\n\tfor _, jsonLink := range jsonLinks {\n\t\tlinkType, ok := jsonLink[\"type\"]\n\t\tif !ok {\n\t\t\tlogWarnf(\"External analytics link missing type field, skipping\")\n\t\t\tcontinue\n\t\t}\n\n\t\tlinkTypeStr, ok := linkType.(string)\n\t\tif !ok {\n\t\t\tlogWarnf(\"External analytics link type field not a string, skipping\")\n\t\t\tcontinue\n\t\t}\n\n\t\tlink := am.linkFromJSON(AnalyticsLinkType(linkTypeStr), jsonLink)\n\t\tif link == nil {\n\t\t\tlogWarnf(\"External analytics link type %s unknown, skipping\", linkTypeStr)\n\t\t\tcontinue\n\t\t}\n\n\t\tlinks = append(links, link)\n\t}\n\n\treturn links, nil\n}", "title": "" }, { "docid": "b02ff1ded89ba0762e8031472baf43b8", "score": "0.484415", "text": "func (o *UserResponse) GetLinks() UserResponseLinks {\n\tif o == nil || o.Links == nil {\n\t\tvar ret UserResponseLinks\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "title": "" }, { "docid": "2a63b2329270254f9390832e82a502b9", "score": "0.48431578", "text": "func (o *ListPagination) GetLinks() PaginationLinks {\n\tif o == nil || o.Links == nil {\n\t\tvar ret PaginationLinks\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "title": "" }, { "docid": "0b86716745154450b1f5ab8c502da6e7", "score": "0.4841118", "text": "func (f *PageFetcher) getAllLinks(doc *goquery.Document) (res []*url.URL) {\n\n\tres = f.getUrlsFromTags(\"a\", \"href\", doc)\n\treturn\n}", "title": "" }, { "docid": "8dd2cfc4723f176b5d092bf2388248fe", "score": "0.48364228", "text": "func (o SelfHostedIntegrationRuntimeStatusResponseOutput) Links() LinkedIntegrationRuntimeResponseArrayOutput {\n\treturn o.ApplyT(func(v SelfHostedIntegrationRuntimeStatusResponse) []LinkedIntegrationRuntimeResponse { return v.Links }).(LinkedIntegrationRuntimeResponseArrayOutput)\n}", "title": "" }, { "docid": "9b89590c4b41e02e07aad97e19ff8e0a", "score": "0.48337156", "text": "func (o NetworkPeeringResponseOutput) ExportCustomRoutes() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v NetworkPeeringResponse) bool { return v.ExportCustomRoutes }).(pulumi.BoolOutput)\n}", "title": "" }, { "docid": "417b34abbadaedbaffdba220c07b07ef", "score": "0.4825043", "text": "func (crw *Crawler) getLinks() []string {\n\t// Calculate the total length of the links slice\n\t// This way it is very efficient because we make 1 allocation only\n\tvar length uint16\n\tfor _, cat := range crw.opts.categories {\n\t\tlength += uint16(len(cat.subs))\n\t}\n\tlinks := make([]string, length)\n\t// We extract all links from every category and merge them in the final slice\n\tfor _, cat := range crw.opts.categories {\n\t\tclinks, err := cat.getLinks()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tcontinue\n\t\t}\n\t\tfor i, cl := range clinks {\n\t\t\tlinks[i] = cl\n\t\t}\n\t}\n\treturn links\n}", "title": "" }, { "docid": "e821a56f78b417476486d75de335e070", "score": "0.47725156", "text": "func (c Customer) JSONAPIRelationshipLinks(relation string) *jsonapi.Links {\n\tif relation == \"loans\" {\n\t\treturn &jsonapi.Links{\n\t\t\t\"related\": fmt.Sprintf(\"%s/%d/loans\",host, c.ID),\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f3669e0a960e7d8d4fe9eb6a17103011", "score": "0.4762131", "text": "func (o *Session) GetLinks() []Link {\n\tif o == nil || o.Links == nil {\n\t\tvar ret []Link\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "title": "" }, { "docid": "d6db28d676eb3bb2df734f7b8e9aaf3e", "score": "0.47516593", "text": "func (account *Account) GetCustomData() (map[string]interface{}, error) {\n\tcustomData := make(map[string]interface{})\n\n\terr := client.get(account.CustomData.Href, emptyPayload(), &customData)\n\n\treturn customData, err\n}", "title": "" }, { "docid": "ce0646f19f0f478eca5e5c301e4a435e", "score": "0.47514677", "text": "func (s Session) GetSelfHref(input *[]KiteLinks) string {\n\tfor _, link := range *input {\n\t\tif strings.ToLower(link.Relationship) == \"self\" {\n\t\t\treturn link.Href\n\t\t}\n\t}\n\treturn NONE\n}", "title": "" }, { "docid": "bbcaae43890b61d836c31e894590768d", "score": "0.4743381", "text": "func (m *Manager) GetCustomComparators() map[reflect.Type]func(deployed resource.KubernetesResource, requested resource.KubernetesResource) bool {\n\tdeploymentType := reflect.TypeOf(appsv1.Deployment{})\n\tconfigMapType := reflect.TypeOf(corev1.ConfigMap{})\n\treturn map[reflect.Type]func(deployed resource.KubernetesResource, requested resource.KubernetesResource) bool{\n\t\tdeploymentType: deploymentEqual,\n\t\tconfigMapType: configMapEqual,\n\t}\n}", "title": "" }, { "docid": "9130bafab2a02be11062e90eef8bef89", "score": "0.47420105", "text": "func (o *Task) GetLinks() TaskLinks {\n\tif o == nil || o.Links == nil {\n\t\tvar ret TaskLinks\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "title": "" }, { "docid": "cd1bca1c8e14996307bb84ad8270e0b9", "score": "0.4738048", "text": "func (o *MicrosoftGraphTargetedManagedAppConfiguration) GetCustomSettings() []MicrosoftGraphKeyValuePair {\n\tif o == nil || o.CustomSettings == nil {\n\t\tvar ret []MicrosoftGraphKeyValuePair\n\t\treturn ret\n\t}\n\treturn *o.CustomSettings\n}", "title": "" }, { "docid": "71ed23c8765653c938632c88c90906ce", "score": "0.47320604", "text": "func (o *PullRequestLinks) GetSelf() Link {\n\tif o == nil || o.Self == nil {\n\t\tvar ret Link\n\t\treturn ret\n\t}\n\treturn *o.Self\n}", "title": "" }, { "docid": "4a397949fca0a9b052ef4f632340acb0", "score": "0.47170475", "text": "func (o *Network) GetLinks() []Link {\n\tif o == nil || o.Links == nil {\n\t\tvar ret []Link\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "title": "" }, { "docid": "b0f16274b98ba77616333c19886ef1ce", "score": "0.47148556", "text": "func (o GetOauthResultOutput) Links() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetOauthResult) string { return v.Links }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "01d9c48e9149382dbba7eeda138f602b", "score": "0.4709184", "text": "func (o *TelegrafAllOf) GetLinks() TelegrafAllOfLinks {\n\tif o == nil || o.Links == nil {\n\t\tvar ret TelegrafAllOfLinks\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "title": "" }, { "docid": "26ca4c655e5728a617f7f25c70d9159d", "score": "0.47006518", "text": "func (rb *ByProjectKeyRequestBuilder) CustomObjects() *ByProjectKeyCustomObjectsRequestBuilder {\n\treturn &ByProjectKeyCustomObjectsRequestBuilder{\n\t\tprojectKey: rb.projectKey,\n\t\tclient: rb.client,\n\t}\n}", "title": "" }, { "docid": "6efef23e709d7416c2845b620ef937ae", "score": "0.46806785", "text": "func (o *Bucket) GetLinks() BucketLinks {\n\tif o == nil || o.Links == nil {\n\t\tvar ret BucketLinks\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "title": "" }, { "docid": "15908a1dfde7e74a9c361be013034e94", "score": "0.46712744", "text": "func (w *WebBridgeRunner) GetLinks(status LinkStatus) (*models.LinksResponse, error) {\n\tvar links models.LinksResponse\n\tvar cmdStr = \"\"\n\tif status == Complete {\n\t\tcmdStr = `dynamic-cli link complete`\n\t} else if status == Pending {\n\t\tcmdStr = `dynamic-cli link pending`\n\t}\n\tcmd, _ := dynamic.NewRequest(cmdStr)\n\tresponse, _ := <-w.dynamicd.ExecCmdRequest(cmd)\n\tresults := map[string]interface{}{}\n\terr := json.Unmarshal([]byte(response), &results)\n\tif err != nil {\n\t\tstrErrMsg := fmt.Sprintf(\"Results JSON unmarshal error %v\", err)\n\t\treturn nil, errors.New(strErrMsg)\n\t}\n\tmyLinks := make(map[string]models.Link)\n\tfor key, linkInterface := range results {\n\t\tif key != \"locked_links\" {\n\t\t\tlinkObj := models.Link{LinkStatus: string(status)}\n\t\t\tlinkVal := reflect.ValueOf(linkInterface)\n\t\t\tfor _, lk := range linkVal.MapKeys() {\n\t\t\t\tlink := linkVal.MapIndex(lk)\n\t\t\t\tlinkObj.SetValue(lk.String(), fmt.Sprintf(\"%v\", link))\n\t\t\t}\n\t\t\tmyLinks[key] = linkObj\n\t\t} else {\n\t\t\tlinks.LockedLinks = linkInterface.(float64)\n\t\t}\n\t}\n\tlinks.Links = myLinks\n\treturn &links, nil\n}", "title": "" }, { "docid": "44b32b91177e370f95265d99c7543573", "score": "0.46672735", "text": "func (s *Scrapper) GetInternalAndExternalLinks() (model.Links, error) {\n\tvar response model.Links\n\tif s.Links == nil {\n\t\treturn response, fmt.Errorf(\"links not initiaized\")\n\t}\n\tfor _, value := range s.Links {\n\t\tif strings.Contains(value, \"http\") {\n\t\t\tresponse.ExternalLinks = append(response.ExternalLinks, value)\n\t\t\ts.ExternalLinks = append(s.ExternalLinks, value)\n\t\t} else {\n\t\t\tresponse.InternalLinks = append(response.InternalLinks, value)\n\t\t}\n\t}\n\treturn response, nil\n}", "title": "" }, { "docid": "036aa401a2d211156e62cd3855ebd3d0", "score": "0.46558797", "text": "func (o *Tag) GetLinks() []Link {\n\tif o == nil || o.Links == nil {\n\t\tvar ret []Link\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "title": "" }, { "docid": "0a6415cf23463c4bbba65a200a06a37d", "score": "0.464768", "text": "func (r *Renderer) Links() []Link {\n\treturn r.links\n}", "title": "" }, { "docid": "bbefa800735a040e08b68d2856ffa1e0", "score": "0.46370876", "text": "func (o *DefaultManagedAppProtection) GetCustomSettings() []MicrosoftGraphKeyValuePair {\n\tif o == nil || o.CustomSettings == nil {\n\t\tvar ret []MicrosoftGraphKeyValuePair\n\t\treturn ret\n\t}\n\treturn *o.CustomSettings\n}", "title": "" }, { "docid": "be8ae5f2600e9939893321046bbc7b4e", "score": "0.46355098", "text": "func (o *UplinkConnection) CustomProperties(info *bambou.FetchingInfo) (CustomPropertiesList, *bambou.Error) {\n\n\tvar list CustomPropertiesList\n\terr := bambou.CurrentSession().FetchChildren(o, CustomPropertyIdentity, &list, info)\n\treturn list, err\n}", "title": "" }, { "docid": "f9a6457dfcf0cccce8aa8a01fee36500", "score": "0.4609952", "text": "func GetCustomLabels(\n\tcluster *corev1.StorageCluster,\n\tk8sObjKind string,\n\tcomponentName string,\n) map[string]string {\n\tif cluster.Spec.Metadata == nil || cluster.Spec.Metadata.Labels == nil {\n\t\treturn nil\n\t}\n\t// Use kind/component to locate the custom labels, e.g. service/portworx-api\n\tkey := fmt.Sprintf(\"%s/%s\", k8sObjKind, componentName)\n\tif labels, ok := cluster.Spec.Metadata.Labels[key]; ok && len(labels) != 0 {\n\t\treturn labels\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b190264ef083cfedbdb2d7955768959e", "score": "0.45998934", "text": "func getPageLinks(urlTemplate string, currentPage int, totalPages int) string {\n\tlinkTemplate := fmt.Sprintf(\"<%s>; rel=\\\"%s\\\"\", urlTemplate, \"%s\")\n\tpageUrls := make([]string, 0)\n\tif totalPages == 1 {\n\t\t// Single page - pagination not possible\n\t\treturn \"\"\n\t}\n\tif currentPage != 1 {\n\t\t// Not first page\n\t\t// Add link to previous page\n\t\tpageUrls = append(pageUrls, fmt.Sprintf(linkTemplate, currentPage-1, \"prev\"))\n\t}\n\tif currentPage != totalPages {\n\t\t// Not last page\n\t\t// Add link to next page\n\t\tpageUrls = append(pageUrls, fmt.Sprintf(linkTemplate, currentPage+1, \"next\"))\n\t}\n\t// Add link to last page\n\tpageUrls = append(pageUrls, fmt.Sprintf(linkTemplate, totalPages, \"last\"))\n\t// Add link to first page\n\tpageUrls = append(pageUrls, fmt.Sprintf(linkTemplate, 1, \"first\"))\n\treturn strings.Join(pageUrls[:], \", \")\n}", "title": "" }, { "docid": "78ff1668b7c637cb0248317ddd3f217f", "score": "0.45955664", "text": "func ListLinks(c web.C, w http.ResponseWriter, r *http.Request) {\n\taccount := GetAccount(c)\n\ttree.List([]string{\"Accounts\", account.Email, \"Links\"}, func(path string, innerError error) bool {\n\t\tif innerError != nil {\n\t\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\t\treturn false\n\t\t}\n\t\tfmt.Fprintf(w, \"%s\\n\", path)\n\t\treturn true\n\t})\n}", "title": "" }, { "docid": "7511a75b479b0c2493ba35e52a9e6a4d", "score": "0.45885366", "text": "func GetRecLinks(rssURL string) ([]string, error) {\n\tpages, err := getAllLinks(rssURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(pages) == 0 {\n\t\treturn nil, errors.New(\"can't find any links\")\n\t}\n\treturn pages, nil\n}", "title": "" }, { "docid": "502ec9a2c82dbba079c68af9091b78d9", "score": "0.4585855", "text": "func (o *IssueLinks) GetSelf() Link {\n\tif o == nil || o.Self == nil {\n\t\tvar ret Link\n\t\treturn ret\n\t}\n\treturn *o.Self\n}", "title": "" }, { "docid": "2ef4b0798e3da99ac6a465f255ab511d", "score": "0.4581469", "text": "func (o *BranchingModelSettingsLinks) GetSelf() Link {\n\tif o == nil || o.Self == nil {\n\t\tvar ret Link\n\t\treturn ret\n\t}\n\treturn *o.Self\n}", "title": "" }, { "docid": "32a7e045527ef79b2378979755705a7e", "score": "0.45784822", "text": "func GetCustomAppUrl(ctx *pulumi.Context) string {\n\treturn config.Get(ctx, \"signalfx:customAppUrl\")\n}", "title": "" }, { "docid": "c5e48c82979a6a84a8b47e4d45f0fa77", "score": "0.4577921", "text": "func (o *MonitoringSettings) GetCustomConfigurationProperties() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.CustomConfigurationProperties\n}", "title": "" }, { "docid": "161a69412c54fa57579bca9a4b433f99", "score": "0.4576151", "text": "func (in *CustomResourceList) DeepCopy() *CustomResourceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CustomResourceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c34687d3d2b0a01b49e44c1998b9a250", "score": "0.456193", "text": "func GetLinksViaLinkOwner(iLinkOwner int64) (*Links, error) {\n\tvar _Links = &Links{LinkOwner: iLinkOwner}\n\thas, err := Engine.Get(_Links)\n\tif has {\n\t\treturn _Links, err\n\t} else {\n\t\treturn nil, err\n\t}\n}", "title": "" }, { "docid": "c0179f14ce3c128a2565057de6dcbd65", "score": "0.45566446", "text": "func (o *WorkspaceMembership) GetLinks() BranchingModelSettingsLinks {\n\tif o == nil || o.Links == nil {\n\t\tvar ret BranchingModelSettingsLinks\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "title": "" }, { "docid": "0bac50e309d315cee9e349e852f6740b", "score": "0.45511374", "text": "func (c *CustomObjects) List(ctx context.Context) ([]CustomObjectMetadata, error) {\n\trequest, err := http.NewRequest(\n\t\thttp.MethodGet, c.url(\"rest\", \"v1\", \"customobjects.json\"), nil,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := c.Client.doRequest(request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, handleError(listCustomObjects, resp)\n\t}\n\n\tresponse := &Response{}\n\treader := json.NewDecoder(resp.Body)\n\terr = reader.Decode(response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tobjects := []CustomObjectMetadata{}\n\terr = json.Unmarshal(response.Result, &objects)\n\n\treturn objects, err\n\n}", "title": "" }, { "docid": "f91727aee22ccc2fd68a20aaaeaae925", "score": "0.45499146", "text": "func (behaviors *CustomBehaviors) GetCustomBehaviors() error {\n\treq, err := client.NewRequest(\n\t\tConfig,\n\t\t\"GET\",\n\t\t\"/papi/v1/custom-behaviors\",\n\t\tnil,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tedge.PrintHttpRequest(req, true)\n\n\tres, err := client.Do(Config, req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tedge.PrintHttpResponse(res, true)\n\n\tif client.IsError(res) {\n\t\treturn client.NewAPIError(res)\n\t}\n\n\tif err = client.BodyJSON(res, behaviors); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f36165dda727a1edc685eda90247cb4c", "score": "0.45431155", "text": "func Links(b io.Reader) []string { // getters does not need get as prefix\n\tvar res []string\n\ttokenizer := html.NewTokenizer(b)\n\n\tfor {\n\t\ttokenType := tokenizer.Next()\n\n\t\tswitch {\n\t\tcase tokenType == html.ErrorToken:\n\t\t\treturn res\n\t\tcase tokenType == html.StartTagToken:\n\t\t\ttoken := tokenizer.Token()\n\n\t\t\tisAnchor := token.Data == \"a\"\n\t\t\tif !isAnchor {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tok, url := Href(token)\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\thasProtocol := strings.Index(url, \"http\") == 0\n\t\t\tif hasProtocol {\n\t\t\t\tres = append(res, url)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2e261fe323e29e0ebf22dde04303ae44", "score": "0.45419306", "text": "func (mech *Mech) GetLinks(url string) (links []string, err error) {\n\tvar stream io.ReadCloser\n\tif stream, err = mech.Stream(url); err != nil {\n\t\treturn\n\t}\n\tpage := &Page{stream: stream}\n\tif links, err = page.Links(); err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "884bc439c6a68b2834f2e5addc3f752d", "score": "0.45258367", "text": "func (s *workItemLinkSuite) getWorkItemRelationshipLinksTestData() func(t *testing.T) []testSecureAPI {\n\treturn func(t *testing.T) []testSecureAPI {\n\t\ttestWorkItemLinksAPI := []testSecureAPI{\n\t\t\t// Get links for non existing work item\n\t\t\t{\n\t\t\t\tmethod: http.MethodGet,\n\t\t\t\turl: fmt.Sprintf(endpointWorkItemRelationshipsLinks, \"7c73067d-be4f-4e7a-bf1d-644dabb90a5c\"),\n\t\t\t\texpectedStatusCode: http.StatusNotFound,\n\t\t\t\texpectedErrorCode: jsonapi.ErrorCodeNotFound,\n\t\t\t\tpayload: nil,\n\t\t\t\tjwtToken: \"\",\n\t\t\t},\n\t\t}\n\t\treturn testWorkItemLinksAPI\n\t}\n}", "title": "" }, { "docid": "c47514c6d9a4fdd151c4f7500cf6058a", "score": "0.45156685", "text": "func (s *DetectCustomLabelsOutput) SetCustomLabels(v []*CustomLabel) *DetectCustomLabelsOutput {\n\ts.CustomLabels = v\n\treturn s\n}", "title": "" }, { "docid": "87c9e545a9aa32c91d20d063bb01c584", "score": "0.45068562", "text": "func (o AccessLevelOutput) Custom() AccessLevelCustomPtrOutput {\n\treturn o.ApplyT(func(v *AccessLevel) AccessLevelCustomPtrOutput { return v.Custom }).(AccessLevelCustomPtrOutput)\n}", "title": "" }, { "docid": "f39ee396e9f59310715320c80555a063", "score": "0.45000747", "text": "func (textToSpeech *TextToSpeechV1) ListCustomModels(listCustomModelsOptions *ListCustomModelsOptions) (result *CustomModels, response *core.DetailedResponse, err error) {\n\treturn textToSpeech.ListCustomModelsWithContext(context.Background(), listCustomModelsOptions)\n}", "title": "" }, { "docid": "b343b1e63c573afa349a58d5e51250ca", "score": "0.4499989", "text": "func (o *Pullrequest) GetLinks() PullRequestLinks {\n\tif o == nil || o.Links == nil {\n\t\tvar ret PullRequestLinks\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "title": "" }, { "docid": "b72d2146e06d58f36d14f9b99af8f7c1", "score": "0.4493974", "text": "func (l *Listing) Links() []Link {\n\tvar items []Link\n\tfor _, c := range l.Data.Children {\n\t\tif c.Kind == TypeLink {\n\t\t\titem, _ := unmarshalLink(c.Data)\n\t\t\titems = append(items, *item)\n\t\t}\n\t}\n\treturn items\n}", "title": "" }, { "docid": "971b80a6720cad86bd6d23de031e8c89", "score": "0.44932368", "text": "func GetLinks(ctx context.Context, baseURL string, deviceName string) (*Links, error) {\n\tparsedBaseURL, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient := &stripe.Client{\n\t\tBaseURL: parsedBaseURL,\n\t}\n\n\tdata := url.Values{}\n\tdata.Set(\"device_name\", deviceName)\n\n\tres, err := client.PerformRequest(ctx, http.MethodPost, stripeCLIAuthPath, data.Encode(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer res.Body.Close()\n\n\tbodyBytes, err := io.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif res.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"unexpected http status code: %d %s\", res.StatusCode, string(bodyBytes))\n\t}\n\n\tvar links Links\n\n\terr = json.Unmarshal(bodyBytes, &links)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &links, nil\n}", "title": "" }, { "docid": "a1f438af64bee4014fb05e67c4a12833", "score": "0.4493029", "text": "func (o *LicenseNotifications) GetLinksOk() (*[]Link, bool) {\n\tif o == nil || o.Links == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Links, true\n}", "title": "" }, { "docid": "91bf99f87664feb5fd096e5e9e46b5cd", "score": "0.44910067", "text": "func (o EndpointOutput) CustomDnsConfigs() EndpointCustomDnsConfigArrayOutput {\n\treturn o.ApplyT(func(v *Endpoint) EndpointCustomDnsConfigArrayOutput { return v.CustomDnsConfigs }).(EndpointCustomDnsConfigArrayOutput)\n}", "title": "" }, { "docid": "f95d717b2398bfb9c746e9aa1391e24b", "score": "0.44890898", "text": "func (o ThemeOutput) Links() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Theme) pulumi.StringOutput { return v.Links }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e9ca4ba1bfac4648f1c5c05ec115dcce", "score": "0.44734734", "text": "func CustomDomains(domains ...string) []*CustomDomain {\n\tres := []*CustomDomain{}\n\tfor _, d := range domains {\n\t\tres = append(res, &CustomDomain{Name: d})\n\t}\n\treturn res\n}", "title": "" }, { "docid": "e9ca4ba1bfac4648f1c5c05ec115dcce", "score": "0.44734734", "text": "func CustomDomains(domains ...string) []*CustomDomain {\n\tres := []*CustomDomain{}\n\tfor _, d := range domains {\n\t\tres = append(res, &CustomDomain{Name: d})\n\t}\n\treturn res\n}", "title": "" }, { "docid": "8eac318173499d670e277e49e889e1ca", "score": "0.44723713", "text": "func GetLinks(url string) (links []string, err error) {\n\treturn New().GetLinks(url)\n}", "title": "" }, { "docid": "24c949b789d73af4bca70ca8a027942f", "score": "0.4457238", "text": "func (o MicrosoftGraphPageLinks) MarshalJSON() ([]byte, error) {\n\ttoSerialize := map[string]interface{}{}\n\tif o.OneNoteClientUrl == nil {\n\t\tif o.isExplicitNullOneNoteClientUrl {\n\t\t\ttoSerialize[\"oneNoteClientUrl\"] = o.OneNoteClientUrl\n\t\t}\n\t} else {\n\t\ttoSerialize[\"oneNoteClientUrl\"] = o.OneNoteClientUrl\n\t}\n\tif o.OneNoteWebUrl == nil {\n\t\tif o.isExplicitNullOneNoteWebUrl {\n\t\t\ttoSerialize[\"oneNoteWebUrl\"] = o.OneNoteWebUrl\n\t\t}\n\t} else {\n\t\ttoSerialize[\"oneNoteWebUrl\"] = o.OneNoteWebUrl\n\t}\n\treturn json.Marshal(toSerialize)\n}", "title": "" }, { "docid": "7d7bbc4e7d0b8682fc23016b3ca004fb", "score": "0.44539088", "text": "func (in *CustomCerts) DeepCopy() *CustomCerts {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CustomCerts)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "434887ca99a0792447ccb15aea826f19", "score": "0.44482625", "text": "func GetLinks(r *io.Reader) (*[]*Link, error) {\n\n\tparser, err := parser.NewHtmlParser(r)\n\n\tif err != nil {\n\t\tlog.Error(\"Get parser failed!\", err)\n\t\treturn nil, err\n\t}\n\n\tnode := parser.FindNode(\"body\")\n\n\tif node == nil {\n\t\tfmt.Println(\"Find body failed\")\n\t\treturn nil, errors.New(\"Find body failed\")\n\t}\n\n\tlinks := []*Link{}\n\n\tbuildLinks(node, &links)\n\n\treturn &links, nil\n}", "title": "" }, { "docid": "e54e05a920ae7910a93482169e4f8ba5", "score": "0.443808", "text": "func GetLinksViaLinkVisible(iLinkVisible string) (*Links, error) {\n\tvar _Links = &Links{LinkVisible: iLinkVisible}\n\thas, err := Engine.Get(_Links)\n\tif has {\n\t\treturn _Links, err\n\t} else {\n\t\treturn nil, err\n\t}\n}", "title": "" }, { "docid": "7ceb442c97a53a27c7ed18e151dbcac6", "score": "0.44366097", "text": "func (o *AmazonConnectionsPage) GetLinksOk() (*[]Link, bool) {\n\tif o == nil || o.Links == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Links, true\n}", "title": "" }, { "docid": "e48926b91860098448cbec06cce2cfb8", "score": "0.44345382", "text": "func (r *RedirectPaymentProduct840SpecificInput) GetCustom() string {\n\tif r == nil || r.Custom == nil {\n\t\treturn \"\"\n\t}\n\treturn *r.Custom\n}", "title": "" } ]
e2f98076c47511bd2678d61ca0a606e0
GetPosts gets the posts property value. Collection of historical posts for the service issue.
[ { "docid": "48a8195526e3dc029c8aade637513268", "score": "0.8228961", "text": "func (m *ServiceHealthIssue) GetPosts()([]ServiceHealthIssuePostable) {\n val, err := m.GetBackingStore().Get(\"posts\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]ServiceHealthIssuePostable)\n }\n return nil\n}", "title": "" } ]
[ { "docid": "59524b46a8dfd0b0dac5a679c5a643f1", "score": "0.7400889", "text": "func (postServiceImpl *postServiceImpl) GetPosts(topicID uint64) (*[]model.Post, *validation.ApplicationError) {\n\treturn repository.PostRepositoryImpl.GetPostsByTopicID(topicID)\n}", "title": "" }, { "docid": "84276284a2008cdc65c88b077dc7acdd", "score": "0.7240553", "text": "func PostsGet() Posts {\n\tpostsLocker.RLock()\n\tdefer postsLocker.RUnlock()\n\n\treturn posts\n}", "title": "" }, { "docid": "c6a888fe131a8f49440ffe4749bd0538", "score": "0.71446186", "text": "func (p *PostController) GetPosts() {\n\tposts := models.GetPosts()\n\n\tp.Reply().Ok().JSON(aah.Data{\n\t\t\"data\": posts,\n\t})\n}", "title": "" }, { "docid": "d5c85a959f8dea05bf98addd9c3d6b7f", "score": "0.7051702", "text": "func (p *PostsHandler) GetPosts(c *fiber.Ctx) error {\n\tvar posts []data.Post\n\n\t// Getting all the posts from database\n\tp.DB.Order(\"created_at desc\").Find(&posts)\n\n\t// Returning the posts to the client as JSON\n\tc.JSON(posts)\n\n\treturn nil\n}", "title": "" }, { "docid": "ca99d146367f783dfec0595a199e3963", "score": "0.69075614", "text": "func (r *Resolvers) GetPosts(args GetPostsArgs) (GetPostsResponse, error) {\r\n\ttx := r.DB.New()\r\n\treturn getPostsGen(args, tx, r)\r\n}", "title": "" }, { "docid": "726b5c6d3a741a34d0234092a9b44872", "score": "0.685506", "text": "func GetPosts(c *fiber.Ctx) error {\n\tcfg := nconf.GetConfig()\n\tpaging := cfg.GetInt64(\"system.paging\")\n\n\tmapData := make(map[string]interface{})\n\tisMore := false\n\tposts := []post.Post{}\n\tvar page int64 = 1\n\tpg := c.Query(\"page\")\n\tif len(pg) > 0 {\n\t\tpage, _ = strconv.ParseInt(pg, 10, 64)\n\t}\n\tlog.Println(\"page:\", page)\n\tmapData[\"page\"] = page\n\n\ttotal, _ := post.GetTotalPost()\n\t// finish soon.\n\tif total == 0 {\n\t\tmapData[\"isMore\"] = false\n\t\tmapData[\"posts\"] = posts\n\t\tdataResp := DataResp{Err: 0, Msg: \"Get all posts successfully\", Data: mapData}\n\t\treturn c.JSON(dataResp)\n\t}\n\n\tmaxPage := (total-1)/paging + 1\n\t// finish soon.\n\tif page > maxPage {\n\t\tmapData[\"isMore\"] = false\n\t\tmapData[\"posts\"] = posts\n\t\tdataResp := DataResp{Err: 0, Msg: \"Get all posts successfully\", Data: mapData}\n\t\treturn c.JSON(dataResp)\n\t}\n\t// Get data paging.\n\tif page < maxPage {\n\t\tisMore = true\n\t}\n\tskip := (page - 1) * paging\n\n\tposts = post.GetSlidePost(skip, paging)\n\tmapData[\"isMore\"] = isMore\n\tmapData[\"posts\"] = posts\n\tdataResp := DataResp{Err: 0, Msg: \"Get all posts successfully\", Data: mapData}\n\treturn c.JSON(dataResp)\n}", "title": "" }, { "docid": "c411bcd286c02334f7b200a5e4db5f08", "score": "0.68453777", "text": "func (server *Server) GetPosts(c *gin.Context) {\n\tpost := models.Post{}\n\n\tposts, err := post.FindAllPosts(server.DB)\n\tif err != nil {\n\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\"status\": http.StatusNotFound,\n\t\t\t\"message\": \"No Post Found\",\n\t\t})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"status\": http.StatusOK,\n\t\t\"message\": posts,\n\t})\n}", "title": "" }, { "docid": "5832323dacff87041d109f0ce8434ebc", "score": "0.6844076", "text": "func (r *repo) GetPosts() ([]models.Post, error) {\n\t// db, err := gorm.Open(\"postgres\", os.Getenv(\"DB_CONNECTION_STRING\"))\n\t// if err != nil {\n\t// \tfmt.Println(err.Error())\n\t// \tpanic(\"Could not connect to database\")\n\t// }\n\n\t// defer db.Close()\n\n\tvar posts []models.Post\n\n\terr := r.db.Find(&posts).Error\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn posts, nil\n}", "title": "" }, { "docid": "d4e62c364a8705d97c477ddbd667d2d4", "score": "0.6826697", "text": "func (servidor *Servidor) GetPosts(w http.ResponseWriter, r *http.Request) {\n\n\tpost := models.Post{}\n\n\tposts, err := post.BuscarTodosPosts(servidor.DB)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tresponses.JSON(w, http.StatusOK, posts)\n}", "title": "" }, { "docid": "56c3bbef87bad66c17b267d52f23bea4", "score": "0.6812485", "text": "func GetPosts(w http.ResponseWriter, r *http.Request) {\n\tposts := []models.Post{}\n\tposts = append(posts, models.Post{Title: \"Post 1\"})\n\tposts = append(posts, models.Post{Title: \"Post 2\"})\n\n\thelpers.CreateJSONResponse(posts, http.StatusOK, w)\n}", "title": "" }, { "docid": "fb1aab39c324c12a512e681059a5ed5c", "score": "0.6807106", "text": "func Posts(ctx context.Context, isDraft bool) ([]*Post, error) {\n\trows, err := db.QueryContext(ctx, \"SELECT id, title, content, date, created_at, modified_at, tags, draft FROM posts WHERE draft = $1 ORDER BY date DESC\", isDraft)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tposts := make([]*Post, 0)\n\tfor rows.Next() {\n\t\tpost := new(Post)\n\t\terr := rows.Scan(&post.ID, &post.Title, &post.Content, &post.Datetime, &post.Created, &post.Modified, pq.Array(&post.Tags), &post.Draft)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tposts = append(posts, post)\n\t}\n\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn posts, nil\n}", "title": "" }, { "docid": "2c9e8df0b0d131bb501c162496b24c6f", "score": "0.68012697", "text": "func (*postController) GetPosts(response http.ResponseWriter, req *http.Request) {\n\tresponse.Header().Set(\"Content-type\", \"application/json\")\n\tposts, err := postService.FindAll()\n\tif err != nil {\n\t\tlog.Println(\"Error occurred while fetching the post\")\n\t\tresponse.WriteHeader(http.StatusInternalServerError)\n\t\tjson.NewEncoder(response).Encode(errors.ServiceError{Message: \"Error occurred while fetching the posts\"})\n\t}\n\tresponse.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(response).Encode(posts)\n}", "title": "" }, { "docid": "f446aeee981a8a0c85acaae8657c1e71", "score": "0.6756494", "text": "func GetPosts() ([]Post, error) {\n\tres, _ := http.Get(\"https://jsonplaceholder.typicode.com/posts\")\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\titems := make([]Post, 0)\n\n\terr := json.Unmarshal(body, &items)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn items, nil\n}", "title": "" }, { "docid": "afafc1799d3e7f4ea0b06b0cb348f70a", "score": "0.6747133", "text": "func GetPosts() ([]Post, error) {\n\tvar list []Post\n\terr := db.Select(&list, \"SELECT * FROM posts ORDER BY posts.id DESC\")\n\treturn list, err\n}", "title": "" }, { "docid": "c342313fb678216afc076ef95f0475b7", "score": "0.67228377", "text": "func (s *Service) Posts() ([]models.Post, error) {\n\n\tposts := []models.Post{}\n\tqry := \"select id, title, content, author_id from POSTS\"\n\n\trows, err := s.db.Query(qry)\n\n\tif err != nil {\n\t\treturn posts, err\n\t}\n\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tpost := models.Post{}\n\n\t\terr = rows.Scan(&post.ID, &post.Title, &post.Content, &post.AuthorID)\n\n\t\tif err != nil {\n\t\t\treturn posts, err\n\t\t}\n\n\t\tposts = append(posts, post)\n\t}\n\n\treturn posts, err\n}", "title": "" }, { "docid": "8cf5a549d2705f162243e471e200b58d", "score": "0.663811", "text": "func (*contoller) GetPosts(response http.ResponseWriter, request *http.Request) {\n\tresponse.Header().Set(\"Content-type\", \"application/json\")\n\n\tposts, err := postService.FindAll()\n\tif err != nil {\n\t\tresponse.WriteHeader(http.StatusInternalServerError)\n\t\tjson.NewEncoder(response).Encode(err.Error())\n\t\treturn\n\t}\n\n\tret, err := json.Marshal(posts)\n\tif err != nil {\n\t\tresponse.WriteHeader(http.StatusInternalServerError)\n\t\tjson.NewEncoder(response).Encode(err.Error())\n\t\treturn\n\t}\n\n\tresponse.WriteHeader(http.StatusOK)\n\tresponse.Write(ret)\n}", "title": "" }, { "docid": "aec2d2a1e50efdabd13308c7227da58e", "score": "0.6587152", "text": "func (u *User) GetPosts() (Error error) {\n\tError = DB.Select(&u.Posts, \"SELECT * FROM posts WHERE userid = $1 ORDER BY created DESC\", u.ID)\n\treturn\n}", "title": "" }, { "docid": "fe162ffc1ca37dff16274b643d89365e", "score": "0.6550351", "text": "func GetAllPosts(c *fiber.Ctx) error {\n\tposts := post.GetAllPost()\n\tdataResp := DataResp{Err: 0, Msg: \"Get all posts successfully\", Data: posts}\n\treturn c.JSON(dataResp)\n}", "title": "" }, { "docid": "7aa2f7411f5b77eef40a35ba5b81a9d6", "score": "0.6535078", "text": "func (interactor *PostInteractor) Posts() (posts domain.Posts, err error) {\n\tposts, err = interactor.PostRepository.FindAll()\n\treturn\n}", "title": "" }, { "docid": "7ce9d560660bc392cbeb5cd143cbdd20", "score": "0.6529632", "text": "func (api *API) GetPosts() ([]byte, error) {\n\tq := `select * from Post inner join PostTopic using (postID) inner join PostAuthor using (postID) order by postID desc;`\n\trows := api.executeQuery(q)\n\n\tposts := make(map[int64]*PostInfo)\n\tfor rows.Next() {\n\t\tpost := &PostInfo{Authors: make([]string, 0), Topics: make([]string, 0)}\n\t\tvar topic, author string\n\t\tif err := rows.Scan(&post.PostID,\n\t\t\t&post.Category,\n\t\t\t&post.Content,\n\t\t\t&post.Date,\n\t\t\t&post.ImageSrc,\n\t\t\t&post.Section,\n\t\t\t&post.Title,\n\t\t\t&post.URL,\n\t\t\t&topic,\n\t\t\t&author); err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t\tif _, ok := posts[post.PostID]; !ok {\n\t\t\tposts[post.PostID] = post\n\t\t}\n\t\tposts[post.PostID].Topics = append(posts[post.PostID].Topics, topic)\n\t\tposts[post.PostID].Authors = append(posts[post.PostID].Authors, author)\n\t}\n\tdefer rows.Close()\n\n\treturn json.Marshal(posts)\n}", "title": "" }, { "docid": "176e80f1a40a91366862318a8c50b57b", "score": "0.6523643", "text": "func (m *ServiceHealthIssue) SetPosts(value []ServiceHealthIssuePostable)() {\n err := m.GetBackingStore().Set(\"posts\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "cffb671b9ba120bcb241984d596c58a7", "score": "0.6417201", "text": "func (api *API) getPosts(ctx *gin.Context) {\n\tposts, err := api.database.GetAllPosts()\n\tif api.check(err, ctx) {\n\t\treturn\n\t}\n\n\tctx.JSON(http.StatusOK, gr(posts))\n}", "title": "" }, { "docid": "f06ef661cac5accae5565e5647a93447", "score": "0.63879615", "text": "func GetPosts(client ClientInterface, name string, params url.Values) (*Posts, error) {\n\treturn queryPosts(client, \"/blog/%s/posts\", name, params)\n}", "title": "" }, { "docid": "a91dbd389da01706d4a4c01c412c9bb1", "score": "0.6351324", "text": "func (ff *FacebookFetcher) GetPosts(pageID string, params map[string]string) ([]facebook.Result, error) {\n\treturn ff.fetch(pageID, \"posts\", params)\n}", "title": "" }, { "docid": "45f4a9aa4570581f07c1b1c4fb36e45d", "score": "0.631898", "text": "func (twitchAPI *TwitchAPI) GetPosts(channelName string, parameters url.Values,\n\tonSuccess func(Posts), onHTTPError jsonapi.HTTPErrorCallback,\n\tonInternalError jsonapi.InternalErrorCallback) {\n\tvar posts Posts\n\tonSuccessfulRequest := func() {\n\t\tonSuccess(posts)\n\t}\n\ttwitchAPI.unauthenticatedAPI.Get(\"/feed/\"+channelName+\"/posts\", parameters, &posts, onSuccessfulRequest,\n\t\tonHTTPError, onInternalError)\n}", "title": "" }, { "docid": "d4e46a5e1f9385e9d39b93abfce5fb9f", "score": "0.6292936", "text": "func GetPosts() ([]Post, error) {\n\tdb, err := getDBConnection()\n\n\tvar posts []Post\n\n\tif err == nil {\n\t\tdefer db.Close()\n\t\trows, err := db.Query(`SELECT id, title, body FROM posts`)\n\t\tfor rows.Next() {\n\t\t\tpost := Post{}\n\t\t\tscanErr := rows.Scan(&post.Id, &post.Title, &post.Body)\n\t\t\tif scanErr != nil {\n\t\t\t\tlog.Fatal(scanErr)\n\t\t\t} else {\n\t\t\t\tposts = append(posts, post)\n\t\t\t}\n\t\t}\n\t\terr = rows.Err()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\t// fmt.Printf(rows)\n\t\t// defer db.Close()\n\n\t\treturn posts, err\n\t}\n\treturn posts, errors.New(\"Unable to connect to database\")\n}", "title": "" }, { "docid": "4e9368903614fffcbad3e6515cfac9ff", "score": "0.62663954", "text": "func (p *PostController) Posts(ctx context.Context, w http.ResponseWriter, r *http.Request) {\n\tps, err := p.Model.GetPosts()\n\tif err != nil {\n\t\tjsonError(w, r, cErrServer, \"\")\n\t\treturn\n\t}\n\tjsonPosts := make([]*jsonPost, len(ps))\n\tfor i, p := range ps {\n\t\tjsonPosts[i] = &jsonPost{\n\t\t\tID: p.ID,\n\t\t\tUID: p.UID,\n\t\t\tUsername: p.Username,\n\t\t\tMessage: p.Message,\n\t\t\tCreatedAt: p.CreatedAt.Unix(),\n\t\t}\n\t}\n\tresp := postsResponse{\n\t\tData: jsonPosts,\n\t}\n\tenc := json.NewEncoder(w)\n\terr = enc.Encode(&resp)\n\tif err != nil {\n\t\tjsonError(w, r, cErrServer, \"\")\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "49e3401759a186400a644d12c20c1957", "score": "0.62373435", "text": "func getPosts(w http.ResponseWriter, r *http.Request) {\n\t// Log request\n\tlogRequest(w, r)\n\n\tposts := []post{}\n\n\t// Start building query string\n\tqueryString := \"Select title, read_id FROM posts WHERE public = 1 AND reported = 0\"\n\targs := []interface{}{}\n\n\t// Get query parameters\n\turlQuery := r.URL.Query()\n\t// Filtering by title\n\tif title, exists := urlQuery[\"title\"]; exists {\n\t\tqueryString = fmt.Sprintf(\"%s AND title LIKE ?\", queryString)\n\t\targs = append(args, fmt.Sprintf(\"%%%s%%\", title[0]))\n\t}\n\t// Sorting by title\n\tif sort, exists := urlQuery[\"sort\"]; exists {\n\t\tif strings.EqualFold(sort[0], \"title\") {\n\t\t\tqueryString += fmt.Sprintf(\" ORDER BY title\")\n\t\t} else if strings.EqualFold(sort[0], \"title_desc\") {\n\t\t\tqueryString += fmt.Sprintf(\" ORDER BY title DESC\")\n\t\t} else {\n\t\t\twriteJSONResponse(w, fmt.Sprintf(\"Invalid query value: %v\", sort[0]), 400)\n\t\t\treturn\n\t\t}\n\t}\n\t// Pagination\n\tcurrentPage := 1\n\tpageLimit := 6\n\n\tif page, exists := urlQuery[\"page\"]; exists {\n\t\tif pageInt, err := strconv.Atoi(page[0]); err != nil {\n\t\t\twriteJSONResponse(w, fmt.Sprintf(\"Invalid query value: %v\", page[0]), 400)\n\t\t\treturn\n\t\t} else {\n\t\t\tcurrentPage = pageInt\n\t\t}\n\t}\n\n\t// Execute query and store resulted rows in posts\n\tqueryString += \";\"\n\n\terr := db.Select(&posts, queryString, args...)\n\tif err != nil {\n\t\twriteJSONResponse(w, http.StatusText(500), 500)\n\t\treturn\n\t}\n\tif len(posts) == 0 {\n\t\twriteJSONResponse(w, \"No results found\", 200)\n\t\treturn\n\t}\n\n\t// Get specified page from posts\n\tvar pagePosts []post\n\tfirstOfPage := (currentPage - 1) * pageLimit // e.g. Page 1 starts from index 0\n\tlastOfPage := currentPage * pageLimit // e.g. Page 1 ends before index 20\n\tif firstOfPage >= len(posts) { // If first of page is beyond posts' range, return empty array\n\t\tpagePosts = []post{}\n\t} else if lastOfPage > len(posts) { // If last of page is beyond posts' range, only take up to last item\n\t\tpagePosts = posts[firstOfPage:]\n\t} else {\n\t\tpagePosts = posts[firstOfPage:lastOfPage]\n\t}\n\n\t// Configure response\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\tresponse := map[string]interface{}{\n\t\t\"message\": fmt.Sprintf(\"Showing %d of %d post(s) found\", len(pagePosts), len(posts)),\n\t\t\"metadata\": map[string]interface{}{\n\t\t\t\"totalShowing\": len(pagePosts),\n\t\t\t\"totalCount\": len(posts),\n\t\t\t\"totalPages\": int(math.Ceil(float64(len(posts)) / float64(pageLimit))),\n\t\t\t\"page\": currentPage,\n\t\t\t\"perPage\": pageLimit,\n\t\t},\n\t\t\"results\": pagePosts,\n\t}\n\tjson.NewEncoder(w).Encode(response)\n\n}", "title": "" }, { "docid": "9fc0131afe0ddfa4d66f1f1f2f803532", "score": "0.6221845", "text": "func GetAllPosts(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tallPosts, err := postService.FetchAllService()\n\tif err != nil {\n\t\tw.WriteHeader(err.StatusCode)\n\t\tjson.NewEncoder(w).Encode(err)\n\t}\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(allPosts)\n}", "title": "" }, { "docid": "41aec1721e7437f4da5fa90b222e2b63", "score": "0.61918265", "text": "func getPosts(body []byte) ([]Post, error) {\n\tvar posts []Post\n\terr := json.Unmarshal(body, &posts)\n\tif err != nil {\n\t\tlog.Printf(\"Error parsing server response: %v\", err)\n\t}\n\treturn posts, err\n}", "title": "" }, { "docid": "9362279976f2d82ee3f45603fe472a73", "score": "0.6183952", "text": "func (handler *PostsController) GetAllPosts(ctx *gin.Context) {\n\tfmt.Println(\"Getting all posts\")\n\n\thandler.service.GetAllPosts()\n\n\tctx.JSON(http.StatusOK, gin.H{\n\t\t\"status\": http.StatusOK,\n\t\t\"message\": \"Getting all posts\",\n\t})\n}", "title": "" }, { "docid": "77709817abd63efa130fe655877e123d", "score": "0.612608", "text": "func (g *Godel) GetMyPosts() []SinglePostResponse {\n response := g.get(\"posts/mine\", nil)\n posts := LatestPostsResponse{}\n response.JSON(&posts)\n\n return posts.Posts\n}", "title": "" }, { "docid": "ecd748342cbfca626bb7ecaff6ca6e1e", "score": "0.6121848", "text": "func (t *Thread) Posts() (ps []Post) {\n\tq := `\n\t\tselect\n\t\t\tid, uuid, body, user_id, thread_id, created_at\n\t\tfrom\n\t\t\tposts\n\t\twhere\n\t\t\tthread_id = $1\n\t`\n\trows, err := Db.QueryContext(ctx, q, t.ID)\n\tif err != nil {\n\t\tlog.Printf(\"query posts by thread_id: %v\", err)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar p Post\n\t\tif err := rows.Scan(&p.ID, &p.UUID, &p.Body, &p.UserID, &p.ThreadID, &p.CreatedAt); err != nil {\n\t\t\tlog.Printf(\"scan posts rows: %v\", err)\n\t\t\treturn\n\t\t}\n\t\tps = append(ps, p)\n\t}\n\tif err := rows.Err(); err != nil {\n\t\tlog.Printf(\"scan posts by thread_id: %v\", err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "1fce1862aeec941ca0479a81174cc6e3", "score": "0.610076", "text": "func (c *Client4) GetPostsAfter(channelId, postId string, page, perPage int, etag string, collapsedThreads bool, includeDeleted bool) (*PostList, *Response, error) {\n\tquery := fmt.Sprintf(\"?page=%v&per_page=%v&after=%v\", page, perPage, postId)\n\tif collapsedThreads {\n\t\tquery += \"&collapsedThreads=true\"\n\t}\n\tif includeDeleted {\n\t\tquery += \"&include_deleted=true\"\n\t}\n\tr, err := c.DoAPIGet(c.channelRoute(channelId)+\"/posts\"+query, etag)\n\tif err != nil {\n\t\treturn nil, BuildResponse(r), err\n\t}\n\tdefer closeBody(r)\n\tvar list PostList\n\tif r.StatusCode == http.StatusNotModified {\n\t\treturn &list, BuildResponse(r), nil\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&list); err != nil {\n\t\treturn nil, nil, NewAppError(\"GetPostsAfter\", \"api.unmarshal_error\", nil, \"\", http.StatusInternalServerError).Wrap(err)\n\t}\n\treturn &list, BuildResponse(r), nil\n}", "title": "" }, { "docid": "c5305c0d24360361e30905afed760120", "score": "0.6076517", "text": "func getPosts(url string) (p Posts) {\n\tbody := getResponse(url)\n\tdefer body.Close()\n\n\terr := json.NewDecoder(body).Decode(&p)\n\n\tif err != nil {\n\t\tlog.Fatalln(\"can't convert json to struct: \", err.Error())\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "5f1f78f368f95ed5c20151b131fbc092", "score": "0.6075101", "text": "func (r *queryResolver) Posts(ctx context.Context, userID int) ([]*model.Post, error) {\n\tpanic(fmt.Errorf(\"not implemented\"))\n}", "title": "" }, { "docid": "1913d35ab17e94eb2cfea3cdbdd27bae", "score": "0.606784", "text": "func (m *MockPostService) GetPosts() []post.Post {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetPosts\")\n\tret0, _ := ret[0].([]post.Post)\n\treturn ret0\n}", "title": "" }, { "docid": "7817d3b76cf75d2796796de9a708c427", "score": "0.6061525", "text": "func (pr *PostRouter) GetAllPost(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\n\tposts, err := pr.Repository.GetAll(ctx)\n\tif err != nil {\n\t\tresponse.HTTPError(w, r, http.StatusNotFound, err.Error())\n\t\treturn\n\t}\n\n\tresponse.JSON(w, r, http.StatusOK, posts)\n}", "title": "" }, { "docid": "9d99374cb2fcdfa2cbcd9d6f5981b4d3", "score": "0.60550386", "text": "func GetPublishedPosts() ([]Post, error) {\n\tvar list []Post\n\terr := db.Select(&list, \"SELECT * FROM posts WHERE published=$1 ORDER BY posts.id DESC\", true)\n\tif err != nil {\n\t\treturn list, err\n\t}\n\tif err := fillPostsAssociations(list); err != nil {\n\t\treturn list, err\n\t}\n\treturn list, err\n}", "title": "" }, { "docid": "d0c239bef2c3cf86e36100399b6aa68d", "score": "0.60324633", "text": "func GetAllPosts(w http.ResponseWriter, r *http.Request) {\n\tresp, _ := http.Get(BaseURL + \"/posts\")\n\tdefer resp.Body.Close()\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\tfmt.Fprintf(w, \"%s\", body)\n}", "title": "" }, { "docid": "d0f9cfbfb1bf44904f403e88110065b0", "score": "0.6025754", "text": "func Posts(c *gin.Context) {\n\tposts := []dbutils.Post{}\n\tdbutils.SelectPosts(posts)\n\tc.JSON(200, posts)\n}", "title": "" }, { "docid": "182d25327bd0bd4017b98b3807fe6573", "score": "0.6025094", "text": "func (c *Client4) GetPostsSince(channelId string, time int64, collapsedThreads bool) (*PostList, *Response, error) {\n\tquery := fmt.Sprintf(\"?since=%v\", time)\n\tif collapsedThreads {\n\t\tquery += \"&collapsedThreads=true\"\n\t}\n\tr, err := c.DoAPIGet(c.channelRoute(channelId)+\"/posts\"+query, \"\")\n\tif err != nil {\n\t\treturn nil, BuildResponse(r), err\n\t}\n\tdefer closeBody(r)\n\tvar list PostList\n\tif r.StatusCode == http.StatusNotModified {\n\t\treturn &list, BuildResponse(r), nil\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&list); err != nil {\n\t\treturn nil, nil, NewAppError(\"GetPostsSince\", \"api.unmarshal_error\", nil, \"\", http.StatusInternalServerError).Wrap(err)\n\t}\n\treturn &list, BuildResponse(r), nil\n}", "title": "" }, { "docid": "9599a8c14810eb6bee69119c693070fc", "score": "0.60207814", "text": "func GetRecentPosts() (Posts []Post, Error error) {\n\tError = DB.Select(&Posts, \"SELECT * FROM posts ORDER BY created DESC LIMIT 50\")\n\treturn\n}", "title": "" }, { "docid": "507d00856c9c0a0b0c26daeb25d42407", "score": "0.6000012", "text": "func (s Set) GetAllPosts(ctx context.Context) ([]uint, error) {\n\tresp, err := s.GetAllPostsEndpoint(ctx, GetAllPostsRequest{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresponse := resp.(GetAllPostsResponse)\n\treturn response.PostIDs, response.Err\n}", "title": "" }, { "docid": "1c27a99637155112c8ffbc20a0d767a3", "score": "0.59852815", "text": "func GetPosts(c *gin.Context) {\n\t//Get informations from Request\n\ttokenClaims := jwt.ExtractClaims(c)\n\toAuthID := tokenClaims[\"id\"].(string)\n\t//Reset Errorfeedback\n\terrFeedback = nil\n\tvar whereClause string\n\tvar query Query\n\t//Get information from query parameter\n\tquery.limit, _ = c.GetQuery(\"limit\")\n\tquery.author, _ = c.GetQuery(\"author\")\n\tquery.offset, _ = c.GetQuery(\"offset\")\n\tpubDateTotemp, _ := c.GetQuery(\"pubDateTo\")\n\tpubDateFromtemp, _ := c.GetQuery(\"pubDateFrom\")\n\tquery.PubDateFrom, err = time.Parse(time.RFC3339, pubDateFromtemp)\n\tfmt.Println(err)\n\tquery.PubDateTo, _ = time.Parse(time.RFC3339, pubDateTotemp)\n\tfmt.Println(pubDateFromtemp)\n\tfmt.Println(pubDateTotemp)\n\tfmt.Println(query.PubDateFrom)\n\tfmt.Println(query.PubDateTo)\n\tquery.category, _ = c.GetQuery(\"category\")\n\t//Define limit and offset for select statement, user limit = 1000000, offset = 0 as default\n\tif query.limit == \"\" {\n\t\tquery.limit = \"1000000\"\n\t}\n\tif query.offset == \"\" {\n\t\tquery.offset = \"0\"\n\t}\n\t//Control if author is queried, else show posts from current user\n\tif query.author != \"\" {\n\t\tvar user, err = GetUserInformation(oAuthID)\n\t\tif err != nil {\n\t\t\terrFeedback = append(errFeedback, err.Error())\n\t\t}\n\t\tif query.author == user.Username {\n\t\t\twhereClause = \"where user.username ='\" + query.author + \"'\"\n\t\t} else {\n\t\t\twhereClause = \"where (user.username ='\" + query.author + \"' and post.isPrivate = 0)\"\n\t\t}\n\t} else {\n\t\twhereClause = \"where (user.oAuthID ='\" + oAuthID + \"')\"\n\t}\n\t//Expand where clause with information about publication date\n\tif pubDateTotemp != \"\" && pubDateFromtemp != \"\" {\n\t\twhereClause += \" and post.pubDate >= '\" + query.PubDateFrom.Format(time.RFC3339) + \"' and post.PubDate <= '\" + query.PubDateTo.Format(time.RFC3339) + \"'\"\n\t} else if pubDateTotemp != \"\" {\n\t\twhereClause += \" and post.pubDate <= '\" + query.PubDateTo.Format(time.RFC3339) + \"'\"\n\t} else if pubDateFromtemp != \"\" {\n\t\twhereClause += \" and post.pubDate >= '\" + query.PubDateFrom.Format(time.RFC3339) + \"'\"\n\t}\n\t//Expand where clause with given category name\n\tif query.category != \"\" {\n\t\twhereClause += \" and category.name = '\" + query.category + \"'\"\n\t}\n\tvar posts = []Post{}\n\t//Create database connection\n\tdb, err := CreateDBConnection()\n\tif err != nil {\n\t\terrFeedback = append(errFeedback, err.Error())\n\t}\n\tdefer db.Close()\n\t//Preprae statement for getting post count\n\tstmtPostsCount, err := db.Prepare(\"Select count(post.slug) from post join user on user.oAuthID = post.oAuthID join category on category.slug = post.category \" + whereClause + \";\")\n\tif err != nil {\n\t\terrFeedback = append(errFeedback, err.Error())\n\t}\n\tvar rowCount int\n\tstmtPostsCount.QueryRow().Scan(&rowCount)\n\t//Prepare statement for getting defined posts from database\n\tstmtPostsOut, err := db.Prepare(\"Select post.slug, post.title, category.name, post.coverImage, post.body, post.createdAt,post.updatedAt, post.pubDate, post.isPrivate, user.oAuthID, user.email, user.oAuthType, user.Username, user.Image from post join user on user.oAuthID = post.oAuthID join category on category.slug = post.category \" + whereClause + \" order by post.pubDate desc limit ? Offset ?\")\n\tif err != nil {\n\t\terrFeedback = append(errFeedback, err.Error())\n\t}\n\trows, err := stmtPostsOut.Query(query.limit, query.offset)\n\tif err != nil {\n\t\terrFeedback = append(errFeedback, err.Error())\n\t}\n\t//Go through every gotten row and add informations to posts array\n\tfor rows.Next() {\n\t\tvar post Post\n\t\terr = rows.Scan(&post.Slug, &post.Title, &post.Category, &post.CoverImage, &post.Body, &post.CreatedAt, &post.UpdatedAt, &post.PubDate, &post.IsPrivate, &post.Author.OAuthID, &post.Author.EMail, &post.Author.OAuthType, &post.Author.Username, &post.Author.Image)\n\t\tif err != nil {\n\t\t\terrFeedback = append(errFeedback, err.Error())\n\t\t}\n\t\tposts = append(posts, post)\n\t}\n\t//Give back cumulated error list\n\tif errFeedback != nil {\n\t\tc.JSON(422, gin.H{\n\t\t\t\"errors\": gin.H{\"body\": errFeedback},\n\t\t})\n\t} else { // Give back array of posts\n\t\tc.JSON(http.StatusOK, gin.H{\n\t\t\t\"posts\": posts,\n\t\t\t\"postCount\": rowCount,\n\t\t})\n\t}\n}", "title": "" }, { "docid": "07e9df074152998d80bee01eeb9718e7", "score": "0.59720075", "text": "func GetAllPost(w http.ResponseWriter, r *http.Request, db *gorm.DB) {\n\trepo := &repo.PostRepo{Db: db}\n\tposts, err := repo.All()\n\n\tif err != nil {\n\t\tRespondError(w, http.StatusInternalServerError, \"internal server error\")\n\t\treturn\n\t}\n\n\tRespondJSON(w, http.StatusOK, posts)\n}", "title": "" }, { "docid": "8940f1a8509f8a605155b916ad606928", "score": "0.5946987", "text": "func (s *ForumServer) GetAllPosts(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tcollection := s.Client.Database(\"cwgcf\").Collection(\"forumPosts\")\n\tctx, _ := context.WithTimeout(context.Background(), 10*time.Second)\n\topt := options.Find()\n\topt.SetSort(bson.D{{\"forumVotes.votesSum\", -1}, {\"updatedAt\", -1}})\n\tcur, err := collection.Find(ctx, bson.D{}, opt)\n\tif err != nil {\n\t\tlog.Printf(\"Error getting forum posts: %v\", err)\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tw.Write([]byte(`{\"error\": \"Not found\"}`))\n\t\treturn\n\t}\n\tdefer cur.Close(ctx)\n\tres := []ForumPost{}\n\tfor cur.Next(ctx) {\n\t\tvar post ForumPost\n\n\t\terr := cur.Decode(&post)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error getting post: %v\", err)\n\t\t\tcontinue\n\t\t}\n\t\t// Get user profile\n\t\tprofile, err := s.ProfileClient.GetProfile(post.UserID)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error getting profile for ID %s: %v\", post.UserID, err)\n\t\t\tcontinue\n\t\t}\n\t\tpost.UserProfile = profile\n\n\t\tres = append(res, post)\n\t}\n\n\tresBytes, _ := json.Marshal(res)\n\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(resBytes)\n}", "title": "" }, { "docid": "d36e9e67ece9ab251dd211b4b0189d2f", "score": "0.5946696", "text": "func (db *DB) AllPosts(prevDate string, limit int) ([]*Post, error) {\n\tposts := []*Post{}\n\n\trows, err := db.Query(\"SELECT posts.ID, posts.title, posts.body, posts.created, posts.updated, users.id, users.name, users.avatar FROM posts INNER JOIN users ON posts.uid = users.id WHERE posts.created < $1 ORDER BY posts.created DESC LIMIT $2;\", prevDate, limit)\n\tif err != nil {\n\t\treturn posts, err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tPost := &Post{}\n\t\terr := rows.Scan(&Post.ID, &Post.Title, &Post.Body, &Post.Created, &Post.Updated, &Post.Author.ID, &Post.Author.Name, &Post.Author.Avatar)\n\t\tif err != nil {\n\t\t\treturn posts, err\n\t\t}\n\t\tposts = append(posts, Post)\n\t}\n\tif err := rows.Err(); err != nil {\n\t\treturn posts, err\n\t}\n\n\treturn posts, nil\n}", "title": "" }, { "docid": "1fae5e10e30ae837eec34c3f4bfb9e51", "score": "0.5938673", "text": "func (s *FeedService) GetFeedPosts(username string, sorting FeedSorting, params PaginateParams, token string) ([]*Post, error) {\n\n\t// TODO test\n\n\tvar (\n\t\tmethod = http.MethodGet\n\t\tpath = fmt.Sprintf(\"/users/%s/feed/posts\", username)\n\t)\n\n\tqueries := url.Values{}\n\t// use params only if not default values\n\tif params.Limit != 0 || params.Offset != 0 {\n\t\tqueries.Set(\"limit\", strconv.FormatUint(uint64(params.Limit), 10))\n\t\tqueries.Set(\"offset\", strconv.FormatUint(uint64(params.Offset), 10))\n\t}\n\tif sorting != \"\" {\n\t\tqueries.Set(\"sort\", fmt.Sprintf(\"%s\", sorting))\n\t}\n\n\treq := s.client.newRequest(path, method)\n\treq.URL.RawQuery = queries.Encode()\n\taddJWTToRequest(req, token)\n\n\tjs, statusCode, err := s.client.do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch js.Status {\n\tcase \"success\":\n\t\tbreak\n\tcase \"fail\":\n\t\tjF, ok := js.Data.(*jSendFailData)\n\t\tif !ok {\n\t\t\treturn nil, ErrRESTServerError\n\t\t}\n\t\ts.client.Logger.Printf(\"%+v\", jF)\n\t\tswitch statusCode {\n\t\tcase http.StatusNotFound:\n\t\t\treturn nil, ErrUserNotFound\n\t\tcase http.StatusBadRequest:\n\t\t\tswitch jF.ErrorReason {\n\t\t\tcase \"limit\":\n\t\t\t\tfallthrough\n\t\t\tcase \"offset\":\n\t\t\t\tfallthrough\n\t\t\tdefault:\n\t\t\t}\n\t\t\tfallthrough\n\t\tdefault:\n\t\t\treturn nil, ErrRESTServerError\n\t\t}\n\tcase \"error\":\n\t\treturn nil, ErrRESTServerError\n\tdefault:\n\t\tswitch statusCode {\n\t\tcase http.StatusUnauthorized:\n\t\t\treturn nil, ErrAccessDenied\n\t\tcase http.StatusInternalServerError:\n\t\t\tfallthrough\n\t\tdefault:\n\t\t\treturn nil, ErrRESTServerError\n\t\t}\n\t}\n\n\tposts := make([]*Post, 0)\n\tdata, ok := js.Data.(*json.RawMessage)\n\tif !ok {\n\t\treturn nil, ErrRESTServerError\n\t}\n\terr = json.Unmarshal(*data, &posts)\n\tif err != nil {\n\t\treturn nil, ErrRESTServerError\n\t}\n\treturn posts, nil\n}", "title": "" }, { "docid": "2097317abfa4d5e0d8ebcfc2e0351985", "score": "0.5935503", "text": "func (post Post) GetAll() ([]Post, error) {\n\tvar posts []Post\n\trows, err := db.Queryx(\"SELECT * FROM posts ORDER BY created DESC\")\n\tif err != nil {\n\t\tif err.Error() == \"sql: no rows in result set\" {\n\t\t\tposts = make([]Post, 0)\n\t\t\treturn posts, nil\n\t\t}\n\t\treturn posts, err\n\t}\n\tfor rows.Next() {\n\t\terr := rows.StructScan(&post)\n\t\tif err != nil {\n\t\t\treturn posts, err\n\t\t}\n\t\tposts = append(posts, post)\n\t}\n\treturn posts, nil\n}", "title": "" }, { "docid": "8ef03a98fe69c06462d97c480315d836", "score": "0.5930667", "text": "func GetRecentPosts() ([]Post, error) {\n\tvar list []Post\n\terr := db.Select(&list, \"SELECT id, name FROM posts WHERE published=$1 ORDER BY id DESC LIMIT 7\", true)\n\treturn list, err\n}", "title": "" }, { "docid": "b27360361a3b89681ca911a461c90d7d", "score": "0.59301525", "text": "func (data *DataSource) RecentPosts(count int) ([]Post, error) {\n\tvar posts []Post\n\tdata.db.Order(\"created_at DESC\").Limit(count).Find(&posts)\n\treturn posts, nil\n}", "title": "" }, { "docid": "d20287a4e9fe1d500d19be35b8c016d9", "score": "0.5913857", "text": "func (store MySQL) GetPosts(opts ...int) ([]Post, ResultsInfo, error) {\n\tlog.Debug().Interface(\"options\", opts).Msg(\"GetPosts\")\n\n\tvar (\n\t\tresultsInfo = ResultsInfo{\n\t\t\tLimit: 25,\n\t\t\tOffset: 0,\n\t\t}\n\t\tcreatedBy = 0\n\t\twhereSQL = \"\"\n\t)\n\n\tif len(opts) > 0 {\n\t\tresultsInfo.Limit = opts[0]\n\t\tif len(opts) > 1 {\n\t\t\tresultsInfo.Offset = opts[1]\n\n\t\t\tif len(opts) > 2 {\n\t\t\t\tif opts[2] > 0 {\n\t\t\t\t\tcreatedBy = opts[2]\n\t\t\t\t\twhereSQL = \" WHERE created_by = ? \"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tconn := db.Connx(mysqlDbID)\n\n\tquery := `\n SELECT\n ` + postSelectSQL + `\n FROM\n\t\t\t` + postsTableName + `\n\t\t` + whereSQL + `\n `\n\n\tparams := []interface{}{}\n\n\tif createdBy > 0 {\n\t\tparams = append(params, createdBy)\n\t}\n\n\tif resultsInfo.Limit > 0 {\n\t\tquery = query + ` LIMIT `\n\t\tif resultsInfo.Offset > 0 {\n\t\t\tquery = query + ` ?, `\n\t\t\tparams = append(params, resultsInfo.Offset)\n\t\t}\n\t\tparams = append(params, resultsInfo.Limit)\n\t\tquery = query + ` ? `\n\t}\n\n\trows, err := conn.Queryx(query, params...)\n\tlog.IfError(err)\n\n\tif err != nil {\n\t\treturn []Post{}, resultsInfo, err\n\t}\n\n\tdefer rows.Close()\n\n\t// Handle createdBy if present in total lookup\n\tids := []int{}\n\tif createdBy > 0 {\n\t\tids = append(ids, createdBy)\n\t}\n\tresultsInfo.Total, err = store.GetTotalPosts(ids...)\n\n\treturn parsePostsFromRows(rows), resultsInfo, nil\n\n}", "title": "" }, { "docid": "3e0168a4e8c8106ceab8dd2f86f88d18", "score": "0.5912939", "text": "func (s *Site) RecentPosts() Posts {\n\tp := s.PostsByDate()\n\tlim := len(p)\n\tif s.meta.RecentCount < lim {\n\t\tlim = s.meta.RecentCount\n\t}\n\treturn s.PostsByDate()[0:lim]\n}", "title": "" }, { "docid": "f8eeff51daf63357db90000371b25964", "score": "0.5904919", "text": "func GetAllPosts(input http.ResponseWriter, r *http.Request){\n\tinput.Header().Set(\"Content-Type\", \"application/json\")\n\tvar posts []models.Post\n\tmodels.DB.Find(&posts)\n\tjson.NewEncoder(input).Encode(posts)\n}", "title": "" }, { "docid": "192e3fce678629a77aa975b9a209c869", "score": "0.59032124", "text": "func (p *SeaBackend) LoadPosts(ctx context.Context) ([]RemotePost, error) {\n\tvar remotePosts []RemotePost\n\n\terr := p.load(ctx, p.endpoint+\"/posts\", &remotePosts)\n\n\tif err != nil {\n\t\treturn remotePosts, fmt.Errorf(\"could not load posts: %w\", err)\n\t}\n\n\treturn remotePosts, nil\n}", "title": "" }, { "docid": "7252389aea4b1fde3d23ff77dced3725", "score": "0.5902276", "text": "func (g *Godel) GetMostRecentPosts() []SinglePostResponse {\n response := g.get(\"posts/location/\", nil)\n posts := LatestPostsResponse{}\n response.JSON(&posts)\n\n return posts.Posts\n}", "title": "" }, { "docid": "ce12939dda7fc99b0b30973fac1b0887", "score": "0.5888606", "text": "func Posts() orm.QuerySeter {\n\tvar table Post\n\treturn orm.NewOrm().QueryTable(table)\n}", "title": "" }, { "docid": "a439db583dc8e84697897b8568fd73c5", "score": "0.58851016", "text": "func (c *Client) ListPosts(ctx context.Context, userID string) ([]*Post, error) {\n\tpath := fmt.Sprintf(\"/users/%s/posts?app-token=%s&limit=1000\", userID, c.Token)\n\tb, err := c.Do(ctx, http.MethodGet, path, nil, http.StatusOK)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tps := make([]*Post, 0)\n\terr = json.Unmarshal(b, &ps)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ps, nil\n}", "title": "" }, { "docid": "38a4bfb742255ff74711cbe873ff2ef4", "score": "0.58710986", "text": "func redisGetPosts(conn redis.Conn, postSet string) ([]Post, error) {\n\tpostNames, err := redis.Strings(conn.Do(\"ZREVRANGE\", postSet, 0, 100))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tposts := []Post{}\n\n\tfor _, name := range postNames {\n\t\tval, err := redis.Values(conn.Do(\"HGETALL\", postTag+name))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tp := new(Post)\n\t\terr = redis.ScanStruct(val, p)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tposts = append(posts, *p)\n\t}\n\n\treturn posts, nil\n}", "title": "" }, { "docid": "f16e831f87877bc8393ffd16e65f9cdc", "score": "0.5866938", "text": "func GetPostMonths() ([]Post, error) {\n\tvar list []Post\n\terr := db.Select(&list, \"SELECT DISTINCT date_trunc('month', created_at) as created_at FROM posts WHERE published=$1 ORDER BY created_at DESC\", true)\n\treturn list, err\n}", "title": "" }, { "docid": "c44bdc7f6368e961e31c06dd4ee87e67", "score": "0.5861953", "text": "func (c *Client) GetUserPosts() (*[]Post, error) {\n\tp := &[]Post{}\n\tenv, err := c.get(\"/me/posts\", p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar ok bool\n\tif p, ok = env.Data.(*[]Post); !ok {\n\t\treturn nil, fmt.Errorf(\"Wrong data returned from API.\")\n\t}\n\tstatus := env.Code\n\n\tif status != http.StatusOK {\n\t\tif c.isNotLoggedIn(status) {\n\t\t\treturn nil, fmt.Errorf(\"Not authenticated.\")\n\t\t}\n\t\treturn nil, fmt.Errorf(\"Problem getting user posts: %d. %s\\n\", status, env.ErrorMessage)\n\t}\n\treturn p, nil\n}", "title": "" }, { "docid": "4bd6c1a00e79fc49dbac3a8c0e041f47", "score": "0.5858431", "text": "func (post Post) GetAll(db *gorm.DB) ([]Post, error) {\n\tvar posts []Post\n\tquery := db.Order(\"date desc\").Find(&posts)\n\tif query.Error != nil {\n\t\tif query.Error == gorm.RecordNotFound {\n\t\t\tposts = make([]Post, 0)\n\t\t\treturn posts, nil\n\t\t}\n\t\treturn posts, query.Error\n\t}\n\treturn posts, nil\n}", "title": "" }, { "docid": "7ee852783e8e4a3381f196b56b1f10f0", "score": "0.5856016", "text": "func PostsHandler (c *gin.Context) {\n\tqueryConfig, err := getAndValidateQueries(c)\n\tif err != nil {\n\t\terrMsg := gin.H{\"Bad Request\": err.Error()}\n\t\tc.JSON(http.StatusBadRequest, errMsg)\n\t\treturn\n\t}\n\n\tposts, err := getCombinedPosts(queryConfig.tags)\n\tif err != nil {\n\t\terrMsg := gin.H{\"Error getting posts\": err.Error()}\n\t\tc.JSON(http.StatusInternalServerError, errMsg)\n\t\treturn\n\t}\n\n\tsortedPosts := sortPosts(posts, queryConfig.direction, queryConfig.sortBy)\n\t// containerize posts inside an upper Posts struct (for matching output in assignment)\n\tcontainerPosts := &Posts {\n\t\tPosts: sortedPosts,\n\t}\n\n\tif response, err := json.Marshal(&containerPosts); err != nil {\n\t\terrMsg := gin.H{\"Error generating response\": err.Error()}\n\t\tc.JSON(http.StatusInternalServerError, errMsg)\n\t\treturn\n\t}else {\n\t\tfmt.Println(string(response))\n\t\tc.JSON(http.StatusOK, string(response))\n\t}\n\n}", "title": "" }, { "docid": "7b67281e8bbcece4f73273a357333be6", "score": "0.58457035", "text": "func (e *Edb) GetPostList() ([]PostList, error) {\n\trows, err := e.db.Query(`\n\t\tSELECT\n\t\t\tid,\n\t\t\tname,\n\t\t\tgo,\n\t\t\tnote\n\t\tFROM\n\t\t\tposts\n\t\tORDER BY\n\t\t\tname ASC`)\n\tif err != nil {\n\t\tlog.Println(\"GetPostList e.db.Query \", err)\n\t\treturn []PostList{}, err\n\t}\n\tposts, err := scanPostsList(rows)\n\treturn posts, err\n}", "title": "" }, { "docid": "afa846db41409b0a1fd434d8aeecfe0e", "score": "0.5837987", "text": "func AllPosts(ctx context.Context) ([]*Post, error) {\n\treturn Posts(ctx, false)\n}", "title": "" }, { "docid": "83d85eff1f9c11863ccdc577d1d262b6", "score": "0.5821089", "text": "func GetPostsForTags(tags string, limit int, sfw bool, page int) ([]Post, error) {\n\tclient := &http.Client{}\n\n\tvar domain string\n\n\tif sfw {\n\t\tdomain = \"e926.net\"\n\t} else {\n\t\tdomain = \"e621.net\"\n\t}\n\n\treq, _ := http.NewRequest(\"GET\", \"https://\"+domain+\"/posts.json\", nil)\n\treq.Header.Set(\"User-Agent\", \"e6dl: go edition (@tjhorner on Telegram)\")\n\n\tqs := req.URL.Query()\n\tqs.Add(\"tags\", tags)\n\tqs.Add(\"limit\", strconv.Itoa(limit))\n\tqs.Add(\"page\", strconv.Itoa(page))\n\n\treq.URL.RawQuery = qs.Encode()\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar respBody struct {\n\t\tPosts []Post\n\t}\n\n\tjson.Unmarshal(body, &respBody)\n\n\treturn respBody.Posts, nil\n}", "title": "" }, { "docid": "6691f5261e3d28893de8a8966e998b88", "score": "0.58133394", "text": "func GetPostList(w http.ResponseWriter, r *http.Request) {\n\tsqlQ := \"SELECT \tid ,\" +\n\t\t\"text ,\" +\n\t\t\"fk_car, fk_user FROM public.posts LIMIT 50\"\n\n\trows, err := Database.Query(sqlQ)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tvar posts [50]Post\n\tcount := 0\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\terr := rows.Scan(&posts[count].ID, &posts[count].Text, &posts[count].Fkcar, &posts[count].Fkuser)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tcount++\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson, err := json.Marshal(posts[:count])\n\n\tfmt.Fprintf(w, \"%s\", json)\n}", "title": "" }, { "docid": "38361b7317fdd0f254f03cb31ea83e1b", "score": "0.5804002", "text": "func (g *Godel) GetMyRepliedPosts() []SinglePostResponse {\n response := g.get(\"posts/mine/replies\", nil)\n post := LatestPostsResponse{}\n response.JSON(&post)\n\n return post.Posts\n}", "title": "" }, { "docid": "f45c15a64e3573a9d20df8b454325481", "score": "0.58023447", "text": "func (ue *UserEntity) GetPostsSince(channelId string, time int64, collapsedThreads bool) ([]string, error) {\n\tpostList, _, err := ue.client.GetPostsSince(context.Background(), channelId, time, collapsedThreads)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif postList == nil || len(postList.Posts) == 0 {\n\t\treturn nil, nil\n\t}\n\n\treturn postList.Order, ue.store.SetPosts(postListToSlice(postList))\n}", "title": "" }, { "docid": "936af3421b337e3f1851d8b204cb693d", "score": "0.5783815", "text": "func (this *Persistence) GetPosts(\n\twhere_clause string,\n\tparams ...interface{},\n) (posts []types.RedditPost, err error) {\n\tvar rows *sql.Rows\n\tvar sql = `\n SELECT \n id\n , name\n , permalink\n , time_created\n , time_stored\n , is_active\n , is_sticky\n , score\n , title\n , url\n , subreddit_name\n , subreddit_id\n FROM redditpost\n ` + where_clause\n\tif rows, err = this.dbconn.Query(sql, params...); err != nil {\n\t\tlog.Errorf(\"Error calling SQL %v\", err)\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar redditPost types.RedditPost\n\n\t\terr = rows.Scan(\n\t\t\t&redditPost.Id,\n\t\t\t&redditPost.Name,\n\t\t\t&redditPost.Permalink,\n\t\t\t&redditPost.TimeCreated,\n\t\t\t&redditPost.TimeStored,\n\t\t\t&redditPost.IsActive,\n\t\t\t&redditPost.IsSticky,\n\t\t\t&redditPost.Score,\n\t\t\t&redditPost.Title,\n\t\t\t&redditPost.Url,\n\t\t\t&redditPost.SubredditName,\n\t\t\t&redditPost.SubredditId,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\t/*\n\t\t\t Maybe this could make a comeback, if I could figure out how...\n\t\t\t Possibly, Scan the row into a map?\n\t\t\t if err = mapstructure.Decode(row, &redditPost); err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"Could not decode reddit post ID: '%s' subreddit: '%s' %v\", row[\"id\"], row[\"subreddit\"], err)\n\t\t\t\t\t}\n\t\t*/\n\t\tposts = append(posts, redditPost)\n\t}\n\tlog.Debugf(\"Retrieved %d posts from the database\", len(posts))\n\treturn posts, nil\n}", "title": "" }, { "docid": "b1544436b2389f233928d3c462e16bf9", "score": "0.57718486", "text": "func (post Post) GetAll() ([]Post, error) {\n\tvar posts []Post\n\tquery := connection.Gorm.Order(\"created desc\").Find(&posts)\n\tif query.Error != nil {\n\t\tif query.Error == gorm.RecordNotFound {\n\t\t\tposts = make([]Post, 0)\n\t\t\treturn posts, nil\n\t\t}\n\t\treturn posts, query.Error\n\t}\n\treturn posts, nil\n}", "title": "" }, { "docid": "03d23ce32ebfb59b51e4a9ffb27dcc61", "score": "0.57530844", "text": "func GetPostList() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tuid := c.GetInt(\"uid\")\n\t\tqueryUserId := c.DefaultQuery(\"uid\", strconv.Itoa(uid))\n\n\t\tvar posts []types.Post\n\n\t\tconn := getConn()\n\n\t\tif result := conn.Where(\"auth = ?\", queryUserId).Find(&posts); result.Error == nil && result.RowsAffected != 0 {\n\t\t\tc.JSON(http.StatusOK, posts)\n\t\t\treturn\n\t\t}\n\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\"code\": 1,\n\t\t\t\"error\": \"Resoure Not Found\",\n\t\t})\n\t}\n}", "title": "" }, { "docid": "6d1297b6c23d5c53cbde3d87f2ff2b79", "score": "0.5733717", "text": "func (s *ForumServer) GetForumPosts(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t// Parse request\n\tvar getForumPostsRequest models.GetForumPostsRequest\n\tdecoder := json.NewDecoder(r.Body)\n\terr := decoder.Decode(&getForumPostsRequest)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to decode request: %v\", err)\n\t}\n\t// Fetch DBPosts\n\tcollection := s.Client.Database(\"cwgcf\").Collection(\"forumPosts\")\n\tctx, _ := context.WithTimeout(context.Background(), 10*time.Second)\n\topt := options.Find()\n\topt.SetSort(bson.D{{\"metadata.updatedAt\", -1}})\n\tcur, err := collection.Find(ctx, bson.D{}, opt)\n\tif err != nil {\n\t\tlog.Printf(\"Error getting forum posts: %v\", err)\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tw.Write([]byte(fmt.Sprintf(`{\"error\": \"%v\"}`, err)))\n\t\treturn\n\t}\n\t// Transform DBPosts to []ForumPostV2\n\tdefer cur.Close(ctx)\n\tresponse := models.GetForumPostsResponse{}\n\tposts := []models.ForumPostV2{}\n\tvotes := map[string]models.ForumVote{}\n\tfor cur.Next(ctx) {\n\t\tvar dbPost models.DBForumPost\n\t\terr := cur.Decode(&dbPost)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error getting post: %v\", err)\n\t\t\tcontinue\n\t\t}\n\t\t// Get user profile\n\t\tprofile, err := s.ProfileClient.GetProfile(dbPost.UserID)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error getting profile for ID %s: %v\", dbPost.UserID, err)\n\t\t\tcontinue\n\t\t}\n\t\tpost := s.dbPostToPost(dbPost, profile)\n\t\tposts = append(posts, post)\n\n\t\t// Get vote\n\t\tvote := s.getVote(dbPost.VoteID)\n\t\tvotes[dbPost.VoteID] = vote\n\t}\n\tresponse.ForumPosts = posts\n\tresponse.ForumVotesMap = votes\n\tresBytes, _ := json.Marshal(response)\n\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(resBytes)\n}", "title": "" }, { "docid": "87360bb106c091032474157928d5f1bd", "score": "0.57303494", "text": "func (p *PostController) GetAll(ctx *fiber.Ctx) {\n\tposts, err := p.postService.GetAll(ctx)\n\tif err != nil {\n\t\tctx.Next(err)\n\n\t\treturn\n\t}\n\n\tr := utils.NewResponse()\n\tr.JSONResponse(ctx, true, fiber.StatusOK, \"[INFO]: Resource found\", posts)\n}", "title": "" }, { "docid": "80e80d1008f1d051704aba642ce51c35", "score": "0.56719995", "text": "func (mr *MockPostServiceMockRecorder) GetPosts() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetPosts\", reflect.TypeOf((*MockPostService)(nil).GetPosts))\n}", "title": "" }, { "docid": "d4dc604eb0df6c910e04e72338322862", "score": "0.5669106", "text": "func (ue *UserEntity) GetPostsAfter(channelId, postId string, page, perPage int, collapsedThreads bool) error {\n\tpostList, _, err := ue.client.GetPostsAfter(context.Background(), channelId, postId, page, perPage, \"\", collapsedThreads, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif postList == nil || len(postList.Posts) == 0 {\n\t\treturn nil\n\t}\n\treturn ue.store.SetPosts(postsMapToSlice(postList.Posts))\n}", "title": "" }, { "docid": "f8d9a99e05b8b147ac8943407ae6258d", "score": "0.566616", "text": "func GetPosts(offset, limit int) ([]Post, bool) {\n\tdb := common.GetDatabase()\n\tvar posts []Post\n\tif err := db.Find(&posts).Offset(offset).Limit(limit).Error; err != nil {\n\t\treturn posts, false\n\t}\n\n\treturn posts, true\n}", "title": "" }, { "docid": "1502ce39a8968e01b35ff389b360bb0d", "score": "0.56260175", "text": "func TestGetPublishedPosts(t *testing.T) {\n\tpostFixtures[1].Time = timeWayBefore\n\tpostFixtures[2].Time = timeBefore\n\n\tb := &goblawg.Blog{Posts: postFixtures}\n\tposts := b.GetPublishedPosts()\n\n\torderedPostList := []*goblawg.Post{postFixtures[0], postFixtures[2], postFixtures[1]}\n\tequals(t, posts, orderedPostList)\n}", "title": "" }, { "docid": "7e33d35661b7af214ebc3425ed7e10cc", "score": "0.5615462", "text": "func (us *User) GetAllPosts() ([]byte, []int) {\n\tposts, _ := ioutil.ReadDir(fmt.Sprintf(\"./coursedata/users/%v/\", us.Matrikel))\n\tvar postdata []byte\n\tvar data []byte\n\tvar postNumbers []int\n\tfor _, p := range posts {\n\t\tnumber, err := strconv.Atoi(strings.Trim(p.Name(), \"post_.md\"))\n\t\tif err == nil {\n\t\t\tcurrentPostStr := fmt.Sprintf(\"# <div class='post-header text-primary'><a href='./?nr=%v&mat=%v'>Aufgabe %v<a/></div>\\n\", number, us.Matrikel, number)\n\t\t\tcurrentPost := []byte(currentPostStr)\n\t\t\tpostdata = us.GetPost(number)\n\t\t\tcurrentPost = append(currentPost, postdata...)\n\t\t\thr := []byte(\"\\n\\n<hr>\\n\")\n\t\t\tcurrentPost = append(currentPost, hr...)\n\t\t\tdata = append(data, currentPost...)\n\t\t\tpostNumbers = append(postNumbers, number)\n\t\t}\n\t}\n\treturn data, postNumbers\n}", "title": "" }, { "docid": "9a66344ae953e70e3b0f00b75e95f6b1", "score": "0.56087357", "text": "func (c *Client4) GetPinnedPosts(channelId string, etag string) (*PostList, *Response, error) {\n\tr, err := c.DoAPIGet(c.channelRoute(channelId)+\"/pinned\", etag)\n\tif err != nil {\n\t\treturn nil, BuildResponse(r), err\n\t}\n\tdefer closeBody(r)\n\n\tvar list PostList\n\tif r.StatusCode == http.StatusNotModified {\n\t\treturn &list, BuildResponse(r), nil\n\t}\n\n\tif err := json.NewDecoder(r.Body).Decode(&list); err != nil {\n\t\treturn nil, nil, NewAppError(\"GetPinnedPosts\", \"api.unmarshal_error\", nil, \"\", http.StatusInternalServerError).Wrap(err)\n\t}\n\treturn &list, BuildResponse(r), nil\n}", "title": "" }, { "docid": "31b27f02bd50857d466aba14d1818007", "score": "0.55771637", "text": "func (r *PostsService) Get(blogId string, postId string) *PostsGetCall {\n\tc := &PostsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.blogId = blogId\n\tc.postId = postId\n\treturn c\n}", "title": "" }, { "docid": "ffde19f6e682a6bacccdc3735ed8b748", "score": "0.5568577", "text": "func (ctrl postController) GetAll(ctx *gin.Context) {\n\n\t// grpc client call\n\treq := &proto.GetAllPostsRequest{}\n\tclient := proto.NewPostServiceClient(ctrl.GrpcConn)\n\n\tposts, appErr := client.GetAll(ctx, req)\n\tif appErr != nil {\n\t\tctrl.RenderError(ctx, appErr)\n\t\treturn\n\t}\n\n\tctrl.RenderSuccess(ctx, viewmodels.Response{\n\t\tSuccess: true,\n\t\tRequestID: requestid.Get(ctx),\n\t\tData: posts,\n\t\tError: nil,\n\t})\n\n}", "title": "" }, { "docid": "d6836faa4b2a4ee800e0af252ff03ec8", "score": "0.55611163", "text": "func (*repository) GetAll() ([]*entities.Post, *error.Response) {\n\treturn allPosts, nil\n}", "title": "" }, { "docid": "a7339cae1a3f8df928bcafa3583d7a16", "score": "0.55557466", "text": "func (repo *repository) QueryPosts(ctx context.Context, params model.ListFilter) ([]uint64, error) {\n\tsqlQuery, args, err := getSQLQuery(ctx, params)\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"params\": params,\n\t\t\t\"func\": \"repository.getSQLQuery\",\n\t\t}).Errorf(\"Failed to get sql query: %s\", err)\n\t\treturn nil, err\n\t}\n\n\tlog.WithFields(log.Fields{\n\t\t\"params\": args,\n\t\t\"func\": \"repository.QueryPosts\",\n\t}).Errorf(\"QueryPosts SQL : %s\", sqlQuery)\n\n\tqueryRes, err := repo.db.Query(sqlQuery, args...)\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"params\": args,\n\t\t\t\"func\": \"repo.db.Query\",\n\t\t}).Errorf(\"Failed to run db query: %s\", err)\n\t\treturn nil, err\n\t}\n\n\tvar postID uint64\n\tvar postIDs []uint64\n\n\tfor queryRes.Next() {\n\t\terr = queryRes.Scan(&postID)\n\t\tif err != nil {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"params\": postID,\n\t\t\t\t\"func\": \"repo.Scan\",\n\t\t\t}).Errorf(\"Failed to scan db query: %s\", err)\n\t\t\treturn nil, err\n\t\t}\n\t\tpostIDs = append(postIDs, postID)\n\t}\n\n\treturn postIDs, err\n}", "title": "" }, { "docid": "8bcf8c1a8e805551bd8540758168b08b", "score": "0.5555649", "text": "func (g *Godel) GetMyPinnedPosts() []SinglePostResponse {\n response := g.get(\"posts/mine/pinned\", nil)\n posts := LatestPostsResponse{}\n response.JSON(&posts)\n\n return posts.Posts\n}", "title": "" }, { "docid": "23488019d98cfe97876563dc2397c861", "score": "0.5534289", "text": "func (wpl *WranglerPostList) NumPosts() int {\n\treturn len(wpl.Posts)\n}", "title": "" }, { "docid": "5b742c93aec3e9938717d14c7479ce12", "score": "0.5522497", "text": "func (api *API) getNumPosts(ctx *gin.Context) {\n\tn, err := api.database.GetNumPosts()\n\tif api.check(err, ctx) {\n\t\treturn\n\t}\n\tctx.JSON(http.StatusOK, gr(n))\n}", "title": "" }, { "docid": "4e8a51ab73da9b98f1c0521e84ab6e60", "score": "0.5518102", "text": "func GetPosts(\n\tuserName string,\n\treverse bool,\n\toffset int,\n\tlimit int,\n\tdone <-chan struct{},\n) (<-chan *joy.Post, <-chan error) {\n\toutPosts := make(chan *joy.Post)\n\toutErrors := make(chan error)\n\n\tpageOffset, postsOffset := getOffsets(userName, offset)\n\tpagesIt := createPagesIterator(userName, reverse, pageOffset)\n\n\tgo func() {\n\t\tdefer close(outPosts)\n\t\tdefer close(outErrors)\n\n\t\tprocessAllPagesPosts(pagesIt, outPosts, outErrors, done)\n\t}()\n\n\tuniquePosts := getUniquePostsChan(outPosts, done)\n\tlimitedPosts, limitedErrors := limitPostsRange(postsOffset, limit, uniquePosts, outErrors, done)\n\treturn limitedPosts, limitedErrors\n}", "title": "" }, { "docid": "6c9318290ee315be29e32e8060aaae0d", "score": "0.5512689", "text": "func (r *ServiceRegistry) NewPosts() service.PostsInterface {\n\tUsersRepo := repository.NewUsers(r.settings.Engine)\n\tBooksRepo := repository.NewBooks(r.settings.Engine)\n\tUsersBooksRegistrationsRepo := repository.NewUsersBooksRegistrations(r.settings.Engine)\n\tActionsRepo := repository.NewActions(r.settings.Engine)\n\treturn service.NewPosts(UsersRepo, BooksRepo, UsersBooksRegistrationsRepo, ActionsRepo)\n}", "title": "" }, { "docid": "04323e1f5141cd40a50a568911ff632d", "score": "0.54981077", "text": "func (s *AdminPostsService) List(listParams *ListParams) (*PostsResponse, error) {\n\tu, err := addOptions(\"posts\", listParams)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := s.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpostsResponse := new(PostsResponse)\n\t_, err = s.client.Do(req, postsResponse)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn postsResponse, nil\n}", "title": "" }, { "docid": "26697c7bd1ce34628f0e235526d86103", "score": "0.5486483", "text": "func (s *AdminPostsService) Get(id string) (*Post, error) {\n\tu := fmt.Sprintf(\"posts/%v\", id)\n\treq, err := s.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpostsResponse := new(PostsResponse)\n\t_, err = s.client.Do(req, postsResponse)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn postsResponse.Posts[0], nil\n}", "title": "" }, { "docid": "24f6145a0fed0930e3ec94f773af9c05", "score": "0.54658824", "text": "func (c *Client4) GetPostsBefore(channelId, postId string, page, perPage int, etag string, collapsedThreads bool, includeDeleted bool) (*PostList, *Response, error) {\n\tquery := fmt.Sprintf(\"?page=%v&per_page=%v&before=%v\", page, perPage, postId)\n\tif collapsedThreads {\n\t\tquery += \"&collapsedThreads=true\"\n\t}\n\tif includeDeleted {\n\t\tquery += \"&include_deleted=true\"\n\t}\n\tr, err := c.DoAPIGet(c.channelRoute(channelId)+\"/posts\"+query, etag)\n\tif err != nil {\n\t\treturn nil, BuildResponse(r), err\n\t}\n\tdefer closeBody(r)\n\tvar list PostList\n\tif r.StatusCode == http.StatusNotModified {\n\t\treturn &list, BuildResponse(r), nil\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&list); err != nil {\n\t\treturn nil, nil, NewAppError(\"GetPostsBefore\", \"api.unmarshal_error\", nil, \"\", http.StatusInternalServerError).Wrap(err)\n\t}\n\treturn &list, BuildResponse(r), nil\n}", "title": "" }, { "docid": "f41b5adae5f72527e3b55c6dfcfa1d61", "score": "0.5460746", "text": "func FetchEventPosts(eventID string, c appengine.Context) (*[]Post, error) {\n\tq := datastore.NewQuery(POST_KIND).\n\t\tFilter(\"EventID =\", eventID).\n\t\tLimit(20).\n\t\tOrder(\"-Created\")\n\n\tposts := make([]Post, 0, 20)\n\n\t_, err := q.GetAll(c, &posts)\n\tif err != nil {\n\t\tc.Errorf(\"Failed to get posts for event %v: %v\", eventID, err)\n\t\treturn nil, err\n\t}\n\n\treturn &posts, nil\n}", "title": "" }, { "docid": "bc1f9c9601e4a3d722661e8a6a7eb589", "score": "0.5460518", "text": "func GetPinnedPosts(u user.User) UserActionResponse {\n\tchannel, err := u.Store().CurrentChannel()\n\tif err != nil {\n\t\treturn UserActionResponse{Err: NewUserError(err)}\n\t}\n\n\tlist, err := u.GetPinnedPosts(channel.Id)\n\tif err != nil {\n\t\treturn UserActionResponse{Err: NewUserError(err)}\n\t}\n\n\treturn UserActionResponse{Info: fmt.Sprintf(\"found %d posts\", len(list.Posts))}\n}", "title": "" }, { "docid": "eb32a72306891c280975975a7a7c6972", "score": "0.5414593", "text": "func GetPost(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tparams := mux.Vars(r)\n\n\tif err != nil {\n\t\tw.WriteHeader(500)\n\t\treturn\n\t}\n\n\terr = db.Ping()\n\tif err != nil {\n\t\tw.WriteHeader(500)\n\t\treturn\n\t}\n\n\tvar (\n\t\tID string\n\t\tBody string\n\t\tTitle string\n\t\tYear string\n\t\tMonth string\n\t\tDay string\n\t)\n\n\tw.WriteHeader(200)\n\terr := db.QueryRow(\"SELECT * FROM posts WHERE ID =?\", params[\"id\"]).Scan(&ID, &Body, &Title, &Year, &Month, &Day)\n\tif err != nil {\n\t\tw.WriteHeader(500)\n\t\treturn\n\t}\n\n\tjson.NewEncoder(w).Encode(model.Blog{ID: ID, Title: Title, Body: Body, Year: Year, Month: Month, Day: Day})\n}", "title": "" }, { "docid": "8055c77d7464ddfd078df70327d68a5a", "score": "0.5414298", "text": "func (data *DataSource) PopularPosts(since time.Time, count int) ([]Post, error) {\n\tvar posts []Post\n\tdata.db.Raw(fmt.Sprintf(rankingQuery, since.Format(\"2006-01-02\")), count).Scan(&posts)\n\treturn posts, nil\n}", "title": "" }, { "docid": "df602de8b2649b7b93cb32a0fb569cb6", "score": "0.5412958", "text": "func GetPosts(\n\tusername string,\n\tsubReddits []SubReddit,\n\tpostControll map[string]PostControll,\n\tlimit int,\n\tsortType string,\n\ttoken string,\n) []Post {\n\n\t// analyze sort type\n\tif sortType != \"hot\" && sortType != \"new\" {\n\t\tfmt.Println(\"Invalid sort type. It must be \\\"hot\\\" or \\\"new\\\"\")\n\t\treturn []Post{}\n\t}\n\n\t// create function return value\n\tvar posts []Post\n\n\t// create client base url\n\tbaseURL := \"https://oauth.reddit.com/\"\n\n\t// request posts from all sub reddits\n\tfor _, subReddit := range subReddits {\n\n\t\t// set initial url with limit query param\n\t\turl := baseURL + subReddit.Display_name_prefixed + \"/\" + sortType\n\t\turl += \"?limit=\" + strconv.Itoa(limit) + \"&raw_json=1\"\n\n\t\t// sub reddit already queried before -> add progression to the url\n\t\tcount := 0\n\t\tif _, ok := postControll[subReddit.Id]; ok {\n\t\t\tafter := postControll[subReddit.Id].After\n\t\t\tcount = postControll[subReddit.Id].Count\n\t\t\turl = url + \"&after=\" + after + \"&count=\" + strconv.Itoa(count)\n\t\t}\n\n\t\t// request posts. Treat request errors\n\t\tresponse, err := request(\"GET\", url, nil, token, username)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error while requesting\", url, \":\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\t// load request response into json. Treat parse errors\n\t\tJSONResponse := PostsResponse{}\n\t\treadErr := json.Unmarshal(response, &JSONResponse)\n\t\tif readErr != nil {\n\t\t\tfmt.Println(\"Error while parsing request response:\", readErr)\n\t\t\tcontinue\n\t\t}\n\n\t\t// increment count and retrieve after on the post controll\n\t\tincreseCount := len(JSONResponse.Data.Children)\n\t\tpostControll[subReddit.Id] = PostControll{\n\t\t\tCount: count + increseCount,\n\t\t\tAfter: JSONResponse.Data.After,\n\t\t}\n\n\t\t// add each post to the response\n\t\tfor _, postChildren := range JSONResponse.Data.Children {\n\n\t\t\t// process post\n\t\t\tnewPost := processPost(postChildren.Data)\n\n\t\t\t// post is valid -> add it to return posts\n\t\t\tif newPost.Title != \"\" {\n\t\t\t\tposts = append(posts, newPost)\n\t\t\t}\n\t\t}\n\t}\n\n\t// return sub reddits' posts\n\treturn posts\n}", "title": "" }, { "docid": "02e25df349733d915a6f1496bbf5b4e5", "score": "0.539894", "text": "func GetDraftPostsV1(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Cache-Control\", \"max-age=30\")\n\tauthService := service.CreateDefaultAuthService()\n\tsession := authService.GetSessionFromRequest(r)\n\tif session == nil {\n\t\tw.WriteHeader(http.StatusForbidden)\n\t\treturn\n\t}\n\tposts := service.CreatePostService().GetDraftPosts(\n\t\tsession.User.Username,\n\t\tconstants.UserPostsDefaultPageSize,\n\t)\n\tdata, _ := json.Marshal(posts)\n\t_, _ = w.Write(data)\n}", "title": "" }, { "docid": "117c7fe737603364eb464d1aa9756309", "score": "0.53919643", "text": "func (g *Godel) GetMyMostDiscussedPosts() []SinglePostResponse {\n response := g.get(\"posts/mine/discussed\", nil)\n posts := LatestPostsResponse{}\n response.JSON(&posts)\n\n return posts.Posts\n}", "title": "" } ]
fa8b74db87461d301d23180f01e01a5f
SetEmail sets the "email" field.
[ { "docid": "2dfee60addc7a0784b8cdcd457d148b9", "score": "0.80338484", "text": "func (uc *UserCreate) SetEmail(s string) *UserCreate {\n\tuc.mutation.SetEmail(s)\n\treturn uc\n}", "title": "" } ]
[ { "docid": "e9c84ecdcd261f1dddc63776bb453b59", "score": "0.83957076", "text": "func (conn *Connection) SetEmail(email string) {\n\tconn.Email = email\n}", "title": "" }, { "docid": "e8fc0960a6698152d05374d6d7562c2f", "score": "0.8273776", "text": "func (u *User) SetEmail(email string) *shared.CustomError {\n\tif govalidator.IsEmail(email) {\n\t\tu.Emailx = email\n\t\treturn nil\n\t} else if email == \"\" {\n\t\treturn shared.NewCustomError(\"Email is required\", shared.ErrorTypeNilArgument)\n\t}\n\treturn shared.NewCustomError(\"Email is not valid\", shared.ErrorTypeInvalidArgument)\n}", "title": "" }, { "docid": "aac33500ed2a625d0cf2423a128c4c19", "score": "0.8251843", "text": "func (suo *StudentUpdateOne) SetEmail(s string) *StudentUpdateOne {\n\tsuo.mutation.SetEmail(s)\n\treturn suo\n}", "title": "" }, { "docid": "e90540fcdaed073a26023901eaa7a7ec", "score": "0.82272804", "text": "func (ac *AdminCreate) SetEmail(s string) *AdminCreate {\n\tac.mutation.SetEmail(s)\n\treturn ac\n}", "title": "" }, { "docid": "c20b20779c5eadb23db883e6cd6c3a90", "score": "0.82194614", "text": "func (su *StudentUpdate) SetEmail(s string) *StudentUpdate {\n\tsu.mutation.SetEmail(s)\n\treturn su\n}", "title": "" }, { "docid": "013cc74ff5698e6ad40e3faca31d51de", "score": "0.8217474", "text": "func (mrc *MedicalRecordCreate) SetEmail(s string) *MedicalRecordCreate {\n\tmrc.mutation.SetEmail(s)\n\treturn mrc\n}", "title": "" }, { "docid": "38cad266b073e064a1b6d081fbde67e5", "score": "0.82120216", "text": "func (m *ProvisionChannelEmailResult) SetEmail(value *string)() {\n m.email = value\n}", "title": "" }, { "docid": "2a6d5a24a879ad5b28adfa4bc5b1bc12", "score": "0.82083255", "text": "func (ac *AccountCreate) SetEmail(s string) *AccountCreate {\n\tac.mutation.SetEmail(s)\n\treturn ac\n}", "title": "" }, { "docid": "36750d3adc9fa74fd257cf36ee39a200", "score": "0.8206844", "text": "func (euo *EmployeeUpdateOne) SetEmail(s string) *EmployeeUpdateOne {\n\teuo.mutation.SetEmail(s)\n\treturn euo\n}", "title": "" }, { "docid": "436ced46768f299beb942c2a898f3268", "score": "0.8152313", "text": "func (m *RestaurantOwnerMutation) SetEmail(s string) {\n\tm.email = &s\n}", "title": "" }, { "docid": "bc724b142b3b0ad7f641b8b46b0788fd", "score": "0.814102", "text": "func (puo *PersonalUpdateOne) SetEmail(s string) *PersonalUpdateOne {\n\tpuo.mutation.SetEmail(s)\n\treturn puo\n}", "title": "" }, { "docid": "49a2e7c654aed6da589ee3177a6297e4", "score": "0.81306547", "text": "func (q *Query) SetEmail(email string) {\n\tif email != \"\" {\n\t\tq.email = email\n\t}\n}", "title": "" }, { "docid": "9d10636199ac248aad647f204fb2f5ef", "score": "0.8125427", "text": "func (in *ActionUserCreateInput) SetEmail(value string) *ActionUserCreateInput {\n\tin.Email = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"Email\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "8962e9855b8e07fdf8e7e68ee70730c6", "score": "0.8124453", "text": "func (m *UserOaInfoMutation) SetEmail(s string) {\n\tm.email = &s\n}", "title": "" }, { "docid": "64e5eafbad9c1ddea5f47562308430e9", "score": "0.8118602", "text": "func (uu *UserUpdate) SetEmail(s string) *UserUpdate {\n\tuu.mutation.SetEmail(s)\n\treturn uu\n}", "title": "" }, { "docid": "64e5eafbad9c1ddea5f47562308430e9", "score": "0.8118602", "text": "func (uu *UserUpdate) SetEmail(s string) *UserUpdate {\n\tuu.mutation.SetEmail(s)\n\treturn uu\n}", "title": "" }, { "docid": "64e5eafbad9c1ddea5f47562308430e9", "score": "0.8118602", "text": "func (uu *UserUpdate) SetEmail(s string) *UserUpdate {\n\tuu.mutation.SetEmail(s)\n\treturn uu\n}", "title": "" }, { "docid": "64e5eafbad9c1ddea5f47562308430e9", "score": "0.8118602", "text": "func (uu *UserUpdate) SetEmail(s string) *UserUpdate {\n\tuu.mutation.SetEmail(s)\n\treturn uu\n}", "title": "" }, { "docid": "64e5eafbad9c1ddea5f47562308430e9", "score": "0.8118602", "text": "func (uu *UserUpdate) SetEmail(s string) *UserUpdate {\n\tuu.mutation.SetEmail(s)\n\treturn uu\n}", "title": "" }, { "docid": "64e5eafbad9c1ddea5f47562308430e9", "score": "0.8118602", "text": "func (uu *UserUpdate) SetEmail(s string) *UserUpdate {\n\tuu.mutation.SetEmail(s)\n\treturn uu\n}", "title": "" }, { "docid": "87ba07e698711a4787f9cbe7f9368c0e", "score": "0.81160754", "text": "func (pu *PersonalUpdate) SetEmail(s string) *PersonalUpdate {\n\tpu.mutation.SetEmail(s)\n\treturn pu\n}", "title": "" }, { "docid": "7f34dde38c7c935263133f601625c1f9", "score": "0.8107096", "text": "func (eu *EmployeeUpdate) SetEmail(s string) *EmployeeUpdate {\n\teu.mutation.SetEmail(s)\n\treturn eu\n}", "title": "" }, { "docid": "89be4b433506da3554eb3b8210e6ebdf", "score": "0.8104983", "text": "func (m *EmployeeMutation) SetEmail(s string) {\n\tm._Email = &s\n}", "title": "" }, { "docid": "0c38d4f187e197a9680c6ae899fd889a", "score": "0.80963194", "text": "func (m *CustomerMutation) SetEmail(s string) {\n\tm.email = &s\n}", "title": "" }, { "docid": "f5317a4af89434a85dc6841b43d35491", "score": "0.80875516", "text": "func (pc *PersonalCreate) SetEmail(s string) *PersonalCreate {\n\tpc.mutation.SetEmail(s)\n\treturn pc\n}", "title": "" }, { "docid": "dd04a5db5f3d8ecf88370f4b86be4dfd", "score": "0.80860156", "text": "func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne {\n\tuuo.mutation.SetEmail(s)\n\treturn uuo\n}", "title": "" }, { "docid": "dd04a5db5f3d8ecf88370f4b86be4dfd", "score": "0.80860156", "text": "func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne {\n\tuuo.mutation.SetEmail(s)\n\treturn uuo\n}", "title": "" }, { "docid": "dd04a5db5f3d8ecf88370f4b86be4dfd", "score": "0.80860156", "text": "func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne {\n\tuuo.mutation.SetEmail(s)\n\treturn uuo\n}", "title": "" }, { "docid": "dd04a5db5f3d8ecf88370f4b86be4dfd", "score": "0.80860156", "text": "func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne {\n\tuuo.mutation.SetEmail(s)\n\treturn uuo\n}", "title": "" }, { "docid": "dd04a5db5f3d8ecf88370f4b86be4dfd", "score": "0.80860156", "text": "func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne {\n\tuuo.mutation.SetEmail(s)\n\treturn uuo\n}", "title": "" }, { "docid": "dd04a5db5f3d8ecf88370f4b86be4dfd", "score": "0.80860156", "text": "func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne {\n\tuuo.mutation.SetEmail(s)\n\treturn uuo\n}", "title": "" }, { "docid": "f6fbdd034922ff60566dcc1b41f1dbb7", "score": "0.8075578", "text": "func (m *PersonalMutation) SetEmail(s string) {\n\tm._Email = &s\n}", "title": "" }, { "docid": "3fc58654dedd0e037d492b2c9640eb68", "score": "0.80652046", "text": "func (dc *DoctorCreate) SetEmail(s string) *DoctorCreate {\n\tdc.mutation.SetEmail(s)\n\treturn dc\n}", "title": "" }, { "docid": "7afabdedb7488c91f8fea6523bf7f37b", "score": "0.8035303", "text": "func (m *UserMutation) SetEmail(s string) {\n\tm.email = &s\n}", "title": "" }, { "docid": "7afabdedb7488c91f8fea6523bf7f37b", "score": "0.8035303", "text": "func (m *UserMutation) SetEmail(s string) {\n\tm.email = &s\n}", "title": "" }, { "docid": "7afabdedb7488c91f8fea6523bf7f37b", "score": "0.8035303", "text": "func (m *UserMutation) SetEmail(s string) {\n\tm.email = &s\n}", "title": "" }, { "docid": "2f8f2ffb020ddcab868586761326aa79", "score": "0.80303526", "text": "func (pc *ProfileCreate) SetEmail(s string) *ProfileCreate {\n\tpc.mutation.SetEmail(s)\n\treturn pc\n}", "title": "" }, { "docid": "2b9fc0fa8b92e5bdaef7c1873ed6beeb", "score": "0.7995248", "text": "func (o *AccountCreationRequest) SetEmail(v string) {\n\to.Email = &v\n}", "title": "" }, { "docid": "014a6f23b6572321593112e263c14d1f", "score": "0.7966364", "text": "func (o *SubmitSelfServiceRecoveryFlowBody) SetEmail(v string) {\n\to.Email = v\n}", "title": "" }, { "docid": "a3fde8a6f9927f734147eb5d6b7adee6", "score": "0.7936036", "text": "func (email *Email) SetEmail(n string) {\n\temail.Email = n\n}", "title": "" }, { "docid": "6c4f1c672b6a3399dec90139a76783e8", "score": "0.7869425", "text": "func (o *TokenObtainPairWithUser) SetEmail(v string) {\n\to.Email = &v\n}", "title": "" }, { "docid": "9d1e41f0d8a25f15202a06af144702ad", "score": "0.7868393", "text": "func (o *IdentityCreateUserRequest) SetEmail(v string) {\n\to.Email = &v\n}", "title": "" }, { "docid": "f0d3f5f9db634b9c2be37a75213298dc", "score": "0.78622544", "text": "func (o *OrganisationBilling1) SetEmail(v string) {\n\to.Email = &v\n}", "title": "" }, { "docid": "deeb889e1eac9df95f0dc38f4e1cb9a9", "score": "0.786008", "text": "func (o *UpdateCustomer) SetEmail(v string) {\n\to.Email = &v\n}", "title": "" }, { "docid": "06264f15a991c990d08cbade57a05640", "score": "0.7859834", "text": "func (o *BankConnectionOwner) SetEmail(v string) {\n\to.Email.Set(&v)\n}", "title": "" }, { "docid": "5f514dff9bf9ee561956afd476f3855c", "score": "0.78588986", "text": "func (s *Session) SetEmail(old, cur string) error {\n\tif s.Role().Level() >= schema.AdminLevel {\n\t\treturn s.store.SetEmail(old, cur)\n\t}\n\treturn ErrPermission\n}", "title": "" }, { "docid": "e43f8be5d2910f253b7bfa68cd63d27a", "score": "0.7841754", "text": "func (o *AddMemberToAccountParams) SetEmail(email string) {\n\to.Email = email\n}", "title": "" }, { "docid": "65755699f11cac09ee8edeb73e55b6e4", "score": "0.78152734", "text": "func (c *Creator) SetEmail(v string) {\n\tc.Email = &v\n}", "title": "" }, { "docid": "a4ccf1b95f9da97de6c1c321cfe04dfc", "score": "0.78063786", "text": "func (o *UpdateRecoveryFlowWithCodeMethod) SetEmail(v string) {\n\to.Email = &v\n}", "title": "" }, { "docid": "814d0d75f09a569ac906b3488a1c4fd1", "score": "0.779897", "text": "func (o *PartnerEndCustomerTechnicalContact) SetEmail(v string) {\n\to.Email = &v\n}", "title": "" }, { "docid": "97fd4f9a96ac445ce341c5c025008637", "score": "0.77870226", "text": "func (o *GetSubscribersParams) SetEmail(email *string) {\n\to.Email = email\n}", "title": "" }, { "docid": "ef5669ef6527166670f4797493dd5492", "score": "0.77507263", "text": "func (o *SubmitSelfServiceRecoveryFlowWithLinkMethodBody) SetEmail(v string) {\n\to.Email = v\n}", "title": "" }, { "docid": "4005a082e681bb252d44d6fed2e9b4eb", "score": "0.7750336", "text": "func (o *OidcUserInfo) SetEmail(v string) {\n\to.Email = &v\n}", "title": "" }, { "docid": "4b9c6a2f95b6b32de51300a7829e5f35", "score": "0.7749899", "text": "func (o *AaaAuditRecord) SetEmail(v string) {\n\to.Email = &v\n}", "title": "" }, { "docid": "08ba2193d8bf14e7878abf2ca7c44ab3", "score": "0.77494955", "text": "func (o *ListWorkspaceUsersWithMemberData) SetEmail(v string) {\n\to.Email = v\n}", "title": "" }, { "docid": "d7b6a53dc00d358393218cac36716e3f", "score": "0.7744669", "text": "func (u *UserUpsertOne) SetEmail(v string) *UserUpsertOne {\n\treturn u.Update(func(s *UserUpsert) {\n\t\ts.SetEmail(v)\n\t})\n}", "title": "" }, { "docid": "7f3ffe013c6a01a2b5a071bf03cb4668", "score": "0.774152", "text": "func (o *Customer) SetEmail(v string) {\n\to.Email = v\n}", "title": "" }, { "docid": "08b5f7792370ff45100a6d157da5865d", "score": "0.7699114", "text": "func (c *Contact) SetEmail(email string) error {\n\tc.email = email\n\treturn nil\n}", "title": "" }, { "docid": "309bc6b8ff193bf0cccc01dc5b0e0fc6", "score": "0.7686954", "text": "func (o *IamUserAllOf) SetEmail(v string) {\n\to.Email = &v\n}", "title": "" }, { "docid": "70970bc9a86bc8fb5d25b91a2c465192", "score": "0.76623684", "text": "func (o *MicrosoftGraphDriveRecipient) SetEmail(v string) {\n\to.Email = &v\n}", "title": "" }, { "docid": "dbaf1347e94f6a6bf529e3f190ae531a", "score": "0.7648504", "text": "func (u *UserUpsert) SetEmail(v string) *UserUpsert {\n\tu.Set(user.FieldEmail, v)\n\treturn u\n}", "title": "" }, { "docid": "637194bbbb0dfa4e05f512ad2fcf526e", "score": "0.7638654", "text": "func (o *ContactInformation) SetEmail(v string) {\n\to.Email = &v\n}", "title": "" }, { "docid": "922e1a5d62941b373dff716af4fffc75", "score": "0.76261723", "text": "func (s *UpdateUserInput) SetEmail(v string) *UpdateUserInput {\n\ts.Email = &v\n\treturn s\n}", "title": "" }, { "docid": "9802515b69839b7bc67ca6767d8d65fd", "score": "0.76091725", "text": "func (m *AttackSimulationUser) SetEmail(value *string)() {\n err := m.GetBackingStore().Set(\"email\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "aa62a521f052eb3dcbe7d6c3a83bf9b8", "score": "0.7606528", "text": "func (m *DriveRecipient) SetEmail(value *string)() {\n err := m.GetBackingStore().Set(\"email\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "1e3235f197d7a9c7a845dc0bd4e5e120", "score": "0.75734156", "text": "func (m *SslCertificateEntity) SetEmail(value *string)() {\n err := m.GetBackingStore().Set(\"email\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "63b995f7b942c53211b0f9e6d87dad20", "score": "0.75645775", "text": "func (o *GetProductListsParams) SetEmail(email *string) {\n\to.Email = email\n}", "title": "" }, { "docid": "c1732f06cabbb51da132f01f6c83b7f5", "score": "0.7540209", "text": "func (s *PickupDetails) SetEmail(v string) *PickupDetails {\n\ts.Email = &v\n\treturn s\n}", "title": "" }, { "docid": "014fdc843fcf2fc4bd1192343161d03e", "score": "0.75255686", "text": "func (o *UsersUsersListParams) SetEmail(email *string) {\n\to.Email = email\n}", "title": "" }, { "docid": "4e152de70fa2b587d0edd190c709018f", "score": "0.7468219", "text": "func (u *User) SetEmail(v string) {\n\tu.Email = &v\n}", "title": "" }, { "docid": "0b2a5b3311f5408c49283f532a0d122e", "score": "0.74589896", "text": "func (o *User) SetEmail(v string) {\n\to.Email = v\n}", "title": "" }, { "docid": "0b2a5b3311f5408c49283f532a0d122e", "score": "0.74589896", "text": "func (o *User) SetEmail(v string) {\n\to.Email = v\n}", "title": "" }, { "docid": "09779926c02425ebf7e0e18b00c47985", "score": "0.74571466", "text": "func (u *user) SetEmail(email string) { u.userData.Email = email }", "title": "" }, { "docid": "17550b227af8a34369419e688c861a5a", "score": "0.74556834", "text": "func (m *ClaimsMapping) SetEmail(value *string)() {\n err := m.GetBackingStore().Set(\"email\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "52d24763ccf218b99b4ee63a8337ccb7", "score": "0.74486667", "text": "func (u *UserUpsertBulk) SetEmail(v string) *UserUpsertBulk {\n\treturn u.Update(func(s *UserUpsert) {\n\t\ts.SetEmail(v)\n\t})\n}", "title": "" }, { "docid": "590d828747664659f39625016f399563", "score": "0.7370314", "text": "func (s *RegisterUserInput) SetEmail(v string) *RegisterUserInput {\n\ts.Email = &v\n\treturn s\n}", "title": "" }, { "docid": "5811cd52d003a1961a0e001d956a6cca", "score": "0.73406965", "text": "func (puo *PhysicianUpdateOne) SetEMAIL(s string) *PhysicianUpdateOne {\n\tpuo.mutation.SetEMAIL(s)\n\treturn puo\n}", "title": "" }, { "docid": "f07907a045fee87a8ba5f9b3b540291c", "score": "0.7325047", "text": "func (pu *PhysicianUpdate) SetEMAIL(s string) *PhysicianUpdate {\n\tpu.mutation.SetEMAIL(s)\n\treturn pu\n}", "title": "" }, { "docid": "0fb99a6dac5e1b7a09fa966adfb77707", "score": "0.7266248", "text": "func (s *User) SetEmail(v string) *User {\n\ts.Email = &v\n\treturn s\n}", "title": "" }, { "docid": "ba70eb97ae4f26abb8911b50c9a1532a", "score": "0.7256322", "text": "func (m *RelatedContact) SetEmailAddress(value *string)() {\n m.emailAddress = value\n}", "title": "" }, { "docid": "ace60c19b6e1733ab10b40a0c7890fb0", "score": "0.7088324", "text": "func (c *Client) setUserEmail(token string) {\n\tc.userEmail = token\n}", "title": "" }, { "docid": "f8642c9a74bb0eafb3e5d1b5138b9325", "score": "0.69382143", "text": "func SetEmail(password, emailPassword, emailLogin, smtpServer string) (err error) {\n\tisCheckPassword := IsCheckPassword(password)\n\tif !isCheckPassword {\n\t\terr = errors.New(\"SesionControl: Error, password does not match\")\n\t\treturn\n\t}\n\n\tif emailPassword == \"\" || emailLogin == \"\" {\n\t\terr = errors.New(\"SesionControl: emailPassword or emailLogin empty\")\n\t\treturn\n\t}\n\n\tnewPasswordHash, err := bcrypt.GenerateFromPassword([]byte(emailPassword), bcrypt.DefaultCost)\n\tif err != nil {\n\t\terr = errors.New(\"SesionControl: Error bcrypt.GenerateFromPassword() msg error: \" + err.Error())\n\t\treturn\n\t}\n\n\tsmtp := gomail.SMTP[smtpServer]\n\tif smtp == nil {\n\t\terr = errors.New(\"SesionControl: smtp server not found\")\n\t\treturn\n\t}\n\n\tif !strings.HasSuffix(emailLogin, smtpServer) && strings.Index(emailLogin, \"@\") != -1 {\n\t\terr = errors.New(\"SesionControl: ! emaillogin@\" + smtpServer + \" .Wrong: \" + emailLogin)\n\t\treturn\n\t}\n\n\tif !strings.HasSuffix(emailLogin, smtpServer) {\n\t\temailLogin += \"@\" + smtpServer\n\t}\n\n\temailPasswordHash := string(newPasswordHash)\n\treturn models.SetEmail(emailPasswordHash, emailLogin, smtpServer)\n}", "title": "" }, { "docid": "ae03667da73289b71e0b686fe1937d1f", "score": "0.6893444", "text": "func (m *ManagedTenantTicketingEndpoint) SetEmailAddress(value *string)() {\n err := m.GetBackingStore().Set(\"emailAddress\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "5de237cc37dcbba867bf37a9d0b83ae0", "score": "0.68197054", "text": "func (m *CalendarPermission) SetEmailAddress(value EmailAddressable)() {\n err := m.GetBackingStore().Set(\"emailAddress\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "da8ced6ed6f6ff6d50089d361fe9ab0a", "score": "0.6735963", "text": "func (o *EntityWatchlistSearchTerms) SetEmailAddress(v string) {\n\to.EmailAddress.Set(&v)\n}", "title": "" }, { "docid": "bb5edcc9fc4e661e6d775273ea90411a", "score": "0.6710241", "text": "func (av *AccountValidator) UpdateEmail(a *Account, email string) error {\n\tif err := av.validateEmail(email); err != nil {\n\t\treturn err\n\t}\n\ta.Email = email\n\treturn nil\n}", "title": "" }, { "docid": "5310177d6baf800ef3f538f27fd70b45", "score": "0.66985804", "text": "func (m *DoctorMutation) SetDoctorEmail(s string) {\n\tm._Doctor_Email = &s\n}", "title": "" }, { "docid": "371da2b642ecf914ec533c65a9eefc47", "score": "0.66789424", "text": "func (auo *AccountUpdateOne) SetEmailAddress(s string) *AccountUpdateOne {\n\tauo.mutation.SetEmailAddress(s)\n\treturn auo\n}", "title": "" }, { "docid": "53722c79aafbf493a1ab57aeb073a92f", "score": "0.6624167", "text": "func (au *AccountUpdate) SetEmailAddress(s string) *AccountUpdate {\n\tau.mutation.SetEmailAddress(s)\n\treturn au\n}", "title": "" }, { "docid": "0f1d5c2eee1f8b0e03707b9e108d7c1f", "score": "0.66221917", "text": "func (m *BookingPerson) SetEmailAddress(value *string)() {\n err := m.GetBackingStore().Set(\"emailAddress\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "1faf047d1aa68aa8193b27e5cf6505de", "score": "0.6528456", "text": "func (m *NotifyUserAction) SetEmailText(value *string)() {\n err := m.GetBackingStore().Set(\"emailText\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "7722d358db187b11af3445fc3b74d1e1", "score": "0.6500819", "text": "func (m *PhysicianMutation) SetPhysicianEmail(s string) {\n\tm._PhysicianEmail = &s\n}", "title": "" }, { "docid": "6a4e746ff5049424dff8c7c75127d700", "score": "0.64974546", "text": "func (ac *AccountCreate) SetEmailChange(s string) *AccountCreate {\n\tac.mutation.SetEmailChange(s)\n\treturn ac\n}", "title": "" }, { "docid": "2e727a3cd9bc1fd868a302736ac78353", "score": "0.648626", "text": "func (s *Service) setEmailAddress(userID string, channelID string, emailAddress string) (*SetEmailResponse, error) {\n\tchannel, err := s.persister.GetChannel(channelID)\n\tif err != nil {\n\t\treturn &SetEmailResponse{}, err\n\t}\n\tif channel.EmailAddress != emailAddress {\n\t\treturn &SetEmailResponse{}, ErrorUnauthorized\n\t}\n\tisAdmin, err := s.IsChannelAdmin(userID, channelID)\n\tif err != nil {\n\t\treturn &SetEmailResponse{}, err\n\t}\n\tif !isAdmin {\n\t\treturn &SetEmailResponse{}, ErrorUnauthorized\n\t}\n\t_, err = s.persister.SetIsAwaitingEmailConfirmation(channelID, false)\n\tif err != nil {\n\t\treturn &SetEmailResponse{}, err\n\t}\n\treturn &SetEmailResponse{UserID: userID, ChannelID: channelID}, nil\n}", "title": "" }, { "docid": "38a20df1b6f1e4c58f2d5d323a9dc2af", "score": "0.64768773", "text": "func (v *Validator) Email(key, email string) string {\n\tif _, err := mail.ParseAddress(email); err != nil {\n\t\tv.AddError(key, \"must be a valid email address\")\n\t\treturn \"\"\n\t}\n\n\treturn email\n}", "title": "" }, { "docid": "dac253ee7f80f0d3ec3837ae1d3ad759", "score": "0.6459766", "text": "func (m *MessageTrace) SetSenderEmail(value *string)() {\n err := m.GetBackingStore().Set(\"senderEmail\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "1b75671f865345d9a07cc8177f73a905", "score": "0.6438949", "text": "func (arc *AuthRequestCreate) SetClaimsEmail(s string) *AuthRequestCreate {\n\tarc.mutation.SetClaimsEmail(s)\n\treturn arc\n}", "title": "" }, { "docid": "d3c6674e82fe857d73a5147168d31067", "score": "0.6407328", "text": "func (u *UserUpsert) UpdateEmail() *UserUpsert {\n\tu.SetExcluded(user.FieldEmail)\n\treturn u\n}", "title": "" }, { "docid": "f90e2d07e63febdeff8597741109cdf8", "score": "0.6399038", "text": "func (acuo *AuthCodeUpdateOne) SetClaimsEmail(s string) *AuthCodeUpdateOne {\n\tacuo.mutation.SetClaimsEmail(s)\n\treturn acuo\n}", "title": "" } ]
8b675a18a347632c2c1837fb2f89b7ab
ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.
[ { "docid": "3697247bfdf2aac59bcffc0296db8cf1", "score": "0.8068045", "text": "func (m *CasbinRuleMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown CasbinRule unique edge %s\", name)\n}", "title": "" } ]
[ { "docid": "f3b1b33cd617ba031ecd8ee64eb5a622", "score": "0.8103773", "text": "func (m *SchemeTypeMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown SchemeType unique edge %s\", name)\n}", "title": "" }, { "docid": "431786b778e50831d5a8d1e3e964a3c4", "score": "0.80750096", "text": "func (m *XxxDemoMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown XxxDemo unique edge %s\", name)\n}", "title": "" }, { "docid": "a1fb85959f161e2858da7f0eff2fa5db", "score": "0.8050334", "text": "func (m *FundMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Fund unique edge %s\", name)\n}", "title": "" }, { "docid": "0abd0d9bd202c93693f6da5d3c2e9de1", "score": "0.8012159", "text": "func (m *ResourceMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase resource.EdgeOwner:\n\t\tm.ClearOwner()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Resource unique edge %s\", name)\n}", "title": "" }, { "docid": "a0b1a8875c7bcfd304fe76728048a573", "score": "0.8011109", "text": "func (m *EventMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Event unique edge %s\", name)\n}", "title": "" }, { "docid": "e8ddd537ba856a6bb04b9408928f081f", "score": "0.7971478", "text": "func (m *GlobalsettingsMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown Globalsettings unique edge %s\", name)\n}", "title": "" }, { "docid": "8a5df22a52c04a079b47129f8b40da5d", "score": "0.7951612", "text": "func (m *MainingreMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Mainingre unique edge %s\", name)\n}", "title": "" }, { "docid": "6bb07a6a4200a62999b70db3569e5f2f", "score": "0.79498273", "text": "func (m *DiagnoseMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase diagnose.EdgeDisease:\n\t\tm.ClearDisease()\n\t\treturn nil\n\tcase diagnose.EdgeDepartment:\n\t\tm.ClearDepartment()\n\t\treturn nil\n\tcase diagnose.EdgePatient:\n\t\tm.ClearPatient()\n\t\treturn nil\n\tcase diagnose.EdgeDoctor:\n\t\tm.ClearDoctor()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Diagnose unique edge %s\", name)\n}", "title": "" }, { "docid": "ddae2d9722e35abadea56d3402defc1f", "score": "0.79488134", "text": "func (m *DoctorMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Doctor unique edge %s\", name)\n}", "title": "" }, { "docid": "16237b4f91e16b1ec16dd88785bcb655", "score": "0.79477483", "text": "func (m *MedicalMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown Medical unique edge %s\", name)\n}", "title": "" }, { "docid": "b71b5685f8ce7b2fe82e3bb8f4c06553", "score": "0.7942407", "text": "func (m *DispenseMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase dispense.EdgeDrug:\n\t\tm.ClearDrug()\n\t\treturn nil\n\tcase dispense.EdgePatient:\n\t\tm.ClearPatient()\n\t\treturn nil\n\tcase dispense.EdgeUser:\n\t\tm.ClearUser()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Dispense unique edge %s\", name)\n}", "title": "" }, { "docid": "07248be2e42986ad0daedd3629176402", "score": "0.79421705", "text": "func (m *MedicalfileMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase medicalfile.EdgeDentist:\n\t\tm.ClearDentist()\n\t\treturn nil\n\tcase medicalfile.EdgePatient:\n\t\tm.ClearPatient()\n\t\treturn nil\n\tcase medicalfile.EdgeEmployee:\n\t\tm.ClearEmployee()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Medicalfile unique edge %s\", name)\n}", "title": "" }, { "docid": "9e68224e535057b7a3d69ec9aebad1dc", "score": "0.7929736", "text": "func (m *RecruitmentMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown Recruitment unique edge %s\", name)\n}", "title": "" }, { "docid": "6ba71f5e5a667cc17ab2d99d74bd8605", "score": "0.79217577", "text": "func (m *RecordfoodMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase recordfood.EdgeRECORDUSER:\n\t\tm.ClearRECORDUSER()\n\t\treturn nil\n\tcase recordfood.EdgeRECORDFOODMENU:\n\t\tm.ClearRECORDFOODMENU()\n\t\treturn nil\n\tcase recordfood.EdgeRECORDINGREDIENT:\n\t\tm.ClearRECORDINGREDIENT()\n\t\treturn nil\n\tcase recordfood.EdgeRECORDSOURCE:\n\t\tm.ClearRECORDSOURCE()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Recordfood unique edge %s\", name)\n}", "title": "" }, { "docid": "1daab0e3aa78df71b5b8df0ad529c0c9", "score": "0.7916294", "text": "func (m *EmployeeMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Employee unique edge %s\", name)\n}", "title": "" }, { "docid": "23c866b7617092aa0377723c49d86132", "score": "0.7908275", "text": "func (m *NurseMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Nurse unique edge %s\", name)\n}", "title": "" }, { "docid": "9badee5358d7cfe54e75a3efee6faf79", "score": "0.7902081", "text": "func (m *DiseaseMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Disease unique edge %s\", name)\n}", "title": "" }, { "docid": "36ce2a0bf68d3970d97205e09b9d9311", "score": "0.7888513", "text": "func (m *SourceMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Source unique edge %s\", name)\n}", "title": "" }, { "docid": "0073cd0f48cde4cbbe1ec57f412df263", "score": "0.78839594", "text": "func (m *CertificateMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Certificate unique edge %s\", name)\n}", "title": "" }, { "docid": "eb1754778bfca8969490959048093722", "score": "0.7866198", "text": "func (m *RentMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase rent.EdgeRoom:\n\t\tm.ClearRoom()\n\t\treturn nil\n\tcase rent.EdgePatient:\n\t\tm.ClearPatient()\n\t\treturn nil\n\tcase rent.EdgeNurse:\n\t\tm.ClearNurse()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Rent unique edge %s\", name)\n}", "title": "" }, { "docid": "8fef5fbdc725775916c544dbfbc3554c", "score": "0.7864694", "text": "func (m *TitleMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Title unique edge %s\", name)\n}", "title": "" }, { "docid": "5e54b16e6ce31d5c9d57db20e0e58ace", "score": "0.78601366", "text": "func (m *SourceMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase source.EdgeParent:\n\t\tm.ClearParent()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Source unique edge %s\", name)\n}", "title": "" }, { "docid": "f3396e08bae4be421f68e9a30168af2c", "score": "0.78581685", "text": "func (m *TestMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown Test unique edge %s\", name)\n}", "title": "" }, { "docid": "1663517274cdb4dadce774e1501da01c", "score": "0.785478", "text": "func (m *FoodMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase food.EdgeOwner:\n\t\tm.ClearOwner()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Food unique edge %s\", name)\n}", "title": "" }, { "docid": "87431b4d5c6bb2028ede220b5548c6b9", "score": "0.78511804", "text": "func (m *PersonalMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Personal unique edge %s\", name)\n}", "title": "" }, { "docid": "6782dbf57315ac07c0b9785b7241ba80", "score": "0.7834713", "text": "func (m *BanTypeMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown BanType unique edge %s\", name)\n}", "title": "" }, { "docid": "17c1363380de09ee4015b25641bcf33a", "score": "0.7829854", "text": "func (m *MessageMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown Message unique edge %s\", name)\n}", "title": "" }, { "docid": "03debb310aec10ec7b563b27792d4567", "score": "0.7826802", "text": "func (m *SysRoleMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown SysRole unique edge %s\", name)\n}", "title": "" }, { "docid": "cd17ac3fedd1ad53b68dba02fcde1886", "score": "0.78234535", "text": "func (m *OtherTestMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown OtherTest unique edge %s\", name)\n}", "title": "" }, { "docid": "5357626881dc2d7a6ab7fe5ad0e0c62f", "score": "0.78204143", "text": "func (m *DepartmentMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Department unique edge %s\", name)\n}", "title": "" }, { "docid": "4b80d5be189bab0b5bdcc1bc87366b4e", "score": "0.7819897", "text": "func (m *FOODMENUMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown FOODMENU unique edge %s\", name)\n}", "title": "" }, { "docid": "4d5383d972bb4c9ed781ac8347c0d674", "score": "0.7811006", "text": "func (m *PatientMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Patient unique edge %s\", name)\n}", "title": "" }, { "docid": "4d5383d972bb4c9ed781ac8347c0d674", "score": "0.7811006", "text": "func (m *PatientMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Patient unique edge %s\", name)\n}", "title": "" }, { "docid": "46ae3b8127ead1a063ceddbe11c3a014", "score": "0.78055334", "text": "func (m *DrugMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Drug unique edge %s\", name)\n}", "title": "" }, { "docid": "55a26ce818fa16d6ffdaa15a05f32fbb", "score": "0.78027797", "text": "func (m *SysMenuActionResourceMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown SysMenuActionResource unique edge %s\", name)\n}", "title": "" }, { "docid": "e47c4b2077771b1dd67e3ac1d39a7247", "score": "0.7798006", "text": "func (m *UserMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase user.EdgeSettings:\n\t\tm.ClearSettings()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown User unique edge %s\", name)\n}", "title": "" }, { "docid": "67118e996e0c20d37e45338759ce7ba7", "score": "0.7796307", "text": "func (m *CompanyMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown Company unique edge %s\", name)\n}", "title": "" }, { "docid": "8ce53e0b28f526b1ca7f4f2c9bd5a46f", "score": "0.7792069", "text": "func (m *BloodtypeMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Bloodtype unique edge %s\", name)\n}", "title": "" }, { "docid": "e108bc9ae0162d1b9390cecd18e3ac89", "score": "0.77869534", "text": "func (m *MealMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Meal unique edge %s\", name)\n}", "title": "" }, { "docid": "ca7a265fb756c7cf13d731aa2a5cd0fd", "score": "0.7783121", "text": "func (m *MessageMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase message.EdgeUser:\n\t\tm.ClearUser()\n\t\treturn nil\n\tcase message.EdgeRoom:\n\t\tm.ClearRoom()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Message unique edge %s\", name)\n}", "title": "" }, { "docid": "f7759d06349bc5edf73a6e6c93c4904c", "score": "0.7777568", "text": "func (m *UserMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown User unique edge %s\", name)\n}", "title": "" }, { "docid": "f7759d06349bc5edf73a6e6c93c4904c", "score": "0.7777568", "text": "func (m *UserMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown User unique edge %s\", name)\n}", "title": "" }, { "docid": "f7759d06349bc5edf73a6e6c93c4904c", "score": "0.7777568", "text": "func (m *UserMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown User unique edge %s\", name)\n}", "title": "" }, { "docid": "f7759d06349bc5edf73a6e6c93c4904c", "score": "0.7777568", "text": "func (m *UserMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown User unique edge %s\", name)\n}", "title": "" }, { "docid": "f7759d06349bc5edf73a6e6c93c4904c", "score": "0.7777568", "text": "func (m *UserMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown User unique edge %s\", name)\n}", "title": "" }, { "docid": "f7759d06349bc5edf73a6e6c93c4904c", "score": "0.7777568", "text": "func (m *UserMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown User unique edge %s\", name)\n}", "title": "" }, { "docid": "f7759d06349bc5edf73a6e6c93c4904c", "score": "0.7777568", "text": "func (m *UserMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown User unique edge %s\", name)\n}", "title": "" }, { "docid": "1fb13c7faa50d07f627f1944dc53634d", "score": "0.7776103", "text": "func (m *SysJwtBlockMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown SysJwtBlock unique edge %s\", name)\n}", "title": "" }, { "docid": "87b47f4bb61e0cb269ea66db9c0a68f2", "score": "0.7773208", "text": "func (m *SysDictMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown SysDict unique edge %s\", name)\n}", "title": "" }, { "docid": "76fab814653ed7b429a89681697793b5", "score": "0.77705824", "text": "func (m *CardMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase card.EdgeOwner:\n\t\tm.ClearOwner()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Card unique edge %s\", name)\n}", "title": "" }, { "docid": "378ad53a16052d88197d7b6d21afcd02", "score": "0.77699625", "text": "func (m *ServerMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Server unique edge %s\", name)\n}", "title": "" }, { "docid": "6843ff48d220864a6edea334d780e4d8", "score": "0.7768096", "text": "func (m *UserSettingsMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase usersettings.EdgeUser:\n\t\tm.ClearUser()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown UserSettings unique edge %s\", name)\n}", "title": "" }, { "docid": "f6d5751a70254e722e63710c12414a9c", "score": "0.7757405", "text": "func (m *RoomtypeMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Roomtype unique edge %s\", name)\n}", "title": "" }, { "docid": "66a1e2a16c5018163a17d34b9318302d", "score": "0.7757194", "text": "func (m *SysLoggingMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown SysLogging unique edge %s\", name)\n}", "title": "" }, { "docid": "46a84118c7d3c146b881f1780a37768f", "score": "0.77560323", "text": "func (m *SysUserMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown SysUser unique edge %s\", name)\n}", "title": "" }, { "docid": "af646e9dc8c166f27f9afaaa98bf0941", "score": "0.77484405", "text": "func (m *FilmMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Film unique edge %s\", name)\n}", "title": "" }, { "docid": "d32b4819220797ff7554e164beacd3de", "score": "0.7740428", "text": "func (m *DentistMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Dentist unique edge %s\", name)\n}", "title": "" }, { "docid": "606b1d903953ce5f7a2cc0244ce4fc44", "score": "0.7739542", "text": "func (m *SysMenuActionMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown SysMenuAction unique edge %s\", name)\n}", "title": "" }, { "docid": "c95974a33b0c16aaa0d03f3d4fb7ea5f", "score": "0.77158564", "text": "func (m *PrefixMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Prefix unique edge %s\", name)\n}", "title": "" }, { "docid": "f581ab863bd4bf88cb58bdcf02b72549", "score": "0.77112496", "text": "func (m *ProjectMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown Project unique edge %s\", name)\n}", "title": "" }, { "docid": "528347a158d4e734b10d6deb8dbd821c", "score": "0.77091813", "text": "func (m *MealplanMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase mealplan.EdgeOwner:\n\t\tm.ClearOwner()\n\t\treturn nil\n\tcase mealplan.EdgeFoods:\n\t\tm.ClearFoods()\n\t\treturn nil\n\tcase mealplan.EdgeMeals:\n\t\tm.ClearMeals()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Mealplan unique edge %s\", name)\n}", "title": "" }, { "docid": "92147b4e92e02a84cf9be4901770aa0a", "score": "0.7708579", "text": "func (m *SysDictItemMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown SysDictItem unique edge %s\", name)\n}", "title": "" }, { "docid": "e43b197ba3950e700c25b605867c902d", "score": "0.77081645", "text": "func (m *DeveloperMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown Developer unique edge %s\", name)\n}", "title": "" }, { "docid": "c8a360cc93b3bb96a6fd88e376e5c59b", "score": "0.76963806", "text": "func (m *SysMenuMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown SysMenu unique edge %s\", name)\n}", "title": "" }, { "docid": "0d01d3d05ec569016608cee57005ab70", "score": "0.7691643", "text": "func (m *RoomMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Room unique edge %s\", name)\n}", "title": "" }, { "docid": "ef4fdeb967f7053f139b53e48e809971", "score": "0.7684755", "text": "func (m *AuthorMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Author unique edge %s\", name)\n}", "title": "" }, { "docid": "e517b28d92f4bc32b72023f9fd85dec6", "score": "0.7671563", "text": "func (m *GroupMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Group unique edge %s\", name)\n}", "title": "" }, { "docid": "14cd81a6530c35404af1112bcfa686c6", "score": "0.7667114", "text": "func (m *APIResponseMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown APIResponse unique edge %s\", name)\n}", "title": "" }, { "docid": "67ae69dd8901708a6dce23c4f8881e43", "score": "0.7665883", "text": "func (m *GenderMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Gender unique edge %s\", name)\n}", "title": "" }, { "docid": "67ae69dd8901708a6dce23c4f8881e43", "score": "0.7665883", "text": "func (m *GenderMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Gender unique edge %s\", name)\n}", "title": "" }, { "docid": "b11d99ab711670305ebb27fa8131cb92", "score": "0.76596737", "text": "func (m *UserMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown User unique edge %s\", name)\n}", "title": "" }, { "docid": "b11d99ab711670305ebb27fa8131cb92", "score": "0.76596737", "text": "func (m *UserMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown User unique edge %s\", name)\n}", "title": "" }, { "docid": "b11d99ab711670305ebb27fa8131cb92", "score": "0.76596737", "text": "func (m *UserMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown User unique edge %s\", name)\n}", "title": "" }, { "docid": "b11d99ab711670305ebb27fa8131cb92", "score": "0.76596737", "text": "func (m *UserMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown User unique edge %s\", name)\n}", "title": "" }, { "docid": "b11d99ab711670305ebb27fa8131cb92", "score": "0.76596737", "text": "func (m *UserMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown User unique edge %s\", name)\n}", "title": "" }, { "docid": "b11d99ab711670305ebb27fa8131cb92", "score": "0.76596737", "text": "func (m *UserMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown User unique edge %s\", name)\n}", "title": "" }, { "docid": "b11d99ab711670305ebb27fa8131cb92", "score": "0.76596737", "text": "func (m *UserMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown User unique edge %s\", name)\n}", "title": "" }, { "docid": "cb4b98b3d36c3beada7452d79db2eb23", "score": "0.76587874", "text": "func (m *PatientMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase patient.EdgeFrompatient:\n\t\tm.ClearFrompatient()\n\t\treturn nil\n\tcase patient.EdgeGender:\n\t\tm.ClearGender()\n\t\treturn nil\n\tcase patient.EdgePrefix:\n\t\tm.ClearPrefix()\n\t\treturn nil\n\tcase patient.EdgeBloodtype:\n\t\tm.ClearBloodtype()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Patient unique edge %s\", name)\n}", "title": "" }, { "docid": "543de693a40ec8fa4a0d83bfdebab68d", "score": "0.765735", "text": "func (m *AchievementMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown Achievement unique edge %s\", name)\n}", "title": "" }, { "docid": "f86580310e6902e433c0ac25dd3d6fa1", "score": "0.76418483", "text": "func (m *PostMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase post.EdgeSource:\n\t\tm.ClearSource()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Post unique edge %s\", name)\n}", "title": "" }, { "docid": "659bd9b892143eaccc8480e30451c4c6", "score": "0.7634654", "text": "func (m *SysUserRoleMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown SysUserRole unique edge %s\", name)\n}", "title": "" }, { "docid": "1433ff08684f46a60b6d62ad15b0bd3f", "score": "0.76280415", "text": "func (m *UserExtendMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown UserExtend unique edge %s\", name)\n}", "title": "" }, { "docid": "18630e92cc564e1fd7991df39c9d7b62", "score": "0.76091367", "text": "func (m *CompanyUserMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown CompanyUser unique edge %s\", name)\n}", "title": "" }, { "docid": "95187c2b4da2e73ae8769a106627ea7a", "score": "0.76073587", "text": "func (m *CustomerMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase customer.EdgeGenders:\n\t\tm.ClearGenders()\n\t\treturn nil\n\tcase customer.EdgePersonals:\n\t\tm.ClearPersonals()\n\t\treturn nil\n\tcase customer.EdgeTitles:\n\t\tm.ClearTitles()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Customer unique edge %s\", name)\n}", "title": "" }, { "docid": "3dc796b864a2519c0275c9fc96fb3203", "score": "0.7606984", "text": "func (m *SysRoleMenuMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown SysRoleMenu unique edge %s\", name)\n}", "title": "" }, { "docid": "e0b32876db1bbeb1da620a57abf7dc86", "score": "0.75994045", "text": "func (m *UserMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase user.EdgeBestFriend:\n\t\tm.ClearBestFriend()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown User unique edge %s\", name)\n}", "title": "" }, { "docid": "d936d637b0e9e71da9f364a52711a23a", "score": "0.7593201", "text": "func (m *ItemDescriptionMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase itemdescription.EdgeOwner:\n\t\tm.ClearOwner()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown ItemDescription unique edge %s\", name)\n}", "title": "" }, { "docid": "627c781080ed7452073e85be58bb8742", "score": "0.75916266", "text": "func (m *CoveredPersonMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase coveredperson.EdgePatient:\n\t\tm.ClearPatient()\n\t\treturn nil\n\tcase coveredperson.EdgeSchemeType:\n\t\tm.ClearSchemeType()\n\t\treturn nil\n\tcase coveredperson.EdgeFund:\n\t\tm.ClearFund()\n\t\treturn nil\n\tcase coveredperson.EdgeCertificate:\n\t\tm.ClearCertificate()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown CoveredPerson unique edge %s\", name)\n}", "title": "" }, { "docid": "75a0cda648d11f9b769e8d729280d4cc", "score": "0.75772923", "text": "func (m *AvatarMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown Avatar unique edge %s\", name)\n}", "title": "" }, { "docid": "5037306e36bd2c83d6043e411a392990", "score": "0.7574704", "text": "func (m *TravelRestrictionSnapshotMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase travelrestrictionsnapshot.EdgeNext:\n\t\tm.ClearNext()\n\t\treturn nil\n\tcase travelrestrictionsnapshot.EdgePrevious:\n\t\tm.ClearPrevious()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown TravelRestrictionSnapshot unique edge %s\", name)\n}", "title": "" }, { "docid": "8f826b74fd59119374c0c8b5671ee50d", "score": "0.75512844", "text": "func (m *PetAttributeMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase petattribute.EdgePet:\n\t\tm.ClearPet()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown PetAttribute unique edge %s\", name)\n}", "title": "" }, { "docid": "03db93841fc548696a350ed7e8422601", "score": "0.7537085", "text": "func (m *SessionMutation) ClearEdge(name string) error {\n\treturn fmt.Errorf(\"unknown Session unique edge %s\", name)\n}", "title": "" }, { "docid": "a39c1bf7a11603b3991c6b189794fb6c", "score": "0.7509534", "text": "func (m *PetMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase pet.EdgeOwner:\n\t\tm.ClearOwner()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Pet unique edge %s\", name)\n}", "title": "" }, { "docid": "a39c1bf7a11603b3991c6b189794fb6c", "score": "0.7509534", "text": "func (m *PetMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase pet.EdgeOwner:\n\t\tm.ClearOwner()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Pet unique edge %s\", name)\n}", "title": "" }, { "docid": "e5c0d78fe4ca8c20eba7c49981395462", "score": "0.74946743", "text": "func (m *RoomMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase room.EdgeRents:\n\t\tm.ClearRents()\n\t\treturn nil\n\tcase room.EdgeRoomtype:\n\t\tm.ClearRoomtype()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Room unique edge %s\", name)\n}", "title": "" }, { "docid": "b0e2f5d8a2d24a0c0317e13b4778bd6d", "score": "0.7462893", "text": "func (m *ItemGroupMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown ItemGroup unique edge %s\", name)\n}", "title": "" }, { "docid": "617a971020dcdb625bb77138e689d657", "score": "0.74342114", "text": "func (m *ItemMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase item.EdgeItemDescription:\n\t\tm.ClearItemDescription()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Item unique edge %s\", name)\n}", "title": "" }, { "docid": "8a92f34cdb3d2ac49baf543a52ee6b1e", "score": "0.7357945", "text": "func (m *ItemVariationMutation) ClearEdge(name string) error {\n\tswitch name {\n\tcase itemvariation.EdgeOriginItem:\n\t\tm.ClearOriginItem()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown ItemVariation unique edge %s\", name)\n}", "title": "" }, { "docid": "027d54068afd42fb1a2d7678a72b6936", "score": "0.7248789", "text": "func (m *TemplateMutation) ClearEdge(name string) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Template unique edge %s\", name)\n}", "title": "" } ]
6db260dfe364af1781171aa4deb19d8e
PushReturn calls PushHook with a function that returns the given values.
[ { "docid": "ff16ee5bea95e8348f4ac28f71064a88", "score": "0.7920668", "text": "func (f *UploadServiceGetDirtyRepositoriesFunc) PushReturn(r0 map[int]int, r1 error) {\n\tf.PushHook(func(context.Context) (map[int]int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" } ]
[ { "docid": "f5e89a23db4d20f22e4a9db192215b89", "score": "0.80012476", "text": "func (f *EventLogStoreCodeIntelligenceWAUsFunc) PushReturn(r0 int, r1 error) {\n\tf.PushHook(func(context.Context) (int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "883270aa15d518a854650b60dd1ff6ed", "score": "0.791654", "text": "func (f *StoreGetLanguagesRequestedByFunc) PushReturn(r0 []string, r1 error) {\n\tf.PushHook(func(context.Context, int) ([]string, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "b8c76ebf4826c280d661d33f2e396bda", "score": "0.7901815", "text": "func (f *StoreGetInferenceScriptFunc) PushReturn(r0 string, r1 error) {\n\tf.PushHook(func(context.Context) (string, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "aa8caa7fba4704d991d12e6dd631bf69", "score": "0.7879427", "text": "func (f *EventLogStoreCodeIntelligenceCrossRepositoryWAUsFunc) PushReturn(r0 int, r1 error) {\n\tf.PushHook(func(context.Context) (int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "baaf989a33ad38da6c8d05f53a6d8eee", "score": "0.78614825", "text": "func (f *StoreNumRepositoriesWithCodeIntelligenceFunc) PushReturn(r0 int, r1 error) {\n\tf.PushHook(func(context.Context) (int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "15e71617e03c9a4909fa69a46e51708c", "score": "0.78367376", "text": "func (f *StoreGetByHostnameFunc) PushReturn(r0 types.Executor, r1 bool, r2 error) {\n\tf.PushHook(func(context.Context, string) (types.Executor, bool, error) {\n\t\treturn r0, r1, r2\n\t})\n}", "title": "" }, { "docid": "a93f6beed3bf96459e750c9d63aaf91f", "score": "0.7814782", "text": "func (f *EventLogStoreCodeIntelligenceSearchBasedCrossRepositoryWAUsFunc) PushReturn(r0 int, r1 error) {\n\tf.PushHook(func(context.Context) (int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "50797e370dd5bc949c4dca358c3f8ebc", "score": "0.7801862", "text": "func (f *EventLogStoreLatestPingFunc) PushReturn(r0 *types.Event, r1 error) {\n\tf.PushHook(func(context.Context) (*types.Event, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "d75183d39e154058f4f95db5be31a636", "score": "0.7773733", "text": "func (f *EventLogStoreCodeIntelligencePreciseCrossRepositoryWAUsFunc) PushReturn(r0 int, r1 error) {\n\tf.PushHook(func(context.Context) (int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "cf8509738845e85586d63e4b7b5b07fe", "score": "0.7771973", "text": "func (f *StoreGetRepoNameFunc) PushReturn(r0 string, r1 error) {\n\tf.PushHook(func(context.Context, int) (string, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "880bcd99aea48c15ce6a1237b24bad49", "score": "0.7767532", "text": "func (f *EventLogStoreCodeIntelligencePreciseWAUsFunc) PushReturn(r0 int, r1 error) {\n\tf.PushHook(func(context.Context) (int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "f6a93b03a5a82113f641c0786643a6f0", "score": "0.7759346", "text": "func (f *EventLogStoreCodeIntelligenceSearchBasedWAUsFunc) PushReturn(r0 int, r1 error) {\n\tf.PushHook(func(context.Context) (int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "d08e62dc16293edfbc1900d864682199", "score": "0.77322173", "text": "func (f *GitserverClientCommitDateFunc) PushReturn(r0 string, r1 time.Time, r2 bool, r3 error) {\n\tf.PushHook(func(context.Context, int, string) (string, time.Time, bool, error) {\n\t\treturn r0, r1, r2, r3\n\t})\n}", "title": "" }, { "docid": "fbd61434e701108136d0e9223dbbaa33", "score": "0.77180547", "text": "func (f *CodeNavServiceGetHoverFunc) PushReturn(r0 string, r1 types.Range, r2 bool, r3 error) {\n\tf.PushHook(func(context.Context, shared1.RequestArgs, codenav.RequestState) (string, types.Range, bool, error) {\n\t\treturn r0, r1, r2, r3\n\t})\n}", "title": "" }, { "docid": "b5edac43589b9f7c6e032561e74dac85", "score": "0.7717993", "text": "func (f *UploadServiceGetRepoNameFunc) PushReturn(r0 string, r1 error) {\n\tf.PushHook(func(context.Context, int) (string, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "dd8297b12da954d8fb55379a69c83621", "score": "0.7668651", "text": "func (f *EventLogStoreTransactFunc) PushReturn(r0 database.EventLogStore, r1 error) {\n\tf.PushHook(func(context.Context) (database.EventLogStore, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "2d9bbddbf7f37ecab597ace64e730a6d", "score": "0.76670855", "text": "func (f *EventLogStoreMaxTimestampByUserIDAndSourceFunc) PushReturn(r0 *time.Time, r1 error) {\n\tf.PushHook(func(context.Context, int32, string) (*time.Time, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "9c26e46379293192573443fa2d8821b8", "score": "0.76667273", "text": "func (f *StoreGetByIDFunc) PushReturn(r0 types.Executor, r1 bool, r2 error) {\n\tf.PushHook(func(context.Context, int) (types.Executor, bool, error) {\n\t\treturn r0, r1, r2\n\t})\n}", "title": "" }, { "docid": "d1e6d7a5abdacb19f3d3ec873e2ac323", "score": "0.7664113", "text": "func (f *CodeNavServiceGetDumpsByIDsFunc) PushReturn(r0 []types.Dump, r1 error) {\n\tf.PushHook(func(context.Context, []int) ([]types.Dump, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "31162245e6e3704acf8601b7d142740f", "score": "0.76524025", "text": "func (f *StoreReadDefinitionsFunc) PushReturn(r0 []types.Location, r1 int, r2 error) {\n\tf.PushHook(func(context.Context, string, string, int, int) ([]types.Location, int, error) {\n\t\treturn r0, r1, r2\n\t})\n}", "title": "" }, { "docid": "fde7be775f05934d9086e19dab1c19cc", "score": "0.76498246", "text": "func (f *EventLogStoreAggregatedCodeIntelEventsFunc) PushReturn(r0 []types.CodeIntelAggregatedEvent, r1 error) {\n\tf.PushHook(func(context.Context) ([]types.CodeIntelAggregatedEvent, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "d0c15157e98f61b745fe7d6be949c059", "score": "0.7648915", "text": "func (f *AutoIndexingServiceNumRepositoriesWithCodeIntelligenceFunc) PushReturn(r0 int, r1 error) {\n\tf.PushHook(func(context.Context) (int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "01d7daca8d76863ce1b776bdbf4fc144", "score": "0.76418775", "text": "func (f *GitserverClientHeadFunc) PushReturn(r0 string, r1 bool, r2 error) {\n\tf.PushHook(func(context.Context, int) (string, bool, error) {\n\t\treturn r0, r1, r2\n\t})\n}", "title": "" }, { "docid": "90ad86ee0a59da0a4612e7a9d823df2b", "score": "0.7593088", "text": "func (f *GitserverClientRawContentsFunc) PushReturn(r0 []byte, r1 error) {\n\tf.PushHook(func(context.Context, int, string, string) ([]byte, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "35f5433f609db757e6229aceb68ac9ab", "score": "0.7586629", "text": "func (f *EventLogStoreCountByUserIDAndEventNameFunc) PushReturn(r0 int, r1 error) {\n\tf.PushHook(func(context.Context, int32, string) (int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "255ba1a5bd7c444bb9b49cc0044dde35", "score": "0.7573097", "text": "func (f *EventLogStoreSiteUsageFunc) PushReturn(r0 types.SiteUsageSummary, r1 error) {\n\tf.PushHook(func(context.Context) (types.SiteUsageSummary, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "0cf4f9ad1c18229405c78535ebda6df4", "score": "0.7572787", "text": "func (f *CodeNavServiceGetDiagnosticsFunc) PushReturn(r0 []shared1.DiagnosticAtUpload, r1 int, r2 error) {\n\tf.PushHook(func(context.Context, shared1.RequestArgs, codenav.RequestState) ([]shared1.DiagnosticAtUpload, int, error) {\n\t\treturn r0, r1, r2\n\t})\n}", "title": "" }, { "docid": "abf30d875cac17f332487a907591251d", "score": "0.7564135", "text": "func (f *EventLogStoreMaxTimestampByUserIDFunc) PushReturn(r0 *time.Time, r1 error) {\n\tf.PushHook(func(context.Context, int32) (*time.Time, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "8b0c1a4905ab80b7c098a1df5983d58e", "score": "0.75526524", "text": "func (f *GitserverClientCommitsUniqueToBranchFunc) PushReturn(r0 map[string]time.Time, r1 error) {\n\tf.PushHook(func(context.Context, int, string, bool, *time.Time) (map[string]time.Time, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "ab9c48b2a13913cd104e3a085e6e6606", "score": "0.7544834", "text": "func (f *SourcerStoreGetBatchChangeFunc) PushReturn(r0 *types1.BatchChange, r1 error) {\n\tf.PushHook(func(context.Context, store.GetBatchChangeOpts) (*types1.BatchChange, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "a5799985fa56ee923536a8f2e85bca00", "score": "0.752355", "text": "func (f *EventLogStoreCountByUserIDAndEventNamesFunc) PushReturn(r0 int, r1 error) {\n\tf.PushHook(func(context.Context, int32, []string) (int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "ce3299736c382f2ef59ed697d5c1354d", "score": "0.7520389", "text": "func (f *BitbucketCloudClientGetPullRequestFunc) PushReturn(r0 *bitbucketcloud.PullRequest, r1 error) {\n\tf.PushHook(func(context.Context, *bitbucketcloud.Repo, int64) (*bitbucketcloud.PullRequest, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "a13f2f9c1c78eb48d7be607f0c3c7c33", "score": "0.75162953", "text": "func (f *GitClientRawContentsFunc) PushReturn(r0 []byte, r1 error) {\n\tf.PushHook(func(context.Context, string) ([]byte, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "5212d75aeb03f7063949709ec6a7a98a", "score": "0.7511907", "text": "func (f *RepoUpdaterClientRepoLookupFunc) PushReturn(r0 *protocol.RepoLookupResult, r1 error) {\n\tf.PushHook(func(context.Context, protocol.RepoLookupArgs) (*protocol.RepoLookupResult, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "0b6e07e623889f10b9a8be86aed1f3e9", "score": "0.7507898", "text": "func (f *BitbucketCloudClientReposFunc) PushReturn(r0 []*bitbucketcloud.Repo, r1 *bitbucketcloud.PageToken, r2 error) {\n\tf.PushHook(func(context.Context, *bitbucketcloud.PageToken, string) ([]*bitbucketcloud.Repo, *bitbucketcloud.PageToken, error) {\n\t\treturn r0, r1, r2\n\t})\n}", "title": "" }, { "docid": "4c8e1a21b9f8bb35416ca6dcdd943cdc", "score": "0.7500533", "text": "func (f *SourcerStoreGetExternalServiceIDsFunc) PushReturn(r0 []int64, r1 error) {\n\tf.PushHook(func(context.Context, store.GetExternalServiceIDsOpts) ([]int64, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "ea540a2ef8f05ac6bbef622d9501e430", "score": "0.7492037", "text": "func (f *EventLogStoreCountByUserIDFunc) PushReturn(r0 int, r1 error) {\n\tf.PushHook(func(context.Context, int32) (int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "8db22d0641d34e261573bfa479217c87", "score": "0.7491201", "text": "func (f *StoreIsQueuedFunc) PushReturn(r0 bool, r1 error) {\n\tf.PushHook(func(context.Context, int, string) (bool, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "b925694fd82421e2298414300353140b", "score": "0.74793667", "text": "func (f *EventLogStoreCountUniqueUsersAllFunc) PushReturn(r0 int, r1 error) {\n\tf.PushHook(func(context.Context, time.Time, time.Time) (int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "d32cc0147f0a2c2cae9716a07c64225c", "score": "0.7475856", "text": "func (f *EventLogStoreCountByUserIDAndEventNamePrefixFunc) PushReturn(r0 int, r1 error) {\n\tf.PushHook(func(context.Context, int32, string) (int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "c7dc702e1a0e0781536c09ae798cea2a", "score": "0.7472036", "text": "func (f *StoreReadMetaFunc) PushReturn(r0 types.MetaData, r1 error) {\n\tf.PushHook(func(context.Context) (types.MetaData, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "3df93842521f19ca9af543b301193e40", "score": "0.747081", "text": "func (f *StoreTransactFunc) PushReturn(r0 persistence.Store, r1 error) {\n\tf.PushHook(func(context.Context) (persistence.Store, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "6c96d3aae0890fdebfb8831f216f4a7c", "score": "0.7468751", "text": "func (f *StoreReadResultChunkFunc) PushReturn(r0 types.ResultChunkData, r1 bool, r2 error) {\n\tf.PushHook(func(context.Context, int) (types.ResultChunkData, bool, error) {\n\t\treturn r0, r1, r2\n\t})\n}", "title": "" }, { "docid": "4c3d112db5df87df03b3f70b153f4324", "score": "0.7458122", "text": "func (f *StoreTransactFunc) PushReturn(r0 store.Store, r1 error) {\n\tf.PushHook(func(context.Context) (store.Store, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "89d9456f697419fceea6a59e79513483", "score": "0.74529743", "text": "func (f *StoreDoneFunc) PushReturn(r0 error) {\n\tf.PushHook(func(error) error {\n\t\treturn r0\n\t})\n}", "title": "" }, { "docid": "89d9456f697419fceea6a59e79513483", "score": "0.74529743", "text": "func (f *StoreDoneFunc) PushReturn(r0 error) {\n\tf.PushHook(func(error) error {\n\t\treturn r0\n\t})\n}", "title": "" }, { "docid": "6525d7f5bf480ce13a22aa383e2edce5", "score": "0.744261", "text": "func (f *StoreInsertDependencyIndexingJobFunc) PushReturn(r0 int, r1 error) {\n\tf.PushHook(func(context.Context, int, string, time.Time) (int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "9b3892c58a28484cb298af2d9367d34c", "score": "0.74382937", "text": "func (f *EventLogStoreCountUniqueUsersByEventNameFunc) PushReturn(r0 int, r1 error) {\n\tf.PushHook(func(context.Context, time.Time, time.Time, string) (int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "5ad1cfaa46dbcd490fcd25fee6867979", "score": "0.7435639", "text": "func (f *EventLogStoreListUniqueUsersAllFunc) PushReturn(r0 []int32, r1 error) {\n\tf.PushHook(func(context.Context, time.Time, time.Time) ([]int32, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "e148cb269cd58166c5cbee41beaccd27", "score": "0.74258155", "text": "func (f *ChangesetSourceGitserverPushConfigFunc) PushReturn(r0 *protocol.PushConfig, r1 error) {\n\tf.PushHook(func(context.Context, database.ExternalServiceStore, *types.Repo) (*protocol.PushConfig, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "53fd2e4a656a08a000eeb36ab2a49e25", "score": "0.7421282", "text": "func (f *StoreReadReferencesFunc) PushReturn(r0 []types.Location, r1 int, r2 error) {\n\tf.PushHook(func(context.Context, string, string, int, int) ([]types.Location, int, error) {\n\t\treturn r0, r1, r2\n\t})\n}", "title": "" }, { "docid": "5b7cd512caa2a821a8315245a5483232", "score": "0.7420607", "text": "func (f *MaximumProcessRunFunc) PushReturn(r0 error) {\n\tf.PushHook(func(context.Context) error {\n\t\treturn r0\n\t})\n}", "title": "" }, { "docid": "e72bb74f479527b3118bcdb9d79b34d2", "score": "0.7416557", "text": "func (f *DataSeriesStoreStampRecordingFunc) PushReturn(r0 types.InsightSeries, r1 error) {\n\tf.PushHook(func(context.Context, types.InsightSeries) (types.InsightSeries, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "22a3cbbccbc7841c8ccf9a9e76de592e", "score": "0.741424", "text": "func (f *CodeNavServiceGetReferencesFunc) PushReturn(r0 []types.UploadLocation, r1 shared1.ReferencesCursor, r2 error) {\n\tf.PushHook(func(context.Context, shared1.RequestArgs, codenav.RequestState, shared1.ReferencesCursor) ([]types.UploadLocation, shared1.ReferencesCursor, error) {\n\t\treturn r0, r1, r2\n\t})\n}", "title": "" }, { "docid": "45f794cb05b9fd69b4b3df8bd7b2f81d", "score": "0.7411977", "text": "func (f *CodeNavServiceGetRangesFunc) PushReturn(r0 []shared1.AdjustedCodeIntelligenceRange, r1 error) {\n\tf.PushHook(func(context.Context, shared1.RequestArgs, codenav.RequestState, int, int) ([]shared1.AdjustedCodeIntelligenceRange, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "bbc3ba92ef32bc53725c8faec2d6f664", "score": "0.7409458", "text": "func (f *StoreListFunc) PushReturn(r0 []types.Executor, r1 int, r2 error) {\n\tf.PushHook(func(context.Context, store.ExecutorStoreListOptions) ([]types.Executor, int, error) {\n\t\treturn r0, r1, r2\n\t})\n}", "title": "" }, { "docid": "73ba2476fb3559b5e29c2db1f8035e2b", "score": "0.74092793", "text": "func (f *StoreGetQueuedRepoRevFunc) PushReturn(r0 []store.RepoRev, r1 error) {\n\tf.PushHook(func(context.Context, int) ([]store.RepoRev, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "525176bd05a2b93c2c0f814c6a5ee069", "score": "0.7409276", "text": "func (f *StoreSetRequestLanguageSupportFunc) PushReturn(r0 error) {\n\tf.PushHook(func(context.Context, int, string) error {\n\t\treturn r0\n\t})\n}", "title": "" }, { "docid": "1027507abb993d6e0c313d649b65bf08", "score": "0.74040306", "text": "func (f *AutoIndexingServiceGetListTagsFunc) PushReturn(r0 []*gitdomain.Tag, r1 error) {\n\tf.PushHook(func(context.Context, api.RepoName, ...string) ([]*gitdomain.Tag, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "72283ebdd8994c221c23da2630699ec5", "score": "0.74019116", "text": "func (f *BitbucketCloudClientRepoFunc) PushReturn(r0 *bitbucketcloud.Repo, r1 error) {\n\tf.PushHook(func(context.Context, string, string) (*bitbucketcloud.Repo, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "b981204a5c74098437a701b2eaaf73b2", "score": "0.73946804", "text": "func (f *EventLogStoreCodeIntelligenceRepositoryCountsFunc) PushReturn(r0 database.CodeIntelligenceRepositoryCounts, r1 error) {\n\tf.PushHook(func(context.Context) (database.CodeIntelligenceRepositoryCounts, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "a19e2bd2920eb0be204566f699fe5787", "score": "0.7390292", "text": "func (f *EventLogStoreCodeIntelligenceRepositoryCountsByLanguageFunc) PushReturn(r0 map[string]database.CodeIntelligenceRepositoryCountsForLanguage, r1 error) {\n\tf.PushHook(func(context.Context) (map[string]database.CodeIntelligenceRepositoryCountsForLanguage, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "50193a67f0d24fb13ffb375451388400", "score": "0.73876464", "text": "func (f *UploadServiceReferencesForUploadFunc) PushReturn(r0 shared1.PackageReferenceScanner, r1 error) {\n\tf.PushHook(func(context.Context, int) (shared1.PackageReferenceScanner, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "2492325dbe57f6949b89379f3462334d", "score": "0.7384397", "text": "func (f *EventLogStoreAggregatedSearchEventsFunc) PushReturn(r0 []types.SearchAggregatedEvent, r1 error) {\n\tf.PushHook(func(context.Context, time.Time) ([]types.SearchAggregatedEvent, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "4e897542671755cd10ec11dc6872b855", "score": "0.73764515", "text": "func (f *BitbucketCloudClientUpdatePullRequestFunc) PushReturn(r0 *bitbucketcloud.PullRequest, r1 error) {\n\tf.PushHook(func(context.Context, *bitbucketcloud.Repo, int64, bitbucketcloud.PullRequestInput) (*bitbucketcloud.PullRequest, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "5dc9020e2008662ec35403ae0d28ce4b", "score": "0.7375139", "text": "func (f *EventLogStoreCountUniqueUsersByEventNamePrefixFunc) PushReturn(r0 int, r1 error) {\n\tf.PushHook(func(context.Context, time.Time, time.Time, string) (int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "6c2c1406c3073064a92fe4894dc60a05", "score": "0.7371636", "text": "func (f *BitbucketCloudClientGetPullRequestStatusesFunc) PushReturn(r0 *bitbucketcloud.PaginatedResultSet, r1 error) {\n\tf.PushHook(func(*bitbucketcloud.Repo, int64) (*bitbucketcloud.PaginatedResultSet, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "e136a1c6f771923243cd64ab83abc7ad", "score": "0.73624694", "text": "func (f *StoreGetLastIndexScanForRepositoryFunc) PushReturn(r0 *time.Time, r1 error) {\n\tf.PushHook(func(context.Context, int) (*time.Time, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "2f692ec6fae1e7f6e0b97e442acc94d2", "score": "0.73622763", "text": "func (f *EventLogStoreDoneFunc) PushReturn(r0 error) {\n\tf.PushHook(func(error) error {\n\t\treturn r0\n\t})\n}", "title": "" }, { "docid": "717c3946a459ecb5db76e4338c1114ef", "score": "0.73579097", "text": "func (f *UploadsServiceGetListTagsFunc) PushReturn(r0 []*gitdomain.Tag, r1 error) {\n\tf.PushHook(func(context.Context, api.RepoName, ...string) ([]*gitdomain.Tag, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "c5719aaa4495dea20f96d26281b35466", "score": "0.7352356", "text": "func (f *BitbucketCloudClientCurrentUserFunc) PushReturn(r0 *bitbucketcloud.User, r1 error) {\n\tf.PushHook(func(context.Context) (*bitbucketcloud.User, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "9ecf6d1ca5fde43521ad24d48514c980", "score": "0.7351638", "text": "func (f *CodeNavServiceGetDefinitionsFunc) PushReturn(r0 []types.UploadLocation, r1 error) {\n\tf.PushHook(func(context.Context, shared1.RequestArgs, codenav.RequestState) ([]types.UploadLocation, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "d62960f704518e13792d7719d7c92ec4", "score": "0.734596", "text": "func (f *RepoUpdaterClientEnqueueRepoUpdateFunc) PushReturn(r0 *protocol.RepoUpdateResponse, r1 error) {\n\tf.PushHook(func(context.Context, api.RepoName) (*protocol.RepoUpdateResponse, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "01b2056d80e3bd79ce4c6e335de8ebbb", "score": "0.7343854", "text": "func (f *UploadsServiceGetAuditLogsForUploadFunc) PushReturn(r0 []types.UploadLog, r1 error) {\n\tf.PushHook(func(context.Context, int) ([]types.UploadLog, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "9c6c9d02bc9f02c61f9a23c4a5984a86", "score": "0.733593", "text": "func (f *EventLogStoreInsertFunc) PushReturn(r0 error) {\n\tf.PushHook(func(context.Context, *database.Event) error {\n\t\treturn r0\n\t})\n}", "title": "" }, { "docid": "061bc5daf1509f13ceba2f8f08f5bf09", "score": "0.73345554", "text": "func (f *ForkableChangesetSourceGitserverPushConfigFunc) PushReturn(r0 *protocol.PushConfig, r1 error) {\n\tf.PushHook(func(context.Context, database.ExternalServiceStore, *types.Repo) (*protocol.PushConfig, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "d68c607d54f58958feb726923fa1ec8f", "score": "0.73215264", "text": "func (f *EventLogStoreCountUniqueUsersByEventNamesFunc) PushReturn(r0 int, r1 error) {\n\tf.PushHook(func(context.Context, time.Time, time.Time, []string) (int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "aa1fcaa977180261cf94c4c7f8368971", "score": "0.7320422", "text": "func (f *StoreProcessStaleSourcedCommitsFunc) PushReturn(r0 int, r1 error) {\n\tf.PushHook(func(context.Context, time.Duration, int, time.Duration, func(ctx context.Context, repositoryID int, commit string) (bool, error)) (int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "ecd05f18e710e3b26b80b15e76f6e1df", "score": "0.7316873", "text": "func (f *StoreSetInferenceScriptFunc) PushReturn(r0 error) {\n\tf.PushHook(func(context.Context, string) error {\n\t\treturn r0\n\t})\n}", "title": "" }, { "docid": "db6ad202aa1b9e5db7e3a1e3d9d4aae8", "score": "0.73168546", "text": "func (f *StoreWriteDefinitionsFunc) PushReturn(r0 error) {\n\tf.PushHook(func(context.Context, chan types.MonikerLocations) error {\n\t\treturn r0\n\t})\n}", "title": "" }, { "docid": "31d66b0c1c166916385d9cc4aada75d8", "score": "0.73165894", "text": "func (f *SettingsStoreGetLatestFunc) PushReturn(r0 *api.Settings, r1 error) {\n\tf.PushHook(func(context.Context, api.SettingsSubject) (*api.Settings, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "277b128597f5d7bda0e7a78f2d4e7ac8", "score": "0.7313405", "text": "func (f *BitbucketCloudClientCreatePullRequestFunc) PushReturn(r0 *bitbucketcloud.PullRequest, r1 error) {\n\tf.PushHook(func(context.Context, *bitbucketcloud.Repo, bitbucketcloud.PullRequestInput) (*bitbucketcloud.PullRequest, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "c88c2f4ddba405de39d4bba5d6731dcb", "score": "0.73111707", "text": "func (f *StoreQueueRepoRevFunc) PushReturn(r0 error) {\n\tf.PushHook(func(context.Context, int, string) error {\n\t\treturn r0\n\t})\n}", "title": "" }, { "docid": "ac8f8155b16fa85bc4f592653e7b55ba", "score": "0.7308636", "text": "func (f *CodeNavServiceGetClosestDumpsForBlobFunc) PushReturn(r0 []types.Dump, r1 error) {\n\tf.PushHook(func(context.Context, int, string, string, bool, string) ([]types.Dump, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "3efdcebbc17fc29a0bdc3e231240e097", "score": "0.73077804", "text": "func (f *BitbucketCloudClientPingFunc) PushReturn(r0 error) {\n\tf.PushHook(func(context.Context) error {\n\t\treturn r0\n\t})\n}", "title": "" }, { "docid": "385f5e3607da7838f6316d45e03001c4", "score": "0.7307714", "text": "func (f *UploadServiceGetRepositoriesForIndexScanFunc) PushReturn(r0 []int, r1 error) {\n\tf.PushHook(func(context.Context, string, string, time.Duration, bool, *int, int, time.Time) ([]int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "c3b5f766c1edd01e9e2c380954e7bf02", "score": "0.72982234", "text": "func (f *EventLogStoreCodeIntelligenceSettingsPageViewCountFunc) PushReturn(r0 int, r1 error) {\n\tf.PushHook(func(context.Context) (int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "94aaad4892db56fe54903b8e565ad786", "score": "0.7293525", "text": "func (f *EventLogStoreListAllFunc) PushReturn(r0 []*types.Event, r1 error) {\n\tf.PushHook(func(context.Context, database.EventLogsListOptions) ([]*types.Event, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "932f32ef298c40dadfb960f75648d951", "score": "0.72900605", "text": "func (f *EventLogStoreCountUniqueUsersPerPeriodFunc) PushReturn(r0 []database.UsageValue, r1 error) {\n\tf.PushHook(func(context.Context, database.PeriodType, time.Time, int, *database.CountUniqueUsersOptions) ([]database.UsageValue, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "f7109a25b3ff3cd91d8ab578518a2194", "score": "0.72847176", "text": "func (f *DataSeriesStoreGetDataSeriesFunc) PushReturn(r0 []types.InsightSeries, r1 error) {\n\tf.PushHook(func(context.Context, GetDataSeriesArgs) ([]types.InsightSeries, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "dd0fdd7cfb63683a94dfd9d1219d2bba", "score": "0.7282516", "text": "func (f *CodeNavServiceGetStencilFunc) PushReturn(r0 []types.Range, r1 error) {\n\tf.PushHook(func(context.Context, shared1.RequestArgs, codenav.RequestState) ([]types.Range, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "1660556bcab062a88dd627b5738a806b", "score": "0.7278797", "text": "func (f *StoreMarkRepoRevsAsProcessedFunc) PushReturn(r0 error) {\n\tf.PushHook(func(context.Context, []int) error {\n\t\treturn r0\n\t})\n}", "title": "" }, { "docid": "e43cfd86718f2fc85b122b6d3832d7fb", "score": "0.7273578", "text": "func (f *StoreExpireFailedRecordsFunc) PushReturn(r0 error) {\n\tf.PushHook(func(context.Context, int, time.Duration, time.Time) error {\n\t\treturn r0\n\t})\n}", "title": "" }, { "docid": "0c8f4d0076ec847016983db8b25c7e4a", "score": "0.72732985", "text": "func (f *SettingsStoreCreateIfUpToDateFunc) PushReturn(r0 *api.Settings, r1 error) {\n\tf.PushHook(func(context.Context, api.SettingsSubject, *int32, *int32, string) (*api.Settings, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "a11d8fcfa1915b1fc21d7dbe6caa08e7", "score": "0.727031", "text": "func (f *UploadsServiceGetUploadsFunc) PushReturn(r0 []types.Upload, r1 int, r2 error) {\n\tf.PushHook(func(context.Context, shared2.GetUploadsOptions) ([]types.Upload, int, error) {\n\t\treturn r0, r1, r2\n\t})\n}", "title": "" }, { "docid": "577b87bb9274159b556b290524d0364b", "score": "0.72636205", "text": "func (f *UploadServiceGetUploadByIDFunc) PushReturn(r0 types.Upload, r1 bool, r2 error) {\n\tf.PushHook(func(context.Context, int) (types.Upload, bool, error) {\n\t\treturn r0, r1, r2\n\t})\n}", "title": "" }, { "docid": "549e7c078a2d21f02ae099b5ccb3c640", "score": "0.7263098", "text": "func (f *GitserverClientDiffPathFunc) PushReturn(r0 []*diff.Hunk, r1 error) {\n\tf.PushHook(func(context.Context, authz.SubRepoPermissionChecker, api.RepoName, string, string, string) ([]*diff.Hunk, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "782261ef4429285e5cef0cca3ff43568", "score": "0.72559714", "text": "func (f *MaximumProcessInitFunc) PushReturn(r0 error) {\n\tf.PushHook(func(context.Context) error {\n\t\treturn r0\n\t})\n}", "title": "" }, { "docid": "0fa72e65b21c385f0fc33a9b4360fa52", "score": "0.7255397", "text": "func (f *GitserverClientListTagsFunc) PushReturn(r0 []*gitdomain.Tag, r1 error) {\n\tf.PushHook(func(context.Context, api.RepoName, ...string) ([]*gitdomain.Tag, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "2f35bcf8fa992dd96e503a7009d48f3f", "score": "0.72499305", "text": "func (f *StoreUpsertHeartbeatFunc) PushReturn(r0 error) {\n\tf.PushHook(func(context.Context, types.Executor) error {\n\t\treturn r0\n\t})\n}", "title": "" } ]
92986d999482d4ac549be246b7aed747
WorkOrderIDs returns the work_order ids in the mutation. Note that ids always returns len(ids) <= 1 for unique edges, and you should use WorkOrderID instead. It exists only for internal usage by the builders.
[ { "docid": "fbff94bdd44df5aa3095dbd29a4c9724", "score": "0.834859", "text": "func (m *LinkMutation) WorkOrderIDs() (ids []int) {\n\tif id := m.work_order; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "f697cd7be436a09481b36fe96c964c46", "score": "0.84320515", "text": "func (m *EquipmentMutation) WorkOrderIDs() (ids []int) {\n\tif id := m.work_order; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "775a218ba4cfa3bc775c966eb0a1fba1", "score": "0.83714634", "text": "func (m *PropertyMutation) WorkOrderIDs() (ids []int) {\n\tif id := m.work_order; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "c4bbffd5389aa98c97e846bc1fa8dabd", "score": "0.82495415", "text": "func (m *CheckListCategoryMutation) WorkOrderIDs() (ids []int) {\n\tif id := m.work_order; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "33a6bfb581f0b4510362f8e7bfc4e8c6", "score": "0.81109583", "text": "func (m *ProjectMutation) WorkOrdersIDs() (ids []int) {\n\tfor id := range m.work_orders {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "a03d7b0dd13383456b30dc8044a1ea0f", "score": "0.80825627", "text": "func (m *ProjectTypeMutation) WorkOrdersIDs() (ids []int) {\n\tfor id := range m.work_orders {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "4e494f226802fed511f63e8aedeb1927", "score": "0.79813963", "text": "func (m *LocationMutation) WorkOrdersIDs() (ids []int) {\n\tfor id := range m.work_orders {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "19479202e4872f57bfe85d1f1f442b22", "score": "0.7943837", "text": "func (m *WorkOrderTypeMutation) WorkOrdersIDs() (ids []int) {\n\tfor id := range m.work_orders {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "430acb71c0993c35cd5d159f4dc8b043", "score": "0.7326304", "text": "func (m *ProjectMutation) AddWorkOrderIDs(ids ...int) {\n\tif m.work_orders == nil {\n\t\tm.work_orders = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.work_orders[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "deedc07a757e7d296d7800f5806271f0", "score": "0.72688365", "text": "func (m *ProjectMutation) RemovedWorkOrdersIDs() (ids []int) {\n\tfor id := range m.removedwork_orders {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "15a854fdcfd1769b0e1d0e1ebca52753", "score": "0.7248858", "text": "func (m *ProjectTypeMutation) RemovedWorkOrdersIDs() (ids []int) {\n\tfor id := range m.removedwork_orders {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "7f3dc14bb18fcc734329c54b0288e94c", "score": "0.7230402", "text": "func (m *ProjectTypeMutation) AddWorkOrderIDs(ids ...int) {\n\tif m.work_orders == nil {\n\t\tm.work_orders = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.work_orders[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "4e27621499b4cd4f8f3b8b68941190e2", "score": "0.7118534", "text": "func (m *LocationMutation) RemovedWorkOrdersIDs() (ids []int) {\n\tfor id := range m.removedwork_orders {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "bbf0669e43ef0765350817a15b7047b5", "score": "0.71076906", "text": "func (m *WorkOrderTypeMutation) AddWorkOrderIDs(ids ...int) {\n\tif m.work_orders == nil {\n\t\tm.work_orders = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.work_orders[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "412418828d37df62bd4a1fa4757faa2e", "score": "0.71028584", "text": "func (m *WorkOrderTypeMutation) RemovedWorkOrdersIDs() (ids []int) {\n\tfor id := range m.removedwork_orders {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "d69d5db561092085beffe80b96b5cabd", "score": "0.7048342", "text": "func (m *LocationMutation) AddWorkOrderIDs(ids ...int) {\n\tif m.work_orders == nil {\n\t\tm.work_orders = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.work_orders[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "f5ebee2dbe83cbfc2f9253a1f9d15ba0", "score": "0.7033376", "text": "func (m *ProjectMutation) RemoveWorkOrderIDs(ids ...int) {\n\tif m.removedwork_orders == nil {\n\t\tm.removedwork_orders = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.removedwork_orders[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "03d088524a824aa9e9a64bde76ff3aa5", "score": "0.6954074", "text": "func (m *ProjectTypeMutation) RemoveWorkOrderIDs(ids ...int) {\n\tif m.removedwork_orders == nil {\n\t\tm.removedwork_orders = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.removedwork_orders[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "5c1940004657d98f539ef20014b2ee27", "score": "0.694277", "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": "6c136f95d1bf11bca2beaab5af0961d2", "score": "0.6844243", "text": "func (m *WorkOrderMutation) AddedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase workorder.EdgeType:\n\t\tif id := m._type; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\tcase workorder.EdgeEquipment:\n\t\tids := make([]ent.Value, 0, len(m.equipment))\n\t\tfor id := range m.equipment {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase workorder.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 workorder.EdgeFiles:\n\t\tids := make([]ent.Value, 0, len(m.files))\n\t\tfor id := range m.files {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase workorder.EdgeHyperlinks:\n\t\tids := make([]ent.Value, 0, len(m.hyperlinks))\n\t\tfor id := range m.hyperlinks {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase workorder.EdgeLocation:\n\t\tif id := m.location; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\tcase workorder.EdgeComments:\n\t\tids := make([]ent.Value, 0, len(m.comments))\n\t\tfor id := range m.comments {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase workorder.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 workorder.EdgeCheckListCategories:\n\t\tids := make([]ent.Value, 0, len(m.check_list_categories))\n\t\tfor id := range m.check_list_categories {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase workorder.EdgeProject:\n\t\tif id := m.project; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\tcase workorder.EdgeOwner:\n\t\tif id := m.owner; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\tcase workorder.EdgeAssignee:\n\t\tif id := m.assignee; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bdaca542349a356408af8b986eb6def5", "score": "0.6834851", "text": "func (m *PropertyTypeMutation) WorkOrderTypeIDs() (ids []int) {\n\tif id := m.work_order_type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "6968c0091d0b74be1f65cf65136427b3", "score": "0.68236893", "text": "func (m *LocationMutation) RemoveWorkOrderIDs(ids ...int) {\n\tif m.removedwork_orders == nil {\n\t\tm.removedwork_orders = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.removedwork_orders[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "fbb47445c2d8d4f1ba51c453823d9957", "score": "0.67371154", "text": "func (m *WorkOrderTypeMutation) RemoveWorkOrderIDs(ids ...int) {\n\tif m.removedwork_orders == nil {\n\t\tm.removedwork_orders = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.removedwork_orders[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "ec11fb8f6e58a8d636bd4a22de3b2682", "score": "0.669326", "text": "func (m *CheckListCategoryDefinitionMutation) WorkOrderTypeIDs() (ids []int) {\n\tif id := m.work_order_type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "7a7c9cc2b6a4b4267522a8cf8971be84", "score": "0.6443369", "text": "func (m *WorkOrderTypeMutation) AddedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase workordertype.EdgeWorkOrders:\n\t\tids := make([]ent.Value, 0, len(m.work_orders))\n\t\tfor id := range m.work_orders {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase workordertype.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 workordertype.EdgeDefinitions:\n\t\tids := make([]ent.Value, 0, len(m.definitions))\n\t\tfor id := range m.definitions {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase workordertype.EdgeCheckListCategoryDefinitions:\n\t\tids := make([]ent.Value, 0, len(m.check_list_category_definitions))\n\t\tfor id := range m.check_list_category_definitions {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c8cde89e475e878646eb3d6846394968", "score": "0.64257467", "text": "func (pu *ProjectUpdate) AddWorkOrderIDs(ids ...string) *ProjectUpdate {\n\tif pu.work_orders == nil {\n\t\tpu.work_orders = make(map[string]struct{})\n\t}\n\tfor i := range ids {\n\t\tpu.work_orders[ids[i]] = struct{}{}\n\t}\n\treturn pu\n}", "title": "" }, { "docid": "5f59c2944a2a5de3e1d1e115ac729c49", "score": "0.63821673", "text": "func (lc *LocationCreate) AddWorkOrderIDs(ids ...int) *LocationCreate {\n\tlc.mutation.AddWorkOrderIDs(ids...)\n\treturn lc\n}", "title": "" }, { "docid": "d18d424a27031775a5d6b0b2d2a506c2", "score": "0.6284776", "text": "func (puo *ProjectUpdateOne) AddWorkOrderIDs(ids ...string) *ProjectUpdateOne {\n\tif puo.work_orders == nil {\n\t\tpuo.work_orders = make(map[string]struct{})\n\t}\n\tfor i := range ids {\n\t\tpuo.work_orders[ids[i]] = struct{}{}\n\t}\n\treturn puo\n}", "title": "" }, { "docid": "dd768cd048b9fbc3c985ecac215971a1", "score": "0.62756777", "text": "func (tc *TechnicianCreate) AddWorkOrderIDs(ids ...string) *TechnicianCreate {\n\tif tc.work_orders == nil {\n\t\ttc.work_orders = make(map[string]struct{})\n\t}\n\tfor i := range ids {\n\t\ttc.work_orders[ids[i]] = struct{}{}\n\t}\n\treturn tc\n}", "title": "" }, { "docid": "dd768cd048b9fbc3c985ecac215971a1", "score": "0.62756777", "text": "func (tc *TechnicianCreate) AddWorkOrderIDs(ids ...string) *TechnicianCreate {\n\tif tc.work_orders == nil {\n\t\ttc.work_orders = make(map[string]struct{})\n\t}\n\tfor i := range ids {\n\t\ttc.work_orders[ids[i]] = struct{}{}\n\t}\n\treturn tc\n}", "title": "" }, { "docid": "ecd31f5e77a5fc536eeb64dcd89b1c52", "score": "0.6233918", "text": "func (pu *ProjectUpdate) RemoveWorkOrderIDs(ids ...string) *ProjectUpdate {\n\tif pu.removedWorkOrders == nil {\n\t\tpu.removedWorkOrders = make(map[string]struct{})\n\t}\n\tfor i := range ids {\n\t\tpu.removedWorkOrders[ids[i]] = struct{}{}\n\t}\n\treturn pu\n}", "title": "" }, { "docid": "11e378a7dce902e7842a10159d0eb556", "score": "0.62126684", "text": "func (m *WorkOrderMutation) CommentsIDs() (ids []int) {\n\tfor id := range m.comments {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "dbbd9c5caf198180f1a7d39dabbf0ab2", "score": "0.6120469", "text": "func (m *WorkOrderTypeMutation) DefinitionsIDs() (ids []int) {\n\tfor id := range m.definitions {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "f574f19927a81763e89265bf039c9106", "score": "0.6116121", "text": "func (m *WorkOrderMutation) EquipmentIDs() (ids []int) {\n\tfor id := range m.equipment {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "ad34d5e2e18a74284037cea7be96a66f", "score": "0.60857105", "text": "func (puo *ProjectUpdateOne) RemoveWorkOrderIDs(ids ...string) *ProjectUpdateOne {\n\tif puo.removedWorkOrders == nil {\n\t\tpuo.removedWorkOrders = make(map[string]struct{})\n\t}\n\tfor i := range ids {\n\t\tpuo.removedWorkOrders[ids[i]] = struct{}{}\n\t}\n\treturn puo\n}", "title": "" }, { "docid": "36f432cdd9070b5c40945d06846ad7b2", "score": "0.5939193", "text": "func (m *WorkOrderMutation) FilesIDs() (ids []int) {\n\tfor id := range m.files {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "95f161e10a4bf481788409b07eddd306", "score": "0.5930793", "text": "func (m *PropertyMutation) SetWorkOrderID(id int) {\n\tm.work_order = &id\n}", "title": "" }, { "docid": "fe570f354d80a1ab8c90f9a4cc9ba5ca", "score": "0.5894664", "text": "func (m *WorkOrderMutation) OwnerIDs() (ids []int) {\n\tif id := m.owner; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "c7d6999343df97180f225ff11e78ce98", "score": "0.5874916", "text": "func (m *WorkOrderMutation) ProjectIDs() (ids []int) {\n\tif id := m.project; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "72feb1b7ef8b55ace5e69753e513a3ba", "score": "0.5858249", "text": "func (m *WorkOrderDefinitionMutation) AddedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase workorderdefinition.EdgeType:\n\t\tif id := m._type; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\tcase workorderdefinition.EdgeProjectType:\n\t\tif id := m.project_type; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7aa005ede1d59a6b317d35c1b7012552", "score": "0.5851474", "text": "func (m *WorkOrderMutation) PropertiesIDs() (ids []int) {\n\tfor id := range m.properties {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "a77b64452d1e9affdcb4717691449c3a", "score": "0.5819594", "text": "func (m *PropertyMutation) WorkOrderID() (id int, exists bool) {\n\tif m.work_order != nil {\n\t\treturn *m.work_order, true\n\t}\n\treturn\n}", "title": "" }, { "docid": "1932ff30a801763839fadac2aba3cc28", "score": "0.5802429", "text": "func (wotu *WorkOrderTypeUpdate) AddWorkOrderIDs(ids ...string) *WorkOrderTypeUpdate {\n\tif wotu.work_orders == nil {\n\t\twotu.work_orders = make(map[string]struct{})\n\t}\n\tfor i := range ids {\n\t\twotu.work_orders[ids[i]] = struct{}{}\n\t}\n\treturn wotu\n}", "title": "" }, { "docid": "d770ca72655f8cf7af01f7816888b0e7", "score": "0.5774294", "text": "func (m *WorkOrderMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase workorder.EdgeEquipment:\n\t\tids := make([]ent.Value, 0, len(m.removedequipment))\n\t\tfor id := range m.removedequipment {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase workorder.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 workorder.EdgeFiles:\n\t\tids := make([]ent.Value, 0, len(m.removedfiles))\n\t\tfor id := range m.removedfiles {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase workorder.EdgeHyperlinks:\n\t\tids := make([]ent.Value, 0, len(m.removedhyperlinks))\n\t\tfor id := range m.removedhyperlinks {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase workorder.EdgeComments:\n\t\tids := make([]ent.Value, 0, len(m.removedcomments))\n\t\tfor id := range m.removedcomments {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase workorder.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 workorder.EdgeCheckListCategories:\n\t\tids := make([]ent.Value, 0, len(m.removedcheck_list_categories))\n\t\tfor id := range m.removedcheck_list_categories {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "303931a889ddd6043c978db5a7ae19ea", "score": "0.5773146", "text": "func (m *EquipmentMutation) WorkOrderID() (id int, exists bool) {\n\tif m.work_order != nil {\n\t\treturn *m.work_order, true\n\t}\n\treturn\n}", "title": "" }, { "docid": "258c6f1e931c0ad6d2108e2eaa22bcee", "score": "0.5752426", "text": "func (wotuo *WorkOrderTypeUpdateOne) AddWorkOrderIDs(ids ...string) *WorkOrderTypeUpdateOne {\n\tif wotuo.work_orders == nil {\n\t\twotuo.work_orders = make(map[string]struct{})\n\t}\n\tfor i := range ids {\n\t\twotuo.work_orders[ids[i]] = struct{}{}\n\t}\n\treturn wotuo\n}", "title": "" }, { "docid": "e09a7a25b3e074a1fadf43abb8b7c73b", "score": "0.573921", "text": "func (m *EquipmentMutation) SetWorkOrderID(id int) {\n\tm.work_order = &id\n}", "title": "" }, { "docid": "43b583acdbdc57b78fbc255c41f179df", "score": "0.573528", "text": "func (m *TeamMutation) TasksIDs() (ids []int) {\n\tfor id := range m.tasks {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "549f3ae2243b5ad3b3cadddfd047d7bd", "score": "0.5706558", "text": "func (m *CheckListCategoryMutation) WorkOrderID() (id int, exists bool) {\n\tif m.work_order != nil {\n\t\treturn *m.work_order, true\n\t}\n\treturn\n}", "title": "" }, { "docid": "19b0ae04db0ab250d8cae174ca27ed78", "score": "0.5672202", "text": "func (m *LinkMutation) SetWorkOrderID(id int) {\n\tm.work_order = &id\n}", "title": "" }, { "docid": "a53dc17b62c87595367870b4c1721d55", "score": "0.5631354", "text": "func (m *LinkMutation) WorkOrderID() (id int, exists bool) {\n\tif m.work_order != nil {\n\t\treturn *m.work_order, true\n\t}\n\treturn\n}", "title": "" }, { "docid": "ec009068e5af48fdc724677d28574714", "score": "0.5620885", "text": "func (m *UserMutation) TasksIDs() (ids []int) {\n\tfor id := range m.tasks {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "2f7c1af98b8c5a45dcb96b9dcc4a617c", "score": "0.5617215", "text": "func (m *CheckListCategoryMutation) SetWorkOrderID(id int) {\n\tm.work_order = &id\n}", "title": "" }, { "docid": "5f5678b4bb4c1013a2fbae8178b9c119", "score": "0.5612194", "text": "func (m *WorkOrderMutation) LocationIDs() (ids []int) {\n\tif id := m.location; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "b6f6fd8dba18e68872ef023eeff35b34", "score": "0.55973136", "text": "func (m *WorkOrderTypeMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase workordertype.EdgeWorkOrders:\n\t\tids := make([]ent.Value, 0, len(m.removedwork_orders))\n\t\tfor id := range m.removedwork_orders {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase workordertype.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 workordertype.EdgeDefinitions:\n\t\tids := make([]ent.Value, 0, len(m.removeddefinitions))\n\t\tfor id := range m.removeddefinitions {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase workordertype.EdgeCheckListCategoryDefinitions:\n\t\tids := make([]ent.Value, 0, len(m.removedcheck_list_category_definitions))\n\t\tfor id := range m.removedcheck_list_category_definitions {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d522bf35ec88ea4f08637b9a51b9d51f", "score": "0.5586903", "text": "func (m *WorkOrderMutation) LinksIDs() (ids []int) {\n\tfor id := range m.links {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "a384f57ad9f139d4cfa5e7a4eb89db8a", "score": "0.5574432", "text": "func (wotu *WorkOrderTypeUpdate) RemoveWorkOrderIDs(ids ...string) *WorkOrderTypeUpdate {\n\tif wotu.removedWorkOrders == nil {\n\t\twotu.removedWorkOrders = make(map[string]struct{})\n\t}\n\tfor i := range ids {\n\t\twotu.removedWorkOrders[ids[i]] = struct{}{}\n\t}\n\treturn wotu\n}", "title": "" }, { "docid": "b7cc6337d91f4553c341703b8505da3e", "score": "0.5546462", "text": "func (au *ActivityUpdate) SetWorkOrderID(id int) *ActivityUpdate {\n\tau.mutation.SetWorkOrderID(id)\n\treturn au\n}", "title": "" }, { "docid": "981dd0994bc28f58027369934c5249c7", "score": "0.55417323", "text": "func (wotuo *WorkOrderTypeUpdateOne) RemoveWorkOrderIDs(ids ...string) *WorkOrderTypeUpdateOne {\n\tif wotuo.removedWorkOrders == nil {\n\t\twotuo.removedWorkOrders = make(map[string]struct{})\n\t}\n\tfor i := range ids {\n\t\twotuo.removedWorkOrders[ids[i]] = struct{}{}\n\t}\n\treturn wotuo\n}", "title": "" }, { "docid": "9541e0ebbedbec359b73645e5d179918", "score": "0.55408293", "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": "3569000ec5faf83eccb4f95ce65f8b63", "score": "0.55385506", "text": "func (wq *WorkQuery) IDs(ctx context.Context) ([]int, error) {\n\tvar ids []int\n\tif err := wq.Select(work.FieldID).Scan(ctx, &ids); err != nil {\n\t\treturn nil, err\n\t}\n\treturn ids, nil\n}", "title": "" }, { "docid": "ab0d179c59094fe81f38fccb24351f1d", "score": "0.55016714", "text": "func (m *ChecksymptomMutation) DoctorordersheetIDs() (ids []int) {\n\tif id := m.doctorordersheet; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "90126e7e80d6bcc982fa7d4918160966", "score": "0.5489543", "text": "func (m *ProjectMutation) AddedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase project.EdgeUsers:\n\t\tids := make([]ent.Value, 0, len(m.users))\n\t\tfor id := range m.users {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase project.EdgeTags:\n\t\tids := make([]ent.Value, 0, len(m.tags))\n\t\tfor id := range m.tags {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase project.EdgeTickets:\n\t\tids := make([]ent.Value, 0, len(m.tickets))\n\t\tfor id := range m.tickets {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase project.EdgeLanguages:\n\t\tids := make([]ent.Value, 0, len(m.languages))\n\t\tfor id := range m.languages {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase project.EdgeOwner:\n\t\tif id := m.owner; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "adac3be1b8869cd4a9f72b7b0212f445", "score": "0.5458198", "text": "func (auo *ActivityUpdateOne) SetWorkOrderID(id int) *ActivityUpdateOne {\n\tauo.mutation.SetWorkOrderID(id)\n\treturn auo\n}", "title": "" }, { "docid": "5ac4c5879056c082b2e6c8ef3f641a77", "score": "0.54545325", "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": "28e95cd7b9761297fff8f833bacff2ce", "score": "0.5449269", "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": "cb147ba2eea04c68ec96ca8f07b6e41e", "score": "0.5441268", "text": "func (m *WorkOrderMutation) TypeIDs() (ids []int) {\n\tif id := m._type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "b90aaa952ae1162ee6185d7b2feb15df", "score": "0.54316163", "text": "func (op *ListStatusChangesOp) TransactionIds(val ...string) *ListStatusChangesOp {\n\tif op != nil {\n\t\top.QueryOpts.Set(\"transaction_ids\", strings.Join(val, \",\"))\n\t}\n\treturn op\n}", "title": "" }, { "docid": "f59f709c8ca1dd2e587f76b13236cce4", "score": "0.54151845", "text": "func (m *WorkOrderMutation) HyperlinksIDs() (ids []int) {\n\tfor id := range m.hyperlinks {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "21e346e4f6a77c12c77cb82f0e543c73", "score": "0.5395816", "text": "func (m *ProjectMutation) AddedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase project.EdgeType:\n\t\tif id := m._type; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\tcase project.EdgeLocation:\n\t\tif id := m.location; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\tcase project.EdgeComments:\n\t\tids := make([]ent.Value, 0, len(m.comments))\n\t\tfor id := range m.comments {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase project.EdgeWorkOrders:\n\t\tids := make([]ent.Value, 0, len(m.work_orders))\n\t\tfor id := range m.work_orders {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase project.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 project.EdgeCreator:\n\t\tif id := m.creator; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0ca35eeee38cca2f57ffbe215e6d9e17", "score": "0.5377778", "text": "func unmarshalOrderIdsRequestBodyRequestBodyToOrderOrderIds(v *OrderIdsRequestBodyRequestBody) *order.OrderIds {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &order.OrderIds{}\n\tif v.OrderID != nil {\n\t\tres.OrderID = make([]string, len(v.OrderID))\n\t\tfor i, val := range v.OrderID {\n\t\t\tres.OrderID[i] = val\n\t\t}\n\t}\n\n\treturn res\n}", "title": "" }, { "docid": "297c3cfc012a1f1eb08c64e1e4d19b03", "score": "0.5358722", "text": "func (m *TeamMutation) 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().Team.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": "80ad7d95714aab85b98378d60dd2c383", "score": "0.53406864", "text": "func WorkflowToIDs(ws []*Workflow) []int64 {\n\tids := make([]int64, len(ws))\n\tfor i := range ws {\n\t\tids[i] = ws[i].ID\n\t}\n\treturn ids\n}", "title": "" }, { "docid": "aa22793ed10d447ba2fe53d97fdb0f61", "score": "0.5326562", "text": "func (pu *ProjectUpdate) RemoveWorkOrders(w ...*WorkOrder) *ProjectUpdate {\n\tids := make([]string, len(w))\n\tfor i := range w {\n\t\tids[i] = w[i].ID\n\t}\n\treturn pu.RemoveWorkOrderIDs(ids...)\n}", "title": "" }, { "docid": "95ee91b80d875f04a7ee288a067a1dd7", "score": "0.5303644", "text": "func (m *CommentMutation) IDs(ctx context.Context) ([]uint64, error) {\n\tswitch {\n\tcase m.op.Is(OpUpdateOne | OpDeleteOne):\n\t\tid, exists := m.ID()\n\t\tif exists {\n\t\t\treturn []uint64{id}, nil\n\t\t}\n\t\tfallthrough\n\tcase m.op.Is(OpUpdate | OpDelete):\n\t\treturn m.Client().Comment.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": "0db014c5f7670bf07a6d447232280be6", "score": "0.53001916", "text": "func (m *TicketMutation) ParentIDs() (ids []int) {\n\tif id := m.parent; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "e242c5e8497280a48b43dd25f4f62709", "score": "0.52866197", "text": "func (m *PetMutation) ToysIDs() (ids []int) {\n\tfor id := range m.toys {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "7469752363c7b83d200d26aeefaa17b8", "score": "0.52759093", "text": "func (fu *FileUpdate) SetWorkOrderID(id int) *FileUpdate {\n\tfu.mutation.SetWorkOrderID(id)\n\treturn fu\n}", "title": "" }, { "docid": "0344bbddbdf35a0e345987dfb04d91e4", "score": "0.527231", "text": "func GetUserWorkOrders(db *sql.DB, u *User) ([]*WorkOrder, error) {\r\n\torderList := []*WorkOrder{}\r\n\r\n\trows, err := db.Query(\r\n\t\t\"SELECT a.id, a.code, a.description, a.start_date, a.end_date, a.state FROM work_orders a, work_order_users b WHERE b.work_order_id = a.id AND b.user_id = ?\",\r\n\t\tu.ID,\r\n\t)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tdefer rows.Close()\r\n\r\n\tfor rows.Next() {\r\n\t\torder := &WorkOrder{}\r\n\t\tif err := rows.Scan(&order.ID, &order.Code, &order.Description, &order.StartDate, &order.EndDate, &order.State); err != nil {\r\n\t\t\treturn nil, err\r\n\t\t}\r\n\t\torderList = append(orderList, order)\r\n\t}\r\n\r\n\treturn orderList, nil\r\n}", "title": "" }, { "docid": "4f89b8ed1de76195f2fc9d8a83c473b2", "score": "0.5267583", "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": "2a75d303fc08c49b77e49e1cb0423d0c", "score": "0.52620834", "text": "func (m *WorkOrderDefinitionMutation) TypeIDs() (ids []int) {\n\tif id := m._type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "6006d10f46f6a4349d57f5789aa73e48", "score": "0.52578956", "text": "func (m *ProjectMutation) TicketsIDs() (ids []int) {\n\tfor id := range m.tickets {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "569786ecf282c3ad8470a450c8fc0ef5", "score": "0.5257707", "text": "func (m *WorkOrderMutation) AddCommentIDs(ids ...int) {\n\tif m.comments == nil {\n\t\tm.comments = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.comments[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "677a0c07423bdd921114594e7c8be603", "score": "0.52543855", "text": "func (m *WorkOrderTypeMutation) RemovedDefinitionsIDs() (ids []int) {\n\tfor id := range m.removeddefinitions {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "fed0c55fbd86435d94671f61bb0da470", "score": "0.5253083", "text": "func (m *ProjectMutation) CommentsIDs() (ids []int) {\n\tfor id := range m.comments {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "797f918731b09dd4c216ad3b58f6959c", "score": "0.5251418", "text": "func (m *WorkOrderMutation) RemovedCommentsIDs() (ids []int) {\n\tfor id := range m.removedcomments {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "3e540c3fcb1d6d38426ffc3592f4516c", "score": "0.5238838", "text": "func (m *GroupMutation) 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().Group.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": "86ce66597fc6190a630896624b936872", "score": "0.522509", "text": "func (m *TaskMutation) AddedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase task.EdgeTeams:\n\t\tids := make([]ent.Value, 0, len(m.teams))\n\t\tfor id := range m.teams {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase task.EdgeOwner:\n\t\tif id := m.owner; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "224e5e00023ec2fea4d43ab450fd32af", "score": "0.52221173", "text": "func (s *state) GuildIDs() []snowflake.Snowflake {\n\tgids := make([]snowflake.Snowflake, 0, len(s.guilds))\n\tfor gid := range s.guilds {\n\t\tgids = append(gids, gid)\n\t}\n\n\treturn gids\n}", "title": "" }, { "docid": "c6f3e827afd9e2bdc9e30658d29c0976", "score": "0.5212631", "text": "func (m *ProjectMutation) LanguagesIDs() (ids []int) {\n\tfor id := range m.languages {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "ea677e0bf28392df370d681cf82fa627", "score": "0.5209372", "text": "func (m *ProjectTypeMutation) AddedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase projecttype.EdgeProjects:\n\t\tids := make([]ent.Value, 0, len(m.projects))\n\t\tfor id := range m.projects {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase projecttype.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 projecttype.EdgeWorkOrders:\n\t\tids := make([]ent.Value, 0, len(m.work_orders))\n\t\tfor id := range m.work_orders {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "182f3c5f2f58c9851813deb506ccd291", "score": "0.5207646", "text": "func (m *LocationMutation) EquipmentIDs() (ids []int) {\n\tfor id := range m.equipment {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "d2b8577569f432b3e026d8c93be58122", "score": "0.52004975", "text": "func (m *RegisterStoreMutation) RequisitionsIDs() (ids []int) {\n\tfor id := range m.requisitions {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "b79cc92a07c111aee00beaa1a9c32d0b", "score": "0.51838285", "text": "func (m *WorkOrderDefinitionMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0a83bea33188999ca39846af67f32f41", "score": "0.5179402", "text": "func (m *TeamMutation) AddedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase team.EdgeTasks:\n\t\tids := make([]ent.Value, 0, len(m.tasks))\n\t\tfor id := range m.tasks {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase team.EdgeUsers:\n\t\tids := make([]ent.Value, 0, len(m.users))\n\t\tfor id := range m.users {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fd628d8a49ffe0403cad21d1a1e360f3", "score": "0.5154646", "text": "func (m *CustomerMutation) BooksIDs() (ids []int) {\n\tfor id := range m.books {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "f39dd88ad6e774b6e6e7a0db029324ae", "score": "0.51544434", "text": "func (puo *ProjectUpdateOne) RemoveWorkOrders(w ...*WorkOrder) *ProjectUpdateOne {\n\tids := make([]string, len(w))\n\tfor i := range w {\n\t\tids[i] = w[i].ID\n\t}\n\treturn puo.RemoveWorkOrderIDs(ids...)\n}", "title": "" }, { "docid": "bca52fa5e6b5aa4b8bfd90b20dc87873", "score": "0.51522744", "text": "func (m *BooksMutation) KidIDs() (ids []int) {\n\tif id := m.kid; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "04aa25ef40ea89b8f32ca492698a5ab1", "score": "0.51352024", "text": "func (m *CustomerMutation) ProblemIDs() (ids []int) {\n\tfor id := range m._Problem {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "55d7a0a9a53fd8f70cfcb2287c798074", "score": "0.5119437", "text": "func (m *UserMutation) RequisitionsIDs() (ids []int) {\n\tfor id := range m.requisitions {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "914dc2a1f8de749f686f6d088d0d6546", "score": "0.51099074", "text": "func (m *EquipmentMutation) PositionsIDs() (ids []int) {\n\tfor id := range m.positions {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" } ]
d05b72bf475649d01ef3f0c9fa52b8bd
Clone performs a deep copy.
[ { "docid": "bdfbd3a5f781be6ee3d1a64cd96c34cf", "score": "0.0", "text": "func (c *ClusterNetworkingConfigV2) Clone() ClusterNetworkingConfig {\n\treturn utils.CloneProtoMsg(c)\n}", "title": "" } ]
[ { "docid": "aa4548d90338dbef0564c1f3042ca7a4", "score": "0.69230545", "text": "func Clone(src, dst interface{}) {\n\tbuffer := new(bytes.Buffer)\n\n\tencoder := gob.NewEncoder(buffer)\n\tencoder.Encode(src)\n\n\tdecoder := gob.NewDecoder(buffer)\n\tdecoder.Decode(dst)\n}", "title": "" }, { "docid": "f920d08d694deb00d2e39b08eea54ad9", "score": "0.6702327", "text": "func (do *DumpOptions) Clone() *DumpOptions {\n\tif do == nil {\n\t\treturn nil\n\t}\n\td := *do\n\treturn &d\n}", "title": "" }, { "docid": "cf881fd8627e2bd26db27496883d77f6", "score": "0.6637163", "text": "func (c *Composite) Clone() data.Clonable {\n\treturn newComposite().Replace(c)\n}", "title": "" }, { "docid": "634c64f6a3d2ec502d72f8806d23f597", "score": "0.66319704", "text": "func (object *Object) Clone(dst interface{}) error {\n\treturn bind(reflect.Indirect(reflect.ValueOf(object)), reflect.Indirect(reflect.ValueOf(dst)))\n}", "title": "" }, { "docid": "3c5ebfae7b76fed9f96759bdd9792d56", "score": "0.6615562", "text": "func (m *M) Clone() *M {\n\tn := New(m.rows, m.cols)\n\tfor i := 0; i < len(m.data); i++ {\n\t\tn.data[i] = m.data[i]\n\t}\n\treturn n\n}", "title": "" }, { "docid": "676a020a1a82be5dc9030b53a1ea11f2", "score": "0.6598864", "text": "func (t *BTree) Clone() *BTree {\n\t// Create two entirely new copy-on-write contexts.\n\t// This operation effectively creates three trees:\n\t// the original, shared nodes (old b.cow)\n\t// the new b.cow nodes\n\t// the new out.cow nodes\n\tcow1, cow2 := *t.cow, *t.cow\n\tout := *t\n\tt.cow = &cow1\n\tout.cow = &cow2\n\treturn &out\n}", "title": "" }, { "docid": "893df6eff5b15d46e9e6b1fd328eaa05", "score": "0.65925294", "text": "func Clone(v interface{}) interface{} {\n\tc := &cloner{}\n\tr := c.Clone(v)\n\treturn r\n}", "title": "" }, { "docid": "e7c523bd66f422dce0bf4e32925f6c83", "score": "0.6591368", "text": "func (t *ImmutableTree) clone() *ImmutableTree {\n\treturn &ImmutableTree{\n\t\troot: t.root,\n\t\tndb: t.ndb,\n\t\tversion: t.version,\n\t\tskipFastStorageUpgrade: t.skipFastStorageUpgrade,\n\t}\n}", "title": "" }, { "docid": "0bc377bc0bc5c2f515d762d2c1085bb5", "score": "0.6573756", "text": "func (t *BTree) Clone() (t2 *BTree) {\n\t// Create two entirely new copy-on-write contexts.\n\t// This operation effectively creates three trees:\n\t// the original, shared nodes (old b.cow)\n\t// the new b.cow nodes\n\t// the new out.cow nodes\n\tcow1, cow2 := *t.cow, *t.cow\n\tout := *t\n\tt.cow = &cow1\n\tout.cow = &cow2\n\treturn &out\n}", "title": "" }, { "docid": "0bc377bc0bc5c2f515d762d2c1085bb5", "score": "0.6573756", "text": "func (t *BTree) Clone() (t2 *BTree) {\n\t// Create two entirely new copy-on-write contexts.\n\t// This operation effectively creates three trees:\n\t// the original, shared nodes (old b.cow)\n\t// the new b.cow nodes\n\t// the new out.cow nodes\n\tcow1, cow2 := *t.cow, *t.cow\n\tout := *t\n\tt.cow = &cow1\n\tout.cow = &cow2\n\treturn &out\n}", "title": "" }, { "docid": "d8440ef41a2c5248d974999514b975e7", "score": "0.65540564", "text": "func Clone(original *testshell.TestRunner, targetDir string) TestRuntime {\n\toriginal.MustRun(\"git\", \"clone\", original.WorkingDir, targetDir)\n\treturn New(targetDir, original.HomeDir, original.BinDir)\n}", "title": "" }, { "docid": "3187913e50700a02b100feb701026155", "score": "0.6534981", "text": "func (b *Board) Clone() Board {\n\n\tioOut := ioutil.Discard\n\tif EnableCloneLogging {\n\t\tioOut = os.Stdout\n\t}\n\n\tcloned := Board{\n\t\ttopPlayer: b.topPlayer,\n\t\tboardLogger: log.New(ioOut, fmt.Sprintf(\"[CLONED-%d]\", b.cloneCount), log.LstdFlags),\n\t}\n\n\tb.Iterate(func(x, y int, p *Pawn) {\n\t\tif p != nil {\n\t\t\tcloned.fields[x][y] = &Pawn{p.Color, p.MovementDirection, p.King}\n\t\t}\n\t})\n\n\tb.cloneCount++\n\treturn cloned\n}", "title": "" }, { "docid": "cdd01df49a6514718352dd39f700b3d3", "score": "0.65180355", "text": "func clone(a, b interface{}) {\n\n\tbuff := new(bytes.Buffer)\n\tenc := gob.NewEncoder(buff)\n\tdec := gob.NewDecoder(buff)\n\tenc.Encode(a)\n\tdec.Decode(b)\n}", "title": "" }, { "docid": "4a543f9efccb912120c03c0f869570dd", "score": "0.65046877", "text": "func TestClone(t *testing.T) {\n\ta := recipe.Recipe{\"a\", 1, []recipe.Ingredient{{\"b\", 1}, {\"c\", 1}}, \"mix\"}\n\tb := a.Clone()\n\n\tif !a.SameAs(&b) {\n\t\tt.Fail()\n\t}\n\n\ta.Ingredients = []recipe.Ingredient{}\n\n\tif a.SameAs(&b) {\n\t\tt.Fail()\n\t}\n}", "title": "" }, { "docid": "2e6c95d6009340cd611795c2a14215f4", "score": "0.64851683", "text": "func (b Board) Clone() Board {\n\tq := New(b.Size)\n\tfor i := 0; i < b.Size; i++ {\n\t\tfor j := 0; j < b.Size; j++ {\n\t\t\tq.Set(i, j, b.Rows[i][j])\n\t\t}\n\t}\n\treturn q\n}", "title": "" }, { "docid": "93378f47b7879dda3f3d89c32c2779fc", "score": "0.64834887", "text": "func (c *Call) Clone() Expression {\n\tlist := cloneExpressionList(c.Args)\n\treturn &Call{F: c.F, Args: list, Distinct: c.Distinct}\n}", "title": "" }, { "docid": "bbc30703b075b99f079f32bd2d5c0665", "score": "0.6475568", "text": "func (opts *LMOpts) Clone() *LMOpts {\n\toptsC := *opts\n\n\treturn &optsC\n}", "title": "" }, { "docid": "3ac92f2c7378851d10d5681a3251a97a", "score": "0.64713746", "text": "func (c *Cache) Clone() model.Part {\n\tc0 := *c\n\treturn &c0\n}", "title": "" }, { "docid": "9db6b9c77f974989188dde2973c18d2c", "score": "0.6470198", "text": "func (m *Matrix2D) Clone() *Matrix2D {\n\ta := m.elements\n\ttmp := [4]float64{a[0], a[1], a[2], a[3]}\n\treturn &Matrix2D{\n\t\telements: tmp,\n\t}\n}", "title": "" }, { "docid": "55d86e3f0a5a7d4400eec1f23b2c93c7", "score": "0.64569235", "text": "func (s *QuickFindSet) Clone() *QuickFindSet {\n\tnew := NewQuickFindSet(s.Size())\n\tcopy(new.ids, s.ids)\n\treturn new\n}", "title": "" }, { "docid": "3cd285f575c46ffecf30195725f12118", "score": "0.6433829", "text": "func (c *configurations) Clone() (copy configurations) {\n\tcopy.committed = c.committed.Clone()\n\tcopy.committedIndex = c.committedIndex\n\tcopy.latest = c.latest.Clone()\n\tcopy.latestIndex = c.latestIndex\n\treturn\n}", "title": "" }, { "docid": "3dfdf464b1566b229222a52d16827d39", "score": "0.6419007", "text": "func (s *Stack) Clone() *Stack {\n\treturn s.clone()\n}", "title": "" }, { "docid": "9e3d958efcc216dd19be7408830e0946", "score": "0.6417668", "text": "func (g *Graph) Clone() (newG *Graph, e error) {\n\n\t// encode\n\tbuf := &bytes.Buffer{}\n\tenc := gob.NewEncoder(buf)\n\n\te = enc.Encode(g)\n\tif e != nil {\n\t\treturn\n\t}\n\n\t// now decode into new graph\n\tdec := gob.NewDecoder(buf)\n\tnewG = New()\n\te = dec.Decode(newG)\n\n\treturn\n}", "title": "" }, { "docid": "0795e72a1afa5e71c403d646e61c1dc5", "score": "0.64094126", "text": "func (x *X) Clone(opts tool.ContextOpts) *X {\n\treturn &X{\n\t\tContext: x.Context.Clone(opts),\n\t\tRoot: x.Root,\n\t\tUsage: x.Usage,\n\t}\n}", "title": "" }, { "docid": "50153ff7221200ddef805fab84680abc", "score": "0.6387038", "text": "func (ms *MoveSlice) Clone() *MoveSlice {\n\tdest := make([]Move, ms.Len(), ms.Cap())\n\tcopy(dest, *ms)\n\treturn (*MoveSlice)(&dest)\n}", "title": "" }, { "docid": "0672bc4513ae6c5ede7f59381d30b753", "score": "0.63859046", "text": "func (m Manifests) Clone() Manifests {\n\treturn NewManifestsFromMap(m.Snapshot())\n}", "title": "" }, { "docid": "e43577aa2e2a97d1d05564baed7d4c08", "score": "0.6373277", "text": "func (X Vector) Clone() gago.Genome {\n\tvar Y = make(Vector, len(X))\n\tcopy(Y, X)\n\treturn Y\n}", "title": "" }, { "docid": "9d9b1757336ef0a4e3133d0ac362a264", "score": "0.63649136", "text": "func (a *Amount) Clone() *Amount {\n\treturn &Amount{\n\t\tWhole: a.Whole,\n\t\tFractional: a.Fractional,\n\t}\n}", "title": "" }, { "docid": "cd4027be24e779221049ebe1cb27cf62", "score": "0.6359217", "text": "func (m Orders) Clone() Orders {\n\tcp := make([]*MarketOrder, len(m))\n\tcopy(cp, m)\n\treturn cp\n}", "title": "" }, { "docid": "04b3763675bd69f4aab95a3dcb06becb", "score": "0.6353461", "text": "func (m *PolicyMatchEntries) Clone(into interface{}) (interface{}, error) {\n\tvar out *PolicyMatchEntries\n\tvar ok bool\n\tif into == nil {\n\t\tout = &PolicyMatchEntries{}\n\t} else {\n\t\tout, ok = into.(*PolicyMatchEntries)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"mismatched object types\")\n\t\t}\n\t}\n\t*out = *(ref.DeepCopy(m).(*PolicyMatchEntries))\n\treturn out, nil\n}", "title": "" }, { "docid": "c6836d6f1cee346298eb7fab6261d74c", "score": "0.6350455", "text": "func (o *FetchOptions) Clone() *FetchOptions {\n\tresult := *o\n\treturn &result\n}", "title": "" }, { "docid": "cdf9f23c1a5e87dea2be616c401fb811", "score": "0.63489103", "text": "func (c *Compiled) Clone() *Compiled {\n\tc.lock.Lock()\n\tdefer c.lock.Unlock()\n\n\tclone := &Compiled{\n\t\tglobalIndexes: c.globalIndexes,\n\t\tbytecode: c.bytecode,\n\t\tglobals: make([]Object, len(c.globals)),\n\t\tmaxAllocs: c.maxAllocs,\n\t}\n\t// copy global objects\n\tfor idx, g := range c.globals {\n\t\tif g != nil {\n\t\t\tclone.globals[idx] = g.Copy()\n\t\t}\n\t}\n\treturn clone\n}", "title": "" }, { "docid": "fcb55bde28b55c656a3ba9c193e0d023", "score": "0.63466126", "text": "func (neural *Neural) Clone() *Neural {\n\tlayers := make([]*Layer, neural.MaxLayers)\n\n\tfor i := 0; i < neural.MaxLayers; i++ {\n\t\tlayers[i] = &Layer{\n\t\t\tInputs: neural.Layers[i].Inputs,\n\t\t\tUnits: neural.Layers[i].Units,\n\t\t\tActivation: neural.Layers[i].Activation,\n\t\t\tRate: neural.Layers[i].Rate,\n\t\t\tMomentum: neural.Layers[i].Momentum,\n\t\t}\n\n\t\tlayers[i].Range = make([][]float64, len(neural.Layers[i].Range))\n\t\tcopy(layers[i].Range, neural.Layers[i].Range)\n\t}\n\n\tclone := NewNeural(layers)\n\n\tfor i := 0; i < neural.MaxLayers; i++ {\n\t\tclone.Layers[i] = neural.Layers[i].Clone()\n\t}\n\n\treturn clone\n}", "title": "" }, { "docid": "698e580d96d59494134863df419a9f3e", "score": "0.63450575", "text": "func (n *Node) clone() *Node {\n\tm := &Node{\n\t\tType: n.Type,\n\t\tDataAtom: n.DataAtom,\n\t\tData: n.Data,\n\t\tAttr: make([]Attribute, len(n.Attr)),\n\t}\n\tcopy(m.Attr, n.Attr)\n\treturn m\n}", "title": "" }, { "docid": "ef3ad7d51572a6d3de067eb9a1a207db", "score": "0.63439286", "text": "func (t *Traversal) Clone() *Traversal {\n\tif t == nil {\n\t\treturn nil\n\t}\n\treturn &Traversal{append(make([]Node, 0, len(t.nodes)), t.nodes...)}\n}", "title": "" }, { "docid": "8ffbb33dae4b34500b5e871b420efd70", "score": "0.63432264", "text": "func (o *BinaryOperation) Clone() Expression {\n\tl := o.L.Clone()\n\tr := o.R.Clone()\n\treturn NewBinaryOperation(o.Op, l, r)\n}", "title": "" }, { "docid": "eba7aac54b04ce77233db2395931eb5c", "score": "0.6338616", "text": "func (l *UniqueItem) Clone() token.Token {\n\tn := &UniqueItem{\n\t\toriginal: l.original,\n\t\tlist: nil,\n\t\tpicked: nil,\n\n\t\tindex: -1,\n\t}\n\n\treturn n\n}", "title": "" }, { "docid": "0f17d51daca660cdef6a8f0273bfa62e", "score": "0.63348526", "text": "func (moves Sequence) Clone() Sequence {\n\tclone := make(Sequence, len(moves))\n\tcopy(clone, moves)\n\treturn clone\n}", "title": "" }, { "docid": "47d51c1f64b202d3ba6f42038c6b68a7", "score": "0.63336504", "text": "func (a ItemS) Clone() ItemS {\n\tc := make([]Item, len(a))\n\tcopy(c, a)\n\treturn c\n}", "title": "" }, { "docid": "8e23253df06a07ea87fe4705437c574c", "score": "0.6331715", "text": "func (c Container) Clone() Container {\n\tentries := map[*Rank]interface{}{}\n\tfor r, v := range c.Entries {\n\t\tentries[r] = v\n\t}\n\tundos := map[*Rank]int{}\n\tfor r, u := range c.Undos {\n\t\tundos[r] = u\n\t}\n\treturn Container{Entries: entries, Undos: undos, Deleted: c.Deleted}\n}", "title": "" }, { "docid": "34a645615e22a3abd581d29608a79245", "score": "0.6324043", "text": "func ShallowClone(v any) any {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tval := reflect.ValueOf(v)\n\n\tt := val.Type()\n\tswitch t.Kind() {\n\tcase reflect.Slice:\n\t\tif val.IsNil() {\n\t\t\treturn reflect.Zero(t).Interface() // don't allocate for zero values\n\t\t}\n\n\t\tsize := val.Len()\n\t\tret := reflect.MakeSlice(t, size, size)\n\t\tfor i := 0; i < size; i++ {\n\t\t\tret.Index(i).Set(val.Index(i))\n\t\t}\n\t\treturn ret.Interface()\n\n\tcase reflect.Map:\n\t\tif val.IsNil() {\n\t\t\treturn reflect.Zero(t).Interface() // don't allocate for zero values\n\t\t}\n\n\t\tret := reflect.MakeMapWithSize(t, val.Len())\n\t\tkeys := val.MapKeys()\n\t\tfor _, key := range keys {\n\t\t\tret.SetMapIndex(key, val.MapIndex(key))\n\t\t}\n\t\treturn ret.Interface()\n\n\tcase reflect.Array, reflect.Chan, reflect.Interface, reflect.Func, reflect.Invalid:\n\t\tpanic(fmt.Sprintf(\"unsupported type for clone: %v\", t))\n\n\tdefault:\n\t\treturn v\n\t}\n}", "title": "" }, { "docid": "deb75bc5d4f57328d1245b6bf534dd6e", "score": "0.6321075", "text": "func (f *FieldDescs) Clone() FieldDescs {\n\tif f == nil || len(f.fields) == 0 {\n\t\treturn FieldDescs{}\n\t}\n\tf2 := NewFieldDescs(len(f.fields))\n\tf2.fields = f2.fields[:len(f.fields)]\n\tcopy(f2.fields, f.fields)\n\tfor k, v := range f.m {\n\t\tf2.m[k] = v\n\t}\n\treturn f2\n}", "title": "" }, { "docid": "4188dfee4b896016b43855fc4e72e3c8", "score": "0.6311557", "text": "func (dn *DN) Clone() *DN {\n\tc := &DN{}\n\tfor _, r := range dn.RDNs {\n\t\trc, _ := NewRDN()\n\t\tfor _, tv := range r.Attributes {\n\t\t\trc.Attributes = append(rc.Attributes, &ldap.AttributeTypeAndValue{Type: tv.Type, Value: tv.Value})\n\t\t}\n\t\tc.RDNs = append(c.RDNs, rc)\n\t}\n\treturn c\n}", "title": "" }, { "docid": "24b18664f4cdf4e45cf426ca2238a21f", "score": "0.63055706", "text": "func (set *Set) clone() *Set {\n\tvar newkids []*Set\n\tif set.kids != nil {\n\t\tnewkids = make([]*Set, ARITY)\n\t\tcopy(newkids, set.kids)\n\t}\n\tcs := &Set{\n\t\tval: set.val,\n\t\tfull: set.full,\n\t\tkids: newkids,\n\t\tsize: set.size,\n\t}\n\treturn cs\n}", "title": "" }, { "docid": "2851bebe97560a7207376205033563e3", "score": "0.63021094", "text": "func (dp DevPlumbing) Clone(stream stream.IOStream, remoteURI, clonePath string, extraargs ...string) error {\n\treturn dp.Plumbing.Clone(dp.stream(stream), dp.Forward(remoteURI), clonePath, extraargs...)\n}", "title": "" }, { "docid": "cefb61148666f568c86985763c9fedf9", "score": "0.6299049", "text": "func (mat TwoDimMatrix) Clone(matDef MatrixDef) Matrix {\n\tx0, y0, x1, y1, length := matDef.Coords.X0, matDef.Coords.Y0, matDef.Coords.X1, matDef.Coords.Y1, matDef.Size\n\n\tclone := make(TwoDimMatrix, length)\n\tfor i := x0; i <= x1; i++ {\n\t\tclone[i-x0] = make(row, length)\n\t\tfor j := y0; j <= y1; j++ {\n\t\t\tclone.SetCell(i-x0, j-y0, mat.GetCell(i, j))\n\t\t}\n\t}\n\n\treturn clone\n}", "title": "" }, { "docid": "171ca18ba74e057e3c6665a1bee25ce4", "score": "0.62887347", "text": "func (src *Match) Clone() *Match {\n\tif src == nil {\n\t\treturn nil\n\t}\n\tdst := new(Match)\n\t*dst = *src\n\tdst.IPProto = append(src.IPProto[:0:0], src.IPProto...)\n\tdst.Srcs = append(src.Srcs[:0:0], src.Srcs...)\n\tdst.Dsts = append(src.Dsts[:0:0], src.Dsts...)\n\tdst.Caps = append(src.Caps[:0:0], src.Caps...)\n\treturn dst\n}", "title": "" }, { "docid": "9437b6419b946d588c1de30ce2945808", "score": "0.62881136", "text": "func (n *Network) Clone(dst *Network) {\r\n\tdefer dst.sort()\r\n\tdst.clear()\r\n\r\n\t// Copy the nodes into the destination\r\n\tdst.input = n.input\r\n\tdst.output = n.output\r\n\tfor _, v := range n.nodes {\r\n\t\tdst.nodes = append(dst.nodes, neuron{\r\n\t\t\tSerial: v.Serial,\r\n\t\t\tKind: v.Kind,\r\n\t\t})\r\n\t}\r\n\r\n\t// Sort the destination nodes so we can find the corresponding ones\r\n\tsort.Sort(dst.nodes)\r\n\tfor _, v := range n.conns {\r\n\t\tdst.conns = append(dst.conns, synapse{\r\n\t\t\tFrom: dst.nodes.Find(v.From.Serial),\r\n\t\t\tTo: dst.nodes.Find(v.To.Serial),\r\n\t\t\tWeight: v.Weight,\r\n\t\t\tActive: v.Active,\r\n\t\t})\r\n\t}\r\n}", "title": "" }, { "docid": "35b8f246035c3d4b41b4dbcf2f0493fa", "score": "0.6278819", "text": "func (rc *RecordCollection) clone() *RecordCollection {\n\trSet := *rc\n\tres := &rSet\n\tres.query = rc.query.clone(res)\n\treturn res\n}", "title": "" }, { "docid": "a5aa3bbe84acf9e5cd0b492f8a41a23a", "score": "0.6273773", "text": "func (c *Call) Clone() *Call {\n\tif c == nil {\n\t\treturn nil\n\t}\n\n\tother := &Call{\n\t\tName: c.Name,\n\t\tArgs: CopyArgs(c.Args),\n\t}\n\tif c.Children != nil {\n\t\tother.Children = make([]*Call, len(c.Children))\n\t\tfor i := range c.Children {\n\t\t\tother.Children[i] = c.Children[i].Clone()\n\t\t}\n\t}\n\t// @seebs \"...it should be safe,\n\t// because nothing should be writing to Precomputed\n\t// once it's gotten created in the first place.\"\n\tother.Precomputed = c.Precomputed\n\n\treturn other\n}", "title": "" }, { "docid": "6a7d76b105b19fc64c8489f5e6957f4b", "score": "0.6271688", "text": "func (p Pointer) Clone(offset, size int) Pointer {\n\tclone := Alloc(uintptr(size))\n\tp.Copy(offset, size, clone)\n\treturn clone\n}", "title": "" }, { "docid": "bcaf52ff792f96a80946507fe113ec21", "score": "0.62666404", "text": "func (c *state) Clone() *state {\n\treturn &state{\n\t\tl: c.l,\n\t\th: c.h,\n\t\trounds: c.rounds,\n\t\tdirection: c.direction,\n\t}\n}", "title": "" }, { "docid": "79c3f38e5148db6abbf7b677c8783a70", "score": "0.6263565", "text": "func (c Collection) Clone() Collection {\n\tif c == nil {\n\t\treturn nil\n\t}\n\n\tnc := make(Collection, len(c))\n\tfor i, g := range c {\n\t\tnc[i] = Clone(g)\n\t}\n\n\treturn nc\n}", "title": "" }, { "docid": "61f411fb8e921b8efc852c2edc938753", "score": "0.6262218", "text": "func (d *XDatasetCollection) Clone() XDatasetCollectionDef {\n\tcloned := &XDatasetCollection{}\n\tfor _, val := range *d {\n\t\t*cloned = append(*cloned, val.Clone())\n\t}\n\treturn cloned\n}", "title": "" }, { "docid": "d78616acc34ccd3faf50f15d27aed4d3", "score": "0.62621266", "text": "func (c *Code) Clone() interface{} {\n\treturn &Code{\n\t\tHead: append([]string(nil), c.Head...),\n\t\tBody: append([]string(nil), c.Body...),\n\t\tTail: append([]string(nil), c.Tail...),\n\t\tchansRd: c.chansRd,\n\t\tchansWr: c.chansWr,\n\t}\n}", "title": "" }, { "docid": "86182977ccedd5721ca203b98a5a73c0", "score": "0.6259755", "text": "func (d *Dialer) Clone() (d2 *Dialer, err error) {\n\td2, err = New(d.Username, d.Password, d.Host, d.Port)\n\t// d2.Verbose = d1.Verbose\n\tif d.Folder != \"\" {\n\t\terr = d2.SelectFolder(d.Folder)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"imap clone: %s\", err)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "15caad2df037a363f02f0c359bbbfdf9", "score": "0.6258515", "text": "func (c Cloner) Clone(v interface{}) interface{} {\n\treturn clone(c.allocator, v)\n}", "title": "" }, { "docid": "59223f44a1b05d7f38a4be12795a394c", "score": "0.6237988", "text": "func (c *CheckState) Clone() *CheckState {\n\tc2 := new(CheckState)\n\t*c2 = *c\n\treturn c2\n}", "title": "" }, { "docid": "94cde5dbbd405a5b08a83f3a34f97479", "score": "0.6234918", "text": "func (as ContainerMemoryAssignments) Clone() ContainerMemoryAssignments {\n\tret := ContainerMemoryAssignments{}\n\tfor key, val := range as {\n\t\tret[key] = val.Clone()\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "3833a8357bbab445a0fcf85afa5f4b0e", "score": "0.6222688", "text": "func (c *Collection) Clone(cloneName string, keys []string, verbose bool) error {\n\tif len(keys) == 0 {\n\t\treturn fmt.Errorf(\"Zero keys clone from %s to %s\", c.Name, cloneName)\n\t}\n\tclone, err := InitCollection(cloneName)\n\tif err != nil {\n\t\treturn err\n\t}\n\ti := 0\n\tfor _, key := range keys {\n\t\tsrc, err := c.ReadJSON(key)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = clone.CreateJSON(key, src)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ti++\n\t\tif verbose && (i%100) == 0 {\n\t\t\tlog.Printf(\"%d objects processed\\n\", i)\n\t\t}\n\t}\n\tif verbose {\n\t\tlog.Printf(\"%d total objects processed\\n\", i)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7ed936418fe957fc06c1d7f0640e55ea", "score": "0.6217751", "text": "func (m *Matrix) Clone() *Matrix {\n\tc := &Matrix{\n\t\trows: m.rows,\n\t\tcols: m.cols,\n\t\tdata: make([]float64, m.rows*m.cols),\n\t}\n\tcopy(c.data, m.data)\n\treturn c\n}", "title": "" }, { "docid": "34358f3e018cdc56af60ce6704fbb070", "score": "0.6210417", "text": "func (r *Record) Clone(dst sql.Record) sql.Record {\n\tother, ok := dst.(*Record)\n\tif !ok {\n\t\tother = &Record{}\n\t}\n\tother.object = r.object\n\treturn other\n}", "title": "" }, { "docid": "312ed9c4fd88b8abcb2bc1a06fde0b76", "score": "0.62096137", "text": "func (s *state) Clone() *state {\n\treturn newStateFromProto(s.toProto())\n}", "title": "" }, { "docid": "9bffe22b8088096dd9f9f36033f0d50f", "score": "0.62095624", "text": "func (sg State) Clone() State {\n\treturn State(ClickBoard(sg).Clone())\n}", "title": "" }, { "docid": "dd38423a90ac69b60a7d4ba2b7153dd8", "score": "0.62072283", "text": "func (h Headers) Clone() Headers {\n\tr := make(Headers, len(h))\n\tcopy(r, h)\n\treturn r\n}", "title": "" }, { "docid": "a46d0800c4c3a0223eff024fee42a911", "score": "0.62064046", "text": "func (d *Dna) Clone() *Dna {\n\tdn := NewDna()\n\tfor i := 0; i < len(d.sequence); i++ {\n\t\tdn.AddGene(NewGene(d.sequence[i].Unpack()))\n\t}\n\treturn dn\n}", "title": "" }, { "docid": "edad4e1c7f2bea208d586f0f5066a5da", "score": "0.620038", "text": "func (t TestExp) DeepCopy() TestExp {\n\tret := make(TestExp, len(t))\n\tfor testName, digests := range t {\n\t\tret.AddDigests(testName, digests)\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "ad1465d9f577e098c40f244fcc9f5243", "score": "0.6185688", "text": "func (b *Builder) Clone() *Builder {\n\tret := *b\n\tret.consumables = make([]*ConsumableOutput, len(b.consumables))\n\tret.outputs = make([]ledgerstate.Output, len(b.outputs))\n\tret.consumedUnspent = make(map[ledgerstate.Color]uint64)\n\tfor i := range ret.consumables {\n\t\tret.consumables[i] = b.consumables[i].Clone()\n\t}\n\tfor i := range ret.outputs {\n\t\tret.outputs[i] = b.outputs[i].Clone()\n\t}\n\tfor col, bal := range b.consumedUnspent {\n\t\tret.consumedUnspent[col] = bal\n\t}\n\treturn &ret\n}", "title": "" }, { "docid": "d6279bdc878dd167812bab1090c7ce6d", "score": "0.6185597", "text": "func (p *Pattern) Clone() *Pattern {\n\tclone := *p\n\tclone.m = &matcher{}\n\t*clone.m = *p.m\n\treturn &clone\n}", "title": "" }, { "docid": "9f316942571840f9c1db2b9d2643241e", "score": "0.61827314", "text": "func Clone(from interface{}) (interface{}, error) {\n\tif from == nil {\n\t\treturn nil, nil\n\t}\n\tswitch x := from.(type) {\n\tcase uint8, uint16, uint32, uint64, float32, float64,\n\t\tint16, int8, bool, string, int, int64, int32,\n\t\tmysql.Time, mysql.Duration, mysql.Decimal,\n\t\tmysql.Hex, mysql.Bit, mysql.Enum, mysql.Set:\n\t\treturn x, nil\n\tcase []byte:\n\t\ttarget := make([]byte, len(from.([]byte)))\n\t\tcopy(target, from.([]byte))\n\t\treturn target, nil\n\tcase []interface{}:\n\t\tvar r []interface{}\n\t\tfor _, v := range from.([]interface{}) {\n\t\t\tvv, err := Clone(v)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tr = append(r, vv)\n\t\t}\n\t\treturn r, nil\n\tdefault:\n\t\treturn nil, errors.Errorf(\"Clone invalid type %T\", from)\n\t}\n}", "title": "" }, { "docid": "0a9ea4e5e9fd4e99873cce15804df204", "score": "0.6177551", "text": "func (m Metadata) Clone() Metadata {\n\tmd := make(Metadata, len(m))\n\tfor k, v := range m {\n\t\tmd[k] = v\n\t}\n\treturn md\n}", "title": "" }, { "docid": "bb1ab85e4348be21de82ff7ad721af94", "score": "0.6169916", "text": "func Clone(r Result) Result {\n\tif cl, ok := r.(interface{ Clone() Result }); ok {\n\t\treturn cl.Clone()\n\t}\n\tif res, ok := r.(*result); ok {\n\t\tnewProto := proto.Clone(res.proto).(*descriptorpb.FileDescriptorProto) //nolint:errcheck\n\t\tnewNodes := make(map[proto.Message]ast.Node, len(res.nodes))\n\t\tnewResult := &result{\n\t\t\tfile: res.file,\n\t\t\tproto: newProto,\n\t\t\tnodes: newNodes,\n\t\t}\n\t\trecreateNodeIndexForFile(res, newResult, res.proto, newProto)\n\t\treturn newResult\n\t}\n\n\t// Can't do the deep-copy we know how to do. So we have to take a\n\t// different tactic.\n\tif r.AST() == nil {\n\t\t// no AST? all we have to do is copy the proto\n\t\tfileProto := proto.Clone(r.FileDescriptorProto()).(*descriptorpb.FileDescriptorProto) //nolint:errcheck\n\t\treturn ResultWithoutAST(fileProto)\n\t}\n\t// Otherwise, we have an AST, but no way to clone the result's\n\t// internals. So just re-create them from scratch.\n\tres, err := ResultFromAST(r.AST(), false, reporter.NewHandler(nil))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn res\n}", "title": "" }, { "docid": "49ca9307dcab27703cebe2109e67925b", "score": "0.6162798", "text": "func (b bindings) clone() bindings {\n\tout := make(bindings, len(b))\n\tfor k, v := range b {\n\t\tout[k] = v\n\t}\n\treturn out\n}", "title": "" }, { "docid": "a8d05017248cf4a52f0ac12d5d836cca", "score": "0.61594343", "text": "func (p Product) Clone() *Product {\n\tmats := make([]*Product, len(p.Materials))\n\tfor k, m := range p.Materials {\n\t\tmats[k] = m.Clone()\n\t}\n\treturn &Product{\n\t\tTypeID: p.TypeID,\n\t\tMaterials: mats,\n\t\tQuantity: p.Quantity,\n\t\tMarketPrice: p.MarketPrice,\n\t\tMarketRegionID: p.MarketRegionID,\n\t\tMaterialEfficiency: p.MaterialEfficiency,\n\t\tBatchSize: p.BatchSize,\n\t\tKind: p.Kind,\n\t\tCorporationID: p.CorporationID,\n\t}\n}", "title": "" }, { "docid": "434335b2470beffee751b37a7e6107bb", "score": "0.61503613", "text": "func (l *LinkList) Clone() *LinkList {\n\tnewList := New()\n\tif atomic.LoadInt64(l.len) == 0 {\n\t\treturn newList\n\t}\n\tl.RLock()\n\tdefer l.RUnlock()\n\tp := l.root.next\n\tfor {\n\t\tif p == nil {\n\t\t\tbreak\n\t\t}\n\t\tnewList.PushBack(p.Value)\n\t\tp = p.Next()\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "d40156a793f92d819464f991d4abb859", "score": "0.6149658", "text": "func (o *Array) Clone() Object {\n\tvar v []Object\n\tfor _, el := range o.Value {\n\t\tv = append(v, el.Clone())\n\t}\n\treturn &Array{Value: v}\n}", "title": "" }, { "docid": "e60fbb5765e3c552b10fa8d2a4e15e8c", "score": "0.6139616", "text": "func (p Project) Clone() Project {\n\tvar (\n\t\tstages = make([]Stage, len(p.Stages))\n\t\tfinalized = make([]Ticket, len(p.Finalized))\n\t)\n\tcopy(finalized, p.Finalized)\n\tfor ii, s := range p.Stages {\n\t\ttickets := make([]Ticket, len(s.Tickets))\n\t\tcopy(tickets, s.Tickets)\n\t\tstages[ii] = Stage{\n\t\t\tName: s.Name,\n\t\t\tTickets: tickets,\n\t\t}\n\t}\n\treturn Project{\n\t\tID: p.ID,\n\t\tName: p.Name,\n\t\tStages: stages,\n\t\tFinalized: finalized,\n\t}\n}", "title": "" }, { "docid": "3e744fe97b6a22f270743a5f2277fe11", "score": "0.61383414", "text": "func (m *Item) Clone(into interface{}) (interface{}, error) {\n\tvar out *Item\n\tvar ok bool\n\tif into == nil {\n\t\tout = &Item{}\n\t} else {\n\t\tout, ok = into.(*Item)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"mismatched object types\")\n\t\t}\n\t}\n\t*out = *(ref.DeepCopy(m).(*Item))\n\treturn out, nil\n}", "title": "" }, { "docid": "619fcacbeb6a9af22b4a68fd276cfd66", "score": "0.6135191", "text": "func (s *TestShell) Clone() Shell {\n\ts.Called()\n\treturn s\n}", "title": "" }, { "docid": "65b2fc4be920ca9b1624e8f642cba03a", "score": "0.6132592", "text": "func (s *Set) Clone() *Set {\n\ts0 := EmptySet(s.setType)\n\tfor e := range s.Iter() {\n\t\ts0.Add(e)\n\t}\n\treturn s0\n}", "title": "" }, { "docid": "4c23157e63ffda324145180067df53d1", "score": "0.6126492", "text": "func (ctx *Context) clone() *Context {\n\tclone := CreateContext()\n\t// basic types so they're auto immutable\n\tclone.Root = ctx.Root\n\tclone.Cwd = ctx.Cwd\n\tclone.Shell = ctx.Shell\n\tclone.Home = ctx.Home\n\n\t// fields that should be shared across all instances\n\t// NOTE These aren't modifiable.\n\tclone.Bots = ctx.Bots\n\tclone.DirChan = ctx.DirChan\n\tclone.OnlyDirectives = ctx.OnlyDirectives\n\tclone.ExceptDirectives = ctx.ExceptDirectives\n\tclone.imports = ctx.imports\n\n\t// Fields that are expected to be mutated at different points.\n\t_cloneDirectiveOpts(ctx.mkdirOpts, clone.mkdirOpts)\n\t_cloneDirectiveOpts(ctx.linkOpts, clone.linkOpts)\n\t_cloneDirectiveOpts(ctx.cleanOpts, clone.cleanOpts)\n\t_cloneDirectiveOpts(ctx.shellOpts, clone.shellOpts)\n\t_cloneDirectiveOpts(ctx.packageOpts, clone.packageOpts)\n\tfor key, value := range ctx.envOpts {\n\t\tclone.envOpts[key] = value\n\t}\n\n\treturn clone\n}", "title": "" }, { "docid": "6b6811563f45b92976568fc3d06bce93", "score": "0.6117396", "text": "func (me *Tree) Copy() *Tree {\n\tnewTree := NewTree()\n\tnewTree.Root = me.Root\n\tif me.Root == nil {\n\t\treturn newTree\n\t}\n\tnewTree.Root = me.Root.Copy()\n\treturn newTree\n}", "title": "" }, { "docid": "0d946ca25a7ab99912ddf46c051af55b", "score": "0.61166406", "text": "func (r *TunnelConnectionV2) Clone() TunnelConnection {\n\tout := *r\n\treturn &out\n}", "title": "" }, { "docid": "9ac4a0568a9aa6426bf9a40f54f6b503", "score": "0.6116399", "text": "func (gb *Board) Clone() *Board {\n\tret := NewBoard()\n\tret.Points = gb.Points.Clone()\n\tret.Lines = gb.Lines.Clone()\n\tret.Circles = gb.Circles.Clone()\n\tret.HalfLines = gb.HalfLines.Clone()\n\tret.Segments = gb.Segments.Clone()\n\tret.seqLen = gb.seqLen\n\tcopy(ret.geomType, gb.geomType)\n\tcopy(ret.geomID, gb.geomID)\n\tfor i := 0; i < configs.MaxSequenceLength; i++ {\n\t\tcopy(ret.geomPoints[i], gb.geomPoints[i])\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "4c7e860432f3a8a6a82e096d3e15d26d", "score": "0.6108721", "text": "func (m *Matcher) Clone() *Matcher {\n\treturn &Matcher{m: m.m}\n}", "title": "" }, { "docid": "a1edf32e930dc1c1740e56c2c0451864", "score": "0.6108429", "text": "func (a *Artifact) Clone() (b *Artifact) {\n\treturn &Artifact{\n\t\tBucket: a.Bucket[:],\n\t\tKey: a.Key[:],\n\t\tHash: a.Hash[:],\n\t\tLocal: a.Local[:],\n\t\tMutable: a.Mutable,\n\t\tUnpack: a.Unpack,\n\t\tQualified: a.Qualified[:],\n\t}\n}", "title": "" }, { "docid": "88a6f468b41517dd421d226e0da009c4", "score": "0.61053884", "text": "func (i *Instance) Clone() *Instance {\n\ti.mutex.RLock()\n\tvj := *i\n\tvj.mutex = new(sync.RWMutex)\n\tif vj.next != nil {\n\t\tvj.next = vj.next.Clone()\n\t}\n\ti.mutex.Unlock()\n\treturn &vj\n}", "title": "" }, { "docid": "51c7f0db5ea19d44246535c3dba09b51", "score": "0.61037034", "text": "func (m *Model) Clone() *Model {\n\tcp := &Model{\n\t\tType: m.Type,\n\t\tName: m.Name,\n\t\tVars: make([]*Variable, len(m.Vars)),\n\t\tFuncs: make([]*Function, len(m.Funcs)),\n\t}\n\n\tfor i, v := range m.Vars {\n\t\tcp.Vars[i] = v.Clone()\n\t}\n\n\tfor i, f := range m.Funcs {\n\t\tcp.Funcs[i] = f.Clone()\n\t}\n\n\treturn cp\n}", "title": "" }, { "docid": "7274360d96102c12917b992bd181e184", "score": "0.6101581", "text": "func (tree *BinarySearchTree) clone() BinarySearchTree {\n\tnewTree := BinarySearchTree{}\n\tif tree.item != nil {\n\t\tnewTree.item = tree.item\n\t}\n\tif tree.left != nil {\n\t\tnewTree.left = tree.left.clone()\n\t}\n\tif tree.right != nil {\n\t\tnewTree.right = tree.right.clone()\n\t}\n\treturn newTree\n}", "title": "" }, { "docid": "4f9ed3bd5206c239f8a74ccc1983a769", "score": "0.60998416", "text": "func (opts Options) clone() (result Options) {\n\tresult = make(Options)\n\tfor k, v := range opts {\n\t\tresult[k] = v\n\t}\n\treturn\n}", "title": "" }, { "docid": "0dfe560f15563a21aa5f2aa41989cb82", "score": "0.60987395", "text": "func (l Value) Clone() Expression {\n\treturn Value{Val: l.Val}\n}", "title": "" }, { "docid": "f5493b219ed8a305225f9d07456581ae", "score": "0.6097846", "text": "func (t *Topology) Copy() *Topology {\n\tvar children [][]NodeId\n\tif len(t.Children) != 0 {\n\t\tchildren = make([][]NodeId, len(t.Children))\n\t\tfor i := range t.Children {\n\t\t\t// Only create a slice for internal nodes\n\t\t\tif len(t.Children[i]) != 0 {\n\t\t\t\tchildren[i] = make([]NodeId, len(t.Children[i]))\n\t\t\t\tcopy(children[i], t.Children[i])\n\t\t\t}\n\t\t}\n\t}\n\treturn &Topology{t.Root, children, nil}\n}", "title": "" }, { "docid": "044fb41baa16b6ffb279b3d9e9cb9939", "score": "0.6094926", "text": "func (s Set) Clone() Set {\n\tsl := s.GetElements()\n\treturn InstantiateSet(sl...)\n}", "title": "" }, { "docid": "2149dd55665998b31789ca4086581191", "score": "0.6091361", "text": "func (t *Template) Clone() *Template {\n\tt2 := &Template{\n\t\tInput: t.Input,\n\t\tprogram: t.program,\n\t}\n\treturn t2\n}", "title": "" }, { "docid": "b62ccc885bb6909a16e8250291d8b413", "score": "0.6084116", "text": "func (v DenseBareRealVector) Clone() DenseBareRealVector {\n result := make(DenseBareRealVector, len(v))\n for i, _ := range v {\n result[i] = *v[i].Clone()\n }\n return result\n}", "title": "" }, { "docid": "fc54e79f2a9585935e7e20d5480b0c8c", "score": "0.60838234", "text": "func (mvcc *MVCC) Clone(name string) *MVCC {\n\tif !mvcc.rlock() {\n\t\treturn nil\n\t}\n\tdefer mvcc.runlock()\n\n\tnewmvcc := NewMVCC(mvcc.name, mvcc.setts)\n\tnewmvcc.lock()\n\tdefer newmvcc.unlock()\n\n\twsnap := mvcc.writesnapshot()\n\n\tnewmvcc.seqno = atomic.LoadUint64(&mvcc.seqno)\n\tnewmvcc.setroot(newmvcc.clonetree(wsnap.getroot()))\n\n\tnewmvcc.clonestats(mvcc.stats())\n\tnewmvcc.h_reclaims = mvcc.h_reclaims.Clone()\n\tfunc() {\n\t\tmvcc.rwhbf.RLock()\n\t\tdefer mvcc.rwhbf.RUnlock()\n\t\tnewmvcc.h_bulkfree = mvcc.h_bulkfree.Clone()\n\t}()\n\n\twsnap.release()\n\n\treturn newmvcc\n}", "title": "" }, { "docid": "b965df402cb3c17d4952addea9fe48cc", "score": "0.6082751", "text": "func (c *Cell) Clone() *Cell {\n\treturn &Cell{\n\t\tKey: c.Key.Clone(),\n\t\tDigest: c.Digest,\n\t\tCount: c.Count,\n\t}\n}", "title": "" }, { "docid": "7b0cb30ae00eb46b662446e69f4258b7", "score": "0.6079985", "text": "func (o *Dict) Clone() Object {\n\tp := make(map[string]Object)\n\tfor k, v := range o.Value {\n\t\tp[k] = v.Clone()\n\t}\n\treturn &Dict{Value: o.Value}\n}", "title": "" }, { "docid": "56453b8ce29ecf243615efa3ac73213b", "score": "0.607805", "text": "func (o *Bool) Clone() Object {\n\treturn &Bool{Value: o.Value}\n}", "title": "" }, { "docid": "d7a39f89a74945804906744a99a93449", "score": "0.6072428", "text": "func (s *Sparse) Clone() Matrix {\n\treturn NewSparse(s.rows, s.cols, s.Data())\n}", "title": "" }, { "docid": "8a2979ff8ac4939e3e1af6cd3000993b", "score": "0.60689896", "text": "func (t *tree) clone() *tree {\n\tnewTree := new(tree)\n\tnewTree.Root = &treeNode{\n\t\tNode{\n\t\t\t\"/\",\n\t\t\ttime.Unix(0, 0),\n\t\t\tnil,\n\t\t},\n\t\ttrue,\n\t\tmake(map[string]*treeNode),\n\t}\n\trecursiveClone(t.Root, newTree.Root)\n\treturn newTree\n}", "title": "" } ]
6a2311c2014a018a6a6ee8858fc55667
Deprecated: Use ServerCommands.ProtoReflect.Descriptor instead.
[ { "docid": "98ccf3faa0f4008ecc7f8e795829774f", "score": "0.68223953", "text": "func (*ServerCommands) Descriptor() ([]byte, []int) {\n\treturn file_pkg_playstore_playstore_proto_rawDescGZIP(), []int{131}\n}", "title": "" } ]
[ { "docid": "74ec650f09714ff2a7711eadf8c6acf3", "score": "0.6955099", "text": "func (*DnsCommandRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_AdminService_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "e0109989b09c91519aad5c225d40b901", "score": "0.67993426", "text": "func (*DnsCommandResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_AdminService_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "4b6795eac12a7966cdf6c8aacd0abbab", "score": "0.6766945", "text": "func (desc *immutable) DescriptorProto() *descpb.Descriptor {\n\treturn &descpb.Descriptor{\n\t\tUnion: &descpb.Descriptor_Database{\n\t\t\tDatabase: &desc.DatabaseDescriptor,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "6d0c92638e8cdc425288beb203f1d4ed", "score": "0.676578", "text": "func (*UpdateMethodDescriptorRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "bd243be557ad16f5f58d1ecbbfd6d3cb", "score": "0.67407674", "text": "func (*Command) Descriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_protobuf_failure_details_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "6eb082d6a50273e8ba9c827ee6277d6e", "score": "0.67387927", "text": "func (*WatchMethodDescriptorRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "d7911141070d21f352d7f9c648cd7880", "score": "0.671555", "text": "func (*InfoCommand) Descriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_protobuf_failure_details_proto_rawDescGZIP(), []int{23}\n}", "title": "" }, { "docid": "67afee121021d1e86fa5c7384933b71d", "score": "0.6704512", "text": "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{244}\n}", "title": "" }, { "docid": "00b2e0885fe143b258d95aa2cd795347", "score": "0.66673535", "text": "func (*BotCommands) Descriptor() ([]byte, []int) {\n\treturn file_core_types_proto_rawDescGZIP(), []int{21}\n}", "title": "" }, { "docid": "dbccd8a8eee5f93f6f1729887cd78463", "score": "0.6661712", "text": "func (*WatchMethodDescriptorResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "8029c5a959b3e75d5f45399cec44b374", "score": "0.66530865", "text": "func (Command_Code) EnumDescriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_protobuf_failure_details_proto_rawDescGZIP(), []int{19, 0}\n}", "title": "" }, { "docid": "f7569b136bc56d52e3fb159220efff4d", "score": "0.66406214", "text": "func (*DeprecateDomainRequest) Descriptor() ([]byte, []int) {\n\treturn file_uber_cadence_api_v1_service_domain_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "084e47b43be686bc9b2533bcfc21e51a", "score": "0.6640161", "text": "func (*WatchMethodDescriptorsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "822cbe3d88bbe2040e316d3d7e8bcf10", "score": "0.66338754", "text": "func (*VersionCommand) Descriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_protobuf_failure_details_proto_rawDescGZIP(), []int{43}\n}", "title": "" }, { "docid": "87c7280891b1aca0d041d2eb7a853f7e", "score": "0.66319734", "text": "func (HelpCommand_Code) EnumDescriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_protobuf_failure_details_proto_rawDescGZIP(), []int{39, 0}\n}", "title": "" }, { "docid": "89bd36cace175269277de57652094f97", "score": "0.6626847", "text": "func (VersionCommand_Code) EnumDescriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_protobuf_failure_details_proto_rawDescGZIP(), []int{43, 0}\n}", "title": "" }, { "docid": "75b42252da1835785276301b93a741bd", "score": "0.6621298", "text": "func (*SyncCommand) Descriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_protobuf_failure_details_proto_rawDescGZIP(), []int{29}\n}", "title": "" }, { "docid": "c6683ebc582adbd8dd556ff3ced99bc0", "score": "0.65935725", "text": "func (*HelpCommand) Descriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_protobuf_failure_details_proto_rawDescGZIP(), []int{39}\n}", "title": "" }, { "docid": "4183bbaa7153d7e6a87f30a10259ad96", "score": "0.6591938", "text": "func (*GetMethodDescriptorRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "dbe55db269c355b4b9a43300ec8ac626", "score": "0.6588949", "text": "func (*CSVCMsg_Broadcast_Command) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{58}\n}", "title": "" }, { "docid": "75a9ef555839c847bfad2a8f7ded5b70", "score": "0.65888083", "text": "func (*CMsgServerPeer) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{46}\n}", "title": "" }, { "docid": "666aa1c686ce9fb44503bc1834aab8e5", "score": "0.6582867", "text": "func (*ContainerCommandResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_DatanodeClientProtocol_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "33c0fc8a56f54ad98e72ae003e26f17c", "score": "0.65711313", "text": "func (*AdminCmdReq) Descriptor() ([]byte, []int) {\n\treturn file_game_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "24215b8a3d47df7aedebef911bb60270", "score": "0.65639204", "text": "func (*WatchMethodDescriptorsResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "184c16b7ded4e15bc5c2ed41588092a9", "score": "0.6562537", "text": "func (*ObfuscatedMember) Descriptor() ([]byte, []int) {\n\treturn file_perfetto_perfetto_trace_proto_rawDescGZIP(), []int{405}\n}", "title": "" }, { "docid": "b14531e46f410727c2619322baf7c509", "score": "0.65552783", "text": "func (InfoCommand_Code) EnumDescriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_protobuf_failure_details_proto_rawDescGZIP(), []int{23, 0}\n}", "title": "" }, { "docid": "5bd685b1f1e46fc8f9694bd028667c47", "score": "0.65525806", "text": "func (*CreateMethodDescriptorRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "7e738a58f7dbbdc253089782fa83bf39", "score": "0.6544997", "text": "func (*CommandResponse) Descriptor() ([]byte, []int) {\n\treturn file_dns_service_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "cee692abec46a031ec7fe45e4a3c0a1c", "score": "0.6544156", "text": "func (c *ConnectorRemote) Proto(ctx context.Context, name *protos.ProtoName) (*protos.ProtoDescriptor, error) {\n\tprotoName := name.Name\n\tprotoReflectTypePointer := proto.MessageType(protoName)\n\tprotoReflectType := protoReflectTypePointer.Elem()\n\tprotoValue := reflect.New(protoReflectType)\n\tdescriptorMethod, ok := protoReflectTypePointer.MethodByName(\"Descriptor\")\n\n\tif !ok {\n\t\treturn nil, errors.New(\"failed to get proto descriptor\")\n\t}\n\n\tdescriptorValue := descriptorMethod.Func.Call([]reflect.Value{protoValue})\n\tprotoDescriptor := descriptorValue[0].Bytes()\n\treturn &protos.ProtoDescriptor{\n\t\tDesc: protoDescriptor,\n\t}, nil\n}", "title": "" }, { "docid": "423ca6ab2573e6677ccdce1ce4ea33bb", "score": "0.6540551", "text": "func (*RelayRevoke) Descriptor() ([]byte, []int) {\n\treturn file_relay_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "4329255af3d05a82e234779bdb0ede6b", "score": "0.6539543", "text": "func (CleanCommand_Code) EnumDescriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_protobuf_failure_details_proto_rawDescGZIP(), []int{35, 0}\n}", "title": "" }, { "docid": "8a6411e6ddf517c258cbd2798397aadc", "score": "0.6535579", "text": "func (x *fastReflection_ResponseInfo) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ResponseInfo\n}", "title": "" }, { "docid": "1d63a578bba9c7b871a1439374b94a40", "score": "0.6523457", "text": "func (*CMsgLocalServerGuildData) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "06b71af01e81b9d7aaa3816010fda3ad", "score": "0.65200377", "text": "func (*SetValue) Descriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_protobuf_invocation_policy_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "1aaedbb7fb184960529d86af5de864e7", "score": "0.651291", "text": "func (*ModqueryCommand) Descriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_protobuf_failure_details_proto_rawDescGZIP(), []int{64}\n}", "title": "" }, { "docid": "1a75e8563da9e20ac4bd27a9d31abc61", "score": "0.6512478", "text": "func (PHP_2_USER_CMD) EnumDescriptor() ([]byte, []int) {\n\treturn file_web_msg_define_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "cc938d4756d2911de6bea34334bf11c2", "score": "0.65120745", "text": "func (*MsgDeleteFriend) Descriptor() ([]byte, []int) {\n\treturn file_Demo_Proto_game_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "e1f3681d73cf34536a8cfad1514c595f", "score": "0.65022975", "text": "func (*DisconnectRequestPB) Descriptor() ([]byte, []int) {\n\treturn file_yb_rpc_rtest_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "7d8a54dc913f1a69ef2e3fcfb42ade95", "score": "0.64985055", "text": "func (*NotifyInterfaceDownRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_daemon_v1_daemon_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "126176911c8178b68fa0e6b90f32e0c6", "score": "0.6489792", "text": "func (*CMsgGCToGCBroadcastConsoleCommand) Descriptor() ([]byte, []int) {\n\treturn file_econ_gcmessages_proto_rawDescGZIP(), []int{91}\n}", "title": "" }, { "docid": "cd27f7b243009a123cfe59d3fac48477", "score": "0.64897895", "text": "func (SyncCommand_Code) EnumDescriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_protobuf_failure_details_proto_rawDescGZIP(), []int{29, 0}\n}", "title": "" }, { "docid": "3934139460db0ec9b0510cb97c65b9f2", "score": "0.6484694", "text": "func (x *fastReflection_Response) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Response\n}", "title": "" }, { "docid": "a556dda1e3f2aac3af613be0de8688fd", "score": "0.64819336", "text": "func (LobbyDotaTVDelay) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_match_management_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "dc711c6e07c64eeba07b4a4c4391db25", "score": "0.6480339", "text": "func (*FromServer) Descriptor() ([]byte, []int) {\n\treturn file_chittyChat_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "397ff0f3b8fd10d0d120f894a1a72c34", "score": "0.64775044", "text": "func (*MsgSendMessageToFriend) Descriptor() ([]byte, []int) {\n\treturn file_Demo_Proto_game_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "c786ad3b5008e2d76ccefb3c060f6de4", "score": "0.6477239", "text": "func (*MsgSendMessageToWord) Descriptor() ([]byte, []int) {\n\treturn file_Demo_Proto_game_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "9ebe063ac3d09444820932d0d5b4f158", "score": "0.6473449", "text": "func (*ListMethodDescriptorsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "8fd31392ba89cdce7dd9ba16574b10fd", "score": "0.6473254", "text": "func (RemoteOptions_Code) EnumDescriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_protobuf_failure_details_proto_rawDescGZIP(), []int{6, 0}\n}", "title": "" }, { "docid": "19d573e5717ae4dc55b280f0462fb8ea", "score": "0.6464424", "text": "func (x *fastReflection_MsgUndelegate) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUndelegate\n}", "title": "" }, { "docid": "2254cf2191c315468b9416a0f0e13d8a", "score": "0.64641947", "text": "func (*DeleteCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{245}\n}", "title": "" }, { "docid": "8c71566cd74d9d9b5f4756e51d43d396", "score": "0.64611715", "text": "func (*Link) Descriptor() ([]byte, []int) {\n\treturn file_daemon_proto_meshnet_v1beta1_meshnet_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "59f70c5cc7fa57ad2a874f6e30449bdb", "score": "0.6459277", "text": "func (*InspectDelegationTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_tokenserver_api_admin_v1_admin_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "e0ee6f0d99242f2967dd88ca8cdf775b", "score": "0.6458738", "text": "func (*NotifyInterfaceDownResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_daemon_v1_daemon_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "2cf72bfa62ef82dee9d63135295d9f9b", "score": "0.6451047", "text": "func (*GrpcServer) Descriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_protobuf_failure_details_proto_rawDescGZIP(), []int{20}\n}", "title": "" }, { "docid": "cd7091f787c99018038a253fe9f7ee93", "score": "0.6443976", "text": "func (*FetchCommand) Descriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_protobuf_failure_details_proto_rawDescGZIP(), []int{28}\n}", "title": "" }, { "docid": "d8c9a366046a9209405dab9e4ae0b90f", "score": "0.6443613", "text": "func (*DeletePermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_node_nodepb_node_proto_rawDescGZIP(), []int{42}\n}", "title": "" }, { "docid": "787e83b171e1aa10916b2ec9536d8aca", "score": "0.6441057", "text": "func (*DeprecateDomainResponse) Descriptor() ([]byte, []int) {\n\treturn file_uber_cadence_api_v1_service_domain_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "4c22a20ea5e793d37c6731643b036284", "score": "0.64394796", "text": "func (*DisallowValues) Descriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_protobuf_invocation_policy_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "81aa3a42f1667c32746bf2033bb06c90", "score": "0.643882", "text": "func (*BatchGetMethodDescriptorsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "ed9e54da9a8bf297fd0ea12b251475e0", "score": "0.643461", "text": "func (ModqueryCommand_Code) EnumDescriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_protobuf_failure_details_proto_rawDescGZIP(), []int{64, 0}\n}", "title": "" }, { "docid": "43823598671b62e2d46dca1cb35684d7", "score": "0.6433948", "text": "func (*ProtocolType) Descriptor() ([]byte, []int) {\n\treturn file_proto_devices_devices_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "914c1111cf67600bb7d3862b1a65e4b8", "score": "0.64317286", "text": "func (*RelayVerifyCli) Descriptor() ([]byte, []int) {\n\treturn file_relay_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "f7911f7e930cd9e10cdfcb1604c6cb8d", "score": "0.6431709", "text": "func (*CommandRequest) Descriptor() ([]byte, []int) {\n\treturn file_bess_msg_proto_rawDescGZIP(), []int{47}\n}", "title": "" }, { "docid": "3e45ccd93088d3f80e8e17d70d6f24fc", "score": "0.6429478", "text": "func (Cmd) EnumDescriptor() ([]byte, []int) {\n\treturn file_PacketCmd_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "69730ee6939acaab3e36e06a8c3a637c", "score": "0.6429465", "text": "func (x *fastReflection_MsgEditValidator) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgEditValidator\n}", "title": "" }, { "docid": "bddd87342d93b8bf4e72598af9433dfa", "score": "0.6418708", "text": "func (*Permission) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_server_auth_service_protocol_components_auth_proto_realms_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "db0e8980192cd38c079772b0b6040be2", "score": "0.6417389", "text": "func (*ClientGetLastBotKeyboard) Descriptor() ([]byte, []int) {\n\treturn file_client_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "12fae6f95dbcf64a83d5abe48e99e088", "score": "0.64147043", "text": "func (*DeleteInfo) Descriptor() ([]byte, []int) {\n\treturn file_dns_service_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "1b54162c811c8c74037554fdff0a7462", "score": "0.6413944", "text": "func (*GetOperReply) Descriptor() ([]byte, []int) {\n\treturn file_proto_ems_ems_grpc_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "799f4a6be7d4b17eee3d112538815aeb", "score": "0.6413552", "text": "func (x *fastReflection_MsgEditValidatorResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgEditValidatorResponse\n}", "title": "" }, { "docid": "ec3378ddf0d6ce1dc8a1e30faf667f5d", "score": "0.6413402", "text": "func (*InspectDelegationTokenResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_tokenserver_api_admin_v1_admin_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "342ad82f2862868792f2adf3e2c4e35b", "score": "0.641135", "text": "func (GrpcServer_Code) EnumDescriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_protobuf_failure_details_proto_rawDescGZIP(), []int{20, 0}\n}", "title": "" }, { "docid": "b36bb9638e8f5a07d9469ab6c82a2d0d", "score": "0.6409906", "text": "func (*ShowCmdJSONReply) Descriptor() ([]byte, []int) {\n\treturn file_proto_ems_ems_grpc_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "fd55f0be0404adc346dc49ed4b7d77ca", "score": "0.6406759", "text": "func (*UpdateDomainInfo) Descriptor() ([]byte, []int) {\n\treturn file_uber_cadence_api_v1_service_domain_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "aa741c60b4bbd357fdca711d5c8cef93", "score": "0.64065814", "text": "func (*ShowCmdArgs) Descriptor() ([]byte, []int) {\n\treturn file_proto_ems_ems_grpc_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "6c71a7728ed8fdedf0578f02c78a98f8", "score": "0.64028895", "text": "func (*Server) Descriptor() ([]byte, []int) {\n\treturn file_openapi_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "d226386be5c47ab5b78f59deeb740dd9", "score": "0.6397958", "text": "func (*UpdateMemberNoteRequest) Descriptor() ([]byte, []int) {\n\treturn file_box_conversation_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "de9cc349709510c2f64969cfc5ddd60e", "score": "0.6397542", "text": "func (*ListMethodDescriptorsResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "df5187a7a50b46904deb2b27230469c0", "score": "0.6396444", "text": "func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParams\n}", "title": "" }, { "docid": "61ca61c276825d2745d29935bac3b844", "score": "0.6396301", "text": "func (*DisconnectModulesRequest) Descriptor() ([]byte, []int) {\n\treturn file_bess_msg_proto_rawDescGZIP(), []int{43}\n}", "title": "" }, { "docid": "33c019ef4e5f85697cb07b39631d29b6", "score": "0.6393336", "text": "func (ServerType) EnumDescriptor() ([]byte, []int) {\n\treturn file_web_msg_define_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "e1b61beb252f44589be66a81fdae5d59", "score": "0.6392814", "text": "func (*NotifyUtxosChangedResponseMessage) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{61}\n}", "title": "" }, { "docid": "612bb3fbcdfd96a2d32412c6903a1daf", "score": "0.6390797", "text": "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_videoconverter_proto_rawDescGZIP(), []int{23}\n}", "title": "" }, { "docid": "3bbc40c7a01fd7e7f6df527a2e24c42e", "score": "0.6390465", "text": "func (*ReplToken_Presenced) Descriptor() ([]byte, []int) {\n\treturn file_client_proto_rawDescGZIP(), []int{3, 2}\n}", "title": "" }, { "docid": "7f6911128f31e5899148fb9a0d3e0e7a", "score": "0.63891613", "text": "func (*DisconnectRequest) Descriptor() ([]byte, []int) {\n\treturn file_remote_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "62dcae9aaa9119f562c767cd72d259a7", "score": "0.6388014", "text": "func (*RemoveFromConversationRequest) Descriptor() ([]byte, []int) {\n\treturn file_protos_protos_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "92f35f3c69559fd06244e941de461103", "score": "0.638747", "text": "func (FetchCommand_Code) EnumDescriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_protobuf_failure_details_proto_rawDescGZIP(), []int{28, 0}\n}", "title": "" }, { "docid": "bcc93f8b423107071836abada7b4598b", "score": "0.6384659", "text": "func (x *fastReflection_RequestInfo) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_RequestInfo\n}", "title": "" }, { "docid": "8e3bd8f960cca28641afec7fdb5909b0", "score": "0.6382449", "text": "func (x *fastReflection_Request) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Request\n}", "title": "" }, { "docid": "a566b169a158b22261ca7a930536ce4d", "score": "0.63817793", "text": "func (SetValue_Behavior) EnumDescriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_protobuf_invocation_policy_proto_rawDescGZIP(), []int{2, 0}\n}", "title": "" }, { "docid": "a8b31e9233d63830e650a63f8a4313d0", "score": "0.63805985", "text": "func (TestCommand_Code) EnumDescriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_protobuf_failure_details_proto_rawDescGZIP(), []int{32, 0}\n}", "title": "" }, { "docid": "0864b125a1ced22451a21f0e5a6bb28b", "score": "0.63802403", "text": "func (*ShowCmdTextReply) Descriptor() ([]byte, []int) {\n\treturn file_proto_ems_ems_grpc_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "37d0528d2c9641819264fbc50218f222", "score": "0.6380188", "text": "func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParamsResponse\n}", "title": "" }, { "docid": "06187672d5ded3eafe00aeb67541c434", "score": "0.63794124", "text": "func (*DeleteGraphRequest) Descriptor() ([]byte, []int) {\n\treturn file_hellopb_hello_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "10ab7618a43012abdf9e346ab23c73b9", "score": "0.637699", "text": "func (RpcTarget) EnumDescriptor() ([]byte, []int) {\n\treturn file_Common_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "cbd6dcaa78e8110b4b0991628024779e", "score": "0.63764006", "text": "func (*CreateAlterRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_prova_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "d11ee5b0e1c3e24791368f78bd24642f", "score": "0.6374846", "text": "func (MLBot_MessageId) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota2_dota_messages_mlbot_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "2ac6bbecd5478fe7779ff8e41e201bc8", "score": "0.63730276", "text": "func (*BotInfo) Descriptor() ([]byte, []int) {\n\treturn file_core_types_proto_rawDescGZIP(), []int{22}\n}", "title": "" }, { "docid": "e9dbec07920e1f1304313e5e4f1ef1f2", "score": "0.6372359", "text": "func (*WatchMethodDescriptorsResponse_PageTokenChange) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{8, 0}\n}", "title": "" }, { "docid": "b480ef06b2c9ab8bcf876df16b58a857", "score": "0.6372152", "text": "func (*NewName) Descriptor() ([]byte, []int) {\n\treturn file_dns_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" } ]
bc8afb456bf47afb0b770909585452ce
depositPropFee deposit fees into a proposal
[ { "docid": "dd9c39296570ccc5dc2045488a0fcfc5", "score": "0.85100013", "text": "func (a *RepoAPI) depositPropFee(params interface{}) (resp *rpc.Response) {\n\treturn rpc.Success(a.mods.Repo.DepositProposalFee(cast.ToStringMap(params)))\n}", "title": "" } ]
[ { "docid": "a9210d7d17949c28b936182d9c2cde14", "score": "0.6069983", "text": "func (_TokenCashier *TokenCashierCaller) DepositFee(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _TokenCashier.contract.Call(opts, &out, \"depositFee\")\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "6635929837e60ed08fe0754b24671784", "score": "0.5850614", "text": "func (_VorCoordinator *VorCoordinatorTransactorSession) ChangeFee(_publicProvingKey [2]*big.Int, _fee *big.Int) (*types.Transaction, error) {\n\treturn _VorCoordinator.Contract.ChangeFee(&_VorCoordinator.TransactOpts, _publicProvingKey, _fee)\n}", "title": "" }, { "docid": "6bdab71d23968243b3234495bc083972", "score": "0.58366483", "text": "func calculateDeliveryFee(o *gorm.Order) int {\n\treturn 75\n}", "title": "" }, { "docid": "d6721afec9eed1cfdd7b333af2f46233", "score": "0.5827437", "text": "func (_VorCoordinator *VorCoordinatorTransactor) ChangeFee(opts *bind.TransactOpts, _publicProvingKey [2]*big.Int, _fee *big.Int) (*types.Transaction, error) {\n\treturn _VorCoordinator.contract.Transact(opts, \"changeFee\", _publicProvingKey, _fee)\n}", "title": "" }, { "docid": "1300031982fafa751a8b337b88bf2f96", "score": "0.5793021", "text": "func (o *Order) CalculateDeliveryFee() {\n\to.DeliveryFeeInCents = 250\n}", "title": "" }, { "docid": "79f9389746ed5d781fb3cd02c6c1d13b", "score": "0.5717653", "text": "func (_VorCoordinator *VorCoordinatorSession) ChangeFee(_publicProvingKey [2]*big.Int, _fee *big.Int) (*types.Transaction, error) {\n\treturn _VorCoordinator.Contract.ChangeFee(&_VorCoordinator.TransactOpts, _publicProvingKey, _fee)\n}", "title": "" }, { "docid": "58cbbe91718a42de537a8d8ebaae57c4", "score": "0.5707997", "text": "func DistributeFee(ctx *mevmtypes.Context, collectedFee *uint256.Int, proposer [32]byte /*pubKey*/, voters [][32]byte) {\n\tif collectedFee == nil {\n\t\treturn\n\t}\n\n\t// the collected fee is saved as stakingAcc's balance, just as the staked coins\n\tstakingAcc, info := LoadStakingAcc(ctx)\n\tstakingAccBalance := stakingAcc.Balance()\n\tstakingAccBalance.Add(stakingAccBalance, collectedFee)\n\tstakingAcc.UpdateBalance(stakingAccBalance)\n\tctx.SetAccount(StakingContractAddress, stakingAcc)\n\n\ttotalVotingPower, votedPower := int64(0), int64(0)\n\tfor _, val := range info.GetActiveValidators(MinimumStakingAmount) {\n\t\ttotalVotingPower += val.VotingPower\n\t}\n\tvalMapByPubkey := info.GetValMapByPubkey()\n\tfor _, voter := range voters {\n\t\tval := valMapByPubkey[voter]\n\t\tvotedPower += val.VotingPower\n\t}\n\n\t// proposerBaseFee and proposerExtraFee both go to the proposer\n\tproposerBaseFee := uint256.NewInt().Mul(collectedFee, BaseProposerPercentage)\n\tproposerBaseFee.Div(proposerBaseFee, uint256.NewInt().SetUint64(100))\n\tcollectedFee.Sub(collectedFee, proposerBaseFee)\n\tproposerExtraFee := uint256.NewInt().Mul(collectedFee, ExtraProposerPercentage)\n\tproposerExtraFee.Mul(proposerExtraFee, uint256.NewInt().SetUint64(uint64(votedPower)))\n\tproposerExtraFee.Div(proposerExtraFee, uint256.NewInt().SetUint64(uint64(100*totalVotingPower)))\n\tcollectedFee.Sub(collectedFee, proposerExtraFee)\n\n\trwdMapByAddr := info.GetCurrRewardMapByAddr()\n\tremainedFee := collectedFee.Clone()\n\t//distribute to the non-proposer voters\n\tfor _, voter := range voters {\n\t\tif bytes.Equal(proposer[:], voter[:]) {\n\t\t\tcontinue\n\t\t}\n\t\tval := valMapByPubkey[voter]\n\t\trwdCoins := uint256.NewInt().Mul(collectedFee, uint256.NewInt().SetUint64(uint64(val.VotingPower)))\n\t\trwdCoins.Div(rwdCoins, uint256.NewInt().SetUint64(uint64(votedPower)))\n\t\tremainedFee.Sub(remainedFee, rwdCoins)\n\t\trwd := rwdMapByAddr[val.Address]\n\t\tif rwd == nil {\n\t\t\trwd = &types.PendingReward{\n\t\t\t\tAddress: val.Address,\n\t\t\t\tEpochNum: info.CurrEpochNum,\n\t\t\t\tAmount: [32]byte{},\n\t\t\t}\n\t\t\tinfo.PendingRewards = append(info.PendingRewards, rwd)\n\t\t}\n\t\tcoins := uint256.NewInt().SetBytes32(rwd.Amount[:])\n\t\tcoins.Add(coins, rwdCoins)\n\t\trwd.Amount = coins.Bytes32()\n\t}\n\n\t//distribute to the proposer\n\tproposerVal := valMapByPubkey[proposer]\n\trwd := rwdMapByAddr[proposerVal.Address]\n\tif rwd == nil {\n\t\trwd = &types.PendingReward{\n\t\t\tAddress: proposerVal.Address,\n\t\t\tEpochNum: info.CurrEpochNum,\n\t\t\tAmount: [32]byte{},\n\t\t}\n\t\tinfo.PendingRewards = append(info.PendingRewards, rwd)\n\t}\n\tcoins := uint256.NewInt().SetBytes32(rwd.Amount[:])\n\tcoins.Add(coins, proposerBaseFee)\n\tcoins.Add(coins, proposerExtraFee)\n\tcoins.Add(coins, remainedFee) // remainedFee may be non-zero because of rounding errors\n\trwd.Amount = coins.Bytes32()\n\n\treadonlyStakingInfo = &info\n\tSaveStakingInfo(ctx, stakingAcc, info)\n}", "title": "" }, { "docid": "da32f928f2a150e659bd4c4172ad39cc", "score": "0.570429", "text": "func DeductFees(ctx sdk.Context, assetKeeper AssetKeeper, payer AccountID, fees Coins) error {\n\treturn assetKeeper.PayFee(ctx, payer, fees)\n}", "title": "" }, { "docid": "25cbbac03ef5465f2aacb88ba696776c", "score": "0.56388384", "text": "func (app *AppDeliver) AddFee(fee int64) {\n\tapp.fee = app.fee + fee\n}", "title": "" }, { "docid": "04a17c59cbc4821fc72f7cd5b764c280", "score": "0.5622579", "text": "func (_TokenCashier *TokenCashierCallerSession) DepositFee() (*big.Int, error) {\n\treturn _TokenCashier.Contract.DepositFee(&_TokenCashier.CallOpts)\n}", "title": "" }, { "docid": "9670eb21b7726e817b6e79803f7e2dec", "score": "0.56149536", "text": "func (_TokenCashier *TokenCashierSession) DepositFee() (*big.Int, error) {\n\treturn _TokenCashier.Contract.DepositFee(&_TokenCashier.CallOpts)\n}", "title": "" }, { "docid": "7fda4ecd67aefd3057c8c0ad544c2db4", "score": "0.56039107", "text": "func (k Keeper) CalculateFees(ctx sdk.Context, principal sdk.Coins, periods sdk.Int, denom string) sdk.Coins {\n\tnewFees := sdk.NewCoins()\n\tfor _, pc := range principal {\n\t\t// how fees are calculated:\n\t\t// feesAccumulated = (outstandingDebt * (feeRate^periods)) - outstandingDebt\n\t\t// Note that since we can't do x^y using sdk.Decimal, we are converting to int and using RelativePow\n\t\tfeePerSecond := k.getFeeRate(ctx, denom)\n\t\tscalar := sdk.NewInt(1000000000000000000)\n\t\tfeeRateInt := feePerSecond.Mul(sdk.NewDecFromInt(scalar)).TruncateInt()\n\t\taccumulator := sdk.NewDecFromInt(types.RelativePow(feeRateInt, periods, scalar)).Mul(sdk.SmallestDec())\n\t\tfeesAccumulated := (sdk.NewDecFromInt(pc.Amount).Mul(accumulator)).Sub(sdk.NewDecFromInt(pc.Amount))\n\t\t// TODO this will always round down, causing precision loss between the sum of all fees in CDPs and surplus coins in liquidator account\n\t\tnewFees = newFees.Add(sdk.NewCoin(pc.Denom, feesAccumulated.TruncateInt()))\n\t}\n\treturn newFees\n}", "title": "" }, { "docid": "29c3e280eec2c288d6648bfc740f8754", "score": "0.558694", "text": "func (_LivepeerETHTicketBroker *LivepeerETHTicketBrokerTransactor) FundDeposit(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _LivepeerETHTicketBroker.contract.Transact(opts, \"fundDeposit\")\n}", "title": "" }, { "docid": "e21531449069d4074f5bedf779c5dd22", "score": "0.55371284", "text": "func (_EtherDelta *EtherDeltaCaller) FeeRebate(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _EtherDelta.contract.Call(opts, out, \"feeRebate\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "88ad8c2c767ceba62fd214753d7e6e3b", "score": "0.5523919", "text": "func (_EtherDelta *EtherDeltaSession) FeeRebate() (*big.Int, error) {\n\treturn _EtherDelta.Contract.FeeRebate(&_EtherDelta.CallOpts)\n}", "title": "" }, { "docid": "ba5480fb2c4e869e602912baffb3c5e1", "score": "0.55196756", "text": "func VoteProposal(d *Deposit) error {\n\tbc, err := blockchain.GetBlockChainFromID(d.DestinationChainID)\n\tif err != nil {\n\t\treturn err\n\t}\n\thandlerAddress, err := getHandlerAddress(d.ResourceID, bc)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdataHash := getProposalDataHash(d, handlerAddress)\n\n\tendpoint := fmt.Sprintf(\"http://%s/api/v0/chains/ethereum/addresses/%s/contracts/bridge/methods/voteProposal\",\n\t\tbc.MbEndpoint, bc.BridgeAddress.String())\n\tpayload := mbAPI.JSONPOSTMethodArgs{\n\t\tArgs: []interface{}{\n\t\t\td.OriginChainID,\n\t\t\td.DepositNonce,\n\t\t\td.ResourceID,\n\t\t\tdataHash,\n\t\t},\n\t\tTransactionArgs: blockchain.TransactionArgs{\n\t\t\tFrom: &bc.HSMAddress,\n\t\t\tSignAndSubmit: true,\n\t\t},\n\t}\n\n\tresult, err := mbAPI.Post(endpoint, bc.BearerToken, payload)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif result.Status != 200 {\n\t\treturn customError.NewAPICallError(endpoint, result.Status, result.Message)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4f2456060a3ffba6725c63e174c564d0", "score": "0.5487595", "text": "func (_TokenCashier *TokenCashierTransactorSession) SetDepositFee(_fee *big.Int) (*types.Transaction, error) {\n\treturn _TokenCashier.Contract.SetDepositFee(&_TokenCashier.TransactOpts, _fee)\n}", "title": "" }, { "docid": "57d72e50ae193c594262e4f51dc1c1e2", "score": "0.5483091", "text": "func (_Pool *PoolSession) Fee() (*big.Int, error) {\n\treturn _Pool.Contract.Fee(&_Pool.CallOpts)\n}", "title": "" }, { "docid": "8ac2489ee5b1e6c4ea0136d1c9596350", "score": "0.5467344", "text": "func (d Debits) Fee() btcutil.Amount {\n\treturn d.txRecord.debits.amount - d.outputAmount(false)\n}", "title": "" }, { "docid": "ffe48ac21201af360c6bbbb344c3e652", "score": "0.54635495", "text": "func (p *Profile) normalizeFees() {\n\tif p.profileProto.ModeratorInfo != nil && p.profileProto.ModeratorInfo.Fee != nil {\n\t\tvar fees = p.profileProto.ModeratorInfo.Fee\n\t\tswitch fees.FeeType {\n\t\tcase pb.Moderator_Fee_FIXED:\n\t\t\tfees.Percentage = 0\n\t\tcase pb.Moderator_Fee_PERCENTAGE:\n\t\t\tfees.FixedFee = nil\n\t\t}\n\n\t\tif ff, err := p.GetModeratedFixedFee(); err == nil {\n\t\t\tswitch p.GetVersion() {\n\t\t\tcase 5:\n\t\t\t\tvar amtInt uint64\n\t\t\t\tif ai, err := strconv.Atoi(p.profileProto.ModeratorInfo.Fee.FixedFee.BigAmount); err == nil {\n\t\t\t\t\tamtInt = uint64(ai)\n\t\t\t\t}\n\t\t\t\tp.profileProto.ModeratorInfo.Fee.FixedFee.CurrencyCode = ff.Currency.Code.String()\n\t\t\t\tp.profileProto.ModeratorInfo.Fee.FixedFee.Amount = amtInt\n\t\t\tdefault: // v4 and earlier\n\t\t\t\tp.profileProto.ModeratorInfo.Fee.FixedFee.AmountCurrency = &pb.CurrencyDefinition{\n\t\t\t\t\tCode: ff.Currency.Code.String(),\n\t\t\t\t\tDivisibility: uint32(ff.Currency.Divisibility),\n\t\t\t\t}\n\t\t\t\tp.profileProto.ModeratorInfo.Fee.FixedFee.BigAmount = ff.Amount.String()\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2887cfc8d2c5952158053b38e550c42d", "score": "0.5463054", "text": "func (tx *Transaction) FeePerByte() int64 {\n\treturn tx.netfee / int64(tx._size)\n}", "title": "" }, { "docid": "54cf8c2e8baf278845d19e81a0e2d229", "score": "0.54584694", "text": "func (c *Cart) CalculateDeliveryFee() {\n\tdeliveryFee := 0.0\n\n\tfor _, order := range c.Orders {\n\t\tdeliveryFee += 10.0 + (10.0 * 0.1 * float64(order.Quantity-1))\n\t}\n\n\tc.DeliveryFee = deliveryFee\n}", "title": "" }, { "docid": "bd4a532bf7f5c4c9b198cc21856b295a", "score": "0.5457212", "text": "func (self *Engine) Propose(passport Passport,flights [] Flight, tripEnd EpochTime, now EpochTime) (*Proposal,error) {\n\n\t// Validate args\n\tif len(flights)==0 {\n\t\treturn nil,EINVALIDARGUMENT\n\t}\n\t\n\t// Check promises are active\n\tif !self.Administrator.validPredictor() {\n\t\treturn nil,EPROMISESNOTENABLED\n\t}\n\n\t// Determine trip start, end, distance to backfill and distance travelled\n\tvar distance Kilometres\n\tvar travelled Kilometres\n\tts := MaxEpochTime\n\tte := tripEnd\n\tfor i:=0; i < len(flights); i++ {\n\t\ttravelled += flights[i].Distance\n\t\tdistance += flights[i].Distance + self.Administrator.params.TaxiOverhead\n\t\tif flights[i].Start < ts {\n\t\t\tts=flights[i].Start\n\t\t}\n\t\tif flights[i].End > te {\n\t\t\tte=flights[i].End\n\t\t}\n\t}\n\n\t// Check proposed trip is not too far in the future\n\tif ts.toEpochDays(true) - now.toEpochDays(false) > epochDays(self.Administrator.params.Promises.MaxDays) {\n\t\treturn nil,ETRIPTOOFARAHEAD\n\t}\n\n\t// Adjust distance for mean balance at clearance if so configured\n\tif self.Administrator.params.Promises.Algo & pamCorrectPromiseDistance == pamCorrectPromiseDistance{\n\t\tdistance -= self.Administrator.pc.getBACPerKm()*distance\n\t}\n\n\t// Ask for proposal and return the result\n\treturn self.getCreateTraveller(passport,now).Promises.propose(ts,te,distance,travelled,now,self.Administrator.predictor,\n\t\t\t\t\t\t\t\t self.Administrator.params.Promises.MaxStackSize)\n}", "title": "" }, { "docid": "bc384b6c440aafd16337a90920efe122", "score": "0.5437751", "text": "func (_TokenCashier *TokenCashierTransactor) SetDepositFee(opts *bind.TransactOpts, _fee *big.Int) (*types.Transaction, error) {\n\treturn _TokenCashier.contract.Transact(opts, \"setDepositFee\", _fee)\n}", "title": "" }, { "docid": "854cf989bdf0e1187f479e0f85a43de4", "score": "0.5431792", "text": "func CalculateFee(amount, fee float64) float64 {\n\treturn amount * (fee / 100)\n}", "title": "" }, { "docid": "854cf989bdf0e1187f479e0f85a43de4", "score": "0.5431792", "text": "func CalculateFee(amount, fee float64) float64 {\n\treturn amount * (fee / 100)\n}", "title": "" }, { "docid": "5e14248a43265017eb958e764a084bcb", "score": "0.5413098", "text": "func (tx *Tx) getFee() string {\n\tif _, err := strconv.ParseFloat(tx.Fee, 64); err == nil {\n\t\treturn numbers.DecimalExp(tx.Fee, int(coin.Binance().Decimals))\n\t}\n\treturn \"0\"\n}", "title": "" }, { "docid": "d2cca2ff7bde977eb39bf0e8f59821a9", "score": "0.54033834", "text": "func deductFees(bankKeeper types.BankKeeper, stakingKeeper StakingKeeper, ctx sdk.Context, acc types.AccountI, fees sdk.Coins) error {\n\tif !fees.IsValid() {\n\t\treturn sdkerrors.Wrapf(sdkerrors.ErrInsufficientFee, \"invalid fee amount: %s\", fees)\n\t}\n\n\tbondDenom := stakingKeeper.BondDenom(ctx)\n\n\tstakingTokenFee := sdk.NewCoins()\n\tstableCoinFee := sdk.NewCoins()\n\n\t// Separate fee into staking token and stablecoins.\n\tfor _, coin := range fees {\n\t\tif coin.Denom == bondDenom {\n\t\t\tstakingTokenFee = stakingTokenFee.Add(coin)\n\t\t} else {\n\t\t\tstableCoinFee = stableCoinFee.Add(coin)\n\t\t}\n\t}\n\n\tif !stakingTokenFee.IsZero() {\n\t\terr := bankKeeper.SendCoinsFromAccountToModule(ctx, acc.GetAddress(), types.FeeCollectorName, stakingTokenFee)\n\t\tif err != nil {\n\t\t\treturn sdkerrors.Wrapf(sdkerrors.ErrInsufficientFunds, err.Error())\n\t\t}\n\t}\n\n\tif !stableCoinFee.IsZero() {\n\t\terr := bankKeeper.SendCoinsFromAccountToModule(ctx, acc.GetAddress(), buyback.AccountName, stableCoinFee)\n\t\tif err != nil {\n\t\t\treturn sdkerrors.Wrapf(sdkerrors.ErrInsufficientFunds, err.Error())\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7e18160e8e52d0a7b08d1e07324d3729", "score": "0.53835094", "text": "func (tx *Transaction) Fee(whiteListData map[string]string) int32 {\n\tif tx.isTxWhitelisted(whiteListData) {\n\t\treturn int32(0)\n\t}\n\treturn int32(tx.Envelope.Tx.Fee)\n}", "title": "" }, { "docid": "1d90d09dc6d086a79f15448008b673a4", "score": "0.5377989", "text": "func (cc *ConsumerCreate) SetFee(f float64) *ConsumerCreate {\n\tcc.mutation.SetFee(f)\n\treturn cc\n}", "title": "" }, { "docid": "541d6af840c89cf7fbfbd3f1a1dcfa4e", "score": "0.53767246", "text": "func (_TokenCashier *TokenCashierSession) SetDepositFee(_fee *big.Int) (*types.Transaction, error) {\n\treturn _TokenCashier.Contract.SetDepositFee(&_TokenCashier.TransactOpts, _fee)\n}", "title": "" }, { "docid": "684727edf2916305bfcc96b899d82fd0", "score": "0.5365641", "text": "func (_PancakeFarm *PancakeFarmTransactor) Deposit(opts *bind.TransactOpts, _pid *big.Int, _amount *big.Int) (*types.Transaction, error) {\n\treturn _PancakeFarm.contract.Transact(opts, \"deposit\", _pid, _amount)\n}", "title": "" }, { "docid": "c039056f2de6cbb47728b80c0941c16e", "score": "0.53553796", "text": "func (_EtherDelta *EtherDeltaCallerSession) FeeRebate() (*big.Int, error) {\n\treturn _EtherDelta.Contract.FeeRebate(&_EtherDelta.CallOpts)\n}", "title": "" }, { "docid": "3675dc12b85bd45f0e3a14427b23aefd", "score": "0.5340691", "text": "func (_Pool *PoolCaller) Fee(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Pool.contract.Call(opts, &out, \"fee\")\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "08c90afb565ab0d17b0dde7b688e1f38", "score": "0.53393656", "text": "func (pv *FridayFilePV) SignProposal(chainID string, proposal *types.Proposal) error {\n\tif err := pv.signProposal(chainID, proposal); err != nil {\n\t\treturn fmt.Errorf(\"error signing proposal: %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cb6b1b8ce8c6b7a2ed979d1c62dee3b3", "score": "0.5333351", "text": "func (_MonitoringService *MonitoringServiceTransactor) Deposit(opts *bind.TransactOpts, beneficiary common.Address, total_deposit *big.Int) (*types.Transaction, error) {\n\treturn _MonitoringService.contract.Transact(opts, \"deposit\", beneficiary, total_deposit)\n}", "title": "" }, { "docid": "9f0f25972455d51e0f6b27026e708c77", "score": "0.5318898", "text": "func (_PancakeFactory *PancakeFactorySession) SetFeeToSetter(_feeToSetter common.Address) (*types.Transaction, error) {\n\treturn _PancakeFactory.Contract.SetFeeToSetter(&_PancakeFactory.TransactOpts, _feeToSetter)\n}", "title": "" }, { "docid": "e6b7b0d2d6a0caa7aa53324ef26e851f", "score": "0.5312531", "text": "func (_PancakeFactory *PancakeFactorySession) SetFeeTo(_feeTo common.Address) (*types.Transaction, error) {\n\treturn _PancakeFactory.Contract.SetFeeTo(&_PancakeFactory.TransactOpts, _feeTo)\n}", "title": "" }, { "docid": "12f1cd4620538e6e3c42a19208922866", "score": "0.5305649", "text": "func (_Pool *PoolCallerSession) Fee() (*big.Int, error) {\n\treturn _Pool.Contract.Fee(&_Pool.CallOpts)\n}", "title": "" }, { "docid": "fdbb44dd8015bf0ea6ff919e6c4672eb", "score": "0.5305492", "text": "func (tx *Tx) Fee(payer weave.Address, fee coin.Coin) {\n\ttx.Fees = &cash.FeeInfo{\n\t\tPayer: payer,\n\t\tFees: &fee}\n}", "title": "" }, { "docid": "577669b8ad88353a395bbfbc90599942", "score": "0.5300497", "text": "func DeductFees(supplyKeeper types.SupplyKeeper, ctx sdk.Context, acc Account, fees sdk.Coins) sdk.Result {\n\tblockTime := ctx.BlockHeader().Time\n\tcoins := acc.GetCoins()\n\n\tif !fees.IsValid() {\n\t\treturn sdk.ErrInsufficientFee(fmt.Sprintf(\"invalid fee amount: %s\", fees)).Result()\n\t}\n\n\t// verify the account has enough funds to pay for fees\n\t_, hasNeg := coins.SafeSub(fees)\n\tif hasNeg {\n\t\treturn sdk.ErrInsufficientFunds(\n\t\t\tfmt.Sprintf(\"insufficient funds to pay for fees; %s < %s\", coins, fees),\n\t\t).Result()\n\t}\n\n\t// Validate the account has enough \"spendable\" coins as this will cover cases\n\t// such as vesting accounts.\n\tspendableCoins := acc.SpendableCoins(blockTime)\n\tif _, hasNeg := spendableCoins.SafeSub(fees); hasNeg {\n\t\treturn sdk.ErrInsufficientFunds(\n\t\t\tfmt.Sprintf(\"insufficient funds to pay for fees; %s < %s\", spendableCoins, fees),\n\t\t).Result()\n\t}\n\n\terr := supplyKeeper.SendCoinsFromAccountToModule(ctx, acc.GetAddress(), types.FeeCollectorName, fees)\n\tif err != nil {\n\t\treturn err.Result()\n\t}\n\n\treturn sdk.Result{}\n}", "title": "" }, { "docid": "bbf07c74fa51d7c61f0a3e7de920852c", "score": "0.52893174", "text": "func (_ALPHA *ALPHACaller) DevFee(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _ALPHA.contract.Call(opts, &out, \"_devFee\")\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "d94f9866bc7ad979f69bc0163a2584ac", "score": "0.52889246", "text": "func (_PancakeFactory *PancakeFactoryTransactorSession) SetFeeToSetter(_feeToSetter common.Address) (*types.Transaction, error) {\n\treturn _PancakeFactory.Contract.SetFeeToSetter(&_PancakeFactory.TransactOpts, _feeToSetter)\n}", "title": "" }, { "docid": "b970a231d195ec42d106d34669ef64c4", "score": "0.528338", "text": "func (mp *Mempool) CalculateFee(gas float64, feePerGas float64) (float64, error) {\n\tif gas == 0 || feePerGas == 0 {\n\t\treturn 0.0, nil\n\t}\n\n\tif gas < 0 || feePerGas < 0 {\n\t\treturn 0.0, errors.New(\"cannot be less than zero\")\n\t}\n\n\treturn gas * feePerGas, nil\n}", "title": "" }, { "docid": "8c5dac4d92784811926454f106d89fc7", "score": "0.52821696", "text": "func (s Service) CalculateFee(amount int64) (fee, remainder int64) {\n\tfee = amount * s.feePercentage / MaxPercentage\n\tremainder = amount - fee\n\n\ttotalAmount := remainder + fee\n\tif totalAmount != amount {\n\t\tremainder += amount - totalAmount\n\t}\n\n\treturn fee, remainder\n}", "title": "" }, { "docid": "af377bb81a705e121fe6cfcf86007048", "score": "0.5277442", "text": "func (_PancakeFactory *PancakeFactorySession) FeeToSetter() (common.Address, error) {\n\treturn _PancakeFactory.Contract.FeeToSetter(&_PancakeFactory.CallOpts)\n}", "title": "" }, { "docid": "1e36b13de01486096646557a5629dd8b", "score": "0.527545", "text": "func (_AplpacaFarm *AplpacaFarmTransactor) Deposit(opts *bind.TransactOpts, _for common.Address, _pid *big.Int, _amount *big.Int) (*types.Transaction, error) {\n\treturn _AplpacaFarm.contract.Transact(opts, \"deposit\", _for, _pid, _amount)\n}", "title": "" }, { "docid": "c952db4584521e5501c6e34cd11eeb2f", "score": "0.52718955", "text": "func (_PancakeFactory *PancakeFactoryTransactorSession) SetFeeTo(_feeTo common.Address) (*types.Transaction, error) {\n\treturn _PancakeFactory.Contract.SetFeeTo(&_PancakeFactory.TransactOpts, _feeTo)\n}", "title": "" }, { "docid": "13ee8b4bd04ae322ba830dcfb1e41416", "score": "0.5271256", "text": "func (_CarContractFunctions *CarContractFunctionsCaller) Fee(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _CarContractFunctions.contract.Call(opts, out, \"fee\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "559655ae2ec0a469b80ccbf1085cf9b2", "score": "0.52683985", "text": "func NewFixedFee(money *Money, description string) Fee {\n\treturn Fee{\n\t\tFixed: money,\n\t\tDescription: description,\n\t}\n}", "title": "" }, { "docid": "07fc0a55c7fb0532b63d1b1ee092866c", "score": "0.5263476", "text": "func (_LivepeerETHTicketBroker *LivepeerETHTicketBrokerTransactorSession) FundDeposit() (*types.Transaction, error) {\n\treturn _LivepeerETHTicketBroker.Contract.FundDeposit(&_LivepeerETHTicketBroker.TransactOpts)\n}", "title": "" }, { "docid": "984441ea042e4e45e7f0e446329b2f9d", "score": "0.52607465", "text": "func (r *Exchange) buyFeeAmount() float64 {\n\treturn r.Amount * r.Fee\n}", "title": "" }, { "docid": "8bd102ecc977f44cc200980e95229989", "score": "0.5250948", "text": "func (a *Account) Deposit(amount float64, db *pg.DB) error {\n\tif amount < 0 {\n\t\treturn errors.New(\"You can only deposit positive quantities\")\n\t}\n\ta.Deposited += amount\n\ta.UpdateAvailableFunds()\n\t_, err := db.Model(a).WherePK().Update()\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "39f0b705e7b1c28319b210e32c790c94", "score": "0.52485406", "text": "func (_LivepeerETHTicketBroker *LivepeerETHTicketBrokerSession) FundDeposit() (*types.Transaction, error) {\n\treturn _LivepeerETHTicketBroker.Contract.FundDeposit(&_LivepeerETHTicketBroker.TransactOpts)\n}", "title": "" }, { "docid": "fabc19daa51d6e75dab6a7c5ac1ec3ca", "score": "0.52474296", "text": "func (a Account) Deposit(p Pot, amt int) (*Deposit, error) {\n\tendpoint := \"/pots/\" + p.ID + \"/deposit\"\n\n\tdata := url.Values{}\n\tdata.Add(\"source_account_id\", a.ID)\n\tdata.Add(\"amount\", strconv.Itoa(amt))\n\n\tsrc := rand.NewSource(time.Now().UnixNano())\n\tr := rand.New(src)\n\n\tdata.Add(\"dedupe_id\", strconv.FormatFloat(r.Float64(), 'f', 6, 64))\n\n\treq, err := a.client.NewRequest(http.MethodPut, endpoint, strings.NewReader(data.Encode()))\n\tif err != nil {\n\t\treturn &Deposit{}, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\n\treturn &Deposit{req, &a.client.Client}, nil\n}", "title": "" }, { "docid": "6d4d42157ea1045c0cb75dd6ae667244", "score": "0.5238753", "text": "func (a *Account) Deposit(amount int) {\n\t//receiver로 Account의 method로 작동한다.\n\t//receiver로 사용되는 변수는 소문자로 시작해야한다.\n\t//a Account는 이 함수를 호출한 오브젝트의 복사본을 가져와 담는다,\n\t//여기서는 복사본이 아닌 호출한 오브젝트 자체의 값을 변경해야 하므로 Account가 아닌 *Account가 와야된다.\n\t//정리를 하자면 set 메서드는 원래 오브젝트를 가져와서 수정해야하기 때문에 *Account 이며\n\t// get 메서드는 원래 오브젝트의 복사본을 가져와도 되므로 Account가 와야한다.\n\ta.balance += amount\n}", "title": "" }, { "docid": "6375fddd6e08541ab41bf57c8d2e1f00", "score": "0.52363193", "text": "func (pv *FridayFilePV) signProposal(chainID string, proposal *types.Proposal) error {\n\theight, round, step := proposal.Height, proposal.Round, stepPropose\n\n\tsameHRS, existSignState, err := pv.SignState.CheckHRS(height, round, step)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsignBytes := proposal.SignBytes(chainID)\n\n\t// We might crash before writing to the wal,\n\t// causing us to try to re-sign for the same HRS.\n\t// If signbytes are the same, use the last signature.\n\t// If they only differ by timestamp, use last timestamp and signature\n\t// Otherwise, return error\n\tif sameHRS {\n\t\tif bytes.Equal(signBytes, existSignState.SignBytes) {\n\t\t\tproposal.Signature = existSignState.Signature\n\t\t} else if timestamp, ok := checkProposalsOnlyDifferByTimestamp(existSignState.SignBytes, signBytes); ok {\n\t\t\tproposal.Timestamp = timestamp\n\t\t\tproposal.Signature = existSignState.Signature\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"conflicting data\")\n\t\t}\n\t\treturn err\n\t}\n\n\t// It passed the checks. Sign the proposal\n\tsig, err := pv.Key.PrivKey.Sign(signBytes)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpv.saveSigned(height, round, step, signBytes, sig)\n\tproposal.Signature = sig\n\treturn nil\n}", "title": "" }, { "docid": "1e0f939bcaed2cd2d95de2d98cef76c0", "score": "0.5222704", "text": "func (a *Appeal) AppealFeePaid() *big.Int {\n\treturn a.appealFeePaid\n}", "title": "" }, { "docid": "85e2cae4bb9363c9f0f13b2c73ca125b", "score": "0.5221006", "text": "func (_PancakeFactory *PancakeFactoryTransactor) SetFeeToSetter(opts *bind.TransactOpts, _feeToSetter common.Address) (*types.Transaction, error) {\n\treturn _PancakeFactory.contract.Transact(opts, \"setFeeToSetter\", _feeToSetter)\n}", "title": "" }, { "docid": "4031b16183508aea801b40991e7aff4c", "score": "0.52195644", "text": "func (_Bridge *BridgeCaller) ServiceFee(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Bridge.contract.Call(opts, &out, \"serviceFee\")\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "0e106173cc515e477d575a65871458b2", "score": "0.5216859", "text": "func (m PrometheusBackend) OverallFee(daemon, asset string, amount float64) {\n\tm.overallFeeFunds.With(\n\t\tprometheus.Labels{\n\t\t\tassetLabel: asset,\n\t\t\tdaemonLabel: daemon,\n\t\t},\n\t).Set(amount)\n}", "title": "" }, { "docid": "76c94e3bb7fc29ac30c2c142e0223346", "score": "0.5203043", "text": "func (_IPancakeFactory *IPancakeFactorySession) FeeToSetter() (common.Address, error) {\n\treturn _IPancakeFactory.Contract.FeeToSetter(&_IPancakeFactory.CallOpts)\n}", "title": "" }, { "docid": "6ddebd43285cfbabd2961d9b4e37f5fb", "score": "0.52023184", "text": "func (_VorCoordinator *VorCoordinatorTransactorSession) ChangeGranularFee(_publicProvingKey [2]*big.Int, _fee *big.Int, _consumer common.Address) (*types.Transaction, error) {\n\treturn _VorCoordinator.Contract.ChangeGranularFee(&_VorCoordinator.TransactOpts, _publicProvingKey, _fee, _consumer)\n}", "title": "" }, { "docid": "50328670dca5604c7d251ae851086619", "score": "0.51979244", "text": "func setContractFee(ctx iscp.Sandbox) (dict.Dict, error) {\n\ta := assert.NewAssert(ctx.Log())\n\ta.Require(CheckAuthorizationByChainOwner(ctx.State(), ctx.Caller()), \"root.setContractFee: not authorized\")\n\n\tparams := kvdecoder.New(ctx.Params(), ctx.Log())\n\n\thname := params.MustGetHname(ParamHname)\n\trec, err := FindContract(ctx.State(), hname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\townerFee := params.MustGetUint64(ParamOwnerFee, 0)\n\townerFeeSet := ownerFee >= 0 //nolint:staticcheck\n\tvalidatorFee := params.MustGetUint64(ParamValidatorFee, 0)\n\tvalidatorFeeSet := validatorFee >= 0 //nolint:staticcheck\n\t// TODO ownerFeeSet and validatorFeeSet checks are probably obsolete and could be removed. to be refactored\n\n\ta.Require(ownerFeeSet || validatorFeeSet, \"root.setContractFee: wrong parameters\")\n\tif ownerFeeSet {\n\t\trec.OwnerFee = ownerFee\n\t}\n\tif validatorFeeSet {\n\t\trec.ValidatorFee = validatorFee\n\t}\n\tcollections.NewMap(ctx.State(), VarContractRegistry).MustSetAt(hname.Bytes(), EncodeContractRecord(rec))\n\treturn nil, nil\n}", "title": "" }, { "docid": "a78f890dad7cc21806232eb42b31e2f3", "score": "0.519758", "text": "func (builder *TxBuilder) Fee() Coins {\n\treturn builder.fee\n}", "title": "" }, { "docid": "1b3fbf31f7e0f7f9fe3be587394999f0", "score": "0.5195139", "text": "func (e *RPCEstimator) estimateFee() error {\n\tinfo, err := e.client.GetBlockChainInfo()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif info.Blocks <= e.lastObservedHeight {\n\t\te.logger.Info(\"already estimated\")\n\t\treturn nil\n\t}\n\n\te.lastObservedHeight = info.Blocks\n\trate, err := e.client.EstimateFee(BlockCountStandard)\n\tif err != nil {\n\t\treturn err\n\t}\n\te.logger.Info(\"got rate\", zap.Any(\"rate\", rate))\n\n\t// feeRates, err := e.ratesCache.GetFeeRatesForBlock(info.Blocks)\n\t// if err != nil {\n\t// \treturn err\n\t// }\n\n\t// e.scores.addPrediction(int(info.Blocks), feeRates, int(rate))\n\treturn nil\n}", "title": "" }, { "docid": "0eed006c6c862d6a8e5c377db108f96a", "score": "0.5189699", "text": "func payFee(c *gin.Context) {\n\tconst funcName = \"payFee\"\n\n\t// Get values which have been added to context by middleware.\n\tticket := c.MustGet(\"Ticket\").(database.Ticket)\n\tknownTicket := c.MustGet(\"KnownTicket\").(bool)\n\tdcrdClient := c.MustGet(\"DcrdClient\").(*rpc.DcrdRPC)\n\treqBytes := c.MustGet(\"RequestBytes\").([]byte)\n\n\tif cfg.VspClosed {\n\t\tsendError(errVspClosed, c)\n\t\treturn\n\t}\n\n\tif !knownTicket {\n\t\tlog.Warnf(\"%s: Unknown ticket (clientIP=%s)\", funcName, c.ClientIP())\n\t\tsendError(errUnknownTicket, c)\n\t\treturn\n\t}\n\n\tvar request payFeeRequest\n\tif err := binding.JSON.BindBody(reqBytes, &request); err != nil {\n\t\tlog.Warnf(\"%s: Bad request (clientIP=%s): %v\", funcName, c.ClientIP(), err)\n\t\tsendErrorWithMsg(err.Error(), errBadRequest, c)\n\t\treturn\n\t}\n\n\t// Respond early if we already have the fee tx for this ticket.\n\tif ticket.FeeTxStatus == database.FeeReceieved ||\n\t\tticket.FeeTxStatus == database.FeeBroadcast ||\n\t\tticket.FeeTxStatus == database.FeeConfirmed {\n\t\tlog.Warnf(\"%s: Fee tx already received (clientIP=%s, ticketHash=%s)\",\n\t\t\tfuncName, c.ClientIP(), ticket.Hash)\n\t\tsendError(errFeeAlreadyReceived, c)\n\t\treturn\n\t}\n\n\t// Get ticket details.\n\trawTicket, err := dcrdClient.GetRawTransaction(ticket.Hash)\n\tif err != nil {\n\t\tlog.Errorf(\"%s: dcrd.GetRawTransaction for ticket failed (ticketHash=%s): %v\", funcName, ticket.Hash, err)\n\t\tsendError(errInternalError, c)\n\t\treturn\n\t}\n\n\t// Ensure this ticket is eligible to vote at some point in the future.\n\tcanVote, err := dcrdClient.CanTicketVote(rawTicket, ticket.Hash, cfg.NetParams)\n\tif err != nil {\n\t\tlog.Errorf(\"%s: dcrd.CanTicketVote error (ticketHash=%s): %v\", funcName, ticket.Hash, err)\n\t\tsendError(errInternalError, c)\n\t\treturn\n\t}\n\tif !canVote {\n\t\tlog.Warnf(\"%s: Unvotable ticket (clientIP=%s, ticketHash=%s)\",\n\t\t\tfuncName, c.ClientIP(), ticket.Hash)\n\t\tsendError(errTicketCannotVote, c)\n\t\treturn\n\t}\n\n\t// Respond early if the fee for this ticket is expired.\n\tif ticket.FeeExpired() {\n\t\tlog.Warnf(\"%s: Expired payfee request (clientIP=%s, ticketHash=%s)\",\n\t\t\tfuncName, c.ClientIP(), ticket.Hash)\n\t\tsendError(errFeeExpired, c)\n\t\treturn\n\t}\n\n\t// Validate VotingKey.\n\tvotingKey := request.VotingKey\n\tvotingWIF, err := dcrutil.DecodeWIF(votingKey, cfg.NetParams.PrivateKeyID)\n\tif err != nil {\n\t\tlog.Warnf(\"%s: Failed to decode WIF (clientIP=%s, ticketHash=%s): %v\",\n\t\t\tfuncName, c.ClientIP(), ticket.Hash, err)\n\t\tsendError(errInvalidPrivKey, c)\n\t\treturn\n\t}\n\n\t// Validate VoteChoices. Just log a warning if vote choices are not valid\n\t// for the current vote version - the ticket should still be registered.\n\tvalidVoteChoices := true\n\terr = isValidVoteChoices(cfg.NetParams, currentVoteVersion(cfg.NetParams), request.VoteChoices)\n\tif err != nil {\n\t\tvalidVoteChoices = false\n\t\tlog.Warnf(\"%s: Invalid vote choices (clientIP=%s, ticketHash=%s): %v\",\n\t\t\tfuncName, c.ClientIP(), ticket.Hash, err)\n\t}\n\n\t// Validate FeeTx.\n\tfeeTx, err := decodeTransaction(request.FeeTx)\n\tif err != nil {\n\t\tlog.Warnf(\"%s: Failed to decode fee tx hex (clientIP=%s, ticketHash=%s): %v\",\n\t\t\tfuncName, c.ClientIP(), ticket.Hash, err)\n\t\tsendError(errInvalidFeeTx, c)\n\t\treturn\n\t}\n\n\terr = blockchain.CheckTransactionSanity(feeTx, cfg.NetParams)\n\tif err != nil {\n\t\tlog.Warnf(\"%s: Fee tx failed sanity check (clientIP=%s, ticketHash=%s): %v\",\n\t\t\tfuncName, c.ClientIP(), ticket.Hash, err)\n\t\tsendError(errInvalidFeeTx, c)\n\t\treturn\n\t}\n\n\t// Loop through transaction outputs until we find one which pays to the\n\t// expected fee address. Record how much is being paid to the fee address.\n\tvar feePaid dcrutil.Amount\n\tconst scriptVersion = 0\n\nfindAddress:\n\tfor _, txOut := range feeTx.TxOut {\n\t\tif txOut.Version != scriptVersion {\n\t\t\tlog.Errorf(\"%s: Fee tx with invalid script version (clientIP=%s, ticketHash=%s): was %d, expected %d\",\n\t\t\t\tfuncName, c.ClientIP(), ticket.Hash, txOut.Version, scriptVersion)\n\t\t\tsendErrorWithMsg(\"invalid script version\", errInvalidFeeTx, c)\n\t\t\treturn\n\t\t}\n\t\t_, addresses, _, err := txscript.ExtractPkScriptAddrs(scriptVersion,\n\t\t\ttxOut.PkScript, cfg.NetParams, isTreasuryEnabled)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"%s: Extract PK error (clientIP=%s, ticketHash=%s): %v\",\n\t\t\t\tfuncName, c.ClientIP(), ticket.Hash, err)\n\t\t\tsendError(errInternalError, c)\n\t\t\treturn\n\t\t}\n\t\tfor _, addr := range addresses {\n\t\t\tif addr.String() == ticket.FeeAddress {\n\t\t\t\tfeePaid = dcrutil.Amount(txOut.Value)\n\t\t\t\tbreak findAddress\n\t\t\t}\n\t\t}\n\t}\n\n\tif feePaid == 0 {\n\t\tlog.Warnf(\"%s: Fee tx did not include expected payment (ticketHash=%s, feeAddress=%s, clientIP=%s)\",\n\t\t\tfuncName, ticket.Hash, ticket.FeeAddress, c.ClientIP())\n\t\tsendErrorWithMsg(\"feetx did not include any payments for fee address\", errInvalidFeeTx, c)\n\t\treturn\n\t}\n\n\tpkHash := stdaddr.Hash160(votingWIF.PubKey())\n\twifAddr, err := stdaddr.NewAddressPubKeyHashEcdsaSecp256k1V0(pkHash, cfg.NetParams)\n\tif err != nil {\n\t\tlog.Errorf(\"%s: Failed to get voting address from WIF (ticketHash=%s, clientIP=%s): %v\",\n\t\t\tfuncName, ticket.Hash, c.ClientIP(), err)\n\t\tsendError(errInvalidPrivKey, c)\n\t\treturn\n\t}\n\n\t// Decode ticket transaction to get its voting address.\n\tticketTx, err := decodeTransaction(rawTicket.Hex)\n\tif err != nil {\n\t\tlog.Warnf(\"%s: Failed to decode ticket hex (ticketHash=%s): %v\",\n\t\t\tfuncName, ticket.Hash, err)\n\t\tsendError(errInternalError, c)\n\t\treturn\n\t}\n\n\t// Get ticket voting address.\n\t_, votingAddr, _, err := txscript.ExtractPkScriptAddrs(scriptVersion, ticketTx.TxOut[0].PkScript, cfg.NetParams, isTreasuryEnabled)\n\tif err != nil {\n\t\tlog.Errorf(\"%s: ExtractPK error (ticketHash=%s): %v\", funcName, ticket.Hash, err)\n\t\tsendError(errInternalError, c)\n\t\treturn\n\t}\n\tif len(votingAddr) == 0 {\n\t\tlog.Error(\"%s: No voting address found for ticket (ticketHash=%s)\", funcName, ticket.Hash)\n\t\tsendError(errInternalError, c)\n\t\treturn\n\t}\n\n\t// Ensure provided private key will allow us to vote this ticket.\n\tif votingAddr[0].String() != wifAddr.String() {\n\t\tlog.Warnf(\"%s: Voting address does not match provided private key: (ticketHash=%s, votingAddr=%+v, wifAddr=%+v)\",\n\t\t\tfuncName, ticket.Hash, votingAddr[0], wifAddr)\n\t\tsendErrorWithMsg(\"voting address does not match provided private key\",\n\t\t\terrInvalidPrivKey, c)\n\t\treturn\n\t}\n\n\tminFee := dcrutil.Amount(ticket.FeeAmount)\n\tif feePaid < minFee {\n\t\tlog.Warnf(\"%s: Fee too small (ticketHash=%s, clientIP=%s): was %s, expected minimum %s\",\n\t\t\tfuncName, ticket.Hash, c.ClientIP(), feePaid, minFee)\n\t\tsendError(errFeeTooSmall, c)\n\t\treturn\n\t}\n\n\t// At this point we are satisfied that the request is valid and the fee tx\n\t// pays sufficient fees to the expected address. Proceed to update the\n\t// database, and if the ticket is confirmed broadcast the fee transaction.\n\n\tticket.VotingWIF = votingWIF.String()\n\tticket.FeeTxHex = request.FeeTx\n\tticket.FeeTxHash = feeTx.TxHash().String()\n\tticket.FeeTxStatus = database.FeeReceieved\n\n\tif validVoteChoices {\n\t\tticket.VoteChoices = request.VoteChoices\n\t}\n\n\terr = db.UpdateTicket(ticket)\n\tif err != nil {\n\t\tlog.Errorf(\"%s: db.UpdateTicket error, failed to set fee tx (ticketHash=%s): %v\",\n\t\t\tfuncName, ticket.Hash, err)\n\t\tsendError(errInternalError, c)\n\t\treturn\n\t}\n\n\tlog.Debugf(\"%s: Fee tx received for ticket (minExpectedFee=%v, feePaid=%v, ticketHash=%s)\",\n\t\tfuncName, minFee, feePaid, ticket.Hash)\n\n\tif ticket.Confirmed {\n\t\terr = dcrdClient.SendRawTransaction(request.FeeTx)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"%s: dcrd.SendRawTransaction for fee tx failed (ticketHash=%s): %v\",\n\t\t\t\tfuncName, ticket.Hash, err)\n\n\t\t\tticket.FeeTxStatus = database.FeeError\n\n\t\t\tif strings.Contains(err.Error(),\n\t\t\t\t\"references outputs of unknown or fully-spent transaction\") {\n\t\t\t\tsendError(errCannotBroadcastFeeUnknownOutputs, c)\n\t\t\t} else {\n\t\t\t\tsendError(errCannotBroadcastFee, c)\n\t\t\t}\n\n\t\t\terr = db.UpdateTicket(ticket)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"%s: db.UpdateTicket error, failed to set fee tx error (ticketHash=%s): %v\",\n\t\t\t\t\tfuncName, ticket.Hash, err)\n\t\t\t}\n\n\t\t\treturn\n\t\t}\n\n\t\tticket.FeeTxStatus = database.FeeBroadcast\n\n\t\terr = db.UpdateTicket(ticket)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"%s: db.UpdateTicket error, failed to set fee tx as broadcast (ticketHash=%s): %v\",\n\t\t\t\tfuncName, ticket.Hash, err)\n\t\t\tsendError(errInternalError, c)\n\t\t\treturn\n\t\t}\n\n\t\tlog.Debugf(\"%s: Fee tx broadcast for ticket (ticketHash=%s, feeHash=%s)\",\n\t\t\tfuncName, ticket.Hash, ticket.FeeTxHash)\n\t}\n\n\t// Send success response to client.\n\tresp, respSig := sendJSONResponse(payFeeResponse{\n\t\tTimestamp: time.Now().Unix(),\n\t\tRequest: reqBytes,\n\t}, c)\n\n\t// Store a record of the vote choice change.\n\terr = db.SaveVoteChange(\n\t\tticket.Hash,\n\t\tdatabase.VoteChangeRecord{\n\t\t\tRequest: string(reqBytes),\n\t\t\tRequestSignature: c.GetHeader(\"VSP-Client-Signature\"),\n\t\t\tResponse: resp,\n\t\t\tResponseSignature: respSig,\n\t\t})\n\tif err != nil {\n\t\tlog.Errorf(\"%s: Failed to store vote change record (ticketHash=%s): %v\", err)\n\t}\n}", "title": "" }, { "docid": "2039a8f6b143d5b1f6eb951e7a647eb1", "score": "0.5188154", "text": "func (k Keeper) UpdateFeesForAllCdps(ctx sdk.Context, collateralDenom string) error {\n\n\tk.IterateCdpsByDenom(ctx, collateralDenom, func(cdp types.CDP) bool {\n\n\t\toldCollateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Principal.Add(cdp.AccumulatedFees...))\n\t\tperiods := sdk.NewInt(ctx.BlockTime().Unix()).Sub(sdk.NewInt(cdp.FeesUpdated.Unix()))\n\n\t\tnewFees := k.CalculateFees(ctx, cdp.Principal, periods, collateralDenom)\n\n\t\t// exit without updating fees if amount has rounded down to zero\n\t\t// cdp will get updated next block when newFees, newFeesSavings, newFeesSurplus >0\n\t\tif newFees.IsZero() {\n\t\t\treturn false\n\t\t}\n\n\t\t// note - only works if principal length is one\n\t\tfor _, dc := range cdp.Principal {\n\t\t\tdp, found := k.GetDebtParam(ctx, dc.Denom)\n\t\t\tif !found {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tsavingsRate := dp.SavingsRate\n\n\t\t\tnewFeesSavings := sdk.NewDecFromInt(newFees.AmountOf(dp.Denom)).Mul(savingsRate).RoundInt()\n\t\t\tnewFeesSurplus := newFees.AmountOf(dp.Denom).Sub(newFeesSavings)\n\n\t\t\t// similar to checking for rounding to zero of all fees, but in this case we\n\t\t\t// need to handle cases where we expect surplus or savings fees to be zero, namely\n\t\t\t// if newFeesSavings = 0, check if savings rate is not zero\n\t\t\t// if newFeesSurplus = 0, check if savings rate is not one\n\t\t\tif (newFeesSavings.IsZero() && !savingsRate.IsZero()) || (newFeesSurplus.IsZero() && !savingsRate.Equal(sdk.OneDec())) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\t// mint debt coins to the cdp account\n\t\t\tk.MintDebtCoins(ctx, types.ModuleName, k.GetDebtDenom(ctx), newFees)\n\t\t\tpreviousDebt := k.GetTotalPrincipal(ctx, collateralDenom, dp.Denom)\n\t\t\tfeeCoins := sdk.NewCoins(sdk.NewCoin(dp.Denom, previousDebt))\n\t\t\tk.SetTotalPrincipal(ctx, collateralDenom, dp.Denom, feeCoins.Add(newFees...).AmountOf(dp.Denom))\n\n\t\t\t// mint surplus coins divided between the liquidator and savings module accounts.\n\t\t\tk.supplyKeeper.MintCoins(ctx, types.LiquidatorMacc, sdk.NewCoins(sdk.NewCoin(dp.Denom, newFeesSurplus)))\n\t\t\tk.supplyKeeper.MintCoins(ctx, types.SavingsRateMacc, sdk.NewCoins(sdk.NewCoin(dp.Denom, newFeesSavings)))\n\t\t}\n\n\t\t// now add the new fees fees to the accumulated fees for the cdp\n\t\tcdp.AccumulatedFees = cdp.AccumulatedFees.Add(newFees...)\n\n\t\t// and set the fees updated time to the current block time since we just updated it\n\t\tcdp.FeesUpdated = ctx.BlockTime()\n\t\tcollateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Principal.Add(cdp.AccumulatedFees...))\n\t\tk.RemoveCdpCollateralRatioIndex(ctx, cdp.Collateral[0].Denom, cdp.ID, oldCollateralToDebtRatio)\n\t\tk.SetCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio)\n\t\treturn false // this returns true when you want to stop iterating. Since we want to iterate through all we return false\n\t})\n\treturn nil\n}", "title": "" }, { "docid": "0c120701795de8710647a82f77cb981f", "score": "0.5179515", "text": "func (w *Wallet) Deposit(amount Bitcoin) {\n w.balance += amount\n}", "title": "" }, { "docid": "6c113a94416f206e283a2b2404293e2a", "score": "0.5175549", "text": "func (msg MsgEthereumTx) Fee() *big.Int {\n\tgasPrice := msg.Data.gasPrice()\n\tgasLimit := new(big.Int).SetUint64(msg.Data.gas())\n\treturn new(big.Int).Mul(gasPrice, gasLimit)\n}", "title": "" }, { "docid": "3f749ffd346571c79dbb12d684e9428e", "score": "0.517413", "text": "func (_VorCoordinator *VorCoordinatorSession) ChangeGranularFee(_publicProvingKey [2]*big.Int, _fee *big.Int, _consumer common.Address) (*types.Transaction, error) {\n\treturn _VorCoordinator.Contract.ChangeGranularFee(&_VorCoordinator.TransactOpts, _publicProvingKey, _fee, _consumer)\n}", "title": "" }, { "docid": "bf9a86798fb115374873bfdaeb2c9e36", "score": "0.5170137", "text": "func (_CarContractFunctions *CarContractFunctionsTransactorSession) UpdateFee(_value *big.Int) (*types.Transaction, error) {\n\treturn _CarContractFunctions.Contract.UpdateFee(&_CarContractFunctions.TransactOpts, _value)\n}", "title": "" }, { "docid": "74da9de76b080562d134a8391f915291", "score": "0.5164767", "text": "func (_PancakeFactory *PancakeFactoryCallerSession) FeeToSetter() (common.Address, error) {\n\treturn _PancakeFactory.Contract.FeeToSetter(&_PancakeFactory.CallOpts)\n}", "title": "" }, { "docid": "0b37eda9a47443367f70cba343975af7", "score": "0.51601607", "text": "func (*FractionalFee) Descriptor() ([]byte, []int) {\n\treturn file_proto_custom_fees_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "964b6923aabdb0ae2f9e351a1c35c51b", "score": "0.51573884", "text": "func (a *action) Deposit(deposit *mixTy.MixDepositAction) (*types.Receipt, error) {\n\tvar notes []string\n\tvar sum uint64\n\t//1. zk-proof校验\n\tfor _, p := range deposit.Proofs {\n\t\tinput, err := a.depositVerify(p)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"get pub input\")\n\t\t}\n\t\tv := input.Amount.GetWitnessValue(ecc.BN254)\n\t\tsum += v.Uint64()\n\t\tnoteHash := input.NoteHash.GetWitnessValue(ecc.BN254)\n\t\tnotes = append(notes, noteHash.String())\n\t}\n\n\t//存款\n\tcfg := a.api.GetConfig()\n\texecer, symbol := mixTy.GetAssetExecSymbol(cfg, deposit.AssetExec, deposit.AssetSymbol)\n\taccoutDb, err := createAccount(cfg, execer, symbol, a.db)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"createAccount,execer=%s,symbol=%s\", execer, symbol)\n\t}\n\t//主链上存入toAddr为mix 执行器地址,平行链上为user.p.{}.mix执行器地址,execAddr和toAddr一致\n\texecAddr := address.ExecAddress(string(a.tx.Execer))\n\treceipt, err := accoutDb.ExecTransfer(a.fromaddr, execAddr, execAddr, int64(sum))\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"account save to exec\")\n\t}\n\t//push new commit to merkle tree\n\tvar leaves [][]byte\n\tfor _, n := range notes {\n\t\tleaves = append(leaves, mixTy.Str2Byte(n))\n\t}\n\tconf := types.ConfSub(cfg, mixTy.MixX)\n\tmaxTreeLeaves := conf.GInt(\"maxTreeLeaves\")\n\trpt, err := pushTree(a.db, execer, symbol, leaves, int32(maxTreeLeaves))\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"pushTree\")\n\t}\n\tmergeReceipt(receipt, rpt)\n\n\treturn receipt, nil\n\n}", "title": "" }, { "docid": "39b07bc925013cc3bdc5a6a37ecceb1f", "score": "0.5146619", "text": "func (_CarContractFunctions *CarContractFunctionsTransactor) UpdateFee(opts *bind.TransactOpts, _value *big.Int) (*types.Transaction, error) {\n\treturn _CarContractFunctions.contract.Transact(opts, \"updateFee\", _value)\n}", "title": "" }, { "docid": "2fb4511f522ddf56aaf6faf184b537c5", "score": "0.51450086", "text": "func (_CarContractFunctions *CarContractFunctionsSession) Fee() (*big.Int, error) {\n\treturn _CarContractFunctions.Contract.Fee(&_CarContractFunctions.CallOpts)\n}", "title": "" }, { "docid": "707735d783736be1b410b58f9fd27f59", "score": "0.5141873", "text": "func (_Burnauction *BurnauctionTransactor) Deposit(opts *bind.TransactOpts, beneficiary common.Address) (*types.Transaction, error) {\n\treturn _Burnauction.contract.Transact(opts, \"deposit\", beneficiary)\n}", "title": "" }, { "docid": "e17bb4799d994489c8defc27ebf45124", "score": "0.5136412", "text": "func (rc *RPCClient) EstimateFee(confTarget int64) (uint64, error) {\n\tvar feeRate float64\n\tvar args anylist\n\tif !rc.arglessFeeEstimates {\n\t\targs = anylist{confTarget}\n\t}\n\tif err := rc.call(methodEstimateFee, args, &feeRate); err != nil {\n\t\treturn 0, err\n\t}\n\tif feeRate <= 0 {\n\t\treturn 0, errNoFeeRate\n\t}\n\treturn uint64(math.Round(feeRate * 1e5)), nil\n}", "title": "" }, { "docid": "0f961749a486641225ff94402aa4e3d8", "score": "0.5134316", "text": "func (_IPancakeFactory *IPancakeFactorySession) SetFeeToSetter(arg0 common.Address) (*types.Transaction, error) {\n\treturn _IPancakeFactory.Contract.SetFeeToSetter(&_IPancakeFactory.TransactOpts, arg0)\n}", "title": "" }, { "docid": "81e2e46a394b5f2d02c7befa58f8d735", "score": "0.512081", "text": "func (_IPancakeFactory *IPancakeFactoryTransactorSession) SetFeeToSetter(arg0 common.Address) (*types.Transaction, error) {\n\treturn _IPancakeFactory.Contract.SetFeeToSetter(&_IPancakeFactory.TransactOpts, arg0)\n}", "title": "" }, { "docid": "56560e592c1453885279752db69dceee", "score": "0.5115403", "text": "func NewVariableFee(pcent float64, description string) Fee {\n\treturn Fee{\n\t\tVariable: pcent,\n\t\tDescription: description,\n\t}\n}", "title": "" }, { "docid": "60675c488c9344bc1331879a46b1ce68", "score": "0.5113284", "text": "func (_IPancakeFactory *IPancakeFactoryCallerSession) FeeToSetter() (common.Address, error) {\n\treturn _IPancakeFactory.Contract.FeeToSetter(&_IPancakeFactory.CallOpts)\n}", "title": "" }, { "docid": "ad53706ed60ff79457dc199785333091", "score": "0.5107812", "text": "func (_ParameterizerContract *ParameterizerContractSession) Proposals(arg0 [32]byte) (struct {\n\tAppExpiry *big.Int\n\tChallengeID *big.Int\n\tDeposit *big.Int\n\tName string\n\tOwner common.Address\n\tProcessBy *big.Int\n\tValue *big.Int\n}, error) {\n\treturn _ParameterizerContract.Contract.Proposals(&_ParameterizerContract.CallOpts, arg0)\n}", "title": "" }, { "docid": "a475d146102fb7229d238b9b881f860f", "score": "0.5104556", "text": "func (_PancakeFactory *PancakeFactoryCaller) FeeToSetter(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _PancakeFactory.contract.Call(opts, &out, \"feeToSetter\")\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": "f7e9ae57831f32dd282873d36fbd2d01", "score": "0.51029986", "text": "func (pt *Note) GetFee() util.String {\n\tvar fee = decimal.Zero\n\tfor _, ref := range pt.References {\n\t\tif !ref.Fee.Empty() {\n\t\t\tfee = fee.Add(ref.Fee.Decimal())\n\t\t}\n\t}\n\treturn util.String(fee.String())\n}", "title": "" }, { "docid": "1a3acc0979deabdf78e2b092b3f4ad91", "score": "0.51003844", "text": "func (_ChequeBook *ChequeBookTransactor) Deposit(opts *bind.TransactOpts, _amount *big.Int) (*types.Transaction, error) {\n\treturn _ChequeBook.contract.Transact(opts, \"deposit\", _amount)\n}", "title": "" }, { "docid": "fd476c148309ec17d0defdcbd75e2c47", "score": "0.51003253", "text": "func (_CarContractFunctions *CarContractFunctionsCallerSession) Fee() (*big.Int, error) {\n\treturn _CarContractFunctions.Contract.Fee(&_CarContractFunctions.CallOpts)\n}", "title": "" }, { "docid": "81bda732aef563230c90be3006559259", "score": "0.509677", "text": "func (_CarContractFunctions *CarContractFunctionsSession) UpdateFee(_value *big.Int) (*types.Transaction, error) {\n\treturn _CarContractFunctions.Contract.UpdateFee(&_CarContractFunctions.TransactOpts, _value)\n}", "title": "" }, { "docid": "9f270f86e953bfd44092b12a5a8ba09f", "score": "0.50949377", "text": "func (d *CreateDeposit) Amount() *big.Int { return d.amount }", "title": "" }, { "docid": "256c1d313b5cd2f45281b11fa373184b", "score": "0.5093175", "text": "func (t *TestObject) ClacFee(p []Poker) (result0 int64, err types.Error) {\n\terr.ErrorCode = types.CodeOK\n\tdefer FuncRecover(&err)\n\tutest.NextBlock(1)\n\tresult0 = t.obj.ClacFee(p)\n\tutest.Commit()\n\treturn\n}", "title": "" }, { "docid": "b66ab99e2f99fd2b027875cbec6b8b64", "score": "0.50925773", "text": "func (_VorCoordinator *VorCoordinatorTransactor) ChangeGranularFee(opts *bind.TransactOpts, _publicProvingKey [2]*big.Int, _fee *big.Int, _consumer common.Address) (*types.Transaction, error) {\n\treturn _VorCoordinator.contract.Transact(opts, \"changeGranularFee\", _publicProvingKey, _fee, _consumer)\n}", "title": "" }, { "docid": "049de288c444719a018e52f75709998f", "score": "0.50916475", "text": "func (pm *PaymentMgr) applyTxFees(inputs []chainjson.TransactionInput, outputs map[string]dcrutil.Amount,\n\ttOut dcrutil.Amount, feeAddr stdaddr.Address) (dcrutil.Amount, dcrutil.Amount, error) {\n\tfuncName := \"applyTxFees\"\n\tif len(inputs) == 0 {\n\t\tdesc := fmt.Sprintf(\"%s: cannot create a payout transaction \"+\n\t\t\t\"without a tx input\", funcName)\n\t\treturn 0, 0, errs.PoolError(errs.TxIn, desc)\n\t}\n\tif len(outputs) == 0 {\n\t\tdesc := fmt.Sprintf(\"%s: cannot create a payout transaction \"+\n\t\t\t\"without a tx output\", funcName)\n\t\treturn 0, 0, errs.PoolError(errs.TxOut, desc)\n\t}\n\tinSizes := make([]int, len(inputs))\n\tfor range inputs {\n\t\tinSizes = append(inSizes, txsizes.RedeemP2PKHSigScriptSize)\n\t}\n\toutSizes := make([]int, len(outputs))\n\tfor range outputs {\n\t\toutSizes = append(outSizes, txsizes.P2PKHOutputSize)\n\t}\n\tchangeScriptSize := 0\n\testSize := txsizes.EstimateSerializeSizeFromScriptSizes(inSizes, outSizes,\n\t\tchangeScriptSize)\n\testFee := txrules.FeeForSerializeSize(txrules.DefaultRelayFeePerKb, estSize)\n\tsansFees := tOut - estFee\n\n\tfor addr, v := range outputs {\n\t\t// Pool fee payments are excluded from tx fee deductions.\n\t\tif addr == feeAddr.String() {\n\t\t\tcontinue\n\t\t}\n\n\t\tratio := float64(int64(sansFees)) / float64(int64(v))\n\t\toutFee := estFee.MulF64(ratio)\n\t\toutputs[addr] -= outFee\n\t}\n\n\treturn sansFees, estFee, nil\n}", "title": "" }, { "docid": "4c3800344e0cc031949e8564cb8b905e", "score": "0.5091394", "text": "func (_PancakeFactory *PancakeFactorySession) FeeTo() (common.Address, error) {\n\treturn _PancakeFactory.Contract.FeeTo(&_PancakeFactory.CallOpts)\n}", "title": "" }, { "docid": "f556039daa87d1526fb5fe60089b2db0", "score": "0.5091304", "text": "func (_Manager *ManagerTransactor) SubmitProposal(opts *bind.TransactOpts, _name string, _symbol string, _decimals uint8, _totalSupply *big.Int, _initialPercentage uint8, _vestingPeriodInWeeks *big.Int, _vestingBeneficiary common.Address) (*types.Transaction, error) {\n\treturn _Manager.contract.Transact(opts, \"submitProposal\", _name, _symbol, _decimals, _totalSupply, _initialPercentage, _vestingPeriodInWeeks, _vestingBeneficiary)\n}", "title": "" }, { "docid": "70a85ec93ba36d818207984495b86ef3", "score": "0.50821483", "text": "func (self *Instance) Propose(value []byte) (uint64, error) {\n log.Debug(\"[%s]try to propose value %s\", self.name, string(value))\n return self.committer.NewValue(value)\n}", "title": "" }, { "docid": "6d6b9b820a02c825a78cdcb001de29a0", "score": "0.50790876", "text": "func (_ParameterizerContract *ParameterizerContractCallerSession) Proposals(arg0 [32]byte) (struct {\n\tAppExpiry *big.Int\n\tChallengeID *big.Int\n\tDeposit *big.Int\n\tName string\n\tOwner common.Address\n\tProcessBy *big.Int\n\tValue *big.Int\n}, error) {\n\treturn _ParameterizerContract.Contract.Proposals(&_ParameterizerContract.CallOpts, arg0)\n}", "title": "" }, { "docid": "e161fd6b912e501ce7cc839151032edb", "score": "0.5072905", "text": "func (_EtherDelta *EtherDeltaCaller) FeeAccount(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _EtherDelta.contract.Call(opts, out, \"feeAccount\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "a9026cbac8afcaea8e931c7058950fea", "score": "0.50720155", "text": "func (*FixedFee) Descriptor() ([]byte, []int) {\n\treturn file_proto_custom_fees_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "8bd45ffa60c3739f81a41eba83b73dde", "score": "0.50684154", "text": "func (msg MsgDAOTransfer) GetFee() sdk.Int {\n\treturn sdk.NewInt(GovFeeMap[msg.Type()])\n}", "title": "" } ]
48f0729be7066516d7faea3e39865fda
Search and select a repository
[ { "docid": "53ccc0f08cf5518d9dadf0525b539cb8", "score": "0.74615246", "text": "func selRepo(text string) (repo, error) {\n\tvar full_name string\n\tvar r repo\n\tif strings.Contains(text, \"/\") {\n\t\tfull_name = text\n\t} else {\n\t\tres, err := getRepoList(text)\n\t\tif err != nil {\n\t\t\treturn r, err\n\t\t}\n\t\tfor i := 0; i < len(res.Items); i++ {\n\t\t\tif strings.ToUpper(res.Items[i].Name) == strings.ToUpper(text) {\n\t\t\t\tfull_name = res.Items[i].FullName\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif full_name == \"\" {\n\t\t\treturn r, errors.New(\"Repository(\" + text + \") not found ...\")\n\t\t}\n\t}\n\tr, err := getRepo(full_name)\n\tif err != nil {\n\t\treturn r, err\n\t}\n\treturn r, nil\n}", "title": "" } ]
[ { "docid": "e5fe522cc89da3e53f7ea90236a7f8cb", "score": "0.6353212", "text": "func FindRepository(db gorp.SqlExecutor, name string, account Account) (*Repository, error) {\n\tvar repo Repository\n\terr := db.SelectOne(&repo,\n\t\t\"SELECT * FROM repos WHERE account_name = $1 AND name = $2\", account.Name, name)\n\treturn &repo, err\n}", "title": "" }, { "docid": "7f6af120396f2b10cae7705bbda5e16a", "score": "0.60471714", "text": "func getRepoList(text string) (searchResult, error) {\n\tvar gURL string = \"https://api.github.com/search/repositories?q=\"\n\tvar res searchResult\n\tresp, err := http.Get(gURL + url.QueryEscape(text))\n\tif err != nil {\n\t\treturn res, err\n\t}\n\tdec := json.NewDecoder(resp.Body)\n\terr = dec.Decode(&res)\n\tif err != nil {\n\t\treturn res, err\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "98ee7df7d1172b6ad082eb51eb263cf5", "score": "0.59730154", "text": "func SearchRepository(query string, with ...func(opt *searchTextdataOpt) searchTextdataOpt) ([]Textdata, error) {\n\n\t// search from shared memory(singleton, no exclusive locks)\n\trefRepos := textDataRepository\n\tif refRepos == nil {\n\t\tmsg := \"Repository is not initialized.\"\n\t\treturn nil, fmt.Errorf(msg)\n\t}\n\n\tdatas := make([]Textdata, 0, 0)\n\tif query == \"\" {\n\t\tdatas = append(datas, *refRepos...)\n\t\treturn datas, nil\n\t}\n\n\t// init & applyOptions\n\topt := searchTextdataOpt{\n\t\tQuery: query,\n\t\tWordOnly: false,\n\t\tIgnoreCase: true,\n\t\tRegex: false,\n\t\tBodyOnly: false,\n\t}\n\tfor _, optFunc := range with {\n\t\topt = optFunc(&opt)\n\t}\n\n\tregex, err := initRegexMatcher(&opt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, data := range *refRepos {\n\t\tif !opt.BodyOnly {\n\t\t\tif regex.MatchString(data.Namespace + \"/\" + data.Caption) {\n\t\t\t\tdatas = append(datas, data)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif regex.MatchString(data.Body) {\n\t\t\tdatas = append(datas, data)\n\t\t\tcontinue\n\t\t}\n\t}\n\n\treturn datas, nil\n}", "title": "" }, { "docid": "65948610c24cb3f9da1db76ff6662f6f", "score": "0.5948926", "text": "func get_searchPage_repo(orderBy string, page int) (int, int) {\n\t// check param errors\n\tif orderBy != \"stars\" && orderBy != \"forks\" {\n\t\tfmt.Println(\"get_searchPage_repo must have 'stars' or 'forks' as first parameter\")\n\t\tos.Exit(1)\n\t}\n\tif page <= 0 {\n\t\tpage = 1\n\t}\n\n\t// get the page\n\turl := \"https://github.com/search?o=desc&q=stars%3A%3E1&s=\" + orderBy + \"&type=Repositories&p=\" + strconv.Itoa(page)\n\tdoc := get_html_page(url)\n\tif doc == nil {\n\t\tfmt.Println(\"Failed to parse page \" + strconv.Itoa(page))\n\t\treturn -1, -1\n\t}\n\n\t// need to return min value to stop scrapping\n\tvar min_stars = 0\n\tvar min_forks = 0\n\n\t// html parsing\n\trepo_list := doc.Find(\".repo-list-item\")\n\tif repo_list == nil {\n\t\tfmt.Println(\"Failed to parse page \" + strconv.Itoa(page))\n\t\treturn -1, -1\n\t}\n\n\trepo_list.Each(func (i int, repo *goquery.Selection) {\n\t\tvar nbr_stars = 0\n\t\tvar nbr_forks = 0\n\t\tvar repo_path = \"\"\n\t\tvar repo_name = \"\"\n\t\tvar repo_owner = \"\"\n\n\t\t// find forks and stars numbers in the DOM\n\t\tstat_items := repo.Find(\".repo-list-stat-item\")\n\t\tstat_items.Each(func (j int, stat_item *goquery.Selection) {\n\t\t\tstatItem_value, exists := stat_item.Attr(\"aria-label\")\n\t\t\tif exists == true {\n\t\t\t\tstat_item := strings.TrimSpace(stat_item.Text())\n\t\t\t\tstat_item = strings.Replace(stat_item, \",\", \"\", 3)\n\t\t\t\tnbr, err := strconv.Atoi(stat_item)\n\t\t\t\tif err == nil && statItem_value == \"Stargazers\" {\n\t\t\t\t\tnbr_stars = nbr\n\t\t\t\t}\n\t\t\t\tif err == nil && statItem_value == \"Forks\" {\n\t\t\t\t\tnbr_forks = nbr\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\n\t\t// find repo name and owner\n\t\trepo_path = repo.Find(\".repo-list-name a\").Text()\n\t\trepo_owner = strings.Split(repo_path, \"/\")[0]\n\t\trepo_name = strings.Split(repo_path, \"/\")[1]\n\n\t\t// update min values to stop the scrapping\n\t\tif nbr_stars > 0 && (min_stars == 0 || min_stars > nbr_stars) {\n\t\t\tmin_stars = nbr_stars\n\t\t}\n\t\tif nbr_forks > 0 && (min_forks == 0 || min_forks > nbr_forks) {\n\t\t\tmin_forks = nbr_forks\n\t\t}\n\n\t\tpersist_scrapped_repo(repo_path, repo_owner, repo_name, nbr_stars, nbr_forks)\n\t})\n\n\treturn min_stars, min_forks\n}", "title": "" }, { "docid": "6316edb890d561a6728c09add3a16f8e", "score": "0.59092623", "text": "func (gui *Gui) getSelectedRepository() *git.RepoEntity {\n\tv, _ := gui.g.View(mainViewFeature.Name)\n\t_, oy := v.Origin()\n\t_, cy := v.Cursor()\n\t// if _, err := v.Line(cy); err != nil {\n\t// \treturn r, err\n\t// }\n\treturn gui.State.Repositories[cy+oy]\n}", "title": "" }, { "docid": "a67154d37a97ca0cdbf4ff07522af251", "score": "0.5877471", "text": "func (app *App) Search(pattern string) ([]*model.Repo, *model.Error) {\n\treturn services.SearchRepos(\"*\" + pattern + \"*\")\n}", "title": "" }, { "docid": "0fca40bb1d4a7c2eb98ded95fa719645", "score": "0.58360183", "text": "func Search(query string, limit int) ([]string, error) {\n\tclient := github.NewClient(nil)\n\tctx := context.Background()\n\tresult, _, err := client.Search.Repositories(ctx, query, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(result.Repositories) == 0 {\n\t\treturn nil, fmt.Errorf(\"query '%s' returned no results\", query)\n\t}\n\n\tnResults := min(len(result.Repositories), limit)\n\tnames := make([]string, nResults)\n\tfor i := 0; i < nResults; i++ {\n\t\tnames[i] = result.Repositories[i].GetFullName()\n\t}\n\treturn names, nil\n}", "title": "" }, { "docid": "a5ecd24fdb0d9d057f722b80a8fa7bf6", "score": "0.5829564", "text": "func (rbgs *remoteBlobGetterService) findCandidateRepository(\n\tctx context.Context,\n\trepositoryCandidates []string,\n\tsearch map[string]imagePullthroughSpec,\n\tcachedLayers []string,\n\tdgst digest.Digest,\n\tretriever importer.RepositoryRetriever,\n) (distribution.Descriptor, error) {\n\t// no possible remote locations to search, exit early\n\tif len(search) == 0 {\n\t\treturn distribution.Descriptor{}, distribution.ErrBlobUnknown\n\t}\n\n\t// see if any of the previously located repositories containing this digest are in this\n\t// image stream\n\tfor _, repo := range cachedLayers {\n\t\tspec, ok := search[repo]\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tdesc, err := rbgs.proxyStat(ctx, retriever, &spec, dgst)\n\t\tif err != nil {\n\t\t\tdelete(search, repo)\n\t\t\tcontinue\n\t\t}\n\t\tcontext.GetLogger(ctx).Infof(\"Found digest location from cache %q in %q\", dgst, repo)\n\t\treturn desc, nil\n\t}\n\n\t// search the remaining registries for this digest\n\tfor _, repo := range repositoryCandidates {\n\t\tspec, ok := search[repo]\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tdesc, err := rbgs.proxyStat(ctx, retriever, &spec, dgst)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\trbgs.cachedLayers.RememberDigest(dgst, rbgs.cacheTTL, repo)\n\t\tcontext.GetLogger(ctx).Infof(\"Found digest location by search %q in %q\", dgst, repo)\n\t\treturn desc, nil\n\t}\n\n\treturn distribution.Descriptor{}, distribution.ErrBlobUnknown\n}", "title": "" }, { "docid": "072f1b6e58cb23b5d0a007a6ad9dde80", "score": "0.58257", "text": "func SearchH(w http.ResponseWriter, r *http.Request, els *ElServer, gins *GinServer) {\n\trbd := SearchRequest{}\n\terr := getParsedBody(r, &rbd)\n\tlog.Debugf(\"got a search request:%+v\", rbd)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\t// Get repo ids from the gin server to which the user has access\n\t// we need to limit results to those\n\trepos := []gogs.Repository{}\n\terr = getParsedHttpCall(http.MethodGet, fmt.Sprintf(\"%s/api/v1/user/repos\", gins.URL),\n\t\tnil, rbd.Token, rbd.CsrfT, &repos)\n\tif err != nil {\n\t\tlog.Errorf(\"could not querry repos: %+v\", err)\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\treturn\n\t}\n\t// Get repos ids for public repos\n\tprepos := struct{ Data []gogs.Repository }{}\n\terr = getParsedHttpCall(http.MethodGet, fmt.Sprintf(\"%s/api/v1/repos/search/?limit=10000\", gins.URL),\n\t\tnil, rbd.Token, rbd.CsrfT, &prepos)\n\tif err != nil {\n\t\tlog.Errorf(\"could not querry public repos: %+v\", err)\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\treturn\n\t}\n\trepos = append(repos, prepos.Data...)\n\n\trepids := make([]string, len(repos))\n\tfor c, repo := range repos {\n\t\trepids[c] = fmt.Sprintf(\"%d\", repo.ID)\n\t}\n\tlog.Debugf(\"Repod to search in:%+v\", repids)\n\t// Lets search now\n\trBlobs := [] BlobSResult{}\n\terr = searchBlobs(rbd.Querry, repids, els, &rBlobs)\n\tif err != nil {\n\t\tlog.Warnf(\"could not search blobs:%+v\", err)\n\t}\n\trCommits := [] CommitSResult{}\n\terr = searchCommits(rbd.Querry, repids, els, &rCommits)\n\tif err != nil {\n\t\tlog.Warnf(\"could not search commits:%+v\", err)\n\t}\n\tdata, err := json.Marshal(SearchResults{Blobs: rBlobs, Commits: rCommits})\n\tif err != nil {\n\t\tlog.Debugf(\"Could not Masrschal search results\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(data)\n}", "title": "" }, { "docid": "abd12e8e1f8bd730cb7558074848189c", "score": "0.5804365", "text": "func (s *Server) Get(ctx context.Context, q *RepoQuery) (*appsv1.Repository, error) {\n\tif !s.enf.EnforceClaims(ctx.Value(\"claims\"), \"repositories\", \"get\", q.Repo) {\n\t\treturn nil, grpc.ErrPermissionDenied\n\t}\n\trepo, err := s.db.GetRepository(ctx, q.Repo)\n\treturn redact(repo), err\n}", "title": "" }, { "docid": "c86cb576494072e94da1f6633adbdf96", "score": "0.5791118", "text": "func getRepo(full_name string) (repo, error) {\n\tvar gURL string = \"https://api.github.com/repos/\"\n\tvar res repo\n\tresp, err := http.Get(gURL + full_name)\n\tif err != nil {\n\t\treturn res, err\n\t}\n\tdec := json.NewDecoder(resp.Body)\n\terr = dec.Decode(&res)\n\tif err != nil {\n\t\treturn res, err\n\t}\n\tif res.FullName == \"\" {\n\t\treturn res, errors.New(\"Repository(\" + full_name + \") not found ...\")\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "3287a71fce27b3c648c77645e0076de2", "score": "0.56340003", "text": "func (ha *App) Search(ctx context.Context, name string) (string, error) {\n\t// Needs helm 3.2+\n\tif out, err := ha.addRepo(ctx); err != nil {\n\t\treturn out, err\n\t}\n\tc := exec.CommandContext(ctx, \"helm\", \"search\", \"repo\", fmt.Sprintf(\"%s/%s\", ha.app.Repository.Name, name))\n\tout, err := c.CombinedOutput()\n\tif err != nil {\n\t\treturn string(out), err\n\t}\n\tif strings.Contains(string(out), \"No results found\") {\n\t\treturn string(out), errors.New(\"No results found\")\n\t}\n\treturn string(out), err\n}", "title": "" }, { "docid": "a2b350f6eb299577abdafcd8c5a70542", "score": "0.5607121", "text": "func FindRepositoryByID(db gorp.SqlExecutor, id int64) (*Repository, error) {\n\tvar repo Repository\n\terr := db.SelectOne(&repo,\n\t\t\"SELECT * FROM repos WHERE id = $1\", id)\n\treturn &repo, err\n}", "title": "" }, { "docid": "8ae2894b1e65f6d60a4ae643acba71aa", "score": "0.55980694", "text": "func (m *Repository) Search(w http.ResponseWriter, r *http.Request) {\n\tif err := render.Template(w, r, \"home.page.html\", &render.TemplateData{\n\t\tData: nil,\n\t}); err != nil {\n\t\tm.App.Error.Println(err)\n\t}\n}", "title": "" }, { "docid": "b5e31d91f46056b3fbdfa904dc5312b9", "score": "0.5566972", "text": "func (gh *githubVCS) Get(repo *Repository, opt Option) (interface{}, error) {\n\tctx := context.Background()\n\tghRepo, _, err := gh.client.Repositories.Get(ctx, repo.Owner, repo.Name)\n\treturn ghRepo, err\n}", "title": "" }, { "docid": "9a63ea08f7c87798301de5cf6b68e39d", "score": "0.5508006", "text": "func valRepo(p string) (bool, models.Repo) {\n\tvar repo models.Repo\n\tid, err := primitive.ObjectIDFromHex(p)\n\tif err != nil {\n\t\treturn false, repo\n\t}\n\trepo = database.GetRepo(id)\n\tif repo.Link == \"\" {\n\t\treturn false, repo\n\t}\n\treturn true, repo\n}", "title": "" }, { "docid": "596ce7d6e780ffbf1843e7958ea8f56c", "score": "0.54854906", "text": "func (g *localGitlab) SearchRepos(search string) ([]*searchRepoItem, error) {\n\topt := &gitlabApp.ListProjectsOptions{Search: gitlabApp.String(search)}\n\tprojects, _, err := g.Client().Projects.ListProjects(opt)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn nil, err\n\t}\n\n\tt := make([]*searchRepoItem, 0, len(projects))\n\tfor _, p := range projects {\n\t\titem := &searchRepoItem{}\n\t\tt = append(t, item)\n\t\titem.ID = string(p.ID)\n\t\titem.Name = p.PathWithNamespace\n\t\titem.Description = p.Description\n\t}\n\treturn t, nil\n}", "title": "" }, { "docid": "c5de8da67785706dc5a834ee7444505e", "score": "0.5478776", "text": "func (q *RepositoryQuery) FindByName(v string) *RepositoryQuery {\n\treturn q.Where(kallax.Eq(Schema.Repository.Name, v))\n}", "title": "" }, { "docid": "1fdba7cce59a3de663f0b0fab7e7988e", "score": "0.54768354", "text": "func Search(binary string, p string, q string, verbose bool) error {\n\tprov, err := ExpandProvider(p)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbuilder := Providers[prov]\n\n\tif builder != nil {\n\t\turl := builder.BuildURI(q)\n\t\tif verbose {\n\t\t\tfmt.Printf(\"%s\\n\", url)\n\t\t}\n\n\t\treturn launcher.OpenURI(binary, url)\n\t}\n\n\treturn fmt.Errorf(\"Provider %q not supported!\\n\", prov)\n}", "title": "" }, { "docid": "51fe4e18b43c7a171d0c21c92436231c", "score": "0.5465277", "text": "func (s *SearchService) search(ctx context.Context, searchType string, parameters *searchParameters, opt *SearchOptions, result interface{}) (*Response, error) {\n\tparams, err := qs.Values(opt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tq := strings.Replace(parameters.Query, \" \", \"+\", -1)\n\tif parameters.RepositoryID != nil {\n\t\tparams.Set(\"repository_id\", strconv.FormatInt(*parameters.RepositoryID, 10))\n\t}\n\tquery := \"q=\" + url.PathEscape(q)\n\tif v := params.Encode(); v != \"\" {\n\t\tquery = query + \"&\" + v\n\t}\n\tu := fmt.Sprintf(\"search/%s?%s\", searchType, query)\n\n\treq, err := s.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch {\n\tcase searchType == \"commits\":\n\t\t// Accept header for search commits preview endpoint\n\t\t// TODO: remove custom Accept header when this API fully launches.\n\t\treq.Header.Set(\"Accept\", mediaTypeCommitSearchPreview)\n\tcase searchType == \"repositories\":\n\t\t// Accept header for search repositories based on topics preview endpoint\n\t\t// TODO: remove custom Accept header when this API fully launches.\n\t\treq.Header.Set(\"Accept\", mediaTypeTopicsPreview)\n\tcase searchType == \"labels\":\n\t\t// Accept header for search labels based on label description preview endpoint.\n\t\t// TODO: remove custom Accept header when this API fully launches.\n\t\treq.Header.Set(\"Accept\", mediaTypeLabelDescriptionSearchPreview)\n\tcase opt != nil && opt.TextMatch:\n\t\t// Accept header defaults to \"application/vnd.github.v3+json\"\n\t\t// We change it here to fetch back text-match metadata\n\t\treq.Header.Set(\"Accept\", \"application/vnd.github.v3.text-match+json\")\n\t}\n\n\treturn s.client.Do(ctx, req, result)\n}", "title": "" }, { "docid": "decd479a8fa17573c5e2e1f93047c6d6", "score": "0.5462367", "text": "func (s *SearchService) Repositories(query string, opt *SearchOptions) (*RepositoriesSearchResult, *Response, error) {\n\tresult := new(RepositoriesSearchResult)\n\tresp, err := s.search(query, opt, result)\n\treturn result, resp, err\n}", "title": "" }, { "docid": "1df627b2c2b8c4a13a99d840a6f6dd53", "score": "0.5450001", "text": "func (r *SQLiteResolver) GetRepo(ctx context.Context, id int64) (string, error) {\n\n\tvar repo string\n\n\tq := \"SELECT s.name FROM catalog c, sources s WHERE c.id = ? AND c.repo_id = s.id\"\n\n\trow := r.db.QueryRowContext(ctx, q, id)\n\terr := row.Scan(&repo)\n\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Failed to scan row, %w\", err)\n\t}\n\n\treturn repo, nil\n}", "title": "" }, { "docid": "d3a0f8d981c147e87c37f191f981a355", "score": "0.54490787", "text": "func FindOrCreateRepository(db gorp.SqlExecutor, name string, account Account) (*Repository, error) {\n\tvar repo Repository\n\terr := db.SelectOne(&repo,\n\t\t\"INSERT INTO repos (account_name, name) VALUES ($1, $2) ON CONFLICT DO NOTHING RETURNING *\", account.Name, name)\n\tif errors.Is(err, sql.ErrNoRows) {\n\t\t//the row already existed, so we did not insert it and hence nothing was returned\n\t\treturn FindRepository(db, name, account)\n\t}\n\treturn &repo, err\n}", "title": "" }, { "docid": "e58a04b9c79c8e77dbabedfa9bc03a45", "score": "0.54366875", "text": "func (c *client) Repo(ctx context.Context, u *model.User, id model.ForgeRemoteID, owner, name string) (*model.Repo, error) {\n\tclient := c.newClientToken(ctx, u.Token)\n\n\tif id.IsValid() {\n\t\tintID, err := strconv.ParseInt(string(id), 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trepo, _, err := client.Repositories.GetByID(ctx, intID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn convertRepo(repo), nil\n\t}\n\n\trepo, _, err := client.Repositories.Get(ctx, owner, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn convertRepo(repo), nil\n}", "title": "" }, { "docid": "41b17d825de1f3e15ceaae9b192ac53a", "score": "0.54349583", "text": "func RepositoryGetByID(id int) (Person, common.Error) {\n\tvar person Person\n\n\tif err := common.DB.Where(\"id = ?\", id).First(&person).Error; err != nil {\n\t\treturn person, common.ErrorMessage()[\"CustomerNotFound\"]\n\t}\n\n\treturn person, error\n}", "title": "" }, { "docid": "ee3c3cb11f95d085e8dd1a0a615d501d", "score": "0.5433519", "text": "func FindRepository(dir string) (pathname string, err error) {\n\treturn findRepositoryWithStatFn(dir, os.Stat)\n}", "title": "" }, { "docid": "491576ad57e2157b23aeb4de3d41c97c", "score": "0.53947014", "text": "func (u *Controller) getRepository(db *mgo.Database) Repository {\n\trepo, err := NewMongoRepository(db)\n\tif err != nil {\n\t\tpanic(errors.New(http.StatusInternalServerError, err.Error()))\n\t}\n\n\treturn repo\n}", "title": "" }, { "docid": "c01839f3ec81d4d5c6aef56be043a864", "score": "0.5392572", "text": "func FindBlobByRepository(db gorp.SqlExecutor, blobDigest digest.Digest, repo Repository) (*Blob, error) {\n\tvar blob Blob\n\terr := db.SelectOne(&blob, blobGetQueryByRepoID, repo.AccountName, blobDigest.String(), repo.ID)\n\treturn &blob, err\n}", "title": "" }, { "docid": "3d5ce8f333cb1793f5711aad90c57a2b", "score": "0.53804004", "text": "func (cloud Cloud) Repositories(metadata bool) ([]common.Repository, error) {\n\n\tkindSplit := strings.SplitN(cloud.kind, \"/\", 2)\n\tkindType := kindSplit[0]\n\tkindKey := kindSplit[1]\n\n\taccountID, _, err := cloud.Credentials()\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to get repositories\")\n\t\treturn nil, err\n\t}\n\n\tswitch kindType {\n\tcase \"project\":\n\t\tro := bitbucket.RepositoriesOptions{Owner: accountID, Role: \"member\"}\n\t\tresult, err := cloud.API.Repositories.ListForAccount(&ro)\n\t\tif err != nil {\n\t\t\tlog.WithFields(logrus.Fields{\n\t\t\t\t\"project\": kindKey,\n\t\t\t}).Errorf(\"Failed to get project repositories\")\n\t\t\treturn nil, err\n\t\t}\n\n\t\trepositories := []common.Repository{}\n\t\tfor _, repo := range result.Items {\n\t\t\tif repo.Project.Key == kindKey {\n\n\t\t\t\trepoBytes, _ := json.MarshalIndent(repo, \"\", \" \")\n\t\t\t\trepoJSON := string(repoBytes)\n\t\t\t\t// fmt.Println(repoJSON)\n\t\t\t\t// Get all metadata for the repository\n\t\t\t\thttpCloneLink := gjson.Get(repoJSON, `Links.clone.#(name%\"http*\").href`).String()\n\t\t\t\tslug := gjson.Get(repoJSON, `Slug`).String()\n\t\t\t\tdescription := gjson.Get(repoJSON, `Description`).String()\n\n\t\t\t\tnewRepo := common.Repository{\n\t\t\t\t\tSlug: slug,\n\t\t\t\t\tSource: httpCloneLink,\n\t\t\t\t\tDescription: description,\n\t\t\t\t}\n\t\t\t\trepositories = append(repositories, newRepo)\n\t\t\t}\n\t\t}\n\t\trepositories = utils.FilterRepos(repositories, cloud.filters.include, cloud.filters.exclude)\n\t\treturn repositories, nil\n\n\tcase \"user\":\n\t\tro := bitbucket.RepositoriesOptions{Owner: kindKey, Role: \"member\"}\n\t\tresult, err := cloud.API.Repositories.ListForAccount(&ro)\n\t\tif err != nil {\n\t\t\tlog.WithFields(logrus.Fields{\n\t\t\t\t\"user\": kindKey,\n\t\t\t}).Errorf(\"Failed to get user repositories\")\n\t\t\treturn nil, err\n\t\t}\n\n\t\trepositories := []common.Repository{}\n\t\tfor _, repo := range result.Items {\n\t\t\trepoBytes, _ := json.MarshalIndent(repo, \"\", \" \")\n\t\t\trepoJSON := string(repoBytes)\n\n\t\t\thttpCloneLink := gjson.Get(repoJSON, `Links.clone.#(name%\"http*\").href`).String()\n\t\t\tslug := gjson.Get(repoJSON, `Slug`).String()\n\t\t\tdescription := gjson.Get(repoJSON, `Description`).String()\n\n\t\t\tnewRepo := common.Repository{\n\t\t\t\tSlug: slug,\n\t\t\t\tSource: httpCloneLink,\n\t\t\t\tDescription: description,\n\t\t\t}\n\t\t\trepositories = append(repositories, newRepo)\n\t\t}\n\t\trepositories = utils.FilterRepos(repositories, cloud.filters.include, cloud.filters.exclude)\n\t\treturn repositories, nil\n\n\tdefault:\n\t\tlog.WithFields(logrus.Fields{\n\t\t\t\"kind\": kindType,\n\t\t}).Errorf(\"Unsupported kind\")\n\t\treturn nil, fmt.Errorf(\"Unsupported kind\")\n\t}\n}", "title": "" }, { "docid": "4a5e293e1066d8cbc65caa725797a10f", "score": "0.53749764", "text": "func (c *Manager) getRepo(namespace, name string) (repoDef, error) {\n\tif namespace == \"\" {\n\t\tcr, err := c.clusterRepos.Get(name)\n\t\tif err != nil {\n\t\t\treturn repoDef{}, err\n\t\t}\n\t\treturn repoDef{\n\t\t\ttypedata: &cr.TypeMeta,\n\t\t\tmetadata: &cr.ObjectMeta,\n\t\t\tspec: &cr.Spec,\n\t\t\tstatus: &cr.Status,\n\t\t}, nil\n\t}\n\n\tpanic(\"namespace should never be empty\")\n}", "title": "" }, { "docid": "7d22e7d4e8647670e44e3000377c5048", "score": "0.53698695", "text": "func GetPersonRepository() PersonRepository {\n return personRepository\n}", "title": "" }, { "docid": "89a2bc0ca82d97d959ec885cb4a5578f", "score": "0.5365962", "text": "func (b Base) Repository() (reflow.Repository, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "f4fc5655079291151ca17c43ff00071e", "score": "0.5354806", "text": "func (this *User) GetRepository(id int, name string) *Repository {\n\tfor _, repository := range this.Repositories {\n\t\tif repository.Id == id {\n\t\t\treturn repository\n\t\t}\n\t}\n\n\trepository := NewRepository(id, name)\n\tthis.Repositories = append(this.Repositories, repository)\n\n\treturn repository\n}", "title": "" }, { "docid": "810268bddffd14e0f39d0213a919e548", "score": "0.5339139", "text": "func (c clientConfig) GetRepository(key string, v interface{}) error {\n\tpath := fmt.Sprintf(\"repositories/%s\", key)\n\tresp, err := c.execute(\"GET\", path, nil)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn fmt.Errorf(\"Failed to update repository. Status: %s\", resp.Status)\n\t}\n\n\tdecoder := json.NewDecoder(resp.Body)\n\terr = decoder.Decode(v)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn resp.Body.Close()\n}", "title": "" }, { "docid": "efed230e9a1d18c4d03f6a4e868ff001", "score": "0.5337539", "text": "func (s *RepositoryStore) FindOne(q *RepositoryQuery) (*Repository, error) {\n\tq.Limit(1)\n\tq.Offset(0)\n\trs, err := s.Find(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !rs.Next() {\n\t\treturn nil, kallax.ErrNotFound\n\t}\n\n\trecord, err := rs.Get()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := rs.Close(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn record, nil\n}", "title": "" }, { "docid": "65409847cb74245972895f5b1c32f1f7", "score": "0.5320489", "text": "func Repo(user, repo string, token *OAuthToken) map[string]interface{} {\n\treq := NewRequest(fmt.Sprintf(\"repos/%s/%s\", user, repo))\n\tjs := APIRequest(req, token)\n\treturn js[0]\n}", "title": "" }, { "docid": "5e33decd8915c85b735c59edbadfdad5", "score": "0.5319043", "text": "func (rs *RepositoryResultSet) One() (*Repository, error) {\n\tif !rs.Next() {\n\t\treturn nil, kallax.ErrNotFound\n\t}\n\n\trecord, err := rs.Get()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := rs.Close(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn record, nil\n}", "title": "" }, { "docid": "5d65b15d14291ba908333fb6a9027836", "score": "0.52938473", "text": "func Repository(repo eh.ReadRepo) *Repo {\n\tif repo == nil {\n\t\treturn nil\n\t}\n\n\tif r, ok := repo.(*Repo); ok {\n\t\treturn r\n\t}\n\n\treturn Repository(repo.Parent())\n}", "title": "" }, { "docid": "5d65b15d14291ba908333fb6a9027836", "score": "0.52938473", "text": "func Repository(repo eh.ReadRepo) *Repo {\n\tif repo == nil {\n\t\treturn nil\n\t}\n\n\tif r, ok := repo.(*Repo); ok {\n\t\treturn r\n\t}\n\n\treturn Repository(repo.Parent())\n}", "title": "" }, { "docid": "4bb143053676d6af58ec150904c0f21b", "score": "0.5292986", "text": "func (c *Client) GetRepository(repository string) (*Repository, error) {\n\tvar host, org, image string\n\tparts := strings.Split(repository, \"/\")\n\tswitch len(parts) {\n\tcase 1:\n\t\thost = dockerHubHost\n\t\torg = dockerHubLibrary\n\t\timage = parts[0]\n\tcase 2:\n\t\thost = dockerHubHost\n\t\torg = parts[0]\n\t\timage = parts[1]\n\tcase 3:\n\t\thost = parts[0]\n\t\torg = parts[1]\n\t\timage = parts[2]\n\tdefault:\n\t\treturn nil, fmt.Errorf(`expected image name as either \"<host>/<org>/<image>\", \"<org>/<image>\", or \"<image>\"`)\n\t}\n\thostlessImageName := fmt.Sprintf(\"%s/%s\", org, image)\n\n\t// quay.io wants us to use cookies for authorisation; the registry\n\t// client uses http.DefaultClient, so happily we can splat a\n\t// cookie jar into the default client and it'll work.\n\tjar, err := cookiejar.New(&cookiejar.Options{PublicSuffixList: publicsuffix.List})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\thttp.DefaultClient.Jar = jar\n\tclient := dockerregistry.NewClient()\n\n\tif host != dockerHubHost {\n\t\tbaseURL, err := url.Parse(fmt.Sprintf(\"https://%s/v1/\", host))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tclient.BaseURL = baseURL\n\t}\n\n\tauth0 := c.Credentials.For(host)\n\t// NB index.docker.io needs this because it's an \"index registry\";\n\t// quay.io needs this because this is where it sets the session\n\t// cookie it wants for authorisation later.\n\tauth, err := client.Hub.GetReadTokenWithAuth(hostlessImageName, auth0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttags, err := client.Repository.ListTags(hostlessImageName, auth)\n\tif err != nil {\n\t\tif regerr, ok := err.(dockerregistry.RegistryError); ok {\n\t\t\tif regerr.Code == 404 {\n\t\t\t\tc.Logger.Log(\"registry-err\", regerr)\n\t\t\t\treturn &Repository{\n\t\t\t\t\tName: repository,\n\t\t\t\t}, nil\n\t\t\t}\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn c.tagsToRepository(client, repository, tags, auth), nil\n}", "title": "" }, { "docid": "96884d246cdcd099a2ad0083678bb917", "score": "0.5291905", "text": "func FindUploadByRepository(db gorp.SqlExecutor, uuid string, repo Repository) (*Upload, error) {\n\tvar upload Upload\n\terr := db.SelectOne(&upload, uploadGetQueryByRepoID, uuid, repo.ID)\n\treturn &upload, err\n}", "title": "" }, { "docid": "90ccaf0866212028f537408317041828", "score": "0.52904975", "text": "func fetch(w http.ResponseWriter, r *http.Request) {\n\tusr := r.FormValue(\"firstname\")\n\turl := strings.Replace(URL, \"@\", usr, 1)\n\n\tres, err := http.Get(url)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tresp := &GitResponse{}\n\tif err = json.NewDecoder(res.Body).Decode(resp); err == nil {\n\t\tif resp.Count > 100 {\n\t\t\tPaginate(resp, url)\n\t\t}\n\t\tfmtDates(resp)\n\t\tresp.Username = usr\n\t\tsort.SliceStable(resp.Items, func(i, j int) bool { //sort the repos by name\n\t\t\treturn resp.Items[i].FullName < resp.Items[j].FullName\n\t\t})\n\t\tsendResp(resp, &w)\n\t\treturn\n\t}\n\tlog.Fatal(err)\n}", "title": "" }, { "docid": "04e0590eab2e3b782d53731e0030b6a1", "score": "0.52903485", "text": "func Repository(repo repo.ReadRepo) *Repo {\n\tif repo == nil {\n\t\treturn nil\n\t}\n\n\tif r, ok := repo.(*Repo); ok {\n\t\treturn r\n\t}\n\n\treturn Repository(repo.Parent())\n}", "title": "" }, { "docid": "6ff8fc8e7b783637100be640e9e9da98", "score": "0.5283512", "text": "func SelectOptionImageRepository() string {\n\tvar optionImageRegistry string\n\tprompt := &survey.Select{\n\t\tMessage: \"Select type of image repository\",\n\t\tOptions: []string{\"Openshift Internal repository\", \"External Registry\"},\n\t\tDefault: \"Openshift Internal repository\",\n\t}\n\n\terr := survey.AskOne(prompt, &optionImageRegistry, survey.Required)\n\tui.HandleError(err)\n\treturn optionImageRegistry\n}", "title": "" }, { "docid": "c6bc3addd9e2fce1deaf7d587f43da7e", "score": "0.52811635", "text": "func LookupRepository(ctx *pulumi.Context, args *LookupRepositoryArgs, opts ...pulumi.InvokeOption) (*LookupRepositoryResult, error) {\n\topts = internal.PkgInvokeDefaultOpts(opts)\n\tvar rv LookupRepositoryResult\n\terr := ctx.Invoke(\"aws-native:ecr:getRepository\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "title": "" }, { "docid": "b36e801c0d316c83c7ee9e18faa554b4", "score": "0.5277227", "text": "func (q *RepositoryQuery) FindByFullName(v string) *RepositoryQuery {\n\treturn q.Where(kallax.Eq(Schema.Repository.FullName, v))\n}", "title": "" }, { "docid": "b05ed33746afa5a6170543bfc7238459", "score": "0.524808", "text": "func FindRepository(fromPath string, fs billy.Filesystem) (*Repository, error) {\n\t// if root return error not found\n\tif fromPath == \"/\" {\n\t\treturn nil, ErrIsNotRepository\n\t}\n\n\t// if this isn't a repo, recurse up\n\t_, err := fs.Stat(fs.Join(fromPath, \".git\"))\n\tif err != nil {\n\t\treturn FindRepository(fs.Join(fromPath, \"..\"), fs)\n\t}\n\n\t// otherwise it is, so return\n\tgitRepo, err := ReadRepository(fromPath, fs)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn gitRepo, nil\n}", "title": "" }, { "docid": "8ed19fe3f2b57c6f01aba9c9fd523e1c", "score": "0.52460676", "text": "func searchRepositories(ctx context.Context, args *search.Args, limit int32) (res []*searchResultResolver, common *searchResultsCommon, err error) {\n\tif mockSearchRepositories != nil {\n\t\treturn mockSearchRepositories(args)\n\t}\n\n\tfieldWhitelist := map[string]struct{}{\n\t\tquery.FieldRepo: struct{}{},\n\t\tquery.FieldRepoGroup: struct{}{},\n\t\tquery.FieldType: struct{}{},\n\t\tquery.FieldDefault: struct{}{},\n\t\tquery.FieldIndex: struct{}{},\n\t\tquery.FieldCount: struct{}{},\n\t\tquery.FieldMax: struct{}{},\n\t\tquery.FieldTimeout: struct{}{},\n\t\tquery.FieldFork: struct{}{},\n\t\tquery.FieldArchived: struct{}{},\n\t}\n\t// Don't return repo results if the search contains fields that aren't on the whitelist.\n\t// Matching repositories based whether they contain files at a certain path (etc.) is not yet implemented.\n\tfor field := range args.Query.Fields {\n\t\tif _, ok := fieldWhitelist[field]; !ok {\n\t\t\treturn nil, nil, nil\n\t\t}\n\t}\n\n\tpattern, err := regexp.Compile(args.Pattern.Pattern)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tcommon = &searchResultsCommon{}\n\tvar results []*searchResultResolver\n\tfor _, repo := range args.Repos {\n\t\tif len(results) == int(limit) {\n\t\t\tcommon.limitHit = true\n\t\t\tbreak\n\t\t}\n\t\tif pattern.MatchString(string(repo.Repo.Name)) {\n\t\t\tresults = append(results, &searchResultResolver{repo: &repositoryResolver{repo: repo.Repo}})\n\t\t}\n\t}\n\treturn results, common, nil\n}", "title": "" }, { "docid": "68f19dc8eb1ed6f90a8b9cf52cc986ef", "score": "0.5244652", "text": "func (ha *HarborAdaptor) GetRepository(name string, namespace string) models.Repository {\n\treturn models.Repository{}\n}", "title": "" }, { "docid": "44ca75a42d6910b8e1dc0beed7ddee75", "score": "0.5240985", "text": "func copyRepo(repos []*harborModle.Repo, cli *harbor.Client, host string) []*models.Repository {\n\trepositories := make([]*models.Repository, 0)\n\tfor _, v := range repos {\n\t\t/*tag, err := cli.ListRepoTags(context.Background(), projectName, strings.Split(v.Name,\"/\")[1])\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}*/\n\t\t//for i := 0; i < int(v.TagsCount); i++ {\n\t\trepositories = append(repositories, &models.Repository{\n\t\t\tID: v.ID,\n\t\t\tName: strings.Split(host, \"//\")[1] + \"/\" + v.Name, /*+ \":\" + tag[i].Name*/\n\t\t\tProjectID: v.ProjectID,\n\t\t\tDescription: v.Description,\n\t\t\tPullCount: v.PullCount,\n\t\t\tStarCount: v.StarCount,\n\t\t\tTagsCount: v.TagsCount,\n\t\t\t//Tags: tag[i].Name,\n\t\t\tCreationTime: v.CreationTime,\n\t\t\tUpdateTime: v.UpdateTime,\n\t\t})\n\t\t//}\n\n\t}\n\treturn repositories\n}", "title": "" }, { "docid": "1dd2141530731f8764a2151026ca3f31", "score": "0.52407306", "text": "func (s *repos) GetByName(ctx context.Context, name api.RepoName) (_ *types.Repo, err error) {\n\tif Mocks.Repos.GetByName != nil {\n\t\treturn Mocks.Repos.GetByName(ctx, name)\n\t}\n\n\tctx, done := trace(ctx, \"Repos\", \"GetByName\", name, &err)\n\tdefer done()\n\n\trepo, err := db.Repos.GetByName(ctx, name)\n\tif err != nil && envvar.SourcegraphDotComMode() {\n\t\t// Automatically add repositories on Sourcegraph.com.\n\t\tif err := s.Add(ctx, name); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn db.Repos.GetByName(ctx, name)\n\t} else if err != nil {\n\t\tif !conf.GetTODO().DisablePublicRepoRedirects && strings.HasPrefix(strings.ToLower(string(name)), \"github.com/\") {\n\t\t\treturn nil, ErrRepoSeeOther{RedirectURL: (&url.URL{\n\t\t\t\tScheme: \"https\",\n\t\t\t\tHost: \"sourcegraph.com\",\n\t\t\t\tPath: string(name),\n\t\t\t\tRawQuery: url.Values{\"utm_source\": []string{conf.DeployType()}}.Encode(),\n\t\t\t}).String()}\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn repo, nil\n}", "title": "" }, { "docid": "3977453e9eb66d7a066390114ab3fd8f", "score": "0.5234423", "text": "func (s *ContainerRegistryService) GetSingleRegistryRepository(pid interface{}, opt *GetSingleRegistryRepositoryOptions, options ...RequestOptionFunc) (*RegistryRepository, *Response, error) {\n\tproject, err := parseID(pid)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tu := fmt.Sprintf(\"registry/repositories/%s\", PathEscape(project))\n\n\treq, err := s.client.NewRequest(http.MethodGet, u, opt, options)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\trepo := new(RegistryRepository)\n\tresp, err := s.client.Do(req, repo)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn repo, resp, nil\n}", "title": "" }, { "docid": "3071e7d34656cd7e10a90343247e7640", "score": "0.52281773", "text": "func (s *SearchService) Repositories(ctx context.Context, query string, opt *SearchOptions) (*RepositoriesSearchResult, *Response, error) {\n\tresult := new(RepositoriesSearchResult)\n\tresp, err := s.search(ctx, \"repositories\", &searchParameters{Query: query}, opt, result)\n\treturn result, resp, err\n}", "title": "" }, { "docid": "4c0b3c67379a65ea0d081b8b1f3d437e", "score": "0.5222213", "text": "func (c *configuration) Repository() Repository {\n\tdataSource := c.dataSource()\n\treturn dataSource.Repository()\n}", "title": "" }, { "docid": "5388fdd923b34cd1ff82630cdebf5085", "score": "0.522136", "text": "func findRepoFromNameAndOrg(db *sql.DB, ctx *lib.Ctx, repoName string, orgID *int) (int, bool) {\n\tvar rows *sql.Rows\n\tif orgID != nil {\n\t\trows = lib.QuerySQLWithErr(\n\t\t\tdb,\n\t\t\tctx,\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"select id from gha_repos where name=%s and org_id=%s\",\n\t\t\t\tlib.NValue(1),\n\t\t\t\tlib.NValue(2),\n\t\t\t),\n\t\t\trepoName,\n\t\t\torgID,\n\t\t)\n\t} else {\n\t\trows = lib.QuerySQLWithErr(\n\t\t\tdb,\n\t\t\tctx,\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"select id from gha_repos where name=%s and org_id is null\",\n\t\t\t\tlib.NValue(1),\n\t\t\t),\n\t\t\trepoName,\n\t\t)\n\t}\n\tdefer func() { lib.FatalOnError(rows.Close()) }()\n\texists := false\n\trid := 0\n\tfor rows.Next() {\n\t\tlib.FatalOnError(rows.Scan(&rid))\n\t\texists = true\n\t}\n\tlib.FatalOnError(rows.Err())\n\treturn rid, exists\n}", "title": "" }, { "docid": "5eb896c46bd7948f0f0d0777fcadacf7", "score": "0.521379", "text": "func (r *Session) SearchRepositories(term string, limit int) (*registrytypes.SearchResults, error) {\n\tif limit < 1 || limit > 100 {\n\t\treturn nil, fmt.Errorf(\"Limit %d is outside the range of [1, 100]\", limit)\n\t}\n\tlogrus.Debugf(\"Index server: %s\", r.indexEndpoint)\n\tu := r.indexEndpoint.String() + \"search?q=\" + url.QueryEscape(term) + \"&n=\" + url.QueryEscape(fmt.Sprintf(\"%d\", limit))\n\n\treq, err := http.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error while getting from the server: %v\", err)\n\t}\n\t// Have the AuthTransport send authentication, when logged in.\n\treq.Header.Set(\"X-Docker-Token\", \"true\")\n\tres, err := r.client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\tif res.StatusCode != 200 {\n\t\treturn nil, httputils.NewHTTPRequestError(fmt.Sprintf(\"Unexpected status code %d\", res.StatusCode), res)\n\t}\n\tresult := new(registrytypes.SearchResults)\n\treturn result, json.NewDecoder(res.Body).Decode(result)\n}", "title": "" }, { "docid": "d3aa623844b8cbc6b7e52aa49f83ef7c", "score": "0.52088964", "text": "func (s *REST) findRepositoryForMapping(ctx kapi.Context, mapping *api.ImageRepositoryMapping) (*api.ImageRepository, error) {\n\tif len(mapping.Name) > 0 {\n\t\treturn s.imageRepositoryRegistry.GetImageRepository(ctx, mapping.Name)\n\t}\n\tif len(mapping.DockerImageRepository) != 0 {\n\t\t//TODO make this more efficient\n\t\tlist, err := s.imageRepositoryRegistry.ListImageRepositories(ctx, labels.Everything())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor i := range list.Items {\n\t\t\tif mapping.DockerImageRepository == list.Items[i].DockerImageRepository {\n\t\t\t\treturn &list.Items[i], nil\n\t\t\t}\n\t\t}\n\t\treturn nil, errors.NewInvalid(\"imageRepositoryMapping\", \"\", errors.ValidationErrorList{\n\t\t\terrors.NewFieldNotFound(\"dockerImageRepository\", mapping.DockerImageRepository),\n\t\t})\n\t}\n\treturn nil, errors.NewNotFound(\"ImageRepository\", \"\")\n}", "title": "" }, { "docid": "facb87262c0978b290ad9058dafdf830", "score": "0.5200561", "text": "func TestSearchOnCentralRegistry(t *testing.T) {\n\ttestRequires(t, Network)\n\tsearchCmd := exec.Command(dockerBinary, \"search\", \"busybox\")\n\tout, exitCode, err := runCommandWithOutput(searchCmd)\n\tif err != nil || exitCode != 0 {\n\t\tt.Fatalf(\"failed to search on the central registry: %s, %v\", out, err)\n\t}\n\n\tif !strings.Contains(out, \"Busybox base image.\") {\n\t\tt.Fatal(\"couldn't find any repository named (or containing) 'Busybox base image.'\")\n\t}\n\n\tlogDone(\"search - search for repositories named (or containing) 'Busybox base image.'\")\n}", "title": "" }, { "docid": "50a0b14ce388786f37499f7313b2e997", "score": "0.5194907", "text": "func (q *RepositoryQuery) FindByGithubID(cond kallax.ScalarCond, v int) *RepositoryQuery {\n\treturn q.Where(cond(Schema.Repository.GithubID, v))\n}", "title": "" }, { "docid": "529e2e1f3f29babaa356862a78e6250c", "score": "0.5179878", "text": "func gitRepositoryRead(clients *client.AggregatedClient, repoID string, repoName string, projectID string) (*git.GitRepository, error) {\n\tidentifier := repoID\n\tif strings.EqualFold(identifier, \"\") {\n\t\tidentifier = repoName\n\t}\n\n\treturn clients.GitReposClient.GetRepository(clients.Ctx, git.GetRepositoryArgs{\n\t\tRepositoryId: converter.String(identifier),\n\t\tProject: converter.String(projectID),\n\t})\n}", "title": "" }, { "docid": "350ea7f4945311a94279c24f65b562b5", "score": "0.5179005", "text": "func testRepo() *library.Repo {\n\ti64 := int64(0)\n\ti := 0\n\tstr := \"\"\n\tb := false\n\n\treturn &library.Repo{\n\t\tID: &i64,\n\t\tPipelineType: &str,\n\t\tUserID: &i64,\n\t\tHash: &str,\n\t\tOrg: &str,\n\t\tName: &str,\n\t\tFullName: &str,\n\t\tLink: &str,\n\t\tClone: &str,\n\t\tBranch: &str,\n\t\tTimeout: &i64,\n\t\tCounter: &i,\n\t\tVisibility: &str,\n\t\tPrivate: &b,\n\t\tTrusted: &b,\n\t\tActive: &b,\n\t\tAllowPull: &b,\n\t\tAllowPush: &b,\n\t\tAllowDeploy: &b,\n\t\tAllowTag: &b,\n\t\tAllowComment: &b,\n\t}\n}", "title": "" }, { "docid": "23ad1a7f7cd19d925dddf26572e0b0a0", "score": "0.51743", "text": "func FromRepository(\n\tid scalar.ID,\n\tname string,\n\torigin string,\n\tstartTime time.Time,\n\tendTime time.Time,\n\tlastActivity time.Time,\n\tcreated time.Time,\n\tcreatedByID scalar.ID,\n\tdeleted time.Time,\n\tdeletedByID scalar.ID,\n) (obj *Project) {\n\tobj = &Project{\n\t\tid: id,\n\t\tname: name,\n\t\torigin: origin,\n\t\tstartTime: startTime,\n\t\tendTime: endTime,\n\t\tlastActivity: lastActivity,\n\t\tcreated: created,\n\t\tcreatedByID: createdByID,\n\t\tdeleted: deleted,\n\t\tdeletedByID: deletedByID,\n\t}\n\treturn\n}", "title": "" }, { "docid": "360bf30b6d965d291a976e20afcf6691", "score": "0.5167215", "text": "func (c *client) Repo(u *model.User, owner, name string) (*model.Repo, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "e4512b834209b34d83b44d19cf81de52", "score": "0.5153404", "text": "func (p Path) Repository() string {\n\tif p.Host() == \"\" {\n\t\treturn string(p)\n\t}\n\n\treturn strings.ReplaceAll(string(p), p.Host()+\"/\", \"\")\n}", "title": "" }, { "docid": "95381012038ab14132e646b2b551a32e", "score": "0.51511836", "text": "func (d *DockerApi) GetRepository(username, name string) (*Repository, error) {\n\tvar repo Repository\n\tif username != \"\" && name == \"\" {\n\t\tname = username\n\t\tusername = \"library\"\n\t}\n\tif username == \"_\" || username == \"\" {\n\t\tusername = \"library\"\n\t}\n\tusername = strings.ToLower(username)\n\tpth := d.getRoute(fmt.Sprintf(\"repositories/%s/%s\", username, name))\n\tr, err := requests.Get(d.client, pth, d.token)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = json.Unmarshal(r, &repo)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbuildSource, err := d.GetBuildSource(repo.Namespace, repo.Name)\n\trepo.BuildSource = buildSource\n\treturn &repo, nil\n}", "title": "" }, { "docid": "f48058cb17f09820b5eb026898c1127d", "score": "0.51510483", "text": "func (d *Decoder) repository(xref string) *RepositoryRecord {\n\tif xref == \"\" {\n\t\treturn &RepositoryRecord{}\n\t}\n\n\tref, found := d.refs[xref].(*RepositoryRecord)\n\tif !found {\n\t\trec := &RepositoryRecord{Xref: xref}\n\t\td.refs[rec.Xref] = rec\n\t\treturn rec\n\t}\n\treturn ref\n}", "title": "" }, { "docid": "9bc8f861c4d90f02edb4b4f322933121", "score": "0.5143976", "text": "func loadRepository() {\n\tctxt, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\trepo, err := cmisClient.GetRepository(ctxt, &empty.Empty{})\n\tif err != nil {\n\t\tupdateStatus(fmt.Sprintf(\"Failed to connect -> %s\", err))\n\t} else {\n\t\trepository = repo\n\t\tupdateStatus(fmt.Sprintf(\"Connected to %s\", repository.GetName()))\n\t\tobjectIDChannel <- repository.GetRootFolder().GetId()\n\t}\n}", "title": "" }, { "docid": "2900e3289cd281d15b143922369b2aad", "score": "0.514316", "text": "func search(cl *lib.Client, r string, c, m, d int) ([]byte, []extAQLFileInfo, error) {\n\n\t// construct and make AQL request\n\tvar request lib.Request\n\trequest.Verb = \"POST\"\n\trequest.Path = \"/api/search/aql\"\n\taqlString := fmt.Sprintf(`items.find(\n\t\t\t{\n\t\t\t\"$and\": [\n\t\t\t\t{\"repo\":\"%s\"},\n\t\t\t\t{\"created\": {\"$before\": \"%dmo\"}},\n\t\t\t\t{\"modified\": {\"$before\": \"%dmo\"}},\n\t\t\t\t{\"stat.downloaded\":{\"$before\": \"%dmo\"}}\n\t\t\t\t]\n\t\t\t}\n\t\t\t).include(\"updated\",\"created_by\",\"repo\",\"type\",\"size\",\n\t\t\t\"name\",\"modified_by\",\"path\",\"modified\",\"id\",\"actual_sha1\",\n\t\t\t\"created\",\"stat.downloaded\")`, r, c, m, d)\n\n\trequest.Body = bytes.NewReader([]byte(aqlString))\n\trequest.ContentType = \"text/plain\"\n\n\tresp, err := cl.HTTPRequest(request)\n\tif err != nil {\n\t\texitErrorf(\"could not query Artifactory API: \", err)\n\t}\n\n\t// decode response bytes into json\n\tvar res extAQLResults\n\terr = json.Unmarshal(resp, &res)\n\tif err != nil {\n\t\texitErrorf(\"could not decode Artifactory response: \", err)\n\t}\n\tlist := res.ExtResults\n\n\treturn resp, list, nil\n}", "title": "" }, { "docid": "7192ede2aade27d71bc02a7d4287a82f", "score": "0.5143088", "text": "func (h *Handler) fetchRepository(ctx context.Context, repositoryName, commit string) (string, error) {\n\ttempDir, err := makeTempDir()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\t_ = os.RemoveAll(tempDir)\n\t\t}\n\t}()\n\n\tcloneURL, err := makeCloneURL(h.options.FrontendURL, h.options.AuthToken, repositoryName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tcommands := [][]string{\n\t\t{\"-C\", tempDir, \"init\"},\n\t\t{\"-C\", tempDir, \"-c\", \"protocol.version=2\", \"fetch\", cloneURL.String(), commit},\n\t\t{\"-C\", tempDir, \"checkout\", commit},\n\t}\n\n\tfor _, args := range commands {\n\t\tif err := h.commander.Run(ctx, \"git\", args...); err != nil {\n\t\t\treturn \"\", errors.Wrap(err, fmt.Sprintf(\"failed `git %s`\", strings.Join(args, \" \")))\n\t\t}\n\t}\n\n\treturn tempDir, nil\n}", "title": "" }, { "docid": "606073676e8e8a2095520fd8766f4143", "score": "0.51427734", "text": "func fetch(ctx context.Context, owner string, repo string) (string, error) {\n\toptions := github.RepositoryContentGetOptions{}\n\tvar files [3]string\n\tfiles[0] = \"\"\n\tfiles[1] = \"docs/\"\n\tfiles[2] = \".github/\"\n\tvar content *github.RepositoryContent\n\tvar err error\n\tfor _, filepath := range files {\n\t\tcontent, _, _, err = client.Repositories.GetContents(ctx, owner, repo, filepath+\"CODEOWNERS\", &options)\n\t\tif err != nil {\n\t\t\tlog.Print(\"Error getting code owners \", err)\n\t\t\tcontinue\n\t\t}\n\t\treturn content.GetContent()\n\t}\n\treturn \"\", err\n}", "title": "" }, { "docid": "e9ad846fc9cca8b693462991d0ce9900", "score": "0.51181203", "text": "func FilterReposByPref(repos []*github.Repository, pref string) []*github.Repository {\n var prefRepos []*github.Repository\n for _, repo := range(repos) {\n if strings.Contains(*repo.Name, pref) {\n prefRepos = append(prefRepos, repo)\n }\n }\n return prefRepos\n}", "title": "" }, { "docid": "bdebf239f9a9131dcc5a6e37fd3a15d7", "score": "0.5111159", "text": "func ImportRepository(vendorName string, repoName string) {\n\n}", "title": "" }, { "docid": "a4bac67585ff1651d519428561e2aa8a", "score": "0.5095663", "text": "func (p *GitProvider) Search(term string) ([]string, error) {\n\tvar names []string\n\n\terr := p.visit(term, matchPredicate, func(file *object.File) error {\n\t\tnames = append(names, strings.Replace(file.Name, suffix, \"\", 1))\n\t\treturn nil\n\t}, false)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn names, err\n}", "title": "" }, { "docid": "4077abffb8b6e95ee82ab811d72932bc", "score": "0.50947195", "text": "func RunGitSearch(ctx context.Context) (err error) {\n\tvar searchStage SearchStage\n\tsearchStage.Init()\n\tvar rl RateLimiter\n\trl.Init()\n\n\tlogInfo(\"search stage started\")\n\terr = stage.RunMiddlewareStage(ctx, &searchStage, &rl, 1, 1)\n\tsearchStage.Close()\n\n\tif err != nil {\n\t\tlogErr(err)\n\t\treturn\n\t}\n\n\tvar fetchStage FetchStage\n\tfetchStage.Init()\n\tlogInfo(\"fetch stage started\")\n\t\n\terr = stage.RunStage(ctx, &fetchStage, &rl, 1, 1, 2)\n\tfetchStage.Close()\n\n\tif err != nil {\n\t\tlogErr(err)\n\t\treturn\n\t}\n\n\terr = UpdateState(stage.FRAGMENTED, stage.NEW, \"github\")\n\tif err != nil {\n\t\tlogErr(err)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "d1231b766205f2be8b4e6ad080294d46", "score": "0.5094673", "text": "func (s *Server) List(ctx context.Context, q *RepoQuery) (*appsv1.RepositoryList, error) {\n\trepoList, err := s.db.ListRepositories(ctx)\n\tif repoList != nil {\n\t\tnewItems := make([]appsv1.Repository, 0)\n\t\tfor _, repo := range repoList.Items {\n\t\t\tif s.enf.EnforceClaims(ctx.Value(\"claims\"), \"repositories\", \"get\", repo.Repo) {\n\t\t\t\tnewItems = append(newItems, *redact(&repo))\n\t\t\t}\n\t\t}\n\t\trepoList.Items = newItems\n\t}\n\treturn repoList, err\n}", "title": "" }, { "docid": "3ebbe8a2525478f4ae21fd45d4571a99", "score": "0.5086727", "text": "func (clt *registryClient) NewRepository(nameInRepository string) error {\n\turlToCall := strings.TrimSuffix(clt.endpoint.RegistryAPI, \"/\")\n\tchallengeManager1 := challenge.NewSimpleManager()\n\t_, err := ping(challengeManager1, clt.endpoint.RegistryAPI+\"/v2/\", \"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar transport http.RoundTripper = transport.NewTransport(\n\t\tnil, auth.NewAuthorizer(\n\t\t\tchallengeManager1,\n\t\t\tauth.NewTokenHandler(nil, clt.creds, nameInRepository, \"pull\")))\n\n\trlt := &rateLimitTransport{\n\t\tlimiter: clt.endpoint.Limiter,\n\t\ttransport: transport,\n\t\tendpoint: clt.endpoint.RegistryAPI,\n\t}\n\n\tnamed, err := reference.WithName(nameInRepository)\n\tif err != nil {\n\t\treturn err\n\t}\n\tclt.regClient, err = client.NewRepository(named, urlToCall, rlt)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "515de5794b330303d15f218b78e64829", "score": "0.5078159", "text": "func (cmd CreateCommand) Repository() *gitalypb.Repository {\n\treturn cmd.repository\n}", "title": "" }, { "docid": "71f058d824517dbd1bd479e1e7f39172", "score": "0.50781363", "text": "func NewRepository() Repository {\n\tdb := make(map[string]string)\n\treturn &Sub{db}\n}", "title": "" }, { "docid": "a231f36df920295fc7db33be5c47926c", "score": "0.5075126", "text": "func RepositoryFactory(dbCon *util.DatabaseConnection) auth.Repository {\n\tvar authRepo auth.Repository\n\tif dbCon.Driver == util.MySQL {\n\t\tauthRepo = NewMySQLRepository(dbCon.MySQLDB)\n\t} else if dbCon.Driver == util.MongoDB {\n\t\tauthRepo = NewMongoDBRepository(dbCon.MongoDB)\n\t}\n\n\treturn authRepo\n}", "title": "" }, { "docid": "1399d43efe947b3c1eec47188cd0f5a2", "score": "0.50747603", "text": "func (api *API) withRepository(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\trepoName := mux.Vars(r)[\"repo\"]\n\n\t\tvar repo repositories.Repository\n\t\tvar exists bool\n\n\t\tif len(repoName) == 0 {\n\t\t\thttp.Error(w, \"Repository not provided.\", http.StatusBadRequest)\n\t\t} else if repo, exists = api.config.Repositories[repoName]; !exists {\n\t\t\thttp.Error(w, \"Repository not found.\", http.StatusNotFound)\n\t\t} else {\n\t\t\tctx := context.WithValue(r.Context(), \"repo\", repo)\n\t\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t\t}\n\t})\n}", "title": "" }, { "docid": "47df2f92cd95440e62bc5d06eecd18a5", "score": "0.5073477", "text": "func (r *registry) Repositories(ctx context.Context, entries []string, last string) (int, error) {\n\tvar numFilled int\n\tvar returnErr error\n\n\tvalues := buildCatalogValues(len(entries), last)\n\tu, err := r.ub.BuildCatalogURL(values)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tresp, err := r.client.Get(u)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tdefer resp.Body.Close()\n\n\tif SuccessStatus(resp.StatusCode) {\n\t\tvar ctlg struct {\n\t\t\tRepositories []string `json:\"repositories\"`\n\t\t}\n\t\tdecoder := json.NewDecoder(resp.Body)\n\n\t\tif err := decoder.Decode(&ctlg); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\tfor cnt := range ctlg.Repositories {\n\t\t\tentries[cnt] = ctlg.Repositories[cnt]\n\t\t}\n\t\tnumFilled = len(ctlg.Repositories)\n\n\t\tlink := resp.Header.Get(\"Link\")\n\t\tif link == \"\" {\n\t\t\treturnErr = io.EOF\n\t\t}\n\t} else {\n\t\treturn 0, handleErrorResponse(resp)\n\t}\n\n\treturn numFilled, returnErr\n}", "title": "" }, { "docid": "6d30fc7ddc73dd1fb43e98227248e832", "score": "0.50666034", "text": "func (a *artifactHubClient) Search(so SearchOption) SearchResult {\n\t// Todo: implement Search for Artifact Hub\n\treturn SearchResult{}\n}", "title": "" }, { "docid": "3a8de73a1c00934f4afa352d2d469739", "score": "0.5066083", "text": "func FindBlobByRepositoryName(db gorp.SqlExecutor, blobDigest digest.Digest, repoName string, account Account) (*Blob, error) {\n\tvar blob Blob\n\terr := db.SelectOne(&blob, blobGetQueryByRepoName, account.Name, blobDigest.String(), repoName)\n\treturn &blob, err\n}", "title": "" }, { "docid": "0b15767ae20e897f4f136baeb248f5c4", "score": "0.5064432", "text": "func ConfigRepository(r Repository) {\n\trepo = r\n}", "title": "" }, { "docid": "b6e8d34d135a7bbd79821c2c9e1de802", "score": "0.5060897", "text": "func FindOneRepoRef(identifier string) (*RepoRef, error) {\n\treturn findOneRepoRefQ(db.Query(bson.M{\n\t\tRepoRefIdKey: identifier,\n\t}))\n}", "title": "" }, { "docid": "508bfabd62f313b695b976c28233665b", "score": "0.5058504", "text": "func (c *Config) Get(client *vela.Client) error {\n\tlogrus.Debug(\"executing get for repo configuration\")\n\n\t// set the pagination options for list of repositories\n\t//\n\t// https://pkg.go.dev/github.com/go-vela/sdk-go/vela?tab=doc#ListOptions\n\topts := &vela.ListOptions{\n\t\tPage: c.Page,\n\t\tPerPage: c.PerPage,\n\t}\n\n\tlogrus.Tracef(\"capturing repos for current user\")\n\n\t// send API call to capture a list of repositories\n\t//\n\t// https://pkg.go.dev/github.com/go-vela/sdk-go/vela?tab=doc#RepoService.GetAll\n\trepos, _, err := client.Repo.GetAll(opts)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// handle the output based off the provided configuration\n\tswitch c.Output {\n\tcase output.DriverDump:\n\t\t// output the repositories in dump format\n\t\t//\n\t\t// https://pkg.go.dev/github.com/go-vela/cli/internal/output?tab=doc#Dump\n\t\treturn output.Dump(repos)\n\tcase output.DriverJSON:\n\t\t// output the repositories in JSON format\n\t\t//\n\t\t// https://pkg.go.dev/github.com/go-vela/cli/internal/output?tab=doc#JSON\n\t\treturn output.JSON(repos)\n\tcase output.DriverSpew:\n\t\t// output the repositories in spew format\n\t\t//\n\t\t// https://pkg.go.dev/github.com/go-vela/cli/internal/output?tab=doc#Spew\n\t\treturn output.Spew(repos)\n\tcase \"wide\":\n\t\t// output the repositories in wide table format\n\t\treturn wideTable(repos)\n\tcase output.DriverYAML:\n\t\t// output the repositories in YAML format\n\t\t//\n\t\t// https://pkg.go.dev/github.com/go-vela/cli/internal/output?tab=doc#YAML\n\t\treturn output.YAML(repos)\n\tdefault:\n\t\t// output the repositories in table format\n\t\treturn table(repos)\n\t}\n}", "title": "" }, { "docid": "59738b40853c77adbc975fe6b2f6575f", "score": "0.50492144", "text": "func TestGitRepo_Read_UsesNameIfIdNotSet(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\treposClient := azdosdkmocks.NewMockGitClient(ctrl)\n\tclients := &client.AggregatedClient{\n\t\tGitReposClient: reposClient,\n\t\tCtx: context.Background(),\n\t}\n\n\tresourceData := schema.TestResourceDataRaw(t, ResourceGitRepository().Schema, nil)\n\tresourceData.Set(\"name\", \"a-name\")\n\tresourceData.Set(\"project_id\", \"a-project\")\n\n\texpectedArgs := git.GetRepositoryArgs{RepositoryId: converter.String(\"a-name\"), Project: converter.String(\"a-project\")}\n\treposClient.\n\t\tEXPECT().\n\t\tGetRepository(clients.Ctx, expectedArgs).\n\t\tReturn(nil, fmt.Errorf(\"error\")).\n\t\tTimes(1)\n\n\tresourceGitRepositoryRead(resourceData, clients)\n}", "title": "" }, { "docid": "df6815201b56d571466ea07730038ed5", "score": "0.504806", "text": "func (s *storage) Search(sr interface{}) ([]interface{}, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "43b5008cba031832fdd2d3c709f5ef9a", "score": "0.5045992", "text": "func (o GitRepoSourceResponseOutput) Repository() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GitRepoSourceResponse) string { return v.Repository }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "82f5b944d35ee816b56363a859701ad8", "score": "0.50353396", "text": "func SeperateRepository(ref reference.Named) NamedRepository {\n\tdomain, path := reference.SplitHostname(ref)\n\treturn &repository{domain: domain, path: path}\n}", "title": "" }, { "docid": "1fc713842663fdb4ee5555a9617b0ea2", "score": "0.5030973", "text": "func Open(s storage.Storer, worktree billy.Filesystem) (*Repository, error) {\n\t_, err := s.Reference(plumbing.HEAD)\n\tif err == plumbing.ErrReferenceNotFound {\n\t\treturn nil, ErrRepositoryNotExists\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn newRepository(s, worktree), nil\n}", "title": "" }, { "docid": "59e9e170e02b00c18908e655a8764510", "score": "0.50264734", "text": "func (rc *RepositoryController) Get() {\n\trc.Data[\"HarborRegUrl\"] = os.Getenv(\"HARBOR_REG_URL\")\n\trc.Forward(\"page_title_repository\", \"repository.htm\")\n}", "title": "" }, { "docid": "e5c19803c6720be3b1898832ff1b3ab7", "score": "0.5026332", "text": "func (c *Client) SearchRepositories(query string) (SearchRepositoryResults, error) {\n\tconst gqlQuery = `\nquery Search($query: String!) {\n\tsearch(query: $query) {\n\t\tresults {\n\t\t\tresults {\n\t\t\t\t... on Repository {\n\t\t\t\t\tname\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n`\n\tvariables := map[string]interface{}{\n\t\t\"query\": query,\n\t}\n\tvar resp struct {\n\t\tData struct {\n\t\t\tSearch struct {\n\t\t\t\tResults struct {\n\t\t\t\t\tResults []*SearchRepositoryResult `json:\"results\"`\n\t\t\t\t} `json:\"results\"`\n\t\t\t} `json:\"search\"`\n\t\t} `json:\"data\"`\n\t}\n\terr := c.GraphQL(\"\", gqlQuery, variables, &resp)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"request GraphQL\")\n\t}\n\n\treturn resp.Data.Search.Results.Results, nil\n}", "title": "" }, { "docid": "a0d503d020a04ea1260b476fda24d1b0", "score": "0.50208145", "text": "func (server *Server) RepositoryAPI() webrepository.WebRepository {\n\treturn server.repositories\n}", "title": "" }, { "docid": "e652ce988a87f6a2a2f4ea9316c75ac2", "score": "0.50201297", "text": "func (s *pcService) Search(q string) (pc []PC, err error) {\n\treturn s.repo.Search(q)\n}", "title": "" }, { "docid": "3d0cd4f8b9c4dcb04a1e5023613ea2b8", "score": "0.5018604", "text": "func (a ProductsApi) RepositoriesGet(projectId int32, q string, page int32, pageSize int32) ([]Repository, *APIResponse, error) {\n\n\tvar localVarHttpMethod = strings.ToUpper(\"Get\")\n\t// create path and map variables\n\tlocalVarPath := a.Configuration.BasePath + \"/repositories\"\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// 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(\"project_id\", a.Configuration.APIClient.ParameterToString(projectId, \"\"))\n\tlocalVarQueryParams.Add(\"q\", a.Configuration.APIClient.ParameterToString(q, \"\"))\n\tlocalVarQueryParams.Add(\"page\", a.Configuration.APIClient.ParameterToString(page, \"\"))\n\tlocalVarQueryParams.Add(\"page_size\", a.Configuration.APIClient.ParameterToString(pageSize, \"\"))\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"text/plain\", \"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t\"text/plain\",\n\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([]Repository)\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: \"RepositoriesGet\", 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": "2aa81099af6dfdc6006d5a7501fd11fd", "score": "0.5009184", "text": "func searchResultsToRepoNodes(matches []result.Match) ([]query.Node, error) {\n\tnodes := make([]query.Node, 0, len(matches))\n\tfor _, match := range matches {\n\t\trepoMatch, ok := match.(*result.RepoMatch)\n\t\tif !ok {\n\t\t\treturn nil, errors.Errorf(\"expected type %T, but got %T\", &result.RepoMatch{}, match)\n\t\t}\n\n\t\trepoFieldValue := \"^\" + regexp.QuoteMeta(string(repoMatch.Name)) + \"$\"\n\t\tif repoMatch.Rev != \"\" {\n\t\t\trepoFieldValue += \"@\" + repoMatch.Rev\n\t\t}\n\n\t\tnodes = append(nodes, query.Parameter{\n\t\t\tField: query.FieldRepo,\n\t\t\tValue: repoFieldValue,\n\t\t})\n\t}\n\n\treturn nodes, nil\n}", "title": "" }, { "docid": "fac0022315e2b06c03d9fc69eb597c27", "score": "0.50082636", "text": "func FindRepository(dirname string) (string, error) {\n\tlog.Debug().Str(\"dirname\", dirname).Msg(\"FindRepository\")\n\tfor curr := dirname; curr != \".\" && curr != \"/\"; curr = filepath.Dir(curr) {\n\t\tvcs := filepath.Join(curr, \".git\")\n\t\tlog.Debug().Str(\"name\", vcs).Msg(\"os.Stat\")\n\t\tinfo, err := os.Stat(vcs)\n\t\tlog.Debug().Str(\"info\", fmt.Sprintf(\"%#v\", info)).Err(err).Msg(\"os.Stat result\")\n\t\tif os.IsNotExist(err) {\n\t\t\tcontinue\n\t\t}\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrap(err, \"could not stat\")\n\t\t}\n\t\tif info.IsDir() {\n\t\t\treturn curr, nil\n\t\t}\n\t}\n\treturn \"\", errors.New(\"could not find repository\")\n}", "title": "" }, { "docid": "fef38c50705809cd476169bb7972dd5e", "score": "0.5007042", "text": "func RepoInfo() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tid, _ := strconv.ParseInt(\n\t\t\tchi.URLParam(r, \"repo\"), 10, 64)\n\t\tif id < 1 {\n\t\t\tctr.BadRequest(w, errors.New(\"cannot find repo, repo_id is invalid\"))\n\t\t\treturn\n\t\t}\n\n\t\tvar repo store.ReposData\n\t\tdb := global.GormDB().Where(&store.ReposData{\n\t\t\tID: id,\n\t\t}).First(&repo)\n\t\tif db.Error != nil {\n\t\t\tctr.BadRequest(w, db.Error)\n\t\t\treturn\n\t\t}\n\t\tctr.OK(w, repo)\n\t}\n}", "title": "" }, { "docid": "6957d469ba3c1d2a59379867074a6bac", "score": "0.5006061", "text": "func Repo(org, repo string) Option {\n\treturn Prefix(path.Join(\"/repos\", org, repo))\n}", "title": "" } ]
d2483999e21f5215c1559e267af27933
doAfterInsertHooks executes all "after Insert" hooks.
[ { "docid": "959a636f811047b5709d30ee04f76168", "score": "0.8630148", "text": "func (o *Transaction) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range transactionAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "bf15ebdfc40f4aad578c49bb9908ab8e", "score": "0.8705122", "text": "func (o *T) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range tAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "43cb80b56bc35f758dc7f56058e588e7", "score": "0.8627515", "text": "func (o *Store) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range storeAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2ffa0c6e7aa8938dc610e3a993a7169e", "score": "0.8561945", "text": "func (o *Page) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range pageAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "47ebfe73f49a7b950501710f357f9db8", "score": "0.8512916", "text": "func (o *UpepCodon) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range upepCodonAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ae90ceb0f7d6fe645c7f2d4509eccfff", "score": "0.8459167", "text": "func (o *Cvtermpath) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range cvtermpathAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5ec5e547b25ea2428a124f59816af102", "score": "0.8427126", "text": "func (o *Prospect) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range prospectAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4d4eca66be335542a8340b0ab2a07f30", "score": "0.8419318", "text": "func (o *Visit) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range visitAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5ddb591ba97801e9ec409a9eb4d6a975", "score": "0.84039646", "text": "func (o *Analysisfeature) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range analysisfeatureAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "64f90b4014c8a2b1ed3dceb1dfdd7382", "score": "0.8403646", "text": "func (o *Restaurant) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range restaurantAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "600b10a22c76dbd414449e744726f7c1", "score": "0.83880955", "text": "func (o *Tile) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range tileAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7c52da924fddc58f7052321d74881652", "score": "0.83869547", "text": "func (o *Sample) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range sampleAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3ca2805c1852dd5663fffddadf395186", "score": "0.8353392", "text": "func (o *BooksLog) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range booksLogAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f69e96adeb7066457990e94a43a5f80d", "score": "0.8330606", "text": "func (o *WorkLog) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range workLogAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b9a31f05735fe082aa223aaa80b806fa", "score": "0.8317295", "text": "func (o *Account) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range accountAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2043c2e62cdd91d0d0f1a2bde8df37d7", "score": "0.82989824", "text": "func (o *Document) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range documentAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2c9264d64bf137d9e403af3a8d811a64", "score": "0.8273453", "text": "func (o *Retro) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range retroAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1b150d8034a2ef00ff74fe3916e47f77", "score": "0.8273111", "text": "func (o *FeaturePub) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range featurePubAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9abdc1bff50d85014e9711fb746d2e7c", "score": "0.82714593", "text": "func (o *Manufacturer) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range manufacturerAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c414a8ec3447f0e4d9fd903c1bba4779", "score": "0.8252805", "text": "func (o *UserIllness) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range userIllnessAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "03e6a5b678453b3c9ecfed3d08ade207", "score": "0.8251757", "text": "func (o *Attendee) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range attendeeAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b8cad6b947d557523e49a0c9863ebcce", "score": "0.8250915", "text": "func (o *Tag) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range tagAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1248362b4ff41dc8c6fc62e9bf210568", "score": "0.825071", "text": "func (o *Authorize) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range authorizeAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0180bbb32489d4ce34fbc17a2001892b", "score": "0.8244625", "text": "func (o *TagMap) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tfor _, hook := range tagMapAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "67164fc941ee78654b3e1e9a015c5451", "score": "0.8240589", "text": "func (o *BookCategory) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range bookCategoryAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0ea8f9b7b173a6fbd5d4de5329fb4b1d", "score": "0.82397664", "text": "func (o *Dividend) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range dividendAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b6e49ece9a2da51343e31ab973bcdd15", "score": "0.8234723", "text": "func (o *Wallet) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range walletAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e562f89f55b10a31ec2198a5e673933e", "score": "0.8221301", "text": "func (o *FeaturePhenotype) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range featurePhenotypeAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8ad9f4a991b5a1369e6eedeadbac976a", "score": "0.8209552", "text": "func (o *Contact) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range contactAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e419da7c30d057e4f298228c65b48c80", "score": "0.8201995", "text": "func (o *Statistic) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range statisticAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "086332503aad2fbc7eed71e090701fb3", "score": "0.82019496", "text": "func (o *DiscountRule) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range discountRuleAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "947347f354f022289275054d22995c98", "score": "0.8189366", "text": "func (o *Ticket) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range ticketAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cdd5233821c30761ee3a0ff09a55047c", "score": "0.81833065", "text": "func (o *FilmCategory) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range filmCategoryAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f54ab9f94a3e5ceb46db705964f822f2", "score": "0.81817406", "text": "func (o *Trustline) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range trustlineAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "16ffcd83fb5e114409e8079660f22121", "score": "0.81750154", "text": "func (o *AuditPackage) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range auditPackageAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2523d164e5bf0e21ea4f1d421e33796f", "score": "0.81720406", "text": "func (o *Friend) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range friendAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1527517ac62da524f41fddd7d6926710", "score": "0.8171501", "text": "func (o *Job) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range jobAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0572fef1562726b215385c070d022868", "score": "0.8166241", "text": "func (o *Workspace) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tfor _, hook := range workspaceAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "89c53cfa3389d5677c209e20c1aed900", "score": "0.8158084", "text": "func (o *MPlan) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range mPlanAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ce0449c7adb27a1f48bb4dc10b2798d3", "score": "0.81568617", "text": "func (o *Storage) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range storageAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6eb5ef783f465ca4c35a8b0010144538", "score": "0.8154602", "text": "func (o *CMFDynamicReport) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range cmfDynamicReportAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4bc8816d43713847401fff4341d62685", "score": "0.81402117", "text": "func (o *BufferEvent) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range bufferEventAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3b98f1059feea52eb317b1b61abcb65f", "score": "0.81400913", "text": "func (o *Datahistoryjob) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range datahistoryjobAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ee753fb8bee32226ecb1349f26f7dd28", "score": "0.81332576", "text": "func (o *Slide) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range slideAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "901f66651559729a0995dce56d1842f3", "score": "0.8131596", "text": "func (o *APIApp) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range apiAppAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "38268a1b8633a648c0c5359ef20c7079", "score": "0.8122529", "text": "func (o *StockPub) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range stockPubAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f19742954c5d95d2cc17dee4219af4bf", "score": "0.81221193", "text": "func (o *Photo) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range photoAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b03a0efa9be02eff3622088880ecbf12", "score": "0.81172866", "text": "func (o *AppPlaybook) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range appPlaybookAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fd5b519cfdd38ade98173a21ffa1a1ac", "score": "0.81109595", "text": "func (o *NotificationArchive) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range notificationArchiveAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1ad437df80dd3048bbeb0f27de041b0f", "score": "0.81109023", "text": "func (o *RecipeBatch) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range recipeBatchAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "81b3ba6e46d2b432050942ab25a3e776", "score": "0.81057656", "text": "func (o *AuthGroup) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range authGroupAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1992f442561fe5c892869eef4a6739aa", "score": "0.809587", "text": "func (o *Confidence) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range confidenceAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3fb1c9fa5dac4f8f39fd41a353680c30", "score": "0.8094861", "text": "func (o *FeaturepropPub) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range featurepropPubAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fd50354ea0fef2c1abce0e9b4c53be9a", "score": "0.8082968", "text": "func (o *Thermostat) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range thermostatAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "df02c1f269f2180a45546ec5389d8fad", "score": "0.8080617", "text": "func (o *TeamsCompetitionsStage) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range teamsCompetitionsStageAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d2ea10897420538b755420baac39b9e9", "score": "0.80755424", "text": "func (o *WithdrawalHistory) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range withdrawalHistoryAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3557d786f56b7422051ddb022abb8b11", "score": "0.807545", "text": "func (o *CMFLiveShut) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range cmfLiveShutAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7b88d58555e030b0fc200617703878bf", "score": "0.8074996", "text": "func (o *Link) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range linkAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ed6ccb7915f9a28033902bffec8bf994", "score": "0.8067912", "text": "func (o *UserTaskStep) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range userTaskStepAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "15fa2d8b0c5c658cef2323e3af9c7634", "score": "0.80663216", "text": "func (o *SMSOtpVerification) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range smsOtpVerificationAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e863b4ecb32067cced03a7b8e71bcd08", "score": "0.803548", "text": "func (o *WithdrawalFiat) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range withdrawalFiatAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "003162162742a92c96e2e2b820040134", "score": "0.8009379", "text": "func (o *CMFCashRecord) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range cmfCashRecordAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6dd95837b64e5c7f03bfdc25c51d88a1", "score": "0.79842424", "text": "func (o *RecipeFragrance) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range recipeFragranceAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "57429cb8240ce6ddd0dfe9904e27f19f", "score": "0.7980584", "text": "func (o *Additive) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range additiveAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2e56875b847bf0d4eeb11f3e45c4b435", "score": "0.79805785", "text": "func (o *CartItem) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range cartItemAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a18c71716bd61b8173a4542645c9c5ff", "score": "0.7969127", "text": "func (o *CMFShopOrderMessage) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range cmfShopOrderMessageAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c9290dda34359d882031e7671629a003", "score": "0.7964387", "text": "func (o *Cart) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range cartAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ec6ae861908bd7355cde6b9a363deadd", "score": "0.796199", "text": "func (o *Pubsub) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range pubsubAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9ad9a666cef8e29f855f81e8f7b28894", "score": "0.7942384", "text": "func (o *CMFTheme) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range cmfThemeAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "da0815e794637cafcd3c43e32922175b", "score": "0.792549", "text": "func (o *HomePicture) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range homePictureAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "78c619ba9a9283a964b25b5b9328b2b8", "score": "0.7925122", "text": "func (o *VolumeCitation) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range volumeCitationAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d349e5c72eb72d6ae9202da38357c580", "score": "0.79201", "text": "func (o *Video) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range videoAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e9bb9b392e907e2206f64615216a2069", "score": "0.78531015", "text": "func (o *CMFCashAccount) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range cmfCashAccountAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "be4dc950d9e574db098948abd616d56e", "score": "0.78498477", "text": "func (o *AuthUserUserPermission) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range authUserUserPermissionAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "67f09c3b82051df0241cce5f354e2a93", "score": "0.7848908", "text": "func (o *Volume) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range volumeAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a2c4225731060f8944ce9e29370c2061", "score": "0.7840302", "text": "func (o *Revokedtoken) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range revokedtokenAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5729ec081e5ef08ee5495748c9f41598", "score": "0.78237975", "text": "func (o *CMFUserToken) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range cmfUserTokenAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "64bab66ce2e342495bac960579162e9b", "score": "0.77923375", "text": "func (o *StockRelationship) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range stockRelationshipAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e480bf5b268b1907e8a620fa766ad5aa", "score": "0.77765274", "text": "func (o *CMFPaidprogramOrder) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range cmfPaidprogramOrderAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7b083b6adc7c0eaa333ccd4053b1a2eb", "score": "0.76893306", "text": "func (o *FileSearchDocsize) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range fileSearchDocsizeAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9df3234d82573995030a237cbeb13418", "score": "0.7678556", "text": "func (o *FeatureRelationshipprop) doAfterInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range featureRelationshippropAfterInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6c389bfec931247201badd992c75e967", "score": "0.7632115", "text": "func (o *OriginChannel) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) {\n\tif boil.HooksAreSkipped(ctx) {\n\t\treturn nil\n\t}\n\n\tfor _, hook := range originChannelAfterInsertHooks {\n\t\tif err := hook(ctx, exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0b8d9a65ee858e10d78818c2d14ff06e", "score": "0.7567705", "text": "func (o *T) doBeforeInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range tBeforeInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "222f420eec5f17857a156921f614c32c", "score": "0.7399486", "text": "func (o *Analysisfeature) doBeforeInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range analysisfeatureBeforeInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2e69c1d0d92e71ce6152e78ccaff5c15", "score": "0.73533905", "text": "func (o *Cvtermpath) doBeforeInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range cvtermpathBeforeInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "244dddde31fa34c7b332e25b9dc6ae67", "score": "0.7320228", "text": "func (o *Store) doBeforeInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range storeBeforeInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "90c866b37fd9b73491444eaf019f17c8", "score": "0.7312057", "text": "func (o *Transaction) doBeforeInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range transactionBeforeInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b2932c4562275a481d3389c691167cfc", "score": "0.72935736", "text": "func (o *Page) doBeforeInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range pageBeforeInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2c458352cd6f20c0d7d7658879bd2be6", "score": "0.7262298", "text": "func (o *Store) doAfterUpsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range storeAfterUpsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d3ddca162222bcfed7b60dd780acef14", "score": "0.72608054", "text": "func (o *UpepCodon) doBeforeInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range upepCodonBeforeInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cc5bbc1303bb312da473c14a77f0be4a", "score": "0.72101444", "text": "func (o *Attendee) doBeforeInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range attendeeBeforeInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9f3676f700e6db03683b80cfdb4b39bb", "score": "0.7194184", "text": "func (o *FeaturePhenotype) doBeforeInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range featurePhenotypeBeforeInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d2d7a4a7d4ba4254e4b199d73afb4eb1", "score": "0.71899974", "text": "func (o *Prospect) doBeforeInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range prospectBeforeInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bf2cb40db2c81d3027cf99b5ce1fa5b2", "score": "0.7186668", "text": "func (o *Authorize) doBeforeInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range authorizeBeforeInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f9ee321944e3d7dde68865dca4de07ef", "score": "0.7183617", "text": "func (o *Transaction) doAfterUpsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range transactionAfterUpsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2c71c4960ad420ff2295fcd0f86e02b3", "score": "0.718161", "text": "func (o *Dividend) doBeforeInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range dividendBeforeInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0882109eef1d3c92abcf013adbd754b9", "score": "0.7163167", "text": "func (o *Transaction) doAfterDeleteHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range transactionAfterDeleteHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "364b9cfd31792de7a0096f7413206fe0", "score": "0.7161702", "text": "func (o *FeaturePub) doBeforeInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range featurePubBeforeInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4fa872a0d5391edf431b96a0dae21108", "score": "0.7154073", "text": "func (o *Store) doAfterDeleteHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range storeAfterDeleteHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "27551924c6ff69d053c177fdd3139e70", "score": "0.7146543", "text": "func (o *Tag) doBeforeInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range tagBeforeInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "aff413fa680fb7b893ed468bd1e7c1d8", "score": "0.7140687", "text": "func (o *Account) doBeforeInsertHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range accountBeforeInsertHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" } ]
4f340224b811db63395c181e302eb868
Code gets the status code for the attach boot volume default response
[ { "docid": "644bdff1debc76c7b6d12fa58fb6c7a1", "score": "0.8377373", "text": "func (o *AttachBootVolumeDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" } ]
[ { "docid": "3a7d2ffdd491ed53f9300241cbefbf19", "score": "0.7566117", "text": "func (o *CreateVolumeDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "6f60ef93c912a041d60103c4dece1a37", "score": "0.73232263", "text": "func (o *AttachVnicDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "b8393018ac005f50b37ff873d9121c54", "score": "0.72563475", "text": "func (o *SvmMigrationVolumeGetDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "73d441ceab8d95d9bce420452f094f1e", "score": "0.72163934", "text": "func (o *VolumeJoinDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "008acff7068ac2332b9d9284679a332d", "score": "0.7191755", "text": "func (o *GetStorageFlexFlashVirtualDrivesDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "f4ce3547114cd296486a5f9aeab2d9a3", "score": "0.70740485", "text": "func (o *GetStorageFlexFlashPhysicalDrivesMoidDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "802dcf5e3101d7dbcd02fa8a4ced11d4", "score": "0.7041682", "text": "func (o *ListVolumesDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "7378727e670e45d45bf4b6e7329c77a8", "score": "0.7022283", "text": "func (o *GetStorageFlexUtilPhysicalDrivesDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "86ae109adbdc121399eb086b5811f8ff", "score": "0.69853866", "text": "func (o *GetVMDiskListDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "5e4dfa9632fed13865a1f45988729c2f", "score": "0.6724615", "text": "func (o *GetAssetManagedDevicesMoidDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "929184c1324e8e28ba7de8bfacbade24", "score": "0.6711966", "text": "func (o *APIServiceHaltsDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "5d2f52f8e64e68d53b969a96ff76da8e", "score": "0.66838074", "text": "func (o *GetFirmwareEulasMoidDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "4bf67a3fdc33b1235c5ac7231a91a07b", "score": "0.6681213", "text": "func (o *TravelExpenseAttachmentDeleteAttachmentDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "920396a4d788d559fedcc8bfc4ef7715", "score": "0.66648275", "text": "func (s *MissingVolumeConfiguration) StatusCode() int {\n\treturn s.RespMetadata.StatusCode\n}", "title": "" }, { "docid": "8105015bced4d7addd7d68ea81f8f07c", "score": "0.6656739", "text": "func (o *CreateClusterFirmwareAssessItemDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "3d368ae659c8232af61c1a88b866ee54", "score": "0.6626447", "text": "func (o *AddVMDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "d51264892171a6113948f42e8178b2fd", "score": "0.6621865", "text": "func (o *GetHyperflexHxdpVersionsMoidDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "3d67fefcaae9ca54284a1a1f98466649", "score": "0.66157556", "text": "func (o *LunAttributeCreateDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "bebdd66d6b809b47f98dd685e7203f0c", "score": "0.6613187", "text": "func (o *GetNodeDriveDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "a674931aee9c98a354b619262fa786e5", "score": "0.66110903", "text": "func (o *CreateEtcdBackupConfigDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "9d137e9aef814a8d7e2572520ab67fcd", "score": "0.6588722", "text": "func (o *TapeDeviceGetDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "587c42ab921e99329a8ce468270d471b", "score": "0.6551325", "text": "func (o *DeleteAssetManagedDevicesMoidDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "f7b1f6ae34588cc82e241a3eb70c4f55", "score": "0.65359086", "text": "func (o *UpdateDeviceDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "425fc437395b233ad261523a89c0ec53", "score": "0.64782965", "text": "func (o *GetAdapterExtEthInterfacesDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "ffb52176a7d9c5611a48af40bf6de29b", "score": "0.6475456", "text": "func (o *DeletePartSupportDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "f0f7b79758b0afc90977bbf69f15ad6c", "score": "0.6471233", "text": "func (o *V2GetLBConfigDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "e54fcba7af1f0babdbbbae60147e48cb", "score": "0.64691496", "text": "func (o *GetSummaryDriveDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "9a3358f955f42e921e9dd32b20ee6484", "score": "0.64669704", "text": "func (s *VolumeNotFound) StatusCode() int {\n\treturn s.RespMetadata.StatusCode\n}", "title": "" }, { "docid": "6735ac3a81ef5204ec5bd11fdc31b80d", "score": "0.64657533", "text": "func (o *GetFirmwareUpgradeStatusesMoidDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "2738f91d8acdc653e9c6823d174edcdc", "score": "0.646431", "text": "func (o *AddDeviceToPhonelineDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "ba5cb799e049740c790f6122d78d81e6", "score": "0.6457108", "text": "func (o *GetVnicFcIfsMoidDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "0826df5dd50c67f2411e1b55d4274342", "score": "0.64468944", "text": "func (o *GetEquipmentPsusDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "9662082d5ef4d20c8842816ca7566aa8", "score": "0.641835", "text": "func (o *DeleteHyperflexExtIscsiStoragePoliciesMoidDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "75541778a363dc9c77e34d37e3c7b647", "score": "0.6409956", "text": "func (o *GetDeviceAutoRunVersionDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "5a4dde288e74d75b286b19cff9d33f16", "score": "0.6409381", "text": "func (o *GetDeviceStatusDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "52f4419b091c144c4c200b9a121a6365", "score": "0.64086", "text": "func (o *GetFileIDThumbnailDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "d87a33ebc338cd632dc2cf27722505c2", "score": "0.6408202", "text": "func (o *ProfilesGetSwitchVendorDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "000aee521bb29a8868b8085a48379bc9", "score": "0.6401452", "text": "func (o *GetEquipmentTpmsMoidDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "fcde9d206ba39a048716a5c13e984a0b", "score": "0.63816047", "text": "func (o *PostFirmwareEulasDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "db8ca11d4bc3f5acacd85ccad5050ced", "score": "0.63773966", "text": "func (o *PutVolumeGroupsUUIDDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "3fb7cef3919edf6a139cfd68005279f4", "score": "0.63707024", "text": "func (o *GetMachineConfigDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "6308fa30ed7a62042c47afac7c61b776", "score": "0.63642865", "text": "func (o *VscanGetDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "44c3c1cccc1bd619333d1b2858ff999e", "score": "0.63637173", "text": "func (o *LockDeployDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "fb5111855a9aedcb7e9f70c2f3ca833f", "score": "0.6348306", "text": "func (o *DeletePublicManagementPackDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "898690fb169520051e0f5db123ec5763", "score": "0.6346044", "text": "func (o *PatchHyperflexHxdpVersionsMoidDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "90557c69b22486043fa028be1c9a3a0c", "score": "0.6345235", "text": "func (o *GetStoragePureHostLunsMoidDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "6ab0e6c088b00fdc974aefccb7c32095", "score": "0.63399833", "text": "func (o *PostExtensionsListDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "52be2d65009c84e2207f08b498f29460", "score": "0.6339847", "text": "func (o *DcimDevicesDeleteDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "10ad190570017ce79af9db677d57158c", "score": "0.6330636", "text": "func (o *GetVolumeBackupPolicyAssetAssignmentDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "9f45fccafd26f3cefac94b2310c6808a", "score": "0.6327071", "text": "func (o *GetStoragePureDisksDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "e1969e27cc92fe90122e1b100e739d53", "score": "0.63174087", "text": "func (o *PostVnicFcIfsMoidDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "cb83d15c247b369d396a70630f6b2f81", "score": "0.6316545", "text": "func (o *GetHyperflexConfigResultEntriesMoidDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "f3a9dd5df3c0feff321fa388ff120708", "score": "0.6315671", "text": "func (o *StorageServiceNodesLeavingGetDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "d964ca119ace0b5f873ca7c48e6dfdc9", "score": "0.6306796", "text": "func (o *GetNdmpContextsBackupByIDDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "7d1d7770232ae35ca0cecdd8e7d80f01", "score": "0.63032335", "text": "func (o *DcimModuleBayTemplatesReadDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "2c5c2fab0d437b6e7f662404fdaf4720", "score": "0.6302484", "text": "func (o *GetApplianceSetupInfosDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "17075e54b407264771d4cb6ebda042ee", "score": "0.62942827", "text": "func (o *RTRCheckActiveResponderCommandStatusDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "a1acd368a7a011db16e8b1db0b07831a", "score": "0.6287209", "text": "func (o *GetSmbSettingsShareDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "d9cbf5613b2eb282fb13db7f05bb5e34", "score": "0.6278613", "text": "func (o *GetVersionDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "532e51e63778432d72a7bdbb5ec8ab6a", "score": "0.6262623", "text": "func (o *VscanScannerModifyDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "439cc311fe92af1d8229a472b86b082f", "score": "0.62589777", "text": "func (o *PostHyperflexServerModelsDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "b027af8636267158f9aee4686091de5a", "score": "0.62536335", "text": "func (o *GetDNSServerOK) Code() int {\n\treturn 200\n}", "title": "" }, { "docid": "8bacf600456e6e0fe24391803ce3c110", "score": "0.62531626", "text": "func (o *GetClustersMulticlusterConfigUUIDDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "4bbdb6fd4e683143cfb5275fd9032583", "score": "0.6252594", "text": "func (o *GetNdmpDumpdateDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "647fd569b44aeb6adb1ead52299c4568", "score": "0.6249553", "text": "func (o *PostClustersUUIDDirectoryServicesDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "b7f753d2d9e136285522b028135c8905", "score": "0.62489563", "text": "func (o *ServiceInstanceGetDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "0399706fe501ffc702813ca58e44aec5", "score": "0.6247926", "text": "func (o *StorageServiceDecommissionPostDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "ee4db5ee81f25c76a62310fb48388885", "score": "0.6246012", "text": "func (o *PostExtensionsDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "613e0d81b4fa854462f535dd5330d169", "score": "0.6236136", "text": "func (o *GetSoftwarerepositoryOperatingSystemFilesDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "edff4ca24b7fccf4fbd5f401df108ede", "score": "0.6235", "text": "func (o *ListAPIKeysDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "aa2ee546e1c1b682fd2e64147cf2c26b", "score": "0.6233936", "text": "func (o *DeleteServerDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "da0ce15469434a706b6476641ffa34e8", "score": "0.6229668", "text": "func (o *AutosupportCreateDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "406665fd2f752d867df137786de83e5a", "score": "0.6223696", "text": "func (o *DeleteDhcpOptionsDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "4e0898c85f7b1403ef90c30465422882", "score": "0.6221175", "text": "func (o *AddSDTDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "47dce92e593389b6a25174382249fdc6", "score": "0.62178516", "text": "func (o *GetConsulDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "456b96cf002beef00c02b26288e3ffaf", "score": "0.6217514", "text": "func (o *AddCustomMaterialDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "18b74bb2e93e39b717f4eb03637eedea", "score": "0.62159437", "text": "func (o *GetComputeBladesDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "b170519dea906eb7c09966a055676106", "score": "0.6206843", "text": "func (o *FpolicyEngineGetDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "4983df579aa355e11d42e85ae1a55042", "score": "0.6203916", "text": "func (o *PostCvdTemplatesDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "b459b14ed9271919a965c4bb67788e97", "score": "0.6194414", "text": "func (o *PostEquipmentFansMoidDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "629d3ef362aa69cc06c1d7a88351b4e7", "score": "0.6189506", "text": "func (o *AddDeviceDatasourceInstanceGroupDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "7143e3587d5dfd7b1f973a6ea992c6e5", "score": "0.6188449", "text": "func (o *PostAssetDeviceClaimsDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "da4acdf0ad7a6a4644714d79742fc71d", "score": "0.6173294", "text": "func (o *DeleteDCDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "ffcc8dc7c594a7ed1db095096fb3c516", "score": "0.61713576", "text": "func (o *PostClustersUUIDDirectoryServicesDirectoryServiceUUIDConnectDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "738c8aaf002c886d4f18ca6a28cf2f58", "score": "0.61672056", "text": "func (o *GetBackupsBackupIDOperationsDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "c1711321015a8483b74f78532f768e64", "score": "0.6163378", "text": "func (o *SMSInboundAutomationDeleteDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "17d25f422f7bc099f378c362f2c52a5f", "score": "0.61628675", "text": "func (o *PutGuestNetworkInterfaceByIDDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "9cfb73b729f0cc624dfebbef2bccce76", "score": "0.61610717", "text": "func (o *BatchGetCmdStatusDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "6eabd0b24ff585a5995cdb77a77d9c97", "score": "0.61581236", "text": "func (o *ArchiveUploadV2OK) Code() int {\n\treturn 200\n}", "title": "" }, { "docid": "7805df330e19e203a04bec6d582f6a37", "score": "0.61577517", "text": "func (o *PatchInstalledAppTagsDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "4a29fbee74503f5d7aa2375fec00a151", "score": "0.61537856", "text": "func (o *UpdateIOCDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "9a5a7d589632253e4889ab8565516f7d", "score": "0.61398226", "text": "func (o *UpdateSignatureTypeDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "8507789deb314a740d3561f5831d7d83", "score": "0.61392677", "text": "func (o *GetApplianceBackupPoliciesDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "81a695699b37f6ce0d3c376686a40433", "score": "0.6137623", "text": "func (o *ApplicationListDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "25dd1892749148a4e04627ef1989887a", "score": "0.61350757", "text": "func (o *UpdateImageDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "bb0aab78addd8782754a54659f0e1c8b", "score": "0.6129875", "text": "func (o *SnapmirrorPolicyCreateDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "7afe17e860f3a464cf19517962120a65", "score": "0.6127623", "text": "func (o *MultiAdminVerifyRequestDeleteDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "f1f8024f2baf978465daaee0a7b9af17", "score": "0.61264074", "text": "func (o *GetHclHyperflexSoftwareCompatibilityInfosDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "d7be244d19d072e70f9b7733f844cbd2", "score": "0.61211926", "text": "func (o *NetworkEthernetPortGetDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "9eb0bdc77fc2fe9f3800cf1c57b5dfef", "score": "0.611787", "text": "func (o *GetAggregateFilesDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" } ]
3067bd729a3937225d8057f9b1bed74a
Cond apply conditionally some options.
[ { "docid": "c28a604f677648f6794a624c67ac8c9c", "score": "0.78706396", "text": "func Cond(apply bool, options ...types.Option) types.Option {\n\tif apply {\n\t\treturn func(g *types.Cmd) {\n\t\t\tg.ApplyOptions(options...)\n\t\t}\n\t}\n\treturn NoOp\n}", "title": "" } ]
[ { "docid": "58308d37d4ff3e414c8239423799ec5c", "score": "0.6814397", "text": "func Cond(conditions ...bool) {}", "title": "" }, { "docid": "7b772d03c35f3bb9f42b6050a6b098d6", "score": "0.5656092", "text": "func (opts *FindTrackedTimesOptions) toCond() builder.Cond {\n\tcond := builder.NewCond().And(builder.Eq{\"tracked_time.deleted\": false})\n\tif opts.IssueID != 0 {\n\t\tcond = cond.And(builder.Eq{\"issue_id\": opts.IssueID})\n\t}\n\tif opts.UserID != 0 {\n\t\tcond = cond.And(builder.Eq{\"user_id\": opts.UserID})\n\t}\n\tif opts.RepositoryID != 0 {\n\t\tcond = cond.And(builder.Eq{\"issue.repo_id\": opts.RepositoryID})\n\t}\n\tif opts.MilestoneID != 0 {\n\t\tcond = cond.And(builder.Eq{\"issue.milestone_id\": opts.MilestoneID})\n\t}\n\tif opts.CreatedAfterUnix != 0 {\n\t\tcond = cond.And(builder.Gte{\"tracked_time.created_unix\": opts.CreatedAfterUnix})\n\t}\n\tif opts.CreatedBeforeUnix != 0 {\n\t\tcond = cond.And(builder.Lte{\"tracked_time.created_unix\": opts.CreatedBeforeUnix})\n\t}\n\treturn cond\n}", "title": "" }, { "docid": "864599c671b2e5fc7ef9f2b4eb265c49", "score": "0.5437152", "text": "func maybeConditionExpression[T dynamo.Thing](\n\tconditionExpression **string,\n\topts []interface{ WriterOpt(T) },\n) (\n\texpressionAttributeNames map[string]string,\n\texpressionAttributeValues map[string]types.AttributeValue,\n) {\n\tif len(opts) > 0 {\n\t\texpressionAttributeNames = map[string]string{}\n\t\texpressionAttributeValues = map[string]types.AttributeValue{}\n\n\t\tfor _, opt := range opts {\n\t\t\tif ap, ok := opt.(interface {\n\t\t\t\tApply(**string, map[string]string, map[string]types.AttributeValue)\n\t\t\t}); ok {\n\t\t\t\tap.Apply(conditionExpression, expressionAttributeNames, expressionAttributeValues)\n\t\t\t}\n\t\t}\n\n\t\t// Unfortunately empty maps are not accepted by DynamoDB\n\t\tif len(expressionAttributeNames) == 0 {\n\t\t\texpressionAttributeNames = nil\n\t\t}\n\t\tif len(expressionAttributeValues) == 0 {\n\t\t\texpressionAttributeValues = nil\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "19351d46498b65c0ae91cb20e0daf045", "score": "0.53886616", "text": "func maybeUpdateConditionExpression[T dynamo.Thing](\n\tconditionExpression **string,\n\texpressionAttributeNames map[string]string,\n\texpressionAttributeValues map[string]types.AttributeValue,\n\topts []interface{ WriterOpt(T) },\n) {\n\tfor _, opt := range opts {\n\t\tif ap, ok := opt.(interface {\n\t\t\tApply(**string, map[string]string, map[string]types.AttributeValue)\n\t\t}); ok {\n\t\t\tap.Apply(conditionExpression, expressionAttributeNames, expressionAttributeValues)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "58695146a766403d28ada385d2a86791", "score": "0.5330465", "text": "func ifHelper(conditional interface{}, options *Options) interface{} {\n\tif options.isIncludableZero() || IsTrue(conditional) {\n\t\treturn options.Fn()\n\t}\n\n\treturn options.Inverse()\n}", "title": "" }, { "docid": "9b012563d4c87ae0f50235a3aa89653e", "score": "0.51993734", "text": "func (rr *RoutingRule) BuildCondition(external map[string][]string) (Condition, error) {\n\tconds := NewConditionChan()\n\n\tif len(rr.Domain) > 0 {\n\t\tmatcher, err := NewDomainMatcher(rr.Domain, external)\n\t\tif err != nil {\n\t\t\treturn nil, newError(\"failed to build domain condition\").Base(err)\n\t\t}\n\t\tconds.Add(matcher)\n\t}\n\n\tif len(rr.UserEmail) > 0 {\n\t\tconds.Add(NewUserMatcher(rr.UserEmail))\n\t}\n\n\tif len(rr.InboundTag) > 0 {\n\t\tconds.Add(NewInboundTagMatcher(rr.InboundTag))\n\t}\n\n\tif rr.PortList != nil {\n\t\tconds.Add(NewPortMatcher(rr.PortList))\n\t} else if rr.PortRange != nil {\n\t\tconds.Add(NewPortMatcher(&net.PortList{Range: []*net.PortRange{rr.PortRange}}))\n\t}\n\n\tif len(rr.Networks) > 0 {\n\t\tconds.Add(NewNetworkMatcher(rr.Networks))\n\t} else if rr.NetworkList != nil {\n\t\tconds.Add(NewNetworkMatcher(rr.NetworkList.Network))\n\t}\n\n\tif len(rr.Geoip) > 0 {\n\t\tcond, err := NewMultiGeoIPMatcher(rr.Geoip, false)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tconds.Add(cond)\n\t} else if len(rr.Cidr) > 0 {\n\t\tcond, err := NewMultiGeoIPMatcher([]*GeoIP{{Cidr: rr.Cidr}}, false)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tconds.Add(cond)\n\t}\n\n\tif len(rr.SourceGeoip) > 0 {\n\t\tcond, err := NewMultiGeoIPMatcher(rr.SourceGeoip, true)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tconds.Add(cond)\n\t} else if len(rr.SourceCidr) > 0 {\n\t\tcond, err := NewMultiGeoIPMatcher([]*GeoIP{{Cidr: rr.SourceCidr}}, true)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tconds.Add(cond)\n\t}\n\n\tif len(rr.Protocol) > 0 {\n\t\tconds.Add(NewProtocolMatcher(rr.Protocol))\n\t}\n\n\tif len(rr.Attributes) > 0 {\n\t\tcond, err := NewAttributeMatcher(rr.Attributes)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tconds.Add(cond)\n\t}\n\n\tif conds.Len() == 0 {\n\t\treturn nil, newError(\"this rule has no effective fields\").AtWarning()\n\t}\n\n\treturn conds, nil\n}", "title": "" }, { "docid": "51b23abc0695d29e92358907599436c5", "score": "0.50841343", "text": "func Condition() *ConditionApplyConfiguration {\n\treturn &ConditionApplyConfiguration{}\n}", "title": "" }, { "docid": "78bc3d7f9888b28d8a5470fbcfca4caa", "score": "0.5081205", "text": "func Condition(t TestingT, comp Comparison, extras ...interface{}) bool {\n\tok := comp()\n\tif !ok {\n\t\texps, acts := toString(true, ok)\n\n\t\treturn Errorf(t, \"Expect to return true\", []labeledOutput{\n\t\t\t{\n\t\t\t\tlabel: labelMessages,\n\t\t\t\tcontent: formatExtras(extras...),\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"-expected\",\n\t\t\t\tcontent: exps,\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"+received\",\n\t\t\t\tcontent: acts,\n\t\t\t},\n\t\t})\n\t}\n\n\treturn ok\n}", "title": "" }, { "docid": "53e290c9271f72d092b8d338b761f83f", "score": "0.5072356", "text": "func composeConditionWithBinaryOp(ctx sessionctx.Context, conditions []Expression, funcName string) Expression {\n\tlength := len(conditions)\n\tif length == 0 {\n\t\treturn nil\n\t}\n\tif length == 1 {\n\t\treturn conditions[0]\n\t}\n\texpr := NewFunctionInternal(ctx, funcName,\n\t\ttypes.NewFieldType(mysql.TypeTiny),\n\t\tcomposeConditionWithBinaryOp(ctx, conditions[:length/2], funcName),\n\t\tcomposeConditionWithBinaryOp(ctx, conditions[length/2:], funcName))\n\treturn expr\n}", "title": "" }, { "docid": "e5a4d5669fc2235b9566443149b5e71d", "score": "0.5059625", "text": "func (q *BasicQuery) AddCond(p string, v interface{}) Query {\n\tq.Conds.Add(p, v)\n\treturn q\n}", "title": "" }, { "docid": "5daba4e35960d6c744a2fd3793cd2a16", "score": "0.50201213", "text": "func (c *compiler) condition(expr ast.Expr, invert bool) Opcode {\n\tjumpOp := func(normal, inverted Opcode) Opcode {\n\t\tif invert {\n\t\t\treturn inverted\n\t\t}\n\t\treturn normal\n\t}\n\n\tswitch cond := expr.(type) {\n\tcase *ast.BinaryExpr:\n\t\t// Optimize binary comparison expressions like \"x < 10\" into just\n\t\t// JumpLess instead of two instructions (Less and JumpTrue).\n\t\tswitch cond.Op {\n\t\tcase lexer.EQUALS:\n\t\t\tc.expr(cond.Left)\n\t\t\tc.expr(cond.Right)\n\t\t\treturn jumpOp(JumpEquals, JumpNotEquals)\n\n\t\tcase lexer.NOT_EQUALS:\n\t\t\tc.expr(cond.Left)\n\t\t\tc.expr(cond.Right)\n\t\t\treturn jumpOp(JumpNotEquals, JumpEquals)\n\n\t\tcase lexer.LESS:\n\t\t\tc.expr(cond.Left)\n\t\t\tc.expr(cond.Right)\n\t\t\treturn jumpOp(JumpLess, JumpGreaterOrEqual)\n\n\t\tcase lexer.LTE:\n\t\t\tc.expr(cond.Left)\n\t\t\tc.expr(cond.Right)\n\t\t\treturn jumpOp(JumpLessOrEqual, JumpGreater)\n\n\t\tcase lexer.GREATER:\n\t\t\tc.expr(cond.Left)\n\t\t\tc.expr(cond.Right)\n\t\t\treturn jumpOp(JumpGreater, JumpLessOrEqual)\n\n\t\tcase lexer.GTE:\n\t\t\tc.expr(cond.Left)\n\t\t\tc.expr(cond.Right)\n\t\t\treturn jumpOp(JumpGreaterOrEqual, JumpLess)\n\t\t}\n\t}\n\n\t// Fall back to evaluating the expression normally, followed by JumpTrue\n\t// or JumpFalse.\n\tc.expr(expr)\n\treturn jumpOp(JumpTrue, JumpFalse)\n}", "title": "" }, { "docid": "258ef7dab6c63781b0adedd67a23a0f0", "score": "0.5016632", "text": "func launchCondition(logger *zap.Logger, client *elastic.Client) func(context.Context, *lifecycle.Event) (bool, error) {\n\treturn func(ctx context.Context, event *lifecycle.Event) (bool, error) {\n\t\t// Check cluster health\n\t\tresp, err := client.ClusterHealth().Do(ctx)\n\t\tswitch {\n\t\tcase err != nil:\n\t\t\treturn false, err\n\t\tcase resp.TimedOut:\n\t\t\treturn false, errors.New(\"request to cluster master node timed out\")\n\t\tcase resp.RelocatingShards > 0:\n\t\t\t// Shards are being relocated. This is the activity lifecycler was designed to protect.\n\t\t\tlogger.Info(\"condition failed: RelocatingShards > 0\")\n\t\t\treturn false, nil\n\t\t}\n\n\t\tlogger.Info(\"condition passed\")\n\t\treturn true, nil\n\t}\n}", "title": "" }, { "docid": "053b64529ea88d0b74f1188d346ded55", "score": "0.50074947", "text": "func conditionally(test bool, prime interface{}, alt interface{}) interface{} {\n\tif test {\n\t\treturn prime\n\t} else {\n\t\treturn alt\n\t}\n}", "title": "" }, { "docid": "e25f30c350c6323c985e9ee89821e850", "score": "0.49734616", "text": "func Condition(name string, ops ...ConditionOp) *v1alpha1.Condition {\n\tcondition := &v1alpha1.Condition{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t},\n\t}\n\tfor _, op := range ops {\n\t\top(condition)\n\t}\n\treturn condition\n}", "title": "" }, { "docid": "0c977d7a70a3d6a57a2c406c46b57181", "score": "0.49717593", "text": "func (i ifCond) True(r *http.Request) bool {\n\tif c, ok := ifConditions[i.op]; ok {\n\t\ta, b := i.a, i.b\n\t\tif r != nil {\n\t\t\treplacer := NewReplacer(r, nil, \"\")\n\t\t\ta = replacer.Replace(i.a)\n\t\t\tb = replacer.Replace(i.b)\n\t\t}\n\t\treturn c(a, b)\n\t}\n\treturn false\n}", "title": "" }, { "docid": "7920c83ff4b65c9cc0a5e7be7d8047f8", "score": "0.49470693", "text": "func (n *Namespace) Conditional(cond bool, v1, v2 any) any {\n\tif cond {\n\t\treturn v1\n\t}\n\treturn v2\n}", "title": "" }, { "docid": "701e29e84b3583cf49807cedb94a05b0", "score": "0.4943285", "text": "func Or(conds ...Cond) Cond {\n\tvar result = make(condOr, 0, len(conds))\n\tfor _, cond := range conds {\n\t\tif cond == nil {\n\t\t\tcontinue\n\t\t}\n\t\tresult = append(result, cond)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "1c0a69dbe065a4b0baac8082e7cbe5cb", "score": "0.4927891", "text": "func (c *Condition) Config(values bool, condition ...int) string {\n\tvar stmt []string\n\n\tfor _, fn := range condition {\n\t\tswitch fn {\n\t\tcase WHERE:\n\t\t\ts := c.where\n\t\t\tif s != \"\" {\n\t\t\t\tif values {\n\t\t\t\t\tstmt = append(stmt, fmt.Sprintf(strings.Replace(c.where, PLACEHOLDER, \"%v\", -1), c.args[WHERE]...))\n\t\t\t\t} else {\n\t\t\t\t\tstmt = append(stmt, s)\n\t\t\t\t}\n\t\t\t}\n\t\tcase HAVING:\n\t\t\ts := c.having\n\t\t\tif s != \"\" {\n\t\t\t\tif values {\n\t\t\t\t\tstmt = append(stmt, fmt.Sprintf(strings.Replace(c.having, PLACEHOLDER, \"%v\", -1), c.args[HAVING]...))\n\t\t\t\t} else {\n\t\t\t\t\tstmt = append(stmt, s)\n\t\t\t\t}\n\t\t\t}\n\t\tcase LIMIT:\n\t\t\tif c.limit != \"\" {\n\t\t\t\tstmt = append(stmt, c.limit)\n\t\t\t}\n\t\tcase ORDER:\n\t\t\tif c.order != \"\" {\n\t\t\t\tstmt = append(stmt, c.order)\n\t\t\t}\n\t\tcase OFFSET:\n\t\t\tif c.offset != \"\" {\n\t\t\t\tstmt = append(stmt, c.offset)\n\t\t\t}\n\t\tcase GROUP:\n\t\t\tif c.group != \"\" {\n\t\t\t\tstmt = append(stmt, c.group)\n\t\t\t}\n\t\tcase ON:\n\t\t\ts := c.on\n\t\t\tif s != \"\" {\n\t\t\t\tif values {\n\t\t\t\t\tstmt = append(stmt, fmt.Sprintf(strings.Replace(c.on, PLACEHOLDER, \"%v\", -1), c.args[ON]...))\n\t\t\t\t} else {\n\t\t\t\t\tstmt = append(stmt, s)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn strings.Join(stmt, \" \")\n}", "title": "" }, { "docid": "536b5066c52699f54a0f68697c41db4a", "score": "0.49268764", "text": "func (a *Agent) buildConditionalActions(ac action) {\n\t// for now, only allow hypotheses on atomic actions\n\tif _, ok := ac.(*atomicAction); !ok {\n\t\treturn\n\t}\n\n\t// only use forward hypotheses for now\n\tforwardHypotheses, _ := ac.getType().getHypotheses()\n\tfor _, row := range forwardHypotheses {\n\t\tfor _, h := range row {\n\t\t\t// if a condition is always satisfied, ignore it\n\t\t\t// this is to dodge \"if apple is red walk towards it\"\n\t\t\tif h.conditionMatch > ac.getType().getAttempts()*9/10 {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif h.evaluate() > 0.9 {\n\t\t\t\tca := a.newConditionalActionType(h.condition, ac.getType(), emptyActionTypeSingleton)\n\t\t\t\ta.mind.addItem(ca, 1.0)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "be30662d1e918ea76e9f2a959780c1b4", "score": "0.49128082", "text": "func (b *Builder) If(condition bool, bits ...interface{}) Condition {\n\treturn If(condition, bits...)\n}", "title": "" }, { "docid": "0612acd80648ecdf3f2bf06a15e7b7fc", "score": "0.490593", "text": "func myCondition(mycheck bool){\nif mycheck{\nfmt.Println(\"this ran\")\n}\nfmt.Println(\"wassup\")\n}", "title": "" }, { "docid": "73bfacddca28ea99176cf9df0a7f4bab", "score": "0.4905492", "text": "func (b *Builder) Or(cond Cond) *Builder {\r\n\tb.cond = Or(b.cond, cond)\r\n\treturn b\r\n}", "title": "" }, { "docid": "c091e64b025d115f3e2ac39966225ea4", "score": "0.4892442", "text": "func (lt *Linter) RCond(mx *mg.Ctx) bool {\n\treturn mx.LangIs(goutil.Langs...) && lt.Linter.RCond(mx)\n}", "title": "" }, { "docid": "42502a753547704babe3211da09b8cf0", "score": "0.48883176", "text": "func (opts *Options) Apply(options ...Option) error {\n\tfor _, o := range options {\n\t\tif err := o(opts); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1ef1af4da2eab7ceedde6948a3c22515", "score": "0.48865616", "text": "func aggregate(from []Getter, targetCondition string, options ...MergeOption) *metav1.Condition {\n\tmergeOpt := &mergeOptions{\n\t\tstepCounter: len(from),\n\t}\n\tfor _, o := range options {\n\t\to(mergeOpt)\n\t}\n\n\tconditionsInScope := make([]localizedCondition, 0, len(from))\n\tfor i := range from {\n\t\tconditions := from[i].GetConditions()\n\t\tfor i, _ := range conditions {\n\t\t\tc := conditions[i]\n\t\t\tif mergeOpt.conditionTypes != nil {\n\t\t\t\tfound := false\n\t\t\t\tfor _, tt := range mergeOpt.conditionTypes {\n\t\t\t\t\tif c.Type == tt {\n\t\t\t\t\t\tfound = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !found {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconditionsInScope = append(conditionsInScope, localizedCondition{\n\t\t\t\tCondition: &c,\n\t\t\t\tGetter: from[i],\n\t\t\t})\n\t\t}\n\t}\n\n\t// If it is required to add a counter only if a subset of condition exists, check if the conditions\n\t// in scope are included in this subset or not.\n\tif mergeOpt.addCounterOnlyIfConditionTypes != nil {\n\t\tfor _, c := range conditionsInScope {\n\t\t\tfound := false\n\t\t\tfor _, tt := range mergeOpt.addCounterOnlyIfConditionTypes {\n\t\t\t\tif c.Type == tt {\n\t\t\t\t\tfound = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !found {\n\t\t\t\tmergeOpt.addCounter = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\t// If it is required to add a source ref only if a condition type exists, check if the conditions\n\t// in scope are included in this subset or not.\n\tif mergeOpt.addSourceRefIfConditionTypes != nil {\n\t\tfor _, c := range conditionsInScope {\n\t\t\tfound := false\n\t\t\tfor _, tt := range mergeOpt.addSourceRefIfConditionTypes {\n\t\t\t\tif c.Type == tt {\n\t\t\t\t\tfound = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif found {\n\t\t\t\tmergeOpt.addSourceRef = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn merge(conditionsInScope, targetCondition, mergeOpt)\n}", "title": "" }, { "docid": "ef5d68a2d5032d8f1fa04290b34d970e", "score": "0.4885395", "text": "func compoundCondOR(g *cfg.Graph, x *cfg.Node) bool {\n\t// Check (x || y) case. The left and right edge represent the false and true\n\t// branch, respectively, in the illustration below.\n\t//\n\t// x OR y\n\t//\n\t// x\n\t// ↙ ↓\n\t// y ↓\n\t// ↙ ↘ ↓\n\t// e t\n\t//\n\tt := g.TrueTarget(x) // true branch\n\ty := g.FalseTarget(x) // false branch\n\tif g.To(y.ID()).Len() == 1 && g.From(y.ID()).Len() == 2 {\n\t\tt2 := g.TrueTarget(y) // true branch\n\t\te := g.FalseTarget(y) // false branch\n\t\tif t == t2 {\n\t\t\treturn true\n\t\t}\n\t\t_ = e\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4b63ad9e2ed2a3b58d669691fb6a0a30", "score": "0.48810372", "text": "func (s *state) walkIfOrWith(typ parse.NodeType, dot reflect.Value, pipe *parse.PipeNode, list, elseList *parse.ListNode) {\n\tdefer s.pop(s.mark())\n\tval := s.evalPipeline(dot, pipe)\n\ttruth, ok := isTrue(val)\n\tif !ok {\n\t\ts.errorf(\"if/with can't use %v\", val)\n\t}\n\tif truth {\n\t\tif typ == parse.NodeWith {\n\t\t\ts.walk(val, list)\n\t\t} else {\n\t\t\ts.walk(dot, list)\n\t\t}\n\t} else if elseList != nil {\n\t\ts.walk(dot, elseList)\n\t}\n}", "title": "" }, { "docid": "066cbb44f1469811492f1140638380f6", "score": "0.4867374", "text": "func combineConditions(fieldsMap map[string]string, conds string) (string, error) {\n\tif conds == \"\" {\n\t\treturn \"\", nil\n\t}\n\n\twhereBlock := \"where \"\n\tvar preparedConditions []string\n\n\t// Parse logical operators\n\t// Get substrings with bracket conditions\n\tre := regexp.MustCompile(`\\((.*?)\\)`)\n\tbracketSubstrings := re.FindAllString(conds, -1)\n\tfor _, brCondSet := range bracketSubstrings {\n\t\tcondSet := brCondSet\n\n\t\tcondSet = strings.Trim(condSet, \"(\")\n\t\tcondSet = strings.Trim(condSet, \")\")\n\n\t\tvar cond string\n\t\tvar err error\n\n\t\tvar bracketConditions []string\n\t\topCount := strings.Count(condSet, \"*\") + strings.Count(condSet, \"||\")\n\t\tfor i := 0; i <= opCount; i++ { // loop number of logical operators in condition set\n\t\t\tcondSet, cond, err = handleConditionsSet(fieldsMap, condSet)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\tbracketConditions = append(bracketConditions, cond)\n\t\t}\n\t\tconds = strings.TrimPrefix(conds, brCondSet)\n\n\t\t// Handle trailimg logical operator\n\t\torIndex := strings.Index(conds, \"||\")\n\t\tandIndex := strings.Index(conds, \"*\")\n\n\t\top := \"\"\n\t\tif (orIndex < 0 || andIndex < orIndex) && andIndex >= 0 { // handle AND logical condition\n\t\t\top = \"*\"\n\t\t}\n\t\tif (andIndex < 0 || orIndex < andIndex) && orIndex >= 0 { // handle OR logical condition\n\t\t\top = \"||\"\n\t\t}\n\t\tif op != \"\" {\n\t\t\tconds = strings.TrimPrefix(conds, op)\n\t\t}\n\n\t\tpreparedConditions = append(preparedConditions, \"(\"+strings.Join(bracketConditions, \" \")+\") \"+logicalBindings[op])\n\t}\n\n\tvar cond string\n\tvar err error\n\topCount := strings.Count(conds, \"*\") + strings.Count(conds, \"||\")\n\tif conds != \"\" { // handle non-bracket conditions set\n\t\tfor i := 0; i <= opCount; i++ { // loop number of logical operators in condition set\n\t\t\tconds, cond, err = handleConditionsSet(fieldsMap, conds)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\tpreparedConditions = append(preparedConditions, cond)\n\t\t}\n\t}\n\n\treturn whereBlock + strings.Join(preparedConditions, \" \"), nil\n}", "title": "" }, { "docid": "ea72e21287f800fd44de5805a14b82db", "score": "0.4866996", "text": "func CheckCondition2(cond Condition, pass string) bool {\n X := string(pass[cond.min - 1]) == cond.letter\n Y := string(pass[cond.max - 1]) == cond.letter\n r := (X || Y) && !(X && Y)\n fmt.Printf(\"Checking pass: %s with %+v, Result: %t\\n\", pass, cond, r)\n return r\n}", "title": "" }, { "docid": "f565ff2968ac14fe2f36a312b174722f", "score": "0.48647818", "text": "func ComposeDNFCondition(ctx sessionctx.Context, conditions ...Expression) Expression {\n\treturn composeConditionWithBinaryOp(ctx, conditions, ast.LogicOr)\n}", "title": "" }, { "docid": "55628fd92fa87c2c6924111725f9431b", "score": "0.48450136", "text": "func (c *operatorConfig) apply(options []OperatorOption) {\n\tfor _, option := range options {\n\t\toption(c)\n\t}\n}", "title": "" }, { "docid": "d79ceea23d7d1316b401733d54c29c50", "score": "0.4843999", "text": "func (c *Condition) Eval(ctx context.Context, attrs realms.Attrs) bool {\n\tfor _, cond := range c.conds {\n\t\tif !cond(ctx, attrs) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "50c7fe4a09c4f69c0e6adca58dc69554", "score": "0.48342234", "text": "func (_e *DeleteItemBuilder_Expecter) WithCondition(cond interface{}) *DeleteItemBuilder_WithCondition_Call {\n\treturn &DeleteItemBuilder_WithCondition_Call{Call: _e.mock.On(\"WithCondition\", cond)}\n}", "title": "" }, { "docid": "787d97fc69d100db4e62111e4fa90260", "score": "0.47846928", "text": "func updateCondition(vr *appmesh.VirtualRouter, conditionType appmesh.VirtualRouterConditionType, status corev1.ConditionStatus, reason *string, message *string) bool {\n\tnow := metav1.Now()\n\texistingCondition := getCondition(vr, conditionType)\n\tif existingCondition == nil {\n\t\tnewCondition := appmesh.VirtualRouterCondition{\n\t\t\tType: conditionType,\n\t\t\tStatus: status,\n\t\t\tLastTransitionTime: &now,\n\t\t\tReason: reason,\n\t\t\tMessage: message,\n\t\t}\n\t\tvr.Status.Conditions = append(vr.Status.Conditions, newCondition)\n\t\treturn true\n\t}\n\n\thasChanged := false\n\tif existingCondition.Status != status {\n\t\texistingCondition.Status = status\n\t\texistingCondition.LastTransitionTime = &now\n\t\thasChanged = true\n\t}\n\tif aws.StringValue(existingCondition.Reason) != aws.StringValue(reason) {\n\t\texistingCondition.Reason = reason\n\t\thasChanged = true\n\t}\n\tif aws.StringValue(existingCondition.Message) != aws.StringValue(message) {\n\t\texistingCondition.Message = message\n\t\thasChanged = true\n\t}\n\treturn hasChanged\n}", "title": "" }, { "docid": "2c4019e2c68050a20595e84610cd7953", "score": "0.47746667", "text": "func None(conditions ...Condition) bool {\n return !Any(conditions...)\n}", "title": "" }, { "docid": "b35284850861a9b15da50e7ecc139308", "score": "0.47706968", "text": "func applyOptions(c *Container, opts ...Option) error {\n\tfor _, opt := range opts {\n\t\tif err := opt.set(c); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5f8b55968b27b5eb23bb596f3060e1b7", "score": "0.47466063", "text": "func (a *Assertions) Condition(comp Comparison, msgAndArgs ...interface{}) bool {\n\treturn Condition(a.t, comp, msgAndArgs...)\n}", "title": "" }, { "docid": "5d64e163d3d39fbdc58194afdea7af32", "score": "0.47353762", "text": "func (self Flags) AddIf(flag Flags, condition bool) Flags {\n\tif condition {\n\t\treturn self | flag\n\t} else {\n\t\treturn self\n\t}\n}", "title": "" }, { "docid": "38964026b533bd7c01cb8c93cc47c9be", "score": "0.4707421", "text": "func lCondInfo(on bool, v ...interface{}) {\n\tif on {\n\t\tinfoLogger.Println(v...)\n\t}\n}", "title": "" }, { "docid": "209639f12cc90cd6d97b6c9f02470f98", "score": "0.47017324", "text": "func (c *Condition) init(groupBy *event.TagSet) {\n\tc.checks = c.compileChecks()\n\tc.eventTrackers = make(map[string]*eventTracker)\n\n\t// add in the modifer functions\n\tc.modifierFuncs = make([]modifier, 0, len(c.ModifierFuncs))\n\tfor _, m := range c.ModifierFuncs {\n\t\tf, ok := modifierFuncs[m]\n\t\tif !ok {\n\t\t\tlogrus.Errorf(\"Modifier function %s unknown\", m)\n\t\t} else {\n\t\t\tlogrus.Infof(\"Adding modifer %s to condition\", m)\n\t\t\tc.modifierFuncs = append(c.modifierFuncs, f)\n\n\t\t}\n\t}\n\n\t// fixes issue where occurences are hit, even when the event doesn't satisify the condition\n\tif c.Occurences < 1 {\n\t\tlogrus.Warnf(\"Occurences must be > 1. %d given. Occurences for this condition will be set to 1.\", c.Occurences)\n\t\tc.Occurences = 1\n\t}\n\n\t// if we have no trackers already, make an empty map of them\n\tif c.eventTrackers == nil {\n\t\tc.eventTrackers = make(map[string]*eventTracker)\n\t}\n\n\t// WindowSize must be above 2. At least one piece of data is needed for historical checks.\n\tif c.WindowSize < 2 {\n\t\tlogrus.Warnf(\"WindowSize must be >= 1. %d given. Window size for this condition will be set to %d\", c.WindowSize, DEFAULT_WINDOW_SIZE)\n\t\tc.WindowSize = DEFAULT_WINDOW_SIZE\n\t}\n\n\t// decide which tracking method we will use\n\tc.trackFunc = getTrackingFunc(c)\n\n\tc.ready = true\n}", "title": "" }, { "docid": "99647353260efd134fc3ffee5058fcbd", "score": "0.4695969", "text": "func mirror(from Getter, targetCondition string, options ...MirrorOptions) *metav1.Condition {\n\tmirrorOpt := &mirrorOptions{}\n\tfor _, o := range options {\n\t\to(mirrorOpt)\n\t}\n\n\tcondition := Get(from, meta.ReadyCondition)\n\n\tif mirrorOpt.fallbackTo != nil && condition == nil {\n\t\tswitch *mirrorOpt.fallbackTo {\n\t\tcase true:\n\t\t\tcondition = TrueCondition(targetCondition, mirrorOpt.fallbackReason, mirrorOpt.fallbackMessage)\n\t\tcase false:\n\t\t\tcondition = FalseCondition(targetCondition, mirrorOpt.fallbackReason, mirrorOpt.fallbackMessage)\n\t\t}\n\t}\n\n\tif condition != nil {\n\t\tcondition.Type = targetCondition\n\t}\n\n\treturn condition\n}", "title": "" }, { "docid": "b7eba80b04172146b86ff0e4bd115759", "score": "0.46912336", "text": "func And(opts ...Option) Option {\n\treturn func(g Generator) {\n\t\tfor _, opt := range opts {\n\t\t\topt(g)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7f07f3a6c2342bef69676bffa675b371", "score": "0.4678508", "text": "func SupportCASWithRestrictions(flagSet *pflag.FlagSet, p *string, restrictions map[string]string) func() bool {\n\tconst casName = \"cas\"\n\n\tdescription := \"make changes to a resource conditional upon matching the provided version\"\n\n\tif len(restrictions) > 0 {\n\t\tdescription += \". Valid only if \"\n\t\tfor k, v := range restrictions {\n\t\t\tdescription += fmt.Sprintf(\"%s=%s \", k, v)\n\t\t}\n\t}\n\n\tflagSet.StringVar(p, casName, \"\", description)\n\n\treturn func() bool {\n\t\treturn flagSet.Changed(casName)\n\t}\n}", "title": "" }, { "docid": "9776c7bfc57e3a04b834f405215adb5c", "score": "0.46725205", "text": "func runCanBeApplied(status string) bool {\n\tallowed := []string{\"planned\", \"cost_estimated\", \"policy_checked\"}\n\n\tfor _, a := range allowed {\n\t\tif status == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "7c6a5ca05df3ff33f2fc3050bf69a42f", "score": "0.46637952", "text": "func EvaluateCondition(\n\tcondition string,\n\tselected *model.SelectedTemplates,\n\tvarMap map[string]string,\n) bool {\n\tdataString := prepareInputData(selected, varMap)\n\t// Execute CCom\n\t// #nosec G204\n\tcmd := exec.Command(\"ccom\", \"-m\", \"-s\", \"-d\", dataString, condition)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\tWarningLogger.Println(\"CCom returned with an error: \" + string(output) + \": \" + err.Error())\n\t\tlogWarning(\"CCom returned with an error: \" + string(output))\n\t}\n\treturn strings.TrimRight(string(output), \"\\r\\n\") == \"true\"\n}", "title": "" }, { "docid": "fbb0dabc296f414a964b4debf7770255", "score": "0.4663127", "text": "func updateCondition(gr *appmesh.GatewayRoute, conditionType appmesh.GatewayRouteConditionType, status corev1.ConditionStatus, reason *string, message *string) bool {\n\tnow := metav1.Now()\n\texistingCondition := getCondition(gr, conditionType)\n\tif existingCondition == nil {\n\t\tnewCondition := appmesh.GatewayRouteCondition{\n\t\t\tType: conditionType,\n\t\t\tStatus: status,\n\t\t\tLastTransitionTime: &now,\n\t\t\tReason: reason,\n\t\t\tMessage: message,\n\t\t}\n\t\tgr.Status.Conditions = append(gr.Status.Conditions, newCondition)\n\t\treturn true\n\t}\n\n\thasChanged := false\n\tif existingCondition.Status != status {\n\t\texistingCondition.Status = status\n\t\texistingCondition.LastTransitionTime = &now\n\t\thasChanged = true\n\t}\n\tif aws.StringValue(existingCondition.Reason) != aws.StringValue(reason) {\n\t\texistingCondition.Reason = reason\n\t\thasChanged = true\n\t}\n\tif aws.StringValue(existingCondition.Message) != aws.StringValue(message) {\n\t\texistingCondition.Message = message\n\t\thasChanged = true\n\t}\n\treturn hasChanged\n}", "title": "" }, { "docid": "99933521827699669cd8d6e749b00827", "score": "0.46628177", "text": "func (b *Builder) Condition(indexes []uint32) (*Condition, error) {\n\tif len(indexes) == 0 {\n\t\treturn nil, nil\n\t}\n\n\tbuf := bytes.NewBuffer(make([]byte, 0, len(indexes)*4))\n\tif err := binary.Write(buf, binary.LittleEndian, indexes); err != nil {\n\t\tpanic(err)\n\t}\n\tcacheKey := buf.String()\n\n\tif cond, exists := b.cache[cacheKey]; exists {\n\t\treturn cond, nil\n\t}\n\n\tcond, err := b.build(indexes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcond.index = len(b.cache)\n\tb.cache[cacheKey] = cond\n\treturn cond, nil\n}", "title": "" }, { "docid": "49979471db5954d15e29868991af8489", "score": "0.46545652", "text": "func conditionAggregator(data map[string][]byte) ([]byte, error) {\n\tcase1Data, _ := data[\"case1\"]\n\tcase2Data, _ := data[\"case2\"]\n\taggregatedResult := fmt.Sprintf(\"(case1: %s, case2: %s)\", case1Data, case2Data)\n\treturn []byte(aggregatedResult), nil\n}", "title": "" }, { "docid": "27e6d5c8c8ea9afcbcec4d7b2a6cb2e4", "score": "0.463167", "text": "func (o *Options) Apply(opts ...Option) error {\n\tfor i, opt := range opts {\n\t\tif err := opt(o); err != nil {\n\t\t\treturn fmt.Errorf(\"dht option %d failed: %s\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e5b4916fb77cb5464c1e1b853b377f5d", "score": "0.4631626", "text": "func setCondition(status *api.Caffe2JobStatus, condition api.Caffe2JobCondition) {\n\tcurrentCond := getCondition(*status, condition.Type)\n\n\t// Do nothing if condition doesn't change\n\tif currentCond != nil && currentCond.Status == condition.Status && currentCond.Reason == condition.Reason {\n\t\treturn\n\t}\n\n\t// Do not update lastTransitionTime if the status of the condition doesn't change.\n\tif currentCond != nil && currentCond.Status == condition.Status {\n\t\tcondition.LastTransitionTime = currentCond.LastTransitionTime\n\t}\n\n\t// Append the updated condition to the\n\tnewConditions := filterOutCondition(status.Conditions, condition.Type)\n\tstatus.Conditions = append(newConditions, condition)\n}", "title": "" }, { "docid": "4e8f2314f8f5cf2591074eee6c5e66e9", "score": "0.46303824", "text": "func (c Condition) Run(r Runner) (*Value, *Breakout) {\n\tif len(c) == 0 {\n\t\t// Empty conditions are automatically true.\n\t\treturn NewValueBool(true), nil\n\t} else if len(c) == 1 {\n\t\t// Every non-empty string is true.\n\t\treturn c[0].Run(r)\n\t}\n\n\t// Make sure every value equals the first.\n\tfirst, bo := c[0].Run(r)\n\tif bo != nil {\n\t\treturn nil, bo\n\t}\n\tstr := first.String()\n\tfor i := 1; i < len(c); i++ {\n\t\tval, bo := c[i].Run(r)\n\t\tif bo != nil {\n\t\t\treturn nil, bo\n\t\t}\n\t\tif val.String() != str {\n\t\t\treturn emptyValue, nil\n\t\t}\n\t}\n\n\treturn NewValueBool(true), nil\n}", "title": "" }, { "docid": "44059d427fd91d6690a74fe09020d741", "score": "0.46262884", "text": "func testCond(c *Processor, cc uint16) bool {\n\tswitch cc {\n\tcase CondTrue:\n\t\treturn true\n\n\tcase CondFalse:\n\t\treturn false\n\n\tcase CondNotEqual:\n\t\treturn c.SR&StatusZero == 0\n\n\tcase CondEqual:\n\t\treturn c.SR&StatusZero != 0\n\n\t\t// TODO: implement all evaluation of all condition codes\n\t}\n\treturn false\n}", "title": "" }, { "docid": "93d717c836893dfe58a1e885aab76eb7", "score": "0.46207017", "text": "func UpdateConditionAlways(_, _, _, _ string) bool {\n\treturn true\n}", "title": "" }, { "docid": "93d717c836893dfe58a1e885aab76eb7", "score": "0.46207017", "text": "func UpdateConditionAlways(_, _, _, _ string) bool {\n\treturn true\n}", "title": "" }, { "docid": "b18768983fc5ae56e29c6cbc0c40efc3", "score": "0.46120244", "text": "func Update(updates ...Eq) *Builder {\r\n\tbuilder := &Builder{cond: NewCond()}\r\n\treturn builder.Update(updates...)\r\n}", "title": "" }, { "docid": "be8c3ae07f49d997437146b8a0c02f43", "score": "0.46082416", "text": "func (bo *BoolOptions) Apply(n models.ConfigurationMap, changed ChangedFunc, data interface{}) int {\n\tchanges := []changedOptions{}\n\n\tbo.optsMU.Lock()\n\tfor k, v := range n {\n\t\tval, ok := bo.Opts[k]\n\n\t\tif boolVal, _ := NormalizeBool(v); boolVal {\n\t\t\t/* Only enable if not enabled already */\n\t\t\tif !ok || !val {\n\t\t\t\tbo.enable(k)\n\t\t\t\tchanges = append(changes, changedOptions{key: k, value: true})\n\t\t\t}\n\t\t} else {\n\t\t\t/* Only disable if enabled already */\n\t\t\tif ok && val {\n\t\t\t\tbo.disable(k)\n\t\t\t\tchanges = append(changes, changedOptions{key: k, value: false})\n\t\t\t}\n\t\t}\n\t}\n\tbo.optsMU.Unlock()\n\n\tfor _, change := range changes {\n\t\tchanged(change.key, change.value, data)\n\t}\n\n\treturn len(changes)\n}", "title": "" }, { "docid": "e75786e2ed6f9f6f5fc1698b0ed5f4ba", "score": "0.46026963", "text": "func (eq Eq) Or(conds ...Cond) Cond {\n\treturn Or(eq, Or(conds...))\n}", "title": "" }, { "docid": "c008981edae831807e619da92a4c0118", "score": "0.46022", "text": "func (s *BasevhdlListener) EnterCondition_clause(ctx *Condition_clauseContext) {}", "title": "" }, { "docid": "7d242f5d4231fb39d413de311b3ce169", "score": "0.4583335", "text": "func ComposeCNFCondition(ctx sessionctx.Context, conditions ...Expression) Expression {\n\treturn composeConditionWithBinaryOp(ctx, conditions, ast.LogicAnd)\n}", "title": "" }, { "docid": "fe4226d7f8d17efc9c276db6437a6654", "score": "0.45812237", "text": "func usingCond(){\n\tconst optimumRockerBoosterCount int = 2\n\tcon := sync.NewCond(&sync.Mutex{})\n\tvar wg sync.WaitGroup\n\twg.Add(1)\n\tvar rocketBoosters []int\n\taddRockerBoosters := func(){\n\t\ttime.Sleep(10000)\n\t\tcon.L.Lock()\n\t\trocketBoosters=append(rocketBoosters, 1)\n\t\tfmt.Println(\"Added one rocket booster\")\n\t\tcon.L.Unlock()\n\t\tcon.Signal()\n\t}\n\n\tstartEngines:= func(){\n\t\tcon.L.Lock()\n\t\tfor len(rocketBoosters)<optimumRockerBoosterCount{\n\t\t\tcon.Wait()\n\t\t\tfmt.Println(\"waiting ....\")\n\t\t}\n\t\tcon.L.Unlock()\n\t\twg.Done()\n\t}\n\tgo startEngines()\n\tfor i:=0;i<3;i++ {\n\t\tgo addRockerBoosters()\n\t}\n\t\n\twg.Wait()\n\tfmt.Println(\"end of main\")\n}", "title": "" }, { "docid": "9d49a5b594d32bf039e4aabfbc51d95c", "score": "0.45636207", "text": "func (s *LCOWOption) Apply(interface{}) error {\n\treturn nil\n}", "title": "" }, { "docid": "e7f7c340244743e568bf065be53db970", "score": "0.455698", "text": "func (m *UserExtModel) Condition(builder query.SQLBuilder) *UserExtModel {\n\tmm := m.clone()\n\tmm.query = mm.query.Merge(builder)\n\n\treturn mm\n}", "title": "" }, { "docid": "d677ff5c1f476274e0fb0725043233ce", "score": "0.45550954", "text": "func conditionsInclude(oldConditions, newConditions []configv1.ClusterOperatorStatusCondition) bool {\n\tfor _, newCondition := range newConditions {\n\t\tfoundMatchingCondition := false\n\n\t\tfor _, oldCondition := range oldConditions {\n\t\t\tif newCondition.Type != oldCondition.Type || newCondition.Status != oldCondition.Status {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif newCondition.Reason != \"\" && newCondition.Reason != oldCondition.Reason {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif newCondition.Message != \"\" && newCondition.Message != oldCondition.Message {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tfoundMatchingCondition = true\n\t\t\tbreak\n\t\t}\n\n\t\tif !foundMatchingCondition {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "8addbe8f577615335b9e8a114f14347d", "score": "0.45526707", "text": "func (app *exitBuilder) WithCondition(cond string) ExitBuilder {\n\tapp.condition = cond\n\treturn app\n}", "title": "" }, { "docid": "3655ab647030044570e21c373b4e2aa5", "score": "0.45473832", "text": "func (o *Options) Apply(opts ...Option) error {\n\tfor i, opt := range opts {\n\t\tif err := opt(o); err != nil {\n\t\t\treturn fmt.Errorf(\"option %d failed: %s\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ceaa97ba3c00c757320d1b4d518285ef", "score": "0.4544648", "text": "func ConditionFromTokens(t []Token, context string) Runnable {\n\tif len(t) != 0 && t[0].String == \"not\" {\n\t\t// Negative condition\n\t\tc := make(NotCondition, len(t)-1)\n\t\tfor i := 1; i < len(t); i++ {\n\t\t\tc[i-1] = t[i].Runnable(context)\n\t\t}\n\t\treturn c\n\t} else {\n\t\t// Positive condition\n\t\tc := make(Condition, len(t))\n\t\tfor i, token := range t {\n\t\t\tc[i] = token.Runnable(context)\n\t\t}\n\t\treturn c\n\t}\n}", "title": "" }, { "docid": "003affe549051db8dfb9e83445750cf8", "score": "0.45418262", "text": "func (c StoppingCondition) Or(other StoppingCondition) StoppingCondition {\n\treturn StoppingCondition{\n\t\tIsMet: func(statistic IterationStatistic) bool { return c.IsMet(statistic) || other.IsMet(statistic) },\n\t}\n}", "title": "" }, { "docid": "db6558ba6fd8f965b6c52dd90e2a40ac", "score": "0.4540865", "text": "func when(condition bool, trueValue, falseValue interface{}) interface{} {\n\tif condition {\n\t\treturn trueValue\n\t} else {\n\t\treturn falseValue\n\t}\n}", "title": "" }, { "docid": "8d2165953e8f3317b416077cf30d2fe2", "score": "0.4536789", "text": "func (lOpts *logOptions) apply(options ...Option) {\n\tfor _, opt := range options {\n\t\topt(lOpts)\n\t}\n}", "title": "" }, { "docid": "50c07aa4a8129ccc0ba45b6d0bc0838b", "score": "0.4527338", "text": "func getCond(t *Target) bool {\n\tt.Fetch(t.exp.GetTargetRef())\n\tcond, err := GetConditions(t)\n\tif err == nil {\n\t\treadyStr, _ := target.GetCondition(cond, \"Ready\")\n\t\treturn (readyStr == \"True\")\n\t}\n\treturn false\n}", "title": "" }, { "docid": "6e191bd878c7dcff590750a8d96940e5", "score": "0.4526565", "text": "func Any(conditions ...Condition) bool {\n for _, condition := range conditions {\n if condition() { return true }\n }\n return false\n}", "title": "" }, { "docid": "14bd98fdd67d8e41de7c61ba99d1fc3c", "score": "0.4525157", "text": "func waitCondWithTimeout(dur time.Duration, cond *sync.Cond) bool {\n\tctx, cancelF := context.WithTimeout(context.Background(), dur)\n\tdefer cancelF()\n\tdone := make(chan struct{})\n\tgo func() {\n\t\tcond.Wait()\n\t\tdone <- struct{}{}\n\t}()\n\tselect {\n\tcase <-done:\n\t\treturn true\n\tcase <-ctx.Done():\n\t}\n\treturn false\n}", "title": "" }, { "docid": "6631f06d7d1c80ece297ee3accb64c52", "score": "0.4520724", "text": "func (t *T) ConditionallyTo(filters ...CombinationFilter) *T {\n\tt.destinationFilters = append(t.destinationFilters, filters...)\n\treturn t\n}", "title": "" }, { "docid": "af495cc38fae51024311d0e8331f6215", "score": "0.4519934", "text": "func ConditionInitialize(context *clusterd.Context, namespaceName types.NamespacedName) {\n\tsetCondition(context, namespaceName, cephv1.Condition{\n\t\tType: cephv1.ConditionFailure,\n\t\tStatus: v1.ConditionFalse,\n\t\tReason: \"\",\n\t\tMessage: \"\",\n\t})\n\tsetCondition(context, namespaceName, cephv1.Condition{\n\t\tType: cephv1.ConditionIgnored,\n\t\tStatus: v1.ConditionFalse,\n\t\tReason: \"\",\n\t\tMessage: \"\",\n\t})\n\tsetCondition(context, namespaceName, cephv1.Condition{\n\t\tType: cephv1.ConditionUpgrading,\n\t\tStatus: v1.ConditionFalse,\n\t\tReason: \"\",\n\t\tMessage: \"\",\n\t})\n}", "title": "" }, { "docid": "3b6d38841cc3bda86956e181aec4ae5f", "score": "0.4518804", "text": "func (o *Options) Apply() {\n\tif o == nil {\n\t\treturn\n\t}\n\tif len(o.ShowHiddenMetricsForVersion) > 0 {\n\t\tSetShowHidden()\n\t}\n\t// set disabled metrics\n\tfor _, metricName := range o.DisabledMetrics {\n\t\tSetDisabledMetric(metricName)\n\t}\n\tif o.AllowListMapping != nil {\n\t\tSetLabelAllowListFromCLI(o.AllowListMapping)\n\t}\n}", "title": "" }, { "docid": "56f5e29dff5d1e1ed24418c98a084646", "score": "0.4511935", "text": "func summary(from Getter, t string, options ...MergeOption) *metav1.Condition {\n\tconditions := from.GetConditions()\n\n\tmergeOpt := &mergeOptions{}\n\tfor _, o := range options {\n\t\to(mergeOpt)\n\t}\n\n\t// Identifies the conditions in scope for the Summary by taking all the existing conditions except t,\n\t// or, if a list of conditions types is specified, only the conditions the condition in that list.\n\tconditionsInScope := make([]localizedCondition, 0, len(conditions))\n\tfor i := range conditions {\n\t\tc := conditions[i]\n\t\tif c.Type == t {\n\t\t\tcontinue\n\t\t}\n\n\t\tif mergeOpt.conditionTypes != nil {\n\t\t\tfound := false\n\t\t\tfor _, tt := range mergeOpt.conditionTypes {\n\t\t\t\tif c.Type == tt {\n\t\t\t\t\tfound = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !found {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tconditionsInScope = append(conditionsInScope, localizedCondition{\n\t\t\tCondition: &c,\n\t\t\tGetter: from,\n\t\t})\n\t}\n\n\t// If it is required to add a step counter only if a subset of condition exists, check if the conditions\n\t// in scope are included in this subset or not.\n\tif mergeOpt.addStepCounterIfOnlyConditionTypes != nil {\n\t\tfor _, c := range conditionsInScope {\n\t\t\tfound := false\n\t\t\tfor _, tt := range mergeOpt.addStepCounterIfOnlyConditionTypes {\n\t\t\t\tif c.Type == tt {\n\t\t\t\t\tfound = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !found {\n\t\t\t\tmergeOpt.addStepCounter = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\t// If it is required to add a step counter, determine the total number of conditions defaulting\n\t// to the selected conditions or, if defined, to the total number of conditions type to be considered.\n\tif mergeOpt.addStepCounter {\n\t\tmergeOpt.stepCounter = len(conditionsInScope)\n\t\tif mergeOpt.conditionTypes != nil {\n\t\t\tmergeOpt.stepCounter = len(mergeOpt.conditionTypes)\n\t\t}\n\t\tif mergeOpt.addStepCounterIfOnlyConditionTypes != nil {\n\t\t\tmergeOpt.stepCounter = len(mergeOpt.addStepCounterIfOnlyConditionTypes)\n\t\t}\n\t}\n\n\treturn merge(conditionsInScope, t, mergeOpt)\n}", "title": "" }, { "docid": "45a03e654af6f32b1bf6a978fdf7adea", "score": "0.4509228", "text": "func (rm *resourceManager) updateConditions(\n\tr *resource,\n\tonSuccess bool,\n\terr error,\n) (*resource, bool) {\n\tko := r.ko.DeepCopy()\n\trm.setStatusDefaults(ko)\n\n\t// Terminal condition\n\tvar terminalCondition *ackv1alpha1.Condition = nil\n\tvar recoverableCondition *ackv1alpha1.Condition = nil\n\tvar syncCondition *ackv1alpha1.Condition = nil\n\tfor _, condition := range ko.Status.Conditions {\n\t\tif condition.Type == ackv1alpha1.ConditionTypeTerminal {\n\t\t\tterminalCondition = condition\n\t\t}\n\t\tif condition.Type == ackv1alpha1.ConditionTypeRecoverable {\n\t\t\trecoverableCondition = condition\n\t\t}\n\t\tif condition.Type == ackv1alpha1.ConditionTypeResourceSynced {\n\t\t\tsyncCondition = condition\n\t\t}\n\t}\n\n\tif rm.terminalAWSError(err) || err == ackerr.SecretTypeNotSupported || err == ackerr.SecretNotFound {\n\t\tif terminalCondition == nil {\n\t\t\tterminalCondition = &ackv1alpha1.Condition{\n\t\t\t\tType: ackv1alpha1.ConditionTypeTerminal,\n\t\t\t}\n\t\t\tko.Status.Conditions = append(ko.Status.Conditions, terminalCondition)\n\t\t}\n\t\tvar errorMessage = \"\"\n\t\tif err == ackerr.SecretTypeNotSupported || err == ackerr.SecretNotFound {\n\t\t\terrorMessage = err.Error()\n\t\t} else {\n\t\t\tawsErr, _ := ackerr.AWSError(err)\n\t\t\terrorMessage = awsErr.Error()\n\t\t}\n\t\tterminalCondition.Status = corev1.ConditionTrue\n\t\tterminalCondition.Message = &errorMessage\n\t} else {\n\t\t// Clear the terminal condition if no longer present\n\t\tif terminalCondition != nil {\n\t\t\tterminalCondition.Status = corev1.ConditionFalse\n\t\t\tterminalCondition.Message = nil\n\t\t}\n\t\t// Handling Recoverable Conditions\n\t\tif err != nil {\n\t\t\tif recoverableCondition == nil {\n\t\t\t\t// Add a new Condition containing a non-terminal error\n\t\t\t\trecoverableCondition = &ackv1alpha1.Condition{\n\t\t\t\t\tType: ackv1alpha1.ConditionTypeRecoverable,\n\t\t\t\t}\n\t\t\t\tko.Status.Conditions = append(ko.Status.Conditions, recoverableCondition)\n\t\t\t}\n\t\t\trecoverableCondition.Status = corev1.ConditionTrue\n\t\t\tawsErr, _ := ackerr.AWSError(err)\n\t\t\terrorMessage := err.Error()\n\t\t\tif awsErr != nil {\n\t\t\t\terrorMessage = awsErr.Error()\n\t\t\t}\n\t\t\trecoverableCondition.Message = &errorMessage\n\t\t} else if recoverableCondition != nil {\n\t\t\trecoverableCondition.Status = corev1.ConditionFalse\n\t\t\trecoverableCondition.Message = nil\n\t\t}\n\t}\n\t// Required to avoid the \"declared but not used\" error in the default case\n\t_ = syncCondition\n\tif terminalCondition != nil || recoverableCondition != nil || syncCondition != nil {\n\t\treturn &resource{ko}, true // updated\n\t}\n\treturn nil, false // not updated\n}", "title": "" }, { "docid": "8f6bce99c7d86f5ebac46d759802df11", "score": "0.4509228", "text": "func (rm *resourceManager) updateConditions(\n\tr *resource,\n\tonSuccess bool,\n\terr error,\n) (*resource, bool) {\n\tko := r.ko.DeepCopy()\n\trm.setStatusDefaults(ko)\n\n\t// Terminal condition\n\tvar terminalCondition *ackv1alpha1.Condition = nil\n\tvar recoverableCondition *ackv1alpha1.Condition = nil\n\tvar syncCondition *ackv1alpha1.Condition = nil\n\tfor _, condition := range ko.Status.Conditions {\n\t\tif condition.Type == ackv1alpha1.ConditionTypeTerminal {\n\t\t\tterminalCondition = condition\n\t\t}\n\t\tif condition.Type == ackv1alpha1.ConditionTypeRecoverable {\n\t\t\trecoverableCondition = condition\n\t\t}\n\t\tif condition.Type == ackv1alpha1.ConditionTypeResourceSynced {\n\t\t\tsyncCondition = condition\n\t\t}\n\t}\n\n\tif rm.terminalAWSError(err) || err == ackerr.SecretTypeNotSupported || err == ackerr.SecretNotFound {\n\t\tif terminalCondition == nil {\n\t\t\tterminalCondition = &ackv1alpha1.Condition{\n\t\t\t\tType: ackv1alpha1.ConditionTypeTerminal,\n\t\t\t}\n\t\t\tko.Status.Conditions = append(ko.Status.Conditions, terminalCondition)\n\t\t}\n\t\tvar errorMessage = \"\"\n\t\tif err == ackerr.SecretTypeNotSupported || err == ackerr.SecretNotFound {\n\t\t\terrorMessage = err.Error()\n\t\t} else {\n\t\t\tawsErr, _ := ackerr.AWSError(err)\n\t\t\terrorMessage = awsErr.Error()\n\t\t}\n\t\tterminalCondition.Status = corev1.ConditionTrue\n\t\tterminalCondition.Message = &errorMessage\n\t} else {\n\t\t// Clear the terminal condition if no longer present\n\t\tif terminalCondition != nil {\n\t\t\tterminalCondition.Status = corev1.ConditionFalse\n\t\t\tterminalCondition.Message = nil\n\t\t}\n\t\t// Handling Recoverable Conditions\n\t\tif err != nil {\n\t\t\tif recoverableCondition == nil {\n\t\t\t\t// Add a new Condition containing a non-terminal error\n\t\t\t\trecoverableCondition = &ackv1alpha1.Condition{\n\t\t\t\t\tType: ackv1alpha1.ConditionTypeRecoverable,\n\t\t\t\t}\n\t\t\t\tko.Status.Conditions = append(ko.Status.Conditions, recoverableCondition)\n\t\t\t}\n\t\t\trecoverableCondition.Status = corev1.ConditionTrue\n\t\t\tawsErr, _ := ackerr.AWSError(err)\n\t\t\terrorMessage := err.Error()\n\t\t\tif awsErr != nil {\n\t\t\t\terrorMessage = awsErr.Error()\n\t\t\t}\n\t\t\trecoverableCondition.Message = &errorMessage\n\t\t} else if recoverableCondition != nil {\n\t\t\trecoverableCondition.Status = corev1.ConditionFalse\n\t\t\trecoverableCondition.Message = nil\n\t\t}\n\t}\n\t// Required to avoid the \"declared but not used\" error in the default case\n\t_ = syncCondition\n\t// custom update conditions\n\tcustomUpdate := rm.CustomUpdateConditions(ko, r, err)\n\tif terminalCondition != nil || recoverableCondition != nil || syncCondition != nil || customUpdate {\n\t\treturn &resource{ko}, true // updated\n\t}\n\treturn nil, false // not updated\n}", "title": "" }, { "docid": "1c0b44f34b01af1db5b707534320cd06", "score": "0.45028254", "text": "func ConditionString(cond bool, valid, inValid string) string {\n\tif cond {\n\t\treturn valid\n\t}\n\treturn inValid\n}", "title": "" }, { "docid": "1c0b44f34b01af1db5b707534320cd06", "score": "0.45028254", "text": "func ConditionString(cond bool, valid, inValid string) string {\n\tif cond {\n\t\treturn valid\n\t}\n\treturn inValid\n}", "title": "" }, { "docid": "d92670bd6304d2a210c26ac167f82b8d", "score": "0.4495269", "text": "func (o GoogleCloudRetailV2alphaRuleOutput) Condition() GoogleCloudRetailV2alphaConditionOutput {\n\treturn o.ApplyT(func(v GoogleCloudRetailV2alphaRule) GoogleCloudRetailV2alphaCondition { return v.Condition }).(GoogleCloudRetailV2alphaConditionOutput)\n}", "title": "" }, { "docid": "01d6c01d2cc3b04e34b47309a8824192", "score": "0.44919273", "text": "func (cfg *Config) Apply(opts ...Option) error {\n\tfor _, opt := range opts {\n\t\tif opt == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif err := opt(cfg); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2c8d84618bd731bf77a4d1c2b947b257", "score": "0.44906873", "text": "func filterOutCondition(conditions []mxv1.MXJobCondition, condType mxv1.MXJobConditionType) []mxv1.MXJobCondition {\n\tvar newConditions []mxv1.MXJobCondition\n\tfor _, c := range conditions {\n\t\tif condType == mxv1.MXJobRestarting && c.Type == mxv1.MXJobRunning {\n\t\t\tcontinue\n\t\t}\n\t\tif condType == mxv1.MXJobRunning && c.Type == mxv1.MXJobRestarting {\n\t\t\tcontinue\n\t\t}\n\n\t\tif c.Type == condType {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Set the running condition status to be false when current condition failed or succeeded\n\t\tif (condType == mxv1.MXJobFailed || condType == mxv1.MXJobSucceeded) && c.Type == mxv1.MXJobRunning {\n\t\t\tc.Status = v1.ConditionFalse\n\t\t}\n\n\t\tnewConditions = append(newConditions, c)\n\t}\n\treturn newConditions\n}", "title": "" }, { "docid": "0e71322b1be19eb1c6aed3e5e176569a", "score": "0.44878644", "text": "func If(hk ent.Hook, cond Condition) ent.Hook {\n\treturn func(next ent.Mutator) ent.Mutator {\n\t\treturn ent.MutateFunc(func(ctx context.Context, m ent.Mutation) (ent.Value, error) {\n\t\t\tif cond(ctx, m) {\n\t\t\t\treturn hk(next).Mutate(ctx, m)\n\t\t\t}\n\t\t\treturn next.Mutate(ctx, m)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "02b43a0a03ddc458cfffffcd6cc94f43", "score": "0.4480843", "text": "func apply(\n\ttest func(t *testing.T, conf interface{}, opts ...option),\n\tconf interface{}, opts ...option,\n) func(*testing.T) {\n\treturn func(t *testing.T) {\n\t\ttest(t, conf, opts...)\n\t}\n}", "title": "" }, { "docid": "9c18640f803368a67e6d90eb6da95c58", "score": "0.4479286", "text": "func excludeIgnoredConditions(obj *unstructured.Unstructured, ignoreOptions fleet.IgnoreOptions) error {\n\tconditions, _, err := unstructured.NestedSlice(obj.Object, \"status\", \"conditions\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tconditionsWithoutIgnored := make([]interface{}, 0)\n\n\tfor _, condition := range conditions {\n\t\tcondition, ok := condition.(map[string]interface{})\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"condition: %#v can't be converted to map[string]interface{}\", condition)\n\t\t}\n\t\texcludeCondition := false\n\t\tfor _, ignoredCondition := range ignoreOptions.Conditions {\n\t\t\tif shouldExcludeCondition(condition, ignoredCondition) {\n\t\t\t\texcludeCondition = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !excludeCondition {\n\t\t\tconditionsWithoutIgnored = append(conditionsWithoutIgnored, condition)\n\t\t}\n\t}\n\n\terr = unstructured.SetNestedSlice(obj.Object, conditionsWithoutIgnored, \"status\", \"conditions\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "eb733c163344effe8b512df00f32eb79", "score": "0.44709975", "text": "func Ternary(condition bool, tVal interface{}, fVal interface{}) interface{} {\n if (condition) {\n return tVal\n }\n return fVal\n}", "title": "" }, { "docid": "826be1e25a4feab2b2d170eeac5412c9", "score": "0.44644183", "text": "func (c *AppConfig) Apply(opts []AppOption) error {\r\n\tfor _, o := range opts {\r\n\t\tif err := o(c); err != nil {\r\n\t\t\treturn err\r\n\t\t}\r\n\t}\r\n\treturn nil\r\n}", "title": "" }, { "docid": "a51954df11dfb8e6fbfce9396ee93320", "score": "0.44562265", "text": "func shouldExcludeCondition(conditions map[string]interface{}, ignoredConditions map[string]string) bool {\n\tif len(ignoredConditions) > len(conditions) {\n\t\treturn false\n\t}\n\n\tfor k, v := range ignoredConditions {\n\t\tif vc, found := conditions[k]; !found || vc != v {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "0ed8e9cb3dac3cb7da865da7754b6ba8", "score": "0.44527817", "text": "func (a *Agent) getConditions() map[condition]bool {\n\tresult := map[condition]bool{}\n\n\tfor _, o := range a.mind.objects() {\n\t\tfor attrType, attrVal := range o.getAttrs() {\n\t\t\tif _, seen := qualitativeAttrTypes[attrType]; !seen {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tresult[a.newAttributeCondition(o.getType(), attrType, attrVal)] = true\n\t\t}\n\t}\n\n\tfor stateType, stateVal := range a.state.states {\n\t\tif stateInfo, seen := agentStateInfos[stateType]; seen {\n\t\t\tresult[a.newAgentCondition(stateType, stateVal > stateInfo.threshold)] = true\n\t\t} else {\n\t\t\tresult[a.newAgentCondition(stateType, stateVal > 0)] = true\n\t\t}\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "7e859276b3e47bef5cecd14e2e533eb9", "score": "0.4449355", "text": "func (am aggregatedMessages) calculateConditionAny() cond_v1.Condition {\n\tvar condMsgs []string\n\tvar status cond_v1.ConditionStatus\n\tswitch { // Order is important because flags are not exclusive\n\tcase am.isUnknown:\n\t\tcondMsgs = am.unknownMsgs\n\t\tstatus = cond_v1.ConditionUnknown\n\tcase am.isTrue:\n\t\tcondMsgs = am.trueMsgs\n\t\tstatus = cond_v1.ConditionTrue\n\tdefault:\n\t\tcondMsgs = am.falseMsgs\n\t\tstatus = cond_v1.ConditionFalse\n\t}\n\treturn am.fmtCondition(condMsgs, status)\n}", "title": "" }, { "docid": "5c110ea596e6692883f3f18e1d4cd29d", "score": "0.44489852", "text": "func (s *BasePlSqlParserListener) EnterCondition(ctx *ConditionContext) {}", "title": "" }, { "docid": "9271946bd174003cdaf52d2c38b43abb", "score": "0.44475117", "text": "func Condition(c query.Condition) bool {\n\treturn Evaluator{Strict: false}.Condition(c)\n}", "title": "" }, { "docid": "a47825d4629a93ab2dd243f619365c94", "score": "0.4447", "text": "func (j *J) evalCondition(s string) (bool, error) {\n\tvar buf strings.Builder\n\tif err := j.send(s, &buf); err != nil {\n\t\treturn false, err\n\t}\n\ts = strings.TrimSpace(buf.String())\n\tif i, err := strconv.Atoi(s); err != nil {\n\t\treturn false, fmt.Errorf(\"expected bool, got %s\", err)\n\t} else {\n\t\treturn i != 0, nil\n\t}\n}", "title": "" }, { "docid": "6975d1c3786099645a32a24a38f36ec4", "score": "0.44451946", "text": "func passesOpenSwathFilters(line []string, options types.Parameters) bool {\n\tisDecoy, _ := strconv.Atoi(line[1])\n\tif options.IgnoreDecoys && isDecoy == 1 {\n\t\treturn false\n\t}\n\n\tmScore, _ := strconv.ParseFloat(line[22], 64)\n\tmScorePeptideExperimentWide, _ := strconv.ParseFloat(line[27], 64)\n\tpeakGroupRank, _ := strconv.Atoi(line[20])\n\n\tif mScore <= options.Mscore &&\n\t\tmScorePeptideExperimentWide <= options.MscorePeptideExperimentWide &&\n\t\tpeakGroupRank <= options.PeakGroupRank {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1a422be0192195accbf8d0f5de6ec6ed", "score": "0.44446462", "text": "func HaveCondition(condType interface{}, status corev1.ConditionStatus) gomegatypes.GomegaMatcher {\n\treturn PointTo(MatchFields(IgnoreExtras, Fields{\n\t\t\"Status\": MatchFields(IgnoreExtras, Fields{\n\t\t\t\"Conditions\": ContainElement(MatchFields(IgnoreExtras, Fields{\n\t\t\t\t\"Type\": Equal(condType),\n\t\t\t\t\"Status\": Equal(status),\n\t\t\t})),\n\t\t}),\n\t}))\n}", "title": "" }, { "docid": "aae56d0404e4db9732db1d34ff0cf0ff", "score": "0.4441823", "text": "func NewCond() Cond {\n\treturn condEmpty{}\n}", "title": "" }, { "docid": "4da15c084acf0c38a25cdc9ad14bd2c2", "score": "0.443972", "text": "func (cmd *ConditionCommand) AddFlaggySubcommand() *flaggy.Subcommand {\n\n\tcmd.subcommand = flaggy.NewSubcommand(\"condition\")\n\tcmd.subcommand.Description = \"Condition and/or convert a mGuard configuration file\"\n\tcmd.subcommand.String(&cmd.inFilePath, \"\", \"in\", \"File containing the mGuard configuration to condition (ATV format or unencrypted ECS container)\")\n\tcmd.subcommand.String(&cmd.outAtvFilePath, \"\", \"atv-out\", \"File receiving the conditioned configuration (ATV format, instead of stdout)\")\n\tcmd.subcommand.String(&cmd.outEcsFilePath, \"\", \"ecs-out\", \"File receiving the conditioned configuration (ECS container, unencrypted, instead of stdout)\")\n\n\tflaggy.AttachSubcommand(cmd.subcommand, 1)\n\n\treturn cmd.subcommand\n}", "title": "" }, { "docid": "b425ae6c82451c23875050e924bdaa13", "score": "0.44374132", "text": "func (ro *RequesterOptions) apply(opts ...RequesterOption) {\n\tfor _, opt := range opts {\n\t\topt(ro)\n\t}\n}", "title": "" }, { "docid": "7ab3efa2c8a8530db3a8127ed35d73b9", "score": "0.44369012", "text": "func (w *Wrapper) saveCondition(typ, connector string, args ...interface{}) {\n\tvar c condition\n\tc.connector = connector\n\tc.args = args\n\tif typ == \"HAVING\" {\n\t\tw.havingConditions = append(w.havingConditions, c)\n\t} else {\n\t\tw.conditions = append(w.conditions, c)\n\t}\n}", "title": "" } ]
e0d91892595d8ca21fc64ea9cdc4aa72
Table ,return device list
[ { "docid": "9f9aa60fdb9b78ce2e393db079cca2ef", "score": "0.0", "text": "func (obj *VersionsController) Table() {\n\n\t//列表\n\tpage, err := obj.GetInt(\"page\")\n\tif err != nil {\n\t\tpage = 1\n\t}\n\tlimit, err := obj.GetInt(\"limit\")\n\tif err != nil {\n\t\tlimit = 30\n\t}\n\n\tstartTime := strings.TrimSpace(obj.GetString(\"startTime\"))\n\tendTime := strings.TrimSpace(obj.GetString(\"endTime\"))\n\n\tobj.pageSize = limit\n\t//查询条件\n\tfilters := make([]interface{}, 0)\n\t//filters = append(filters, \"status\", 1)\n\n\tif startTime != \"\" {\n\t\tst, _ := time.Parse(timeLayoutStr, startTime)\n\t\tfilters = append(filters, \"VersionUpdateTime__gte\", st.Unix())\n\t}\n\n\tif endTime != \"\" {\n\t\tet, _ := time.Parse(timeLayoutStr, endTime)\n\t\tfilters = append(filters, \"VersionUpdateTime__lte\", et.Unix())\n\t}\n\n\tresult, count := models.VerGetList(page, obj.pageSize, filters...)\n\n\tlist := make([]map[string]interface{}, len(result))\n\tfor k, v := range result {\n\t\trow := make(map[string]interface{})\n\t\trow[\"ID\"] = v.ID\n\t\trow[\"VersionTitle\"] = v.VersionTitle\n\t\trow[\"VersionSize\"] = v.VersionSize\n\t\trow[\"VersionURL\"] = v.VersionURL\n\t\trow[\"VersionDes\"] = v.VersionDes\n\t\trow[\"VersionAddTime\"] = beego.Date(time.Unix(v.VersionAddTime, 0), \"Y-m-d H:i:s\")\n\t\trow[\"VersionUpdateTime\"] = beego.Date(time.Unix(v.VersionUpdateTime, 0), \"Y-m-d H:i:s\")\n\t\tlist[k] = row\n\t}\n\tobj.ajaxList(\"Success\", msgOk, count, list)\n}", "title": "" } ]
[ { "docid": "fcfac684ed61dfa62e6791baa1faff6a", "score": "0.71361476", "text": "func (s *Session) ListDevices() (string, error) { return s.action(http.MethodGet, \"/stat/device\", nil) }", "title": "" }, { "docid": "689a83f27c94107f979846effa51142f", "score": "0.6984077", "text": "func deviceList() string {\n\tdl := device.Registered()\n\tif len(dl) > 0 {\n\t\treturn strings.Join(dl, \", \")\n\t}\n\treturn \"none\"\n}", "title": "" }, { "docid": "4ad7345dcf21fda60b4e28e462ee6bc8", "score": "0.6823884", "text": "func (c Main) DeviceList() revel.Result {\n\tdevices := dao.GetAllDevices(c.getCurrentUserID())\n\tc.ViewArgs[\"devices\"] = devices\n\treturn c.Render()\n}", "title": "" }, { "docid": "e45f8928ce96eb40dc13627861a0566b", "score": "0.6605704", "text": "func (v DevicesResource) List(c buffalo.Context) error {\n\t// Get the DB connection from the context\n\ttx, ok := c.Value(\"tx\").(*pop.Connection)\n\tif !ok {\n\t\treturn fmt.Errorf(\"no transaction found\")\n\t}\n\n\tdevices := &models.Devices{}\n\n\t// Retrieve all Devices from the DB\n\tif err := tx.Eager().All(devices); err != nil {\n\t\treturn err\n\t}\n\n\treturn c.Render(200, r.JSON(devices))\n}", "title": "" }, { "docid": "d7fee142008b064e3ff5018a07d6c89d", "score": "0.65604335", "text": "func (sub *vmSubscription) DeviceList(op trace.Operation) error {\n\tlist, err := sub.vm.Device(op.Context)\n\tif err != nil {\n\t\top.Errorf(\"vm stats subscription(%s) unable to load devices: %s\", sub.ID(), err)\n\t\treturn err\n\t}\n\n\t// populate slice for disk and network names\n\tfor i := range list {\n\t\tswitch list.Type(list[i]) {\n\t\tcase object.DeviceTypeDisk:\n\t\t\t// disk names are presented by the performanceManager based on their relationship to the\n\t\t\t// controller. So we need to create a disk name that aligns with the performance manager\n\t\t\t// naming pattern\n\t\t\tdisk := list[i].GetVirtualDevice()\n\t\t\tswitch c := list.FindByKey(disk.ControllerKey).(type) {\n\t\t\tcase types.BaseVirtualSCSIController:\n\t\t\t\tsub.diskNames = append(sub.diskNames, fmt.Sprintf(\"%s%d:%d\", \"scsi\", c.GetVirtualSCSIController().BusNumber, *disk.UnitNumber))\n\t\t\t}\n\t\tcase object.DeviceTypeEthernet:\n\t\t\tsub.networkNames = append(sub.networkNames, list.Name(list[i]))\n\t\t}\n\t}\n\n\tsub.devices = list\n\treturn nil\n}", "title": "" }, { "docid": "2839a15fd26dce9d10b3be1c41d2e46b", "score": "0.65559745", "text": "func (a *DeviceAPI) List(ctx context.Context, req *pb.ListDeviceRequest) (*pb.ListDeviceResponse, error) {\n\n\tisUser, err := GetIsUser(ctx)\n\tif err != nil || !isUser {\n\t\treturn nil, helpers.ErrToRPCError(err)\n\t}\n\n\tdevices, err := storage.ListDevices(storage.DB(), req.Limit, req.Offset)\n\tif err != nil {\n\t\treturn nil, helpers.ErrToRPCError(err)\n\t}\n\n\tcount, err := storage.GetDeviceCount(storage.DB())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &pb.ListDeviceResponse{\n\t\tTotalCount: count,\n\t\tResult: make([]*pb.GetDeviceResponse, len(devices)),\n\t}\n\n\tfor i, d := range devices {\n\t\tdevice := &pb.GetDeviceResponse{\n\t\t\tId: d.ID,\n\t\t\tSerialNumber: d.SerialNumber,\n\t\t\tFirmwareVersion: d.FirmwareVersion,\n\t\t}\n\t\tdevice.RegisteredAt, err = ptypes.TimestampProto(d.RegisteredAt)\n\t\tif err != nil {\n\t\t\treturn nil, helpers.ErrToRPCError(err)\n\t\t}\n\t\tresp.Result[i] = device\n\t}\n\n\treturn resp, nil\n\n}", "title": "" }, { "docid": "248dcf649be358fa806377491367cff3", "score": "0.6511775", "text": "func (inst *QemuInstance) listDevices() (*QOMDev, error) {\n\tlistcmd := `{ \"execute\": \"qom-list\", \"arguments\": { \"path\": \"/machine/peripheral-anon\" } }`\n\tout, err := inst.runQmpCommand(listcmd)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Running QMP qom-list command\")\n\t}\n\n\tvar devs QOMDev\n\tif err = json.Unmarshal(out, &devs); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"De-serializing QMP qom-list output\")\n\t}\n\treturn &devs, nil\n}", "title": "" }, { "docid": "ecff2d1c10c088e5fbf4ea8b07155b0d", "score": "0.64387745", "text": "func ListDevice(flag bool) []string {\n\tfiles, err := ioutil.ReadDir(\"/dev/\")\n\tif err != nil {\n\t\treturn nil\n\t} else {\n\t\tvar s []string\n\t\tfor _, v := range files {\n\t\t\tif flag {\n\t\t\t\tif strings.Contains(v.Name(), \"ttyUSB\") {\n\t\t\t\t\ts = append(s, v.Name())\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif strings.Contains(v.Name(), \"tty\") {\n\t\t\t\t\ts = append(s, v.Name())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn s\n\t}\n}", "title": "" }, { "docid": "f242ebfb6befcb12d4a262fc837e035e", "score": "0.6350138", "text": "func _device(uuid string) (devs map[string][]string, dev []Dev, err error) {\n\to := orm.NewOrm()\n\tvar d Dev\n\tvar m Machine\n\tdevs = make(map[string][]string, 0)\n\n\tvar e []Export\n\tif _, err = o.QueryTable(new(Export)).Filter(\"clusterid\", uuid).All(&e); err != nil {\n\t\tutil.AddLog(err)\n\t\treturn\n\t}\n\n\tvar s []Storage\n\tif _, err = o.QueryTable(new(Storage)).Filter(\"clusterid\", uuid).All(&s); err != nil {\n\t\tutil.AddLog(err)\n\t\treturn\n\t}\n\n\tvar c []Client\n\tif _, err = o.QueryTable(new(Client)).Filter(\"clusterid\", uuid).All(&c); err != nil {\n\t\tutil.AddLog(err)\n\t\treturn\n\t}\n\n\tfor _, i := range e {\n\t\tif err = o.QueryTable(new(Machine)).Filter(\"ip\", i.Ip).One(&m); err != nil {\n\t\t\tutil.AddLog(err)\n\t\t\treturn\n\t\t}\n\t\td.Ip = i.Ip\n\t\td.Uuid = i.Uuid\n\t\td.Status = m.Status\n\t\td.Devtype = \"export\"\n\t\tdev = append(dev, d)\n\t\tdevs[\"export\"] = append(devs[\"export\"], i.Ip)\n\t}\n\tfor _, i := range s {\n\t\tif err = o.QueryTable(new(Machine)).Filter(\"ip\", i.Ip).One(&m); err != nil {\n\t\t\tutil.AddLog(err)\n\t\t\treturn\n\t\t}\n\t\td.Ip = i.Ip\n\t\td.Uuid = i.Uuid\n\t\td.Status = m.Status\n\t\td.Devtype = \"storage\"\n\t\tdev = append(dev, d)\n\t\tdevs[\"storage\"] = append(devs[\"storage\"], i.Ip)\n\t}\n\tfor _, i := range c {\n\t\tif err = o.QueryTable(new(Machine)).Filter(\"ip\", i.Ip).One(&m); err != nil {\n\t\t\tutil.AddLog(err)\n\t\t\treturn\n\t\t}\n\t\td.Ip = i.Ip\n\t\td.Uuid = i.Uuid\n\t\td.Status = m.Status\n\t\td.Devtype = \"client\"\n\t\tdev = append(dev, d)\n\t\tdevs[\"client\"] = append(devs[\"client\"], i.Ip)\n\t}\n\treturn\n}", "title": "" }, { "docid": "d143235bef1c579751dda98fe11ebaa1", "score": "0.6345934", "text": "func getDevicesDFL() []device {\n\treturn []device{\n\t\t{\n\t\t\tname: \"region1\",\n\t\t\tregions: []region{\n\t\t\t\t{\n\t\t\t\t\tid: \"region1\",\n\t\t\t\t\tinterfaceID: \"ce48969398f05f33946d560708be108a\",\n\t\t\t\t\tdevNode: \"/dev/dfl-fme.0\",\n\t\t\t\t\tafus: []afu{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: \"dfl-port.0\",\n\t\t\t\t\t\t\tafuID: \"d8424dc4a4a3c413f89e433683f9040b\",\n\t\t\t\t\t\t\tdevNode: \"/dev/dfl-port.0\",\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\tname: \"region2\",\n\t\t\tregions: []region{\n\t\t\t\t{\n\t\t\t\t\tid: \"region2\",\n\t\t\t\t\tinterfaceID: \"ce48969398f05f33946d560708be108a\",\n\t\t\t\t\tdevNode: \"/dev/dfl-fme.1\",\n\t\t\t\t\tafus: []afu{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: \"dfl-port.1\",\n\t\t\t\t\t\t\tafuID: \"d8424dc4a4a3c413f89e433683f9040b\",\n\t\t\t\t\t\t\tdevNode: \"/dev/dfl-port.1\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: \"dfl-port.2\",\n\t\t\t\t\t\t\tafuID: \"d8424dc4a4a3c413f89e433683f9040b\",\n\t\t\t\t\t\t\tdevNode: \"/dev/dfl-port.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\tname: \"region3\",\n\t\t\tregions: []region{\n\t\t\t\t{\n\t\t\t\t\tid: \"region3\",\n\t\t\t\t\tinterfaceID: unhealthyInterfaceID,\n\t\t\t\t\tdevNode: \"/dev/dfl-fme.2\",\n\t\t\t\t\tafus: []afu{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: \"dfl-port.3\",\n\t\t\t\t\t\t\tafuID: unhealthyAfuID,\n\t\t\t\t\t\t\tdevNode: \"/dev/dfl-port.3\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: \"dfl-port.4\",\n\t\t\t\t\t\t\tafuID: \"d8424dc4a4a3c413f89e433683f9040b\",\n\t\t\t\t\t\t\tdevNode: \"/dev/dfl-port.4\",\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": "232bf35cd466a386cdc1ec3e3a3f5a3e", "score": "0.6334276", "text": "func ListDevices() (devices []Device, err error) {\n\treq, err := http.NewRequest(\"GET\", \"https://iot.cht.com.tw/iot/v1/device\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Set(\"CK\", os.Getenv(\"CHT_PROJECT_CK\"))\n\tresp, err := (&http.Client{}).Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tdec := json.NewDecoder(resp.Body)\n\tif err := dec.Decode(&devices); err != nil {\n\t\treturn nil, err\n\t}\n\treturn\n}", "title": "" }, { "docid": "249de9dfce9b84fb0cfe04199ffd2b7c", "score": "0.6285989", "text": "func ListDevices() ([]Device, error) {\n\tcmd := exec.Command(\"smartctl\", \"--scan\")\n\toutput, err := cmd.Output()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(output) == 0 {\n\t\treturn nil, ErrEmpty\n\t}\n\n\treturn parseScan(output)\n}", "title": "" }, { "docid": "5ca9632650c2f760f58d77bcca6783a5", "score": "0.62752223", "text": "func (account *CassandraAccount)GetDevices() ([]*CassandraDevice, error) {\n devices := []*CassandraDevice{}\n var deviceId gocql.UUID\n var accessLevel int\n\n query := account.dl.session.Query(`\n SELECT device_id, access_level FROM device_permissions \n WHERE username = ?\n `, account.Username()).Consistency(gocql.One)\n iter := query.Iter()\n for iter.Scan(&deviceId, &accessLevel) {\n if accessLevel > 0 {\n /* TODO: can we do another query inside an iterator? */\n device, err := account.dl.LookupDevice(deviceId)\n if err != nil {\n iter.Close()\n return []*CassandraDevice{}, err\n }\n devices = append(devices, device)\n }\n }\n if err := iter.Close(); err != nil {\n return []*CassandraDevice{}, err\n }\n\n return devices, nil\n}", "title": "" }, { "docid": "e01e8a9d32633b774d9f840687945274", "score": "0.62483597", "text": "func (ds* DataStore) getDevices(w http.ResponseWriter, r* http.Request) {\n\tvar devices []Device\n\terr := ds.collection.Find(nil).All(&devices)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tlist := make([]string, len(devices))\n\n\tfor i, device := range devices {\n\t\tlist[i] = device.DeviceId\n\t}\n\n\tb, _ := json.Marshal(list)\n\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(b)\n}", "title": "" }, { "docid": "4826140c26cb45501089fa421b724b6d", "score": "0.6218732", "text": "func List() (list []EthDev) {\n\tfor p := C.rte_eth_find_next(0); p < C.RTE_MAX_ETHPORTS; p = C.rte_eth_find_next(p + 1) {\n\t\tlist = append(list, FromID(int(p)))\n\t}\n\treturn list\n}", "title": "" }, { "docid": "45027c00df7ce1fc141bd7f1d31c2182", "score": "0.6161962", "text": "func (a *DeviceAPI) ListAll(ctx context.Context, req *empty.Empty) (*pb.ListDeviceResponse, error) {\n\n\tisUser, err := GetIsUser(ctx)\n\tif err != nil || !isUser {\n\t\treturn nil, helpers.ErrToRPCError(err)\n\t}\n\n\tcount, err := storage.GetDeviceCount(storage.DB())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdevices, err := storage.ListDevices(storage.DB(), count, 0)\n\tif err != nil {\n\t\treturn nil, helpers.ErrToRPCError(err)\n\t}\n\n\tresp := &pb.ListDeviceResponse{\n\t\tTotalCount: count,\n\t\tResult: make([]*pb.GetDeviceResponse, len(devices)),\n\t}\n\n\tfor i, d := range devices {\n\t\tdevice := &pb.GetDeviceResponse{\n\t\t\tId: d.ID,\n\t\t\tSerialNumber: d.SerialNumber,\n\t\t\tFirmwareVersion: d.FirmwareVersion,\n\t\t}\n\t\tdevice.RegisteredAt, err = ptypes.TimestampProto(d.RegisteredAt)\n\t\tif err != nil {\n\t\t\treturn nil, helpers.ErrToRPCError(err)\n\t\t}\n\t\tresp.Result[i] = device\n\t}\n\n\treturn resp, nil\n\n}", "title": "" }, { "docid": "2529dd364552da091db24ce31d05b0bb", "score": "0.615042", "text": "func (cu Cuda) GetDeviceList() ([]*Device, error) {\n\n\ty, err := cu.devicecount()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar x []*Device\n\tzero := CInt(0)\n\tfor i := zero; i < y; i++ {\n\t\tvar id C.CUdevice\n\t\terr = newErrorDriver(\"Getting DeviceID\", C.cuDeviceGet(&id, i.c()))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvar major C.int\n\t\tvar minor C.int\n\t\terr = newErrorDriver(\"cuDeviceGetAttribute - major\", C.cuDeviceGetAttribute(&major, C.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, id))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = newErrorDriver(\"cuDeviceGetAttribute - minor\", C.cuDeviceGetAttribute(&minor, C.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, id))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tx = append(x, &Device{id: id, major: int(major), minor: int(minor), idinC: CInt(id)})\n\t}\n\treturn x, nil\n}", "title": "" }, { "docid": "7a1579fe4b0162bd49e25285246b009f", "score": "0.6116566", "text": "func getTablelist() []string {\n\n\tsql := \"select table_name from `tables` where `table_schema`='vsimanage' and `table_type`='base table'\"\n\n\tvar list = []string{}\n\t//DB.BrowseToSource(\"user\",sql,&list)\n\trows, _ := DB.Query(sql)\n\n\tfor rows.Next() {\n\t\tvar table_name string\n\n\t\terr := rows.Scan(&table_name)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tlist = append(list, table_name)\n\t}\n\treturn list\n}", "title": "" }, { "docid": "8a8f46ee664d5e8b678542fbe00ffc85", "score": "0.60627973", "text": "func (s *Session) getDevices() (map[string]Device, error) {\n\tvar (\n\t\tdevicesJSON string\n\t\tdevices = map[string]Device{}\n\t\tdresp DeviceResponse\n\n\t\terr error\n\t)\n\n\tif devicesJSON, err = s.ListDevices(); err != nil {\n\t\treturn nil, fmt.Errorf(\"listing devices: %w\", err)\n\t}\n\n\tif err = json.Unmarshal([]byte(devicesJSON), &dresp); err != nil {\n\t\treturn nil, fmt.Errorf(\"unmarshalling devices: %w\", err)\n\t}\n\n\tfor _, device := range dresp.Data {\n\t\tdevices[device.MAC.String()] = device\n\t}\n\n\treturn devices, nil\n}", "title": "" }, { "docid": "f36accb606df41a3a495ae3d10627f64", "score": "0.6062273", "text": "func List() (list []EthDev) {\n\tfor p := C.rte_eth_find_next(0); p < C.RTE_MAX_ETHPORTS; p = C.rte_eth_find_next(p + 1) {\n\t\tlist = append(list, ethDev(p))\n\t}\n\treturn list\n}", "title": "" }, { "docid": "292c15fbcb521220c144234b22332f23", "score": "0.60303885", "text": "func (db *Db) Devices() (ret []data.Device, err error) {\n\terr = db.store.Find(&ret, nil)\n\treturn\n}", "title": "" }, { "docid": "72f411dfe0422e63000dc79b4ece0eac", "score": "0.6027777", "text": "func (inst *QemuInstance) listBlkDevices() (*QOMBlkDev, error) {\n\tlistcmd := `{ \"execute\": \"query-block\" }`\n\tout, err := inst.runQmpCommand(listcmd)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Running QMP query-block command\")\n\t}\n\n\tvar devs QOMBlkDev\n\tif err = json.Unmarshal(out, &devs); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"De-serializing QMP query-block output\")\n\t}\n\treturn &devs, nil\n}", "title": "" }, { "docid": "2446b6ecb3edcf410d7230bcb2bf9789", "score": "0.5995496", "text": "func (client ComputeClient) listInstanceDevices(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/instances/{instanceId}/devices\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response ListInstanceDevicesResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\tapiReferenceLink := \"https://docs.oracle.com/iaas/api/#/en/iaas/20160918/Device/ListInstanceDevices\"\n\t\terr = common.PostProcessServiceError(err, \"Compute\", \"ListInstanceDevices\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "title": "" }, { "docid": "a18e6514b0d394432cd875312f34a6bc", "score": "0.5981135", "text": "func Devices(ctx context.Context) ([]*Device, error) {\n\toutput, err := Command(ctx, \"devices\", \"-l\").Output(testexec.DumpLogOnError)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to query ADB devices\")\n\t}\n\tvar devices []*Device\n\tfor _, line := range strings.Split(string(output), \"\\n\") {\n\t\tdevice, err := parseDevice(line)\n\t\tif err != nil {\n\t\t\t// Log unexpected errors but continue processing other devices.\n\t\t\tif !errors.Is(err, errSkippedLine) {\n\t\t\t\ttesting.ContextLogf(ctx, \"Failed to parse line %q, got error: %v\", line, err)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tdevices = append(devices, device)\n\t}\n\treturn devices, nil\n}", "title": "" }, { "docid": "07d601727401d16d580825e5d18a32b8", "score": "0.59687626", "text": "func (conn *Connection) Devices() ([]*Device, error) {\n\tdevs := make([]*Device, 0)\n\tnumDevs := C.tdGetNumberOfDevices()\n\n\tfor i := C.int(0); i < numDevs; i++ {\n\t\tdev, err := conn.GetDevice(int(C.tdGetDeviceId(i)))\n\t\tif err != nil {\n\t\t\treturn devs, err\n\t\t}\n\t\tdevs = append(devs, dev)\n\t}\n\n\treturn devs, getError(numDevs)\n}", "title": "" }, { "docid": "3de75aa4e58ae07868adc6f791ba596c", "score": "0.5959249", "text": "func listDevices(volumeGroups ...string) (map[string]*PmemDeviceInfo, error) {\n\targs := append(lvsArgs, volumeGroups...)\n\toutput, err := pmemexec.RunCommand(\"lvs\", args...)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"lvs failure : %v\", err)\n\t}\n\treturn parseLVSOutput(output)\n}", "title": "" }, { "docid": "3de75aa4e58ae07868adc6f791ba596c", "score": "0.5959249", "text": "func listDevices(volumeGroups ...string) (map[string]*PmemDeviceInfo, error) {\n\targs := append(lvsArgs, volumeGroups...)\n\toutput, err := pmemexec.RunCommand(\"lvs\", args...)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"lvs failure : %v\", err)\n\t}\n\treturn parseLVSOutput(output)\n}", "title": "" }, { "docid": "d2c132e36000ba419d8fab978202c70a", "score": "0.5957061", "text": "func (g *generator) GetDeviceList(ctx context.Context) []string {\n\tctx = logcontext.WithLogger(ctx, logcontext.FromContext(ctx).\n\t\tWithField(\"service_method\", \"GetDeviceList\"))\n\tvar output []string\n\tg.deviceListMutex.RLock()\n\tfor s := range g.deviceList {\n\t\toutput = append(output, s)\n\t}\n\tg.deviceListMutex.RUnlock()\n\tlogcontext.FromContext(ctx).Info(\"success\")\n\treturn output\n}", "title": "" }, { "docid": "75866656a13260bcbb2857998e2a97da", "score": "0.5936648", "text": "func (ldh *LogicalDeviceHandler) ListVirtletLogicalDevices() ([]string, error) {\n\ttable, err := ldh.commander.Command(\"dmsetup\", \"table\").Run(nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"dmsetup table: %v\", err)\n\t}\n\tvar r []string\n\tfor _, l := range strings.Split(string(table), \"\\n\") {\n\t\tif l == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tfields := strings.Fields(l)\n\t\tif len(fields) != 6 || fields[3] != \"linear\" {\n\t\t\tcontinue\n\t\t}\n\t\tvirtDevName := fields[0]\n\t\tif strings.HasSuffix(virtDevName, \":\") {\n\t\t\tvirtDevName = virtDevName[:len(virtDevName)-1]\n\t\t}\n\n\t\tdevID := fields[4]\n\t\tueventFile := filepath.Join(ldh.sysfsPath, \"dev/block\", devID, \"uevent\")\n\t\tueventContent, err := ioutil.ReadFile(ueventFile)\n\t\tif err != nil {\n\t\t\tglog.Warningf(\"error reading %q: %v\", ueventFile, err)\n\t\t\tcontinue\n\t\t}\n\t\tdevName := \"\"\n\t\tfor _, ul := range strings.Split(string(ueventContent), \"\\n\") {\n\t\t\tul = strings.TrimSpace(ul)\n\t\t\tif strings.HasPrefix(ul, devnameUeventVar) {\n\t\t\t\tdevName = ul[len(devnameUeventVar):]\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif devName == \"\" {\n\t\t\tglog.Warningf(\"bad uevent file %q: no DEVNAME\", ueventFile)\n\t\t\tcontinue\n\t\t}\n\n\t\tisVbd, err := ldh.deviceHasVirtletHeader(devName)\n\t\tif err != nil {\n\t\t\tglog.Warningf(\"checking device file %q: %v\", devName, err)\n\t\t\tcontinue\n\t\t}\n\n\t\tif isVbd {\n\t\t\tr = append(r, virtDevName)\n\t\t}\n\t}\n\n\treturn r, nil\n}", "title": "" }, { "docid": "e7c504d6c5937f9114133ba6a1efbef3", "score": "0.5925652", "text": "func (c *Client) ListDevices() (ListDevicesOutput, error) {\n\tcontents, err := c.Raw(http.MethodGet, \"/devices.json\", nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar output ListDevicesOutput\n\terr = json.Unmarshal(contents, &output)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn output, nil\n}", "title": "" }, { "docid": "9f55e3c609f692b7934b131617d7bf5f", "score": "0.58776283", "text": "func (ps *PgStore) GetDevices(ctx context.Context, filters device.DeviceFilters) ([]device.DeviceListItem, error) {\n\tif filters.Search != \"\" {\n\t\tfilters.Search = \"%\" + filters.Search + \"%\"\n\t}\n\n\tselectedItems := `d.dev_eui,\n\t\t\td.created_at,\n\t\t\td.updated_at,\n\t\t\td.application_id,\n\t\t\td.device_profile_id,\n\t\t\td.name,\n\t\t\td.description,\n\t\t\td.device_status_battery,\n\t\t\td.device_status_margin,\n\t\t\td.device_status_external_power_source,\n\t\t\td.last_seen_at,\n\t\t\td.latitude,\n\t\t\td.longitude,\n\t\t\td.altitude,\n\t\t\td.dr,\n\t\t\td.variables,\n\t\t\td.tags,\n\t\t\td.dev_addr,\n\t\t\td.app_s_key,\n\t\t\td.provision_id,\n\t\t\td.model,\n\t\t\td.serial_number, \n\t\t\td.manufacturer`\n\tquery, args, err := sqlx.BindNamed(sqlx.DOLLAR, `\n\t\tselect\n\t\t\tdistinct `+selectedItems+`,\n\t\t\tdp.name as device_profile_name\n\t\tfrom\n\t\t\tdevice d\n\t\tinner join device_profile dp\n\t\t\ton dp.device_profile_id = d.device_profile_id\n\t\tinner join application a\n\t\t\ton d.application_id = a.id\n\t\tleft join device_multicast_group dmg\n\t\t\ton d.dev_eui = dmg.dev_eui\n\t\t`+filters.SQL()+`\n\t\torder by\n\t\t\td.name\n\t\tlimit :limit\n\t\toffset :offset\n\t`, filters)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"named query error\")\n\t}\n\n\trows, err := ps.db.QueryContext(ctx, query, args...)\n\tif err != nil {\n\t\treturn nil, handlePSQLError(Select, err, \"select error\")\n\t}\n\tdefer rows.Close()\n\n\tvar devices []device.DeviceListItem\n\tvar provisionID, model, serialNumber, manufacturer sql.NullString\n\n\tfor rows.Next() {\n\t\tvar devItem device.DeviceListItem\n\t\tif err := rows.Scan(\n\t\t\t&devItem.DevEUI,\n\t\t\t&devItem.CreatedAt,\n\t\t\t&devItem.UpdatedAt,\n\t\t\t&devItem.ApplicationID,\n\t\t\t&devItem.DeviceProfileID,\n\t\t\t&devItem.Name,\n\t\t\t&devItem.Description,\n\t\t\t&devItem.DeviceStatusBattery,\n\t\t\t&devItem.DeviceStatusMargin,\n\t\t\t&devItem.DeviceStatusExternalPower,\n\t\t\t&devItem.LastSeenAt,\n\t\t\t&devItem.Latitude,\n\t\t\t&devItem.Longitude,\n\t\t\t&devItem.Altitude,\n\t\t\t&devItem.DR,\n\t\t\t&devItem.Variables,\n\t\t\t&devItem.Tags,\n\t\t\t&devItem.DevAddr,\n\t\t\t&devItem.AppSKey,\n\t\t\t&provisionID,\n\t\t\t&model,\n\t\t\t&serialNumber,\n\t\t\t&manufacturer,\n\t\t\t&devItem.DeviceProfileName); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdevItem.ProvisionID = provisionID.String\n\t\tdevItem.Model = model.String\n\t\tdevItem.SerialNumber = serialNumber.String\n\t\tdevItem.Manufacturer = manufacturer.String\n\t\tdevices = append(devices, devItem)\n\t}\n\n\treturn devices, rows.Err()\n}", "title": "" }, { "docid": "f3c41a5fdd5fff4a9c6dd27c4c1c478a", "score": "0.58545715", "text": "func (c *Controller) ListDevices(ctx context.Context, body *deviceregistrydef.ListDevicesRequest) (*deviceregistrydef.ListDevicesResponse, error) {\n\tvar devices []*devicedef.Header\n\tvar err error\n\n\tif controllerName, set := body.GetControllerName(); set {\n\t\tdevices, err = c.DeviceRepository.FindByController(controllerName)\n\t} else {\n\t\tdevices, err = c.DeviceRepository.FindAll()\n\t}\n\tif err != nil {\n\t\treturn nil, oops.WithMessage(err, \"failed to find devices\")\n\t}\n\n\treturn &deviceregistrydef.ListDevicesResponse{\n\t\tDeviceHeaders: devices,\n\t}, nil\n}", "title": "" }, { "docid": "9ed190459e7c8e87b8a1186e40bdaf66", "score": "0.58145094", "text": "func (c *Client) ListDevices(ctx context.Context) ([]*Device, error) {\n\tvar res []*Device\n\tif _, err := c.call(\n\t\tctx,\n\t\thttp.MethodGet,\n\t\t\"devices\",\n\t\tnil,\n\t\tnil,\n\t\tnil,\n\t\t&res,\n\t); err != nil {\n\t\treturn nil, err\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "4b4654442af05f44c5ee895fa811e984", "score": "0.5807123", "text": "func Devices() ([]Device, error) {\n\td := []Device{}\n\tdbusConn, err := dbus.SessionBus()\n\tif err != nil {\n\t\treturn d, err\n\t}\n\n\tvar s []string\n\terr = dbusConn.Object(\"org.razer\", dbus.ObjectPath(\"/org/razer\")).\n\t\tCall(\"razer.devices.getDevices\", 0).Store(&s)\n\tif err != nil {\n\t\treturn d, err\n\t}\n\n\tfor _, vs := range s {\n\t\td = append(d, Device{\n\t\t\tName: vs,\n\t\t\tdbusObject: dbusConn.Object(\"org.razer\",\n\t\t\t\tdbus.ObjectPath(fmt.Sprintf(\"/org/razer/device/%s\", vs))),\n\t\t})\n\t}\n\n\treturn d, nil\n}", "title": "" }, { "docid": "c5beff8eb010c9e5239437e7ac2194c8", "score": "0.57973874", "text": "func listInfo() ([]*CloudDriverInfo, error) {\n // ex) /cloud-info-spaces/drivers/AWS_driver01-V0.5/AWS [aws-test-driver-v0.5.so]\n\n key := \"/cloud-info-spaces/drivers\"\n keyValueList, err := store.GetList(key, true)\n if err != nil {\n return nil, err\n }\n\n cloudDriverInfoList := make([]*CloudDriverInfo, len(keyValueList))\n for count, kv := range keyValueList {\n drvInfo := &CloudDriverInfo{utils.GetNodeValue(kv.Key, 3), utils.GetNodeValue(kv.Key, 4), kv.Value}\n cloudDriverInfoList[count] = drvInfo\n }\n\n return cloudDriverInfoList, nil\n}", "title": "" }, { "docid": "3750766d99099f85aad2cad568e91c30", "score": "0.57871896", "text": "func (e *etcd) Devices() []config.Device {\n\treturn e.devices\n}", "title": "" }, { "docid": "fbf5441531d6217cc7a453c82e3d51c8", "score": "0.5765714", "text": "func (that *RazberryService) Devices() (map[string]interface{}, error) {\n\treturn that.get(\"/devices\")\n}", "title": "" }, { "docid": "ca03c122a644cb1f167b6c4dfcefa67d", "score": "0.57529885", "text": "func GetAllDevices() (list pb.Devices) {\n\treturn Devices\n}", "title": "" }, { "docid": "9b1483e0baa1f6042ca9cdf743dca857", "score": "0.5746257", "text": "func (s *GoHomeServer) getDevices(writer http.ResponseWriter, request *http.Request) { //nolint: unparam\n\trespond(writer, s.state.GetAllDevices())\n}", "title": "" }, { "docid": "d35b4694f62c5f6e40d73c2861768922", "score": "0.5745723", "text": "func (a SysApi) GetFileDeviceCapabilitiesDbList() (*SysFileDeviceCapabilitiesDbList, error) {\n\n\tvar httpMethod = \"Get\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/file/deviceCapabilitiesDb\"\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysFileDeviceCapabilitiesDbList)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "fbbeeb286ddf76f485f60d5a11dbb893", "score": "0.5722216", "text": "func (c *Controller) ListDevices() []ConnectDevice {\n\tc.devicesLock.RLock()\n\tres := make([]ConnectDevice, 0, len(c.devices))\n\tfor _, device := range c.devices {\n\t\tres = append(res, device)\n\t}\n\tc.devicesLock.RUnlock()\n\n\treturn res\n}", "title": "" }, { "docid": "56681237d4cbfa11324be812f9404f86", "score": "0.57158476", "text": "func getDevices() ([]pcap.Interface, error) {\n\tdevices, err := pcap.Findalldevs()\n\tif err != nil {\n\t\tfmt.Fprintf(errWriter, \"[-] Error, pcap failed to iniaitilize\")\n\t}\n\treturn devices, err\n}", "title": "" }, { "docid": "d0b44aaf38bb84fd71f5861b91858029", "score": "0.57112384", "text": "func (page DeviceListPage) Values() []Device {\n\tif page.dl.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.dl.Value\n}", "title": "" }, { "docid": "72b9efddad7cce0e6020c9ddda09907b", "score": "0.5696626", "text": "func (c *HelloClient) Devices() (result Devices, err error) {\n\terr = c.checkAuthentication()\n\tif err != nil {\n\t\treturn result, err\n\t}\n\n\treq, err := http.NewRequest(http.MethodGet, devicesURL, nil)\n\tif err != nil {\n\t\treturn result, err\n\t}\n\treq.Header.Set(\"Authorization\", \"Bearer \"+c.token.Token)\n\n\tres, err := c.client.Do(req)\n\tif err != nil {\n\t\treturn result, err\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode != http.StatusOK {\n\t\treturn result, fmt.Errorf(\"unexpected status code: %d\", res.StatusCode)\n\t}\n\n\terr = json.NewDecoder(res.Body).Decode(&result)\n\tif err != nil {\n\t\treturn result, err\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "96021c90bbc90aa74d25ba577c9cf104", "score": "0.5670323", "text": "func (s *DeviceService) Devices() []models.Device {\n\treturn cache.Devices().All()\n}", "title": "" }, { "docid": "7cac5861b830a8456cd996e27c3c95a6", "score": "0.56699866", "text": "func AllDevices() []string {\n\treturn []string{Admin, Android, IOS, Web, Windows}\n}", "title": "" }, { "docid": "e79a5d829c6b6d0aed51436a6176dd7b", "score": "0.56648374", "text": "func (d *DeviceRestClient) DevicesByLabel(label string, ctx context.Context) ([]models.Device, error) {\n\treturn d.requestDeviceSlice(d.url+\"/label/\"+url.QueryEscape(label), ctx)\n}", "title": "" }, { "docid": "01bf05beab7e7c38111146f930e0d5f6", "score": "0.56595486", "text": "func NewCmdDeviceList(cl *libcmdline.CommandLine, g *libkb.GlobalContext) cli.Command {\n\treturn cli.Command{\n\t\tName: \"list\",\n\t\tUsage: \"List devices\",\n\t\tAction: func(c *cli.Context) {\n\t\t\tcl.ChooseCommand(&CmdDeviceList{Contextified: libkb.NewContextified(g)}, \"list\", c)\n\t\t},\n\t}\n}", "title": "" }, { "docid": "1ce5dd1d711b6896032e6bb25bdb7c45", "score": "0.56116974", "text": "func FindAll(vendor, product int) ([]*USBDev, error) {\n\tif e := C.libusb_init(nil); e != 0 {\n\t\treturn nil, USBError(e)\n\t}\n\tvar dptr **C.struct_libusb_device\n\tif e := C.libusb_get_device_list(nil, &dptr); e < 0 {\n\t\treturn nil, USBError(e)\n\t}\n\tdefer C.libusb_free_device_list(dptr, 1)\n\tdevs := (*[1 << 28]*C.libusb_device)(unsafe.Pointer(dptr))\n\n\tvar n int\n\tfor i, dev := range devs[:] {\n\t\tif dev == nil {\n\t\t\tn = i\n\t\t\tbreak\n\t\t}\n\t}\n\tdescr := make([]*C.struct_libusb_device_descriptor, n)\n\tfor i, dev := range devs[:n] {\n\t\tvar ds C.struct_libusb_device_descriptor\n\t\tif e := C.libusb_get_device_descriptor(dev, &ds); e < 0 {\n\t\t\treturn nil, USBError(e)\n\t\t}\n\t\tif int(ds.idVendor) == vendor && int(ds.idProduct) == product {\n\t\t\tdescr[i] = &ds\n\t\t\tcontinue\n\t\t}\n\t\tif vendor == 0 && product == 0 && ds.idVendor == 0x403 {\n\t\t\tswitch ds.idProduct {\n\t\t\tcase 0x6001, 0x6010, 0x6011, 0x6014, 0x6015:\n\t\t\t\tdescr[i] = &ds\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tn--\n\t}\n\tif n == 0 {\n\t\treturn nil, nil\n\t}\n\tret := make([]*USBDev, n)\n\tn = 0\n\tfor i, ds := range descr {\n\t\tif ds == nil {\n\t\t\tcontinue\n\t\t}\n\t\tu := new(USBDev)\n\t\tu.d = devs[i]\n\t\tC.libusb_ref_device(u.d)\n\t\truntime.SetFinalizer(u, (*USBDev).unref)\n\t\tif err := u.getStrings(u.d, ds); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tret[n] = u\n\t\tn++\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "0c76cb3c2554cb4afbdea312d5767386", "score": "0.56035876", "text": "func GetAdapters() ([]*HcitoolDev, error) {\n\n\tlist := make([]*HcitoolDev, 0)\n\traw, err := cmd.Exec(\"hcitool\", \"dev\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// raw:\n\t// Devices:\n\t// \thci1\t70:C9:4E:58:AA:7E\n\n\tlines := strings.Split(raw, \"\\n\")\n\tlines = lines[1:]\n\n\t// \thci1\t70:C9:4E:58:AA:7E\n\tre1 := regexp.MustCompile(\"^[ \\t]*([a-zA-Z0-9]+)[ \\t]*([a-zA-Z0-9:]+)$\")\n\n\tfor i := 0; i < len(lines); i++ {\n\n\t\tif !re1.MatchString(lines[i]) {\n\t\t\tcontinue\n\t\t}\n\n\t\tel := new(HcitoolDev)\n\n\t\tres := re1.FindStringSubmatch(lines[i])\n\t\tif len(res) > 1 {\n\t\t\tel.ID = res[1]\n\t\t\tel.Address = res[2]\n\t\t\tlist = append(list, el)\n\t\t}\n\n\t}\n\n\treturn list, nil\n}", "title": "" }, { "docid": "cf03586d48ab946f9aa0fad9615cfdcd", "score": "0.5590477", "text": "func ReadDeviceTraitsDB() ([]Device, error) {\n\tvar allDevices []Device\n\n\tfor _, osType := range []string{\"iPhoneOS\", \"AppleTVOS\", \"WatchOS\"} {\n\t\tfor _, releaseType := range []string{\"\", \"-beta\"} {\n\t\t\tdbFile := fmt.Sprintf(\"/Applications/Xcode%s.app/Contents/Developer/Platforms/%s.platform/usr/standalone/device_traits.db\", releaseType, osType)\n\t\t\tif _, err := os.Stat(dbFile); err == nil {\n\t\t\t\tdb, err := gorm.Open(sqlite.Open(dbFile), &gorm.Config{})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, errors.Wrapf(err, \"unable to open database: %s\", dbFile)\n\t\t\t\t}\n\n\t\t\t\tvar devices []Device\n\t\t\t\tdb.Preload(\"DeviceTrait\").Find(&devices)\n\n\t\t\t\tallDevices = append(allDevices, devices...)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn uniqueDevices(allDevices), nil\n}", "title": "" }, { "docid": "3a004ed6bcecf31e95cf88e6146b1210", "score": "0.5587858", "text": "func (env *Env) GetAllDevices(w http.ResponseWriter, r *http.Request) {\n\tisAdmin := userIsAuthorized(r, noUser)\n\tif !isAdmin {\n\t\thttp.Error(w, errForbidden, http.StatusForbidden)\n\t\treturn\n\t}\n\n\tresponse, err := env.DB.GetAllDevices()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\terr = writeResponse(w, r.FormValue(\"out\"), response)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "7afadfbb6a20eb95458ccc494b19694b", "score": "0.5567916", "text": "func ListInterface() []string {\n\tret := make([]string, len(configs))\n\tfor i, config := range configs {\n\t\tret[i] = config.DeviceName\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "84f3660cec012b49f16d173fcb93e742", "score": "0.5567011", "text": "func ListFilecoinDevices(path []uint32) {\n\tledgerAdmin := ledger_go.NewLedgerAdmin()\n\tfor i := int(0); i < ledgerAdmin.CountDevices(); i += 1 {\n\t\tledgerDevice, err := ledgerAdmin.Connect(i)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tdefer ledgerDevice.Close()\n\n\t\tapp := LedgerFilecoin{ledgerDevice, VersionInfo{}}\n\t\tdefer app.Close()\n\n\t\tappVersion, err := app.GetVersion()\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\t_, _, addrString, err := app.GetAddressPubKeySECP256K1(path)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tfmt.Printf(\"============ Device found\\n\")\n\t\tfmt.Printf(\"Filecoin App Version : %x\\n\", appVersion)\n\t\tfmt.Printf(\"Filecoin App Address : %s\\n\", addrString)\n\t}\n}", "title": "" }, { "docid": "b895d59dd798cc6255040f22a0acff04", "score": "0.5565957", "text": "func (mc *ThingController) ListDevices(authorization, replyTo, corrID string) error {\n\tmc.logger.Info(\"list devices command received\")\n\tthings, err := mc.thingInteractor.List(authorization)\n\tif err != nil {\n\t\tsendErr := mc.sender.SendListResponse(things, replyTo, corrID, err)\n\t\tif sendErr != nil {\n\t\t\treturn fmt.Errorf(\"error sending response: %v: %w\", err, sendErr)\n\t\t}\n\t\treturn err\n\t}\n\n\tsendErr := mc.sender.SendListResponse(things, replyTo, corrID, err)\n\tif sendErr != nil {\n\t\treturn fmt.Errorf(\"error sending response: %v: %w\", err, sendErr)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2b91d4510ae5cef0bed2aea693f97f88", "score": "0.55636394", "text": "func GetTable(ip string, communit string, oids []string) (tableRows map[string](map[string]g.SnmpPDU), e error) {\n\ts := NewSNMP(ip, communit)\n\terr := s.Connect()\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer s.Conn.Close()\n\n\ttableRows = make(map[string](map[string]g.SnmpPDU))\n\tfor _, oid := range oids {\n\t\trows, e := s.BulkWalkAll(oid)\n\t\tif e != nil {\n\t\t\treturn tableRows, e\n\t\t}\n\t\tfor _, row := range rows {\n\t\t\tindex := row.Name[(len(oid) + 1):]\n\t\t\tr := tableRows[index]\n\t\t\tif r == nil {\n\t\t\t\tr = make(map[string]g.SnmpPDU)\n\t\t\t}\n\t\t\tr[oid] = row\n\t\t\ttableRows[index] = r\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "40d3397feba1bc250b33b855a379ae84", "score": "0.5551717", "text": "func SearchDeviceListHandler(ctx *macaron.Context) {\n\tvar listings []PluginDeviceListing\n\tfor _, plugin := range plugin.GetLoadedPlugins() {\n\t\tpluginDevices := plugin.Plugin.GetAvailableDevices()\n\t\tif len(pluginDevices) > 0 {\n\t\t\tvar devices []AvailableDevice\n\t\t\tfor _, d := range pluginDevices {\n\t\t\t\tif !models.HasPluginDevice(plugin.Manifest.Id, d.UniqueID) {\n\t\t\t\t\tdevices = append(devices, AvailableDevice{Device: d, PluginID: plugin.Manifest.Id})\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlistings = append(listings, PluginDeviceListing{\n\t\t\t\tPluginName: plugin.Manifest.Name,\n\t\t\t\tDevices: devices,\n\t\t\t})\n\t\t}\n\t}\n\tctx.Data[\"Listings\"] = listings\n\tctx.HTML(http.StatusOK, \"search_device_list\")\n}", "title": "" }, { "docid": "1aa17cd03c39b975f7fad63256d6bf2a", "score": "0.5543771", "text": "func ioctlTable(cmd uintptr, name string, uuid string, flags uint32, primaryUdevEvent bool, tables []Table) error {\n\tconst (\n\t\t// allocate buffer large enough for dmioctl + specs\n\t\talignment = 8\n\n\t\tDM_UDEV_FLAGS_SHIFT = 16\n\t\t// Quoting https://fossies.org/linux/LVM2/libdm/libdevmapper.h\n\t\t//\n\t\t// DM_UDEV_PRIMARY_SOURCE_FLAG is automatically appended by\n\t\t// libdevmapper for all ioctls generating udev uevents. Once used in\n\t\t// udev rules, we know if this is a real \"primary sourced\" event or not.\n\t\t// We need to distinguish real events originated in libdevmapper from\n\t\t// any spurious events to gather all missing information (e.g. events\n\t\t// generated as a result of \"udevadm trigger\" command or as a result\n\t\t// of the \"watch\" udev rule).\n\t\tDM_UDEV_PRIMARY_SOURCE_FLAG = 0x0040\n\t)\n\n\tvar udevFlags uint32\n\tif primaryUdevEvent {\n\t\t// device mapper has a complex initialization sequence. A device need to be 1) created\n\t\t// 2) load table 3) resumed. The device is usable at the 3rd step only.\n\t\t// To make udev rules handle the device at 3rd step (rather than at ADD event), device mapper distinguishes\n\t\t// the \"primary\" events with a udev flag set below.\n\t\t// Only RESUME, REMOVE, RENAME operations are considered primary events.\n\t\tudevFlags = DM_UDEV_PRIMARY_SOURCE_FLAG << DM_UDEV_FLAGS_SHIFT\n\t}\n\n\tspecs := make([]string, 0, len(tables)) // cached specs\n\n\tlength := unix.SizeofDmIoctl\n\tfor _, t := range tables {\n\t\tlength += unix.SizeofDmTargetSpec\n\t\tspec := t.buildSpec()\n\t\tspecs = append(specs, spec)\n\n\t\tlength += roundUp(len(spec)+1, alignment) // adding 1 for terminating NUL, then align the data\n\t}\n\n\tdata := make([]byte, length)\n\tvar idx uintptr\n\tioctlData := (*unix.DmIoctl)(unsafe.Pointer(&data[0]))\n\tioctlData.Version = [...]uint32{4, 0, 0} // minimum required version\n\tcopy(ioctlData.Name[:], name)\n\tcopy(ioctlData.Uuid[:], uuid)\n\tioctlData.Data_size = uint32(length)\n\tioctlData.Data_start = unix.SizeofDmIoctl\n\tioctlData.Target_count = uint32(len(tables))\n\tioctlData.Flags = flags\n\tioctlData.Event_nr = udevFlags\n\tidx += unix.SizeofDmIoctl\n\n\tfor i, t := range tables {\n\t\tspec := specs[i]\n\n\t\tspecData := (*unix.DmTargetSpec)(unsafe.Pointer(&data[idx]))\n\t\tspecSize := unix.SizeofDmTargetSpec + uintptr(roundUp(len(spec)+1, alignment))\n\t\tspecData.Next = uint32(specSize)\n\t\tspecData.Sector_start = t.startSector()\n\t\tspecData.Length = t.length()\n\t\tcopy(specData.Target_type[:], t.targetType())\n\t\tcopy(data[idx+unix.SizeofDmTargetSpec:], spec)\n\n\t\tidx += specSize\n\t}\n\n\treturn ioctl(cmd, data)\n}", "title": "" }, { "docid": "429d2003b45cebae35ae698b9ab9df88", "score": "0.553865", "text": "func (c *Client) Devices() ([]*Device, error) {\n\treq := c.buildRequest(\"/devices\", nil)\n\tresp, err := c.Client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\tvar errjson errorResponse\n\t\tdec := json.NewDecoder(resp.Body)\n\t\terr = dec.Decode(&errjson)\n\t\tif err == nil {\n\t\t\treturn nil, &errjson.ErrResponse\n\t\t}\n\n\t\treturn nil, errors.New(resp.Status)\n\t}\n\n\tvar devResp deviceResponse\n\tdec := json.NewDecoder(resp.Body)\n\terr = dec.Decode(&devResp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdevices := append(devResp.Devices, devResp.SharedDevices...)\n\treturn devices, nil\n}", "title": "" }, { "docid": "b7beffdacd992717218700b2e05a8c28", "score": "0.55380565", "text": "func (m *MemDb) Tables() []string { return []string{m.tbl.Name} }", "title": "" }, { "docid": "38af5542ab0e7c473d609ffe9f071e11", "score": "0.55366325", "text": "func listScsiDevices(dirName string) ([]string, error) {\n\n\tvar scsiList []string\n\tsysPathStats, err := ioutil.ReadDir(dirName)\n\tif err != nil {\n\t\treturn scsiList, err\n\t}\n\n\tfor _, dir := range sysPathStats {\n\n\t\tdvre := regexp.MustCompile(`^[0-9]:.?:.?:.?`)\n\t\tdirName := dir.Name()\n\t\tif dvre.MatchString(dirName) {\n\t\t\tscsiList = append(scsiList, dirName)\n\t\t}\n\t}\n\treturn scsiList, nil\n}", "title": "" }, { "docid": "e89bcf3850602827d13a10cb89e26202", "score": "0.55312645", "text": "func (dm *DeviceManager) ListDevices() ([]Device, error) {\n\t// Ensure root permissions\n\troot := new(Root)\n\terr := root.Ensure()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"can't list devices\")\n\t}\n\n\t// Read all items in the directory\n\tinputs, err := ioutil.ReadDir(\"/sys/class/input\")\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"can't read directory with input devices\")\n\t}\n\n\t// Filter event devices\n\tvar filtered []Device\n\tfor _, input := range inputs {\n\t\tdeviceID := input.Name()\n\n\t\tif !eventDevice.MatchString(deviceID) {\n\t\t\tcontinue\n\t\t}\n\n\t\teventPath := filepath.Join(\"/dev/input\", deviceID)\n\t\t_, err := os.Stat(eventPath)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"can't read input directory\")\n\t\t}\n\n\t\tdn, err := ioutil.ReadFile(filepath.Join(\"/sys/class/input\", deviceID, \"device/name\"))\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"can't read device name\")\n\t\t}\n\t\tdeviceName := strings.TrimSpace(string(dn))\n\n\t\tfiltered = append(filtered, Device{Name: deviceName, ID: deviceID, EventPath: eventPath})\n\t}\n\treturn filtered, nil\n}", "title": "" }, { "docid": "9ca31aae09b40dfb9d677922bc1db4e0", "score": "0.5530102", "text": "func Devices() ([]Device, error) {\n\tnm, err := System()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn nm.Devices()\n}", "title": "" }, { "docid": "1e32de41f95e64cc6e7ea62a6a204866", "score": "0.5527287", "text": "func (c *keysClient) Devices() ([]string, error) {\n\tvar devices []string\n\n\tresp, err := c.MakeRequest(\"/list\", nil)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\terr = parseJSON(resp, &devices)\n\n\treturn devices, err\n}", "title": "" }, { "docid": "e4a3acdfb1f21c03b648bbd371b662dd", "score": "0.5519685", "text": "func DeviceInfos() []DeviceInfo {\n\tdeviceInfosFiltered := []DeviceInfo{}\n\n\tvar result funcCallResult[[]hid.DeviceInfo]\n\tch := make(chan funcCallResult[[]hid.DeviceInfo])\n\tif runtime.GOOS == darwin {\n\t\tfuncCalls <- func() {\n\t\t\tdi, err := hid.EnumerateHid(0, 0)\n\t\t\tch <- funcCallResult[[]hid.DeviceInfo]{di, err}\n\t\t}\n\t\tresult = <-ch\n\t} else {\n\t\tdi, err := hid.EnumerateHid(0, 0)\n\t\tresult = funcCallResult[[]hid.DeviceInfo]{di, err}\n\t}\n\t// The library never actually returns an error in this functions.\n\tif result.err != nil {\n\t\tlogging.Get().WithError(result.err).Error(\"EnumerateHid() returned an error\")\n\t\treturn deviceInfosFiltered\n\t}\n\n\tfor idx := range result.value {\n\t\tdi := hidDeviceInfo{result.value[idx]}\n\t\t// If Enumerate() is called too quickly after a device is inserted, the HID device input\n\t\t// report is not yet ready.\n\t\tif di.Serial() == \"\" || di.Product() == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tif isBitBox(di) || isBitBox02(di) || isBitBox02Bootloader(di) {\n\t\t\tdeviceInfosFiltered = append(deviceInfosFiltered, di)\n\t\t}\n\t}\n\treturn deviceInfosFiltered\n}", "title": "" }, { "docid": "eb58026a9db6f3c7f7e5f08accef64ba", "score": "0.55183536", "text": "func (c *Client) GetDeviceList(accessToken string, roomID int64) (*Client, error) {\n\turl := fmt.Sprintf(\"%s%s%d\", selectDevicebyRoomURL, \"?roomId=\", roomID)\n\treq, err := http.NewRequest(\"POST\", url, nil)\n\tif err != nil {\n\t\tlog.Error(fmt.Errorf(\"Can't get device list, error: \", err))\n\t\t// handle err\n\t}\n\treq.Header.Set(\"Accept\", \"*/*\")\n\treq.Header.Set(\"Access_token\", accessToken)\n\n\tresp, err := http.DefaultClient.Do(req)\n\tprocessHTTPResponse(resp, err, c)\n\treturn c, nil\n}", "title": "" }, { "docid": "05d33bf6b622292226013676d4bea5a6", "score": "0.5511257", "text": "func (o *OS) List() ([]string, error) {\n\treturn o.ring.Keys()\n}", "title": "" }, { "docid": "abdfcf3ef070709bbdbc09579bff82b1", "score": "0.550169", "text": "func (a *DeviceAPI) List(ctx context.Context, req *pb.ListDeviceRequest) (*pb.ListDeviceResponse, error) {\n\tvar err error\n\tvar idFilter bool\n\n\tfilters := storage.DeviceFilters{\n\t\tApplicationID: req.ApplicationId,\n\t\tSearch: req.Search,\n\t\tTags: hstore.Hstore{\n\t\t\tMap: make(map[string]sql.NullString),\n\t\t},\n\t\tLimit: int(req.Limit),\n\t\tOffset: int(req.Offset),\n\t}\n\n\tif req.MulticastGroupId != \"\" {\n\t\tfilters.MulticastGroupID, err = uuid.FromString(req.MulticastGroupId)\n\t\tif err != nil {\n\t\t\treturn nil, helpers.ErrToRPCError(err)\n\t\t}\n\t}\n\n\tif req.ServiceProfileId != \"\" {\n\t\tfilters.ServiceProfileID, err = uuid.FromString(req.ServiceProfileId)\n\t\tif err != nil {\n\t\t\treturn nil, helpers.ErrToRPCError(err)\n\t\t}\n\t}\n\n\tfor k, v := range req.Tags {\n\t\tfilters.Tags.Map[k] = sql.NullString{String: v, Valid: true}\n\t}\n\n\tif filters.ApplicationID != 0 {\n\t\tidFilter = true\n\n\t\t// validate that the client has access to the given application\n\t\tif err := a.validator.Validate(ctx,\n\t\t\tauth.ValidateApplicationAccess(req.ApplicationId, auth.Read),\n\t\t); err != nil {\n\t\t\treturn nil, grpc.Errorf(codes.Unauthenticated, \"authentication failed: %s\", err)\n\t\t}\n\n\t}\n\n\tif filters.MulticastGroupID != uuid.Nil {\n\t\tidFilter = true\n\n\t\t// validate that the client has access to the given multicast-group\n\t\tif err := a.validator.Validate(ctx,\n\t\t\tauth.ValidateMulticastGroupAccess(auth.Read, filters.MulticastGroupID),\n\t\t); err != nil {\n\t\t\treturn nil, grpc.Errorf(codes.Unauthenticated, \"authentication failed: %s\", err)\n\t\t}\n\t}\n\n\tif filters.ServiceProfileID != uuid.Nil {\n\t\tidFilter = true\n\n\t\t// validate that the client has access to the given service-profile\n\t\tif err := a.validator.Validate(ctx,\n\t\t\tauth.ValidateServiceProfileAccess(auth.Read, filters.ServiceProfileID),\n\t\t); err != nil {\n\t\t\treturn nil, grpc.Errorf(codes.Unauthenticated, \"authentication failed: %s\", err)\n\t\t}\n\t}\n\n\tif !idFilter {\n\t\tuser, err := a.validator.GetUser(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, helpers.ErrToRPCError(err)\n\t\t}\n\n\t\tif !user.IsAdmin {\n\t\t\treturn nil, grpc.Errorf(codes.Unauthenticated, \"client must be global admin for unfiltered request\")\n\t\t}\n\t}\n\n\tcount, err := storage.GetDeviceCount(ctx, storage.DB(), filters)\n\tif err != nil {\n\t\treturn nil, helpers.ErrToRPCError(err)\n\t}\n\n\tdevices, err := storage.GetDevices(ctx, storage.DB(), filters)\n\tif err != nil {\n\t\treturn nil, helpers.ErrToRPCError(err)\n\t}\n\n\treturn a.returnList(count, devices)\n}", "title": "" }, { "docid": "2a4c36430ccb901770d757153253ff68", "score": "0.55013686", "text": "func (m *DevicePluginManager) ListAndWatch(ex *comtypes.ExtendedResource) ([]*pluginapi.Device, error) {\n\t//connect grpc socket\n\tconn, err := m.dial(ex.Socket, 5*time.Second)\n\tif err != nil {\n\t\tblog.Errorf(\"connect extended resource %s socket %s failed: %s\", ex.Name, ex.Socket, err.Error())\n\t\treturn nil, err\n\t}\n\tdefer conn.Close()\n\n\tclient := pluginapi.NewDevicePluginClient(conn)\n\tlistAndWatchClient, err := client.ListAndWatch(context.Background(), &pluginapi.Empty{})\n\tif err != nil {\n\t\tblog.Errorf(\"extended resource %s ListAndWatch failed: %s\", ex.Name, err.Error())\n\t\treturn nil, err\n\t}\n\tresponse, err := listAndWatchClient.Recv()\n\tif err != nil {\n\t\tblog.Errorf(\"extended resource %s ListAndWatch receive message failed: %s\", ex.Name, err.Error())\n\t\treturn nil, err\n\t}\n\tblog.Infof(\"extended resource %s ListAndWatch success, devices(%s)\", ex.Name, response.Devices)\n\treturn response.Devices, nil\n}", "title": "" }, { "docid": "aea1537b6d402302c4723ec3d6d26d31", "score": "0.5497486", "text": "func Devices() <-chan DeviceInfo {\n\tresult := make(chan DeviceInfo)\n\tgo func() {\n\t\tfor d := range hid.Devices() {\n\t\t\tdi := toLedDeviceInfo(d)\n\t\t\tif di != nil {\n\t\t\t\tresult <- di\n\t\t\t}\n\t\t}\n\t\tclose(result)\n\t}()\n\treturn result\n}", "title": "" }, { "docid": "25468868a39cf69a4f38f80f7f96a16e", "score": "0.5496148", "text": "func (*ListDevicesResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha2_device_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "75bf46b3f6cb9ab3d3093410e73c731f", "score": "0.54884046", "text": "func (c *Client) Devices() ([]*Device, error) {\n\treq := c.buildRequest(\"/devices\", nil)\n\tresp, err := c.Client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\tvar errjson errorResponse\n\t\tdec := json.NewDecoder(resp.Body)\n\t\terr = dec.Decode(&errjson)\n\t\tif err == nil {\n\t\t\treturn nil, &errjson.ErrResponse\n\t\t}\n\n\t\treturn nil, errors.New(resp.Status)\n\t}\n\n\tvar devResp deviceResponse\n\tdec := json.NewDecoder(resp.Body)\n\terr = dec.Decode(&devResp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor i := range devResp.Devices {\n\t\tdevResp.Devices[i].Client = c\n\t}\n\tdevices := append(devResp.Devices, devResp.SharedDevices...)\n\treturn devices, nil\n}", "title": "" }, { "docid": "a85c1bfe26539cefff74b4a365e749d0", "score": "0.5478591", "text": "func DeviceListHandler(\n\tparams wireguard.DeviceListParams,\n\tprincipal interface{},\n) middleware.Responder {\n\tdevices, err := GetDevices()\n\tif err != nil {\n\t\twgrest.Logger.Println(err.Error())\n\n\t\treturn wireguard.NewDeviceListDefault(http.StatusInternalServerError).WithPayload(\n\t\t\t&models.Error{Detail: err.Error()},\n\t\t)\n\t}\n\n\tlist := wireguard.NewDeviceListOK().WithPayload(devices)\n\treturn list\n}", "title": "" }, { "docid": "7cc188e0d142391d0165f2d68faffae7", "score": "0.5476274", "text": "func (d *DeviceRestClient) requestDeviceSlice(url string, ctx context.Context) ([]models.Device, error) {\n\tdata, err := clients.GetRequest(url, ctx)\n\tif err != nil {\n\t\treturn []models.Device{}, err\n\t}\n\n\tdSlice := make([]models.Device, 0)\n\terr = json.Unmarshal(data, &dSlice)\n\treturn dSlice, err\n}", "title": "" }, { "docid": "203ff72b60c5f7b2736163dc7b47503e", "score": "0.5457762", "text": "func (a *Client) GetDevices() ([]Device, error) {\n\tif !a.hasLoggedIn() {\n\t\treturn nil, ErrNotLoggedIn\n\t}\n\n\ttype deviceResponse struct {\n\t\tDevices []Device `json:\"data\"`\n\t\tSuccess bool `json:\"success\"`\n\t}\n\n\tts := time.Now().UnixNano() / (int64(time.Millisecond) / int64(time.Nanosecond))\n\n\treq, err := http.NewRequest(\"GET\", baseURL+fmt.Sprintf(\"/hmsweb/users/devices?t=%d\", ts), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ta.applyCommonHeaders(req)\n\n\tresp, err := a.HTTPClient.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\tswitch resp.StatusCode {\n\t\tcase http.StatusUnauthorized:\n\t\t\treturn nil, ErrRequestUnauthorized\n\t\tdefault:\n\t\t\ta.verbose(\"Status code:\", resp.StatusCode)\n\t\t\treturn nil, ErrRequestFailedStatusNotOK\n\t\t}\n\t}\n\n\trespBody := deviceResponse{}\n\terr = json.NewDecoder(resp.Body).Decode(&respBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !respBody.Success {\n\t\treturn nil, ErrRequestUnsuccessful\n\t}\n\n\ta.Devices = respBody.Devices\n\n\treturn respBody.Devices, nil\n}", "title": "" }, { "docid": "627733fbfa329e50788a7c7ff2f2dcbd", "score": "0.5440304", "text": "func ListDeviceTypes(xcodePath string) ([]*DeviceType, error) {\n\tcmd := exec.Command(\"xcrun\", \"simctl\", \"list\", \"devicetypes\", \"--json\")\n\tcmd.Env = append(cmd.Env, fmt.Sprintf(\"DEVELOPER_DIR=%s\", xcodePath))\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"running simctl list: %w\", err)\n\t}\n\n\treturn parseDeviceTypesOutput(output)\n}", "title": "" }, { "docid": "dfc1af05805680f6646bdec1f3f82af5", "score": "0.5427006", "text": "func (*ListDevicesRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha2_device_service_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "d57a4da18b70cef45fb0ad0244b41ad5", "score": "0.5417257", "text": "func (db *DB) List(table jdh.Table, args *jdh.Values) (jdh.ListScanner, error) {\n\tif db.isClosed {\n\t\treturn nil, errors.New(\"database already closed\")\n\t}\n\tif args == nil {\n\t\treturn nil, errors.New(\"empty argument list\")\n\t}\n\tswitch table {\n\tcase jdh.Taxonomy:\n\t\treturn db.taxonList(args.KV)\n\t}\n\treturn nil, errors.New(\"list not implemented for table \" + string(table))\n}", "title": "" }, { "docid": "18e29744bd4c061eb2beace8eeaba3d3", "score": "0.5407861", "text": "func (p AVFoundation) Devices() ([]input.Device, error) {\n\tcmd := exec.Command(\n\t\t\"ffmpeg\", \"-hide_banner\", \"-loglevel\", \"info\",\n\t\t\"-f\", \"avfoundation\", \"-list_devices\", \"true\",\n\t\t\"-i\", \"\",\n\t)\n\n\to, _ := cmd.CombinedOutput()\n\n\tvar audio bool\n\tvar devices []input.Device\n\n\tvar scanner = bufio.NewScanner(bytes.NewReader(o))\n\tfor scanner.Scan() {\n\t\ttext := scanner.Text()\n\n\t\t// Trim away the prefix.\n\t\tif strings.HasPrefix(text, \"[AVFoundation\") {\n\t\t\tparts := strings.SplitN(text, \"] \", 2)\n\t\t\tif len(parts) == 2 {\n\t\t\t\ttext = parts[1]\n\t\t\t}\n\t\t}\n\n\t\t// If we're starting the audio devices section, then mark the boolean to\n\t\t// scan.\n\t\tif text == \"AVFoundation audio devices:\" {\n\t\t\taudio = true\n\t\t\tcontinue\n\t\t}\n\n\t\t// If we're not scanning a device (which starts with a square bracket)\n\t\t// anymore, then we stop.\n\t\tif !strings.HasPrefix(text, \"[\") {\n\t\t\taudio = false\n\t\t\tcontinue\n\t\t}\n\n\t\t// If we're not under the audio section yet, then skip.\n\t\tif !audio {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Parse.\n\t\tparts := strings.SplitN(text, \" \", 2)\n\t\tif len(parts) != 2 {\n\t\t\tcontinue\n\t\t}\n\n\t\tn, err := strconv.Atoi(strings.Trim(parts[0], \"[]\"))\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"failed to parse device index\")\n\t\t}\n\n\t\tdevices = append(devices, AVFoundationDevice{\n\t\t\tIndex: n,\n\t\t\tName: parts[1],\n\t\t})\n\t}\n\n\tif len(devices) == 0 {\n\t\t// This is completely for visual.\n\t\tvar lines = strings.Split(string(o), \"\\n\")\n\t\tfor i, line := range lines {\n\t\t\tlines[i] = \"\\t\" + line\n\t\t}\n\t\tvar output = strings.Join(lines, \"\\n\")\n\n\t\treturn nil, fmt.Errorf(\"no devices found; ffmpeg output:\\n%s\", output)\n\t}\n\n\treturn devices, nil\n}", "title": "" }, { "docid": "3fe4434aeb086fdde7765f3f24bc2cc2", "score": "0.5404628", "text": "func AllDevices() ([]Device, error) {\n\tnm, err := System()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn nm.AllDevices()\n}", "title": "" }, { "docid": "47733b364539191c007bb74cd7796ade", "score": "0.5399438", "text": "func (ec *Client)GetDataDevice()(ids []string,err error){\n\tgrsp,err :=ec.Get(\"data/\",clientv3.WithPrefix())\n\tids = make([]string,0)\n\tfor _,v:=range grsp.Kvs{\n\t\tids=append(ids,string(v.Value))\n\t}\n\treturn\n}", "title": "" }, { "docid": "4215b9b360ad2d40cebfce2f06fa8fcd", "score": "0.5391342", "text": "func (dbc *DatabaseCfg) GetSnmpDeviceCfgArray(filter string) ([]*SnmpDeviceCfg, error) {\n\tvar err error\n\tvar devices []*SnmpDeviceCfg\n\t//Get Only data for selected devices\n\tif len(filter) > 0 {\n\t\tif err = dbc.x.Where(filter).Find(&devices); err != nil {\n\t\t\tlog.Warnf(\"Fail to get SnmpDevicesCfg data filteter with %s : %v\\n\", filter, err)\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tif err = dbc.x.Find(&devices); err != nil {\n\t\t\tlog.Warnf(\"Fail to get SnmpDevicesCfg data: %v\\n\", err)\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t//Asign Groups to devices.\n\tvar snmpdevmgroups []*SnmpDevMGroups\n\tif err = dbc.x.Find(&snmpdevmgroups); err != nil {\n\t\tlog.Warnf(\"Fail to get SnmpDevices and Measurement groups relationship data: %v\\n\", err)\n\t\treturn devices, err\n\t}\n\n\t//Load Measurements and metrics relationship\n\t//We asign field metric ID to each measurement\n\tfor _, mVal := range devices {\n\t\tfor _, mg := range snmpdevmgroups {\n\t\t\tif mg.IDSnmpDev == mVal.ID {\n\t\t\t\tmVal.MeasurementGroups = append(mVal.MeasurementGroups, mg.IDMGroupCfg)\n\t\t\t}\n\t\t}\n\t}\n\n\t//Asign Filters to devices.\n\tvar snmpdevfilters []*SnmpDevFilters\n\tif err = dbc.x.Find(&snmpdevfilters); err != nil {\n\t\tlog.Warnf(\"Fail to get SnmpDevices and Filter relationship data: %v\\n\", err)\n\t\treturn devices, err\n\t}\n\n\t//Load Measurements and metrics relationship\n\t//We asign field metric ID to each measurement\n\tfor _, mVal := range devices {\n\t\tfor _, mf := range snmpdevfilters {\n\t\t\tif mf.IDSnmpDev == mVal.ID {\n\t\t\t\tmVal.MeasFilters = append(mVal.MeasFilters, mf.IDFilter)\n\t\t\t}\n\t\t}\n\t}\n\treturn devices, nil\n}", "title": "" }, { "docid": "9c9b83001452a0b170ae1758639e5b2c", "score": "0.5381945", "text": "func RenderTableRow(w http.ResponseWriter, Devs []*models.Device) {\n rowHolder := struct {\n Devices []*models.Device\n }{Devs}\n err := tableView.Render(w, rowHolder)\n if err != nil {\n log.Println(err)\n http.Error(w, err.Error(), http.StatusInternalServerError)\n }\n}", "title": "" }, { "docid": "9f293b03b64e47e8108167af91e10bdb", "score": "0.53805465", "text": "func (api * API) getDevices(w http.ResponseWriter, r *http.Request){\n\tdefer r.Body.Close()\n\tif r.Method == \"GET\" {\n\t\tlog.Printf(\"New request: %s\", r.URL)\n\t\t\n\t\tusername := r.URL.Query().Get(\"username\")\n\t\tif username != \"\" {\n\t\t\tdevices, err := getDevicesDB(api.db, username)\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"%s\", err)\n\t\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\t}\n\t\t\tjsonEncoder := json.NewEncoder(w)\n\t\t\tjsonEncoder.Encode(devices)\n\t\t\t\n\t\t}\n\n\t\t\n\t}\n}", "title": "" }, { "docid": "0296cb08f709f87673c828e623f31c8c", "score": "0.5375253", "text": "func list() []Dataset {\n\n\toutput, err := exec.Command(\"zfs\", \"list\", \"-H\").Output()\n\tcrash(err)\n\tlines := strings.Split(string(output), \"\\n\")\n\tvar datasets []Dataset\n\tfor i := 0; i < len(lines)-1; i++ {\n\t\tlineSplit := strings.Split(lines[i], \"\\t\")\n\t\tmountPoint := lineSplit[4]\n\t\tif mountPoint != \"/\" && mountPoint != \"none\" && mountPoint != \"-\" && mountPoint != \"/\" {\n\t\t\tdatasets = append(datasets, Dataset{Name: lineSplit[0], Mountpoint: lineSplit[4]})\n\t\t}\n\t}\n\n\treturn datasets\n}", "title": "" }, { "docid": "86ebbac8c5a6cc6da5c0e217e2a2856a", "score": "0.5364692", "text": "func (c *DMXDeviceController) GetAll(r *http.Request, idReq *api.Empty, reply *[]*cntl.DMXDevice) error {\n\t*reply = []*cntl.DMXDevice{}\n\tfor _, id := range c.storage.List(&cntl.DMXDevice{}) {\n\t\tentity := &cntl.DMXDevice{}\n\t\tif err := c.storage.Read(id, entity); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to read entity %s: %v\", id, err)\n\t\t}\n\t\t*reply = append(*reply, entity)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4028a4c5ea20d7e900a840e19b271814", "score": "0.5364468", "text": "func (d *DeviceCache) Devices() []*Device {\n\td.mu.Lock()\n\tdefer d.mu.Unlock()\n\n\tvar devices []*Device\n\tfor _, device := range d.devices {\n\t\tdevices = append(devices, device)\n\t}\n\treturn devices\n}", "title": "" }, { "docid": "52172870fd2d07bedf66fe8b7449bb94", "score": "0.53567535", "text": "func (r Repository) List(ctx context.Context) ([]domain.Table, error) {\n\ttables, err := r.StorageProvider.List(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tts := make([]domain.Table, len(tables))\n\n\tfor i := range tables {\n\t\tts[i] = storage.AdaptTableToDomain(tables[i])\n\t}\n\n\treturn ts, nil\n}", "title": "" }, { "docid": "421ce7c5d8ad69e920ea2fccd17a435e", "score": "0.53475475", "text": "func (r *Registry) Devices() []Device {\n\tr.Lock()\n\tdefer r.Unlock()\n\n\tout := make([]Device, len(r.devices))\n\tcopy(out, r.devices)\n\treturn out\n}", "title": "" }, { "docid": "703a578e542b9496d7857ae9ca543160", "score": "0.534431", "text": "func (d *DeviceRestClient) Devices(ctx context.Context) ([]models.Device, error) {\n\treturn d.requestDeviceSlice(d.url, ctx)\n}", "title": "" }, { "docid": "ea44f45180d83eb018ce24b919a347a4", "score": "0.5328928", "text": "func (c Controller) List(ctx context.Context) ([]domain.Table, error) {\n\ttables, err := c.RepositoryProvider.List(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%v: %w\", err, ErrFailedToFetchTable)\n\t}\n\n\tfor i := range tables {\n\t\tbets, err := c.BetRepositoryProvider.List(ctx, tables[i].ID)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\ttables[i].Bets = bets\n\t}\n\n\treturn tables, nil\n}", "title": "" }, { "docid": "913c8c4eb404dba2da08dfaa46577f51", "score": "0.53170204", "text": "func Devices() ([]*Device, error) {\n\tvar (\n\t\tmaxEndpoints C.ItemCount\n\t\tdevices = []*Device{}\n\t\tnumDestinations C.ItemCount = C.MIDIGetNumberOfDestinations()\n\t\tnumSources C.ItemCount = C.MIDIGetNumberOfSources()\n\t)\n\tif numDestinations > numSources {\n\t\tmaxEndpoints = numDestinations\n\t} else {\n\t\tmaxEndpoints = numSources\n\t}\n\tfor i := C.ItemCount(0); i < maxEndpoints; i++ {\n\t\tvar (\n\t\t\td *Device\n\t\t\tobj C.MIDIObjectRef\n\t\t)\n\t\tif i < numDestinations && i < numSources {\n\t\t\td = &Device{\n\t\t\t\tType: DeviceDuplex,\n\t\t\t\tinput: C.MIDIGetSource(i),\n\t\t\t\toutput: C.MIDIGetDestination(i),\n\t\t\t}\n\t\t\tobj = C.MIDIObjectRef(d.output)\n\t\t} else if i < numDestinations {\n\t\t\td = &Device{\n\t\t\t\tType: DeviceOutput,\n\t\t\t\toutput: C.MIDIGetDestination(i),\n\t\t\t}\n\t\t\tobj = C.MIDIObjectRef(d.output)\n\t\t} else {\n\t\t\td = &Device{\n\t\t\t\tType: DeviceInput,\n\t\t\t\tinput: C.MIDIGetSource(i),\n\t\t\t}\n\t\t\tobj = C.MIDIObjectRef(d.input)\n\t\t}\n\t\tvar name C.CFStringRef\n\t\tif rc := C.MIDIObjectGetStringProperty(obj, C.kMIDIPropertyName, &name); rc != 0 {\n\t\t\treturn nil, coreMidiError(rc)\n\t\t}\n\t\td.Name = fromCFString(name)\n\t\tC.CFRelease(C.CFTypeRef(name))\n\t\tdevices = append(devices, d)\n\t}\n\treturn devices, nil\n}", "title": "" }, { "docid": "71e2f7c5b349f565c0aac6f984cd712e", "score": "0.53058165", "text": "func (reg *InductorConfiguration) List() []string {\n\tkeys := make([]string, len(reg.OperatingSystems))\n\ti := 0\n\tfor k := range reg.OperatingSystems {\n\t\tkeys[i] = k\n\t\ti++\n\t}\n\tsort.Strings(keys)\n\treturn keys\n}", "title": "" }, { "docid": "ed02f1d56e591b457dbe6d80a51f825a", "score": "0.5297866", "text": "func (c *TestCommand) Table() ([][]string, error) {\n\tres := c.Called()\n\treturn res.Get(0).([][]string), res.Error(1)\n}", "title": "" }, { "docid": "eb4d99a6dc8a365612c3b709df83e1b1", "score": "0.52947074", "text": "func (m *Source) Tables() []string { return m.tablenamelist }", "title": "" }, { "docid": "ef99e2ef33ea8cb6a68f3d3abc523414", "score": "0.5292745", "text": "func Devices(mediaType MediaType) ([]Device, error) {\n\tvar cDevicesPtr C.PAVBindDevice\n\tvar cDevicesLen C.int\n\n\tstatus := C.AVBindDevices(C.AVBindMediaType(mediaType), &cDevicesPtr, &cDevicesLen)\n\tif status != nil {\n\t\treturn nil, fmt.Errorf(\"%s\", C.GoString(status))\n\t}\n\n\t// https://github.com/golang/go/wiki/cgo#turning-c-arrays-into-go-slices\n\tcDevices := (*[1 << 28]C.AVBindDevice)(unsafe.Pointer(cDevicesPtr))[:cDevicesLen:cDevicesLen]\n\tdevices := make([]Device, cDevicesLen)\n\n\tfor i := range devices {\n\t\tdevices[i].UID = C.GoString(&cDevices[i].uid[0])\n\t\tdevices[i].cDevice = cDevices[i]\n\t\tdevices[i].Name = C.GoString(&cDevices[i].name[0])\n\t}\n\n\treturn devices, nil\n}", "title": "" }, { "docid": "f5242d000185a1833b8bfc71b1d7c382", "score": "0.52923894", "text": "func (t *films) listFilms(db *sql.DB, start, count int) ([]listResponse, error) {\n/*\n qry := `select uuid,\n films ->> 'active' as active,\n films -> 'Metadata' ->> 'name' as name\n from acme.films LIMIT %d OFFSET %d;`\n*/\n qry := `select FilmsUUID\n from acme.films LIMIT %d OFFSET %d;`\n statement := fmt.Sprintf(qry, count, start)\n rows, err := db.Query(statement)\n\n if err != nil {\n return nil, err\n }\n\n defer rows.Close()\n\n ul := []listResponse{}\n\n for rows.Next() {\n var t listResponse\n err := rows.Scan(&t.UUID)\n\n if err != nil {\n log.Printf(\"SQL rows.Scan failed: %s\", err)\n return ul, err\n }\n\n ul = append(ul, t)\n }\n\n return ul, nil\n}", "title": "" }, { "docid": "794f03f78991c1a1bb71befc0d93f03e", "score": "0.5291895", "text": "func (client Client) ListTablesByDatabaseResponder(resp *http.Response) (result USQLTableList, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "91c63abd38de0c1b2367a5252e9a8980", "score": "0.5284599", "text": "func (dbRepo *DatabaseRepository) GetDevicesInFabric(FabricID uint) ([]domain.Device, error) {\n\tvar DBDevices []database.Device\n\terr := dbRepo.GetDBHandle().Model(database.Device{}).Where(\"fabric_id = ?\", FabricID).Find(&DBDevices).Error\n\n\tDevices := make([]domain.Device, 0, len(DBDevices))\n\tif err == nil {\n\t\tfor _, DBDevice := range DBDevices {\n\t\t\tvar Device domain.Device\n\t\t\tCopy(&Device, DBDevice)\n\t\t\tif Device.Password, err = util.AesDecrypt(constants.AESEncryptionKey, Device.Password); err != nil {\n\t\t\t\treturn Devices, err\n\t\t\t}\n\t\t\tDevice.IsPasswordEncrypted = false\n\t\t\tDevices = append(Devices, Device)\n\t\t}\n\t}\n\n\treturn Devices, err\n}", "title": "" }, { "docid": "715b1d82139831edb2c90181e65d2d96", "score": "0.52818906", "text": "func (m *Data) list(keys [][]byte, table []byte) (res []Keyer, err error) {\n\terr = m.db.View(func(tx *bolt.Tx) error {\n\t\t// Assume bucket exists and has keys.\n\t\tb := tx.Bucket(table)\n\t\tfor _, key := range keys {\n\t\t\tv := b.Get(key)\n\t\t\td, err := newFor(table)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.WithMessage(err, string(table))\n\t\t\t}\n\t\t\tif err := json.Unmarshal(v, d); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tres = append(res, d)\n\t\t}\n\t\treturn nil\n\t})\n\treturn\n}", "title": "" }, { "docid": "8778f97dce1feb76bf8caddbbbfe716b", "score": "0.52772796", "text": "func interfaceTable(ifindex int) ([]net.Interface, error) {\n\taas, err := adapterAddresses()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar ift []net.Interface\n\tfor _, aa := range aas {\n\t\tindex := aa.IfIndex\n\t\tif index == 0 { // ipv6IfIndex is a substitute for ifIndex\n\t\t\tindex = aa.Ipv6IfIndex\n\t\t}\n\t\tif ifindex == 0 || ifindex == int(index) {\n\t\t\tifi := net.Interface{\n\t\t\t\tIndex: int(index),\n\t\t\t\tName: syscall.UTF16ToString((*(*[10000]uint16)(unsafe.Pointer(aa.FriendlyName)))[:]),\n\t\t\t}\n\t\t\tif aa.OperStatus == windows.IfOperStatusUp {\n\t\t\t\tifi.Flags |= FlagUp\n\t\t\t}\n\t\t\t// For now we need to infer link-layer service\n\t\t\t// capabilities from media types.\n\t\t\t// We will be able to use\n\t\t\t// MIB_IF_ROW2.AccessType once we drop support\n\t\t\t// for Windows XP.\n\t\t\tswitch aa.IfType {\n\t\t\tcase windows.IF_TYPE_ETHERNET_CSMACD, windows.IF_TYPE_ISO88025_TOKENRING, windows.IF_TYPE_IEEE80211, windows.IF_TYPE_IEEE1394:\n\t\t\t\tifi.Flags |= net.FlagBroadcast | net.FlagMulticast\n\t\t\tcase windows.IF_TYPE_PPP, windows.IF_TYPE_TUNNEL:\n\t\t\t\tifi.Flags |= net.FlagPointToPoint | net.FlagMulticast\n\t\t\tcase windows.IF_TYPE_SOFTWARE_LOOPBACK:\n\t\t\t\tifi.Flags |= net.FlagLoopback | net.FlagMulticast\n\t\t\tcase windows.IF_TYPE_ATM:\n\t\t\t\tifi.Flags |= net.FlagBroadcast | net.FlagPointToPoint | net.FlagMulticast // assume all services available; LANE, point-to-point and point-to-multipoint\n\t\t\t}\n\t\t\tif aa.Mtu == 0xffffffff {\n\t\t\t\tifi.MTU = -1\n\t\t\t} else {\n\t\t\t\tifi.MTU = int(aa.Mtu)\n\t\t\t}\n\t\t\tif aa.PhysicalAddressLength > 0 {\n\t\t\t\tifi.HardwareAddr = make(net.HardwareAddr, aa.PhysicalAddressLength)\n\t\t\t\tcopy(ifi.HardwareAddr, aa.PhysicalAddress[:])\n\t\t\t}\n\t\t\tift = append(ift, ifi)\n\t\t\tif ifindex == ifi.Index {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn ift, nil\n}", "title": "" } ]
251e2a132968530db03c9491a3479223
NewTrie is used to create a new radix trie.
[ { "docid": "ff6abaa8e2ba26198a0c5df07c0e3d00", "score": "0.7370955", "text": "func NewTrie() Trie {\n\treturn Trie{}\n}", "title": "" } ]
[ { "docid": "c3a1999f5aec207c77792980b73323f4", "score": "0.77284783", "text": "func newTrieNode(val rune, clean bool) *trieNode {\n\treturn &trieNode{val, clean, make(map[rune]*trieNode)}\n}", "title": "" }, { "docid": "be3d12e548280e01daf60dcf120480da", "score": "0.772616", "text": "func NewTrie() *Trie {\n return &Trie{Root: node.NewNode(\"*\", false)}\n}", "title": "" }, { "docid": "cfb30627018e9894c23f90d6526091d4", "score": "0.7569669", "text": "func NewTrie() *Trie {\n\treturn &Trie{}\n}", "title": "" }, { "docid": "0da53dfcb5b50cf6b9765495e65aa7b5", "score": "0.75631315", "text": "func NewTrie() *Trie {\n root := &Trie {\n &node{\n character: \"\",\n children: make(map[string]*node),\n },\n 0,\n }\n return root\n}", "title": "" }, { "docid": "9fa851675092b0adfb6b264bb71ab43c", "score": "0.7554726", "text": "func New() *Trie {\n\treturn newTrie(nil)\n}", "title": "" }, { "docid": "104c2127ed97438758916d01b22fe08e", "score": "0.754315", "text": "func New() *Trie {\n\treturn &Trie{\n\t\troot: &node{},\n\t}\n}", "title": "" }, { "docid": "441dc92fe29f9527724409d554da6436", "score": "0.7501668", "text": "func New() *Trie {\n\treturn &Trie{\n\t\troot: &Node{children: make(map[rune]*Node), depth: 0},\n\t\tsize: 0,\n\t}\n}", "title": "" }, { "docid": "441dc92fe29f9527724409d554da6436", "score": "0.7501668", "text": "func New() *Trie {\n\treturn &Trie{\n\t\troot: &Node{children: make(map[rune]*Node), depth: 0},\n\t\tsize: 0,\n\t}\n}", "title": "" }, { "docid": "bfe8e13c5fe3931604b4d17af84846ec", "score": "0.7494689", "text": "func NewTrie() *Trie {\n\treturn &Trie{\n\t\troot: &node{},\n\t}\n}", "title": "" }, { "docid": "38b4d58ee7491ff1e40850a1e531f91b", "score": "0.74664366", "text": "func NewTrie() *Trie {\n\treturn &Trie{\n\t\tRoot: NewNode(),\n\t}\n}", "title": "" }, { "docid": "14575003b83b7271d9a8939a08442369", "score": "0.74598265", "text": "func NewTrie() *Trie {\n\treturn &Trie{\n\t\troot: newNode(),\n\t}\n}", "title": "" }, { "docid": "f74469540b20f3e379f2247d6ecb4999", "score": "0.7443416", "text": "func New() *Trie {\n\treturn &Trie{\n\t\troot: newTrieNode(),\n\t}\n}", "title": "" }, { "docid": "5e93bb294e1b1e26e988d9dc6ed20347", "score": "0.74245477", "text": "func NewTrie() *Trie {\n\treturn &Trie{\n\t\troot: newNode(0),\n\t}\n}", "title": "" }, { "docid": "a9cfe7df46ba2973e2f954af5e53fac9", "score": "0.73649144", "text": "func NewTrie() *Trie {\n\treturn &Trie{\n\t\troot: &Node{\n\t\t\tchild: make(map[string]*Node),\n\t\t\tvalue: [](bson.ObjectId){},\n\t\t\tdepth: 0,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "a42e182596d7966529aeec4e4e6e5a60", "score": "0.73489296", "text": "func newTrieNode() *trieNode {\n\tnode := new(trieNode)\n\tnode.edges = make(map[rune]*trieNode, 0)\n\treturn node\n}", "title": "" }, { "docid": "9af58c189a9119347bdc333710894fef", "score": "0.7320063", "text": "func New() *Trie {\n\troot := &TrieNode{\n\t\tKey: byte(0),\n\t\tConns: make(map[byte]*TrieNode),\n\t\tIsWord: true,\n\t}\n\n\treturn &Trie{root}\n}", "title": "" }, { "docid": "3e9c4b306f353f73d13b1a5268914a5a", "score": "0.7269217", "text": "func NewTrie() *Trie {\n\treturn &Trie{\n\t\troot: NewTrieNode(),\n\t}\n}", "title": "" }, { "docid": "0ffc64cd5e7ea3c6ff8eebee6ce5f314", "score": "0.7262996", "text": "func NewTrie() *Trie {\n\ttrie := &Trie{}\n\ttrie.root = NewNode()\n\treturn trie\n}", "title": "" }, { "docid": "95baadf12870b8828ec69fc4b8d04122", "score": "0.70574427", "text": "func NewTrie() *Trie {\n\treturn &Trie{\n\t\troot: TrieNode{\n\t\t\tchildren: &[]TrieNode{},\n\t\t},\n\t\tmx: &sync.RWMutex{},\n\t}\n}", "title": "" }, { "docid": "fba990183483556f5304254f17d77f78", "score": "0.699488", "text": "func NewTrie() SuccinctTrie {\n\treturn &trie{}\n}", "title": "" }, { "docid": "5475cf3858970e0b665f12d1976b14e2", "score": "0.68804836", "text": "func newTxTrie() *txTrie {\n\treturn &txTrie{\n\t\tlocalTrie: newLocalTrie(),\n\t}\n}", "title": "" }, { "docid": "947a87f79da2729614e01b6665692670", "score": "0.68708277", "text": "func trieConstructor() ipMap {\n\treturn newTrie()\n}", "title": "" }, { "docid": "907c9340fc2fbd5bdd54880b17873636", "score": "0.68654805", "text": "func NewTrieTree() *TrieTree {\n\treturn &TrieTree{root: &TrieNode{rune('-'), 0, false, [26]*TrieNode{}}}\n}", "title": "" }, { "docid": "357e5b372f566d6d334084b384116620", "score": "0.6837062", "text": "func NewTrie(root common.Hash, prefix []byte, db database.Database) (*Trie, error) {\n\n\ttrie := &Trie{\n\t\tdb: db,\n\t\tprefix: prefix,\n\t}\n\n\tif (root != common.Hash{}) {\n\t\trootnode, err := trie.loadNode(root[:])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttrie.root = rootnode\n\t}\n\n\treturn trie, nil\n}", "title": "" }, { "docid": "4e4f56f1633927e6d9d455fd2d5406af", "score": "0.670133", "text": "func ConstructTrie() Trie {\n\troot := Node{isEnd: false, char: 0, children: [26]*Node{}}\n\treturn Trie{\n\t\troot: &root,\n\t}\n}", "title": "" }, { "docid": "30e7c173b069275624301c33935029d7", "score": "0.66219836", "text": "func newRouter() *trieRegexpRouter {\n\treturn &trieRegexpRouter{root: new(trieNode)}\n}", "title": "" }, { "docid": "155c4666c3e2d431058e0765d6fa08dd", "score": "0.6466939", "text": "func newTrieView(\n\tdb *merkleDB,\n\tparentTrie TrieView,\n\troot *node,\n\tbatchOps []database.BatchOp,\n) (*trieView, error) {\n\tif root == nil {\n\t\treturn nil, ErrNoValidRoot\n\t}\n\n\tnewView := &trieView{\n\t\troot: root,\n\t\tdb: db,\n\t\tparentTrie: parentTrie,\n\t\tchanges: newChangeSummary(len(batchOps)),\n\t}\n\n\tfor _, op := range batchOps {\n\t\tnewVal := maybe.Nothing[[]byte]()\n\t\tif !op.Delete {\n\t\t\tnewVal = maybe.Some(slices.Clone(op.Value))\n\t\t}\n\t\tif err := newView.recordValueChange(newPath(op.Key), newVal); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn newView, nil\n}", "title": "" }, { "docid": "6291915147ea648725ffbc6859382ed2", "score": "0.62785196", "text": "func Constructor() Trie {\n\troot := &TrieNode{chars: [26]*TrieNode{}}\n\treturn Trie{root}\n}", "title": "" }, { "docid": "d200db59058244b2ba7f7be7383238b9", "score": "0.62646866", "text": "func Constructor() Trie {\n\ttrie := Trie{root: &TrieNode{children: make([]*TrieNode, 26)}}\n\treturn trie\n}", "title": "" }, { "docid": "f2dfb7db68c63061a55937765b6da84d", "score": "0.624627", "text": "func Constructor() WordTrie {\n\tt := WordTrie{}\n\ttrieNode := new(WordTrieNode)\n\ttrieNode.children = make([]*WordTrieNode, 26)\n\tt.Root = trieNode\n\treturn t\n}", "title": "" }, { "docid": "bf242746a75575507054618ec9e6cf58", "score": "0.62449586", "text": "func NewTrieBuilder() TrieBuilder {\n\treturn newTrieNode()\n}", "title": "" }, { "docid": "3154c186709620427f2949543b1c78d2", "score": "0.62140673", "text": "func Constructor() Trie {\n\treturn Trie{nodes: make(map[byte]*Trie)}\n}", "title": "" }, { "docid": "728a29f47f4d6ba3fd3f73079d3a37a9", "score": "0.6210248", "text": "func GenerateTrie(words []string) *Trie {\n\tvar root Trie = Trie{}\n\tfor _, word := range words {\n\t\tcurrent := &root\n\t\tfor _, ch := range word {\n\t\t\tif current.children[ch-'a'] == nil {\n\t\t\t\tcurrent.children[ch-'a'] = &Trie{} // if alpha does not have a node the gen one\n\t\t\t}\n\t\t\tcurrent = current.children[ch-'a']\n\t\t}\n\t\tcurrent.word = word // assign word to last alphabet of word\n\t}\n\treturn &root\n}", "title": "" }, { "docid": "cf212d0fc086a0ebef57517993d488a1", "score": "0.6151561", "text": "func TireConstructor() *Trie {\n\treturn &Trie{\n\t\tisEnd: false,\n\t\tchilds: make(map[string]*Trie, 26)}\n\n}", "title": "" }, { "docid": "25b25609f5e3a1c5900c48911a90a0a2", "score": "0.6147599", "text": "func Constructor() Trie {\n root := &Trie{}\n return *root\n}", "title": "" }, { "docid": "6f8616ac69c29cdbba253b8f076b987a", "score": "0.6136139", "text": "func Constructor() Trie {\n\troot := &TrieNode{\n\t\tchildren: map[byte]*TrieNode{},\n\t}\n\treturn Trie{root}\n}", "title": "" }, { "docid": "6a726d1598cfa03db89c4106db2ff910", "score": "0.6121996", "text": "func Constructor() Trie {\n\tr := Trie{children: [26]*Trie{}, isEndOfWord: false, root: &Trie{}}\n\treturn r\n}", "title": "" }, { "docid": "15e19009f8c9db58be56b266b2231ba7", "score": "0.60953176", "text": "func Constructor() Trie {\n\treturn Trie{root: &TrieNode{}}\n}", "title": "" }, { "docid": "ffdf2a6c0d36c61cd019d5c4d6a08f84", "score": "0.6076525", "text": "func Constructor() Trie {\n\treturn Trie{child: make(map[rune]*Trie)}\n}", "title": "" }, { "docid": "58f98ac5b54d33412dce75eb8cdb28d2", "score": "0.60738367", "text": "func TestNewTrie(t *testing.T) {\n\ttrie := NewTrie()\n\n\tif trie.size != 0 {\n\t\tt.Errorf(\"expected size 0, got: %d\", trie.size)\n\t}\n}", "title": "" }, { "docid": "24b29f577f76e02f29d3ce0d5335f841", "score": "0.60651034", "text": "func Constructor() Trie {\n\treturn Trie{\n\t\tnext: make([]*Trie, 26),\n\t}\n}", "title": "" }, { "docid": "e6229d38cf8457d6338a54214342476c", "score": "0.60340905", "text": "func Constructor() Trie {\n\treturn Trie{\n\t\tnext: [26]*Trie{},\n\t}\n}", "title": "" }, { "docid": "31c1f198843f3745a5170a307aeda634", "score": "0.6031675", "text": "func NewNode() Router {\n log.Println(\"Creating new Rabric Node\")\n\n trie := patricia.NewTrie()\n r := &Realm{URI: \"pd\"}\n trie.Insert(patricia.Prefix(\"pd\"), r)\n\n return &node{\n realms: make(map[URI]Realm),\n sessionOpenCallbacks: []func(uint, string){},\n sessionCloseCallbacks: []func(uint, string){},\n root: trie,\n }\n}", "title": "" }, { "docid": "e7cbe9aa7418089fcc1904393bc8c1b7", "score": "0.60283375", "text": "func NewTrieTree(specialEndRune rune) *Tree {\n\treturn &Tree{newTrieNode(specialEndRune, true), specialEndRune}\n}", "title": "" }, { "docid": "94862bd9e72fefbaa9a36509b9ca685c", "score": "0.60203", "text": "func Constructor() Trie {\n\treturn Trie{childrenMap: map[byte]*Trie{}}\n}", "title": "" }, { "docid": "bdd81ddb791a5ffdff4fa29fe33804fa", "score": "0.60055536", "text": "func Constructor() Trie {\n\treturn Trie{\n\t\tnode: NewTrieNode(),\n\t}\n}", "title": "" }, { "docid": "1b2791e0b01afc57089bf2bc74bbbf4d", "score": "0.5890567", "text": "func Constructor() Trie {\n\tchild := map[rune]*Trie{}\n\treturn Trie{IsEnd: false, Children: child}\n}", "title": "" }, { "docid": "58a9f85d4ad5cbf7af5e0c958b0b940d", "score": "0.5881313", "text": "func Constructor() Trie {\n\ttrie := Trie{pre: &letter{0, false, map[int32]*letter{}}}\n\treturn trie\n}", "title": "" }, { "docid": "f7f1164b781706f3706160e143781161", "score": "0.58674806", "text": "func Constructor() Trie {\n\treturn Trie{root: &trieStorage{}}\n}", "title": "" }, { "docid": "ae16ec47d17009e2c1a32f1b3fb78365", "score": "0.57778305", "text": "func NewMockTrie(ctrl *gomock.Controller) *MockTrie {\n\tmock := &MockTrie{ctrl: ctrl}\n\tmock.recorder = &MockTrieMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "3e8368d6270500bd5f8b003f0a148288", "score": "0.57036287", "text": "func NewTrieSet(offset rune, alphaSize uint8) *TrieSet {\n\treturn &TrieSet{\n\t\toffset: uint8(offset),\n\t\talphaSize: alphaSize,\n\t}\n}", "title": "" }, { "docid": "dc73237ef4d09993d9718d3e4d5e604f", "score": "0.5639077", "text": "func Constructor() Trie {\n\treturn Trie{}\n}", "title": "" }, { "docid": "dc73237ef4d09993d9718d3e4d5e604f", "score": "0.5639077", "text": "func Constructor() Trie {\n\treturn Trie{}\n}", "title": "" }, { "docid": "dc73237ef4d09993d9718d3e4d5e604f", "score": "0.5639077", "text": "func Constructor() Trie {\n\treturn Trie{}\n}", "title": "" }, { "docid": "a8afe4a24492bd9ece2f9c6bc1fb5e31", "score": "0.5550592", "text": "func newRoutingTable(k int, dht *DHT) *routingTable {\n\troot := newRoutingTableNode(newBitmap(0))\n\n\trt := &routingTable{\n\t\tRWMutex: &sync.RWMutex{},\n\t\tk: k,\n\t\troot: root,\n\t\tcachedNodes: newSyncedMap(),\n\t\tcachedKBuckets: newKeyedDeque(),\n\t\tdht: dht,\n\t\tclearQueue: newSyncedList(),\n\t}\n\n\trt.cachedKBuckets.Push(root.bucket.prefix.String(), root.bucket)\n\treturn rt\n}", "title": "" }, { "docid": "1a6c44372de884025a2b19128ae43298", "score": "0.55455524", "text": "func NewMTTrie() *MTTrie {\n\tm := &mttNode{\n\t\tchildren: map[string]*mttNode{},\n\t}\n\treturn &MTTrie{m}\n}", "title": "" }, { "docid": "d5cba5b861e287ee7bad2c8b3ed973be", "score": "0.5528847", "text": "func NewPrefixTrie() *PrefixTrie {\n\treturn &PrefixTrie{}\n}", "title": "" }, { "docid": "596929aa475b1ec09e5f337425bb706b", "score": "0.5510254", "text": "func New(data, index string) *Tree {\n\treturn &Tree{\n\t\troot: &Node{\n\t\t\tdata: data,\n\t\t\tindex: index,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "b3208663cda4e276a6da0067d4c61dd7", "score": "0.5493136", "text": "func NewTrieServeMux() *TrieServeMux {\n\treturn &TrieServeMux{\n\t\tmethods: make(map[string]http.Handler),\n\t\tpaths: make(map[string]*TrieServeMux),\n\t}\n}", "title": "" }, { "docid": "cbfd0153fa837b442a706662cf0b4700", "score": "0.5455596", "text": "func newRoutingTableNode(prefix *bitmap) *routingTableNode {\n\treturn &routingTableNode{\n\t\tchildren: make([]*routingTableNode, 2),\n\t\tbucket: newKBucket(prefix),\n\t}\n}", "title": "" }, { "docid": "28433f7130f561b2b0597bf579fb9b2a", "score": "0.54368746", "text": "func newHistoricalTrieView(\n\tdb *merkleDB,\n\tchanges *changeSummary,\n) (*trieView, error) {\n\tif changes == nil {\n\t\treturn nil, ErrNoValidRoot\n\t}\n\n\tpassedRootChange, ok := changes.nodes[RootPath]\n\tif !ok {\n\t\treturn nil, ErrNoValidRoot\n\t}\n\n\tnewView := &trieView{\n\t\troot: passedRootChange.after,\n\t\tdb: db,\n\t\tparentTrie: db,\n\t\tchanges: changes,\n\t}\n\t// since this is a set of historical changes, all nodes have already been calculated\n\t// since no new changes have occurred, no new calculations need to be done\n\tnewView.calculateNodesOnce.Do(func() {})\n\tnewView.nodesAlreadyCalculated.Set(true)\n\treturn newView, nil\n}", "title": "" }, { "docid": "19fd8d2b809235c37e836f69c87b72cf", "score": "0.5424533", "text": "func Constructor() MagicDictionary {\n\tt := ConstructTrie()\n\treturn MagicDictionary{\n\t\ttrie: &t,\n\t}\n}", "title": "" }, { "docid": "0c3e3dfd9f1faa570ee629a5f88a090d", "score": "0.5408067", "text": "func Constructor() WordDictionary {\n\treturn WordDictionary{\n\t\troot: &Trie{},\n\t}\n}", "title": "" }, { "docid": "dadd522c15f7a1081d4aef1ea4573d60", "score": "0.53858626", "text": "func Constructor() WordDictionary {\n\treturn WordDictionary{\n\t\troot: NewTrieNode(),\n\t}\n}", "title": "" }, { "docid": "704d1c3d6d3f34f69d5ddbba2ccc1d7e", "score": "0.5338155", "text": "func NewChain(prefixLen int) *Chain {\n\treturn &Chain{make(map[string][]rune), prefixLen, 0, 0}\n}", "title": "" }, { "docid": "4360da7f0deb083bb2a5fbcd8486f07d", "score": "0.53274477", "text": "func Constructor() Trie {\n\tv := make([]string, 0)\n\n\treturn Trie{Values: v}\n}", "title": "" }, { "docid": "191035959b8cb10e2ed3ec27691e32a9", "score": "0.53016734", "text": "func (p *Parser) newTree(c *C.TSTree) *Tree {\n\tbase := &BaseTree{c: c}\n\truntime.SetFinalizer(base, (*BaseTree).Close)\n\n\tnewTree := &Tree{p: p, BaseTree: base, cache: make(map[C.TSNode]*Node)}\n\treturn newTree\n}", "title": "" }, { "docid": "82473e2922a89e8bdc29d049237846a7", "score": "0.53013927", "text": "func NewTrieStack(db *GethDB, blockNumber uint64, dumpDir, nibble, operation string) *TrieStack {\n\tvar err error\n\tts := &TrieStack{}\n\n\t// Metrics in this operation\n\tmetrics.NewLogger(\"traverse-state-trie\")\n\tmetrics.NewLogger(\"geth-leveldb-get-queries\")\n\tmetrics.NewLogger(\"trie-node-children-processes\")\n\tmetrics.NewLogger(\"traverse-state-trie-iterations\")\n\tmetrics.NewLogger(\"new-nodes-bytes-tranferred\")\n\tmetrics.NewLogger(\"file-creations\")\n\tmetrics.NewCounter(\"traverse-state-trie-branches\")\n\tmetrics.NewCounter(\"traverse-state-trie-extensions\")\n\tmetrics.NewCounter(\"traverse-state-trie-leaves\")\n\tmetrics.NewCounter(\"traverse-state-smart-contracts\")\n\n\t// Add the reference to the database\n\tts.db = db\n\n\t// Hardcoded stack directory. Sue me\n\tdataDirectoryName := \"/tmp/trie_stack_data_dir/\" + strconv.FormatUint(blockNumber, 10)\n\n\t// Clearing the directory if exists, as we want to start always\n\t// with a fresh stack database.\n\tos.RemoveAll(dataDirectoryName)\n\tts.Stack, err = goque.OpenStack(dataDirectoryName)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Find the block header RLP we need\n\tblockHash := db.GetCanonicalHash(blockNumber)\n\theaderRLP := db.GetHeaderRLP(blockHash, blockNumber)\n\theader := new(types.Header)\n\tif err := rlp.Decode(bytes.NewReader(headerRLP), header); err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Finally, Init the traversal with the state root\n\t_, err = ts.Push(header.Root[:])\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Assign these variables\n\tts.dumpDir = dumpDir\n\n\tswitch operation {\n\tcase \"evmcode\":\n\t\tts.operation = \"evmcode\"\n\tcase \"state-trie\":\n\t\tts.operation = \"state-trie\"\n\tcase \"count-all\":\n\t\tts.operation = \"count-all\"\n\tdefault:\n\t\tpanic(\"operation not supported\")\n\t}\n\n\tif len(nibble) > 1 {\n\t\tpanic(\"unsupported nibble lenght\")\n\t}\n\tif len(nibble) == 1 {\n\t\tn := nibble[0]\n\t\tswitch {\n\t\tcase n >= '0' && n <= '9':\n\t\t\tts.firstNibbleInt = int(n - 48)\n\t\tcase n >= 'a' && n <= 'f':\n\t\t\tts.firstNibbleInt = int(n + 10 - 97)\n\t\tdefault:\n\t\t\tpanic(\"wrong value for nibble\")\n\t\t}\n\t} else {\n\t\tts.firstNibbleInt = -1\n\t}\n\n\t// Return the wrapped object\n\tts.iterationCheapCounter = 0\n\treturn ts\n}", "title": "" }, { "docid": "f0ba3a77c31614f5f1c50fd2755b8f72", "score": "0.5253121", "text": "func New(words []string) Censor {\n\tt := trie.New()\n\tfor _, w := range words {\n\t\tt.AddString(w)\n\t}\n\treturn Censor{\n\t\tt: t,\n\t\tPattern: \"*\",\n\t}\n}", "title": "" }, { "docid": "d695c478ee450b8958c2cec0deef2682", "score": "0.521444", "text": "func New(hashFunc HashFunc) *Tree {\n\thasher := Hasher{hashFunc}\n\tdict := OrderedMap{nil, nil, make(map[string]*mapnode)}\n\treturn &Tree{hasher, nil, dict}\n}", "title": "" }, { "docid": "01e1c95675d55d132d166f988480c0fb", "score": "0.5209141", "text": "func NewACTrie() *ACTrie {\n\treturn &ACTrie{\n\t\tnext: make(map[rune]*ACTrie),\n\t}\n}", "title": "" }, { "docid": "809bdc9e4c690cc0b52ff34a76c6b2f9", "score": "0.51740056", "text": "func (tb *TrieBuilder) Build() *Trie {\n\tvar trie *Trie = &Trie{\n\t\troot: newNode(),\n\t\twords: tb.words,\n\t}\n\n\t//Build our trie\n\tfor indx, word := range trie.words {\n\t\tinsertWord(trie, word, indx)\n\t}\n\n\tif tb.optimize {\n\t\ttb.optimizeSkiping(trie)\n\t}\n\n\treturn trie\n}", "title": "" }, { "docid": "1aa70bf1a3a828569aa6d6f7c6610f79", "score": "0.51717055", "text": "func withTrie(size int) {\n\tvar tr Trie\n\tfor _, s := range tc[:size] {\n\t\ttr.Put(s, s)\n\t}\n}", "title": "" }, { "docid": "36878b28b697a74fa05b363610d208b9", "score": "0.5170402", "text": "func New() *RTree {\n\t// 16 entries provide good performance and low memory overhead\n\treturn NewConf(16)\n}", "title": "" }, { "docid": "ee7f619802f1413a08dec50ff4963b86", "score": "0.5149669", "text": "func (t *trieView) NewView(ctx context.Context, batchOps []database.BatchOp) (TrieView, error) {\n\tif t.isInvalid() {\n\t\treturn nil, ErrInvalid\n\t}\n\tt.commitLock.RLock()\n\tdefer t.commitLock.RUnlock()\n\n\tif t.committed {\n\t\treturn t.getParentTrie().NewView(ctx, batchOps)\n\t}\n\n\tif err := t.calculateNodeIDs(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\n\tnewView, err := newTrieView(t.db, t, t.root.clone(), batchOps)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tt.validityTrackingLock.Lock()\n\tdefer t.validityTrackingLock.Unlock()\n\n\tif t.invalidated {\n\t\treturn nil, ErrInvalid\n\t}\n\tt.childViews = append(t.childViews, newView)\n\n\treturn newView, nil\n}", "title": "" }, { "docid": "8a22d7fd8acc2b2eabc030b151b7b206", "score": "0.51154184", "text": "func newTableReader(index tableIndex, r tableReaderAt, blockSize uint64) tableReader {\n\treturn tableReader{index, r, blockSize}\n}", "title": "" }, { "docid": "9cd36da47f3cb902e2aee3dad7a64745", "score": "0.51078105", "text": "func New() *Router {\n\treturn &Router{\n\t\troutes: NewTrie(),\n\t\tdynamicRoutes: make(dynamicSet),\n\t\tVerbose: true,\n\t}\n}", "title": "" }, { "docid": "62da646f56911ba2913c41aba2243c03", "score": "0.5099247", "text": "func Constructor0211() WordDictionary {\n\treturn WordDictionary{\n\t\troot: createTrieNode(),\n\t}\n}", "title": "" }, { "docid": "864599c3aa5519a14307e873de869e0c", "score": "0.5090725", "text": "func New(name string, funcs ...map[string]interface{}) *Tree {}", "title": "" }, { "docid": "a284efe3b94c93e06aeed2fe835bc21f", "score": "0.50884867", "text": "func (t *treeGenerator) newTriple(parent, descendant *node.Node) (*triple.Triple, error) {\n\treturn triple.New(parent, t.predicate, triple.NewNodeObject(descendant))\n}", "title": "" }, { "docid": "30412cc681576045a941f00101ba24a3", "score": "0.5074868", "text": "func TestTrie(t *testing.T) {\n\tt.Logf(\"Test when all nodes are registered\\n\")\n\ttestTrie(t, false)\n\tt.Logf(\"Test node one by one\\n\")\n\ttestTrie(t, true)\n}", "title": "" }, { "docid": "31b5cab2ab00f30166c7bb675c8eda43", "score": "0.50695467", "text": "func newRouter() *router {\n\treturn &router{\n\t\troots: make(map[string]*node),\n\t\theadlers: make(map[string]HandleFunc),\n\t}\n}", "title": "" }, { "docid": "b98668e776c764d2fe53d7c796222b1d", "score": "0.5066875", "text": "func NewChain(prefixLen int) *Chain {\n\treturn &Chain{make(map[string][]string), prefixLen}\n}", "title": "" }, { "docid": "b98668e776c764d2fe53d7c796222b1d", "score": "0.5066875", "text": "func NewChain(prefixLen int) *Chain {\n\treturn &Chain{make(map[string][]string), prefixLen}\n}", "title": "" }, { "docid": "b98668e776c764d2fe53d7c796222b1d", "score": "0.5066875", "text": "func NewChain(prefixLen int) *Chain {\n\treturn &Chain{make(map[string][]string), prefixLen}\n}", "title": "" }, { "docid": "b98668e776c764d2fe53d7c796222b1d", "score": "0.5066875", "text": "func NewChain(prefixLen int) *Chain {\n\treturn &Chain{make(map[string][]string), prefixLen}\n}", "title": "" }, { "docid": "58274ba0adbc96d44519a19fbc2ef594", "score": "0.5038352", "text": "func newBucket(tx *Tx) Bucket {\n\tvar b = Bucket{tx: tx}\n\tb.buckets = make(map[string]*Bucket)\n\tif tx.writable {\n\t\tb.nodes = make(map[pgid]*node)\n\t}\n\treturn b\n}", "title": "" }, { "docid": "91c2fe5a7672224868fec2b9e51a6729", "score": "0.5035615", "text": "func newTree() *Tree {\n\treturn &Tree{\n\t\troot: nil,\n\t\tallNodes: newMapNodes(),\n\t}\n}", "title": "" }, { "docid": "7676a46ff87b93fe013fb2a42c36cb1a", "score": "0.5035176", "text": "func NewChain(prefixLen int) *Chain {\n\treturn &Chain{make(map[string]map[string]int), prefixLen}\n}", "title": "" }, { "docid": "e81fb93d73774dfe2eb1790ffe0a3718", "score": "0.50275826", "text": "func New(text string) Rope { return &leaf{text: text} }", "title": "" }, { "docid": "7846d677f3980dd3b550bf4e3d2d583d", "score": "0.50235736", "text": "func New(strings ...string) SuffixTree {\n\ttree := SuffixTree{\n\t\troot: newNode(-1, -1),\n\t\tcorpus: make([]string, 0, 1),\n\t}\n\n\tfor _, s := range strings {\n\t\ttree.Insert(s)\n\t}\n\treturn tree\n}", "title": "" }, { "docid": "455b4e52915dc26edcca1aa2348c2d1a", "score": "0.5016371", "text": "func MakePostingsTrie(str string, arry [516]rune) string {\n\n\tif len(str) > 256 {\n\t\treturn \"\"\n\t}\n\n\t// expand Greek letters, anglicize characters in other alphabets\n\tif IsNotASCII(str) {\n\t\tif HasGreek(str) {\n\t\t\tstr = SpellGreek(str)\n\t\t\tstr = CompressRunsOfSpaces(str)\n\t\t}\n\t\tstr = unidecode.Unidecode(str)\n\t\tstr = strings.TrimSpace(str)\n\t}\n\n\ti := 0\n\tdoSlash := false\n\n\tfor _, ch := range str {\n\t\tif doSlash {\n\t\t\tarry[i] = '/'\n\t\t\ti++\n\t\t}\n\t\tif ch == ' ' {\n\t\t\tch = '_'\n\t\t}\n\t\tif !unicode.IsLetter(ch) && !unicode.IsDigit(ch) {\n\t\t\tch = '_'\n\t\t}\n\t\tarry[i] = ch\n\t\ti++\n\t\tdoSlash = true\n\t}\n\n\treturn strings.ToLower(string(arry[:i]))\n}", "title": "" }, { "docid": "bba94cce9f0df04c22ff4edd3e5213cd", "score": "0.49995965", "text": "func newNode(stringId, start int) *node {\n\treturn &node{\n\t\tstr: substring{index: stringId, offset: start, length: inf},\n\t\tsuffix: nil,\n\t\tchildren: make(map[rune]*node),\n\t}\n}", "title": "" }, { "docid": "079a251410607523207df49e3b6bdf17", "score": "0.4995299", "text": "func New(branch int) (generator.Generator, error) {\n\tif branch < 1 {\n\t\treturn nil, fmt.Errorf(\"invalid branch factor %d\", branch)\n\t}\n\tnt, err := node.NewType(\"/tn\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tp, err := predicate.NewImmutable(\"parent_of\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &treeGenerator{\n\t\tbranch: branch,\n\t\tnodeType: nt,\n\t\tpredicate: p,\n\t}, nil\n}", "title": "" }, { "docid": "4001211f72a86c099c38ab37cfe88f91", "score": "0.49919498", "text": "func NewTribe(name string) *Tribe {\n\treturn &Tribe{\n\t\tID: helpers.IDGeneratorFunc(),\n\t\tName: name,\n\t}\n}", "title": "" }, { "docid": "4d48e3fd26028dbaf1e7b1614e86da17", "score": "0.4983846", "text": "func newSuffixTree() *suffixTree {\n t := new(suffixTree)\n t.root = newNode()\n return t\n}", "title": "" }, { "docid": "5f4aa07f28cd9ff689d2ae4240a4fae4", "score": "0.49833524", "text": "func (t *Trie) Add(entry string) {\n t.NumberOfEntries++\n t.addHelper(t.Root, entry)\n}", "title": "" }, { "docid": "f69bab08898f49b0432c5950b8253a28", "score": "0.49737495", "text": "func (t *Trie) newFlag() nodeFlag {\n\treturn nodeFlag{dirty: true, gen: t.cachegen}\n}", "title": "" }, { "docid": "546d3aebfb4569bc87a3f6849221d68b", "score": "0.49665368", "text": "func (this *Trie) Insert(word string) {\n n := len(word)\n current := this\n for i := 0; i < n; i++ {\n childIdx := byte(word[i] - 'a')\n if current.Children[childIdx] == nil {\n current.Children[childIdx] = &Trie{}\n }\n current = current.Children[childIdx]\n }\n current.isWordBoundary = true\n}", "title": "" }, { "docid": "5cd90e974211c9d802a9aadb8c01a699", "score": "0.49601975", "text": "func newNode() *node {\n n := new(node)\n n.children = make(map[rune]*node)\n n.word = \"\"\n n.group = -1\n return n\n}", "title": "" } ]
ac7d936db7be4d9ea9930073a0986797
NewMetadata instantiate the Metadata associated to the given struct It uses the `key` tag to do the mapping, more concrete examples are provided in the documentation
[ { "docid": "fc15e91c9799ee64021aac4815f4ee03", "score": "0.7134212", "text": "func newMetadata(element interface{}) *Metadata {\n\tm := make(map[string]string)\n\tt := reflect.TypeOf(element)\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tfield := t.Field(i)\n\t\tif tag := field.Tag.Get(\"key\"); tag != \"\" {\n\t\t\tm[field.Name] = tag\n\t\t}\n\t}\n\treturn &Metadata{\n\t\tm,\n\t}\n}", "title": "" } ]
[ { "docid": "02137df64cce9c5ed743d8fd119514b3", "score": "0.61943644", "text": "func NewMetadata(keys, values []string) Metadata {\n\treturn Metadata{arrow.NewMetadata(keys, values)}\n}", "title": "" }, { "docid": "47e022b60a223e638cbd01bd89c39b20", "score": "0.60050744", "text": "func NewMetadata(version *Version, envs map[string]string, resolver CommitResolver, now func() time.Time) (Metadata, error) {\n\tvar m Metadata\n\n\tswitch {\n\tcase envs[\"BUILDKITE\"] == \"true\":\n\t\tm = &buildkiteMetadata{}\n\tcase envs[\"CIRCLECI\"] == \"true\":\n\t\tm = &circleMetadata{}\n\tcase envs[\"GITHUB_ACTIONS\"] == \"true\":\n\t\tm = &githubMetadata{}\n\tcase envs[\"JENKINS_HOME\"] != \"\":\n\t\tm = &jenkinsMetadata{}\n\tcase envs[\"SEMAPHORE\"] == \"true\":\n\t\tm = &semaphoreMetadata{}\n\tcase envs[\"TRAVIS\"] == \"true\":\n\t\tm = &travisMetadata{}\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unrecognized environment: system does not appear to be a supported CI provider (Buildkite, CircleCI, GitHub Actions, Jenkins, Semaphore, or Travis CI)\")\n\t}\n\n\tif err := m.initEnvData(envs, resolver); err != nil {\n\t\treturn nil, err\n\t}\n\tm.initTimestamp(now)\n\tm.initVersionData(version)\n\n\treturn m, nil\n}", "title": "" }, { "docid": "60f27f30224393ddae3e03f8bd30e626", "score": "0.59799236", "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": "9a4eb1b49aea0e544c9557e72392c796", "score": "0.5907193", "text": "func NewMetadata() *Metadata {\n\tid := randomReadableString(IDLen)\n\tsecret := randomReadableString(SecretLen)\n\treturn &Metadata{\n\t\tID: id,\n\t\tSecret: secret,\n\t\tCreateDate: time.Now(),\n\t}\n}", "title": "" }, { "docid": "1cb8fe6e79f9661c0a36f3fe001d318d", "score": "0.58759964", "text": "func NewMetadata(host host.Host, messageID string, gossip bool) *pb.Metadata {\n\t// Add protobufs bin data for message author public key\n\t// this is useful for authenticating messages forwarded by a node authored by another node\n\tnodePubKey, err := host.Peerstore().PubKey(host.ID()).Bytes()\n\n\tif err != nil {\n\t\tpanic(\"Failed to get public key for sender from local peer store.\")\n\t}\n\n\treturn &pb.Metadata{\n\t\tClientVersion: utils.ClientVersion,\n\t\tNodeId: peer.IDB58Encode(host.ID()),\n\t\tNodePubKey: nodePubKey,\n\t\tTimestamp: time.Now().Unix(),\n\t\tId: messageID,\n\t\tGossip: gossip}\n}", "title": "" }, { "docid": "51d81c2366ed72c6ab5e8d2c1ac4f745", "score": "0.58529174", "text": "func NewMetadata(name, tipe, sep, leftq, rightq string, vs []string) (\n\tmd *Metadata,\n) {\n\tmd = &Metadata{\n\t\tName: name,\n\t\tType: tipe,\n\t\tSeparator: sep,\n\t\tLeftQuote: leftq,\n\t\tRightQuote: rightq,\n\t\tValueSpace: vs,\n\t}\n\n\tmd.Init()\n\n\treturn\n}", "title": "" }, { "docid": "2df7ad98215b50dff143ff995ea3afed", "score": "0.5832377", "text": "func NewMetadata() *Metadata {\n\tthis := Metadata{}\n\treturn &this\n}", "title": "" }, { "docid": "4814cf97ac8cd7581a57faa5aece85e5", "score": "0.58138317", "text": "func NewMetadata(cache Cache) *Meta {\n\treturn &Meta{\n\t\tDS: cache,\n\t}\n}", "title": "" }, { "docid": "cc8514b19cb0020c86576761f8f2c17b", "score": "0.5799067", "text": "func NewMetadata(fs afero.Fs, cacheDir string) Metadata {\n\tfilePath := MetadataPath(cacheDir)\n\treturn Metadata{\n\t\tfs: fs,\n\t\tfilePath: filePath,\n\t}\n}", "title": "" }, { "docid": "8f200507a82ebe7e0714635e0211f65f", "score": "0.5768646", "text": "func NewMetadataDef(id, md interface{}) (*ast.Metadata, error) {\n\ti, ok := id.(*ast.MetadataIDDummy)\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"invalid metadata ID type; expected *astx.MetadataID, got %T\", id)\n\t}\n\tm, ok := md.(*ast.Metadata)\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"invalid metadata type; expected *ast.Metadata, got %T\", md)\n\t}\n\tmetadata := &ast.Metadata{\n\t\tID: i.ID,\n\t\tNodes: m.Nodes,\n\t}\n\treturn metadata, nil\n}", "title": "" }, { "docid": "cabe280e26004d70f6ad5551cc887c7c", "score": "0.57105803", "text": "func NewMetadata(namespace, name string) Metadata {\n\treturn Metadata{\n\t\tName: name,\n\t\tNamespace: namespace,\n\t}\n}", "title": "" }, { "docid": "d8621fd57ff9613c7ecbd851cecfab25", "score": "0.5617151", "text": "func NewMetadata() *Metadata {\n\treturn &Metadata{C.meta_new()}\n}", "title": "" }, { "docid": "0ed03d08b389a11c2c389ab3eef2530f", "score": "0.5576388", "text": "func NewMetaData(metaDir string, capacity int) (*Metadata, error) {\n\tpath := filepath.Join(metaDir, metaName)\n\tmetaFile, err := segment.NewSegment(path, metaSize)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error in crating the Metadata memory mapped file: %v\", err)\n\t}\n\n\tm := &Metadata{\n\t\tmetaFile: metaFile,\n\t\tname: metaName,\n\t\tsize: metaSize,\n\t\tcapacity: capacity,\n\t}\n\n\tv := m.GetVersion()\n\tif v != 0 && v != metaVersion {\n\t\treturn nil, fmt.Errorf(\"metadata metaVersion is not matching, the Metadata metaVersion is %d\", v)\n\t}\n\tc := m.GetCapacity()\n\tif c != 0 && c != capacity {\n\t\treturn nil, fmt.Errorf(\"metadata catapacity is not equal to the old capacity, the old capacity is %d\", c)\n\t}\n\tm.PutVersion(metaVersion)\n\tm.PutCapacity(int64(capacity))\n\treturn m, nil\n}", "title": "" }, { "docid": "380abc8611a4de2679d48c7568481d52", "score": "0.5571094", "text": "func New(key string, value interface{}) Fields {\n\treturn Add(nil, key, value)\n}", "title": "" }, { "docid": "583a9f301c83e8a812a4c185c230b7ad", "score": "0.5465294", "text": "func (*kvR) NewStruct() *kvR {\n\treturn &kvR{}\n}", "title": "" }, { "docid": "f0f8e828f759d8764d448e4224316c74", "score": "0.53877074", "text": "func NewMetadataMapping() *MetadataMapping {\r\n\treturn &MetadataMapping{\r\n\t\tmdByName: make(map[string]Metadata),\r\n\t}\r\n}", "title": "" }, { "docid": "5ee78a3648c5e82a04345a5ba91778e9", "score": "0.5354545", "text": "func (ssekms) CreateMetadata(metadata map[string]string, keyID string, kmsKey []byte, sealedKey SealedKey, ctx kms.Context) map[string]string {\n\tif sealedKey.Algorithm != SealAlgorithm {\n\t\tlogger.CriticalIf(context.Background(), Errorf(\"The seal algorithm '%s' is invalid for SSE-S3\", sealedKey.Algorithm))\n\t}\n\n\t// There are two possibilites:\n\t// - We use a KMS -> There must be non-empty key ID and a KMS data key.\n\t// - We use a K/V -> There must be no key ID and no KMS data key.\n\t// Otherwise, the caller has passed an invalid argument combination.\n\tif keyID == \"\" && len(kmsKey) != 0 {\n\t\tlogger.CriticalIf(context.Background(), errors.New(\"The key ID must not be empty if a KMS data key is present\"))\n\t}\n\tif keyID != \"\" && len(kmsKey) == 0 {\n\t\tlogger.CriticalIf(context.Background(), errors.New(\"The KMS data key must not be empty if a key ID is present\"))\n\t}\n\n\tif metadata == nil {\n\t\tmetadata = make(map[string]string, 5)\n\t}\n\n\tmetadata[MetaAlgorithm] = sealedKey.Algorithm\n\tmetadata[MetaIV] = base64.StdEncoding.EncodeToString(sealedKey.IV[:])\n\tmetadata[MetaSealedKeyKMS] = base64.StdEncoding.EncodeToString(sealedKey.Key[:])\n\tif len(ctx) > 0 {\n\t\tb, _ := ctx.MarshalText()\n\t\tmetadata[MetaContext] = base64.StdEncoding.EncodeToString(b)\n\t}\n\tif len(kmsKey) > 0 && keyID != \"\" { // We use a KMS -> Store key ID and sealed KMS data key.\n\t\tmetadata[MetaKeyID] = keyID\n\t\tmetadata[MetaDataEncryptionKey] = base64.StdEncoding.EncodeToString(kmsKey)\n\t}\n\treturn metadata\n}", "title": "" }, { "docid": "74106a2d13fbeeccb1cb54cc4f2a51cf", "score": "0.52863395", "text": "func NewMetadata(nodes interface{}) (*ast.Metadata, error) {\n\tif nodes == nil {\n\t\treturn &ast.Metadata{}, nil\n\t}\n\tns, ok := nodes.([]ast.MetadataNode)\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"invalid metadata nodes type; expected []ast.MetadataNode, got %T\", nodes)\n\t}\n\tmetadata := &ast.Metadata{\n\t\tNodes: ns,\n\t}\n\treturn metadata, nil\n}", "title": "" }, { "docid": "3412f832d7d612cd3cda8c323997e213", "score": "0.5269125", "text": "func NewMetaTable(kv kv.MetaKv) (*metaTable, error) {\n\tmt := &metaTable{\n\t\tcatalog: &indexcoord.Catalog{\n\t\t\tTxn: kv,\n\t\t},\n\t\tindexLock: sync.RWMutex{},\n\t\tsegmentIndexLock: sync.RWMutex{},\n\t}\n\terr := mt.reloadFromKV()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn mt, nil\n}", "title": "" }, { "docid": "326385878b0f793728c7ca5cb7480bd6", "score": "0.5238633", "text": "func NewMetadata(c kube.Client, gvr schema.GroupVersionResource, filter Filter) Informer[*metav1.PartialObjectMetadata] {\n\topts := ToOpts(c, gvr, filter)\n\topts.InformerType = kubetypes.MetadataInformer\n\tinf := kubeclient.GetInformerFilteredFromGVR(c, opts, gvr)\n\treturn newInformerClient[*metav1.PartialObjectMetadata](inf, filter)\n}", "title": "" }, { "docid": "5212259c441ca5206a7014dc64f8e1ab", "score": "0.5229421", "text": "func newPluginMeta(path, fname, namespace, key string, plugin interface{}, opts ...PluginOption) *PluginMeta {\n\t// Construct the basic metadata\n\tmeta := &PluginMeta{\n\t\tPath: path,\n\t\tFilename: fname,\n\t\tNamespace: namespace,\n\t\tKey: key,\n\t\tPlugin: plugin,\n\t\tMeta: map[string]interface{}{},\n\t}\n\n\t// Apply all options\n\tfor _, opt := range opts {\n\t\topt(meta)\n\t}\n\n\treturn meta\n}", "title": "" }, { "docid": "39544f57d9beb989d2d662229d5476f3", "score": "0.5226188", "text": "func New() *KV {\n\treturn &KV{data: map[string]string{}}\n}", "title": "" }, { "docid": "b6cfaa908730af81c4c5858660fb1741", "score": "0.5213751", "text": "func generateMetaDataKey(parent *datastore.Key) *datastore.Key {\n\tkey := datastore.NameKey(models.MetaData, parent.Name, parent)\n\tkey.Namespace = \"chester\"\n\treturn key\n}", "title": "" }, { "docid": "0c46f33d4be94e6f60a785d51a456d9d", "score": "0.51826507", "text": "func New(intf interface{}) Key {\n\tswitch t := intf.(type) {\n\tcase map[string]interface{}:\n\t\treturn composite{sentinel, t}\n\tcase int8, int16, int32, int64,\n\t\tuint8, uint16, uint32, uint64,\n\t\tfloat32, float64, string, bool,\n\t\tvalue.Value:\n\t\treturn keyImpl{key: intf}\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid type for key: %T\", intf))\n\t}\n}", "title": "" }, { "docid": "5a1c5d8cb518eece741f76891d7b7f2e", "score": "0.516132", "text": "func NewTag(key string, value string) (Tag, error) {\n\tif key == \"\" {\n\t\treturn nil, ErrNoTagKey\n\t}\n\n\treturn tag{\n\t\tkey: key,\n\t\tvalue: value,\n\t}, nil\n}", "title": "" }, { "docid": "abf55f48d21d8fa3e037921882210002", "score": "0.5096761", "text": "func NewKopsMetadata(metadataBytes []byte) (*KopsMetadata, error) {\n\t// Check if length of metadata is 0 as opposed to if the value is nil. This\n\t// is done to avoid an issue encountered where the metadata value provided\n\t// had a length of 0, but had non-zero capacity.\n\tif len(metadataBytes) == 0 || string(metadataBytes) == \"null\" {\n\t\t// TODO: remove \"null\" check after sqlite is gone.\n\t\treturn nil, nil\n\t}\n\n\tkopsMetadata := KopsMetadata{}\n\terr := json.Unmarshal(metadataBytes, &kopsMetadata)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &kopsMetadata, nil\n}", "title": "" }, { "docid": "69dd1bce4e0acdd4ba7ee69adf7ce936", "score": "0.5073796", "text": "func newEntry(k Key, v interface{}) Entry {\n\treturn &entry{\n\t\tk: k,\n\t\tv: v,\n\t}\n}", "title": "" }, { "docid": "eebcd92ac835af9733d201a0f12ef4d8", "score": "0.50719595", "text": "func New(keyName, sigType string, hash crypto.Hash) *Info {\n\ta := make(map[string]interface{})\n\ta[\"sig.type\"] = sigType\n\ta[\"sig.keyname\"] = keyName\n\ta[\"sig.hash\"] = x509tools.HashNames[hash]\n\ta[\"sig.timestamp\"] = time.Now().UTC()\n\tif hostname, _ := os.Hostname(); hostname != \"\" {\n\t\ta[\"sig.hostname\"] = hostname\n\t}\n\tfor _, env := range os.Environ() {\n\t\tif !strings.HasPrefix(env, \"RELIC_ATTR_\") {\n\t\t\tcontinue\n\t\t}\n\t\tenv = env[11:]\n\t\ti := strings.Index(env, \"=\")\n\t\tif i < 0 {\n\t\t\tcontinue\n\t\t}\n\t\tk, v := env[:i], env[i+1:]\n\t\ta[k] = v\n\t}\n\treturn &Info{a, nil, nil}\n}", "title": "" }, { "docid": "0daa4e36a0abad85eb7b9191eb9e17c6", "score": "0.505262", "text": "func NewMetadataFrom(reader io.Reader) (Metadata, error) {\n\tb, err := ioutil.ReadAll(reader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar result localMetadata\n\tif err := json.Unmarshal(b, &result); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &result, nil\n}", "title": "" }, { "docid": "a2cc69da9a30176f86917d004b98eb3b", "score": "0.50525385", "text": "func (s *Segment) addMetadata(key string, value interface{}) {\n\ts.Lock()\n\tdefer s.Unlock()\n\n\tif s.Metadata == nil {\n\t\ts.Metadata = make(map[string]map[string]interface{})\n\t\ts.Metadata[\"default\"] = make(map[string]interface{})\n\t}\n\ts.Metadata[\"default\"][key] = value\n}", "title": "" }, { "docid": "9ea5919c1a1875158a476242f218264c", "score": "0.50304407", "text": "func newMetric(keyLen int) *Metric {\n\treturn &Metric{\n\t\tKeys: make([]string, keyLen),\n\t\tLabelValues: make([]*LabelValue, 0),\n\t\tlabelValuesMap: make(map[string]*LabelValue),\n\t}\n}", "title": "" }, { "docid": "77dfc6c01ce1cc6d590a4c999ded0167", "score": "0.502732", "text": "func NewMetaDataPairs(kv ...string) MetaData {\n\tif len(kv)%2 == 1 {\n\t\tpanic(fmt.Errorf(\"NewMetaDataPairs: got odd number of kv strings\"))\n\t}\n\tmd := MetaData{}\n\tfor i := 0; i < len(kv); i += 2 {\n\t\tmd[kv[i]] = [][]byte{[]byte(kv[i+1])}\n\t}\n\treturn md\n}", "title": "" }, { "docid": "b99f7d79ebde98a51c79bdf86e5cb585", "score": "0.50250727", "text": "func NewMetadataCmd(ec *cli.ExecutionContext) *cobra.Command {\n\tv := viper.New()\n\tmetadataCmd := &cobra.Command{\n\t\tUse: \"metadata\",\n\t\tAliases: []string{\"md\"},\n\t\tShort: \"Manage Hasura GraphQL Engine metadata saved in the database\",\n\t\tPersistentPreRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcmd.Root().PersistentPreRun(cmd, args)\n\t\t\tec.Viper = v\n\t\t\terr := ec.Prepare()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn ec.Validate()\n\t\t},\n\t\tSilenceUsage: true,\n\t}\n\tmetadataCmd.AddCommand(\n\t\tnewMetadataDiffCmd(ec),\n\t\tnewMetadataExportCmd(ec),\n\t\tnewMetadataClearCmd(ec),\n\t\tnewMetadataReloadCmd(ec),\n\t\tnewMetadataApplyCmd(ec),\n\t\tnewMetadataInconsistencyCmd(ec),\n\t)\n\n\tf := metadataCmd.PersistentFlags()\n\n\tf.String(\"endpoint\", \"\", \"http(s) endpoint for Hasura GraphQL Engine\")\n\tf.String(\"admin-secret\", \"\", \"admin secret for Hasura GraphQL Engine\")\n\tf.String(\"access-key\", \"\", \"access key for Hasura GraphQL Engine\")\n\tf.MarkDeprecated(\"access-key\", \"use --admin-secret instead\")\n\n\tutil.BindPFlag(v, \"endpoint\", f.Lookup(\"endpoint\"))\n\tutil.BindPFlag(v, \"admin_secret\", f.Lookup(\"admin-secret\"))\n\tutil.BindPFlag(v, \"access_key\", f.Lookup(\"access-key\"))\n\n\treturn metadataCmd\n}", "title": "" }, { "docid": "7ce153a5be97fd19bd2c7140820c2698", "score": "0.5019944", "text": "func NewMeta(name string, value string) Meta {\n\t// TODO: implement add Meta using dbr\n\treturn Meta{}\n}", "title": "" }, { "docid": "91f9688bfabb3f5883953e16d73b5ca0", "score": "0.5007088", "text": "func (p *PromotionCodeParams) AddMetadata(key string, value string) {\n\tif p.Metadata == nil {\n\t\tp.Metadata = make(map[string]string)\n\t}\n\n\tp.Metadata[key] = value\n}", "title": "" }, { "docid": "3aaaefde71a2e5752b03dd0e1aaebcd0", "score": "0.5004852", "text": "func NewTag(key string, value string) tag.Tag {\n\treturn tag.Tag{\n\t\tKey: tag.MustNewKey(key),\n\t\tValue: value,\n\t}\n}", "title": "" }, { "docid": "b76737d73734feace62b81a46a7829ce", "score": "0.4975006", "text": "func (p *Params) AddMetadata(key, value string) {\n\tif p.Metadata == nil {\n\t\tp.Metadata = make(map[string]string)\n\t}\n\n\tp.Metadata[key] = value\n}", "title": "" }, { "docid": "07d98e407aec047123915302300bfe6b", "score": "0.4970044", "text": "func (c *Client) Meta(key, value string) PublishOpt {\n\treturn func(p *Publication) error {\n\t\tif p.Entry.Meta == nil {\n\t\t\tp.Entry.Meta = map[string]string{}\n\t\t}\n\t\tp.Entry.Meta[key] = value\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "39565436060078d207be1260aa55f5c6", "score": "0.49517512", "text": "func NewMockKeyMetadata(ctrl *gomock.Controller) *MockKeyMetadata {\n\tmock := &MockKeyMetadata{ctrl: ctrl}\n\tmock.recorder = &MockKeyMetadataMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "2429e4fe999d92d7b3c0aa700f0a0f31", "score": "0.4950142", "text": "func (d *TemplateDescriptor) Create(key string, value *model.Template) (metadata interface{}, err error) {\n\td.log.Infof(\"New Data, Key: %q Value: %+v\", key, value)\n\treturn nil, nil\n}", "title": "" }, { "docid": "db5ee2f9804165c992bcf4310a701e27", "score": "0.4941863", "text": "func NewStructFromKey(key *Key) *KeyStructure {\n\treturn &KeyStructure{\n\t\tKey: key.key,\n\t\tIndex: key.index,\n\t}\n}", "title": "" }, { "docid": "fb28d429242dc087f365219b1093f630", "score": "0.49270365", "text": "func CreateOrUpdateMeta(key string, value string) (sql.Result, error) {\n\tvar m *Meta\n\tcxt := context.GetContext()\n\tconn, _ := dbr.Open(cxt.GetConf().DBType, cxt.GetConf().GetDSN(), nil)\n\tsess := conn.NewSession(nil)\n\tdefer sess.Close()\n\tsess.Select(\"name\", \"value\", \"created_at\").From(\"meta\").Where(\"name = ?\", key).Load(&m)\n\tif m != nil {\n\t\treturn sess.InsertInto(\"meta\").Columns(\"name\", \"value\").Values(key, value).Exec()\n\t}\n\treturn sess.Update(\"meta\").Set(\"name\", key).Set(\"value\", value).Exec()\n}", "title": "" }, { "docid": "fecd9228f4f50a6acfd5339577dfb6d3", "score": "0.49251738", "text": "func NewKeyValue() Data {\r\n\treturn Data{}\r\n}", "title": "" }, { "docid": "44212bf5306a78ba46f9b98628630c7e", "score": "0.4913636", "text": "func (k *Tag) New() label.Label { return label.OfValue(k, nil) }", "title": "" }, { "docid": "8aea321a542395536fa80b613be1b1de", "score": "0.49009493", "text": "func (c *jsiiProxy_CfnApiMappingV2) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "49c75a4aeefa4781375d495a608f8fa6", "score": "0.48993522", "text": "func (c *jsiiProxy_CfnModelV2) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "65671f68eeb569508224c49f12e42c58", "score": "0.48906186", "text": "func (rpm *testRpmImpl) SetMetadata(key string, data string) error { return nil }", "title": "" }, { "docid": "d2b6e6199c734c097b2eb3775c246b55", "score": "0.4887302", "text": "func CreateObjMetadata(namespace string, name string, gk schema.GroupKind) (*ObjMetadata, error) {\n\t// Namespace can be empty, but name cannot.\n\tname = strings.TrimSpace(name)\n\tif name == \"\" {\n\t\treturn nil, fmt.Errorf(\"empty name for inventory object\")\n\t}\n\tif gk.Empty() {\n\t\treturn nil, fmt.Errorf(\"empty GroupKind for inventory object\")\n\t}\n\n\treturn &ObjMetadata{\n\t\tNamespace: strings.TrimSpace(namespace),\n\t\tName: name,\n\t\tGroupKind: gk,\n\t}, nil\n}", "title": "" }, { "docid": "f8781374b1a29b3efc07d2f7bb519404", "score": "0.48820266", "text": "func (c *jsiiProxy_CfnModel) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "c8b94a5fec20f83d3b3f8f96d2966e67", "score": "0.4880462", "text": "func (c *jsiiProxy_CfnTemplate) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "a356ea862a27e3c2ce8e80866144818c", "score": "0.48733768", "text": "func NewMetadataProvider(cluster string, providerId string, changeCh chan bool, statsCh chan map[c.IndexInstId]map[c.PartitionId]c.Statistics,\n\tsettings Settings) (s *MetadataProvider, err error) {\n\n\ts = new(MetadataProvider)\n\ts.clusterUrl = cluster\n\ts.watchers = make(map[c.IndexerId]*watcher)\n\ts.pendings = make(map[c.IndexerId]chan bool)\n\ts.repo = newMetadataRepo(s)\n\ts.timeout = int64(time.Second) * 120\n\ts.metaNotifyCh = changeCh\n\ts.statsNotifyCh = statsCh\n\ts.settings = settings\n\n\ts.providerId = providerId\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlogging.Debugf(\"MetadataProvider.NewMetadataProvider(): MetadataProvider follower ID %s\", s.providerId)\n\n\tcinfo, err := c.FetchNewClusterInfoCache(cluster, c.DEFAULT_POOL, \"NewMetaDataProvider\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.clusterVersion = cinfo.GetClusterVersion()\n\n\treturn s, nil\n}", "title": "" }, { "docid": "4fa4fac196d153d05f608df9aeee0fcd", "score": "0.48672652", "text": "func New(baseDir string) (Persister, error) {\n\tlocalDir, err := ioutil.TempDir(baseDir, \"kopia-local-metadata-\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsnap, err := kopiarunner.NewKopiaSnapshotter(localDir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpersistenceDir, err := ioutil.TempDir(localDir, \"kopia-persistence-root\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &kopiaMetadata{\n\t\tlocalMetadataDir: localDir,\n\t\tpersistenceDir: persistenceDir,\n\t\tSimple: NewSimple(),\n\t\tsnap: snap,\n\t}, nil\n}", "title": "" }, { "docid": "929da3543d964f9afe0d184e5f728b3e", "score": "0.48653775", "text": "func NewParam(key string, value interface{}) *KV {\n\treturn &KV{key, value}\n}", "title": "" }, { "docid": "034fdc2d6a67c0c019389b63ff3d040c", "score": "0.48647484", "text": "func (p *Payout) AddMetadata(key, value string) {\n\tp.Metadata[key] = value\n}", "title": "" }, { "docid": "300adc862a994470671a50060f3c4797", "score": "0.48516896", "text": "func metaFromProfileKey(schemaV, key string) (meta profile.Meta, err error) {\n\tif !strings.HasPrefix(key, schemaV) {\n\t\treturn meta, fmt.Errorf(\"invalid key format %q: schema version mismatch, want %s\", key, schemaV)\n\t}\n\n\t// create profile ID from the original object's key\n\tpid := profile.ID(key)\n\n\tkey = strings.TrimPrefix(key, schemaV)\n\tks := strings.SplitN(key, \"/\", 3)\n\tif len(ks) != 3 {\n\t\treturn meta, fmt.Errorf(\"invalid key format %q\", key)\n\t}\n\n\tservice, pt, tail := ks[0], ks[1], ks[2]\n\n\tv, _ := strconv.Atoi(pt)\n\tptype := profile.ProfileType(v)\n\tif ptype == profile.TypeUnknown {\n\t\treturn profile.Meta{}, fmt.Errorf(\"could not parse profile type %q, key %q\", pt, key)\n\t}\n\n\tks = strings.SplitN(tail, \",\", 2)\n\tvar dgst, lbls string\n\tif len(ks) == 1 {\n\t\tdgst = ks[0]\n\t} else {\n\t\tdgst, lbls = ks[0], ks[1]\n\t}\n\n\tdigest, err := xid.FromString(dgst)\n\tif err != nil {\n\t\treturn meta, fmt.Errorf(\"could not parse digest, key %q: %w\", key, err)\n\t}\n\n\tvar labels profile.Labels\n\tif err := labels.FromString(lbls); err != nil {\n\t\treturn meta, fmt.Errorf(\"could not parse labels, key %q: %w\", key, err)\n\t}\n\n\tmeta = profile.Meta{\n\t\tProfileID: pid,\n\t\tService: service,\n\t\tType: ptype,\n\t\tLabels: labels,\n\t\tCreatedAt: digest.Time().UTC(),\n\t}\n\treturn meta, nil\n}", "title": "" }, { "docid": "d264b0a73a90a9c10033f5578e5d7b66", "score": "0.4837218", "text": "func newMetadataRepo(provider *MetadataProvider) *metadataRepo {\n\n\treturn &metadataRepo{\n\t\tdefinitions: make(map[c.IndexDefnId]*c.IndexDefn),\n\t\tinstances: make(map[c.IndexDefnId]map[c.IndexInstId]map[c.PartitionId]map[uint64]*mc.IndexInstDistribution),\n\t\tindices: make(map[c.IndexDefnId]*IndexMetadata),\n\t\ttopology: make(map[c.IndexerId]map[c.IndexDefnId]bool),\n\t\tversion: uint64(0),\n\t\tprovider: provider,\n\t\tnotifiers: make(map[c.IndexDefnId]*event),\n\t}\n}", "title": "" }, { "docid": "03dece49e7d67f716fc34e030f9eeecb", "score": "0.48356363", "text": "func NewMetadata(application application.Application, logger logger.Logger) (Metadata, bool, error) {\n\tmd := Metadata{}\n\n\tm, err := manifest.NewManifest(application, logger)\n\tif err != nil {\n\t\treturn Metadata{}, false, err\n\t}\n\n\tif err := m.Decode(&md); err != nil {\n\t\treturn Metadata{}, false, err\n\t}\n\n\tif md.MainClass == \"\" {\n\t\treturn Metadata{}, false, nil\n\t}\n\n\tmd.ClassPath = []string{application.Root}\n\treturn md, true, nil\n}", "title": "" }, { "docid": "e00b2eb86fcf41ae9a29f10dd2467fcf", "score": "0.48156014", "text": "func (c *jsiiProxy_CfnApiV2) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "10446dc64e92864750170cbfc7c0706f", "score": "0.48117134", "text": "func New(m Metadata) *Table { // nolint: gocritic\n\tt := &Table{\n\t\tmetadata: m,\n\t}\n\n\t// prepare primary and partition key comparators\n\tt.primaryKeyCmp = make([]qb.Cmp, 0, len(m.PartKey)+len(m.SortKey))\n\tfor _, k := range m.PartKey {\n\t\tt.primaryKeyCmp = append(t.primaryKeyCmp, qb.Eq(k))\n\t}\n\tfor _, k := range m.SortKey {\n\t\tt.primaryKeyCmp = append(t.primaryKeyCmp, qb.Eq(k))\n\t}\n\tt.partKeyCmp = make([]qb.Cmp, len(m.PartKey))\n\tcopy(t.partKeyCmp, t.primaryKeyCmp[:len(t.metadata.PartKey)])\n\n\t// prepare get stmt\n\tt.get.stmt, t.get.names = qb.Select(m.Name).Where(t.primaryKeyCmp...).ToCql()\n\t// prepare select stmt\n\tt.sel.stmt, t.sel.names = qb.Select(m.Name).Where(t.partKeyCmp...).ToCql()\n\t// prepare insert stmt\n\tt.insert.stmt, t.insert.names = qb.Insert(m.Name).Columns(m.Columns...).ToCql()\n\n\treturn t\n}", "title": "" }, { "docid": "7657b4c98bd45b198fc605b7f524a363", "score": "0.48077303", "text": "func NewMetadataValue(node interface{}) (ast.MetadataNode, error) {\n\tswitch n := node.(type) {\n\tcase *ast.LocalDummy:\n\t\treturn &ast.MetadataValue{X: n}, nil\n\tcase ast.Constant:\n\t\treturn &ast.MetadataValue{X: n}, nil\n\tcase ast.MetadataNode:\n\t\treturn n, nil\n\tdefault:\n\t\treturn nil, errors.Errorf(\"invalid metadata node type; expected ast.MetadataNode, got %T\", node)\n\t}\n}", "title": "" }, { "docid": "552d3969e1f7520da3f5464b715821eb", "score": "0.47968334", "text": "func (c *jsiiProxy_CfnSimpleAD) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "e103a20d647b95d36812cc264fa40a54", "score": "0.47950453", "text": "func (c *jsiiProxy_CfnAgent) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "ec68abdf4202fb426c0632f1d730a9f6", "score": "0.47858664", "text": "func createMetadata(name string, legacy bool, fullCollName string) *commandMetadata {\n\treturn &commandMetadata{\n\t\tName: name,\n\t\tTime: time.Now(),\n\t\tLegacy: legacy,\n\t\tFullCollectionName: fullCollName,\n\t}\n}", "title": "" }, { "docid": "02dca820b6b3b77876de84561232a5f6", "score": "0.47821662", "text": "func (s *Segment) AddMetadata(key string, value string) {\n\ts.addMetadata(key, value)\n}", "title": "" }, { "docid": "1934ce9238fcb8693fdc3f4b933d61c4", "score": "0.4772499", "text": "func (c *jsiiProxy_CfnApiKey) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "feb4ded1f013e20fecb39324b2266c39", "score": "0.47697774", "text": "func (gen *generator) metadataDefFromID(old ast.MetadataID) (metadata.Definition, error) {\n\tid := metadataID(old)\n\tnode, ok := gen.new.metadataDefs[id]\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"unable to locate metadata ID %q\", enc.MetadataID(id))\n\t}\n\treturn node, nil\n}", "title": "" }, { "docid": "a887ef2724e399d33fe30c4b5274ee46", "score": "0.47688514", "text": "func (c *jsiiProxy_CfnProvisioningTemplate) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "ed67a3ade318f45b24afe198d655ac4c", "score": "0.4759378", "text": "func NewMetadataImport(ctx *pulumi.Context,\n\tname string, args *MetadataImportArgs, opts ...pulumi.ResourceOption) (*MetadataImport, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.MetadataImportId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'MetadataImportId'\")\n\t}\n\tif args.ServiceId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ServiceId'\")\n\t}\n\tvar resource MetadataImport\n\terr := ctx.RegisterResource(\"google-native:metastore/v1alpha:MetadataImport\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "c5e69f3ef964b9408e26410ef88edabd", "score": "0.4753152", "text": "func (c *jsiiProxy_CfnTargetGroup) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "1b3239296913ba6795847d43990feeec", "score": "0.4751823", "text": "func (c *jsiiProxy_CfnPublisher) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "7f39cda11e4b2e03a50c7009e176aab7", "score": "0.47510016", "text": "func (c *jsiiProxy_CfnDocumentationPart) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "6e90b4835ebcf5c41fbdf424579b2ad1", "score": "0.47508633", "text": "func NewMetadataFromReader(r io.Reader, buildContextDirectory string) (*Metadata, error) {\n\tvar imageAndTag string\n\tsubstitutionArgs := []string{}\n\n\t// Parse the Dockerfile.\n\tparsed, err := parser.Parse(bufio.NewReader(r))\n\tif err != nil {\n\t\tlog.Errorf(\"Could not parse Dockerfile: %v\", err)\n\t\tif strings.Contains(err.Error(), \"file with no instructions\") {\n\t\t\treturn nil, ErrEmptyDockerfile\n\t\t}\n\t\treturn nil, ErrInvalidDockerfile\n\t}\n\n\tast := parsed.AST\n\tif len(ast.Children) == 0 {\n\t\treturn nil, ErrEmptyDockerfile\n\t}\n\n\tfirst_cmd := strings.ToLower(ast.Children[0].Value)\n\n\t// Make sure the first command is either FROM or ARG\n\tif first_cmd != \"arg\" && first_cmd != \"from\" {\n\t\treturn nil, ErrDockerfileMissingFROMorARG\n\t}\n\n\tstages, metaArgs, _ := instructions.Parse(ast)\n\tif first_cmd == \"arg\" {\n\t\tfor _, metaArg := range metaArgs {\n\t\t\tfor _, arg := range metaArg.Args {\n\t\t\t\tif arg.Value != nil {\n\t\t\t\t\tsubstitutionArgs = append(substitutionArgs, arg.Key+\"=\"+*arg.Value)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tshlex := shell.NewLex(parsed.EscapeToken)\n\t\timageAndTag, _ = shlex.ProcessWord(stages[0].BaseName, substitutionArgs)\n\n\t} else if first_cmd == \"from\" {\n\t\timageAndTag = stages[0].BaseName\n\t}\n\n\tref, err := reference.Parse(imageAndTag)\n\tif err != nil {\n\t\treturn nil, ErrInvalidBaseImage\n\t}\n\n\t// Parse the image name.\n\tvar image string\n\tnamed, ok := ref.(reference.Named)\n\tif !ok {\n\t\treturn nil, ErrInvalidBaseImage\n\t}\n\timage = named.Name()\n\n\t// Attempt to parse the tag name.\n\tvar tag string\n\tnametag, ok := ref.(reference.NamedTagged)\n\tif ok {\n\t\ttag = nametag.Tag()\n\t}\n\tif tag == \"\" {\n\t\ttag = \"latest\"\n\t}\n\n\treturn &Metadata{\n\t\tBaseImage: image,\n\t\tBaseImageTag: tag,\n\t}, nil\n}", "title": "" }, { "docid": "8c6a7d7ad0414d27b93635db0aa9bfae", "score": "0.47492704", "text": "func (d *SteeringDescriptor) Create(key string, steering *srv6.Steering) (metadata interface{}, err error) {\n\tif err := d.srHandler.AddSteering(steering); err != nil {\n\t\tname, valid := srv6.ModelSteering.ParseKey(key)\n\t\tif !valid {\n\t\t\tname = fmt.Sprintf(\"(key %v)\", key)\n\t\t}\n\t\treturn nil, errors.Errorf(\"failed to add steering %s: %v\", name, err)\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "6c196bc305e087ef9f0a44fca512280d", "score": "0.47460458", "text": "func (c *jsiiProxy_CfnDocumentationVersion) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "b2c76b6e28693091f11214def568d371", "score": "0.47452343", "text": "func (c *jsiiProxy_CfnStack) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "a2db92c763d009a9ee3948943002215d", "score": "0.47425133", "text": "func (c *jsiiProxy_CfnProject) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "9258505bab32fe2732848962ab543439", "score": "0.47418967", "text": "func newTableInfo(src interface{}) *tableInfo {\n\tsrcType := reflect.TypeOf(src)\n\ttableName := getTableNameFromTypeName(srcType)\n\tv := reflect.Indirect(reflect.ValueOf(src))\n\tt := v.Type()\n\n\tvar pkName string\n\tvar pkIndex int\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tfield := t.Field(i)\n\t\tpk := field.Tag.Get(\"pk\")\n\t\tif pk == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tpkName = field.Name\n\t\tpkIndex = i\n\t}\n\n\tpk := pk{\n\t\tName: camelToSnake(pkName),\n\t\tIndex: pkIndex,\n\t}\n\n\treturn &tableInfo{\n\t\tName: tableName,\n\t\tPk: pk,\n\t\tColumnValue: v,\n\t\tColumnInfo: t,\n\t}\n}", "title": "" }, { "docid": "29c7df31810f83273ebd8b4eb7a5ef1d", "score": "0.47410244", "text": "func (c *jsiiProxy_CfnPublicTypeVersion) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "44e97a6282b9d98fd9be2a5d71b02952", "score": "0.47382405", "text": "func (c *jsiiProxy_CfnUsagePlanKey) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "50786894e20c3421600beeeb25476744", "score": "0.47366658", "text": "func (tracer Tracer) AddMetadata(ctx context.Context, key string, value interface{}) error {\n\treturn xray.AddMetadata(ctx, key, value)\n}", "title": "" }, { "docid": "36f75697ef217cee4ca3292955938884", "score": "0.47363636", "text": "func (c *jsiiProxy_CfnThing) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "df789a80b4770a7bf71804957ecab47a", "score": "0.4729995", "text": "func (s *Subscription) AddMetadata(key, value string) {\n\ts.Metadata[key] = value\n}", "title": "" }, { "docid": "dd301c2fe2dd3081aeca65280df2b419", "score": "0.47236213", "text": "func NewKeyFromStruct(structure *KeyStructure, kdf kdf.HKDF) *Key {\n\treturn NewKey(\n\t\tkdf,\n\t\tstructure.Key,\n\t\tstructure.Index,\n\t)\n}", "title": "" }, { "docid": "f7aeb11aea3f2ffa2d9550a3e212de74", "score": "0.4721813", "text": "func (c *jsiiProxy_CfnMacro) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "1b3f7e89689e4831cd2fae64af69ef3f", "score": "0.47154132", "text": "func CreateObjMetadata(namespace string, name string, gk schema.GroupKind) (ObjMetadata, error) {\n\t// Namespace can be empty, but name cannot.\n\tname = strings.TrimSpace(name)\n\tif name == \"\" {\n\t\treturn ObjMetadata{}, fmt.Errorf(\"empty name for object\")\n\t}\n\t// Manually validate name, since by the time k8s reports the error\n\t// the invalid name has already been encoded into the inventory object.\n\tif !validateNameChars(name) {\n\t\treturn ObjMetadata{}, fmt.Errorf(\"invalid characters in object name: %s\", name)\n\t}\n\tif gk.Empty() {\n\t\treturn ObjMetadata{}, fmt.Errorf(\"empty GroupKind for object\")\n\t}\n\treturn ObjMetadata{\n\t\tNamespace: strings.TrimSpace(namespace),\n\t\tName: name,\n\t\tGroupKind: gk,\n\t}, nil\n}", "title": "" }, { "docid": "425b39f5deedefe66eacfc06143be551", "score": "0.4713212", "text": "func (f *FSM) SetMetadata(key string, dataValue interface{}) {\n\tf.metadataMu.Lock()\n\tdefer f.metadataMu.Unlock()\n\tf.metadata[key] = dataValue\n}", "title": "" }, { "docid": "c1e12ecc423b898cd8134078c9f92389", "score": "0.47085193", "text": "func NewTag()(*Tag) {\n m := &Tag{\n Entity: *iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.NewEntity(),\n }\n return m\n}", "title": "" }, { "docid": "d4b855ff018aaf9987a59ed4973b3f74", "score": "0.47080716", "text": "func (b *bow) SetMetadata(key, value string) Bow {\n\tm := b.Metadata()\n\tm = m.Set(key, value)\n\treturn &bow{Record: array.NewRecord(\n\t\tarrow.NewSchema(b.Schema().Fields(), &m.Metadata),\n\t\tb.Columns(),\n\t\tb.Record.NumRows())}\n}", "title": "" }, { "docid": "d851464bcab226425f06a9fdededeb1a", "score": "0.47064802", "text": "func newMetadataPersistenceV2(cfg config.Cassandra, currentClusterName string, logger log.Logger) (p.MetadataStore, error) {\n\tcluster := cassandra.NewCassandraCluster(cfg)\n\tcluster.ProtoVersion = cassandraProtoVersion\n\tcluster.Consistency = gocql.LocalQuorum\n\tcluster.SerialConsistency = gocql.LocalSerial\n\tcluster.Timeout = defaultSessionTimeout\n\n\tsession, err := cluster.CreateSession()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &cassandraMetadataPersistenceV2{\n\t\tcassandraStore: cassandraStore{session: session, logger: logger},\n\t\tcurrentClusterName: currentClusterName,\n\t}, nil\n}", "title": "" }, { "docid": "dfbd15afb1e4518fb5ff54389defd29b", "score": "0.47061446", "text": "func (m *Metadata) Set(newKey, newValue string) Metadata {\n\tkeys := m.Keys()\n\tvalues := m.Values()\n\tkeyIndex := m.FindKey(newKey)\n\n\tif keyIndex == -1 {\n\t\tkeys = append(keys, newKey)\n\t\tvalues = append(values, newValue)\n\t} else {\n\t\tvalues[keyIndex] = newValue\n\t}\n\n\treturn Metadata{arrow.NewMetadata(keys, values)}\n}", "title": "" }, { "docid": "ad95c321e648f2820e274ad97f47f0f7", "score": "0.46929473", "text": "func (c *jsiiProxy_CfnSchema) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "3e8b3b8cfa86eb4764bcc524fe88da83", "score": "0.46848387", "text": "func NewKey(c echo.Context) error {\n if c.QueryParam(\"authenticater\") == \"\" {\n return c.JSON(http.StatusBadRequest, \"Invalid Authenticator ID\")\n }\n // Generate new key\n key := KeyData {\n AuthKey: GenerateAuthKey(),\n Authenticater: c.QueryParam(\"authenticater\"),\n Expires: time.Now().Add(time.Hour*24),\n }\n // Store in DB\n err := db.Update(func (tx *bolt.Tx) {\n b, err := tx.CreateBucket(key.AuthKey)\n if err != nil {\n return c.JSON(http.StatusConflict, \"Key already exist. Please try again.\")\n }\n\n b.Put(authenticater_bucket_key, []byte(key.Authenticater))\n b.Put(expires_bucket_key, []byte(key.Expires.Format(time.RFC3339)))\n return nil\n })\n\n if err != nil {\n return err\n }\n\n // Return to requester\n return c.JSON(http.StatusOK, key)\n}", "title": "" }, { "docid": "16f04b8861c425af764f7d952880ceab", "score": "0.46812654", "text": "func (kevt *Kevent) AddMeta(k MetadataKey, v any) {\n\tkevt.Metadata[k] = v\n}", "title": "" }, { "docid": "b372f8a0c3bcf4430d435f5f8cba3da3", "score": "0.4678176", "text": "func (*CreateTagKeyMetadata) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_resourcemanager_v3_tag_keys_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "7a39e336d8233473c61858bfb20157ee", "score": "0.4675912", "text": "func NewKey(kind string, id string) Key {\n\treturn &key{id, kind}\n}", "title": "" }, { "docid": "3cfcd8bb799bdbd131a751ee8799ccfc", "score": "0.46747813", "text": "func NewTagKey(ctx *pulumi.Context,\n\tname string, args *TagKeyArgs, opts ...pulumi.ResourceOption) (*TagKey, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.Parent == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Parent'\")\n\t}\n\tif args.ShortName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ShortName'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource TagKey\n\terr := ctx.RegisterResource(\"gcp:tags/tagKey:TagKey\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "15e4941b1d889127fa128b15562fc3ca", "score": "0.46709353", "text": "func (c *jsiiProxy_CfnVpcLink) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "1d8b62286d52a7c23be0af910baa154d", "score": "0.46665162", "text": "func newMetadataConfigfromConfig(cfg *Config) metadata.PusherConfig {\n\treturn metadata.PusherConfig{\n\t\tConfigHostname: cfg.Hostname,\n\t\tConfigTags: cfg.HostMetadata.Tags,\n\t\tMetricsEndpoint: cfg.Metrics.Endpoint,\n\t\tAPIKey: cfg.API.Key,\n\t\tUseResourceMetadata: cfg.HostMetadata.HostnameSource == HostnameSourceFirstResource,\n\t\tInsecureSkipVerify: cfg.TLSSetting.InsecureSkipVerify,\n\t\tTimeoutSettings: cfg.TimeoutSettings,\n\t\tRetrySettings: cfg.RetrySettings,\n\t}\n}", "title": "" }, { "docid": "c3720452dff739fd535bdcd8d61c725e", "score": "0.46638304", "text": "func NewMetadataString(val interface{}) (*ast.MetadataString, error) {\n\tv, err := getTokenString(val)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\tv = enc.Unquote(v)\n\treturn &ast.MetadataString{Val: v}, nil\n}", "title": "" }, { "docid": "3297673566ae2b0fd341f6346606b512", "score": "0.46621025", "text": "func (c *jsiiProxy_CfnStageV2) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" } ]
9d655dded48f3411b2b1ed6caa279f27
GetCharacteristics returns all characteristics of a given dish.
[ { "docid": "80663c184820247f6147446dce1933a8", "score": "0.8131482", "text": "func (s *Service) GetCharacteristics(dishID uint64) ([]Characteristic, error) {\n\tcharacteristicEntities, err := s.characteristics.FindByDish(dishID)\n\n\tif err == sql.ErrNoRows {\n\t\treturn nil, ErrCharacteristicsNotFound\n\t} else if err != nil {\n\t\treturn nil, err\n\t}\n\n\tcharacteristics := make([]Characteristic, 0)\n\n\t// ToDo: Load the variants via SQL in the corresponding storage\n\tfor _, characteristicEntity := range characteristicEntities {\n\t\tvariantEntities, err := s.variants.FindByCharacteristic(characteristicEntity.ID)\n\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn nil, ErrVariantsNotFound\n\t\t} else if err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvariants := make([]Variant, 0)\n\n\t\tfor _, variantEntity := range variantEntities {\n\t\t\tvariants = append(variants, Variant{\n\t\t\t\tID: variantEntity.ID,\n\t\t\t\tValue: variantEntity.Value,\n\t\t\t\tIsDefault: variantEntity.IsDefault,\n\t\t\t\tPrice: variantEntity.Price,\n\t\t\t})\n\t\t}\n\n\t\tcharacteristics = append(characteristics, Characteristic{\n\t\t\tID: characteristicEntity.ID,\n\t\t\tName: characteristicEntity.Name,\n\t\t\tMultiple: characteristicEntity.Multiple,\n\t\t\tVariants: variants,\n\t\t})\n\t}\n\n\treturn characteristics, nil\n}", "title": "" } ]
[ { "docid": "95ff01bbc9aa3856cd0d8fabf17fdcd5", "score": "0.76890916", "text": "func (c *Controller) GetCharacteristics() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tdishID, err := strconv.Atoi(chi.URLParam(r, \"id\"))\n\n\t\tif err != nil {\n\t\t\trespond(w, r, http.StatusUnprocessableEntity, ErrInvalidNumberFormat.Error())\n\t\t\treturn\n\t\t}\n\n\t\tcharacteristics, err := c.dishService.GetCharacteristics(uint64(dishID))\n\n\t\tif err != nil && (err == dish.ErrCharacteristicsNotFound || err == dish.ErrVariantsNotFound) {\n\t\t\trespond(w, r, http.StatusNotFound, err.Error())\n\t\t\treturn\n\t\t} else if err != nil {\n\t\t\trespond(w, r, http.StatusInternalServerError, ErrProcessingFailed.Error())\n\t\t\treturn\n\t\t}\n\n\t\trespond(w, r, http.StatusOK, characteristics)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "c862ba2fcf651c65c1d25b990cde5241", "score": "0.6627776", "text": "func (d *Device1) GetCharacteristics() ([]*gatt.GattCharacteristic1, error) {\n\n\tlist, err := d.GetCharacteristicsList()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tchars := []*gatt.GattCharacteristic1{}\n\tfor _, path := range list {\n\n\t\tchar, err := gatt.NewGattCharacteristic1(path)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tchars = append(chars, char)\n\t}\n\n\treturn chars, nil\n}", "title": "" }, { "docid": "56dac3225fb31613a7879a7e85fb7e1e", "score": "0.66098946", "text": "func (p *Client) DiscoverCharacteristics(filter []ble.UUID, s *ble.Service) ([]*ble.Characteristic, error) {\n\tlog.Printf(\"BLE GATT: %s: %s: discovering characteristics in service\", p, s.UUID)\n\tp.Lock()\n\tdefer p.Unlock()\n\tstart := s.Handle\n\tvar lastChar *ble.Characteristic\n\tfor start <= s.EndHandle {\n\t\tlength, b, err := p.ac.ReadByType(start, s.EndHandle, ble.CharacteristicUUID)\n\t\tif err == ble.ErrAttrNotFound {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor len(b) != 0 {\n\t\t\th := binary.LittleEndian.Uint16(b[:2])\n\t\t\tp := ble.Property(b[2])\n\t\t\tvh := binary.LittleEndian.Uint16(b[3:5])\n\t\t\tu := ble.UUID(b[5:length])\n\t\t\tc := &ble.Characteristic{\n\t\t\t\tUUID: u,\n\t\t\t\tProperty: p,\n\t\t\t\tHandle: h,\n\t\t\t\tValueHandle: vh,\n\t\t\t\tEndHandle: s.EndHandle,\n\t\t\t}\n\t\t\tif filter == nil || ble.Contains(filter, u) {\n\t\t\t\ts.Characteristics = append(s.Characteristics, c)\n\t\t\t}\n\t\t\tif lastChar != nil {\n\t\t\t\tlastChar.EndHandle = c.Handle - 1\n\t\t\t}\n\t\t\tlastChar = c\n\t\t\tstart = vh + 1\n\t\t\tb = b[length:]\n\t\t}\n\t}\n\tlog.Printf(\"BLE GATT: %s: %s: discovered %d characteristics in service\", p, s.UUID, len(s.Characteristics))\n\treturn s.Characteristics, nil\n}", "title": "" }, { "docid": "c4cf0aebd3abca5a7c19af2d8a176c9c", "score": "0.65452373", "text": "func (d *Device1) GetCharacteristicsList() ([]dbus.ObjectPath, error) {\n\n\tvar chars []dbus.ObjectPath\n\n\tom, err := bluez.GetObjectManager()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlist, err := om.GetManagedObjects()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor path := range list {\n\n\t\tspath := string(path)\n\n\t\t// log.Debugf(\"%s=%s\", string(d.Path()), spath)\n\n\t\tif !strings.HasPrefix(spath, string(d.Path())) {\n\t\t\tcontinue\n\t\t}\n\n\t\tcharPos := strings.Index(spath, \"char\")\n\t\tif charPos == -1 {\n\t\t\tcontinue\n\t\t}\n\n\t\tif strings.Contains(spath[charPos:], \"desc\") {\n\t\t\tcontinue\n\t\t}\n\n\t\tchars = append(chars, path)\n\t}\n\n\treturn chars, nil\n}", "title": "" }, { "docid": "95dde57057df2f9d159fc82d13a67ea4", "score": "0.61547333", "text": "func (cfg *ConfigT) GetCharacteristics() []string {\n\tcharacteristics := []string{}\n\n\tif (cfg.PEFile.FileHeader.Characteristics & 0x0002) > 1 {\n\t\tcharacteristics = append(characteristics, \"Executable\")\n\t}\n\n\tif (cfg.PEFile.FileHeader.Characteristics & 0x0100) > 1 {\n\t\tcharacteristics = append(characteristics, \"32bit\")\n\t}\n\n\tif (cfg.PEFile.FileHeader.Characteristics & 0x2000) > 1 {\n\t\tcharacteristics = append(characteristics, \"DLL\")\n\t}\n\n\treturn characteristics\n}", "title": "" }, { "docid": "b991cbe79d313cb58f3aa5300d27de22", "score": "0.607507", "text": "func (srv *Server) Characteristics(w http.ResponseWriter, r *http.Request) {\n\tsess := srv.context.GetSessionForRequest(r)\n\tconn := sess.Connection()\n\n\tswitch r.Method {\n\tcase hap.MethodGET:\n\t\tr.ParseForm()\n\t\tlog.Debug.Printf(\"%v GET /characteristics %v\", r.RemoteAddr, r.Form)\n\n\t\tvar (\n\t\t\terr = false // indicates if a characteristic was not found\n\t\t\tarr []CharacteristicResponse\n\t\t)\n\n\t\t// id=1.4,1.5\n\t\tstrs := strings.Split(r.Form.Get(\"id\"), \",\")\n\t\tfor _, str := range strs {\n\t\t\tif ids := strings.Split(str, \".\"); len(ids) == 2 {\n\t\t\t\taid := to.Uint64(ids[0]) // accessory id\n\t\t\t\tiid := to.Uint64(ids[1]) // instance id (= characteristic id)\n\t\t\t\tresp := CharacteristicResponse{AccessoryID: aid, CharacteristicID: iid}\n\t\t\t\tif ch := srv.getCharacteristic(aid, iid); ch != nil {\n\t\t\t\t\tresp.Value = ch.GetValueFromConnection(conn)\n\t\t\t\t} else {\n\t\t\t\t\terr = true\n\t\t\t\t\tstatus := hap.StatusServiceCommunicationFailure\n\t\t\t\t\tresp.Status = &status\n\t\t\t\t}\n\t\t\t\tarr = append(arr, resp)\n\t\t\t} else {\n\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif err == true {\n\t\t\t// Set 207 status when any of the response includes an error\n\t\t\tw.WriteHeader(http.StatusMultiStatus)\n\t\t\tfor _, resp := range arr {\n\t\t\t\tif resp.Status == nil {\n\t\t\t\t\tok := 0\n\t\t\t\t\tresp.Status = &ok // make sure that every response contains a status code (0 means OK)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tw.WriteHeader(http.StatusOK)\n\t\t}\n\n\t\tWriteJSON(w, r, &CharacteristicsResponse{arr})\n\tcase hap.MethodPUT:\n\t\tlog.Debug.Printf(\"%v PUT /characteristics\", r.RemoteAddr)\n\t\tb, err := ioutil.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\tlog.Debug.Println(err)\n\t\t} else {\n\t\t\tlog.Debug.Println(string(b))\n\t\t}\n\n\t\treq := struct {\n\t\t\tCharacteristics []CharacteristicRequest `json:\"characteristics\"`\n\t\t}{}\n\t\terr = JSONDecode(bytes.NewBuffer(b), &req)\n\t\tif err != nil {\n\t\t\tlog.Debug.Println(err)\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tif err := WriteJSON(w, r, &ErrResponse{Status: hap.StatusInvalidValueInRequest /*?*/}); err != nil {\n\t\t\t\tlog.Debug.Println(err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tresp := &CharacteristicsResponse{}\n\t\tfor _, ch := range req.Characteristics {\n\t\t\tc := srv.getCharacteristic(ch.AccessoryID, ch.CharacteristicID)\n\t\t\tif c == nil {\n\t\t\t\tlog.Info.Printf(\"Could not find characteristic with aid %d and iid %d\\n\", ch.AccessoryID, ch.CharacteristicID)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif ch.Value != nil {\n\t\t\t\tc.UpdateValueFromConnection(ch.Value, conn)\n\t\t\t}\n\n\t\t\tif ch.Events != nil {\n\t\t\t\tif !c.IsObservable() {\n\t\t\t\t\tstatus := hap.StatusNotificationNotSupported\n\t\t\t\t\terr := CharacteristicResponse{AccessoryID: ch.AccessoryID, CharacteristicID: ch.CharacteristicID, Status: &status}\n\t\t\t\t\tresp.Characteristics = append(resp.Characteristics, err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif events, ok := ch.Events.(bool); ok == true {\n\t\t\t\t\tif events {\n\t\t\t\t\t\tsess.Subscribe(c)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsess.Unsubscribe(c)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif len(resp.Characteristics) == 0 {\n\t\t\tw.WriteHeader(http.StatusNoContent)\n\t\t\treturn\n\t\t}\n\n\t\tWriteJSON(w, r, resp)\n\n\tdefault:\n\t\tlog.Debug.Println(\"Cannot handle HTTP method\", r.Method)\n\t}\n}", "title": "" }, { "docid": "f648a5d0f8b3d00edef26a1b58414723", "score": "0.50911707", "text": "func getCharacteristics(s string) []string {\n\tfields := strings.Split(s, \",\")\n\tels := []string{}\n\tfor i, v := range fields {\n\t\tif i == 0 {\n\t\t\tnametype := strings.Split(v, \": \")\n\t\t\tels = append(els, nametype...)\n\t\t} else {\n\t\t\tels = append(els, strings.Trim(v, \" \\n\"))\n\t\t}\n\t}\n\treturn els\n}", "title": "" }, { "docid": "5c49a42d074ab486504af9b4360f34a1", "score": "0.4884499", "text": "func (d *Device1) GetDescriptors(char *gatt.GattCharacteristic1) ([]*gatt.GattDescriptor1, error) {\n\tdescrPaths, err := d.GetDescriptorList()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdescrFound := []*gatt.GattDescriptor1{}\n\tfor _, path := range descrPaths {\n\t\tdescr, err := gatt.NewGattDescriptor1(path)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif char.Path() == descr.Properties.Characteristic {\n\t\t\tdescrFound = append(descrFound, descr)\n\t\t}\n\t}\n\n\tif len(descrFound) == 0 {\n\t\treturn nil, errors.New(\"descriptors not found\")\n\t}\n\n\treturn descrFound, nil\n}", "title": "" }, { "docid": "bc2b3482b333691167939ca08c03d00e", "score": "0.488195", "text": "func (p *Client) DiscoverDescriptors(filter []ble.UUID, c *ble.Characteristic) ([]*ble.Descriptor, error) {\n\tlog.Printf(\"BLE GATT: %s: %s: discovering descriptors\", p, c.UUID)\n\tp.Lock()\n\tdefer p.Unlock()\n\tstart := c.ValueHandle + 1\n\tfor start <= c.EndHandle {\n\t\tfound, b, err := p.ac.FindInformation(start, c.EndHandle)\n\t\tif err == ble.ErrAttrNotFound {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlength := 2 + 2\n\t\tif found == 0x02 {\n\t\t\tlength = 2 + 16\n\t\t}\n\t\tfor len(b) != 0 {\n\t\t\th := binary.LittleEndian.Uint16(b[:2])\n\t\t\tu := ble.UUID(b[2:length])\n\t\t\td := &ble.Descriptor{UUID: u, Handle: h}\n\t\t\tif filter == nil || ble.Contains(filter, u) {\n\t\t\t\tc.Descriptors = append(c.Descriptors, d)\n\t\t\t}\n\t\t\tif u.Equal(ble.ClientCharacteristicConfigUUID) {\n\t\t\t\tc.CCCD = d\n\t\t\t}\n\t\t\tstart = h + 1\n\t\t\tb = b[length:]\n\t\t}\n\t}\n\tlog.Printf(\"BLE GATT: %s: %s: discovered %d descriptors in characteristic\", p, c.UUID, len(c.Descriptors))\n\treturn c.Descriptors, nil\n}", "title": "" }, { "docid": "8db0b2ff1e564ebbe21e27e7953eb4dc", "score": "0.48659408", "text": "func EnumerateHid(vendorID uint16, productID uint16) ([]DeviceInfo, error) {\n\tenumerateLock.Lock()\n\tdefer enumerateLock.Unlock()\n\n\treturn enumerateHid(vendorID, productID)\n}", "title": "" }, { "docid": "f206741d089e3c0f8430755b046f696d", "score": "0.4683813", "text": "func (d *Device1) GetAllServicesAndUUID() ([]string, error) {\n\n\tlist, err := d.GetCharacteristicsList()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tchars := map[dbus.ObjectPath]*gatt.GattCharacteristic1{}\n\n\tvar deviceFound []string\n\tvar uuidAndService string\n\tfor _, path := range list {\n\n\t\tchar, err := gatt.NewGattCharacteristic1(path)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tchars[path] = char\n\n\t\tprops := chars[path].Properties\n\t\tcuuid := strings.ToUpper(props.UUID)\n\t\tservice := string(props.Service)\n\n\t\tuuidAndService = fmt.Sprint(cuuid, \":\", service)\n\t\tdeviceFound = append(deviceFound, uuidAndService)\n\t}\n\n\treturn deviceFound, nil\n}", "title": "" }, { "docid": "b8a1a2338ae93523b0855b7bff0a42a0", "score": "0.46720996", "text": "func (o ApiShieldOutput) AuthIdCharacteristics() ApiShieldAuthIdCharacteristicArrayOutput {\n\treturn o.ApplyT(func(v *ApiShield) ApiShieldAuthIdCharacteristicArrayOutput { return v.AuthIdCharacteristics }).(ApiShieldAuthIdCharacteristicArrayOutput)\n}", "title": "" }, { "docid": "de89ea000e055914f55328187f5eed3f", "score": "0.4665399", "text": "func (d *Device) GetStatistics(\n\ttyp DeviceStatisticsType,\n) ([]DeviceStatisticsRecord, error) {\n\tvar values [][]interface{}\n\n\terr := d.obj.\n\t\tCall(deviceMethodGetStatistics, 0, typ).\n\t\tStore(&values)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to make dbus call: %w\", err)\n\t}\n\n\trecords := make([]DeviceStatisticsRecord, len(values))\n\n\tfor i, value := range values {\n\t\tif err := dbus.Store([]interface{}{value}, &records[i]); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to store result: %w\", err)\n\t\t}\n\t}\n\n\treturn records, nil\n}", "title": "" }, { "docid": "e036fec90508be41e76e1f5cdf87f428", "score": "0.45886385", "text": "func Enumerate(vendorID uint16, productID uint16) ([]DeviceInfo, error) {\n\tenumerateLock.Lock()\n\tdefer enumerateLock.Unlock()\n\n\t// Enumerate all the raw USB devices and skip the HID ones\n\traws, err := enumerateRaw(vendorID, productID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Enumerate all the HID USB devices\n\thids, err := enumerateHid(vendorID, productID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn append(raws, hids...), nil\n}", "title": "" }, { "docid": "5d91c0f37c85e62bf40ccf71b5acd5e5", "score": "0.45743212", "text": "func getProperties(char *XMLCharacteristic) {\n\tfmt.Print(\"\\t \")\n\tif strings.Compare(char.Properties.Broadcast, mandatory) == 0 {\n\t\tfmt.Print(\"broadcast \")\n\t\tchar.Properties.bitMask |= gatt.CharBroadcast\n\t}\n\tif strings.Compare(char.Properties.Read, mandatory) == 0 {\n\t\tfmt.Print(\"read \")\n\t\tchar.Properties.bitMask |= gatt.CharRead\n\t}\n\tif strings.Compare(char.Properties.WriteWithoutResponse, mandatory) == 0 {\n\t\tfmt.Print(\"writeWithoutResponse \")\n\t\tchar.Properties.bitMask |= gatt.CharWriteNR\n\t}\n\tif strings.Compare(char.Properties.Write, mandatory) == 0 {\n\t\tfmt.Print(\"write \")\n\t\tchar.Properties.bitMask |= gatt.CharWrite\n\t}\n\tif strings.Compare(char.Properties.Notify, mandatory) == 0 {\n\t\tfmt.Print(\"notify \")\n\t\tchar.Properties.bitMask |= gatt.CharNotify\n\t}\n\tif strings.Compare(char.Properties.Indicate, mandatory) == 0 {\n\t\tfmt.Print(\"indicate \")\n\t\tchar.Properties.bitMask |= gatt.CharIndicate\n\t}\n\tif strings.Compare(char.Properties.SignedWrite, mandatory) == 0 {\n\t\tfmt.Print(\"signedWrite \")\n\t\tchar.Properties.bitMask |= gatt.CharSignedWrite\n\t}\n\tif strings.Compare(char.Properties.Extended, mandatory) == 0 {\n\t\tfmt.Print(\"extended \")\n\t\tchar.Properties.bitMask |= gatt.CharExtended\n\t}\n\tfmt.Println()\n}", "title": "" }, { "docid": "3c10e6e3c52d471816d478dd5d53dcdd", "score": "0.45427266", "text": "func Retrieve() {\n\tdb, err := sql.Open(\"mysql\", \"root:RVLmusic@tcp(127.0.0.1)/marvel\")\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tdefer db.Close()\n\n\tresults, err := db.Query(\"SELECT * FROM characters\")\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tdefer results.Close()\n\n\tfor results.Next() {\n\n\t\tvar theCharacters heroAttributes\n\n\t\terr := results.Scan(&theCharacters.PageID, &theCharacters.Name, &theCharacters.Urlslug, &theCharacters.ID, &theCharacters.Align, &theCharacters.Eye, &theCharacters.Hair, &theCharacters.Sex, &theCharacters.Gsm, &theCharacters.Alive, &theCharacters.Appearances, &theCharacters.FirstAppearances, &theCharacters.Year)\n\t\tif err != nil {\n\t\t\tlog.Fatalln(err)\n\t\t}\n\n\t\tbyteArr, err := json.MarshalIndent(theCharacters, \"\", \" \")\n\t\tif err != nil {\n\t\t\tlog.Fatalln(err)\n\t\t}\n\n\t\tfmt.Fprintf(res, \"\\n%v\\n\", string(byteArr))\n\t}\n}", "title": "" }, { "docid": "18e4e37f688b3a1edab6c7439d612c4c", "score": "0.45408747", "text": "func (p *parser) GetCharacters(a *goquery.Selection) []model.PeopleCharacter {\n\tv := character{area: a, cleanImg: p.cleanImg}\n\tv.setDetail()\n\treturn v.data\n}", "title": "" }, { "docid": "1a372c237fbfe905c923020e4077c017", "score": "0.45335317", "text": "func (s *HeroService) Durations(heroID int) ([]HeroDuration, *http.Response, error) {\n\therodurations := new([]HeroDuration)\n\tapiError := new(APIError)\n\tpath := strconv.Itoa(heroID) + \"/durations\"\n\tresp, err := s.sling.New().Get(path).Receive(herodurations, apiError)\n\treturn *herodurations, resp, relevantError(err, *apiError)\n}", "title": "" }, { "docid": "d3518d3760d226efff0268a1a6303062", "score": "0.44407687", "text": "func (conn *Connection) GetCharacteristic(uuid string) (Characteristic, error) {\n\treturn conn.findGattObject(characteristicInterface, uuid)\n}", "title": "" }, { "docid": "d056877c739aa9e3dd8cf48644501565", "score": "0.438138", "text": "func (p *Client) DiscoverServices(filter []ble.UUID) ([]*ble.Service, error) {\n\tlog.Printf(\"BLE GATT: %s: discovering services\", p)\n\tp.Lock()\n\tdefer p.Unlock()\n\tif p.profile == nil {\n\t\tp.profile = &ble.Profile{}\n\t}\n\tstart := uint16(0x0001)\n\tfor {\n\t\tlength, b, err := p.ac.ReadByGroupType(start, 0xFFFF, ble.PrimaryServiceUUID)\n\t\tif err == ble.ErrAttrNotFound {\n\t\t\tlog.Printf(\"BLE GATT: %s: discovered %d services\", p, len(p.profile.Services))\n\t\t\treturn p.profile.Services, nil\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to read by group type: %w\", err)\n\t\t}\n\t\tfor len(b) != 0 {\n\t\t\th := binary.LittleEndian.Uint16(b[:2])\n\t\t\tendh := binary.LittleEndian.Uint16(b[2:4])\n\t\t\tu := ble.UUID(b[4:length])\n\t\t\tif filter == nil || ble.Contains(filter, u) {\n\t\t\t\ts := &ble.Service{\n\t\t\t\t\tUUID: u,\n\t\t\t\t\tHandle: h,\n\t\t\t\t\tEndHandle: endh,\n\t\t\t\t}\n\t\t\t\tp.profile.Services = append(p.profile.Services, s)\n\t\t\t}\n\t\t\tif endh == 0xFFFF {\n\t\t\t\tlog.Printf(\"BLE GATT: %s: discovered %d services\", p, len(p.profile.Services))\n\t\t\t\treturn p.profile.Services, nil\n\t\t\t}\n\t\t\tstart = endh + 1\n\t\t\tb = b[length:]\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b77caae62456f1e2af7e70d639f6d912", "score": "0.4368284", "text": "func Enumerate(vendorId uint16, productId uint16) ([]*DeviceInfo, error) {\n\tu := udev.Udev{}\n\tudevEnum := u.NewEnumerate()\n\tudevEnum.AddMatchSubsystem(\"hidraw\")\n\tit, err := udevEnum.DeviceIterator()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar list []*DeviceInfo\n\n\tit.Each(func(v_ interface{}) {\n\t\tdev := v_.(*udev.Device)\n\n\t\thid_dev := dev.ParentWithSubsystemDevtype(\"hid\", \"\")\n\t\tif hid_dev == nil {\n\t\t\t// Unable to find parent HID device; continue.\n\t\t\treturn\n\t\t}\n\n\t\tdi := &DeviceInfo{\n\t\t\tPath: dev.Devnode(),\n\t\t}\n\n\t\tvar bus_type int\n\t\t// di.VendorId\n\t\t// di.ProductId\n\t\t// di.Product\n\t\t// di.SerialNumber\n\t\terr = parse_uevent_info(hid_dev.SysattrValue(\"uevent\"), &bus_type, di)\n\t\tif err != nil {\n\t\t\t// Skip.\n\t\t\treturn\n\t\t}\n\n\t\tif bus_type != C.BUS_USB && bus_type != C.BUS_BLUETOOTH {\n\t\t\t// We only know how to handle USB and Bluetooth.\n\t\t\treturn\n\t\t}\n\n\t\tif ((vendorId != 0) && (vendorId != di.VendorId)) ||\n\t\t\t((productId != 0) && (productId != di.ProductId)) {\n\t\t\t// Vendor / Product ID mismatch\n\t\t\treturn\n\t\t}\n\n\t\tdi.ReleaseNumber = 0\n\t\tdi.InterfaceNumber = -1\n\n\t\tif bus_type == C.BUS_USB {\n\t\t\t/* The device pointed to by hid_dev contains information about\n\t\t\t the hidraw device. In order to get information about the\n\t\t\t USB device, get the parent device with the\n\t\t\t subsystem/devtype pair of \"usb\"/\"usb_device\". This will\n\t\t\t be several levels up the tree, but the function will find\n\t\t\t it. */\n\t\t\tusbDev := hid_dev.ParentWithSubsystemDevtype(\"usb\", \"usb_device\")\n\t\t\tif usbDev == nil {\n\t\t\t\t// Fake USB device, skip.\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tdi.Manufacturer = usbDev.SysattrValue(\"manufacturer\")\n\t\t\t// TODO check consequences of this line\n\t\t\tdi.Product = usbDev.SysattrValue(\"product\")\n\n\t\t\treleaseNumber, err := strconv.ParseUint(usbDev.SysattrValue(\"bcdDevice\"), 16, 16)\n\t\t\tif err != nil {\n\t\t\t\tdi.ReleaseNumber = 0\n\t\t\t} else {\n\t\t\t\tdi.ReleaseNumber = uint16(releaseNumber)\n\t\t\t}\n\n\t\t\tinterfaceDev := hid_dev.ParentWithSubsystemDevtype(\"usb\", \"usb_interface\")\n\t\t\tif interfaceDev != nil {\n\t\t\t\tinterfaceNumber, err := strconv.ParseInt(usbDev.SysattrValue(\"bInterfaceNumber\"), 16, 32)\n\t\t\t\tif err != nil {\n\t\t\t\t\tdi.InterfaceNumber = -1\n\t\t\t\t} else {\n\t\t\t\t\tdi.InterfaceNumber = int(interfaceNumber)\n\t\t\t\t}\n\t\t\t}\n\t\t} else /* bus_type == BUS_BLUETOOTH */ {\n\t\t\t// manufacturer string, etc not available without querying device\n\t\t\t// only available strings:\n\t\t\t// uevent, report_descriptor (bytes), modalias, country\n\t\t}\n\n\t\tlist = append(list, di)\n\t})\n\tit.Close()\n\n\treturn list, nil\n}", "title": "" }, { "docid": "e33f809f0fe114f02f3016f6eaa46d9f", "score": "0.4360455", "text": "func (d *Device1) GetCharsByUUID(uuid string) ([]*gatt.GattCharacteristic1, error) {\n\tuuid = strings.ToUpper(uuid)\n\n\tlist, err := d.GetCharacteristicsList()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcharsFound := []*gatt.GattCharacteristic1{}\n\n\tfor _, path := range list {\n\n\t\tchar, err := gatt.NewGattCharacteristic1(path)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tcuuid := strings.ToUpper(char.Properties.UUID)\n\n\t\tif cuuid == uuid {\n\t\t\tcharsFound = append(charsFound, char)\n\t\t}\n\t}\n\n\tif len(charsFound) == 0 {\n\t\treturn nil, errors.New(\"characteristic not found\")\n\t}\n\n\treturn charsFound, nil\n}", "title": "" }, { "docid": "c86a3250a70635680baa364278cc710c", "score": "0.4332016", "text": "func (d *Device1) GetDescriptorList() ([]dbus.ObjectPath, error) {\n\tvar descr []dbus.ObjectPath\n\n\tom, err := bluez.GetObjectManager()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlist, err := om.GetManagedObjects()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor path := range list {\n\n\t\tspath := string(path)\n\n\t\tif !strings.HasPrefix(spath, string(d.Path())) {\n\t\t\tcontinue\n\t\t}\n\n\t\tcharPos := strings.Index(spath, \"desc\")\n\t\tif charPos == -1 {\n\t\t\tcontinue\n\t\t}\n\n\t\tif strings.Contains(spath[charPos:], \"char\") {\n\t\t\tcontinue\n\t\t}\n\n\t\tdescr = append(descr, path)\n\t}\n\n\treturn descr, nil\n}", "title": "" }, { "docid": "3a6a76a1f8b82172f15676762bcf0913", "score": "0.42890105", "text": "func (o *AnalyzeARecipeSearchQuery200Response) GetDishes() []AnalyzeARecipeSearchQuery200ResponseDishesInner {\n\tif o == nil {\n\t\tvar ret []AnalyzeARecipeSearchQuery200ResponseDishesInner\n\t\treturn ret\n\t}\n\n\treturn o.Dishes\n}", "title": "" }, { "docid": "a74c68de34f4aaebf8691843a06060a8", "score": "0.42549354", "text": "func OrderDishes() []*Dish {\n\td1 := Dish{Name: \"chorizo\", Morsels: randomNum(5, 11)}\n\td2 := Dish{Name: \"chopitos\", Morsels: randomNum(5, 11)}\n\td3 := Dish{Name: \"pimientos de padrón\", Morsels: randomNum(5, 11)}\n\td4 := Dish{Name: \"croquetas\", Morsels: randomNum(5, 11)}\n\td5 := Dish{Name: \"patatas bravas\", Morsels: randomNum(5, 11)}\n\treturn []*Dish{&d1, &d2, &d3, &d4, &d5}\n}", "title": "" }, { "docid": "ea2221d8a21dc234b68b0beb2b2e4e48", "score": "0.42481482", "text": "func (d *Device) GetFeatures() (wire.Message, error) {\n\tif err := d.Connect(); err != nil {\n\t\treturn wire.Message{}, err\n\t}\n\tdefer d.Disconnect()\n\n\tgetFeaturesChunks, err := MessageGetFeatures()\n\tif err != nil {\n\t\treturn wire.Message{}, err\n\t}\n\n\treturn d.Driver.SendToDevice(d.dev, getFeaturesChunks)\n}", "title": "" }, { "docid": "32217e0f4e47c6aa03ce820de2e3a3f7", "score": "0.4232582", "text": "func (w *WrappedSDEType) GetDisplayAttributes() map[string]*DisplayAttribute {\r\n\tout := make([]*DisplayAttribute, 0)\r\n\toutm := make(map[string]*DisplayAttribute)\r\n\tfor k, v := range w.Attributes {\r\n\t\tif strings.Contains(k, \"displayAttributes.\") {\r\n\t\t\tdattr := parseAttr(v.(int), w)\r\n\t\t\tout = append(out, dattr)\r\n\t\t}\r\n\t}\r\n\tfor _, v := range out {\r\n\t\toutm[v.AttributeName] = v\r\n\t}\r\n\t/*\tkeys := make([]string, 0)\r\n\t\tfor _, v := range out {\r\n\t\t\tkeys = append(keys, v.AttributeName)\r\n\t\t}\r\n\r\n\t\tsort.Strings(keys)*/\r\n\r\n\treturn outm\r\n}", "title": "" }, { "docid": "729802091374c89f113df711c642ce11", "score": "0.42225665", "text": "func parseCharacteristics(block []line) (Characteristics, error) {\n\t// Check the block is non-empty\n\tif len(block) == 0 {\n\t\tpanic(\"empty block\")\n\t}\n\n\t// Parse each upgrade\n\tupgrades := []Upgrade{}\n\tfor _, line := range block {\n\n\t\t// The line should be made of label and value\n\t\tsplits := strings.Fields(line.Text)\n\t\tif len(splits) != 2 {\n\t\t\treturn Characteristics{}, NewError(InvalidUpgradeFormat, line.Number)\n\t\t}\n\n\t\t// Check the value is numeric\n\t\t_, err := strconv.Atoi(splits[1])\n\t\tif err != nil {\n\t\t\treturn Characteristics{}, NewError(InvalidUpgradeValue, line.Number)\n\t\t}\n\n\t\t// Check the value is absolute\n\t\tif strings.ContainsAny(splits[1], \"+|-\") {\n\t\t\treturn Characteristics{}, NewError(ForbidenUpgradeValue, line.Number)\n\t\t}\n\n\t\tu := Upgrade{\n\t\t\tMark: MarkSpecial,\n\t\t\tName: strings.Join(splits, \" \"),\n\t\t\tCost: IntP(0),\n\t\t\tLine: line.Number,\n\t\t}\n\n\t\t// Add the characteristic to the list\n\t\tupgrades = append(upgrades, u)\n\t}\n\n\treturn upgrades, nil\n}", "title": "" }, { "docid": "def6b6cbd9be5dbe4b06b773c8c874c8", "score": "0.42117807", "text": "func (c *DeviceInfoCollector) Describe(ch chan<- *prometheus.Desc) {\n\tch <- c.NoiseLevel\n\tch <- c.SignalLevel\n\tch <- c.Uptime\n}", "title": "" }, { "docid": "b9b04a2b3b4593e5796fde3bb03d5ad4", "score": "0.4203214", "text": "func (p *Client) ReadCharacteristic(c *ble.Characteristic) ([]byte, error) {\n\tlog.Printf(\"BLE GATT: %s: %s: read characteristic\", p, c.UUID)\n\tp.Lock()\n\tdefer p.Unlock()\n\tval, err := p.ac.Read(c.ValueHandle)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tc.Value = val\n\tlog.Printf(\"BLE GATT: %s: %s: read %d bytes from characteristic\", p, c.UUID, len(val))\n\treturn val, nil\n}", "title": "" }, { "docid": "2761cf212591be99cc105dfdc4c9a029", "score": "0.4178413", "text": "func (device Device) GetCapabilities() (DeviceCapabilities, error) {\n\t// Create SOAP\n\tsoap := SOAP{\n\t\tXMLNs: deviceXMLNs,\n\t\tBody: `<tds:GetCapabilities>\n\t\t\t<tds:Category>All</tds:Category>\n\t\t</tds:GetCapabilities>`,\n\t}\n\n\t// Send SOAP request\n\tresponse, err := soap.SendRequest(device.XAddr)\n\tif err != nil {\n\t\treturn DeviceCapabilities{}, err\n\t}\n\n\t// Get network capabilities\n\tenvelopeBodyPath := \"Envelope.Body.GetCapabilitiesResponse.Capabilities\"\n\tifaceNetCap, err := response.ValueForPath(envelopeBodyPath + \".Device.Network\")\n\tif err != nil {\n\t\treturn DeviceCapabilities{}, err\n\t}\n\n\tnetCap := NetworkCapabilities{}\n\tif mapNetCap, ok := ifaceNetCap.(map[string]interface{}); ok {\n\t\tnetCap.DynDNS = interfaceToBool(mapNetCap[\"DynDNS\"])\n\t\tnetCap.IPFilter = interfaceToBool(mapNetCap[\"IPFilter\"])\n\t\tnetCap.IPVersion6 = interfaceToBool(mapNetCap[\"IPVersion6\"])\n\t\tnetCap.ZeroConfig = interfaceToBool(mapNetCap[\"ZeroConfiguration\"])\n\t}\n\n\t// Get events capabilities\n\tifaceEventsCap, err := response.ValueForPath(envelopeBodyPath + \".Events\")\n\tif err != nil {\n\t\treturn DeviceCapabilities{}, err\n\t}\n\n\teventsCap := make(map[string]bool)\n\tif mapEventsCap, ok := ifaceEventsCap.(map[string]interface{}); ok {\n\t\tfor key, value := range mapEventsCap {\n\t\t\tif strings.ToLower(key) == \"xaddr\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tkey = strings.Replace(key, \"WS\", \"\", 1)\n\t\t\teventsCap[key] = interfaceToBool(value)\n\t\t}\n\t}\n\n\t// Get streaming capabilities\n\tifaceStreamingCap, err := response.ValueForPath(envelopeBodyPath + \".Media.StreamingCapabilities\")\n\tif err != nil {\n\t\treturn DeviceCapabilities{}, err\n\t}\n\n\tstreamingCap := make(map[string]bool)\n\tif mapStreamingCap, ok := ifaceStreamingCap.(map[string]interface{}); ok {\n\t\tfor key, value := range mapStreamingCap {\n\t\t\tkey = strings.Replace(key, \"_\", \" \", -1)\n\t\t\tstreamingCap[key] = interfaceToBool(value)\n\t\t}\n\t}\n\n\t// Create final result\n\tdeviceCapabilities := DeviceCapabilities{\n\t\tNetwork: netCap,\n\t\tEvents: eventsCap,\n\t\tStreaming: streamingCap,\n\t}\n\n\treturn deviceCapabilities, nil\n}", "title": "" }, { "docid": "dd17f6860e67e872a7d4557269a4f988", "score": "0.41749805", "text": "func (d *GattDescriptor1) GetProperties() (*GattDescriptor1Properties, error) {\n\terr := d.client.GetProperties(d.Properties)\n\treturn d.Properties, err\n}", "title": "" }, { "docid": "1a2a27b7cc02c4d21fc07e521819365f", "score": "0.4138267", "text": "func (client *Client) GetWsChGeneral(request *GetWsChGeneralRequest) (response *GetWsChGeneralResponse, err error) {\n\tresponse = CreateGetWsChGeneralResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "title": "" }, { "docid": "34542bc60259183d907a1f8c5705bc31", "score": "0.41373476", "text": "func (m *Malscraper) GetPeopleCharacter(id int) ([]model.PeopleCharacter, int, error) {\n\treturn m.api.GetPeopleCharacter(id)\n}", "title": "" }, { "docid": "2446a8ba2f9b69cbde47f221b5427804", "score": "0.41173378", "text": "func (obj *AdminConnectionImpl) GetAttributeDescriptors() ([]tgdb.TGAttributeDescriptor, tgdb.TGError) {\n\tresults, err := obj.executeAdminRequest(AdminCommandShowAttrDescs, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn results.([]tgdb.TGAttributeDescriptor), nil\n}", "title": "" }, { "docid": "96e7b09e253cd93dcd96cc3734ddee38", "score": "0.4114676", "text": "func (o *DatacenterProperties) GetFeatures() *[]string {\n\tif o == nil {\n\t\treturn nil\n\t}\n\n\treturn o.Features\n}", "title": "" }, { "docid": "0f22ab305d42e62a59681fef7084dc47", "score": "0.41097185", "text": "func GetFoods(locationFood string, foodChan chan []Food) error {\n\tsql := `SELECT * FROM comida WHERE deDondeEs=$1`\n\tdb := getConnection()\n\tdefer db.Close()\n\trows, err := db.Query(sql, locationFood)\n\tif err != nil {\n\t\tlog.Println(\"error en la linea 19 fila data/getFood.go\")\n\t\treturn err\n\t}\n\tvar foodArr []Food = []Food{}\n\tfor rows.Next() {\n\t\tvar foodAttr Food\n\t\tif err := rows.Scan(&foodAttr.ID, &foodAttr.Cost, &foodAttr.WhereItIs, &foodAttr.Name, &foodAttr.ImageURL); err != nil {\n\t\t\tlog.Println(\"error en la linea 26 fila data/getFood.go\")\n\t\t\treturn err\n\t\t}\n\t\tfoodArr = append(foodArr, foodAttr)\n\n\t}\n\tfoodChan <- foodArr\n\treturn nil\n}", "title": "" }, { "docid": "970f9c3567ca8584a8d039bbc2a6681d", "score": "0.40967903", "text": "func (m *MockControllerHost) GetCapacities(ctx thrift.Context, getCapacitiesRequest *controller.GetCapacitiesRequest) (*controller.GetCapacitiesResult_, error) {\n\targs := m.Called(ctx, getCapacitiesRequest)\n\treturn args.Get(0).(*controller.GetCapacitiesResult_), args.Error(1)\n}", "title": "" }, { "docid": "765fe9aa87baad0ffb9d44b732805746", "score": "0.4067674", "text": "func (dc *dhcpCollector) Describe(ch chan<- *prometheus.Desc) {\n\tch <- dc.dhcpStatus\n}", "title": "" }, { "docid": "775863d4e518230f4df6c486ac7c53e8", "score": "0.40619794", "text": "func (us *UserService) GetConsents(ctx context.Context, realm string, userID string) (AttributeMap, error) {\n\n\t// nolint: goconst\n\tpath := \"/realms/{realm}/users/{id}/consents\"\n\n\tvar consents AttributeMap\n\n\t_, err := us.client.newRequest(ctx).\n\t\tSetPathParams(map[string]string{\n\t\t\t\"realm\": realm,\n\t\t\t\"id\": userID,\n\t\t}).\n\t\tSetResult(&consents).\n\t\tGet(path)\n\n\treturn consents, err\n}", "title": "" }, { "docid": "5dfc2c9e5beb6bf609ff8286b7e67b71", "score": "0.4054748", "text": "func (c *cassiniCollector) Describe(ch chan<- *prometheus.Desc) {\n\tfor _, desc := range c.descs {\n\t\tch <- desc\n\t}\n}", "title": "" }, { "docid": "cddd98e83eb5f46ef05023570bd1d480", "score": "0.40535933", "text": "func (c *Character) DetermineDamageBonus() *Attribute {\n\n\tdamageBonus := &Attribute{\n\t\tName: \"Damage Bonus\",\n\t\tMax: 21,\n\t\tDice: 1,\n\t}\n\n\tstr := c.Statistics[\"STR\"]\n\tsiz := c.Statistics[\"SIZ\"]\n\n\tstr.UpdateStatistic()\n\tsiz.UpdateStatistic()\n\n\tdb := siz.Total + str.Total\n\n\tswitch {\n\tcase db < 13:\n\t\tdamageBonus.Base = -4\n\t\tdamageBonus.Text = \"-1D4\"\n\tcase db < 25:\n\t\tdamageBonus.Base = 0\n\t\tdamageBonus.Text = \"-\"\n\tcase db < 33:\n\t\tdamageBonus.Base = 4\n\t\tdamageBonus.Text = \"+1D4\"\n\tcase db < 41:\n\t\tdamageBonus.Base = 6\n\t\tdamageBonus.Text = \"+1D6\"\n\tcase db < 57:\n\t\tdamageBonus.Base = 6\n\t\tdamageBonus.Dice = 2\n\t\tdamageBonus.Text = \"+2D6\"\n\tcase db > 56:\n\t\tdamageBonus.Base = 6\n\t\tdamageBonus.Dice = ((db - 56) / 16) + 2\n\t\tdamageBonus.Text = fmt.Sprintf(\"+%dD%d\",\n\t\t\tdamageBonus.Dice,\n\t\t\tdamageBonus.Base,\n\t\t)\n\t}\n\n\treturn damageBonus\n}", "title": "" }, { "docid": "664c4a9b1263224d80cc6f37306fb40b", "score": "0.40513763", "text": "func (c *Character) DetermineSpiritDamage() *Attribute {\n\n\tdamage := &Attribute{\n\t\tName: \"Spirit Damage\",\n\t\tMax: 21,\n\t\tDice: 1,\n\t}\n\n\tpow := c.Statistics[\"POW\"]\n\tcha := c.Statistics[\"CHA\"]\n\n\tpow.UpdateStatistic()\n\tcha.UpdateStatistic()\n\n\tdb := pow.Total + cha.Total\n\n\tswitch {\n\tcase db < 13:\n\t\tdamage.Base = 3\n\t\tdamage.Text = \"1D3\"\n\tcase db < 25:\n\t\tdamage.Base = 6\n\t\tdamage.Text = \"1D6\"\n\tcase db < 33:\n\t\tdamage.Base = 6\n\t\tdamage.Value = 1\n\t\tdamage.Text = \"1D6+1\"\n\tcase db < 41:\n\t\tdamage.Base = 6\n\t\tdamage.Value = 3\n\t\tdamage.Text = \"1D6+3\"\n\tcase db < 57:\n\t\tdamage.Base = 6\n\t\tdamage.Dice = 2\n\t\tdamage.Value = 3\n\t\tdamage.Text = \"2D6+3\"\n\tcase db > 56:\n\t\tdamage.Base = 6\n\t\tdamage.Dice = ((db - 56) / 16) + 2\n\t\tdamage.Value = ((db - 56) / 16) + 3\n\t\tdamage.Text = fmt.Sprintf(\"%dD%d+%d\",\n\t\t\tdamage.Dice,\n\t\t\tdamage.Base,\n\t\t\tdamage.Value,\n\t\t)\n\t}\n\treturn damage\n}", "title": "" }, { "docid": "9d5bcd7add37c9ef43af4709e68ce787", "score": "0.40487602", "text": "func (s *Session) GetHmdDesc() *HmdDesc {\n\treturn nil\n}", "title": "" }, { "docid": "f38a798920107c24f8baf47cfa77c633", "score": "0.40405178", "text": "func (c *CephClusterCollector) Describe(ch chan<- *prometheus.Desc) {\n\tds := []*prometheus.Desc{\n\t\tc.MirrorDaemonCount,\n\t}\n\n\tfor _, d := range ds {\n\t\tch <- d\n\t}\n}", "title": "" }, { "docid": "62ebd9024d54eb2871f5cec5872d4f14", "score": "0.40328708", "text": "func (s *StatisticService) Caps(ctx context.Context, opts *StatisticCapsOpts) ([]*StatCap, *Response, error) {\n\tpath := \"/3.1/stats/caps\"\n\n\treq, err := s.client.NewRequestOpts(ctx, http.MethodGet, path, opts, nil, false)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tbody := new(statisticCapsResponse)\n\tresp, err := s.client.Do(req, body)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn body.Stats, resp, nil\n}", "title": "" }, { "docid": "4528126304a4ad708e8b050b63f20cb6", "score": "0.40304786", "text": "func (collector *deconzCollector) Describe(ch chan<- *prometheus.Desc) {\n\n\t//Update this section with the each metric you create for a given collector\n\tch <- collector.temperatureMetric\n\tch <- collector.humidityMetric\n\tch <- collector.pressureMetric\n}", "title": "" }, { "docid": "77a630c1ea9e0432342089be2d0cf87e", "score": "0.40266696", "text": "func (d nvmlDevice) GetAttributes() (map[string]interface{}, error) {\n\treturn nil, fmt.Errorf(\"GetAttributes is not supported for non-MIG devices\")\n}", "title": "" }, { "docid": "8456d95475a333c2516e24058a92c26e", "score": "0.40143633", "text": "func (drv *Driver) GetDeviceInfos() ([]usb.Info, error) {\n\tif drv.DeviceType() == DeviceTypeUSB {\n\t\tinfos, err := drv.bus.Enumerate(SkycoinVendorID, SkycoinHwProductID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn infos, nil\n\t}\n\treturn nil, errors.New(\"reading device info make sense for physical devices only\")\n}", "title": "" }, { "docid": "c1e78e2c2fd4353b62e44dfcd0c6f2d7", "score": "0.40109184", "text": "func (u *CounterUnit) Describe(ch chan<- *prometheus.Desc) {\n\tch <- u.vec.desc\n}", "title": "" }, { "docid": "dbc414f47f891faf2adb97ef7470793f", "score": "0.40077618", "text": "func (o *FontOptions) GetVariations() string {\n\treturn C.GoString(C.cairo_font_options_get_variations(o.native))\n}", "title": "" }, { "docid": "976b323a26c1641d2e6fef5bab0f7c64", "score": "0.40045732", "text": "func (*CMsgProfileResponse_FeaturedHero) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{202, 0}\n}", "title": "" }, { "docid": "4b7b55099288e95151bed3ef7e2e9708", "score": "0.40044162", "text": "func (s service) GetHospitalPUI() (*[]HsPUIsAttributes, error) {\n\tparam := phParams{\n\t\tF: \"json\",\n\t\tWhere: \"1=1\",\n\t\tReturnGeometry: \"false\",\n\t\tSpatialRel: \"esriSpatialRelIntersects\",\n\t\tOutFields: \"*\",\n\t\tCacheHint: \"false\",\n\t}\n\n\tparams, err := query.Values(param)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\turl := fmt.Sprintf(\"%s%s%s\", baseApi, hospitalPUI, params.Encode())\n\tres, err := http.Get(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar baseResponse hsPUIBase\n\terr = json.NewDecoder(res.Body).Decode(&baseResponse)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response []HsPUIsAttributes\n\n\tfor _, v := range baseResponse.Features {\n\t\tresponse = append(response, v.Attributes)\n\t}\n\n\treturn &response, nil\n}", "title": "" }, { "docid": "ab13252467b28e504e99da8c85470e42", "score": "0.4002296", "text": "func GetHand(h []string) []Card {\n values := map[string]int {\n \"2\": 2, \"3\": 3, \"4\": 4, \"5\": 5, \"6\": 6, \"7\": 7, \"8\": 8, \"9\": 9,\n \"T\": 10, \"J\": 11, \"Q\": 12, \"K\": 13, \"A\": 14,\n }\n suits := map[string]string {\n \"C\": \"Clubs\", \"D\": \"Diamonds\", \"H\": \"Hearts\", \"S\": \"Spades\",\n }\n\n var p []Card\n for _, c := range h {\n card := Card {val: values[c[:1]], suit: suits[c[1:2]]}\n p = append(p, card)\n //fmt.Printf(\"%s :: %v\\n\", c, card)\n }\n return p\n}", "title": "" }, { "docid": "a7875daefdcbb3999c3c241b07f69cbf", "score": "0.3996205", "text": "func (c *FanCollector) Describe(ch chan<- *prometheus.Desc) {\n\tds := []*prometheus.Desc{\n\t\tc.RPM,\n\t\tc.Alarm,\n\t}\n\n\tfor _, d := range ds {\n\t\tch <- d\n\t}\n}", "title": "" }, { "docid": "4b31c32017bd7012c09bd2c631c860e2", "score": "0.3991032", "text": "func (o *OrderResponseChargesAllOf) GetData() []ChargesDataResponse {\n\tif o == nil || IsNil(o.Data) {\n\t\tvar ret []ChargesDataResponse\n\t\treturn ret\n\t}\n\treturn o.Data\n}", "title": "" }, { "docid": "8b2746849a38a7d1b2c59610701b7546", "score": "0.39803275", "text": "func (*MedicinalProductIndication_OtherTherapy) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r4_core_resources_medicinal_product_indication_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "e90d13675887ad4c92d8ecfd3740856c", "score": "0.39713642", "text": "func (client *Client) DescribeScuDeductFactor(request *DescribeScuDeductFactorRequest) (response *DescribeScuDeductFactorResponse, err error) {\n\tresponse = CreateDescribeScuDeductFactorResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "title": "" }, { "docid": "32d13a991af7b6c88f8b48d5d17fc4b7", "score": "0.39689997", "text": "func (p *Client) ReadLongCharacteristic(c *ble.Characteristic) ([]byte, error) {\n\tlog.Printf(\"BLE GATT: %s: read long characteristic\", c.UUID)\n\tp.Lock()\n\tdefer p.Unlock()\n\n\t// The maximum length of an attribute value shall be 512 octects [Vol 3, 3.2.9]\n\tbuffer := make([]byte, 0, 512)\n\n\tread, err := p.ac.Read(c.ValueHandle)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbuffer = append(buffer, read...)\n\n\tfor len(read) >= p.conn.TxMTU()-1 {\n\t\tif read, err = p.ac.ReadBlob(c.ValueHandle, uint16(len(buffer))); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbuffer = append(buffer, read...)\n\t}\n\n\tc.Value = buffer\n\tlog.Printf(\"BLE GATT: %s: %s: read %d bytes from characteristic\", p, c.UUID, len(buffer))\n\treturn buffer, nil\n}", "title": "" }, { "docid": "87fefe5bfba54727c22ea5f941795d2b", "score": "0.39586377", "text": "func (o *CostByOrgAttributes) GetCharges() []ChargebackBreakdown {\n\tif o == nil || o.Charges == nil {\n\t\tvar ret []ChargebackBreakdown\n\t\treturn ret\n\t}\n\treturn o.Charges\n}", "title": "" }, { "docid": "2013c63a97ba9857895f0cba3269f839", "score": "0.39569804", "text": "func (*CMsgGCGetHeroTimedStatsResponse) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{41}\n}", "title": "" }, { "docid": "820f35203f15256126bfb6a142d3b891", "score": "0.39527825", "text": "func (b *GenericAccessDriver) GetAppearance() string {\n\tc, _ := b.adaptor().ReadCharacteristic(\"2a01\")\n\tbuf := bytes.NewBuffer(c)\n\n\tvar val uint16\n\tbinary.Read(buf, binary.LittleEndian, &val)\n\treturn appearances[val]\n}", "title": "" }, { "docid": "db45c700b61c74bdc0a705445b847ccb", "score": "0.3942675", "text": "func (p *GetAttributesParams) Do(ctx context.Context) (attributes []string, err error) {\n\t// execute\n\tvar res GetAttributesReturns\n\terr = cdp.Execute(ctx, CommandGetAttributes, p, &res)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn res.Attributes, nil\n}", "title": "" }, { "docid": "3d83eb74648393a420c2d094060c396b", "score": "0.3941571", "text": "func (o *AeThreats) GetThreats() map[string]Threat {\n\tif o == nil || o.Threats == nil {\n\t\tvar ret map[string]Threat\n\t\treturn ret\n\t}\n\treturn *o.Threats\n}", "title": "" }, { "docid": "d9e4c5b6aa6a9516ee138ecff616faf7", "score": "0.39391944", "text": "func DetailedDishInformation(c echo.Context) error {\n\n\tdb, ok := c.Get(\"db\").(*gorm.DB)\n\n\tif !ok {\n\t\treturn c.NoContent(http.StatusInternalServerError)\n\t}\n\n\t_schoolID, _ := strconv.Atoi(c.Param(\"id\"))\n\n\t_canteenID, _ := strconv.Atoi(c.Param(\"id2\"))\n\n\t_menuID, _ := strconv.Atoi(c.Param(\"id3\"))\n\n\t_dishID, _ := strconv.Atoi(c.Param(\"id4\"))\n\n\t_canteen := canteen.Canteen{}\n\n\t_canteen.SchoolID = uint(_schoolID)\n\n\t_canteen.ID = uint(_canteenID)\n\n\t_menu := menu.Menu{}\n\n\t_dish := model.Dish{}\n\n\terr := db.Find(&_dish, _dishID).Error\n\n\t// First check if dish with given id exists, and if not return Not Found\n\n\tif err != nil {\n\t\treturn c.NoContent(http.StatusNotFound)\n\t}\n\n\terr = db.Find(&_menu, _menuID).Error\n\n\t// Check if menu with given id exists, and if not return Not Found\n\n\tif err != nil {\n\t\treturn c.NoContent(http.StatusNotFound)\n\t}\n\n\t_menuEntry := canteen.MenuEntry{}\n\n\terr = db.Where(&_canteen).First(&_canteen).Error\n\n\t// Now lets grant that the menu belongs to the canteen, and if not return Not Found\n\n\tif err != nil {\n\t\treturn c.NoContent(http.StatusNotFound)\n\t}\n\n\t_menuEntry.CanteenID = _canteen.ID\n\n\t_menuEntry.ID = _menu.MenuEntryID\n\n\terr = db.Where(&_menuEntry).First(&_menuEntry).Error\n\n\tif err != nil {\n\t\treturn c.NoContent(http.StatusNotFound)\n\t}\n\n\tmodelview := view.ToGetDetailedDishInformationModelView(_dish)\n\n\treturn c.JSON(http.StatusOK, modelview)\n\n}", "title": "" }, { "docid": "6abed50456debe9fe1888a9529b328f3", "score": "0.39275897", "text": "func (o *VnicIscsiBootPolicyAllOf) GetChap() VnicIscsiAuthProfile {\n\tif o == nil || o.Chap.Get() == nil {\n\t\tvar ret VnicIscsiAuthProfile\n\t\treturn ret\n\t}\n\treturn *o.Chap.Get()\n}", "title": "" }, { "docid": "fa7b020e0c3c40b82a2bb7d64cace88c", "score": "0.39208812", "text": "func (d *Device) Properties() (r map[string]string) {\n\td.lock()\n\tdefer d.unlock()\n\tr = make(map[string]string)\n\tfor l := C.udev_device_get_properties_list_entry(d.ptr); l != nil; l = C.udev_list_entry_get_next(l) {\n\t\tr[C.GoString(C.udev_list_entry_get_name(l))] = C.GoString(C.udev_list_entry_get_value(l))\n\t}\n\treturn\n}", "title": "" }, { "docid": "41875fc896cdab6046562871285dd5cd", "score": "0.39108422", "text": "func (st *stCharacter) getCharacterSpecies() error {\n\t// URL for finding the species\n\tspeciesURL := constants.StURL + constants.SPECIES_SUB_URL + \"?uid=\" + st.Uid\n\n\tspeciesBytes, err := libhttp.CallRest(speciesURL, http.MethodGet, \"\")\n\n\t// Raising custom error aggrigating all HTTP errors\n\tif err != nil {\n\t\tlogger.Print(\"getCharacterSpecies\", err.Error())\n\t\treturn errors.New(constants.SPECIES_NOT_FOUND)\n\t}\n\n\tvar speciesInfo = struct {\n\t\tCharacter stCharacter `json:\"character\"`\n\t}{}\n\n\tjson.Unmarshal(speciesBytes, &speciesInfo)\n\n\t// if no species found raise error\n\tif len(speciesInfo.Character.Species) == 0 {\n\t\tlogger.Print(\"getCharacterSpecies\", constants.SPECIES_NOT_FOUND)\n\t\treturn errors.New(constants.SPECIES_NOT_FOUND)\n\t}\n\n\tst.Species = speciesInfo.Character.Species\n\n\treturn nil\n}", "title": "" }, { "docid": "9fb23f81f4daf71496f988cbe897b4eb", "score": "0.39075625", "text": "func (anime *Anime) Characters() *AnimeCharacters {\n\tcharacters, _ := GetAnimeCharacters(anime.ID)\n\treturn characters\n}", "title": "" }, { "docid": "2b6780651e96bcf78bf23829f2e50186", "score": "0.38939765", "text": "func (*SubstanceDefinition_Moiety) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_resources_substance_definition_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "f32c6f6134027e4ad282b86cf8db3f42", "score": "0.38915005", "text": "func QueryCapabilities(fd int) (*Capability, error) {\n\tcapability := &Capability{}\n\tif _, _, err := syscall.Syscall(syscall.SYS_IOCTL, uintptr(fd), uintptr(VidIocQueryCap), uintptr(unsafe.Pointer(capability))); err != 0 {\n\t\treturn nil, err\n\t}\n\treturn capability, nil\n}", "title": "" }, { "docid": "21b4ef5a2e16d2adce12d92d34ae7422", "score": "0.38904893", "text": "func GetAllPrivilege() []models.Privilege {\n\tlog.Println(\"Get all privilege\")\n\n\tvar privileges []models.Privilege\n\tcur, err := db.Collection(\"privileges\").Find(context.TODO(), bson.D{})\n\t// defer cur.Close(context.TODO())\n\tif err != nil {\n\t\tlog.Print(err)\n\t} else {\n\t\tfor cur.Next(context.TODO()) {\n\t\t\tvar privilege models.Privilege\n\t\t\terr := cur.Decode(&privilege)\n\t\t\tif err != nil {\n\t\t\t\tlog.Print(err)\n\t\t\t} else {\n\t\t\t\tprivileges = append(privileges, privilege)\n\t\t\t}\n\n\t\t}\n\t}\n\n\tlog.Println(\"Return all privilege: \", privileges)\n\treturn privileges\n}", "title": "" }, { "docid": "e95d3069a92dd7df2cd7283f022be77e", "score": "0.3889623", "text": "func (c *ChromeDOM) GetAttributes(nodeId *types.ChromeDOMNodeId, ) ([]string, error) {\n\tparamRequest := make(map[string]interface{}, 1)\n\tparamRequest[\"nodeId\"] = nodeId\n\trecvCh, _ := sendCustomReturn(c.target.sendCh, &ParamRequest{Id: c.target.getId(), Method: \"DOM.getAttributes\", Params: paramRequest})\n\tresp := <-recvCh\n\n\tvar chromeData struct {\n\t\tResult struct { \n\t\t\tAttributes []string \n\t\t}\n\t}\n\t\t\n\terr := json.Unmarshal(resp.Data, &chromeData)\n\tif err != nil {\n\t\tcerr := &ChromeErrorResponse{}\n\t\tchromeError := json.Unmarshal(resp.Data, cerr)\n\t\tif chromeError == nil {\n\t\t\treturn nil, &ChromeRequestErr{Resp: cerr}\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn chromeData.Result.Attributes, nil\n}", "title": "" }, { "docid": "aefa7224b56e9c3c4a2009869a4fe263", "score": "0.3887157", "text": "func (c *Character) DetermineHitPoints() *Attribute {\n\n\thp := &Attribute{\n\t\tName: \"Hit Points\",\n\t\tMaxValue: 21,\n\t}\n\n\ts := c.Statistics[\"SIZ\"]\n\ts.UpdateStatistic()\n\n\tsiz := s.Total\n\n\tp := c.Statistics[\"POW\"]\n\tp.UpdateStatistic()\n\n\tpow := p.Total\n\n\tfmt.Println(\"SIZ \", siz)\n\tfmt.Println(\"POW \", pow)\n\n\tcon := c.Statistics[\"CON\"]\n\tcon.UpdateStatistic()\n\n\tfmt.Println(\"CON \", con.Total)\n\n\tbaseHP := con.Total\n\n\tswitch {\n\tcase siz < 5:\n\t\tbaseHP -= 2\n\t\tfmt.Println(\"-2\")\n\tcase siz < 9:\n\t\tbaseHP--\n\t\tfmt.Println(\"-1\")\n\tcase siz < 13:\n\t\tfmt.Println(\"No change\")\n\tcase siz < 17:\n\t\tbaseHP++\n\t\tfmt.Println(\"+1\")\n\tcase siz < 21:\n\t\tbaseHP += 2\n\t\tfmt.Println(\"+2\")\n\tcase siz < 25:\n\t\tbaseHP += 3\n\t\tfmt.Println(\"+3\")\n\tcase siz > 24:\n\t\tbaseHP += ((siz - 24) / 4) + 4\n\t}\n\n\tswitch {\n\tcase pow < 5:\n\t\tbaseHP--\n\tcase pow < 9:\n\t\tfmt.Println(\"No change\")\n\tcase pow < 13:\n\t\tfmt.Println(\"No change\")\n\tcase pow < 17:\n\t\tfmt.Println(\"No change\")\n\tcase pow < 21:\n\t\tbaseHP++\n\tcase pow < 25:\n\t\tbaseHP += 2\n\tcase pow > 24:\n\t\tbaseHP += ((pow - 24) / 4) + 3\n\t}\n\n\thp.Base = baseHP\n\thp.Max = baseHP\n\n\tlocHP := 0\n\n\tswitch {\n\tcase hp.Base < 7:\n\t\tlocHP = 2\n\tcase hp.Base < 10:\n\t\tlocHP = 3\n\tcase hp.Base < 13:\n\t\tlocHP = 4\n\tcase hp.Base < 16:\n\t\tlocHP = 5\n\tcase hp.Base < 19:\n\t\tlocHP = 6\n\tcase hp.Base < 22:\n\t\tlocHP = 7\n\tcase hp.Base > 21:\n\t\tlocHP = ((hp.Base - 21) / 3) + 7\n\t}\n\n\tfor _, v := range c.HitLocations {\n\t\tv.Max = locHP + v.Base\n\t\tv.Min = -(2 * v.Max)\n\t}\n\n\treturn hp\n}", "title": "" }, { "docid": "c0c641e62305f329e8588e9ffce6a6d9", "score": "0.3881753", "text": "func (c collector) Describe(ch chan<- *prometheus.Desc) {\n\tch <- temperatureDesc\n\tch <- pressureDesc\n\tch <- humidityDesc\n}", "title": "" }, { "docid": "73a88abbf734838b4f05f1409b4b225e", "score": "0.38788226", "text": "func (f *IBMPIDhcpClient) GetAll() (models.DHCPServers, error) {\n\tparams := p_cloud_service_d_h_c_p.NewPcloudDhcpGetallParams().\n\t\tWithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).\n\t\tWithCloudInstanceID(f.cloudInstanceID)\n\tresp, err := f.session.Power.PCloudServicedhcp.PcloudDhcpGetall(params, f.session.AuthInfo(f.cloudInstanceID))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to Get all DHCP servers: %w\", err)\n\t}\n\tif resp == nil || resp.Payload == nil {\n\t\treturn nil, fmt.Errorf(\"failed to Get all DHCP servers\")\n\t}\n\treturn resp.Payload, nil\n}", "title": "" }, { "docid": "58bc51e6105659d9f5c12bc2d806533f", "score": "0.38742825", "text": "func retrieveChievesForPlayer(realm, player string) (*wowp.CharacterAchievementsSummary, error) {\n\tif c, ok := wowPlayerChieveCache.Get(realm + \"-\" + player); ok {\n\t\treturn c.(*wowp.CharacterAchievementsSummary), nil\n\t}\n\tcas, _, err := bNetClient.WoWCharacterAchievementsSummary(ctx, realm, player)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\twowPlayerChieveCache.SetDefault(realm+\"-\"+player, cas)\n\treturn cas, nil\n}", "title": "" }, { "docid": "a2c7eeb4521daefcd422826b4a463c25", "score": "0.3873398", "text": "func (c *statsCollector) Describe(ch chan<- *prometheus.Desc) {\n\tds := []*prometheus.Desc{\n\t\tc.FreelistFreePages,\n\t\tc.FreelistPendingPages,\n\t\tc.FreelistFreePageAllocatedBytes,\n\t\tc.FreelistInUseBytes,\n\t\tc.ReadTxTotal,\n\t\tc.OpenReadTx,\n\n\t\tc.TxPagesAllocatedTotal,\n\t\tc.TxPagesAllocatedBytesTotal,\n\t\tc.TxCursorsTotal,\n\t\tc.TxNodesAllocatedTotal,\n\t\tc.TxNodesDereferencedTotal,\n\t\tc.TxNodeRebalancesTotal,\n\t\tc.TxNodeRebalanceSecondsTotal,\n\t\tc.TxNodesSplitTotal,\n\t\tc.TxNodesSpilledTotal,\n\t\tc.TxNodesSpilledSecondsTotal,\n\t\tc.TxWritesTotal,\n\t\tc.TxWriteSecondsTotal,\n\t}\n\n\tfor _, d := range ds {\n\t\tch <- d\n\t}\n}", "title": "" }, { "docid": "7fd0a49943b589eaab1a4254a199b601", "score": "0.3869305", "text": "func (*SmdQueryResp_SmdDeviceWithHealth) Descriptor() ([]byte, []int) {\n\treturn file_ctl_smd_proto_rawDescGZIP(), []int{8, 0}\n}", "title": "" }, { "docid": "bb467a030ca74baa9d8f0c8e3393ec05", "score": "0.38640937", "text": "func (*CMsgGCGetHeroStandings) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{37}\n}", "title": "" }, { "docid": "43e58dfd4fd6cc3513ae733f6dfc6bfd", "score": "0.38469663", "text": "func (s *service) getStoragePoolCapacities(ctx context.Context, symmetrixID, storagePoolID string, pmaxClient pmax.Pmax) (*types.SrpCap, *types.FbaCap, *types.CkdCap, error) {\n\t// Get storage pool info\n\tsrp, err := pmaxClient.GetStoragePool(ctx, symmetrixID, storagePoolID)\n\tif err != nil {\n\t\treturn nil, nil, nil, status.Errorf(codes.Internal, \"Could not retrieve StoragePool %s. Error(%s)\", storagePoolID, err.Error())\n\t}\n\tif srp.SrpCap != nil {\n\t\tlog.Infof(\"StoragePoolCapacities: %#v\", srp.SrpCap)\n\t\treturn srp.SrpCap, nil, nil, nil\n\t}\n\tif (srp.FbaCap != nil) || (srp.CkdCap != nil) {\n\t\tlog.Infof(\"StoragePoolCapacities(Fba/Ckd) : %#v StoragePoolCapacities(Fba/Ckd) : %#v \", srp.FbaCap, srp.CkdCap)\n\t\treturn nil, srp.FbaCap, srp.CkdCap, nil\n\t}\n\treturn nil, nil, nil, status.Errorf(codes.Internal, \"Could not retrieve StoragePool %s. Error(%s)\", storagePoolID, err.Error())\n}", "title": "" }, { "docid": "b5a5f823661a5b4715bb91db923eaa78", "score": "0.38459244", "text": "func (p *AccountPrivacyRules) GetChats() (value []ChatClass) {\n\tif p == nil {\n\t\treturn\n\t}\n\treturn p.Chats\n}", "title": "" }, { "docid": "8521e543eb9eaac870e5243aa7c0fad4", "score": "0.3842677", "text": "func (m *DeviceCategory) GetDescription()(*string) {\n return m.description\n}", "title": "" }, { "docid": "4aa9b0cf8651a30ac341455cd703e719", "score": "0.38421994", "text": "func udevAttributes(ctx context.Context, devicePath string) (map[string]string, error) {\n\tcmd := testexec.CommandContext(ctx, \"udevadm\", \"info\", \"--attribute-walk\", \"property\", \"--name\", devicePath)\n\tout, err := cmd.Output()\n\tif err != nil {\n\t\tcmd.DumpLog(ctx)\n\t\treturn nil, errors.Errorf(\"failed running %q\", strings.Join(cmd.Args, \" \"))\n\t}\n\treturn parseUdev(out, `^ATTRS{([a-z0-9_]+)}==\"(.*)\"$`)\n}", "title": "" }, { "docid": "c35b1e29360bf696de3dbad944e795aa", "score": "0.38410896", "text": "func (*SubstanceDefinition_Structure_Isotope_MolecularWeight) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_resources_substance_definition_proto_rawDescGZIP(), []int{0, 2, 0, 0}\n}", "title": "" }, { "docid": "3adfafc23a915bfc9628fd84ff4c2ba4", "score": "0.38394442", "text": "func (m *ManagedTenant) GetDeviceHealthStatuses()([]DeviceHealthStatusable) {\n val, err := m.GetBackingStore().Get(\"deviceHealthStatuses\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]DeviceHealthStatusable)\n }\n return nil\n}", "title": "" }, { "docid": "f01db134d26e406b1fe68c92cd9e8977", "score": "0.38311958", "text": "func Devices() []*HidDevice {\n\thidDevices := hid.Devices()\n\tdevices := make([]*HidDevice, len(hidDevices))\n\tfor i, _ := range hidDevices {\n\t\tdevices[i] = newHidDevice(hidDevices[i])\n\t}\n\treturn devices\n}", "title": "" }, { "docid": "8af3f7987bd11a46914a7dc51fe278a6", "score": "0.3827315", "text": "func (*TbcowcowStateDealResp) Descriptor() ([]byte, []int) {\n\treturn file_tbcowcow_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "609d93ccd03bf77a9e499e75d2243ede", "score": "0.3825849", "text": "func (*GetFirehoseCustomerResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_openbank_openbank_v1_customer_all_proto_rawDescGZIP(), []int{36}\n}", "title": "" }, { "docid": "08b61cf37e337a1944d7d585987aaeb2", "score": "0.38241816", "text": "func (mo *HostDatastoreSystem) Capabilities() (*HostDatastoreSystemCapabilities, error) {\n\tp, err := mo.currentProperty(\"capabilities\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif p != nil {\n\t\treturn p.(*HostDatastoreSystemCapabilities), nil\n\t}\n\treturn nil, nil\n\n}", "title": "" }, { "docid": "44bbc10c60b6448bb0e383e01de31e1a", "score": "0.38181344", "text": "func (k Keeper) GetAllAttributes(ctx sdk.Context, acc sdk.AccAddress) ([]types.Attribute, error) {\n\tdefer telemetry.MeasureSince(time.Now(), types.ModuleName, \"keeper_method\", \"get_all\")\n\n\tpred := func(s string) bool { return true }\n\treturn k.prefixScan(ctx, types.AccountAttributesKeyPrefix(acc), pred)\n}", "title": "" }, { "docid": "8801b962a9aa959af94d364a436deb9a", "score": "0.38168487", "text": "func (a SmPolicyDecision_QosChars) Get(fieldName string) (value QosCharacteristics, found bool) {\n\tif a.AdditionalProperties != nil {\n\t\tvalue, found = a.AdditionalProperties[fieldName]\n\t}\n\treturn\n}", "title": "" }, { "docid": "39d5b8e840a3bb9b3717f4a1c3251f00", "score": "0.38155922", "text": "func (m *ContentType) GetColumns()([]ColumnDefinitionable) {\n val, err := m.GetBackingStore().Get(\"columns\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]ColumnDefinitionable)\n }\n return nil\n}", "title": "" }, { "docid": "9c89782bf3cf621dbee507b29d1fa193", "score": "0.3813274", "text": "func (d *ACSDriver) GetCapabilities(ctx context.Context) (*types.Capabilities, error) {\n\tcap := &types.Capabilities{}\n\treturn cap, nil\n}", "title": "" }, { "docid": "35ef919452e04ba8a4eef8a7cb955339", "score": "0.38129807", "text": "func (*ClearDonutsResponse) Descriptor() ([]byte, []int) {\n\treturn file_donuts_protos_donuts_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "3ab97ac1a0aa950d687346342a04481f", "score": "0.38088852", "text": "func (m *WindowsDefenderAdvancedThreatProtectionConfigurationCollectionResponse) GetValue()([]WindowsDefenderAdvancedThreatProtectionConfigurationable) {\n return m.value\n}", "title": "" }, { "docid": "8cf317ae8d58927e41e7f156f5071046", "score": "0.3808463", "text": "func (mc *MetricCollector) Describe(ch chan<- *prometheus.Desc) {\n\tfor _, desc := range mc.desc {\n\t\tch <- desc\n\t}\n}", "title": "" }, { "docid": "1ab5e4f30a69875717a1938fe11b9825", "score": "0.38073954", "text": "func (c *Conn) getProperties(ctx context.Context, path dbus.ObjectPath, dbusInterface string) (map[string]interface{}, error) {\n\tvar err error\n\tvar props map[string]dbus.Variant\n\n\tif !path.IsValid() {\n\t\treturn nil, fmt.Errorf(\"invalid unit name: %v\", path)\n\t}\n\n\tobj := c.sysconn.Object(\"org.freedesktop.systemd1\", path)\n\terr = obj.CallWithContext(ctx, \"org.freedesktop.DBus.Properties.GetAll\", 0, dbusInterface).Store(&props)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := make(map[string]interface{}, len(props))\n\tfor k, v := range props {\n\t\tout[k] = v.Value()\n\t}\n\n\treturn out, nil\n}", "title": "" }, { "docid": "b2a36b3cffe6129cc2eca7127146d490", "score": "0.380497", "text": "func (c *Support) DescribeCases(req *DescribeCasesRequest) (resp *DescribeCasesResponse, err error) {\n\tresp = &DescribeCasesResponse{}\n\terr = c.client.Do(\"DescribeCases\", \"POST\", \"/\", req, resp)\n\treturn\n}", "title": "" }, { "docid": "e568d4669904e2bdc577543eef933fc1", "score": "0.38045698", "text": "func (i Input) Features() []int {\n features := make([]int, 12, 12)\n\n // The following maps create a relation between a certain feature and its\n // position within the features vector.\n indexes := map[deck.Value]int {\n deck.Nine: 0,\n deck.Ten: 1,\n deck.J: 2,\n deck.Q: 3,\n deck.K: 4,\n deck.A: 5,\n }\n\n aces := map[deck.Suit]int {\n deck.H: 7,\n deck.D: 8,\n deck.S: 9,\n deck.C: 10,\n }\n\n // Used to keep track of how many suits are in the hand.\n suitsPresent := make(map[deck.Suit]int)\n\n for _, card := range i.Hand {\n if card.Suit == i.Top.Suit {\n features[indexes[card.Value]] = 1\n } else if card.Suit == i.Top.Suit.Left() && card.Value == deck.J {\n features[6] = 1\n } else if card.Value == deck.A {\n features[aces[card.Suit]] = 1\n }\n\n // Adjust suit count for left bower and increment the count for the\n // current card's suit.\n adjSuit := card.AdjSuit(i.Top.Suit)\n if _, ok := suitsPresent[adjSuit]; ok {\n suitsPresent[adjSuit] += 1\n } else {\n suitsPresent[adjSuit] = 1\n }\n }\n\n suitCount := len(suitsPresent)\n // If the hand has less then 2 suits and no card is being picked up then one\n // can be sure we have 2 suits.\n if suitCount <= 2 && i.Dealer != 0 {\n features[11] = 1\n } else if suitCount <= 3 && i.Dealer == 0 {\n // Else, if there are less than 3 suits and we are picking up, one suit\n // might be gotten rid of yet. Even if we had 2 suits we would to check that\n // we already had the trump suit if we are picking up.\n _, trumpPresent := suitsPresent[i.Top.Suit]\n if suitCount <= 2 && trumpPresent {\n features[11] = 1\n } else if suitCount == 3 && trumpPresent {\n for _, card := range i.Hand {\n // If this is the only card in the hand of a given suit, and it\n // is not a trump (left bower or of the same suit as the top\n // card), and it is not an A, then by removing it we get rid of\n // one suit. So if there were only 3 suits, then this means we\n // have 2 suits after discarding if we were to pick up. We also\n // have to make sure that this removal will result in at 2 suits\n // and that picking up the top card does not increase the suit\n // amount.\n if suitsPresent[card.Suit] == 1 && card.Value != deck.A &&\n card.AdjSuit(i.Top.Suit) != i.Top.Suit {\n features[11] = 1\n\n // There could be more than one card that matches these\n // requirements, we only care if one exists, so break on finding\n // one.\n break\n }\n }\n }\n }\n\n // If you are picking it up then consider the weight of the card on top as\n // well. The discarded card need not be considered since, it is most likely\n // non-trump, and will not affect this analysis which only considers trump\n // cards. If it is a trump card, then every other card is a trump as well\n // and the final decision should not be affected.\n if i.Dealer == 0 && i.Dealer == 2 {\n features[indexes[i.Top.Value]] = 1\n }\n\n return features\n}", "title": "" } ]
ea8905ba79319fc45a70fd152df430fb
Login logs out of any existing session and logs in again.
[ { "docid": "75eeea8ac46e44c5ad88df763ed6e36d", "score": "0.70259136", "text": "func (s *Sessions) Login(w http.ResponseWriter, r *http.Request, userID string, p LoginParams) (*Session, error) {\n\toldSession := SessionFromRequest(r)\n\tsessionID, stickyID := newSessionID()\n\tsession := makeSession(&sessionParams{\n\t\tID: sessionID,\n\t\tStickyID: stickyID,\n\t\tUserID: userID,\n\t\tRememberMe: p.RememberMe,\n\t})\n\tif err := s.save(r.Context(), session); err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot write cookie: %w\", err)\n\t}\n\thttp.SetCookie(w, makeSessionCookie(session))\n\tgo s.expireOldSessionAfterLogin(userID, oldSession)\n\treturn session, nil\n}", "title": "" } ]
[ { "docid": "a66558007a91cd1e07c8ce66143f4124", "score": "0.7210187", "text": "func (u *User) Login(w http.ResponseWriter, r *http.Request) error {\n\tif u.ID == -1 {\n\t\treturn ErrNotLoggedIn\n\t}\n\n\tsess, err := u.mod.getSession(w, r, cookieLongTerm)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsess.Values[cookieKeyUID] = int64(u.ID)\n\tsess.Save(r, w)\n\treturn nil\n}", "title": "" }, { "docid": "03d53e437b60ef48e714ea15df990d7f", "score": "0.7064914", "text": "func Login(o *authoperator.AuthOperator, writer http.ResponseWriter, request *http.Request, logger *log.Entry) (int, string) {\n\tif o.Name() == \"nobody\" {\n\t\t// If the operator is a nobody, backtrack to the login page\n\t\treturn -1, \"\"\n\t}\n\twebcore.CreateSessionCookie(o, writer, request)\n\thttp.Redirect(writer, request, \"/\", http.StatusFound)\n\n\treturn webcore.DEBUG, \"\"\n}", "title": "" }, { "docid": "3fc64ba62ca121658a217a0a2ff3e09f", "score": "0.70256686", "text": "func (CTRL *LoginController) Login() {\n\tusername := CTRL.GetString(\"username\")\n\tpassword := CTRL.GetString(\"password\")\n\tbackTo := CTRL.GetString(\"back_to\")\n\n\tvar user models.User\n\tif VerifyUser(&user, username, password) {\n\t\tCTRL.SetSession(sessionName, user.Id)\n\t\tif backTo != \"\" {\n\t\t\tCTRL.Redirect(\"/admin/\"+backTo, 302)\n\t\t} else {\n\t\t\tCTRL.Redirect(\"/admin/profile/0/show\", 302)\n\t\t}\n\t} else {\n\t\tCTRL.Redirect(\"/admin/register\", 302)\n\t}\n\n}", "title": "" }, { "docid": "7fb58a0e2523327596c9d4b316da8901", "score": "0.69991195", "text": "func (c *CommonController) Login() {\n\tprincipal := c.GetString(\"principal\")\n\tpassword := c.GetString(\"password\")\n\n\tuser, err := auth.Login(models.AuthModel{principal, password})\n\tif err != nil {\n\t\tbeego.Error(\"Error occurred in UserLogin:\", err)\n\t\tc.CustomAbort(http.StatusUnauthorized, \"\")\n\t}\n\n\tif user == nil {\n\t\tc.CustomAbort(http.StatusUnauthorized, \"\")\n\t}\n\n\tc.SetSession(\"userId\", user.UserID)\n\tc.SetSession(\"username\", user.Username)\n}", "title": "" }, { "docid": "608ed9a9308904e26968994b551e54ab", "score": "0.6993009", "text": "func login(w http.ResponseWriter, r *http.Request) {\n\tsession, _ := sessionStore.Get(r, \"cookie-name\")\n\n\t//set some session values\n\tsession.Values[\"authenticated\"] = true\n\tsession.Values[\"userid\"] = 0\n\tsession.Values[\"logintime\"] = time.Now()\n\n\t//SAVE SESSION\n\terr := session.Save(r, w)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "28bccd73e99f815b5482175550d86cff", "score": "0.68516415", "text": "func Login(c *gin.Context, u db.User) {\n\tsession := sessions.Default(c)\n\tsession.Set(\"Name\", u.Name)\n\tsession.Set(\"Email\", u.Email)\n\tsession.Save()\n}", "title": "" }, { "docid": "308cca3edaf6b0883fdfeca70aefa2b4", "score": "0.68434674", "text": "func Login(w http.ResponseWriter, r *http.Request) {\n\tif r.Method == \"POST\" {\n\t\terr := r.ParseForm()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t\tlogin := r.FormValue(\"login\")\n\t\tpassword := r.FormValue(\"password\")\n\t\tlog.Println(login, \" \", password)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\thttp.ServeFile(w, r, \"templates/error.html\")\n\t\t}\n\t\tsession, err := sessions.Store.Get(r, \"session\")\n\n\t\tvar check bool\n\t\tvar rank int\n\t\tcheck, rank = db.ValidUser(login, password)\n\t\tif check {\n\t\t\tsession.Values[\"loggedin\"] = \"true\"\n\t\t\tsession.Values[\"username\"] = login\n\t\t\tsession.Save(r, w)\n\t\t\tswitch rank {\n\t\t\tcase 0:\n\t\t\t\thttp.Redirect(w, r, \"/\", 301)\n\t\t\tcase 1:\n\t\t\t\thttp.Redirect(w, r, \"/teacher\", 301)\n\t\t\tcase 2:\n\t\t\t\thttp.Redirect(w, r, \"/admin\", 301)\n\t\t\t}\n\n\t\t} else {\n\t\t\thttp.ServeFile(w, r, \"templates/login_fail.html\")\n\t\t}\n\n\t} else {\n\t\thttp.ServeFile(w, r, \"templates/new_login.html\")\n\t}\n}", "title": "" }, { "docid": "71f6b57fe735eaaa17b46839bc01d0a9", "score": "0.67910683", "text": "func Login(w http.ResponseWriter, r *http.Request) {\n\tu, err := readUser(r)\n\tif err != nil {\n\t\twriteError(w, http.StatusBadRequest, jsonErr{Code: 404, Text: \"Invalid arguments\"})\n\t\treturn\n\t}\n\tuser := RepoFindUser(u.Email)\n\tif (User{}) == user || user.Password != sha256Hash(u.Password, user.Salt) {\n\t\twriteError(w, http.StatusBadRequest, jsonErr{Code: 404, Text: \"Invalid Email or Password\"})\n\t\treturn\n\t}\n\tsessionID := startSession()\n\ttokenString, err := generateToken(sessionID)\n\tif err != nil {\n\t\twriteError(w, http.StatusInternalServerError, jsonErr{Code: 404, Text: \"Error Creating Token\"})\n\t\treturn\n\t}\n\terr = writeJSON(w, http.StatusOK, SessionTokenResponse{Token: tokenString})\n\tif err != nil {\n\t\twriteError(w, http.StatusInternalServerError, jsonErr{Code: 404, Text: \"Unable to craft response\"})\n\t}\n}", "title": "" }, { "docid": "e002d1b03751c0c88dc69758b6ed0330", "score": "0.678408", "text": "func (m *Map) Login(id string, c connections.OutputConnection) error {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\tconn, ok := m.conn(id)\n\tif ok {\n\t\terr := m.onLogout(id, conn)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tm.Identities.Delete(id)\n\tm.Identities.Store(id, c)\n\treturn nil\n}", "title": "" }, { "docid": "48ec7772a4a6521a792da3cff5ad383a", "score": "0.67737496", "text": "func Login(db database.Database, username, password string) (models.Session, error) {\n\taccount, err := db.GetAccountByUsername(username)\n\tif err != nil {\n\t\tif err.Error() == \"no matching account found\" {\n\t\t\treturn models.Session{}, fmt.Errorf(\"Error: %s\", UnathorizedErrorMessage)\n\t\t}\n\n\t\treturn models.Session{}, fmt.Errorf(\"There was a problem getting account information: %s\", err.Error())\n\t}\n\n\tpassword, err = GetSaltedPassword(password, account.Salt)\n\tif err != nil {\n\t\treturn models.Session{}, fmt.Errorf(\"There was a problem salting the password: %s\", err.Error())\n\t}\n\n\tif password != account.Password {\n\t\treturn models.Session{}, fmt.Errorf(\"Error: %s\", UnathorizedErrorMessage)\n\t}\n\n\tsession := CreateSession(account.Username)\n\terr = db.StoreSession(session)\n\n\tif err != nil {\n\t\treturn models.Session{}, fmt.Errorf(\"There was a problem storing the session: %s\", err.Error())\n\t}\n\n\treturn session, nil\n}", "title": "" }, { "docid": "2a4f475a5b6782ca6389e1c7f02f2973", "score": "0.6740428", "text": "func login(w http.ResponseWriter, r *http.Request) {\n\tUsername := r.FormValue(\"Username\")\n\tPassword := crypt(r.FormValue(\"Password\"))\n\tcfg := LoadConfig()\n\tu := cfg.getUser(Username)\n\tif u.Password != Password {\n\t\tps := newPageStatus(r)\n\t\tps[\"Error\"] = tr(\"Access Denied\")\n\t\terr := templates.ExecuteTemplate(w, \"login\", ps)\n\t\thandleError(w, r, err)\n\t\treturn\n\t} else {\n\t\ts, err := SessionFor(w, r)\n\t\tif handleError(w, r, err) {\n\t\t\treturn\n\t\t}\n\t\ts[LOGGEDUSER] = u\n\t\ts.Save()\n\t\ttargetUrl := r.FormValue(\"URL\")\n\t\tif targetUrl == \"\" {\n\t\t\ttargetUrl = \"/\"\n\t\t}\n\t\thttp.Redirect(w, r, targetUrl, 302)\n\t}\n}", "title": "" }, { "docid": "f13077e3c95eba2b4ccac237b7c052c9", "score": "0.6738942", "text": "func Login(w http.ResponseWriter, r *http.Request) {\n\tif r.Method == \"POST\" {\n\t\tr.ParseForm()\n\t\tuser := r.Form.Get(\"user\")\n\t\tpassword := r.Form.Get(\"password\")\n\t\tif auth.GlobalAccountManager.Authenticate(user, password) {\n\t\t\tsess, sid := session.GlobalSessionManager.CreateSession()\n\t\t\tsess.Set(session.SESSION_USERNAME, user)\n\t\t\tsess.Set(session.SESSION_AUTHENTICATED, true)\n\t\t\tsess.Set(session.SESSION_PATH, path.Join())\n\t\t\thttp.SetCookie(w, NewCookie(sid))\n\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\tShowGophile(w, CreateFileData(user, \"\", \"Welcome, \"+user+\"!\"))\n\t\t} else {\n\t\t\tw.WriteHeader(http.StatusForbidden)\n\t\t\tShowIndex(w, \"User or password incorrect.\")\n\t\t}\n\t} else {\n\t\tw.WriteHeader(http.StatusMethodNotAllowed)\n\t}\n}", "title": "" }, { "docid": "c1caecacef364f1f35d80a5cba48c2ff", "score": "0.6734488", "text": "func (h *handle) SessionLogin(ctx context.Context, req *padlockpb.SessionLoginRequest) (*padlockpb.SessionLoginResponse, error) {\n\tid, err := h.authenticate(req.GetId().GetAuth())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlog.Printf(\"Logging into session for %s\\n\", id)\n\tsess, err := h.getSession(req.GetId().GetUuid(), id.String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer sess.mx.Unlock()\n\tif req.GetLoginAsSecurityOfficer() {\n\t\terr = sess.sess.LoginSecurityOfficer(req.GetPin())\n\t} else {\n\t\terr = sess.sess.Login(req.GetPin())\n\t}\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.PermissionDenied, \"login failed: %v\", err)\n\t}\n\t// TODO: propagate login/logout state update to all sessions on this slot\n\treturn &padlockpb.SessionLoginResponse{}, nil\n}", "title": "" }, { "docid": "ee29834862f616f763becf5e14d5f3d0", "score": "0.67253876", "text": "func login(res http.ResponseWriter, req *http.Request) {\n\tif alreadyLoggedIn(req) {\n\t\thttp.Redirect(res, req, \"/home\", http.StatusSeeOther)\n\t\treturn\n\t}\n\tif req.Method == http.MethodPost {\n\t\tun := req.FormValue(\"username\")\n\t\tp := req.FormValue(\"password\")\n\t\tu, ok := dbUsers[un]\n\t\tif !ok {\n\t\t\ttpl.ExecuteTemplate(res, \"login.gohtml\", \"Incorrect Username Or Password\")\n\t\t\treturn\n\t\t}\n\t\terr := bcrypt.CompareHashAndPassword(u.Password, []byte(p))\n\t\tif err != nil {\n\t\t\ttpl.ExecuteTemplate(res, \"login.gohtml\", \"Incorrect Username Or Password\")\n\t\t\treturn\n\t\t}\n\t\tsID, _ := uuid.NewV4()\n\t\tc := &http.Cookie{\n\t\t\tName: \"session\",\n\t\t\tValue: sID.String(),\n\t\t}\n\t\thttp.SetCookie(res, c)\n\t\tdbSessions[c.Value] = un\n\t\thttp.Redirect(res, req, \"/home\", http.StatusSeeOther)\n\t\treturn\n\t}\n\n\ttpl.ExecuteTemplate(res, \"login.gohtml\", nil) // must direct some where\n}", "title": "" }, { "docid": "2b2b7297722ef10db20069bf8f5723ec", "score": "0.6689877", "text": "func login(repo *Repository) error {\n\n\ttemplate := map[string]string{\n\t\t\"href\": \"session-template/internal\",\n\t\t\"username\": repo.username,\n\t\t\"password\": repo.password,\n\t}\n\n\tvalues := map[string]map[string]string{\n\t\t\"sessionTemplate\": template,\n\t}\n\tjsonValue, _ := json.Marshal(values)\n\n\tresp, err := repo.client.Post(repo.path(pathSession), \"application/json\", bytes.NewBuffer(jsonValue))\n\n\tvar msg string\n\n\tif err == nil {\n\t\t/* The msg will not be used on Success or not failfast */\n\t\tmsg = fmt.Sprintf(\"%s %s\", resp.Status, http.StatusText(resp.StatusCode))\n\t\tdefer resp.Body.Close()\n\t} else {\n\t\tmsg = err.Error()\n\t}\n\n\tif !repo.failfast && (err != nil || resp.StatusCode == http.StatusBadGateway) {\n\t\tlog.Printf(\"Could not login to CIMI server: %s. Login deferred.\", msg)\n\t\terr = nil\n\t} else {\n\n\t\tif resp != nil && resp.StatusCode == http.StatusCreated {\n\t\t\trepo.logged = true\n\t\t} else {\n\t\t\terr = errors.New(msg)\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "aea07f0c1f78d2050d8e4a62fbc00c95", "score": "0.66818655", "text": "func (db *DataBase) Login(user *models.UserPrivateInfo) (sessionCode string, found *models.UserPublicInfo, err error) {\n\n\tvar (\n\t\ttx *sql.Tx\n\t\tuserID int\n\t)\n\n\tif tx, err = db.Db.Begin(); err != nil {\n\t\treturn\n\t}\n\tdefer tx.Rollback()\n\n\tif userID, found, err = db.checkBunch(tx, user.Email, user.Password); err != nil {\n\t\tfmt.Println(\"database/login - fail enter\")\n\t\treturn\n\t}\n\n\tif sessionCode, err = db.createSession(tx, userID); err != nil {\n\t\tfmt.Println(\"database/login - fail creating Session\")\n\t\treturn\n\t}\n\n\tif err = db.updatePlayerLastSeen(tx, userID); err != nil {\n\t\tfmt.Println(\"database/login - fail updatePlayerLastSeen\")\n\t\treturn\n\t}\n\n\tfmt.Println(\"database/login +\")\n\n\terr = tx.Commit()\n\treturn\n}", "title": "" }, { "docid": "43fa2c3eaf8c17f761216a13c94a3032", "score": "0.6668523", "text": "func (db *Database) Login(user, pass string) error {\n\treturn db.Session.Login(&Credential{Username: user, Password: pass, Source: db.Name})\n}", "title": "" }, { "docid": "62aa811265366afb3936ea457b2bbe48", "score": "0.666518", "text": "func (u *User) Login() {\n\t// Update last login time\n\t// Add to logged-in user's list\n\t// etc ...\n\tu.authenticated = true\n}", "title": "" }, { "docid": "60da4efe2ed5cf893fcec1faaaff7c72", "score": "0.66581684", "text": "func (h *handler) Login(ctx context.Context, w http.ResponseWriter, r *http.Request) error {\n\tvar (\n\t\tcookieStore = ctx.Value(\"cookieStore\").(*sessions.CookieStore)\n\t\terr error\n\n\t\tloginForm struct {\n\t\t\tIdentifier string\n\t\t\tPassword string\n\t\t}\n\t)\n\n\tif err = httputils.DecodeJSON(r.Body, &loginForm); err != nil {\n\t\thttputils.WriteError(w, http.StatusBadRequest, \"\")\n\t\treturn nil\n\t}\n\n\tuser, err := h.authService.BasicAuth(loginForm.Identifier, loginForm.Password)\n\n\tif err != nil {\n\t\thttputils.WriteError(w, http.StatusInternalServerError, \"\")\n\t\treturn nil\n\t} else if user == nil {\n\t\thttputils.WriteError(w, http.StatusUnauthorized, \"Usuario/clave inválidos\")\n\t\treturn nil\n\t}\n\n\tsession, _ := cookieStore.New(r, h.cfg.SessionCookieName)\n\tsession.Values[\"data\"] = &httputils.SessionData{\n\t\tUserID: user.ID,\n\t\tEmail: user.Email,\n\t\tIsAdmin: user.IsAdmin,\n\t\tIsTeacher: user.IsTeacher,\n\t\tExpiresAt: time.Now().Add(h.cfg.SessionLifeTime),\n\t}\n\n\treturn session.Save(r, w)\n}", "title": "" }, { "docid": "63b37b2d70610647840accc1bf59b8c8", "score": "0.66526693", "text": "func Login() error {\n\treturn LoginWithConnection(GetConnection())\n}", "title": "" }, { "docid": "5800401719a0a526dcbf38162637fcde", "score": "0.66518956", "text": "func (c *Client) Login() error {\n\tformData := url.Values{\"userId\": {c.username}, \"userPassword\": {c.password}}\n\tresp, err := c.hc.PostForm(c.baseURL+\"/enduserAPI/login\", formData)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error logging in: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\tif err := checkStatusOk(resp); err != nil {\n\t\treturn err\n\t}\n\tfor _, cookie := range resp.Cookies() {\n\t\tif (cookie.Name == \"JSESSIONID\") && (cookie.Value != \"\") {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn errors.New(\"JSESSIONID not found in response to /login\")\n}", "title": "" }, { "docid": "34839f3f938fa9816397975378a65619", "score": "0.66350114", "text": "func (c *AccountController) Login(ctx *app.LoginAccountContext) error {\n\t// AccountController_Login: start_implement\n\n\t// Put your logic here\n\n\treturn nil\n\t// AccountController_Login: end_implement\n}", "title": "" }, { "docid": "3fc0a29f72331f007d679b90b311da21", "score": "0.66196626", "text": "func (u *User) Login() {\n\t// Update last login time, add to logged-in user's list\n\tu.authenticated = true\n}", "title": "" }, { "docid": "61ff88336f1e22d2006bf068d56cce95", "score": "0.6615998", "text": "func (h *Handlers) Login(w http.ResponseWriter, r *http.Request) {\n\t// Extract credentials from request\n\tvar input map[string]string\n\tif err := json.NewDecoder(r.Body).Decode(&input); err != nil {\n\t\th.logger.Error().Err(err).Str(\"method\", \"Add\").Msg(hub.ErrInvalidInput.Error())\n\t\thelpers.RenderErrorJSON(w, hub.ErrInvalidInput)\n\t\treturn\n\t}\n\n\t// Check if the credentials provided are valid\n\tcheckCredentialsOutput, err := h.userManager.CheckCredentials(r.Context(), input[\"email\"], input[\"password\"])\n\tif err != nil {\n\t\th.logger.Error().Err(err).Str(\"method\", \"Login\").Msg(\"checkCredentials failed\")\n\t\thelpers.RenderErrorJSON(w, err)\n\t\treturn\n\t}\n\tif !checkCredentialsOutput.Valid {\n\t\thelpers.RenderErrorWithCodeJSON(w, nil, http.StatusUnauthorized)\n\t\treturn\n\t}\n\n\t// Register user session\n\tip, _, _ := net.SplitHostPort(r.RemoteAddr)\n\tsession, err := h.userManager.RegisterSession(r.Context(), &hub.Session{\n\t\tUserID: checkCredentialsOutput.UserID,\n\t\tIP: ip,\n\t\tUserAgent: r.UserAgent(),\n\t})\n\tif err != nil {\n\t\th.logger.Error().Err(err).Str(\"method\", \"Login\").Msg(\"registerSession failed\")\n\t\thelpers.RenderErrorJSON(w, err)\n\t\treturn\n\t}\n\n\t// Generate and set session cookie\n\tencodedSessionID, err := h.sc.Encode(sessionCookieName, session.SessionID)\n\tif err != nil {\n\t\th.logger.Error().Err(err).Str(\"method\", \"Login\").Msg(\"sessionID encoding failed\")\n\t\thelpers.RenderErrorJSON(w, err)\n\t\treturn\n\t}\n\tcookie := &http.Cookie{\n\t\tName: sessionCookieName,\n\t\tValue: encodedSessionID,\n\t\tPath: \"/\",\n\t\tExpires: time.Now().Add(sessionDuration),\n\t\tHttpOnly: true,\n\t\tSameSite: http.SameSiteLaxMode,\n\t}\n\tif h.cfg.GetBool(\"server.cookie.secure\") {\n\t\tcookie.Secure = true\n\t}\n\thttp.SetCookie(w, cookie)\n\tw.Header().Set(SessionApprovedHeader, strconv.FormatBool(session.Approved))\n\tw.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "c6698aee334beb8725c69ef730240b41", "score": "0.66072214", "text": "func (s *Session) Login(ctx context.Context, creds apitypes.LoginCredential) error {\n\tif !creds.Valid() {\n\t\treturn &apitypes.Error{\n\t\t\tType: apitypes.BadRequestError,\n\t\t\tErr: []string{\"invalid login credentials provided\"},\n\t\t}\n\t}\n\n\tvar authToken string\n\tvar err error\n\tswitch creds.Type() {\n\tcase apitypes.UserSession:\n\t\tauthToken, err = attemptHMACLogin(ctx, s.engine.client, s.engine.session, creds)\n\tcase apitypes.MachineSession:\n\t\tauthToken, err = attemptPDPKALogin(ctx, s.engine.client, s.engine.session, creds)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tself, err := s.engine.client.Self.Get(ctx, authToken)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.engine.db.Set(self.Identity)\n\tif self.Type == apitypes.UserSession {\n\t\ts.engine.db.Set(self.Auth)\n\t}\n\n\treturn s.engine.session.Set(self.Type, self.Identity, self.Auth, creds.Passphrase(), authToken)\n}", "title": "" }, { "docid": "55e8ccc21fd9c227ab36e5f09e4feb83", "score": "0.6592879", "text": "func (svc *SessionsService) Login(ctx context.Context, ld models.LoginData) (resAccess, resRefresh models.TokenData, err error) {\n\t//1. Authentificate user\n\terr = svc.EnsureUserCreds(ld.UserName, ld.Password)\n\tif err != nil {\n\t\tsvc.Logger.Log(\"method\", \"EnsureUserCreds\", \"action\", \"checking user credentials\", \"error\", err)\n\t\treturn resAccess, resRefresh, err\n\t}\n\n\t//2. Get user profile\n\tprofile, err := svc.GetUserProfile(ld.UserName, string(svc.secret))\n\tif err != nil {\n\t\tsvc.Logger.Log(\"method\", \"GetUserProfile\", \"action\", \"retrieving user profile\", \"error\", err)\n\t\treturn resAccess, resRefresh, err\n\t}\n\n\t//3. Create an access token\n\tresAccess, err = svc.GenerateToken(access, ld.UserName, profile.Role.Mask)\n\tif err != nil {\n\t\tsvc.Logger.Log(\"method\", \"GetToken\", \"action\", \"generate access token\", \"error\", err)\n\t\treturn resAccess, resRefresh, err\n\t}\n\n\tresRefresh, err = svc.GenerateToken(refresh, ld.UserName, profile.Role.Mask)\n\tif err != nil {\n\t\tsvc.Logger.Log(\"method\", \"GetToken\", \"action\", \"generate refresh token\", \"error\", err)\n\t\treturn resAccess, resRefresh, err\n\t}\n\n\t//4. Save token in db\n\tsvc.Db.Save(ld.UserName, resRefresh.Token)\n\n\treturn resAccess, resRefresh, nil\n}", "title": "" }, { "docid": "7ac26c6151884b5b991f4bac0a0b57d5", "score": "0.65849674", "text": "func (s *Session) Login() error {\n\to, err := newOAuth()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tu, err := o.authorize()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tu, err = o.login(u, s.Username, s.Password)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tu, err = o.callback(u)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttoken, err := o.token(u)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.token = token\n\treturn nil\n}", "title": "" }, { "docid": "7401555827f9b6963d4d0e8236c9343a", "score": "0.65788144", "text": "func (s *Session) Logout() {\n\ts.Active = false\n\tSave(s)\n}", "title": "" }, { "docid": "dbceaf7fb909aecc1079a22c31224686", "score": "0.6576004", "text": "func (p11w *Pkcs11Wrapper) Login() (err error) {\n\n\terr = p11w.Context.Login(p11w.Session, pkcs11.CKU_USER, p11w.SlotPin)\n\n\t// ignore login error CKR_USER_ALREADY_LOGGED_IN\n\tif err != nil && strings.Contains(err.Error(), \"CKR_USER_ALREADY_LOGGED_IN\") {\n\t\terr = nil\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "2bf0922ca6e60a7fe216c885a48c1e18", "score": "0.6562616", "text": "func (a *AWSSecretsManager) Login() error {\n\treturn nil\n}", "title": "" }, { "docid": "25e97d92a7a309989e6738c00799dc25", "score": "0.6551406", "text": "func login(res http.ResponseWriter, req *http.Request) {\n\n\tif isLoggedIn(req) && isAdmin(res, req) {\n\t\thttp.Redirect(res, req, \"/admin\", http.StatusSeeOther)\n\t\treturn\n\t} else if isLoggedIn(req) {\n\t\thttp.Redirect(res, req, \"/home\", http.StatusSeeOther)\n\t\treturn\n\t}\n\n\tif req.Method == http.MethodPost {\n\t\tusername := req.FormValue(\"username\")\n\t\tpassword := req.FormValue(\"password\")\n\n\t\tif username == \"\" || password == \"\" {\n\t\t\thttp.Error(res, helper.ErrEmptyFields.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t//validate inputs via a whitelist\n\t\tif !validate.IsAlphaNumeric(username) || !validate.IsAlphaNumeric(password) {\n\t\t\tWarnLogger.Println(\"Invalid username and/or password. \", validate.ErrInvalidAlphaNum.Error())\n\t\t\thttp.Error(res, \"Invalid username and/or password. \"+validate.ErrInvalidAlphaNum.Error(), http.StatusUnprocessableEntity)\n\t\t\treturn\n\t\t}\n\n\t\tmyUser, ok := mapUsers[username]\n\t\tif !ok {\n\t\t\t//user does not exist\n\t\t\thttp.Error(res, \"Invalid username and/or password\", http.StatusUnauthorized)\n\t\t\treturn\n\t\t}\n\t\terr := bcrypt.CompareHashAndPassword(myUser.Password, []byte(password))\n\t\tif err != nil {\n\t\t\t//incorrect password\n\t\t\thttp.Error(res, \"Invalid username and/or password\", http.StatusForbidden)\n\t\t\treturn\n\t\t}\n\t\t//disallow concurrent login based on active sessions in mapSessions\n\t\tfor _, user := range mapSessions {\n\t\t\tif user == username {\n\t\t\t\thttp.Error(res, \"Unable to log in. Please try again later.\", http.StatusSeeOther)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tid := uuid.NewV4()\n\t\tvar expireCookie = time.Now().Add(1 * time.Hour)\n\t\tloginCookie := &http.Cookie{\n\t\t\tName: \"loginCookie\",\n\t\t\tValue: id.String(),\n\t\t\tExpires: expireCookie,\n\t\t\tDomain: \"localhost\",\n\t\t\tPath: \"/\",\n\t\t\tSecure: true,\n\t\t\tHttpOnly: true,\n\t\t}\n\n\t\thttp.SetCookie(res, loginCookie)\n\t\tmapSessions[loginCookie.Value] = username\n\t\tif myUser.Username == \"admin\" {\n\t\t\thttp.Redirect(res, req, \"/admin\", http.StatusSeeOther)\n\t\t\treturn\n\t\t} else {\n\t\t\thttp.Redirect(res, req, \"/home\", http.StatusSeeOther)\n\t\t\treturn\n\t\t}\n\t}\n\terr := tpl.ExecuteTemplate(res, \"login.gohtml\", nil)\n\tif err != nil {\n\t\tErrLogger.Println(\"Failed to load template: \", err.Error())\n\t\thttp.Error(res, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "5aabfdef275ce133324f16fb5d26de3d", "score": "0.6527728", "text": "func Login(c *gin.Context) {\n data, err := rest.GetJSONBody(c.Request)\n if err != nil {\n c.JSON(http.StatusBadRequest, gin.H{\"message\": err.Error()})\n return\n\t}\n\t\n usuario, err := usuarios.ParseLoginUsuario(data)\n if err != nil {\n c.JSON(http.StatusBadRequest,gin.H{\"message\": err.Error()})\n return\n }\n\n result, apiErr := usuarios.Login(usuario)\n if apiErr != nil {\n c.JSON(apiErr.Status, apiErr.Message)\n return\n\t}\n\t\n\tsessionToken := tokenGenerator()\n\t\n\tapiErr = sessions.SaveSession(sessionToken, result.IDUsuario)\n\tif apiErr != nil {\n\t\tc.JSON(apiErr.Status, apiErr.Message)\n\t\treturn\n\t}\n\n c.JSON(http.StatusOK, sessionToken)\n}", "title": "" }, { "docid": "cdb2c6e548930c7334adf42af5bf8606", "score": "0.6521346", "text": "func (b *Batch) Login() error {\n\n\t// No credentials, or expired, ask for username/password\n\tusername, err := readUsername(os.Stdin)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpassword, err := readPassword(readPasswordFromTerminal)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tauthResponse, err := b.Authenticate(username, password)\n\tif err != nil {\n\t\treturn errCouldNotLogin\n\t}\n\n\tcfg := &Config{\n\t\tTeamID: authResponse.Team.ID,\n\t\tUserID: authResponse.AccountID,\n\t\tToken: b.Token,\n\t}\n\n\t// Successfully authenticated, write token to cache\n\tif err := writeConfig(cfg); err != nil {\n\t\treturn errors.Wrap(err, \"unable to cache login credentials\")\n\t}\n\n\tb.Log.Info(\"Authentication successful!\")\n\n\treturn nil\n}", "title": "" }, { "docid": "d0b84d86331c6f7df28acf5b7ea2af52", "score": "0.6511063", "text": "func (app App) Login(w http.ResponseWriter, r *http.Request) {\n\tvar authRequest AuthRequest\n\traw, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tWriteResponseError(w, http.StatusInternalServerError, errors.Wrap(err, \"failed to read request body\"))\n\t\treturn\n\t}\n\tr.Body.Close()\n\n\tsession, err := app.Sessions.Get(r, UserSessionCookie)\n\tif err != nil && err.Error() != \"securecookie: the value is not valid\" {\n\t\tWriteResponseError(w, http.StatusInternalServerError, errors.Wrap(err, \"failed to read or create cookie session\"))\n\t\treturn\n\t}\n\n\terr = json.Unmarshal(raw, &authRequest)\n\tif err != nil {\n\t\tWriteResponseError(w, http.StatusInternalServerError, errors.Wrap(err, \"failed to decode request body\"))\n\t\treturn\n\t}\n\n\tuser, exists, err := app.Storage.GetUserByName(authRequest.Username)\n\tif err != nil {\n\t\tWriteResponseError(w, http.StatusInternalServerError, errors.Wrap(err, \"failed to lookup user by name\"))\n\t\treturn\n\t}\n\tif !exists {\n\t\tWriteResponse(w, http.StatusUnauthorized, \"user not found\")\n\t\treturn\n\t}\n\n\terr = bcrypt.CompareHashAndPassword([]byte(user.Password), []byte(authRequest.Password))\n\tif err != nil {\n\t\tif err == bcrypt.ErrMismatchedHashAndPassword {\n\t\t\tWriteResponseError(w, http.StatusUnauthorized, errors.New(\"invalid password\"))\n\t\t} else {\n\t\t\tWriteResponseError(w, http.StatusInternalServerError, errors.Wrap(err, \"failed to process password\"))\n\t\t}\n\t\treturn\n\t}\n\n\tsession.Values[\"UserID\"] = user.ID\n\n\tapp.WriteToken(w, r, session, user.ID)\n}", "title": "" }, { "docid": "b67c0aa97649aef0ad481b95bf592eba", "score": "0.65075475", "text": "func (uc *UserController) Login() {\r\n\r\n\tuc.activeContent(\"login\")\r\n\r\n\t// Refresh flash content displayed by login.tpl\r\n\tflash := beego.ReadFromRequest(&uc.Controller)\r\n\tif fn, ok := flash.Data[\"notice\"]; ok {\r\n\t\tuc.Data[\"notice\"] = fn\r\n\t}\r\n\t// Process Login values submitted by user when method is POST\r\n\tif uc.Ctx.Input.Method() == \"POST\" {\r\n\t\tflash := beego.NewFlash()\r\n\t\tif err := uc.Ctx.Request.ParseForm(); err != nil {\r\n\t\t\tflash.Notice(\"Error processing Login form\")\r\n\t\t\tflash.Store(&uc.Controller)\r\n\t\t\tfmt.Println(err) // TODO Review possible errors\r\n\t\t\tuc.Redirect(\"/\", 302)\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\tusername := uc.Ctx.Request.Form.Get(\"username\")\r\n\t\tpassword := uc.Ctx.Request.Form.Get(\"password\")\r\n\r\n\t\tauthResult := authenticate(username, password, false)\r\n\r\n\t\tif !authResult.Authenticated {\r\n\t\t\tflash.Notice(authResult.Message)\r\n\t\t\tflash.Store(&uc.Controller)\r\n\t\t\tuc.Redirect(\"/login\", 302)\r\n\t\t\treturn\r\n\t\t} else {\r\n\t\t\t// Create \"hamlistings\" session, init with user session values, return to home\r\n\t\t\tsm := make(map[string]interface{})\r\n\t\t\tsm[\"username\"] = username\r\n\t\t\tuc.SetSession(\"hamlistings\", sm)\r\n\t\t\tuc.Redirect(\"/listings\", 302)\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t}\r\n}", "title": "" }, { "docid": "c23fb4264261d8c45255e2ca72fb9323", "score": "0.6506248", "text": "func (c *SessionController) Login(ctx *app.LoginSessionContext) error {\n\t// Generate JWT\n\ttoken := jwtgo.New(jwtgo.SigningMethodRS512)\n\tin10m := time.Now().Add(time.Duration(10) * time.Minute).Unix()\n\ttoken.Claims = jwtgo.StandardClaims{\n\t\tIssuer: \"GoWorkshop\", // who creates the token and signs it\n\t\tAudience: contextUser(ctx).Email, // to whom the token is intended to be sent\n\t\tExpiresAt: in10m, // time when the token will expire (10 minutes from now)\n\t\tId: uuid.NewV4().String(), // a unique identifier for the token\n\t\tIssuedAt: time.Now().Unix(), // when the token was issued/created (now)\n\t\tNotBefore: 2, // time before which the token is not yet valid (2 minutes ago)\n\t\tSubject: \"user\", // the subject/principal is whom the token is about\n\t}\n\tsignedToken, err := token.SignedString(c.privateKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to sign token: %s\", err) // internal error\n\t}\n\n\t// Set auth header for client retrieval\n\tctx.ResponseData.Header().Set(\"Authorization\", \"Bearer \"+signedToken)\n\treturn nil\n}", "title": "" }, { "docid": "37e65462179e8f0bc75d97ae12a7bbe5", "score": "0.65037686", "text": "func (auth *Auth) LogIn(sesID, name, password string) error {\n\tsession, ok := auth.sessionMap[sesID]\n\tif !ok {\n\t\treturn ErrInvalidSession\n\t}\n\n\tif session.info != nil && session.info.LoggedIn {\n\t\treturn ErrAlreadyLoggedIn\n\t}\n\n\tnewinfo, err := auth.ls.isValid(name, password)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsession.info = newinfo\n\tsession.info.LoggedIn = true\n\tsession.info.Name = name\n\treturn nil\n}", "title": "" }, { "docid": "7e8cda089d6d8621e7582e4cf044abbb", "score": "0.6497382", "text": "func (s *DashServer) Login(ctx context.Context, in *pb.LoginReq) (*pb.LoginRes, error) {\n\treq := repo.LoginReq{\n\t\tEmail: in.Email,\n\t\tPassword: in.Password,\n\t}\n\t// step1: login\n\tuser, err := repo.Client.Login(req)\n\tif err != nil {\n\t\treturn &pb.LoginRes{Result: &pb.Result{Status: false}}, err\n\t}\n\t// step2: generate jwt\n\ttoken, err := s.JwtMgr.GenerateJwt(*user)\n\tif err != nil {\n\t\treturn &pb.LoginRes{Result: &pb.Result{Status: false}}, err\n\t}\n\t// step3: save login log\n\terr = repo.Client.SaveLoginLog(in.Email)\n\tif err != nil {\n\t\treturn &pb.LoginRes{Result: &pb.Result{Status: false}}, err\n\t}\n\treturn &pb.LoginRes{Result: &pb.Result{Status: true}, Token: token}, err\n}", "title": "" }, { "docid": "a979c8e4e3780443a3c97f6fcb2f2534", "score": "0.64734095", "text": "func (d DefaultSec) Login(dbConn *sql.DB, id string, psw string) (string, error) {\n\tlogit.Info.Println(\"DefaultSec.Login\")\n\tvar uuid string\n\tvar err error\n\tvar user User\n\tvar unencryptedPsw string\n\tuser, err = DBGetUser(dbConn, id)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\tlogit.Error.Println(err.Error())\n\t\t\treturn \"\", errors.New(\"user not found\")\n\t\t} else {\n\t\t\tlogit.Error.Println(err.Error())\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\tlogit.Info.Println(\"Login checkpoint 1\")\n\n\tunencryptedPsw, err = DecryptPassword(user.Password)\n\tif err != nil {\n\t\tlogit.Error.Println(err.Error())\n\t\treturn \"\", err\n\t}\n\n\tif unencryptedPsw != psw {\n\t\treturn \"\", errors.New(\"incorrect password\")\n\t}\n\tlogit.Info.Println(\"Login checkpoint 2\")\n\n\t/**\n\tuuid, err = newUUID()\n\tif err != nil {\n\t\tlogit.Error.Println(err.Error())\n\t\treturn \"\", err\n\t}\n\t*/\n\tguid := xid.New()\n\tuuid = guid.String()\n\n\tlogit.Info.Println(\"Login checkpoint 3\")\n\t//register the session\n\terr = DBAddSession(dbConn, uuid, id)\n\tif err != nil {\n\t\tlogit.Error.Println(err.Error())\n\t\treturn \"\", err\n\t}\n\n\tlogit.Info.Println(\"secimpl Login returning uuid \" + uuid)\n\treturn uuid, nil\n}", "title": "" }, { "docid": "7219102486d376427c86c5aaf6471d9f", "score": "0.64669895", "text": "func Login(w http.ResponseWriter, r *http.Request) {\n\tr.ParseForm()\n\tusername := r.Form.Get(\"username\")\n\tpassword := r.Form.Get(\"password\")\n\n\tif username != \"\" && model.User[username] == password {\n\t\t// generate random session id\n\t\tsid, _ := generateRandomString(32)\n\n\t\t// add entry to session store\n\t\tmodel.Session[sid] = username\n\n\t\t// write session id to cookie\n\t\t// Expires \t-> Ablauf nach einem Jahr\n\t\t// Path \t-> Zugriff nur bei Paths die mit \"/\" beginnen\n\t\t// HttpOnly -> XSS (Cross Site Scripting) -> kein JavaScript Zugriff auf Cookies\n\t\t// SameSite\t-> Cookie wird nur von aktueller (first) Domain verwaltet und nicht durch third-party Domains.\n\t\t//\t\t\t\tBsp. blog.seite wird auf evil.example referenziert und man will nicht,\n\t\t//\t\t\t\tdass evil.example der Cookie von blog.seite mitgeschickt wird\n\t\tcookie := http.Cookie{Name: \"sid\",\n\t\t\tValue: sid,\n\t\t\tHttpOnly: true,\n\t\t\tExpires: time.Now().Add(365 * 24 * time.Hour),\n\t\t\tPath: \"/\",\n\t\t\tSameSite: http.SameSiteStrictMode}\n\t\thttp.SetCookie(w, &cookie)\n\n\t\tvar tmplData = struct {\n\t\t\tUsername string\n\t\t}{\n\t\t\tUsername: username,\n\t\t}\n\t\ttmpl.ExecuteTemplate(w, \"todo.html\", tmplData)\n\t} else {\n\t\tvar tmplData = struct {\n\t\t\tErrorMessage string\n\t\t}{\n\t\t\tErrorMessage: \"Username and/or password wrong!\",\n\t\t}\n\t\ttmpl.ExecuteTemplate(w, \"login.html\", tmplData)\n\t}\n}", "title": "" }, { "docid": "65cbb5258b3c9b1797b7b83793df6c4b", "score": "0.64660406", "text": "func (c *Client) login() error {\n\tauthURL := c.formatPath(\"auth/session\")\n\tdata := map[string]string{\"api_token\": c.APIToken}\n\tjsonValue, _ := json.Marshal(data)\n\t_, err := c.client.Post(authURL, \"application/json\", bytes.NewBuffer(jsonValue))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "80ad0883149cd02ba3f07a2f135114d0", "score": "0.6449728", "text": "func Login(w http.ResponseWriter, r *http.Request) {\n\tdata := &LoginRequest{}\n\n\tif err := render.Bind(r, data); err != nil {\n\t\trender.Render(w, r, response.ValidationError(err))\n\n\t\treturn\n\t}\n\n\tu := user.Login(data.Login, data.Password)\n\n\tif u == nil {\n\t\trender.Render(w, r, response.Unauthorized())\n\n\t\treturn\n\t}\n\n\t_, token, _ := tokenAuth.Encode(jwtauth.Claims{\"id\": u.ID})\n\n\trender.Render(w, r, newLoginResponse(token))\n}", "title": "" }, { "docid": "e6b174faf5ad4858b773e04ac6d9c44f", "score": "0.6436802", "text": "func (session *GGSession) Login() error {\n\tparams := C.struct_gg_login_params{\n\t\tuin: (C.uin_t)(session.Uin),\n\t\tpassword: C.CString(session.Password),\n\t\tasync: (C.int)(1),\n\t\tprotocol_features: GGFeatureImageDescr,\n\t}\n\n\t// We use wrapper because a wrapper function because cgo doesnt like errno.\n\t// See https://github.com/golang/go/issues/1360\n\tvar err int\n\n\ts := C.gg_login2((*C.struct_gg_login_params)(unsafe.Pointer(&params)), (*C.int)(unsafe.Pointer(&err)))\n\tif s == nil {\n\t\treturn NewGGError(err)\n\t}\n\tsession.session = s\n\tgo session.poller()\n\tfor {\n\t\te := <-session.Events\n\t\tdefer e.Close()\n\n\t\tif e.Type() == GGEventConnectionFailed {\n\t\t\treturn AccessDeniedError\n\t\t}\n\t\tif e.Type() == GGEventConnectionSuccess {\n\t\t\t// Start ping timer\n\t\t\tsession.pingTicker = time.NewTicker(60 * time.Second)\n\t\t\tgo session.ticker()\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn Fault\n}", "title": "" }, { "docid": "f0b517de395d303d89bfb43390fffc3c", "score": "0.6422843", "text": "func (u *User) Login() {\n\tu.authenticated = true\n}", "title": "" }, { "docid": "8e0a746159d34eb90ecf8e9793327452", "score": "0.642194", "text": "func (session *Session) loginSession(context appengine.Context, teamID string) {\n\ts := SessionRecord{\n\t\tCreated: time.Now(),\n\t\tTeamID: teamID,\n\t}\n\tkey := datastore.NewKey(context, \"Session\", session.ID, 0, nil)\n\t_, err := datastore.Put(context, key, &s)\n\tif err != nil {\n\t\tcontext.Warningf(\"login didn't save? SID=%s T=%s ERR=%s\", session.ID, teamID, err.Error())\n\t}\n\terr = memcache.Set(context, &memcache.Item{\n\t\tKey: \"Session/\" + session.ID,\n\t\tValue: []byte(teamID),\n\t})\n\tif err != nil {\n\t\tcontext.Warningf(\"login no cache SID=%s TID=%s ERR= %s\", session.ID, teamID, err.Error())\n\t}\n}", "title": "" }, { "docid": "e9065e3a30a5b85e0bf681bb14d93a34", "score": "0.6408906", "text": "func (s *Session) Login(ctx context.Context, creds apitypes.LoginCredential) error {\n\tif !creds.Valid() {\n\t\treturn &apitypes.Error{\n\t\t\tType: apitypes.BadRequestError,\n\t\t\tErr: []string{\"invalid login credentials provided\"},\n\t\t}\n\t}\n\n\tsalt, loginToken, err := s.engine.client.Tokens.PostLogin(ctx, creds)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmechanism := loginToken.Body.Mechanism\n\tvar authToken *envelope.Token\n\tswitch mechanism {\n\tcase primitive.HMACAuth:\n\t\tauthToken, err = s.attemptEdDSAUpgrade(ctx, loginToken, salt, creds)\n\tcase primitive.EdDSAAuth:\n\t\tauthToken, err = s.attemptEdDSALogin(ctx, loginToken, salt, creds)\n\tdefault:\n\t\terr = &apitypes.Error{\n\t\t\tType: apitypes.InternalServerError,\n\t\t\tErr: []string{fmt.Sprintf(\"unrecognized auth mechanism: %s\", mechanism)},\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttoken := authToken.Body.Token\n\tself, err := s.engine.client.Self.Get(ctx, authToken.Body.Token)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.engine.db.Set(self.Identity)\n\tif self.Type == apitypes.UserSession {\n\t\ts.engine.db.Set(self.Auth)\n\t}\n\n\treturn s.engine.session.Set(self.Type, self.Identity, self.Auth, creds.Passphrase(), token)\n}", "title": "" }, { "docid": "48e80916af1b679c8539ef0196d8c6b3", "score": "0.6408222", "text": "func (c *Client) Login() error {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\tformValues := FormValues{}\n\tformValues.Add(\"Username\", \"NULL\")\n\tformValues.Add(\"Password\", c.password)\n\n\t// Load homepage to get initial session token cookie (is stored in cookie jar).\n\tresp, err := c.c.Get(c.baseURL.String())\n\tif err != nil {\n\t\treturn err\n\t}\n\t// TODO: Check if we're already logged in.\n\tresp.Body.Close()\n\n\tresp, err = c.Set(loginFunc, formValues)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\tresp.Body.Close()\n\n\tmatches := sidRe.FindStringSubmatch(string(body))\n\tif len(matches) != 2 {\n\t\treturn ErrLoginFailed\n\t}\n\tsid := matches[1]\n\n\tsidCookie := &http.Cookie{\n\t\tDomain: c.baseURL.Host,\n\t\tName: \"SID\",\n\t\tValue: sid,\n\t}\n\n\t// Store SID cookie in cookie jar.\n\tupdated := false\n\tcookies := resp.Cookies()\n\tfor i, cookie := range cookies {\n\t\tif cookie.Name == \"SID\" {\n\t\t\tcookies[i] = sidCookie\n\t\t\tupdated = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !updated {\n\t\tcookies = append(cookies, sidCookie)\n\t}\n\tc.c.Jar.SetCookies(c.baseURL, cookies)\n\n\treturn nil\n}", "title": "" }, { "docid": "9c9485a6685b778d621326a1779a98f7", "score": "0.63989", "text": "func login(c *gin.Context) {\n\tsession := sessions.Default(c)\n\tusername := c.PostForm(\"username\")\n\tpassword := c.PostForm(\"password\")\n\n\t// Validate form input\n\tif strings.Trim(username, \" \") == \"\" || strings.Trim(password, \" \") == \"\" {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": \"Parameters can't be empty\"})\n\t\treturn\n\t}\n\n\thashPwd, _ := HashPassword(password)\n\trows, err := db.Query(fmt.Sprintf(\"select * from users where login = '%s' and password = '%s'\", username, hashPwd))\n\tif err != nil {\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tif rows.Next() {\n\t\tsession.Set(userkey, username) // In real world usage you'd set this to the users ID\n\t\tif err := session.Save(); err != nil {\n\t\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\": \"Failed to save session\"})\n\t\t\treturn\n\t\t}\n\t\tc.Redirect(302, \"/\")\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusUnauthorized, gin.H{\"error\": \"Authentication failed\"})\n\t// Save the username in the session\n}", "title": "" }, { "docid": "83cbdf15761a59497dd4383837959725", "score": "0.63914716", "text": "func (m *Manager) Login(s *session.Session, msg *protocol.JoyLoginRequest) error {\n\tlog.Println(msg)\n\tid := s.ID()\n\ts.Bind(id)\n\treturn s.Response(protocol.LoginResponse{\n\t\tStatus: protocol.LoginStatusSucc,\n\t\tID: id,\n\t})\n}", "title": "" }, { "docid": "7a0781a67eeb3470f96928d49d63f692", "score": "0.6364199", "text": "func Login(w http.ResponseWriter, r *http.Request) {\n\t//redirects to homepage if already logged in\n\t//Should not run unless you login and request /login route\n\tif alreadyLoggedIn(w, r) {\n\t\thttp.Redirect(w, r, \"/\", http.StatusSeeOther)\n\t\treturn\n\t}\n\n\t//Sends Data for Kafka\n\tProduceUserPageRequest(\"NotLoggedIn\", \"/login\")\n\n\terr := config.TPL.ExecuteTemplate(w, \"login.gohtml\", nil)\n\tif err != nil {\n\t\tlog.Println(err, \"Error Executing Template : loginHandlers.go : Login\")\n\t}\n}", "title": "" }, { "docid": "9822033e953817dc8a6022a59c12f8c5", "score": "0.63637394", "text": "func (a *App) Login(w http.ResponseWriter, r *http.Request) {\n\tr.ParseForm()\n\n\tusername := r.Form.Get(\"username\")\n\tpassword := r.Form.Get(\"password\")\n\trefresh := r.Form.Get(\"refresh\")\n\trefreshToken := r.Form.Get(\"refresh_token\")\n\n\tflow := aws.String(flowUsernamePassword)\n\tparams := map[string]*string{\n\t\t\"USERNAME\": aws.String(username),\n\t\t\"PASSWORD\": aws.String(password),\n\t}\n\n\t// Compute secret hash based on client secret.\n\tif a.AppClientSecret != \"\" {\n\t\tsecretHash := computeSecretHash(a.AppClientSecret, username, a.AppClientID)\n\n\t\tparams[\"SECRET_HASH\"] = aws.String(secretHash)\n\t}\n\n\tif refresh != \"\" {\n\t\tflow = aws.String(flowRefreshToken)\n\t\tparams = map[string]*string{\n\t\t\t\"REFRESH_TOKEN\": aws.String(refreshToken),\n\t\t}\n\t}\n\n\tauthTry := &cognito.InitiateAuthInput{\n\t\tAuthFlow: flow,\n\t\tAuthParameters: params,\n\t\tClientId: aws.String(a.AppClientID),\n\t}\n\n\tres, err := a.CognitoClient.InitiateAuth(authTry)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\thttp.Redirect(w, r, fmt.Sprintf(\"/login?message=%s\", err.Error()), http.StatusSeeOther)\n\t\treturn\n\t}\n\n\thttp.Redirect(w, r, fmt.Sprintf(\"/login?authres=%s\", res.AuthenticationResult), http.StatusFound)\n}", "title": "" }, { "docid": "1c47a5604e66c345a1627c47123ed75e", "score": "0.6357259", "text": "func (am AuthManager) Login(userID string, ctx *Ctx) (session *Session, err error) {\n\t// create a new session value\n\tsessionValue := NewSessionID()\n\t// userID and sessionID are required\n\tsession = NewSession(userID, sessionValue)\n\tif am.SessionTimeoutProvider != nil {\n\t\tsession.ExpiresUTC = am.SessionTimeoutProvider(session)\n\t}\n\tsession.UserAgent = webutil.GetUserAgent(ctx.Request)\n\tsession.RemoteAddr = webutil.GetRemoteAddr(ctx.Request)\n\n\t// call the perist handler if one's been provided\n\tif am.PersistHandler != nil {\n\t\terr = am.PersistHandler(ctx.Context(), session)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// call the serialize handler if one's been provided\n\tif am.SerializeHandler != nil {\n\t\tsessionValue, err = am.SerializeHandler(ctx.Context(), session)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// inject cookies into the response\n\tam.injectCookie(ctx, sessionValue, session.ExpiresUTC)\n\treturn session, nil\n}", "title": "" }, { "docid": "7653536db05da79bbce3baa4b8164134", "score": "0.635225", "text": "func userLogin(login User, r *http.Request) (int, error) {\n\t//var tempUser []*User\n\tvar tempUser User\n\n\tc := appengine.NewContext(r)\n\tkey := datastore.NewKey(c, \"Email\", login.Email, 0, nil)\n\terr := datastore.Get(c, key, &tempUser)\n\tif err != nil || tempUser.Pswrd != login.Pswrd {\n\t\tif err == datastore.ErrNoSuchEntity {\n\t\t\treturn -2, err\n\t\t}\n\t\treturn -1, err\n\t}\n\n\tsessionID, err := startSession(login.Email, r)\n\n\treturn sessionID, err\n}", "title": "" }, { "docid": "7bd2ff1561b4228e817372c84b7aef4a", "score": "0.63481665", "text": "func Logout() {\n\tmasterToken = \"\"\n\tadminMasterToken = \"\"\n}", "title": "" }, { "docid": "1f03a3e769e9c4172dd05999bd18e660", "score": "0.6346851", "text": "func (c *ClientConnection) Login(userName string, password string, app *ApiApplication) error {\n\tif app == nil {\n\t\tapp = NewApplication(\"\", \"\", \"\")\n\t}\n\tparams := loginStruct{userName, password, *app}\n\tdata, err := c.CallRaw(\"Session.login\", params)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttoken := struct {\n\t\tResult struct {\n\t\t\tToken string `json:\"token\"`\n\t\t} `json:\"result\"`\n\t}{}\n\terr = json.Unmarshal(data, &token)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.Token = &token.Result.Token\n\treturn nil\n}", "title": "" }, { "docid": "7e092397bc5890b5fced364bcf31f8ec", "score": "0.6332274", "text": "func (c *CommonController) Logout() {\n\tc.DestroySession()\n}", "title": "" }, { "docid": "a6fe56c2768ed4b0442770efd50e1c79", "score": "0.63289195", "text": "func (c *Client) Login(credentials *models.UserCredentials) error {\n\tif c.auth != nil {\n\t\treturn nil\n\t}\n\n\tif credentials.ID != \"\" && credentials.Token != \"\" {\n\t\tc.auth = &authInfo{id: credentials.ID, token: credentials.Token}\n\t\treturn nil\n\t}\n\n\tresponse := new(logonResponse)\n\tdata := url.Values{\"user\": {credentials.Email}, \"password\": {credentials.Password}}\n\tif err := c.PostForm(\"login\", data, response); err != nil {\n\t\treturn err\n\t}\n\n\tc.auth = &authInfo{id: response.Data.UserID, token: response.Data.Token}\n\tcredentials.ID, credentials.Token = response.Data.UserID, response.Data.Token\n\treturn nil\n}", "title": "" }, { "docid": "57b5f7022a187b65f534e51e436d332d", "score": "0.63271385", "text": "func Login(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tswitch r.Method {\n\tcase \"GET\":\n\t\tvar reqobj object.LoginRequest\n\t\tvar resp *object.LoginResponse\n\t\tif err := json.NewDecoder(r.Body).Decode(&reqobj); err != nil {\n\t\t\tresp = &object.LoginResponse{\n\t\t\t\tMessage: err.Error(),\n\t\t\t}\n\t\t}\n\t\tif accesstokenmap == nil {\n\t\t\taccesstokenmap = make(map[string]string)\n\t\t}\n\t\tif userloggedinmap == nil {\n\t\t\tuserloggedinmap = make(map[string]string)\n\t\t}\n\t\tif durationmap == nil {\n\t\t\tdurationmap = make(map[string]string)\n\t\t}\n\t\tif adminaccess == nil {\n\t\t\tadminaccess = make(map[string]bool)\n\t\t}\n\t\tif mutx == nil {\n\t\t\tmutx = &sync.Mutex{}\n\t\t}\n\t\tadmin := false\n\t\tif accesstoken, ok := userloggedinmap[reqobj.Username]; ok {\n\t\t\tif settime, k := durationmap[accesstoken]; k {\n\t\t\t\tstartTime, _ := time.Parse(\"2006-01-02 15:04:05.00\", settime)\n\t\t\t\tcurrentTimeVal := time.Now().Format(\"2006-01-02 15:04:05.00\")\n\t\t\t\tcurrentTime, _ := time.Parse(\"2006-01-02 15:04:05.00\", currentTimeVal)\n\t\t\t\tduration := currentTime.Sub(startTime)\n\t\t\t\tdefinedDuration, _ := time.ParseDuration(dur)\n\t\t\t\tif duration <= definedDuration {\n\t\t\t\t\tresp = &object.LoginResponse{\n\t\t\t\t\t\tMessage: \"User Logged In\",\n\t\t\t\t\t\tAccessToken: fmt.Sprintf(\"%s\", accesstoken),\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tresp, admin = database.Login(&reqobj)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tresp, admin = database.Login(&reqobj)\n\t\t\t}\n\t\t} else {\n\t\t\tresp, admin = database.Login(&reqobj)\n\t\t}\n\t\tbyteresp, _ := json.Marshal(resp)\n\t\tcurrenttime := time.Now().Format(\"2006-01-02 15:04:05.00\")\n\t\tif admin {\n\t\t\tmutx.Lock()\n\t\t\tadminaccess[resp.AccessToken] = true\n\t\t\tmutx.Unlock()\n\t\t}\n\t\tmutx.Lock()\n\t\tuserloggedinmap[reqobj.Username] = resp.AccessToken\n\t\tdurationmap[resp.AccessToken] = currenttime\n\t\taccesstokenmap[resp.AccessToken] = reqobj.Username\n\t\tmutx.Unlock()\n\t\tif resp.AccessToken == \"\" {\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t}\n\t\tw.Write(byteresp)\n\tdefault:\n\t\tw.WriteHeader(http.StatusMethodNotAllowed)\n\t\tresponse := object.LoginResponse{\n\t\t\tMessage: \"Method Not Supported\",\n\t\t}\n\t\tbyteresp, _ := json.Marshal(response)\n\t\tw.Write(byteresp)\n\t}\n}", "title": "" }, { "docid": "2449ff1ccc8079563ad54159c1941899", "score": "0.63223296", "text": "func (ch *offboardUserHandler) clearLogin() error {\n\tusrMngr := ch.env.UserManager()\n\tif usrMngr == nil {\n\t\treturn errors.New(\"no user manager found in environment\")\n\t}\n\tusr, err := usrMngr.GetUserByID(ch.user)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"finding user\")\n\t}\n\treturn errors.Wrap(usrMngr.ClearUser(usr, false), \"clearing login cache\")\n}", "title": "" }, { "docid": "09eb4fa91d45b4706dac9406e49d64e7", "score": "0.6313784", "text": "func (c *Client) Login() (err error) {\n\tcolor.Cyan(\"Login %v...\\n\", c.Username)\n\n\tpassword, err := c.DecryptPassword()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tjar, _ := cookiejar.New(nil)\n\tc.client.Jar = jar\n\tbody, err := util.GetBody(c.client, c.host+\"/login\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tcsrf, err := findCsrf(body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tbody, err = util.PostBody(c.client, c.host+\"/login\", url.Values{\n\t\t\"username\": {c.Username},\n\t\t\"password\": {password},\n\t\t\"csrf_token\": {csrf},\n\t})\n\tif err != nil {\n\t\treturn\n\t}\n\n\tusername, err := findUsername(body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tc.Username = username\n\tc.Jar = jar\n\tcolor.Green(\"Succeed!!\")\n\tcolor.Green(\"Welcome %v~\", username)\n\treturn c.save()\n}", "title": "" }, { "docid": "46b01e188dfa2bb1191f7f7eef53a1c0", "score": "0.63032514", "text": "func Login(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\terr := tpl.ExecuteTemplate(w, \"login.html\", nil)\n\tHandleError(w, err)\n}", "title": "" }, { "docid": "15e9d518f014f1b43d60ba820461dedf", "score": "0.63017607", "text": "func (z *ZoomEye) Login(username, password string) (string, error) {\n\tvar (\n\t\tdata = map[string]interface{}{\n\t\t\t\"username\": username,\n\t\t\t\"password\": password,\n\t\t}\n\t\tresult = &LoginResult{}\n\t)\n\tif err := z.post(loginAPI, nil, data, result); err != nil {\n\t\treturn \"\", err\n\t}\n\tz.accessToken = result.AccessToken\n\treturn z.accessToken, nil\n}", "title": "" }, { "docid": "fe5bba0734eee0e8e52860ec8e35b4b3", "score": "0.63004756", "text": "func (s *WebServer) actuallyLogin(w http.ResponseWriter, r *http.Request, login *loginForm) {\n\tloginResult, err := s.core.Login(login.Pass)\n\tif err != nil {\n\t\ts.writeAPIError(w, \"login error: %v\", err)\n\t\treturn\n\t}\n\n\tuser := extractUserInfo(r)\n\tif !user.Authed {\n\t\tauthToken := s.authorize()\n\t\thttp.SetCookie(w, &http.Cookie{\n\t\t\tName: authCK,\n\t\t\tValue: authToken,\n\t\t\tPath: \"/\",\n\t\t\t// The client should only send the cookie with first-party requests.\n\t\t\t// Cross-site requests should not include the auth cookie.\n\t\t\t// https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-4.1.1\n\t\t\tSameSite: http.SameSiteStrictMode,\n\t\t\t// Secure: false, // while false we require SameSite set\n\t\t})\n\t}\n\n\twriteJSON(w, struct {\n\t\tOK bool `json:\"ok\"`\n\t\tNotes []*db.Notification `json:\"notes\"`\n\t}{\n\t\tOK: true,\n\t\tNotes: loginResult.Notifications,\n\t}, s.indent)\n}", "title": "" }, { "docid": "8a1cdd303f956c149ff9471a4e150165", "score": "0.62966776", "text": "func (p *LoginProbe) Login() {\n\tp.Client.Login(p.Credentials)\n\tp.Client.Logout()\n}", "title": "" }, { "docid": "5dc27115f56cc1dbf2bf425afeb261ef", "score": "0.62917745", "text": "func Logout() error {\n\treturn removeSession()\n}", "title": "" }, { "docid": "ee79277c922c855fc5bfb234e2816417", "score": "0.62890416", "text": "func (c *Client) Login() error {\n\trsakey, err := c.getRsaKey()\n\tif err != nil {\n\t\treturn err\n\t}\n\tpass, err := c.encryptPassword(rsakey)\n\tif err != nil {\n\t\treturn err\n\t}\n\tresp, err := c.doLogin(rsakey, pass, \"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif resp.Requires2FA {\n\t\ta := c.Auth.AuthCode()\n\t\tresp, err = c.doLogin(rsakey, pass, a)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tlog.Printf(\"%#v\", resp)\n\treturn nil\n}", "title": "" }, { "docid": "650520794a453184a70308d042ebc02f", "score": "0.62828887", "text": "func (t *Tableau) login(server, username, password string) (string, error) {\n\tif t.loggedIn {\n\t\treturn \"\", ErrAlreadyLoggedIn\n\t}\n\n\tserver = addHTTPS(server)\n\tt.server = server\n\tt.user = username\n\n\tlog.Printf(\"attempting to log in as %s\", t)\n\n\tout, err := t.e.run(actLogin, \"-s\", server, \"-u\", username, \"-p\", password)\n\n\tt.loggedIn = (err == nil)\n\n\treturn out, err\n}", "title": "" }, { "docid": "fc6af039ef5e93c98fb499af5916ba5e", "score": "0.6278348", "text": "func (env *Env) Login(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tWriteError(w, http.StatusBadRequest, err, \"Invalid request\")\n\t}\n\tvar request UserRequest\n\terr = json.Unmarshal(body, &request)\n\tif err != nil || ((request.Name == \"\" || request.Password == \"\") && request.Token == \"\") {\n\t\tWriteError(\n\t\t\tw,\n\t\t\thttp.StatusBadRequest,\n\t\t\tfmt.Errorf(\"invalid request: %s\", string(body)),\n\t\t\t\"Invalid request\",\n\t\t)\n\t\treturn\n\t}\n\n\tvar user User\n\tif request.Name != \"\" && request.Password != \"\" {\n\t\trequest.Name = strings.Title(strings.ToLower(request.Name))\n\t\trequest.Token = computeHmac256(request.Password, request.Name)\n\n\t\tuser, err = env.db.LoginWithCredentials(request.Name, request.Token)\n\t\tswitch {\n\t\tcase err == ErrUserNotFound:\n\t\t\tWriteError(w, http.StatusNotFound, err, \"The specified user could not be found\")\n\t\t\treturn\n\t\tcase err == ErrInvalidCredentials:\n\t\t\tWriteError(w, http.StatusUnauthorized, err, \"Invalid credentials\")\n\t\t\treturn\n\t\tcase err != nil:\n\t\t\tInternalServerError(w, err)\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tuser, err = env.db.LoginWithToken(request.Token)\n\t\tswitch {\n\t\tcase err == ErrUserNotFound:\n\t\t\tWriteError(w, http.StatusNotFound, err, \"The given token did not match any users\")\n\t\t\treturn\n\t\tcase err != nil:\n\t\t\tInternalServerError(w, err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tlog.WithField(\"name\", user.Name).Info(\"User signed in\")\n\tworkouts, err := env.db.GetWorkouts(user.ID)\n\tif err != nil {\n\t\tInternalServerError(w, err)\n\t\treturn\n\t}\n\n\tuser.Token = request.Token\n\tWriteJSON(w, http.StatusOK, LoginResponse{user, workouts})\n}", "title": "" }, { "docid": "816c641ae8c5f007cdeeec639f6305f2", "score": "0.62758166", "text": "func (s *session) Logout() error {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\n\tif s.Type() == apitypes.NotLoggedIn {\n\t\treturn createNotLoggedInError()\n\t}\n\n\ts.sessionType = apitypes.NotLoggedIn\n\ts.identity = nil\n\ts.auth = nil\n\ts.token = \"\"\n\ts.passphrase = []byte{}\n\treturn nil\n}", "title": "" }, { "docid": "96adc989f506285050aef687b8aa2c02", "score": "0.6274849", "text": "func (repo *Repository) Logout(w http.ResponseWriter, r *http.Request) {\n\t_ = repo.App.Session.Destroy(r.Context())\n\t_ = repo.App.Session.RenewToken(r.Context())\n\trepo.App.Session.Put(r.Context(), \"flash\", \"Logged out successfully\")\n\n\thttp.Redirect(w, r, \"/user/login\", http.StatusSeeOther)\n}", "title": "" }, { "docid": "dace40da1823dcf2f1b78ee24b8bd15a", "score": "0.62717456", "text": "func (h *AuthHandlerService) Login(rw http.ResponseWriter, req *http.Request) {\n\trw.Write([]byte(\"Not implemented\"))\n}", "title": "" }, { "docid": "0e3e762cb9137fa48bab09572f51f6e4", "score": "0.6270951", "text": "func login(c *gin.Context) {\n\tsession := sessions.Default(c)\n\tusername := c.PostForm(\"username\")\n\tpassword := c.PostForm(\"password\")\n\n\t// Validate form input\n\tif strings.Trim(username, \" \") == \"\" || strings.Trim(password, \" \") == \"\" {\n\t\tc.HTML(http.StatusBadRequest, \"login.html\", gin.H{\"error\": \"Username or password can't be empty 🙄\"})\n\t\treturn\n\t}\n\n\t// FETCH FROM IALAB lol\n\terr := vcloudAuth(username, password)\n\tif err != nil {\n\t\tc.HTML(http.StatusBadRequest, \"login.html\", gin.H{\"error\": \"Incorrect username or password.\"})\n\t\treturn\n\t}\n\n\t// Save the username in the session\n\tsession.Set(userkey, username)\n\tif err := session.Save(); err != nil {\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\": \"Failed to save session\"})\n\t\treturn\n\t}\n\tc.Redirect(http.StatusSeeOther, \"/\")\n}", "title": "" }, { "docid": "69fd7e2bb4af44cb2b138107fd44e71d", "score": "0.62705946", "text": "func SetLogin(c *gin.Context, ID string) {\n\tsession := sessions.Default(c)\n\tsession.Set(\"ID\", ID)\n\tsession.Save()\n}", "title": "" }, { "docid": "418138c99bbcd7ff8cf78598c1f8f1c3", "score": "0.62650543", "text": "func (h *HTTP) Login(ctx context.Context) error {\n\ttoken, err := h.Keystone.ObtainToken(ctx, h.ID, h.Password, h.Scope)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\th.AuthToken = token\n\treturn nil\n}", "title": "" }, { "docid": "363bdf7eb4af77fa563d8f9dd652595c", "score": "0.6258156", "text": "func (repo *Repository) Login(w http.ResponseWriter, r *http.Request) {\n\trender.Template(w, r, \"login.page.html\", &models.TemplateData{\n\t\tForm: forms.New(nil),\n\t})\n}", "title": "" }, { "docid": "3e823e882d101f0dce74550fae8b1322", "score": "0.62536055", "text": "func (p *Repo) Login(auth Auth) (user Auth, err error) {\n\terr = p.Engine.DB.First(&auth).Error\n\treturn\n}", "title": "" }, { "docid": "cb95119a871d0866c685da1a67b0236f", "score": "0.62499547", "text": "func (p *provider) Login() error {\n\treturn nil\n}", "title": "" }, { "docid": "44210e77b38bdab034df16fd72a4578d", "score": "0.62454563", "text": "func (c *client) Login(w http.ResponseWriter, r *http.Request) (string, error) {\n\tc.Logger.Trace(\"processing login request\")\n\n\t// generate a random string for creating the OAuth state\n\toAuthState, err := random.GenerateRandomString(32)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// pass through the redirect if it exists\n\tredirect := r.FormValue(\"redirect_uri\")\n\tif len(redirect) > 0 {\n\t\tc.OAuth.RedirectURL = redirect\n\t}\n\n\t// temporarily redirect request to Github to begin workflow\n\thttp.Redirect(w, r, c.OAuth.AuthCodeURL(oAuthState), http.StatusTemporaryRedirect)\n\n\treturn oAuthState, nil\n}", "title": "" }, { "docid": "f81b03e12d5919fe70514b935c085550", "score": "0.6241336", "text": "func (c *Client) login(ctx context.Context) (string, error) {\n\tpayload := &Request{\n\t\tAction: \"login\",\n\t\tParam: &LoginRequest{\n\t\t\tCustomerNumber: c.customerNumber,\n\t\t\tAPIKey: c.apiKey,\n\t\t\tAPIPassword: c.apiPassword,\n\t\t\tClientRequestID: \"\",\n\t\t},\n\t}\n\n\tvar responseData LoginResponse\n\terr := c.doRequest(ctx, payload, &responseData)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"loging error: %w\", err)\n\t}\n\n\treturn responseData.APISessionID, nil\n}", "title": "" }, { "docid": "6eccdc97228d2d0f21921f3e370afd09", "score": "0.6240246", "text": "func Login(w http.ResponseWriter, r *http.Request) {\n\trender.Render(w, r, LoginRenderer)\n}", "title": "" }, { "docid": "3bd1795e237e23f988d49d9b93c768d6", "score": "0.62311196", "text": "func (p *Provider) Login(req *pkcs11.LoginReq) error {\n\tlog.Printf(\"Login: UserType=%v, Pin=%v\",\n\t\treq.UserType, mask(string(req.Pin)))\n\tp.parent.Lock()\n\tdefer p.parent.Unlock()\n\n\tif p.parent.loggedIn {\n\t\tif p.parent.loggedUser == req.UserType {\n\t\t\treturn pkcs11.ErrUserAlreadyLoggedIn\n\t\t}\n\t\treturn pkcs11.ErrUserAnotherAlreadyLoggedIn\n\t}\n\tp.parent.loggedIn = true\n\tp.parent.loggedUser = req.UserType\n\n\tswitch req.UserType {\n\tcase pkcs11.CkuSO:\n\t\tp.parent.state = pkcs11.CksRWSOFunctions\n\n\tcase pkcs11.CkuUser:\n\t\tp.parent.state = pkcs11.CksRWUserFunctions\n\n\tdefault:\n\t\tp.parent.state = pkcs11.CksROPublicSession\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "949529c25ae4b536647384d76c67c06d", "score": "0.62304455", "text": "func (d *DCOSAuth) Login() {\n\n\tlo, _ := GenerateServiceLoginObject([]byte(d.privateKey), d.UID, d.ValidTime)\n\n\t// Build client\n\tclient := createClient()\n\td.token, _ = login(d.Master, lo, client)\n}", "title": "" }, { "docid": "86e12afbef02e80075bb2128a3d82ef3", "score": "0.6228726", "text": "func Login(c *gin.Context) {\n\tc.HTML(200, \"login.html\", nil)\n\treturn\n}", "title": "" }, { "docid": "9a0a95e24a6a904bcc64b0530b1c3134", "score": "0.62244534", "text": "func (app *App) login(\n\tctx context.Context,\n\tw http.ResponseWriter,\n\tuserID, device, method, reqURI string) error {\n\trt, err := app.authUsecases.GetRefreshToken(ctx, userID)\n\tif err != nil {\n\t\tapp.l.Debug().Msgf(\"[%s %s]: error: %v\", method, reqURI, err)\n\t\t// the retrive of the refresh token has failed for some reason,\n\t\t// but we can try to create new refresh token.\n\t}\n\n\tif rt == nil || time.Until(rt.ExpiresAt) <= 0 {\n\t\trt, err = createRefreshToken(\n\t\t\tctx, userID, app.authUsecases.SaveRefreshToken)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\ttoken, err := createJWTAuth(\n\t\tctx, userID, device, rt, app.jwtKey, app.authUsecases.SaveJWT)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsetCookieJWTAuthToken(w, token.Token, token.ExpiresAt)\n\treturn nil\n}", "title": "" }, { "docid": "e2e7e7c9cbe65f0caf468c5e6efa9b4d", "score": "0.6220749", "text": "func (s *Session) Logout() error {\n\ts.Valid = false\n\treturn s.put()\n}", "title": "" }, { "docid": "cc74406579e5b64af0f61a4f5bb04f0d", "score": "0.6220158", "text": "func (g *Github) Login() error {\n\tpayload := map[string]interface{}{\n\t\t\"token\": g.AccessToken,\n\t}\n\n\tdata, err := g.Client.Write(\"auth/github/login\", payload)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// If we cannot write the Vault token, we'll just have to login next time. Nothing showstopping.\n\terr = SetToken(g.Client, data.Auth.ClientToken)\n\tif err != nil {\n\t\tprint(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3f51223925f50035bc09a49657064a83", "score": "0.6220022", "text": "func (c *Client) Login(loginId string, password string) (*Result, *AppError) {\n\tm := make(map[string]string)\n\tm[\"login_id\"] = loginId\n\tm[\"password\"] = password\n\treturn c.login(m)\n}", "title": "" }, { "docid": "0664d46013a2c2ed4d55b8a720fc3788", "score": "0.62182283", "text": "func Login(username, password string) (string, error) {\n\tif username == \"\" || password == \"\" {\n\t\treturn \"\", new(errors.BadRequest)\n\t}\n\n\tvar id int\n\trow := config.Db[\"note\"].QueryRow(\"SELECT id FROM accounts WHERE (username=$1 AND password=$2)\", username, password)\n\terr := row.Scan(&id)\n\n\tif err != nil {\n\t\tswitch err {\n\t\tcase sql.ErrNoRows:\n\t\t\t// wrong username/password\n\t\t\tlog.Printf(\"failed to login: %s:%s\", username, password)\n\t\t\treturn \"\", new(errors.Unauthorized)\n\t\tdefault:\n\t\t\tlog.Printf(\"pkg/auth/auth.go:Login: error during results' scan: %s\", err)\n\t\t\treturn \"\", new(errors.Internal)\n\t\t}\n\t}\n\n\tvar tok string\n\ttok, err = token.New(id)\n\tif err != nil {\n\t\treturn \"\", new(errors.Internal)\n\t}\n\n\tlog.Println(\"pkg/auth/auth.go:Login: # TODO insert created session into db\")\n\t/*\n\t\tlastSeen := \"1970-01-01\"\n\t\texpiration := \"1970-01-01\"\n\n\t\tif _, err := config.Db[\"note\"].Exec(\n\t\t\t\"INSERT INTO sessions(uid, token, last_seen, expiration) VALUES ($1, $2, $3, $4)\",\n\t\t\tid, tok, lastSeen, expiration,\n\t\t); err != nil {\n\t\t\tlog.Printf(\"pkg/auth/auth.go:Login: cannot create session: %s\", err)\n\t\t\treturn \"\", new(errors.Internal)\n\t\t}\n\t*/\n\n\treturn tok, nil\n}", "title": "" }, { "docid": "c0c47d105adc5887ea238c6e88d2be25", "score": "0.6207962", "text": "func (u *Users) Login(w http.ResponseWriter, r *http.Request) {\n\tform := LoginForm{}\n\tif err := parseForm(r, &form); err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Fprintln(w, \"Email is\", form.Email)\n\tfmt.Fprintln(w, \"Password is\", form.Password)\n}", "title": "" }, { "docid": "46fd4ec70f2dbf2947e3ae55067a9087", "score": "0.6193519", "text": "func (b *LocalBackend) Login(token *tailcfg.Oauth2Token) {\n\tb.mu.Lock()\n\tb.assertClientLocked()\n\tcc := b.cc\n\tb.mu.Unlock()\n\n\tcc.Login(token, b.loginFlags|controlclient.LoginInteractive)\n}", "title": "" }, { "docid": "c053f87dee72c32847e0db80d684dc59", "score": "0.619331", "text": "func (c *Client) Login() error {\n\tv := url.Values{\n\t\t\"username\": []string{c.Username},\n\t\t\"password\": []string{c.Password},\n\t}\n\n\tres, err := c.cli.PostForm(c.Address+\"/\"+c.LoginEndpoint, v)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\n\treturn nil\n}", "title": "" }, { "docid": "fa58317c84827ebeb5369a25b40c2334", "score": "0.6192604", "text": "func (conn SplunkConnection) Login() (SessionKey, error) {\n\n\tdata := make(url.Values)\n\tdata.Add(\"username\", conn.Username)\n\tdata.Add(\"password\", conn.Password)\n\tdata.Add(\"output_mode\", \"json\")\n\tresponse, err := conn.httpPost(fmt.Sprintf(\"%s/services/auth/login\", conn.BaseURL), &data)\n\n\tif err != nil {\n\t\treturn SessionKey{}, err\n\t}\n\n\tbytes := []byte(response)\n\tvar key SessionKey\n\tunmarshall_error := xml.Unmarshal(bytes, &key)\n\tconn.sessionKey = key\n\treturn key, unmarshall_error\n}", "title": "" }, { "docid": "279fbfc2e10ae57a6f3242d1db31adf4", "score": "0.6187701", "text": "func Login(c *fiber.Ctx) error {\n\tvar request dto.NewLoginRequest\n\tif err := c.BodyParser(&request); err != nil {\n\t\tgetStatus(c, 422, err)\n\t} else {\n\t\tuser, appErr := service.Login(request)\n\t\tif appErr != nil {\n\t\t\tgetStatus(c, 500, user)\n\t\t} else {\n\t\t\ttoken, err := utils.GenerateJwt(user.UserId)\n\t\t\tuser.AccessToken = token\n\t\t\tif err != nil {\n\t\t\t\tgetStatus(c, 401, err)\n\t\t\t}\n\t\t\t// cookie := fiber.Cookie{\n\t\t\t// \tName: \"jwt\",\n\t\t\t// \tValue: token,\n\t\t\t// \tExpires: time.Now().Add(time.Hour * 24),\n\t\t\t// \tHTTPOnly: true,\n\t\t\t// }\n\t\t\t// c.Cookie(&cookie)\n\t\t\tgetStatus(c, 200, &user)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bd32f6c1b68843170132ea012e3fcc22", "score": "0.6181934", "text": "func (r *Robonaut) Login(email string, password string) error {\n\t// Login an existing user\n\tuser, err := r.Client.Login(&models.UserCredentials{Email: email, Password: password})\n\tif err != nil {\n\t\tlog.Println(\"Failed to login\", err)\n\t\treturn err\n\t}\n\n\tr.Self = user\n\n\tr.Client.ConnectionOnline()\n\n\tif err := r.Rest.Login(&models.UserCredentials{ID: user.ID, Token: user.Token}); err != nil {\n\t\tlog.Println(\"Failed to login rest\", err)\n\t\treturn err\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "761b883712da3aa82c92a4bb64905e4f", "score": "0.61815107", "text": "func (r CGTeamworkMutation) Login(ctx context.Context, input models.CGTeamworkLoginInput) (ret *models.CGTeamworkLogin, err error) {\n\tret = new(models.CGTeamworkLogin)\n\tret.ClientMutationID = input.ClientMutationID\n\n\tres, err := r.app.CGTeamwork().Login(ctx, input.Login, input.Password)\n\tif err != nil {\n\t\treturn\n\t}\n\tret.AccessToken = res.AccessToken()\n\tret.AccessTokenExpire = res.AccessTokenExpire()\n\treturn\n}", "title": "" }, { "docid": "16cdfc183d0159d16759818296a62ea7", "score": "0.61571217", "text": "func (s *DefaultService) Login(ctx context.Context, user, pass string) (token string, err error) {\n\treturn s.repo.Auth(ctx, user, pass)\n}", "title": "" }, { "docid": "e0e240f2acb5b31d681ddcf729ddb121", "score": "0.6155817", "text": "func (db *Database) Logout() {\n\tsession := db.Session\n\tdbname := db.Name\n\tsession.m.Lock()\n\tfound := false\n\tfor i, cred := range session.creds {\n\t\tif cred.Source == dbname {\n\t\t\tcopy(session.creds[i:], session.creds[i+1:])\n\t\t\tsession.creds = session.creds[:len(session.creds)-1]\n\t\t\tfound = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif found {\n\t\tif session.masterSocket != nil {\n\t\t\tsession.masterSocket.Logout(dbname)\n\t\t}\n\t\tif session.slaveSocket != nil {\n\t\t\tsession.slaveSocket.Logout(dbname)\n\t\t}\n\t}\n\tsession.m.Unlock()\n}", "title": "" }, { "docid": "490ad1dd815ae116dd2a93e440cc3ac7", "score": "0.615404", "text": "func (m *MWApi) Login() error {\n\tif m.Username == \"\" || m.Password == \"\" {\n\t\treturn errors.New(\"Username or password not set.\")\n\t}\n\n\tquery := Values{\n\t\t\"action\": \"login\",\n\t\t\"lgname\": m.Username,\n\t\t\"lgpassword\": m.Password,\n\t}\n\n\tif m.Domain != \"\" {\n\t\tquery[\"lgdomain\"] = m.Domain\n\t}\n\n\tbody, _, err := m.API(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar response outerLogin\n\terr = json.Unmarshal(body, &response)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif response.Login.Result == \"Success\" {\n\t\treturn nil\n\t} else if response.Login.Result != \"NeedToken\" {\n\t\treturn errors.New(\"Error logging in: \" + response.Login.Result)\n\t}\n\n\t// Need to use the login token\n\tquery[\"lgtoken\"] = response.Login.Token\n\n\tbody, _, err = m.API(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = json.Unmarshal(body, &response)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif response.Login.Result == \"Success\" {\n\t\treturn nil\n\t} else {\n\t\treturn errors.New(\"Error logging in: \" + response.Login.Result)\n\t}\n}", "title": "" }, { "docid": "b1ec114d4f1886bd4732dc3c60faf373", "score": "0.6153998", "text": "func (u *userService) Login(username string, password string) (user *User, err error) {\n\tif user, err = u.userDatabase.ByUsername(username); err != nil {\n\t\treturn nil, ErrNotFound\n\t}\n\n\tif user.username != username || user.password != password {\n\t\treturn nil, ErrUnauthorized\n\t}\n\treturn user, nil\n}", "title": "" }, { "docid": "7d545d659f9699b36de2108b2ed8303a", "score": "0.6151565", "text": "func (s *HTTP) Login(w http.ResponseWriter, r *http.Request) {\n\tuserID := uuid.NewV4()\n\tuserToken := token\n\n\tresponse := types.LoginResponse{\n\t\tUserID: userID.String(),\n\t\tToken: userToken,\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\terr := json.NewEncoder(w).Encode(response)\n\tif err != nil {\n\t\thttp.Error(w, \"failed to write response: \"+err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" } ]
7f1ad17c5745bded42fd55827bcdc05a
void IupDrawPolygon(Ihandle ih, int points, int count); Draws a polygon. Coordinates are stored in the array in the sequence: x1, y1, x2, y2, ...
[ { "docid": "700ca8c6128acc4bd898a0d8d1da4e96", "score": "0.89153063", "text": "func DrawPolygon(ih Ihandle, points []int, count int){\n\tif points.len() != count{\n\t\tpanic(fmt.Errorf(\"points array size different from count\"))\n\t}\n\tC.IupDrawPolygon(ih.ptr(), (*C.int)(unsafe.Pointer(&points[0])), C.int(count))\n}", "title": "" } ]
[ { "docid": "4f2be728367aae2294d3003593de9aad", "score": "0.6980747", "text": "func (i *Image) DrawPoly(points ...float64) {\n\tC.cairo_move_to(i.Ctx, C.double(points[0]), C.double(points[1]))\n\tfor j := 2; j < len(points); j += 2 {\n\t\tC.cairo_line_to(i.Ctx, C.double(points[j]), C.double(points[j+1]))\n\t}\n\tC.cairo_close_path(i.Ctx)\n}", "title": "" }, { "docid": "52d94a5548a6f6162a5700af7a0022cf", "score": "0.6740095", "text": "func (s *Surface) DrawPolygon(polygon Polygon, c color.RGBA) {\n\tif len(polygon) < 3 {\n\t\treturn\n\t}\n\tfor i := 1; i < len(polygon); i++ {\n\t\ts.Line(polygon[i-1], polygon[i], c)\n\t}\n\ts.Line(polygon[len(polygon)-1], polygon[0], c)\n}", "title": "" }, { "docid": "f1c335e22125821a0a38ba9fef019d26", "score": "0.6464648", "text": "func defpolygon(id string, w int, h int, legend string) {\n\tvar x = []int{0, w / 2, w, w, w / 2, 0}\n\tvar y = []int{0, -h / 4, 0, (h * 3) / 4, h / 2, (h * 3) / 4}\n\tcanvas.Gid(id)\n\tfor i := 0; i < len(x); i++ {\n\t\tdefcoord(x[i], y[i], -textsize)\n\t}\n\tcanvas.Polygon(x, y, objstyle)\n\tdeflegend(w/2, h, 0, legend)\n\tcanvas.Gend()\n}", "title": "" }, { "docid": "23f6bc5d672894c24de2eb10db6731a4", "score": "0.6274318", "text": "func (s *Surface) DrawPolygonA(polygon Polygon, c color.RGBA) {\n\tif len(polygon) < 3 {\n\t\treturn\n\t}\n\tfor i := 1; i < len(polygon); i++ {\n\t\ts.LineA(polygon[i-1], polygon[i], c)\n\t}\n\ts.LineA(polygon[len(polygon)-1], polygon[0], c)\n}", "title": "" }, { "docid": "39f2c4bc9c0a1ce2bd6d54dfdcffb5d1", "score": "0.6266291", "text": "func (dp *DrawPolygon) InDrawPolygon(xi, yi, x2i, y2i int) bool {\n\tif dp.usingDrawPolygon {\n\t\tx := float64(xi)\n\t\ty := float64(yi)\n\t\tx2 := float64(x2i)\n\t\ty2 := float64(y2i)\n\n\t\tdx := dp.dims.Min.X()\n\t\tdy := dp.dims.Min.Y()\n\t\tdx2 := dp.dims.Max.X()\n\t\tdy2 := dp.dims.Max.Y()\n\n\t\tdimOverlap := false\n\t\tif x > dx {\n\t\t\tif x < dx2 {\n\t\t\t\tdimOverlap = true\n\t\t\t}\n\t\t} else {\n\t\t\tif dx < x2 {\n\t\t\t\tdimOverlap = true\n\t\t\t}\n\t\t}\n\t\tif y > dy {\n\t\t\tif y < dy2 {\n\t\t\t\tdimOverlap = true\n\t\t\t}\n\t\t} else {\n\t\t\tif dy < y2 {\n\t\t\t\tdimOverlap = true\n\t\t\t}\n\t\t}\n\t\tif !dimOverlap {\n\t\t\treturn false\n\t\t}\n\t\tif dp.rectangular {\n\t\t\treturn true\n\t\t}\n\t\tr := floatgeom.NewRect2(x, y, x2, y2)\n\t\tdiags := [][2]floatgeom.Point2{\n\t\t\t{\n\t\t\t\t{r.Min.X(), r.Max.Y()},\n\t\t\t\t{r.Max.X(), r.Min.Y()},\n\t\t\t}, {\n\t\t\t\tr.Min,\n\t\t\t\tr.Max,\n\t\t\t},\n\t\t}\n\t\tlast := dp.drawPolygon[len(dp.drawPolygon)-1]\n\t\tfor i := 0; i < len(dp.drawPolygon); i++ {\n\t\t\tnext := dp.drawPolygon[i]\n\t\t\tif r.Contains(next) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\t// Checking line segment from last to next\n\t\t\tfor _, diag := range diags {\n\t\t\t\tif orient(diag[0], diag[1], last) != orient(diag[0], diag[1], next) &&\n\t\t\t\t\torient(next, last, diag[0]) != orient(next, last, diag[1]) {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlast = next\n\t\t}\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "0a84d53fd2ec4614da6176e3fa70f81f", "score": "0.6176349", "text": "func (dp *DrawPolygon) SetPolygon(poly []floatgeom.Point2) {\n\tdp.usingDrawPolygon = true\n\tdp.dims = floatgeom.NewBoundingRect2(poly...)\n\tdp.drawPolygon = poly\n\tdp.rectangular = isRectangular(poly...)\n}", "title": "" }, { "docid": "eb99554e35cc8952be5f0522e7f05583", "score": "0.60924274", "text": "func Polygon(mode string, coords []float32) {\n\tcoords = append(coords, coords[0], coords[1])\n\tif mode == \"line\" {\n\t\tPolyLine(coords)\n\t} else {\n\t\tprepareDraw(nil)\n\t\tbindTexture(glState.defaultTexture)\n\t\tuseVertexAttribArrays(shaderPos)\n\n\t\tbuffer := newVertexBuffer(len(coords), coords, UsageStatic)\n\t\tbuffer.bind()\n\t\tdefer buffer.unbind()\n\n\t\tgl.VertexAttribPointer(shaderPos, 2, gl.FLOAT, false, 0, 0)\n\t\tgl.DrawArrays(gl.TRIANGLE_FAN, 0, len(coords)/2-1)\n\t}\n}", "title": "" }, { "docid": "03c5ed00d41b867296c6458b1205e35e", "score": "0.6092125", "text": "func polygon(w io.Writer, s []string, linenumber int) error {\n\tn := len(s)\n\te := fmt.Errorf(\"line %d: %s \\\"xcoord\\\" \\\"ycoord\\\" [color] [opacity]\", linenumber, s[0])\n\tif n < 3 {\n\t\treturn e\n\t}\n\tswitch n {\n\tcase 3:\n\t\tfmt.Fprintf(w, \"<%s xc=%s yc=%s/>\\n\", s[0], s[1], s[2])\n\tcase 4:\n\t\tfmt.Fprintf(w, \"<%s xc=%s yc=%s color=%s/>\\n\", s[0], s[1], s[2], s[3])\n\tcase 5:\n\t\tfmt.Fprintf(w, \"<%s xc=%s yc=%s color=%s opacity=%q/>\\n\", s[0], s[1], s[2], s[3], s[4])\n\tdefault:\n\t\treturn e\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "37543ea9bbdf1f574a963b677244a8da", "score": "0.608184", "text": "func Polygon(offset Pt, filled bool, points []Pt, thickness float64) *PolygonT {\n\treturn &PolygonT{\n\t\tOffset: offset,\n\t\tPoints: points,\n\t}\n}", "title": "" }, { "docid": "16c3f341085c369cc4e65b9268ed2e37", "score": "0.607714", "text": "func (p *Polygon) Render(path string) error {\n\tif p.vlist == nil {\n\t\treturn fmt.Errorf(\"no vertices\")\n\t}\n\tp.fixups()\n\tfmt.Printf(\"rendering %s\\n\", path)\n\td := NewDXF(path)\n\tfor i := 0; i < len(p.vlist)-1; i++ {\n\t\tif p.vlist[i+1].vtype != HIDE {\n\t\t\tp0 := p.vlist[i].vertex\n\t\t\tp1 := p.vlist[i+1].vertex\n\t\t\td.Line(p0, p1)\n\t\t}\n\t}\n\t// close the polygon if needed\n\tif p.closed {\n\t\tp0 := p.vlist[len(p.vlist)-1].vertex\n\t\tp1 := p.vlist[0].vertex\n\t\tif !p0.Equals(p1, TOLERANCE) {\n\t\t\td.Line(p0, p1)\n\t\t}\n\t}\n\terr := d.Save()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "070caa1e4d9d5fd37ff4e1d66d2db9e2", "score": "0.59903926", "text": "func NewPolygon(xys ...XYer) (*Polygon, error) {\n\tdata := make([]XYs, len(xys))\n\tfor i, d := range xys {\n\t\tvar err error\n\t\tdata[i], err = CopyXYs(d)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn &Polygon{\n\t\tXYs: data,\n\t\tLineStyle: DefaultLineStyle,\n\t}, nil\n}", "title": "" }, { "docid": "30653a848354b01768de470d0789230b", "score": "0.5914055", "text": "func Polygon(p orb.Polygon, proj orb.Projection) orb.Polygon {\n\tfor i := range p {\n\t\tp[i] = Ring(p[i], proj)\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "57895a3ae778ae7ce559e1e1ea80a43e", "score": "0.572915", "text": "func (dp *DrawPolygon) SetDrawPolygon(p polyclip.Polygon) {\n\t// get []floatgeom.Point2\n\tpoly := make([]floatgeom.Point2, 0, len(p))\n\tfor _, c := range p {\n\t\tfor _, pt := range c {\n\t\t\tpoly = append(poly, floatgeom.Point2{pt.X, pt.Y})\n\t\t}\n\t}\n\tdp.SetPolygon(poly)\n}", "title": "" }, { "docid": "788ae75c53f675e2aa4cd9c0da15b41d", "score": "0.55540866", "text": "func NewPolygon(points ...interface{}) *Polygon {\n\treturn &Polygon{\n\t\tbasicShape: wrapBasicShape(pkg.Get(\"Polygon\").New(points...)),\n\t}\n}", "title": "" }, { "docid": "fd3278651298ee45c3e4f3d1b4d31b52", "score": "0.5521573", "text": "func PolygonArea(locList []*Location) (square float64, err error) {\n\tvectorMinus := func(fromVector, toVector [2]float64) [2]float64 {\n\t\treturn [2]float64{toVector[0] - fromVector[0], toVector[1] - fromVector[1]}\n\t}\n\n\tvectorCrossMultiple := func(firstVector, SecondVector [2]float64) float64 {\n\t\treturn firstVector[0]*SecondVector[1] - firstVector[1]*SecondVector[0]\n\t}\n\n\t// check polygon has enough points\n\tif len(locList) < 4 {\n\t\treturn -1, errors.New(\"Not enough Points\")\n\t}\n\n\t// check polygon is closure\n\tif math.Abs(locList[0].EuclideanDistance(locList[len(locList)-1])-0.0) > 0.01 {\n\t\treturn -1, errors.New(\"Polygon not closure\")\n\t}\n\n\t// remove the closure point of polygon\n\tlocList = locList[0 : len(locList)-1]\n\tvar avgLat, avgLng, sumLat, sumLng float64\n\tfor i := 0; i < len(locList); i++ {\n\t\tsumLat += locList[i].GetLatitude()\n\t\tsumLng += locList[i].GetLongitude()\n\t}\n\tavgLat, avgLng = sumLat/float64(len(locList)), sumLng/float64(len(locList))\n\t//1. choose first element as base point\n\tbasePoint := NewLocation(avgLat, avgLng)\n\tbaseVector := [2]float64{0.0, 0.0}\n\n\t//2. convert all loctList from lat/lng coordinate to x/y coordinate\n\tusePoint := make([]*Location, len(locList))\n\tuseVector := make([][2]float64, len(locList))\n\tfor i := 0; i < len(locList); i++ {\n\t\tusePoint[i] = locList[i]\n\t\tuseVector[i] = [2]float64{\n\t\t\tbasePoint.EuclideanDistance(NewLocation(usePoint[i].GetLatitude(), basePoint.GetLongitude())),\n\t\t\tbasePoint.EuclideanDistance(NewLocation(basePoint.GetLatitude(), usePoint[i].GetLongitude()))}\n\t\t//based on the geographical latitude and longitude, the coordinate has been rotated.\n\t\t// The increasing latitude will located on the negative x-axis.\n\t\tif usePoint[i].GetLatitude() > basePoint.GetLatitude() {\n\t\t\tuseVector[i][0] *= -1.0\n\t\t}\n\t\tif usePoint[i].GetLongitude() < basePoint.GetLongitude() {\n\t\t\tuseVector[i][1] *= -1.0\n\t\t}\n\t}\n\t//3. cross the vector to get triangle area each by each\n\tvar area = 0.0\n\tfor i := 0; i < len(useVector)-1; i++ {\n\t\tfirstVec := vectorMinus(useVector[i], baseVector)\n\t\tsecondVec := vectorMinus(useVector[i+1], baseVector)\n\t\ttmpArea := vectorCrossMultiple(firstVec, secondVec)\n\t\tarea += tmpArea\n\t}\n\treturn area / 2, nil\n}", "title": "" }, { "docid": "ef6345e27dcdd51883f6009db7000952", "score": "0.5430462", "text": "func DrawRectangle(ih Ihandle, x1, y1, x2, y2 int){\n\tC.IupDrawRectangle(ih.ptr(), C.int(x1), C.int(y1), C.int(x2), C.int(y2))\n}", "title": "" }, { "docid": "2cc0de0aaa8a6ca39686c324f3b39712", "score": "0.54268783", "text": "func (me *XsdGoPkgHasElems_Polygon) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_Polygon; 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\tfor _, x := range me.Polygons {\n\t\t\tif err = x.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\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": "bcd159f52c7b7a504ccf8a7cdfaa36ed", "score": "0.5426693", "text": "func (li *polygonIterator) Done() {}", "title": "" }, { "docid": "152aebf9bd7676ccb5e329d83058586d", "score": "0.53778297", "text": "func PolygonMode(face uint32, mode uint32) {\n\tsyscall.Syscall(gpPolygonMode, 2, uintptr(face), uintptr(mode), 0)\n}", "title": "" }, { "docid": "4027042da9d0202281443d29d8110ed8", "score": "0.53752345", "text": "func PolygonContains(p orb.Polygon, point orb.Point) bool {\n\tif !RingContains(p[0], point) {\n\t\treturn false\n\t}\n\n\tfor i := 1; i < len(p); i++ {\n\t\tif RingContains(p[i], point) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "c8f2a598d31cf5e57845d64d6d6cf1c2", "score": "0.53466576", "text": "func (me *XsdGoPkgHasElem_Polygon) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_Polygon; 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.Polygon.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": "ae014af3874ce39067ec80b040cb7b39", "score": "0.5328745", "text": "func (o *OccluderPolygon2D) GetPolygon() gdnative.PoolVector2Array {\n\t//log.Println(\"Calling OccluderPolygon2D.GetPolygon()\")\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(\"OccluderPolygon2D\", \"get_polygon\")\n\n\t// Call the parent method.\n\t// PoolVector2Array\n\tretPtr := gdnative.NewEmptyPoolVector2Array()\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.NewPoolVector2ArrayFromPointer(retPtr)\n\treturn ret\n}", "title": "" }, { "docid": "0a9a07897b2340460711955ad9838373", "score": "0.5320798", "text": "func DeserializePoly(buf []byte, isBig bool, srid uint32) (Polygon, int, error) {\n\t// Must be at least count, count, and four points\n\tif len(buf) < (CountSize + CountSize + 4*PointSize) {\n\t\treturn Polygon{}, 0, sql.ErrInvalidGISData.New(\"DeserializePoly\")\n\t}\n\n\t// Read number of lines\n\tlines := make([]LineString, readCount(buf, isBig))\n\tbuf = buf[CountSize:]\n\tcount := CountSize\n\n\t// Read lines\n\tvar err error\n\tvar c int\n\tfor i := range lines {\n\t\tlines[i], c, err = DeserializeLine(buf, isBig, srid)\n\t\tif err != nil {\n\t\t\treturn Polygon{}, 0, sql.ErrInvalidGISData.New(\"DeserializePoly\")\n\t\t}\n\t\tbuf = buf[c:]\n\t\tcount += c\n\t}\n\n\treturn Polygon{SRID: srid, Lines: lines}, count, nil\n}", "title": "" }, { "docid": "ecf915ca5c246c1ca1dbdbbdb91a7c37", "score": "0.5305087", "text": "func (dp *DrawPolygon) ClearDrawPolygon() {\n\tdp.usingDrawPolygon = false\n\tdp.dims = floatgeom.Rect2{}\n\tdp.rectangular = false\n}", "title": "" }, { "docid": "0885d6e57660227f581deb7ef4eb5660", "score": "0.5257057", "text": "func draw(points []Point) {\n\n\tif len(points) == 0 {\n\t\treturn\n\t}\n\n\tvar plan [41][41]bool // x+20 , y + 20\n\tfor _, p := range points {\n\t\tplan[p.X+20][p.Y+20] = true\n\t}\n\tfor x := 0; x < 41; x++ {\n\t\tfor y := 0; y < 41; y++ {\n\t\t\tif plan[x][y] {\n\t\t\t\tfmt.Print(\".\")\n\t\t\t} else {\n\t\t\t\tfmt.Print(\" \")\n\t\t\t}\n\t\t}\n\t\tfmt.Println()\n\t}\n\n}", "title": "" }, { "docid": "380ec083f9f710f1936716fe2ddef0e4", "score": "0.5248909", "text": "func (p Polygon) Iterate() starlark.Iterator {\n\treturn &polygonIterator{polygon: p}\n}", "title": "" }, { "docid": "ffeded0df0e1c64cc35d6a8038538a4b", "score": "0.5228479", "text": "func geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:195968:13: */\n\tbp := tls.Alloc(48)\n\tdefer tls.Free(48)\n\n\tvar p uintptr\n\tif argc < 1 {\n\t\treturn\n\t}\n\tp = geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0))\n\tif p != 0 {\n\t\tvar db uintptr = Xsqlite3_context_db_handle(tls, context)\n\t\tvar x uintptr = Xsqlite3_str_new(tls, db)\n\t\tvar i int32\n\t\tvar cSep int8 = int8('\\'')\n\t\tXsqlite3_str_appendf(tls, x, ts+25290 /* \"<polyline points...\" */, 0)\n\t\tfor i = 0; i < (*GeoPoly)(unsafe.Pointer(p)).FnVertex; i++ {\n\t\t\tXsqlite3_str_appendf(tls, x, ts+25308 /* \"%c%g,%g\" */, libc.VaList(bp, int32(cSep), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((i)*2))*4))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((i)*2)+1))*4)))))\n\t\t\tcSep = int8(' ')\n\t\t}\n\t\tXsqlite3_str_appendf(tls, x, ts+25316 /* \" %g,%g'\" */, libc.VaList(bp+24, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */)))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + 1*4)))))\n\t\tfor i = 1; i < argc; i++ {\n\t\t\tvar z uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))\n\t\t\tif (z != 0) && (*(*int8)(unsafe.Pointer(z)) != 0) {\n\t\t\t\tXsqlite3_str_appendf(tls, x, ts+25324 /* \" %s\" */, libc.VaList(bp+40, z))\n\t\t\t}\n\t\t}\n\t\tXsqlite3_str_appendf(tls, x, ts+25328 /* \"></polyline>\" */, 0)\n\t\tXsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free})))\n\t\tXsqlite3_free(tls, p)\n\t}\n}", "title": "" }, { "docid": "40f87bbef667074272b7ac9e8371a889", "score": "0.52251524", "text": "func NewPolygon() *Polygon {\n\treturn &Polygon{}\n}", "title": "" }, { "docid": "0f2ed653fd2453804dae8256c493e078", "score": "0.52145916", "text": "func PolygonOffset(factor float32, units float32) {\n\tsyscall.Syscall(gpPolygonOffset, 2, uintptr(math.Float32bits(factor)), uintptr(math.Float32bits(units)), 0)\n}", "title": "" }, { "docid": "ae9775618eace1beb2baf2d7d501199c", "score": "0.52089775", "text": "func (pts *Polygon) Plot(c draw.Canvas, plt *plot.Plot) {\n\ttrX, trY := plt.Transforms(&c)\n\tps := make([][]vg.Point, len(pts.XYs))\n\n\tfor i, ring := range pts.XYs {\n\t\tps[i] = make([]vg.Point, len(ring))\n\t\tfor j, p := range ring {\n\t\t\tps[i][j].X = trX(p.X)\n\t\t\tps[i][j].Y = trY(p.Y)\n\t\t}\n\t\tps[i] = c.ClipPolygonXY(ps[i])\n\t}\n\tif pts.Color != nil && len(ps) > 0 {\n\t\tc.SetColor(pts.Color)\n\t\t// allocate enough space for at least 4 path components per ring.\n\t\t// 3 is the minimum but 4 is more common.\n\t\tpa := make(vg.Path, 0, 4*len(ps))\n\t\tfor _, ring := range ps {\n\t\t\tif len(ring) == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tpa.Move(ring[0])\n\t\t\tfor _, p := range ring[1:] {\n\t\t\t\tpa.Line(p)\n\t\t\t}\n\t\t\tpa.Close()\n\t\t}\n\t\tc.Fill(pa)\n\t}\n\n\tfor _, ring := range ps {\n\t\tif len(ring) > 0 && ring[len(ring)-1] != ring[0] {\n\t\t\tring = append(ring, ring[0])\n\t\t}\n\t\tc.StrokeLines(pts.LineStyle, c.ClipLinesXY(ring)...)\n\t}\n}", "title": "" }, { "docid": "527e9a2d49246329300464d3baa96966", "score": "0.520867", "text": "func geopolyAddSegments(tls *libc.TLS, p uintptr, pPoly uintptr, side uint8) { /* sqlite3.c:196505:13: */\n\tvar i uint32\n\tvar x uintptr\n\tfor i = uint32(0); i < (uint32((*GeoPoly)(unsafe.Pointer(pPoly)).FnVertex) - uint32(1)); i++ {\n\t\tx = ((pPoly + 8 /* &.a */) + uintptr(((i)*uint32(2)))*4)\n\t\tgeopolyAddOneSegment(tls, p, *(*GeoCoord)(unsafe.Pointer(x)), *(*GeoCoord)(unsafe.Pointer(x + 1*4)), *(*GeoCoord)(unsafe.Pointer(x + 2*4)), *(*GeoCoord)(unsafe.Pointer(x + 3*4)), side, i)\n\t}\n\tx = ((pPoly + 8 /* &.a */) + uintptr(((i)*uint32(2)))*4)\n\tgeopolyAddOneSegment(tls, p, *(*GeoCoord)(unsafe.Pointer(x)), *(*GeoCoord)(unsafe.Pointer(x + 1*4)), *(*GeoCoord)(unsafe.Pointer((pPoly + 8 /* &.a */))), *(*GeoCoord)(unsafe.Pointer((pPoly + 8 /* &.a */) + 1*4)), side, i)\n}", "title": "" }, { "docid": "60e1b72a79f137bfcb6ff8f9cb7a48de", "score": "0.5203148", "text": "func (o *Transfinite) Draw(npts []int, onlyBry bool, args, argsBry *plt.A) {\n\n\t// auxiliary\n\tif len(npts) != o.ndim {\n\t\tnpts = make([]int, o.ndim)\n\t}\n\tfor i := 0; i < o.ndim; i++ {\n\t\tif npts[i] < 3 {\n\t\t\tnpts[i] = 3\n\t\t}\n\t}\n\tif args == nil {\n\t\targs = &plt.A{C: plt.C(0, 0), NoClip: true}\n\t}\n\tif argsBry == nil {\n\t\targsBry = &plt.A{C: plt.C(0, 0), Lw: 2, NoClip: true}\n\t}\n\tx := la.NewVector(o.ndim)\n\tu := la.NewVector(o.ndim)\n\tx0 := make([]float64, npts[0])\n\ty0 := make([]float64, npts[0])\n\tx1 := make([]float64, npts[1])\n\ty1 := make([]float64, npts[1])\n\n\tif !onlyBry {\n\t\t// draw 0-lines\n\t\tfor j := 0; j < npts[1]; j++ {\n\t\t\tu[1] = -1 + 2*float64(j)/float64(npts[1]-1)\n\t\t\tfor i := 0; i < npts[0]; i++ {\n\t\t\t\tu[0] = -1 + 2*float64(i)/float64(npts[0]-1)\n\t\t\t\to.Point(x, u)\n\t\t\t\tx0[i] = x[0]\n\t\t\t\ty0[i] = x[1]\n\t\t\t}\n\t\t\tplt.Plot(x0, y0, args)\n\t\t}\n\n\t\t// draw 1-lines\n\t\tfor i := 0; i < npts[0]; i++ {\n\t\t\tu[0] = -1 + 2*float64(i)/float64(npts[0]-1)\n\t\t\tfor j := 0; j < npts[1]; j++ {\n\t\t\t\tu[1] = -1 + 2*float64(j)/float64(npts[1]-1)\n\t\t\t\to.Point(x, u)\n\t\t\t\tx1[j] = x[0]\n\t\t\t\ty1[j] = x[1]\n\t\t\t}\n\t\t\tplt.Plot(x1, y1, args)\n\t\t}\n\t}\n\n\t// draw B0(r)\n\tfor i := 0; i < npts[0]; i++ {\n\t\tr := -1 + 2*float64(i)/float64(npts[0]-1)\n\t\to.b[0](x, r)\n\t\tx0[i] = x[0]\n\t\ty0[i] = x[1]\n\t}\n\tplt.Plot(x0, y0, argsBry)\n\n\t// draw B1(s)\n\tfor j := 0; j < npts[1]; j++ {\n\t\ts := -1 + 2*float64(j)/float64(npts[1]-1)\n\t\to.b[1](x, s)\n\t\tx1[j] = x[0]\n\t\ty1[j] = x[1]\n\t}\n\tplt.Plot(x1, y1, argsBry)\n\n\t// draw B2(r)\n\tfor i := 0; i < npts[0]; i++ {\n\t\tr := -1 + 2*float64(i)/float64(npts[0]-1)\n\t\to.b[2](x, r)\n\t\tx0[i] = x[0]\n\t\ty0[i] = x[1]\n\t}\n\tplt.Plot(x0, y0, argsBry)\n\n\t// draw B3(s)\n\tfor j := 0; j < npts[1]; j++ {\n\t\ts := -1 + 2*float64(j)/float64(npts[1]-1)\n\t\to.b[3](x, s)\n\t\tx1[j] = x[0]\n\t\ty1[j] = x[1]\n\t}\n\tplt.Plot(x1, y1, argsBry)\n}", "title": "" }, { "docid": "b717999987f96acb40195888263b1a0f", "score": "0.519463", "text": "func (ptx *context) Poly(points []plot.Point, style *plot.Style) {\n\tmustExist(style)\n\tptx.elements = append(ptx.elements, element{\n\t\tpoints: points,\n\t\tstyle: *style,\n\t})\n}", "title": "" }, { "docid": "ef6deed7c64540e259e054b136283770", "score": "0.51777905", "text": "func (p Polygon) Type() string { return \"Polygon\" }", "title": "" }, { "docid": "4b610037261e3b244294586af12cf914", "score": "0.51596665", "text": "func (p Polygon) OrbPolygon() orb.Polygon {\n\tring := make([]orb.Ring, len(p))\n\tfor i, l := range p {\n\t\tring[i] = l.OrbRing()\n\t}\n\treturn orb.Polygon(ring)\n}", "title": "" }, { "docid": "c1617e3c1f2332a32441071ec30783b6", "score": "0.51517737", "text": "func (p Polygon) Index(i int) starlark.Value {\n\treturn p[i]\n}", "title": "" }, { "docid": "28b2496abf97c912d580a6f4212683b9", "score": "0.5151236", "text": "func PolygonRGBA(dst *sdl.Surface, vx []int16, vy []int16, r, g, b, a uint8) int {\n\treturn int(C.polygonRGBA((*C.SDL_Surface)(cast(dst)),\n\t\t(*C.Sint16)(unsafe.Pointer(&vx[0])),\n\t\t(*C.Sint16)(unsafe.Pointer(&vy[0])),\n\t\tC.int(len(vx)),\n\t\tC.Uint8(r),\n\t\tC.Uint8(g),\n\t\tC.Uint8(b),\n\t\tC.Uint8(a)))\n}", "title": "" }, { "docid": "b91bac48503a521ed6fb93362bd822a6", "score": "0.51230127", "text": "func Polygon3d(P [][]float64, args *A) {\n\tif len(P) < 1 {\n\t\treturn\n\t}\n\tif args == nil {\n\t\targs = &A{Fc: \"#5294ed\", Ec: \"#ffec4f\"}\n\t}\n\tcreateAxes3d()\n\tuid := genUID()\n\tio.Ff(&bufferPy, \"verts%d = [[\", uid)\n\tfor i, p := range P {\n\t\tif i > 0 {\n\t\t\tio.Ff(&bufferPy, \",\")\n\t\t}\n\t\tio.Ff(&bufferPy, \"(\")\n\t\tfor j, x := range p {\n\t\t\tif j > 0 {\n\t\t\t\tio.Ff(&bufferPy, \",\")\n\t\t\t}\n\t\t\tio.Ff(&bufferPy, \"%g\", x)\n\t\t}\n\t\tio.Ff(&bufferPy, \")\")\n\t}\n\tio.Ff(&bufferPy, \"]]\\n\")\n\tio.Ff(&bufferPy, \"poly%d = m3d.art3d.Poly3DCollection(verts%d\", uid, uid)\n\tupdateBufferAndClose(&bufferPy, args, false, false)\n\tio.Ff(&bufferPy, \"plt.gca().add_collection3d(poly%d)\\n\", uid)\n}", "title": "" }, { "docid": "7bc846f9e54ba0758047d84d53340db3", "score": "0.5115874", "text": "func (p Polygon) Freeze() {}", "title": "" }, { "docid": "1f6d1232449538d5f807409cb75777ef", "score": "0.5085994", "text": "func geopolyJsonFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:195942:13: */\n\tbp := tls.Alloc(32)\n\tdefer tls.Free(32)\n\n\tvar p uintptr = geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0))\n\tif p != 0 {\n\t\tvar db uintptr = Xsqlite3_context_db_handle(tls, context)\n\t\tvar x uintptr = Xsqlite3_str_new(tls, db)\n\t\tvar i int32\n\t\tXsqlite3_str_append(tls, x, ts+25266 /* \"[\" */, 1)\n\t\tfor i = 0; i < (*GeoPoly)(unsafe.Pointer(p)).FnVertex; i++ {\n\t\t\tXsqlite3_str_appendf(tls, x, ts+25268 /* \"[%!g,%!g],\" */, libc.VaList(bp, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((i)*2))*4))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((i)*2)+1))*4)))))\n\t\t}\n\t\tXsqlite3_str_appendf(tls, x, ts+25279 /* \"[%!g,%!g]]\" */, libc.VaList(bp+16, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */)))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + 1*4)))))\n\t\tXsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free})))\n\t\tXsqlite3_free(tls, p)\n\t}\n}", "title": "" }, { "docid": "ee545817ffa8cd53e0c43fdb84601c33", "score": "0.50809467", "text": "func PolygonMode(face uint32, mode uint32) {\n\tC.glowPolygonMode(gpPolygonMode, (C.GLenum)(face), (C.GLenum)(mode))\n}", "title": "" }, { "docid": "dd46308a5a507e2606d34bfd39a60e36", "score": "0.50762737", "text": "func geopolyContainsPointFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:196371:13: */\n\tvar p1 uintptr = geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0))\n\tvar x0 float64 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))\n\tvar y0 float64 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))\n\tvar v int32 = 0\n\tvar cnt int32 = 0\n\tvar ii int32\n\tif p1 == uintptr(0) {\n\t\treturn\n\t}\n\tfor ii = 0; ii < ((*GeoPoly)(unsafe.Pointer(p1)).FnVertex - 1); ii++ {\n\t\tv = pointBeneathLine(tls, x0, y0, float64(*(*GeoCoord)(unsafe.Pointer((p1 + 8 /* &.a */) + uintptr(((ii)*2))*4))), float64(*(*GeoCoord)(unsafe.Pointer((p1 + 8 /* &.a */) + uintptr((((ii)*2)+1))*4))),\n\t\t\tfloat64(*(*GeoCoord)(unsafe.Pointer((p1 + 8 /* &.a */) + uintptr(((ii+1)*2))*4))), float64(*(*GeoCoord)(unsafe.Pointer((p1 + 8 /* &.a */) + uintptr((((ii+1)*2)+1))*4))))\n\t\tif v == 2 {\n\t\t\tbreak\n\t\t}\n\t\tcnt = cnt + (v)\n\t}\n\tif v != 2 {\n\t\tv = pointBeneathLine(tls, x0, y0, float64(*(*GeoCoord)(unsafe.Pointer((p1 + 8 /* &.a */) + uintptr(((ii)*2))*4))), float64(*(*GeoCoord)(unsafe.Pointer((p1 + 8 /* &.a */) + uintptr((((ii)*2)+1))*4))),\n\t\t\tfloat64(*(*GeoCoord)(unsafe.Pointer((p1 + 8 /* &.a */)))), float64(*(*GeoCoord)(unsafe.Pointer((p1 + 8 /* &.a */) + 1*4))))\n\t}\n\tif v == 2 {\n\t\tXsqlite3_result_int(tls, context, 1)\n\t} else if ((v + cnt) & 1) == 0 {\n\t\tXsqlite3_result_int(tls, context, 0)\n\t} else {\n\t\tXsqlite3_result_int(tls, context, 2)\n\t}\n\tXsqlite3_free(tls, p1)\n}", "title": "" }, { "docid": "23a07e8155f91fc2a10a389764452f04", "score": "0.50739783", "text": "func BuildFromPolygon(coords, holes []float64, sx, sy float64, out []*point.Point) []*point.Point {\n\tpanic(\"BuildFromPolyon not implemented yet!\")\n}", "title": "" }, { "docid": "be581c13f3be641935c659d19462f56e", "score": "0.50706774", "text": "func (li *multiPolygonIterator) Done() {}", "title": "" }, { "docid": "04446298d57dfdbfb5c2d00f982bb152", "score": "0.506301", "text": "func NewTriangleFromPolygon(py [][][2]float64) Triangle {\n\t// Assume we are getting triangles from the function.\n\tif debug && len(py) != 1 {\n\t\tpanic(fmt.Sprintf(\"Step 3 : assumption invalid for triangle. %v\", py))\n\t}\n\tif debug && len(py[0]) < 3 {\n\t\tpanic(fmt.Sprintf(\"Step 3 : assumption invalid for triangle. %v\", py))\n\t}\n\tt := Triangle{py[0][0], py[0][1], py[0][2]}\n\treturn t\n}", "title": "" }, { "docid": "7b9db2f5d6eac6ed117d080864141c3b", "score": "0.50609756", "text": "func geopolyRegularFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:196147:13: */\n\tbp := tls.Alloc(4)\n\tdefer tls.Free(4)\n\n\tvar x float64 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv)))\n\tvar y float64 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))\n\tvar r float64 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))\n\tvar n int32 = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)))\n\t// var i int32 at bp, 4\n\n\tvar p uintptr\n\n\tif (n < 3) || (r <= 0.0) {\n\t\treturn\n\t}\n\tif n > 1000 {\n\t\tn = 1000\n\t}\n\tp = Xsqlite3_malloc64(tls, (uint64(uint64(unsafe.Sizeof(GeoPoly{})) + ((uint64((n - 1) * 2)) * uint64(unsafe.Sizeof(GeoCoord(0)))))))\n\tif p == uintptr(0) {\n\t\tXsqlite3_result_error_nomem(tls, context)\n\t\treturn\n\t}\n\t*(*int32)(unsafe.Pointer(bp /* i */)) = 1\n\t*(*uint8)(unsafe.Pointer((p + 4 /* &.hdr */))) = *(*uint8)(unsafe.Pointer(bp /* &i */))\n\t*(*uint8)(unsafe.Pointer((p + 4 /* &.hdr */) + 1)) = uint8(0)\n\t*(*uint8)(unsafe.Pointer((p + 4 /* &.hdr */) + 2)) = (uint8((n >> 8) & 0xff))\n\t*(*uint8)(unsafe.Pointer((p + 4 /* &.hdr */) + 3)) = (uint8(n & 0xff))\n\tfor *(*int32)(unsafe.Pointer(bp /* i */)) = 0; *(*int32)(unsafe.Pointer(bp /* i */)) < n; *(*int32)(unsafe.Pointer(bp /* i */))++ {\n\t\tvar rAngle float64 = (((float64(2.0) * 3.1415926535897932385) * float64(*(*int32)(unsafe.Pointer(bp /* i */)))) / float64(n))\n\t\t(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((*(*int32)(unsafe.Pointer(bp /* i */)))*2))*4))) = (GeoCoord(x - (r * geopolySine(tls, (rAngle-(float64(0.5)*3.1415926535897932385))))))\n\t\t(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((*(*int32)(unsafe.Pointer(bp /* i */)))*2)+1))*4))) = (GeoCoord(y + (r * geopolySine(tls, rAngle))))\n\t}\n\tXsqlite3_result_blob(tls, context, p+4 /* &.hdr */, (4 + (8 * n)), libc.UintptrFromInt32(-1))\n\tXsqlite3_free(tls, p)\n}", "title": "" }, { "docid": "25fd1d99db305d1dda431306f6923f88", "score": "0.50507003", "text": "func (m *Mesh) AddPolygon(indexes ...int) *Polygon {\n\tp := NewPolygon(len(indexes))\n\tfor _, v := range indexes {\n\t\tp.AddIndex(v)\n\t}\n\tm.Polygons = append(m.Polygons, p)\n\treturn &p\n}", "title": "" }, { "docid": "2a750a31cecb7ee0ec0085f16c5299f4", "score": "0.5046461", "text": "func (native *OpenGL) PolygonMode(face uint32, mode uint32) {\n\tgl.PolygonMode(face, mode)\n}", "title": "" }, { "docid": "1f9c03c2f7218aee986807965c07f628", "score": "0.50259984", "text": "func (gs *GeoShapeGo) Write(dataWriter *utils.StreamDataWriter) error {\n\tnumPolygons := len(gs.Polygons)\n\terr := dataWriter.WriteUint32(uint32(numPolygons))\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, polygon := range gs.Polygons {\n\t\tnumPoints := len(polygon)\n\t\terr = dataWriter.WriteUint32(uint32(numPoints))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, point := range polygon {\n\t\t\terr = dataWriter.WriteFloat32(point[0])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr = dataWriter.WriteFloat32(point[1])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn dataWriter.WritePadding(int(dataWriter.GetBytesWritten()), 4)\n}", "title": "" }, { "docid": "5a2de89c26034e0c36af50f06730402c", "score": "0.502557", "text": "func (m *Map) GeneratePolygon() (geo.Polygon, error) {\n\tml, err := m.makeLineMap()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlps, err := ml.Loops()\n\treturn geo.Polygon(lps), err\n}", "title": "" }, { "docid": "37132ca408e202356f6f21823ceff2b7", "score": "0.50170743", "text": "func pointInPolygon(point geom.Point, polygon geom.Geom) (bool, error) {\n\tinCount := 0\n\tswitch polygon.(type) {\n\tcase geom.Polygon:\n\t\to := orientation(polygon.(geom.Polygon))\n\t\tfor i, r := range polygon.(geom.Polygon) {\n\t\t\tif pointInPoly(point, contour(r)) != 0 {\n\t\t\t\tif o[i] > 0. {\n\t\t\t\t\tinCount++\n\t\t\t\t} else if o[i] < 0. {\n\t\t\t\t\tinCount--\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn inCount > 0, nil\n\tcase geom.MultiPolygon:\n\t\tfor _, pp := range polygon.(geom.MultiPolygon) {\n\t\t\tin, err := pointInPolygon(point, geom.Geom(pp))\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\tif in {\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t}\n\t\treturn false, nil\n\tdefault:\n\t\treturn false, newUnsupportedGeometryError(polygon)\n\t}\n}", "title": "" }, { "docid": "2a67eada42fa50622398fb063306b1fe", "score": "0.49924648", "text": "func DrawTriangleElements(count int32) {\n\tgl.DrawElements(gl.TRIANGLES, count, gl.UNSIGNED_INT, gl.PtrOffset(0))\n}", "title": "" }, { "docid": "5dc14ade0163571c072208b2acf8fdc8", "score": "0.4989494", "text": "func (w *World) Draw(pix []byte) {\n\tfor i, v := range w.area {\n\t\tif v {\n\t\t\tpix[4*i] = 0xff\n\t\t\tpix[4*i+1] = 0x00\n\t\t\tpix[4*i+2] = 0x00\n\t\t\tpix[4*i+3] = 0xff\n\t\t} else {\n\t\t\tpix[4*i] = 0\n\t\t\tpix[4*i+1] = 0\n\t\t\tpix[4*i+2] = 0\n\t\t\tpix[4*i+3] = 0\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5693be450ffaf5c94a5f6b70fe57bf6f", "score": "0.49826014", "text": "func (dp *DrawPolygon) DrawPolygonDim() floatgeom.Rect2 {\n\treturn dp.dims\n}", "title": "" }, { "docid": "2c5b045beccfeb309db3f0c0f48c6d8f", "score": "0.4972469", "text": "func geopolyCcwFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:196098:13: */\n\tvar p uintptr = geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0))\n\tif p != 0 {\n\t\tif geopolyArea(tls, p) < 0.0 {\n\t\t\tvar ii int32\n\t\t\tvar jj int32\n\t\t\tii = 1\n\t\t\tjj = ((*GeoPoly)(unsafe.Pointer(p)).FnVertex - 1)\n\t\t__1:\n\t\t\tif !(ii < jj) {\n\t\t\t\tgoto __3\n\t\t\t}\n\t\t\t{\n\t\t\t\tvar t GeoCoord = *(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((ii)*2))*4))\n\t\t\t\t(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((ii)*2))*4))) = *(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((jj)*2))*4))\n\t\t\t\t(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((jj)*2))*4))) = t\n\t\t\t\tt = *(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((ii)*2)+1))*4))\n\t\t\t\t(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((ii)*2)+1))*4))) = *(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((jj)*2)+1))*4))\n\t\t\t\t(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((jj)*2)+1))*4))) = t\n\n\t\t\t}\n\t\t\tgoto __2\n\t\t__2:\n\t\t\tii++\n\t\t\tjj--\n\t\t\tgoto __1\n\t\t\tgoto __3\n\t\t__3:\n\t\t}\n\t\tXsqlite3_result_blob(tls, context, p+4, /* &.hdr */\n\t\t\t(4 + (8 * (*GeoPoly)(unsafe.Pointer(p)).FnVertex)), libc.UintptrFromInt32(-1))\n\t\tXsqlite3_free(tls, p)\n\t}\n}", "title": "" }, { "docid": "8fad278182cd4fb0bc165a6404b6e003", "score": "0.49657798", "text": "func PolygonByAxis(\n\tp *geom.Polygon, axisBounds *planar.AxisBounds) (*geom.Polygon, error) {\n\n\tresult := geom.NewPolygon(geom.XY)\n\tnumRings := p.NumLinearRings()\n\tfor i := 0; i < numRings; i++ {\n\t\tclipped, err := LinearRingByAxis(p.LinearRing(i), axisBounds)\n\t\tif i == 0 && err == ErrEmptyResult {\n\t\t\t// If the shell is empty, no sense clipping the holes\n\t\t\treturn nil, ErrEmptyResult\n\t\t}\n\t\tif err != ErrEmptyResult {\n\t\t\tresult.Push(clipped)\n\t\t}\n\t}\n\tif result.NumLinearRings() > 0 {\n\t\treturn result, nil\n\t}\n\treturn nil, ErrEmptyResult\n}", "title": "" }, { "docid": "c8cb955c4875d786bc610758cf8baf33", "score": "0.49543214", "text": "func dopoly(doc *gc.Canvas, xc, yc string, cw, ch float64, color string, opacity float64) {\n\txs := strings.Split(xc, \" \")\n\tys := strings.Split(yc, \" \")\n\tif len(xs) != len(ys) {\n\t\treturn\n\t}\n\tif len(xs) < 3 || len(ys) < 3 {\n\t\treturn\n\t}\n\tpx := make([]float32, len(xs))\n\tpy := make([]float32, len(xs))\n\tfor i := 0; i < len(xs); i++ {\n\t\tx, err := strconv.ParseFloat(xs[i], 32)\n\t\tif err != nil {\n\t\t\tpx[i] = 0\n\t\t} else {\n\t\t\tpx[i] = float32(x)\n\t\t}\n\t\ty, err := strconv.ParseFloat(ys[i], 32)\n\t\tif err != nil {\n\t\t\tpy[i] = 0\n\t\t} else {\n\t\t\tpy[i] = float32(y)\n\t\t}\n\t}\n\tc := gc.ColorLookup(color)\n\tc.A = setop(opacity)\n\tdoc.Polygon(px, py, c)\n}", "title": "" }, { "docid": "a03767b1da7bd7d86ac972ba9f8f310c", "score": "0.49331358", "text": "func (self *GooDelegate) Draw(s *goosurface.Surface) {\n s.Begin();\n s.Clear(0.0, 0.0, 0.0, 0.9);\n s.End();\n}", "title": "" }, { "docid": "1ec090a107f7f3c757bfb959cc03a568", "score": "0.49321055", "text": "func (b *Buffer) Draw(p gfx.Primitive, first, count int) {\n\tb.ctx.fastBindBuffer(b.ctx.Enums[int(b.typ)], b.o)\n\tif b.typ == gfx.ArrayBuffer {\n\t\tb.ctx.O.Call(\"drawArrays\", b.ctx.Enums[int(p)], first, count)\n\t} else {\n\t\tb.ctx.O.Call(\"drawElements\", b.ctx.Enums[int(p)], count, b.ctx.UNSIGNED_SHORT, first*4)\n\t}\n}", "title": "" }, { "docid": "b74edb91f947897e8e4a836ee13a741f", "score": "0.49207613", "text": "func (plot *PlotWindow) DrawPoints(points []image.Point, pixelColor color.Color) {\n\tif plot == nil {\n\t\treturn\n\t}\n\tximg, err := xgraphics.NewDrawable(system.X, xproto.Drawable(plot.window.Id))\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer ximg.Destroy()\n\n\t// \n\tfor index, _ := range points {\n\t\tximg.Set(points[index].X, points[index].Y, pixelColor)\n\t}\n\t\n\tximg.XSurfaceSet(plot.window.Id)\n\t\n\tximg.XDraw()\n\t\n\tximg.XPaint(plot.window.Id)\n\t\n}", "title": "" }, { "docid": "33cf1782b6e2e332b99c9c6ead1abb65", "score": "0.49166808", "text": "func (p MultiPolygon) implementsGeometryValue() {}", "title": "" }, { "docid": "d3b04c4f98f2e1cf1b15f64428c72c95", "score": "0.49101907", "text": "func geopolyFuncParam(tls *libc.TLS, pCtx uintptr, pVal uintptr, pRc uintptr) uintptr { /* sqlite3.c:195867:16: */\n\tbp := tls.Alloc(4)\n\tdefer tls.Free(4)\n\n\tvar p uintptr = uintptr(0)\n\tvar nByte int32\n\tif (Xsqlite3_value_type(tls, pVal) == SQLITE_BLOB) &&\n\t\t((uint64(libc.AssignInt32(&nByte, Xsqlite3_value_bytes(tls, pVal)))) >= (uint64(4) + (uint64(6) * uint64(unsafe.Sizeof(GeoCoord(0)))))) {\n\t\tvar a uintptr = Xsqlite3_value_blob(tls, pVal)\n\t\tvar nVertex int32\n\t\tnVertex = (((int32(*(*uint8)(unsafe.Pointer(a + 1))) << 16) + (int32(*(*uint8)(unsafe.Pointer(a + 2))) << 8)) + int32(*(*uint8)(unsafe.Pointer(a + 3))))\n\t\tif ((int32(*(*uint8)(unsafe.Pointer(a))) == 0) || (int32(*(*uint8)(unsafe.Pointer(a))) == 1)) &&\n\t\t\t((((uint64(nVertex * 2)) * uint64(unsafe.Sizeof(GeoCoord(0)))) + uint64(4)) == uint64(uint32(nByte))) {\n\t\t\tp = Xsqlite3_malloc64(tls, (uint64(uint64(unsafe.Sizeof(GeoPoly{})) + ((uint64((nVertex - 1) * 2)) * uint64(unsafe.Sizeof(GeoCoord(0)))))))\n\t\t\tif p == uintptr(0) {\n\t\t\t\tif pRc != 0 {\n\t\t\t\t\t*(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM\n\t\t\t\t}\n\t\t\t\tif pCtx != 0 {\n\t\t\t\t\tXsqlite3_result_error_nomem(tls, pCtx)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t*(*int32)(unsafe.Pointer(bp /* x */)) = 1\n\t\t\t\t(*GeoPoly)(unsafe.Pointer(p)).FnVertex = nVertex\n\t\t\t\tlibc.Xmemcpy(tls, p+4 /* &.hdr */, a, uint64(nByte))\n\t\t\t\tif int32(*(*uint8)(unsafe.Pointer(a))) != int32(*(*uint8)(unsafe.Pointer(bp /* &x */))) {\n\t\t\t\t\tvar ii int32\n\t\t\t\t\tfor ii = 0; ii < nVertex; ii++ {\n\t\t\t\t\t\tgeopolySwab32(tls, ((p + 8 /* &.a */) + uintptr(((ii)*2))*4))\n\t\t\t\t\t\tgeopolySwab32(tls, ((p + 8 /* &.a */) + uintptr((((ii)*2)+1))*4))\n\t\t\t\t\t}\n\t\t\t\t\t*(*uint8)(unsafe.Pointer((p + 4 /* &.hdr */))) ^= uint8((1))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif pRc != 0 {\n\t\t\t*(*int32)(unsafe.Pointer(pRc)) = SQLITE_OK\n\t\t}\n\t\treturn p\n\t} else if Xsqlite3_value_type(tls, pVal) == SQLITE_TEXT {\n\t\tvar zJson uintptr = Xsqlite3_value_text(tls, pVal)\n\t\tif zJson == uintptr(0) {\n\t\t\tif pRc != 0 {\n\t\t\t\t*(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM\n\t\t\t}\n\t\t\treturn uintptr(0)\n\t\t}\n\t\treturn geopolyParseJson(tls, zJson, pRc)\n\t} else {\n\t\tif pRc != 0 {\n\t\t\t*(*int32)(unsafe.Pointer(pRc)) = SQLITE_ERROR\n\t\t}\n\t\treturn uintptr(0)\n\t}\n\treturn uintptr(0)\n}", "title": "" }, { "docid": "cc298ed25aef1f2e55e14440b4919be8", "score": "0.49043912", "text": "func FilledPolygonRGBA(dst *sdl.Surface, vx []int16, vy []int16, r, g, b, a uint8) int {\n\treturn int(C.filledPolygonRGBA((*C.SDL_Surface)(cast(dst)),\n\t\t(*C.Sint16)(cast(&vx[0])),\n\t\t(*C.Sint16)(cast(&vy[0])),\n\t\tC.int(len(vx)),\n\t\tC.Uint8(r),\n\t\tC.Uint8(g),\n\t\tC.Uint8(b),\n\t\tC.Uint8(a)))\n}", "title": "" }, { "docid": "74aa2e1e5ca9c1485c4a7802b63e7d23", "score": "0.4901163", "text": "func geopolyBBoxFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:196261:13: */\n\tvar p uintptr = geopolyBBox(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0), uintptr(0))\n\tif p != 0 {\n\t\tXsqlite3_result_blob(tls, context, p+4, /* &.hdr */\n\t\t\t(4 + (8 * (*GeoPoly)(unsafe.Pointer(p)).FnVertex)), libc.UintptrFromInt32(-1))\n\t\tXsqlite3_free(tls, p)\n\t}\n}", "title": "" }, { "docid": "35697d838c5abae8c04772909993d1e7", "score": "0.4864003", "text": "func geopolyBlobFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:195923:13: */\n\tvar p uintptr = geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0))\n\tif p != 0 {\n\t\tXsqlite3_result_blob(tls, context, p+4, /* &.hdr */\n\t\t\t(4 + (8 * (*GeoPoly)(unsafe.Pointer(p)).FnVertex)), libc.UintptrFromInt32(-1))\n\t\tXsqlite3_free(tls, p)\n\t}\n}", "title": "" }, { "docid": "b4dc7bb80afb84f96e6c9043607c581e", "score": "0.48627576", "text": "func (calc *LineCentroidCalculator) AddPolygon(polygon *geom.Polygon) *LineCentroidCalculator {\n\tfor i := 0; i < polygon.NumLinearRings(); i++ {\n\t\tcalc.AddLinearRing(polygon.LinearRing(i))\n\t}\n\n\treturn calc\n}", "title": "" }, { "docid": "c219f3f0b31320214ed5ffb7a44576d6", "score": "0.48399156", "text": "func PolygonOffset(factor float32, units float32) {\n\tC.glowPolygonOffset(gpPolygonOffset, (C.GLfloat)(factor), (C.GLfloat)(units))\n}", "title": "" }, { "docid": "ab43deeaf8af60c9cd575f0eca26d6ae", "score": "0.48268628", "text": "func Draw(fnc ColorMap, size image.Rectangle, domain *ComplexRect) image.Image {\n\tsize = size.Canon()\n\t// Clever vector hack to move the Min corner to 0,0\n\tsize = size.Sub(size.Min)\n\t// For now, use RGBA as image type\n\timg := image.NewRGBA(size)\n\t// max x and y guaranteed to be size of rectangle\n\tx := size.Dx()\n\ty := size.Dy()\n\tdx := domain.dx() / float64(x)\n\tdy := domain.dy() / float64(y)\n\t// Get the initial x vals\n\tbase_x := domain.left()\n\tbase_y := domain.bottom()\n\tfor i := 0; i <= x; i++ {\n\t\tfor j := 0; j <= y; j++ {\n\t\t\tpoint := complex(base_x+float64(i)*dx, base_y+float64(j)*dy)\n\t\t\timg.Set(i, j, fnc(point))\n\t\t}\n\t}\n\treturn img\n}", "title": "" }, { "docid": "0f815990b9462a946efd2d2de2a44524", "score": "0.4817515", "text": "func (p Polygon) String() string {\n\t// TODO (b5): finish this\n\treturn fmt.Sprintf(\"polygon %d rings\", len(p))\n\t// w := strings.Builder{}\n\t// w.WriteRune('[')\n\t// for _, p := range p {\n\t// \tw.WriteString(p.String() + \" \")\n\t// }\n\t// w.WriteRune(']')\n\t// return w.String()\n}", "title": "" }, { "docid": "29533ffdabdf3c96f65d49e74c4c146c", "score": "0.4814753", "text": "func (p MultiPolygon) WriteData(buf []byte) int {\n\tWriteCount(buf, uint32(len(p.Polygons)))\n\tbuf = buf[CountSize:]\n\tcount := CountSize\n\tfor _, p := range p.Polygons {\n\t\tWriteWKBHeader(buf, WKBPolyID)\n\t\tbuf = buf[WKBHeaderSize:]\n\t\tc := p.WriteData(buf)\n\t\tbuf = buf[c:]\n\t\tcount += WKBHeaderSize + c\n\t}\n\treturn count\n}", "title": "" }, { "docid": "62b0757e6694b463fb05b1256a7d8393", "score": "0.48137614", "text": "func (p MultiPolygon) Freeze() {}", "title": "" }, { "docid": "dbead9e809fb17a0956eb01883389bd0", "score": "0.48068187", "text": "func geopolyArea(tls *libc.TLS, p uintptr) float64 { /* sqlite3.c:196051:15: */\n\tvar rArea float64 = 0.0\n\tvar ii int32\n\tfor ii = 0; ii < ((*GeoPoly)(unsafe.Pointer(p)).FnVertex - 1); ii++ {\n\t\trArea = rArea + ((float64(((*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((ii)*2))*4))) - (*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((ii+1)*2))*4)))) * // (x0 - x1)\n\t\t\t((*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((ii)*2)+1))*4))) + (*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((ii+1)*2)+1))*4)))))) * // (y0 + y1)\n\t\t\t0.5)\n\t}\n\trArea = rArea + ((float64(((*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((ii)*2))*4))) - (*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */))))) * // (xN - x0)\n\t\t((*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((ii)*2)+1))*4))) + (*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + 1*4)))))) * // (yN + y0)\n\t\t0.5)\n\treturn rArea\n}", "title": "" }, { "docid": "a7723479f3069cdec0f53421bcdfb945", "score": "0.4805131", "text": "func LiesInsidePolygon(polygon []Point, p Point) bool {\n\tpolygon = append(polygon, polygon[0]) // to link back to first point\n\tintersections := make(map[Point]struct{})\n\tfor i := 1; i < len(polygon); i++ {\n\t\tlow, high := polygon[i-1], polygon[i]\n\t\tif low.Y > high.Y {\n\t\t\tlow, high = high, low\n\t\t}\n\t\tif low.Y == high.Y || p.Y < low.Y || p.Y > high.Y {\n\t\t\tcontinue // skip horizontal lines and too high, too low\n\t\t}\n\t\tif low.X == high.X { // vertical line\n\t\t\tif p.X == low.X && p.Y >= low.Y && p.Y <= high.Y {\n\t\t\t\treturn false // on boundary\n\t\t\t} else if p.X < low.X && p.Y >= low.Y && p.Y <= high.Y {\n\t\t\t\tintersections[Point{low.X, p.Y}] = struct{}{}\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tslope := (high.Y - low.Y) / (high.X - low.X)\n\t\tb := low.Y - slope*low.X\n\t\txAtY := (p.Y - b) / slope\n\t\tif p.X == xAtY {\n\t\t\treturn false // on boundary\n\t\t} else if p.X < xAtY {\n\t\t\tintersections[Point{xAtY, p.Y}] = struct{}{}\n\t\t}\n\t}\n\treturn len(intersections) == 1\n}", "title": "" }, { "docid": "7f3ac107a7231bd2f40bb40d1efe2d86", "score": "0.47953504", "text": "func Polyline(P [][]float64, args *A) {\n\tif len(P) < 1 {\n\t\treturn\n\t}\n\tuid := genUID()\n\tio.Ff(&bufferPy, \"dat%d = [[pth.Path.MOVETO, [%g, %g]]\", uid, P[0][0], P[0][1])\n\tfor _, p := range P {\n\t\tio.Ff(&bufferPy, \", [pth.Path.LINETO, [%g, %g]]\", p[0], p[1])\n\t}\n\tclosed := true\n\tif args != nil {\n\t\tclosed = args.Closed\n\t}\n\tif closed {\n\t\tio.Ff(&bufferPy, \", [pth.Path.CLOSEPOLY, [0, 0]]\")\n\t}\n\tio.Ff(&bufferPy, \"]\\n\")\n\tio.Ff(&bufferPy, \"commands%d, vertices%d = zip(*dat%d)\\n\", uid, uid, uid)\n\tio.Ff(&bufferPy, \"ph%d = pth.Path(vertices%d, commands%d)\\n\", uid, uid, uid)\n\tio.Ff(&bufferPy, \"pc%d = pat.PathPatch(ph%d\", uid, uid)\n\tupdateBufferAndClose(&bufferPy, args, false, false)\n\tio.Ff(&bufferPy, \"plt.gca().add_patch(pc%d)\\n\", uid)\n}", "title": "" }, { "docid": "6f0831f7c37be6bbdc68c8959abd8206", "score": "0.47899732", "text": "func DrawSelectRect(ih Ihandle, x1, y1, x2, y2 int){\n\tC.IupDrawSelectRect(ih.ptr(), C.int(x1), C.int(y1), C.int(x2), C.int(y2))\n}", "title": "" }, { "docid": "eb8e9fe207d5d58b10539a0ae4467a35", "score": "0.47770804", "text": "func geopolyAddOneSegment(tls *libc.TLS, p uintptr, x0 GeoCoord, y0 GeoCoord, x1 GeoCoord, y1 GeoCoord, side uint8, idx uint32) { /* sqlite3.c:196461:13: */\n\tvar pSeg uintptr\n\tvar pEvent uintptr\n\tif x0 == x1 {\n\t\treturn\n\t} // Ignore vertical segments\n\tif x0 > x1 {\n\t\tvar t GeoCoord = x0\n\t\tx0 = x1\n\t\tx1 = t\n\t\tt = y0\n\t\ty0 = y1\n\t\ty1 = t\n\t}\n\tpSeg = ((*GeoOverlap)(unsafe.Pointer(p)).FaSegment + uintptr((*GeoOverlap)(unsafe.Pointer(p)).FnSegment)*48)\n\t(*GeoOverlap)(unsafe.Pointer(p)).FnSegment++\n\t(*GeoSegment)(unsafe.Pointer(pSeg)).FC = (float64((y1 - y0) / (x1 - x0)))\n\t(*GeoSegment)(unsafe.Pointer(pSeg)).FB = (float64(y1) - (float64(x1) * (*GeoSegment)(unsafe.Pointer(pSeg)).FC))\n\t(*GeoSegment)(unsafe.Pointer(pSeg)).Fy0 = y0\n\t(*GeoSegment)(unsafe.Pointer(pSeg)).Fside = side\n\t(*GeoSegment)(unsafe.Pointer(pSeg)).Fidx = idx\n\tpEvent = ((*GeoOverlap)(unsafe.Pointer(p)).FaEvent + uintptr((*GeoOverlap)(unsafe.Pointer(p)).FnEvent)*32)\n\t(*GeoOverlap)(unsafe.Pointer(p)).FnEvent++\n\t(*GeoEvent)(unsafe.Pointer(pEvent)).Fx = float64(x0)\n\t(*GeoEvent)(unsafe.Pointer(pEvent)).FeType = 0\n\t(*GeoEvent)(unsafe.Pointer(pEvent)).FpSeg = pSeg\n\tpEvent = ((*GeoOverlap)(unsafe.Pointer(p)).FaEvent + uintptr((*GeoOverlap)(unsafe.Pointer(p)).FnEvent)*32)\n\t(*GeoOverlap)(unsafe.Pointer(p)).FnEvent++\n\t(*GeoEvent)(unsafe.Pointer(pEvent)).Fx = float64(x1)\n\t(*GeoEvent)(unsafe.Pointer(pEvent)).FeType = 1\n\t(*GeoEvent)(unsafe.Pointer(pEvent)).FpSeg = pSeg\n}", "title": "" }, { "docid": "3e902a897b1f9184f52eff7a4a3e18db", "score": "0.47752765", "text": "func PolygonFromLoops(loops []*Loop) *Polygon {\n\tif len(loops) > 1 {\n\t\tpanic(\"s2.PolygonFromLoops for multiple loops is not yet implemented\")\n\t}\n\treturn &Polygon{\n\t\tloops: loops,\n\t\tnumVertices: len(loops[0].Vertices()), // TODO(roberts): Once multi-loop is supported, fix this.\n\t\tbound: EmptyRect(),\n\t\tsubregionBound: EmptyRect(),\n\t}\n}", "title": "" }, { "docid": "6228be840666b77e134a0c15e797ee05", "score": "0.47708625", "text": "func polygonContains(bounds Polygon, point Point) bool {\n\tx := real(point)\n\ty := imag(point)\n\n\tinside := false\n j := len(bounds) - 1\n\tfor i, v := range bounds {\n\t\txi := real(v)\n\t\txj := real(bounds[j])\n\t\tyi := imag(v)\n\t\tyj := imag(bounds[j])\n\t\t\n\t\tintersect := (yi > y) != (yj > y) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi)\n\t\tif intersect {\n\t\t\tinside = !inside\n\t\t}\n\n\t\tj = i\n\t}\n\treturn inside\n/*\n\treturn (real(point) >= real(bounds[0])+delta && real(point) <= real(bounds[2])-delta) && (imag(point) <= imag(bounds[0])-delta && imag(point) >= imag(bounds[2])+delta)\n*/\n}", "title": "" }, { "docid": "9c2e92b4e894dd209e3e5867bbc4605d", "score": "0.47532165", "text": "func (tri *Triangulator) triangulatePseudoPolygon(p []quadedge.Vertex, ab triangulate.Segment) error {\n\tif debug {\n\t\tlog.Printf(\"triangulatePseudoPolygon(%v, %v)\", p, ab)\n\t}\n\n\t// triangulatePseudoPolygon([[0.2 0.3] [0 0]], {[[0 1] [1 0.5]] <nil>})\n\ta := ab.GetStart()\n\tb := ab.GetEnd()\n\tvar c quadedge.Vertex\n\t// If P has more than one element then\n\tif len(p) > 1 {\n\t\t// c:=First vertex of P\n\t\tc = p[0]\n\t\tci := 0\n\t\t// For each vertex v in P do\n\t\tfor i, v := range p {\n\t\t\t// If v ∈ CircumCircle (a, b, c) then\n\t\t\tif isInCircle(a, b, c, v) {\n\t\t\t\tc = v\n\t\t\t\tci = i\n\t\t\t}\n\t\t}\n\t\t// Divide P into PE and PD giving P=PE+c+PD\n\t\tpe := p[0:ci]\n\t\tpd := p[ci+1:]\n\t\t// TriangulatePseudoPolygon(PE, ac, T)\n\t\tif err := tri.triangulatePseudoPolygon(pe, triangulate.NewSegment(geom.Line{a, c})); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// TriangulatePseudoPolygon(PD, cd, T) (cb instead of cd? -JRS)\n\t\tif err := tri.triangulatePseudoPolygon(pd, triangulate.NewSegment(geom.Line{c, b})); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else if len(p) == 1 {\n\t\tc = p[0]\n\t}\n\n\t// If P is not empty then\n\tif len(p) > 0 && a.Equals(c) == false && b.Equals(c) == false {\n\t\t// Add triangle with vertices a, b, c into T\n\t\tif err := tri.createTriangle(a, c, b); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4e95b41080af17c150955aa3b5a3e69e", "score": "0.47366726", "text": "func Draw(drawer Drawer, filename string, data []int) error {\n\tw := computeMaxWidth(data)\n\th := computeMaxHeight(data)\n\timg := drawer.Draw(w, h, data)\n\treturn writeToFile(filename, img)\n}", "title": "" }, { "docid": "703800e5ebba1f1237f3b423ab105ec7", "score": "0.47217214", "text": "func (f Feature) genPoints(in chan world.XZ, gti [6]int32) {\n\tg := f.Geometry()\n\te := g.Envelope()\n\teminx := int32(e.MinX())\n\teminy := int32(e.MinY())\n\temaxx := int32(e.MaxX())\n\temaxy := int32(e.MaxY())\n\n\tfor y := eminy; y < emaxy; y -= gti[5] {\n\t\tfor x := eminx; x < emaxx; x += gti[1] {\n\t\t\tin <- world.XZ{X: x, Z: y}\n\t\t}\n\t}\n\tclose(in)\n}", "title": "" }, { "docid": "8a3c10793e9a49a2955ad66289b6af8a", "score": "0.4717353", "text": "func (p *Polygon) Close() {\n\tp.closed = true\n}", "title": "" }, { "docid": "e747c6f732d1c11797975fb36d6b526f", "score": "0.4711113", "text": "func (p Path) Draw(b *Brush) Limited {\n\tvar c Composite\n\tif b.StartMarker == nil && b.EndMarker == nil {\n\t\tfor _, s := range p {\n\t\t\tif d := s.Draw(b); d != nil {\n//\t\t\tif du,is:=d.(Limiter);is{\n//\t\t\t\tif duc,is:=du.Unlimited.(Composite);is && len(duc)<4{\n//\t\t\t\t\tc = append(c, duc...)\n//\t\t\t\t}else{\n//\t\t\t\t\tc = append(c, d)\n//\t\t\t\t}\n//\t\t\t}else\n\t\t\t\tif cd,is:=d.(Composite);is{\n\t\t\t\t\tc = append(c,cd...) // XXX leave to end and check if this is good or bad?\n\t\t\t\t}else{\n\t\t\t\t\tc = append(c, d)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn c //Limiter{Unlimited(c), c.MaxX()}\n\t}\n\t// same as above but with markers before first non-nil Draw and/or after last non-nil Draw\n\tvar sx, sy, ex, ey x\n\tfor _, s := range p {\n\t\tif len(c) == 0 {\n\t\t\tsx, sy = b.PenPath.Pen.x, b.PenPath.Pen.y\n\t\t}\n\t\tif d := s.Draw(b); d != nil {\n\t\t\tif len(c) == 0 && b.StartMarker != nil {\n\t\t\t\tc = append(c, Translated{b.StartMarker, sx, sy})\n\t\t\t}\n\t\t\t// XXX assume sub-composite is locialised to flatten and then centre to regain the division. \n\t\t\tif cd,is:=d.(Composite);is{\n\t\t\t\tc = append(c,cd...) // XXX leave to end and check if this is good or bad?\n\t\t\t}else{\n\t\t\t\tc = append(c, d)\n\t\t\t}\n//\t\t\tif du,is:=d.(Limiter);is{\n//\t\t\t\tif duc,is:=du.Unlimited.(Composite);is && len(duc)<4{\n//\t\t\t\t\tc = append(c, duc...)\n//\t\t\t\t}else{\n//\t\t\t\t\tc = append(c, d)\n//\t\t\t\t}\n//\t\t\t}else{\n//\t\t\t\tc = append(c, d)\n//\t\t\t}\n\t\t\tex, ey = b.PenPath.Pen.x, b.PenPath.Pen.y\n\t\t}\n\t}\n\tif b.EndMarker != nil {\n\t\tc = append(c, Translated{b.EndMarker, ex, ey})\n\t}\n\treturn c //Limiter{Unlimited(c), c.MaxX()}\n}", "title": "" }, { "docid": "6a4d5a49d0bcd0bc1173775661d4c118", "score": "0.47080874", "text": "func DrawLine(ih Ihandle, x1, y1, x2, y2 int){\n\tC.IupDrawLine(ih.ptr(), C.int(x1), C.int(y1), C.int(x2), C.int(y2))\n}", "title": "" }, { "docid": "4e7b32094a818b4e35cb5506f81f058d", "score": "0.47077522", "text": "func pointInPolygon(poly []*geom.Point, pt *geom.Point) bool {\n\tvar polyCorners = len(poly)\n\tvar i, j = 0, polyCorners-1\n\tvar oddNodes = false\n\tvar x, y = pt[0], pt[1]\n\n\tfor i = 0; i < polyCorners; i++ {\n\t\tif (poly[i][1] < y && poly[j][1] >= y || poly[j][1] < y && poly[i][1] >= y) && (poly[i][0] <= x || poly[j][0] <= x) {\n\t\t\tif poly[i][0]+(y-poly[i][1])/(poly[j][1]-poly[i][1])*(poly[j][0]-poly[i][0]) < x {\n\t\t\t\toddNodes = !oddNodes\n\t\t\t}\n\t\t}\n\t\tj = i\n\t}\n\n\treturn oddNodes\n}", "title": "" }, { "docid": "b36fd29fd00a868c66c512d0b19c27b4", "score": "0.470676", "text": "func (v Vector) DrawAt(cv Canvas, cl color.Color, p Point) {\n\tp.Draw(cv, cl)\n\tx0, y0 := round(p[0]), round(p[1])\n\tp1 := p.Plus(v)\n\tx1, y1 := round(p1[0]), round(p1[1])\n\tcv.StrokeLine(cl, x0, y0, x1, y1)\n}", "title": "" }, { "docid": "687088c3235081859492646d6854b0bd", "score": "0.47052076", "text": "func (me TxsdAreaShape) IsPoly() bool { return me.String() == \"POLY\" }", "title": "" }, { "docid": "3d7b424498768783bc5f70013410fdbb", "score": "0.46755505", "text": "func geopolyAreaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:196073:13: */\n\tvar p uintptr = geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0))\n\tif p != 0 {\n\t\tXsqlite3_result_double(tls, context, geopolyArea(tls, p))\n\t\tXsqlite3_free(tls, p)\n\t}\n}", "title": "" }, { "docid": "7aa1291f411036610cdf4e6c1b49c8ae", "score": "0.46706343", "text": "func (c *Canvas) drawDetection(dets [][]int) {\n\tc.processor.MaxPoints = c.trianglePoints\n\tc.processor.Grayscale = c.isGrayScaled\n\tc.processor.StrokeWidth = c.strokeWidth\n\tc.processor.PointsThreshold = c.pointsThreshold\n\tc.processor.Wireframe = c.wireframe\n\n\tc.triangle = &triangle.Image{*c.processor}\n\n\tfor i := 0; i < len(dets); i++ {\n\t\tif dets[i][3] > 50 {\n\t\t\tc.ctx.Call(\"beginPath\")\n\t\t\tc.ctx.Set(\"lineWidth\", 2)\n\t\t\tc.ctx.Set(\"strokeStyle\", \"rgba(255, 0, 0, 0.5)\")\n\n\t\t\trow, col, scale := dets[i][1], dets[i][0], dets[i][2]\n\t\t\tcol = col + int(float64(col)*0.1)\n\t\t\tscale = int(float64(scale) * 0.85)\n\n\t\t\t// Substract the image under the detected face region.\n\t\t\timgData := make([]byte, scale*scale*4)\n\t\t\tsubimg := c.ctx.Call(\"getImageData\", row-scale/2, col-scale/2, scale, scale).Get(\"data\")\n\t\t\tuint8Arr := js.Global().Get(\"Uint8Array\").New(subimg)\n\t\t\tjs.CopyBytesToGo(imgData, uint8Arr)\n\n\t\t\t// Triangulate the detected face region.\n\t\t\tbuffer := c.triangulate(imgData, dets[i])\n\t\t\tuint8Arr = js.Global().Get(\"Uint8Array\").New(scale * scale * 4)\n\t\t\tjs.CopyBytesToJS(uint8Arr, buffer)\n\n\t\t\tuint8Clamped := js.Global().Get(\"Uint8ClampedArray\").New(uint8Arr)\n\t\t\trawData := js.Global().Get(\"ImageData\").New(uint8Clamped, scale)\n\n\t\t\t// Replace the underlying face region with the triangulated image.\n\t\t\tc.ctx.Call(\"putImageData\", rawData, row-scale/2, col-scale/2)\n\n\t\t\tif c.showFrame {\n\t\t\t\tc.ctx.Call(\"rect\", row-scale/2, col-scale/2, scale, scale)\n\t\t\t\tc.ctx.Call(\"stroke\")\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4ff1211ba288c74132403e626e1a0efd", "score": "0.46696806", "text": "func (p Polygon) Type() string {\n\treturn \"Polygon\"\n}", "title": "" }, { "docid": "3826d1e507eea40683db4e74edd36142", "score": "0.46630108", "text": "func OfIntPoints(pt func(i int) (x, y int), len int) path {\n\treturn &intPath{pt, len}\n}", "title": "" }, { "docid": "60c6330cf84014cf5834f12bf51d9583", "score": "0.46604818", "text": "func geopolyXformFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:196015:13: */\n\tvar p uintptr = geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0))\n\tvar A float64 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))\n\tvar B float64 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))\n\tvar C float64 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)))\n\tvar D float64 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 4*8)))\n\tvar E float64 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 5*8)))\n\tvar F float64 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 6*8)))\n\tvar x1 GeoCoord\n\tvar y1 GeoCoord\n\tvar x0 GeoCoord\n\tvar y0 GeoCoord\n\tvar ii int32\n\tif p != 0 {\n\t\tfor ii = 0; ii < (*GeoPoly)(unsafe.Pointer(p)).FnVertex; ii++ {\n\t\t\tx0 = *(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((ii)*2))*4))\n\t\t\ty0 = *(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((ii)*2)+1))*4))\n\t\t\tx1 = (GeoCoord(((A * float64(x0)) + (B * float64(y0))) + E))\n\t\t\ty1 = (GeoCoord(((C * float64(x0)) + (D * float64(y0))) + F))\n\t\t\t(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((ii)*2))*4))) = x1\n\t\t\t(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((ii)*2)+1))*4))) = y1\n\t\t}\n\t\tXsqlite3_result_blob(tls, context, p+4, /* &.hdr */\n\t\t\t(4 + (8 * (*GeoPoly)(unsafe.Pointer(p)).FnVertex)), libc.UintptrFromInt32(-1))\n\t\tXsqlite3_free(tls, p)\n\t}\n}", "title": "" }, { "docid": "86d7d8bc9c4ca1b90ac83f2449befacd", "score": "0.4656179", "text": "func (t *tweaker) glPolygonOffset(factor, units GLfloat) {\n\torigFactor, origUnits := t.c.Rasterization.PolygonOffsetFactor, t.c.Rasterization.PolygonOffsetUnits\n\tt.doAndUndo(\n\t\tNewGlPolygonOffset(origFactor+factor, origUnits+units),\n\t\tNewGlPolygonOffset(origFactor, origUnits))\n}", "title": "" }, { "docid": "5039ec3ac65a8766ea9d4e3272394da6", "score": "0.46559227", "text": "func MakePolygon(outer *geo.Geometry, interior ...*geo.Geometry) (*geo.Geometry, error) {\n\tlayout := geom.XY\n\touterGeomT, err := outer.AsGeomT()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\touterRing, ok := outerGeomT.(*geom.LineString)\n\tif !ok {\n\t\treturn nil, errors.Newf(\"argument must be LINESTRING geometries\")\n\t}\n\tsrid := outerRing.SRID()\n\tcoords := make([][]geom.Coord, len(interior)+1)\n\tcoords[0] = outerRing.Coords()\n\tfor i, g := range interior {\n\t\tinteriorRingGeomT, err := g.AsGeomT()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tinteriorRing, ok := interiorRingGeomT.(*geom.LineString)\n\t\tif !ok {\n\t\t\treturn nil, errors.Newf(\"argument must be LINESTRING geometries\")\n\t\t}\n\t\tif interiorRing.SRID() != srid {\n\t\t\treturn nil, errors.Newf(\"mixed SRIDs are not allowed\")\n\t\t}\n\t\tcoords[i+1] = interiorRing.Coords()\n\t}\n\n\tpolygon, err := geom.NewPolygon(layout).SetSRID(srid).SetCoords(coords)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn geo.NewGeometryFromGeomT(polygon)\n}", "title": "" }, { "docid": "ee5f3d55e056ec92b662fb7c97b7f6ae", "score": "0.46496838", "text": "func AsPolygon(g geom.Geometry) geom.Polygon {\n\tp, ok := g.(geom.Polygon)\n\tif !ok {\n\t\tpanic(fmt.Sprintf(\"expected polygon, not %t\", g))\n\t}\n\treturn p\n}", "title": "" }, { "docid": "16aca961cfd624b052055a3a2652bea3", "score": "0.4648105", "text": "func drawField(field [][]Cell, filename string) {\n // WRITE YOUR CODE HERE\n rows := len(field)\n cols := len(field[0])\n //fmt.Println(\"rows: \" + string(rows))\n //fmt.Println(\"cols: \" + string(cols))\n pic := CreateNewCanvas(rows*5, cols*5)\n \tpic.SetLineWidth(1)\n for i := 0; i < rows; i++ {\n \tfor j := 0; j < cols; j++ {\n \t\tif field[i][j].kind == \"C\" {\n\t\t\tdrawSquare(pic, i, j, \"blue\") // if the cell is \"C\", draw blue sqaure\n\t\t} else {\n\t\t\tdrawSquare(pic, i, j, \"red\") // if the cell if \"D\", draw red sqaure\n\t\t}\n\n \t}\n\t}\n\tpic.SaveToPNG(filename)\n}", "title": "" }, { "docid": "9af8ee492f163f0ad5cb2a422f7ed4ba", "score": "0.46363258", "text": "func (p Polygon) Len() int {\n\treturn len(p)\n}", "title": "" }, { "docid": "0a84d14b734bbb83c4e6b6fd8ac914e8", "score": "0.46271136", "text": "func TestGetPolygons(t *testing.T) {\n}", "title": "" }, { "docid": "4cd9a92bf48437a68c5589db8267b7d2", "score": "0.46188405", "text": "func isPointInPolygon(polygon []float32, offset, count int, x, y float32) bool {\n\toddNodes := false\n\tj := offset + count - 2\n\ti := offset\n\tfor n := j; i <= n; i += 2 {\n\t\tyi := polygon[i+1]\n\t\tyj := polygon[j+1]\n\t\tif (yi < y && yj >= y) || (yj < y && yi >= y) {\n\t\t\txi := polygon[i]\n\t\t\tif xi+(y-yi)/(yj-yi)*(polygon[j]-xi) < x {\n\t\t\t\toddNodes = !oddNodes\n\t\t\t}\n\t\t}\n\t\tj = i\n\t}\n\treturn oddNodes\n}", "title": "" }, { "docid": "71bafea0559f7076dfb0dc31b421deb0", "score": "0.461691", "text": "func (o *Mesh) Draw(args *DrawArgs) {\n\n\t// auxiliary\n\ttype triple struct{ a, b, c int } // points on edge\n\tedgesdrawn := make(map[triple]bool) // edges drawn already\n\tvar tri triple\n\n\t// arguments\n\tif args == nil {\n\t\targs = NewArgs()\n\t}\n\n\t// loop over cells\n\tfor _, cell := range o.Cells {\n\n\t\t// skip disabled cells\n\t\tif cell.Disabled {\n\t\t\tcontinue\n\t\t}\n\n\t\t// lin cell\n\t\tlincell := TypeIndexToKind[cell.TypeIndex] == KindLin\n\t\tif !lincell && args.OnlyLins {\n\t\t\tcontinue\n\t\t}\n\n\t\t// draw cells\n\t\tif args.WithCells {\n\t\t\tct := cell.TypeIndex\n\t\t\tnEdges := len(EdgeLocalVertsD[ct])\n\t\t\tnvEdge := len(EdgeLocalVertsD[ct][0]) // number of vertices along edge of cell\n\t\t\tnvEtot := nvEdge*nEdges - nEdges // total number of vertices along all edges\n\t\t\taa := getargs(cell.ID, args.ArgsCells)\n\t\t\tif cell.Gndim > 2 {\n\t\t\t\t// TODO\n\t\t\t} else {\n\t\t\t\tk := 0\n\t\t\t\txx := make([][]float64, nvEtot)\n\t\t\t\tfor _, lvids := range EdgeLocalVertsD[ct] { // loop over edges\n\t\t\t\t\tfor ivert := 0; ivert < len(lvids)-1; ivert++ { // loop over verts on edge\n\t\t\t\t\t\tlv := lvids[ivert]\n\t\t\t\t\t\txx[k] = o.Verts[cell.V[lv]].X\n\t\t\t\t\t\tk++\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tplt.Polyline(xx, aa)\n\t\t\t}\n\t\t}\n\n\t\t// draw edges\n\t\tif args.WithEdges || args.WithIdsEdges || args.WithTagsEdges {\n\t\t\tfor iedge, lvids := range EdgeLocalVertsD[cell.TypeIndex] {\n\n\t\t\t\t// set triple of vertices\n\t\t\t\ttri.a = cell.V[lvids[0]]\n\t\t\t\ttri.b = cell.V[lvids[1]]\n\t\t\t\tnv := len(lvids)\n\t\t\t\tif nv > 2 {\n\t\t\t\t\ttri.c = cell.V[lvids[2]]\n\t\t\t\t} else {\n\t\t\t\t\ttri.c = len(o.Verts) // indicator of not-available\n\t\t\t\t}\n\t\t\t\tutl.IntSort3(&tri.a, &tri.b, &tri.c)\n\n\t\t\t\t// draw edge if not drawn yet\n\t\t\t\tif _, drawn := edgesdrawn[tri]; !drawn {\n\t\t\t\t\tx := make([]float64, nv)\n\t\t\t\t\ty := make([]float64, nv)\n\t\t\t\t\tvar z []float64\n\t\t\t\t\tndim := len(o.Verts[tri.a].X)\n\t\t\t\t\tif ndim > 2 {\n\t\t\t\t\t\tz = make([]float64, nv)\n\t\t\t\t\t}\n\t\t\t\t\tfor i, lv := range lvids {\n\t\t\t\t\t\tv := o.Verts[cell.V[lv]]\n\t\t\t\t\t\tx[i], y[i] = v.X[0], v.X[1]\n\t\t\t\t\t\tif ndim > 2 {\n\t\t\t\t\t\t\tz[i] = v.X[2]\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ndim > 2 {\n\t\t\t\t\t\tif args.WithEdges {\n\t\t\t\t\t\t\tplt.Plot3dLine(x, y, z, args.ArgsEdges)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif args.WithTagsEdges && len(cell.EdgeTags) > 0 {\n\t\t\t\t\t\t\ttag := cell.EdgeTags[iedge]\n\t\t\t\t\t\t\tif tag != 0 {\n\t\t\t\t\t\t\t\ttxt := io.Sf(\"%d\", tag)\n\t\t\t\t\t\t\t\txc, yc, zc := 0.0, 0.0, 0.0\n\t\t\t\t\t\t\t\tfor i := 0; i < len(x); i++ {\n\t\t\t\t\t\t\t\t\txc += x[i]\n\t\t\t\t\t\t\t\t\tyc += y[i]\n\t\t\t\t\t\t\t\t\tzc += z[i]\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\txc /= float64(len(x))\n\t\t\t\t\t\t\t\tyc /= float64(len(x))\n\t\t\t\t\t\t\t\tzc /= float64(len(x))\n\t\t\t\t\t\t\t\tplt.Text3d(xc, yc, zc, txt, args.ArgsTagsEdges)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif args.WithEdges {\n\t\t\t\t\t\t\tplt.Plot(x, y, args.ArgsEdges)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif args.WithTagsEdges && len(cell.EdgeTags) > 0 {\n\t\t\t\t\t\t\ttag := cell.EdgeTags[iedge]\n\t\t\t\t\t\t\tif tag != 0 {\n\t\t\t\t\t\t\t\ttxt := io.Sf(\"%d\", tag)\n\t\t\t\t\t\t\t\txc, yc := 0.0, 0.0\n\t\t\t\t\t\t\t\tfor i := 0; i < len(x); i++ {\n\t\t\t\t\t\t\t\t\txc += x[i]\n\t\t\t\t\t\t\t\t\tyc += y[i]\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\txc /= float64(len(x))\n\t\t\t\t\t\t\t\tyc /= float64(len(x))\n\t\t\t\t\t\t\t\tplt.Text(xc, yc, txt, args.ArgsTagsEdges)\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\tedgesdrawn[tri] = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// add middle node\n\t\tif args.WithVerts {\n\t\t\tif cell.TypeKey == \"qua9\" {\n\t\t\t\tvid := cell.V[8]\n\t\t\t\tx := o.Verts[vid].X[0]\n\t\t\t\ty := o.Verts[vid].X[1]\n\t\t\t\tplt.PlotOne(x, y, args.ArgsVerts)\n\t\t\t}\n\t\t}\n\n\t\t// linear cells\n\t\tif lincell {\n\n\t\t\t// collect vertices\n\t\t\tnv := len(cell.V)\n\t\t\tx := make([]float64, nv)\n\t\t\ty := make([]float64, nv)\n\t\t\tfor i, vid := range cell.V {\n\t\t\t\tx[i] = o.Verts[vid].X[0]\n\t\t\t\ty[i] = o.Verts[vid].X[1]\n\t\t\t}\n\t\t\taa := getargs(cell.ID, args.ArgsLins)\n\t\t\tplt.Plot(x, y, aa)\n\t\t}\n\n\t\t// cell ids\n\t\tif args.WithIdsCells {\n\t\t\txc := make([]float64, cell.Gndim)\n\t\t\tfor i := 0; i < cell.X.M; i++ {\n\t\t\t\tfor j := 0; j < cell.Gndim; j++ {\n\t\t\t\t\txc[j] += cell.X.Get(i, j)\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor i := 0; i < cell.Gndim; i++ {\n\t\t\t\txc[i] /= float64(cell.X.M)\n\t\t\t}\n\t\t\ttxt := io.Sf(\"%d\", cell.ID)\n\t\t\tif o.Ndim > 2 {\n\t\t\t\tz := 0.0\n\t\t\t\tif cell.Gndim > 2 {\n\t\t\t\t\tz = xc[2]\n\t\t\t\t}\n\t\t\t\tplt.Text3d(xc[0], xc[1], z, txt, args.ArgsIdsCells)\n\t\t\t} else {\n\t\t\t\tplt.Text(xc[0], xc[1], txt, args.ArgsIdsCells)\n\t\t\t}\n\t\t}\n\t}\n\n\t// loop over vertices\n\tvar xv, yv, zv []float64\n\tif args.WithVerts || args.WithIdsVerts || args.WithTagsVerts {\n\t\txv = make([]float64, len(o.Verts))\n\t\tyv = make([]float64, len(o.Verts))\n\t\tif o.Ndim > 2 {\n\t\t\tzv = make([]float64, len(o.Verts))\n\t\t}\n\t\tfor i, v := range o.Verts {\n\t\t\txv[i], yv[i] = v.X[0], v.X[1]\n\t\t\tif len(v.X) > 2 {\n\t\t\t\tzv[i] = v.X[2]\n\t\t\t}\n\t\t\tif args.WithIdsVerts {\n\t\t\t\ttxt := io.Sf(\"%d\", v.ID)\n\t\t\t\tif o.Ndim > 2 {\n\t\t\t\t\tplt.Text3d(xv[i], yv[i], zv[i], txt, args.ArgsIdsVerts)\n\t\t\t\t} else {\n\t\t\t\t\tplt.Text(xv[i], yv[i], txt, args.ArgsIdsVerts)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif args.WithTagsVerts && v.Tag != 0 {\n\t\t\t\ttxt := io.Sf(\"%d\", v.Tag)\n\t\t\t\tif o.Ndim > 2 {\n\t\t\t\t\tplt.Text3d(xv[i], yv[i], zv[i], txt, args.ArgsTagsVerts)\n\t\t\t\t} else {\n\t\t\t\t\tplt.Text(xv[i], yv[i], txt, args.ArgsTagsVerts)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// draw vertices\n\tif args.WithVerts {\n\t\tif o.Ndim > 2 {\n\t\t\tplt.Plot3dPoints(xv, yv, zv, args.ArgsVerts)\n\t\t} else {\n\t\t\tplt.Plot(xv, yv, args.ArgsVerts)\n\t\t}\n\t}\n\n\t// set figure\n\tif o.Ndim > 2 {\n\t\tplt.Default3dView(o.Xmin[0], o.Xmax[0], o.Xmin[1], o.Xmax[1], o.Xmin[2], o.Xmax[2], true)\n\t} else {\n\t\tplt.Equal()\n\t\tplt.AxisRange(o.Xmin[0], o.Xmax[0], o.Xmin[1], o.Xmax[1])\n\t}\n}", "title": "" } ]
aab04e9f7c6812768d141901dfc84a45
Deprecated: Use P4HeaderStackTypeSpec.ProtoReflect.Descriptor instead.
[ { "docid": "790352528b88675da6157e64a1917ead", "score": "0.71247137", "text": "func (*P4HeaderStackTypeSpec) Descriptor() ([]byte, []int) {\n\treturn file_p4_config_v1_p4types_proto_rawDescGZIP(), []int{13}\n}", "title": "" } ]
[ { "docid": "5a35adabc2fd797b6c090fce2f965a9e", "score": "0.67659783", "text": "func (*P4HeaderUnionStackTypeSpec) Descriptor() ([]byte, []int) {\n\treturn file_p4_config_v1_p4types_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "21e0bb1621f0146605e8848ae6d99dab", "score": "0.6760997", "text": "func (*ProtocolSignatureProto) Descriptor() ([]byte, []int) {\n\treturn file_ProtocolInfo_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "868f771e5f77b231de12d4a26b2debd8", "score": "0.66396105", "text": "func (*GetProtocolSignatureRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_ProtocolInfo_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "898ac189e415f61a9391db0dc973003a", "score": "0.6611731", "text": "func (*GetProtocolSignatureResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ProtocolInfo_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "2d80d16f9a50e76db8d36e9f3ee93bb6", "score": "0.6590432", "text": "func (*TokenProto) Descriptor() ([]byte, []int) {\n\treturn file_preprocess_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "db9b1e100f02f83c21e0ada826950403", "score": "0.65887237", "text": "func (*StackChange) Descriptor() ([]byte, []int) {\n\treturn file_l2_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "2b99fa374c45d14d4744bd9bc425ace5", "score": "0.6561064", "text": "func (*Stack) Descriptor() ([]byte, []int) {\n\treturn file_l2_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "6b321031b5da6f58db1a3c892a5518a6", "score": "0.6516644", "text": "func (*Trace) Descriptor() ([]byte, []int) {\n\treturn file_quic_trace_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "16440c01705f2f58a8a661ce563c10c3", "score": "0.6513416", "text": "func (*P4NewTypeTranslation) Descriptor() ([]byte, []int) {\n\treturn file_p4_config_v1_p4types_proto_rawDescGZIP(), []int{24}\n}", "title": "" }, { "docid": "92d2a11771696b691d7a6174818f76ad", "score": "0.6505254", "text": "func (desc *immutable) DescriptorProto() *descpb.Descriptor {\n\treturn &descpb.Descriptor{\n\t\tUnion: &descpb.Descriptor_Type{\n\t\t\tType: &desc.TypeDescriptor,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "dccade663b1f3a398fbb7f835d8d6710", "score": "0.649796", "text": "func (*StackFrame) Descriptor() ([]byte, []int) {\n\treturn file_Shared_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "5fe9cb392178828d1347d5bc8e50eb73", "score": "0.6474676", "text": "func (*StackRequest) Descriptor() ([]byte, []int) {\n\treturn file_l2_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "3d1fede4a22c0ddc47c5ea1425ab904b", "score": "0.64668775", "text": "func (*Stack) Descriptor() ([]byte, []int) {\n\treturn file_cli_server_protos_compose_v1_compose_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "690433d323720536069629d895aca163", "score": "0.6439556", "text": "func (*TraceRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_debug_debug_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "1cc45f1c60dc5bd6b3598af3b1ac508b", "score": "0.643937", "text": "func (*P4HeaderTypeSpec) Descriptor() ([]byte, []int) {\n\treturn file_p4_config_v1_p4types_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "059d90cc90c5978386e9e190c2636e92", "score": "0.6431509", "text": "func (*Details) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_provenance_api_spikepb_ids_inspect_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "a14766fe251150d8600e50cc6b27166b", "score": "0.64271694", "text": "func (*Type) Descriptor() ([]byte, []int) {\n\treturn file_go_pkg_beam_core_runtime_graphx_v1_v1_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "d858d75f9530964470ea927cb287ea42", "score": "0.64248246", "text": "func (*StreamTracesMessage) Descriptor() ([]byte, []int) {\n\treturn file_envoy_service_trace_v2_trace_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "dd440b8d86dbd6bebe8eb008acefd3d8", "score": "0.64201635", "text": "func (*DeprecatedMessage) Descriptor() ([]byte, []int) {\n\treturn file_cmd_protoc_gen_go_testdata_comments_deprecated_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "d7f130ca6d8ef3610b03ccbe174d8efa", "score": "0.6415788", "text": "func (*Payload) Descriptor() ([]byte, []int) {\n\treturn file_trisa_api_v1beta1_api_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "533778d4cb97a10227141d458d7785d9", "score": "0.64112294", "text": "func (*Frame) Descriptor() ([]byte, []int) {\n\treturn file_quic_trace_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "4ee2a9fa76845f09ac51e5c82f042f8c", "score": "0.64032954", "text": "func (*TraceRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_debug_debug_api_debug_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "0a3b50eeb6988eda97d7b807d39aba5b", "score": "0.6382763", "text": "func (*GetProtocolVersionsResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ProtocolInfo_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "ecb1d0d3fd37c0afba67886469ee1f69", "score": "0.6355337", "text": "func (*P4NewTypeSpec) Descriptor() ([]byte, []int) {\n\treturn file_p4_config_v1_p4types_proto_rawDescGZIP(), []int{25}\n}", "title": "" }, { "docid": "669eb8635f9446af7f22304381808363", "score": "0.63547474", "text": "func (*Trickle) Descriptor() ([]byte, []int) {\n\treturn file_proto_rtc_rtc_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "8e9f73da191aa4d0b0f3e99a472da498", "score": "0.6352478", "text": "func (*Message7287) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "916e09af4f8cf3cf8d4b6d435b3023e8", "score": "0.63382447", "text": "func (*KindExpression) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_storage_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "aa14c612a8f559342442fb2591fd5a23", "score": "0.63268", "text": "func (*StackTraceElementWrapper) Descriptor() ([]byte, []int) {\n\treturn file_UserBitShared_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "f8ff3de7befeeabdf229fda0bb9b46a6", "score": "0.6324542", "text": "func (*P4NamedType) Descriptor() ([]byte, []int) {\n\treturn file_p4_config_v1_p4types_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "b9c32fa53b358a7e724e5838da866267", "score": "0.6318402", "text": "func (*FlowControlInfo) Descriptor() ([]byte, []int) {\n\treturn file_quic_trace_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "eb2b930d5c38b03b05e22c26e212b53a", "score": "0.6314358", "text": "func (*CTraceMsg_CardMovedToSpellStack) Descriptor() ([]byte, []int) {\n\treturn file_artifact_dcg_gamemessages_proto_rawDescGZIP(), []int{45}\n}", "title": "" }, { "docid": "a9877a8748818a2d696a292bb189f052", "score": "0.6312468", "text": "func (*Stack) Descriptor() ([]byte, []int) {\n\treturn file_Shared_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "44d3f13c848fc238c5b87b02744a8dfe", "score": "0.6296638", "text": "func (*TypeRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_ClientService_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "cb920097c80bc42f24290e7076cd5f77", "score": "0.62804496", "text": "func (*Message8590) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "417be51712d9ccb2a429fa1c244c055a", "score": "0.62717557", "text": "func (*TypedObjectRef) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_skv2_api_core_v1_core_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "afd26a126cd3d75885353cde0718d093", "score": "0.6263438", "text": "func (*NetProtocolInfos) Descriptor() ([]byte, []int) {\n\treturn file_p2pnext_proto_rawDescGZIP(), []int{43}\n}", "title": "" }, { "docid": "6c16b7a7fe578fb0e1740dee90d812e7", "score": "0.62622136", "text": "func (*P2PMessageHeaders) Descriptor() ([]byte, []int) {\n\treturn file_p2pnext_proto_rawDescGZIP(), []int{24}\n}", "title": "" }, { "docid": "206dd6ac509534f682d4c3e23d6010eb", "score": "0.6261633", "text": "func (*GetTeamRequest) Descriptor() ([]byte, []int) {\n\treturn file_transport_grpc_proto_soccer_soccer_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "4c4eba3d053157add2c204e405d0434f", "score": "0.6261431", "text": "func (*StreamFrameInfo) Descriptor() ([]byte, []int) {\n\treturn file_quic_trace_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "d03fffe7d3d6a26122105b16db7cf633", "score": "0.62574536", "text": "func (*Message7864) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{31}\n}", "title": "" }, { "docid": "f00d1e1f7f53ce48949705afec6a0306", "score": "0.62572324", "text": "func (*MessageHeaderReq) Descriptor() ([]byte, []int) {\n\treturn file_p2pnext_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "7fc13a56f6af59d8fa099e1b25468260", "score": "0.6256526", "text": "func (*PushRequest) Descriptor() ([]byte, []int) {\n\treturn file_pyserver_pyserver_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "11c0cfceb8f96997fddfcc315e13f95a", "score": "0.6250417", "text": "func (*NetworkProxy) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_provenance_api_spikepb_ids_inspect_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "653505940a9b5863fb3d77918497bfdd", "score": "0.62477565", "text": "func (*GetProtocolVersionsRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_ProtocolInfo_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "2be79d7e72935f9f69ce12b1842a2e45", "score": "0.6246498", "text": "func (*ProtocolVersionProto) Descriptor() ([]byte, []int) {\n\treturn file_ProtocolInfo_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "f2815080b86160198322110f9fd780d5", "score": "0.6246036", "text": "func (*Message8575) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{34}\n}", "title": "" }, { "docid": "0330b42583da613b9f98878c15a3465f", "score": "0.62428814", "text": "func (*Security_Tls) Descriptor() ([]byte, []int) {\n\treturn file_grpc_channelz_v1_channelz_proto_rawDescGZIP(), []int{15, 0}\n}", "title": "" }, { "docid": "3caf65a6dee84b066afe84cc3de79045", "score": "0.6242355", "text": "func (*ProtocolInfo) Descriptor() ([]byte, []int) {\n\treturn file_p2pnext_proto_rawDescGZIP(), []int{44}\n}", "title": "" }, { "docid": "9d7fffa7fdd7ad0c3a53e09a19a955a8", "score": "0.62375414", "text": "func (*Message8572) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "53fae32c7dd58160c9872ca180afc9d2", "score": "0.623206", "text": "func (*Locality) Descriptor() ([]byte, []int) {\n\treturn file_envoy_api_v2_core_base_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "2912854593ec697223b6a7a82264167f", "score": "0.62281585", "text": "func (*PayType) Descriptor() ([]byte, []int) {\n\treturn file_pay_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "ad699db92ebac0bc0fbb1bcea72e2624", "score": "0.62278193", "text": "func (*Token) Descriptor() ([]byte, []int) {\n\treturn file_harmonytypes_v1_types_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "dfa0f18feb70d9c41fbb3ca7ffcab3ec", "score": "0.6224846", "text": "func (*P4StructTypeSpec) Descriptor() ([]byte, []int) {\n\treturn file_p4_config_v1_p4types_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "fbca336e46cb37ec19f8304f809dc266", "score": "0.62213814", "text": "func (*DelRsp) Descriptor() ([]byte, []int) {\n\treturn file_test_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "bfa9483afe5565f679587700f849c751", "score": "0.6218104", "text": "func (*Message8587) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "981ef13d457171f3ac6b9545a7ab2ed7", "score": "0.62172365", "text": "func (*RuntimeUInt32) Descriptor() ([]byte, []int) {\n\treturn file_envoy_api_v2_core_base_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "fae60da952a10a13c8287469614c19da", "score": "0.62164074", "text": "func (*Metadata) Descriptor() ([]byte, []int) {\n\treturn file_envoy_api_v2_core_base_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "873730a0c533555d808494b1a6a8eec9", "score": "0.62152517", "text": "func (*Message8774) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "4198fa4c394174456b3d1f4452d9eeec", "score": "0.62127936", "text": "func (*Message12685) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "fc3be3285dca5e8d166a69a2c876691b", "score": "0.6212688", "text": "func (*Message7843) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{35}\n}", "title": "" }, { "docid": "429e2a4ba033af154d1579fa035b2cc9", "score": "0.62065595", "text": "func (*Span) Descriptor() ([]byte, []int) {\n\treturn file_proto_debug_debug_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "e47032a502501aa506de05e36dcc88c3", "score": "0.6206126", "text": "func (*MessageNetInfo) Descriptor() ([]byte, []int) {\n\treturn file_p2pnext_proto_rawDescGZIP(), []int{21}\n}", "title": "" }, { "docid": "b516ec9ccf2064e4cd28e254c78e73c3", "score": "0.62043846", "text": "func (*InjectPayload) Descriptor() ([]byte, []int) {\n\treturn file_go_pkg_beam_core_runtime_graphx_v1_v1_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "cb58403e22b1f3af43e34530318a2183", "score": "0.62017757", "text": "func (*VersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_debug_debug_api_debug_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "6b191fb15b30d5bef1a0951138f144b2", "score": "0.61996424", "text": "func (*TraceResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_debug_debug_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "29241432bbe6bd643e8ce721adbcca61", "score": "0.61994064", "text": "func (*StackStatusResponse) Descriptor() ([]byte, []int) {\n\treturn file_l2_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "1bf2caa9fccd55733852a82db220c960", "score": "0.6198033", "text": "func (*Security) Descriptor() ([]byte, []int) {\n\treturn file_grpc_channelz_v1_channelz_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "6fb0c6d3bb7ae76de194adeab2ded8a0", "score": "0.6194357", "text": "func (*Message7929) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{37}\n}", "title": "" }, { "docid": "1080c35c9213141f1b91359648e98fdf", "score": "0.6193111", "text": "func (*Message12797) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "7fcf2db78bcb691838556e1318059486", "score": "0.6189967", "text": "func (*TransportSocket) Descriptor() ([]byte, []int) {\n\treturn file_envoy_api_v2_core_base_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "700ce06312e17d1cf853588625be37a5", "score": "0.61894476", "text": "func (*MessageExternalNetReq) Descriptor() ([]byte, []int) {\n\treturn file_p2pnext_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "414c350ef787516c2c7bec21f4cc0d69", "score": "0.61869276", "text": "func (*P4HeaderTypeSpec_Member) Descriptor() ([]byte, []int) {\n\treturn file_p4_config_v1_p4types_proto_rawDescGZIP(), []int{11, 0}\n}", "title": "" }, { "docid": "a11fc8227acb82f65dcfe26b928c164e", "score": "0.61865294", "text": "func (*MessagePayloadRequest) Descriptor() ([]byte, []int) {\n\treturn file_puppet_message_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "bdff8cf2560081e242b277e9658f6e6f", "score": "0.61818236", "text": "func (*Token) Descriptor() ([]byte, []int) {\n\treturn file_proto_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "5af5e89b816c526497d562dcd5b76ecd", "score": "0.6181209", "text": "func (*MessageVersion) Descriptor() ([]byte, []int) {\n\treturn file_p2pnext_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "8055b133e64c32ed7217aba41bd3d61b", "score": "0.6180677", "text": "func (*StreamTracesMessage_Identifier) Descriptor() ([]byte, []int) {\n\treturn file_envoy_service_trace_v2_trace_service_proto_rawDescGZIP(), []int{1, 0}\n}", "title": "" }, { "docid": "88022e971aa7d2a6b02754cbc07253f5", "score": "0.61797196", "text": "func (*TypeMeta) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_gkehub_v1_service_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "4c80b2e82dce0536e36cb78ec9b8bb51", "score": "0.617606", "text": "func (*LocalRsp) Descriptor() ([]byte, []int) {\n\treturn file_test_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "d302bc6e3e5d10fc38eae0d6f80e8eea", "score": "0.6173768", "text": "func (*PushMsg) Descriptor() ([]byte, []int) {\n\treturn file_api_logic_grpc_api_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "fdb297920f6d32c676ce0212ce606cc3", "score": "0.61725265", "text": "func (*Wrapper) Descriptor() ([]byte, []int) {\n\treturn file_tests_enum_enum_renames_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "90f5b1370ddeabd0089156188df28038", "score": "0.6169892", "text": "func (*CryptoFrameInfo) Descriptor() ([]byte, []int) {\n\treturn file_quic_trace_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "a66eff145490877c405710d7c8a6a4ee", "score": "0.61682445", "text": "func (*Message11975) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "16ae9b782e721da615793c7c2aa0fdc7", "score": "0.6163131", "text": "func (*Message3886_Message3887) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{30, 0}\n}", "title": "" }, { "docid": "8e0040537ca61fd8c4e1e230aa1f33a3", "score": "0.6160546", "text": "func (*SetLogLevelRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_debug_debug_api_debug_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "50a60a6e6d9e2fd2def386f3c9047ecc", "score": "0.6158402", "text": "func (*Opaque) Descriptor() ([]byte, []int) {\n\treturn file_cs3_types_v1beta1_types_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "a8a6ae84d5bb1c2c26c8cd2427236796", "score": "0.6157103", "text": "func (*StackResponse) Descriptor() ([]byte, []int) {\n\treturn file_l2_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "3d59eb35277bcb42bc94e8f2c3a17636", "score": "0.6154911", "text": "func (*Foo) Descriptor() ([]byte, []int) {\n\treturn file_rpctest_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "5181049a80e0d0c816fc5f2815763eae", "score": "0.6154639", "text": "func (*Trust) Descriptor() ([]byte, []int) {\n\treturn file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "f384ea318669d2eb9d8cfce72ecfc653", "score": "0.61512285", "text": "func (*Message12798) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "a89c82476a6ca08265a1822353999c3b", "score": "0.6149415", "text": "func (*Message3922) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{32}\n}", "title": "" }, { "docid": "b8a3b685e01fef717ccdbf5e053a6d53", "score": "0.61493313", "text": "func (PushMsg_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_api_logic_grpc_api_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "343a9fd6044255f1f9575ed53e643c68", "score": "0.6149313", "text": "func (*MessageUtil) Descriptor() ([]byte, []int) {\n\treturn file_p2pnext_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "92d3f74ff59055d63c393e4421bd07ff", "score": "0.61470747", "text": "func (*ChannelTrace) Descriptor() ([]byte, []int) {\n\treturn file_grpc_channelz_v1_channelz_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "bc60487ab7131a6aa0cf22ca09b9cdad", "score": "0.6144401", "text": "func (*ControlPlane) Descriptor() ([]byte, []int) {\n\treturn file_envoy_api_v2_core_base_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "a2b22c569390d54ec7eb333f28af06e3", "score": "0.6140509", "text": "func (*TypeDefine) Descriptor() ([]byte, []int) {\n\treturn file_meta_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "329c58bfb456850848e92ccb5e1a41fc", "score": "0.61388415", "text": "func (*Headers) Descriptor() ([]byte, []int) {\n\treturn file_networking_v1alpha3_virtual_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "bb0588909b55ebb3a6e06c594b83e3e2", "score": "0.61344945", "text": "func (*TransportState) Descriptor() ([]byte, []int) {\n\treturn file_quic_trace_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "0811d05d9af3482ae7cdae5bd2efacbf", "score": "0.61342776", "text": "func (*Metadata) Descriptor() ([]byte, []int) {\n\treturn file_harmonytypes_v1_types_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "0c4b6f216c934ad97fef167cdd0d9623", "score": "0.6133628", "text": "func (*Metadata) Descriptor() ([]byte, []int) {\n\treturn file_proto_messages_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "e10eec492d2e8fffa81e7dd4515b50b7", "score": "0.61329097", "text": "func (*Message12825) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_1_proto_rawDescGZIP(), []int{12}\n}", "title": "" } ]
5b1f32699703a214f92cfa9d0f0ced7e
NewMintRequest converts the parameters and returns a struct with needed parameter for minting
[ { "docid": "2a141bc0beff927ae560271326b57f41", "score": "0.7216326", "text": "func NewMintRequest(to common.Address, anchorID anchors.AnchorID, proofs []*proofspb.Proof, rootHash [32]byte) (*MintRequest, error) {\n\n\t// tokenID is uint256 in Solidity (256 bits | max value is 2^256-1)\n\t// tokenID should be random 32 bytes (32 byte = 256 bits)\n\ttokenID := utils.ByteSliceToBigInt(utils.RandomSlice(32))\n\ttokenURI := \"http:=//www.centrifuge.io/DUMMY_URI_SERVICE\"\n\tproofData, err := createProofData(proofs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &MintRequest{\n\t\tTo: to,\n\t\tTokenID: tokenID,\n\t\tTokenURI: tokenURI,\n\t\tAnchorID: anchorID.BigInt(),\n\t\tMerkleRoot: rootHash,\n\t\tValues: proofData.Values,\n\t\tSalts: proofData.Salts,\n\t\tProofs: proofData.Proofs}, nil\n}", "title": "" } ]
[ { "docid": "fbb90de6039e3ddd6a525181bc3d59b6", "score": "0.7079535", "text": "func NewMintRequest(to common.Address, anchorID anchors.AnchorID, proofs []*proofspb.Proof, rootHash [32]byte) (*MintRequest, error) {\n\ttokenID := utils.ByteSliceToBigInt(utils.RandomSlice(256))\n\ttokenURI := \"http:=//www.centrifuge.io/DUMMY_URI_SERVICE\"\n\tproofData, err := createProofData(proofs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &MintRequest{\n\t\tTo: to,\n\t\tTokenID: tokenID,\n\t\tTokenURI: tokenURI,\n\t\tAnchorID: anchorID.BigInt(),\n\t\tMerkleRoot: rootHash,\n\t\tValues: proofData.Values,\n\t\tSalts: proofData.Salts,\n\t\tProofs: proofData.Proofs}, nil\n}", "title": "" }, { "docid": "0c3a19ab9d7b02fb349ddf4e9d968d3e", "score": "0.60681427", "text": "func NewMsgMintRequest(receiver string, signer string, amount sdk.Coin) *MsgMintRequest {\n\treturn &MsgMintRequest{\n\t\tReceiver: receiver,\n\t\tSigner: signer,\n\t\tAmount: amount,\n\t}\n}", "title": "" }, { "docid": "38c6659a545ef17d6c4a1a6d75fdb6b4", "score": "0.5794", "text": "func (c *InputService12ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "ec93955ef76d39467ff4d2ddd2d2deaa", "score": "0.578936", "text": "func (_MintableToken *MintableTokenTransactor) Mint(opts *bind.TransactOpts, arg0 common.Address, arg1 *big.Int) (*types.Transaction, error) {\n\treturn _MintableToken.contract.Transact(opts, \"mint\", arg0, arg1)\n}", "title": "" }, { "docid": "c5513277c17ef10e4b9c3e423fdf3202", "score": "0.57836974", "text": "func newRequest(seq int, command string) *Request {\n\treturn &Request{\n\t\tProtocolMessage: ProtocolMessage{\n\t\t\tType: \"request\",\n\t\t\tSeq: seq,\n\t\t},\n\t\tCommand: command,\n\t}\n}", "title": "" }, { "docid": "b1c3540dec7e8ffdefc26dcce6587d4a", "score": "0.57670337", "text": "func (c *InputService22ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "27087697d82b91d40dca5f981237c7f9", "score": "0.5738471", "text": "func (c *InputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "41166de2f4848fc23640120f6d85e0c8", "score": "0.573451", "text": "func (c *InputService11ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "9488258aa53b4d53551d474f589e923b", "score": "0.5704148", "text": "func (s *PingfederateService) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := s.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "fb1a6cf310525a9574f12c458b07e196", "score": "0.5696014", "text": "func (c *InputService12ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "80759d75034e241a61ab831729b9b664", "score": "0.5689632", "text": "func (c *OpsWorksCM) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\t// Run custom request initialization if present\n\tif initRequest != nil {\n\t\tinitRequest(req)\n\t}\n\n\treturn req\n}", "title": "" }, { "docid": "66a7ec5ecbc66ff1f2c17dca7e624bc7", "score": "0.5684996", "text": "func (c *InputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "7ee7e2f481db00b218818be5ec9c93c8", "score": "0.5674951", "text": "func (_NFToken *NFTokenTransactor) Mint(opts *bind.TransactOpts, _to common.Address, _tokenId *big.Int, _uri string) (*types.Transaction, error) {\n\treturn _NFToken.contract.Transact(opts, \"mint\", _to, _tokenId, _uri)\n}", "title": "" }, { "docid": "200927996b123025f369229416a3b685", "score": "0.56711024", "text": "func (c *InputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "bd4666b64a376b3f67d20223490cae2b", "score": "0.5668633", "text": "func (c *InputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "b286ab4b97baddcb2cca6b31fa84196d", "score": "0.56531614", "text": "func newRequest(id uint64, data []byte, msgType byte) *request {\n\treturn &request{\n\t\tmsgType: msgType,\n\t\tid: id,\n\t\tdata: data,\n\t}\n}", "title": "" }, { "docid": "f7fb6a3a7db52341d6c154d468976522", "score": "0.56262493", "text": "func (_MintableToken *MintableTokenTransactor) Mint(opts *bind.TransactOpts, _to common.Address, _amount *big.Int) (*types.Transaction, error) {\r\n\treturn _MintableToken.contract.Transact(opts, \"mint\", _to, _amount)\r\n}", "title": "" }, { "docid": "bc65467a731d0520f18586b51c9eaa86", "score": "0.56213224", "text": "func (c *InputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "8f4feb20911ffd4c5467a44dfaffbc58", "score": "0.5618069", "text": "func NewRequest(int1 uint64, int2 uint64, limit uint64, str1 string, str2 string) Request {\n\treturn Request{\n\t\tInt1: int1,\n\t\tInt2: int2,\n\t\tLimit: limit,\n\t\tStr1: str1,\n\t\tStr2: str2,\n\t}\n}", "title": "" }, { "docid": "d02005bd0e7ce95b273258c4580cc11b", "score": "0.56153023", "text": "func (c *InputService23ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "e6ea0d6b927fa429cb9c41611d2399d1", "score": "0.5613541", "text": "func (s *OauthKeyManagementService) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := s.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "6ab495f555e4413d1de61d6afa95d26c", "score": "0.5610585", "text": "func (_SkaleToken *SkaleTokenTransactor) Mint(opts *bind.TransactOpts, account common.Address, amount *big.Int, userData []byte, operatorData []byte) (*types.Transaction, error) {\n\treturn _SkaleToken.contract.Transact(opts, \"mint\", account, amount, userData, operatorData)\n}", "title": "" }, { "docid": "287021e1c30c06b4497ba130c5b7b1d3", "score": "0.55982584", "text": "func (c *InputService11ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "bc5d2450944282fe3b6140e2f865e3a3", "score": "0.5589798", "text": "func newRequestVoteRequest(term uint64, candidateName string, lastLogIndex uint64, lastLogTerm uint64) *RequestVoteRequest {\n\treturn &RequestVoteRequest{\n\t\tTerm: term,\n\t\tLastLogIndex: lastLogIndex,\n\t\tLastLogTerm: lastLogTerm,\n\t\tCandidateName: candidateName,\n\t}\n}", "title": "" }, { "docid": "7caa8a043ed660738e288fcf918796a4", "score": "0.55754584", "text": "func (c *STS) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\t// Run custom request initialization if present\n\tif initRequest != nil {\n\t\tinitRequest(req)\n\t}\n\n\treturn req\n}", "title": "" }, { "docid": "ab2bae617f5c1ac7dd917ff40888ff9e", "score": "0.5574775", "text": "func (s *VersionService) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := s.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "af1e372f431d0bc9b2198648fc1c94cd", "score": "0.5571616", "text": "func (c *InputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "e56dea95c3506a4aeab8f812255d97a1", "score": "0.5567937", "text": "func (c *InputService17ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "880f694535f967ca3b225f11448ba262", "score": "0.55672765", "text": "func (repo repository) CreateRequest(reqModel *CLAManagerRequest) (*CLAManagerRequest, error) {\n\tf := logrus.Fields{\n\t\t\"functionName\": \"CreateRequest\",\n\t\t\"projectName\": reqModel.ProjectName,\n\t\t\"projectID\": reqModel.ProjectID,\n\t\t\"projectExternalID\": reqModel.ProjectExternalID,\n\t\t\"companyName\": reqModel.CompanyName,\n\t\t\"companyID\": reqModel.CompanyID,\n\t\t\"companyExternalID\": reqModel.CompanyExternalID,\n\t\t\"userID\": reqModel.UserID,\n\t\t\"userName\": reqModel.UserName,\n\t\t\"userEmail\": reqModel.UserEmail,\n\t\t\"userExternalID\": reqModel.UserExternalID,\n\t\t\"status\": reqModel.Status,\n\t}\n\n\trequestID, err := uuid.NewV4()\n\tif err != nil {\n\t\tlog.WithFields(f).Warnf(\"Unable to generate a UUID for a pending invite, error: %v\", err)\n\t\treturn nil, err\n\t}\n\n\t_, now := utils.CurrentTime()\n\n\tlog.WithFields(f).Debugf(\"request model: %+v\", reqModel)\n\n\titemMap := map[string]*dynamodb.AttributeValue{\n\t\t\"request_id\": {\n\t\t\tS: aws.String(requestID.String()),\n\t\t},\n\t\t\"company_id\": {\n\t\t\tS: aws.String(reqModel.CompanyID),\n\t\t},\n\t\t\"company_name\": {\n\t\t\tS: aws.String(reqModel.CompanyName),\n\t\t},\n\t\t\"project_id\": {\n\t\t\tS: aws.String(reqModel.ProjectID),\n\t\t},\n\t\t\"project_name\": {\n\t\t\tS: aws.String(reqModel.ProjectName),\n\t\t},\n\t\t\"user_id\": {\n\t\t\tS: aws.String(reqModel.UserID),\n\t\t},\n\t\t\"user_name\": {\n\t\t\tS: aws.String(reqModel.UserName),\n\t\t},\n\t\t\"user_email\": {\n\t\t\tS: aws.String(reqModel.UserEmail),\n\t\t},\n\t\t\"status\": {\n\t\t\tS: aws.String(\"pending\"),\n\t\t},\n\t\t\"date_created\": {\n\t\t\tS: aws.String(now),\n\t\t},\n\t\t\"date_modified\": {\n\t\t\tS: aws.String(now),\n\t\t},\n\t}\n\n\t// If provided the project external ID - add it\n\tif reqModel.ProjectExternalID != \"\" {\n\t\titemMap[\"project_external_id\"] = &dynamodb.AttributeValue{\n\t\t\tS: aws.String(reqModel.ProjectExternalID),\n\t\t}\n\t}\n\t// If provided the company project external - add it\n\tif reqModel.CompanyExternalID != \"\" {\n\t\titemMap[\"company_external_id\"] = &dynamodb.AttributeValue{\n\t\t\tS: aws.String(reqModel.CompanyExternalID),\n\t\t}\n\t}\n\t// If provided the user external ID - add it\n\tif reqModel.UserExternalID != \"\" {\n\t\titemMap[\"user_external_id\"] = &dynamodb.AttributeValue{\n\t\t\tS: aws.String(reqModel.UserExternalID),\n\t\t}\n\t}\n\n\tinput := &dynamodb.PutItemInput{\n\t\tItem: itemMap,\n\t\tTableName: aws.String(repo.tableName),\n\t}\n\n\t_, err = repo.dynamoDBClient.PutItem(input)\n\tif err != nil {\n\t\tlog.WithFields(f).Warnf(\"unable to create a new CLA Manager request, error: %v\", err)\n\t\treturn nil, err\n\t}\n\n\t// Load the created record\n\tcreatedRequest, err := repo.GetRequest(requestID.String())\n\tif err != nil || createdRequest == nil {\n\t\tlog.WithFields(f).Warnf(\"unable to query newly created CLA Manager request by id: %s, error: %v\",\n\t\t\trequestID.String(), err)\n\t\treturn nil, err\n\t}\n\n\treturn createdRequest, nil\n}", "title": "" }, { "docid": "fea377ff005b34e7315dc1a18bddc7cf", "score": "0.55670094", "text": "func (c *InputService14ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "c67c7ae2219017209c325ea11a704807", "score": "0.55668247", "text": "func (c *InputService13ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "a604372107bfd11f6d5e0474a6351a81", "score": "0.5562663", "text": "func (c *InputService21ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "25ea9622c8fb1051bebe509839790cd2", "score": "0.556019", "text": "func (c *InputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "7d758a2555c6ac2bfb72c2d95ee09cfc", "score": "0.5553625", "text": "func (_PMintyMultiToken *PMintyMultiTokenTransactor) Mint(opts *bind.TransactOpts, tokenId *big.Int, quantity *big.Int, hash string, poolId *big.Int) (*types.Transaction, error) {\n\treturn _PMintyMultiToken.contract.Transact(opts, \"mint\", tokenId, quantity, hash, poolId)\n}", "title": "" }, { "docid": "9622e4121393954e5f81ed7440acc1da", "score": "0.5549867", "text": "func (c *InputService10ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "9622e4121393954e5f81ed7440acc1da", "score": "0.5549867", "text": "func (c *InputService10ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "2ab22a1fe3d7992ac65f9657ae9c2572", "score": "0.55401504", "text": "func (_Token *TokenTransactor) Mint(opts *bind.TransactOpts, _account common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _Token.contract.Transact(opts, \"mint\", _account, _amount)\n}", "title": "" }, { "docid": "7be77d87a98fed15d556d0ae2e858e92", "score": "0.553619", "text": "func (s *KeyPairsService) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := s.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "649cc055a8d139010b05b8e1baf3870a", "score": "0.55338866", "text": "func (c *InputService1ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "649cc055a8d139010b05b8e1baf3870a", "score": "0.55338866", "text": "func (c *InputService1ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "649cc055a8d139010b05b8e1baf3870a", "score": "0.55338866", "text": "func (c *InputService1ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "649cc055a8d139010b05b8e1baf3870a", "score": "0.55338866", "text": "func (c *InputService1ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "99158021c1ad7219415010b8d5eff70f", "score": "0.55305606", "text": "func Mint(c context.Context, params MintParams) (*tokenserver.MachineTokenBody, string, error) {\n\tif err := params.Validate(); err != nil {\n\t\treturn nil, \"\", err\n\t}\n\tchunks := strings.SplitN(params.FQDN, \".\", 2)\n\tif len(chunks) != 2 {\n\t\tpanic(\"impossible\") // checked in Validate already\n\t}\n\tcfg := domainConfig(params.Config, chunks[1])\n\tif cfg == nil {\n\t\tpanic(\"impossible\") // checked in Validate already\n\t}\n\n\tbody := tokenserver.MachineTokenBody{\n\t\tMachineFqdn: params.FQDN,\n\t\tIssuedBy: params.SignerServiceAccount,\n\t\tIssuedAt: uint64(clock.Now(c).Unix()),\n\t\tLifetime: uint64(cfg.MachineTokenLifetime),\n\t\tCaId: params.Config.UniqueId,\n\t\tCertSn: params.Cert.SerialNumber.Uint64(), // already validated, fits uint64\n\t}\n\tserializedBody, err := proto.Marshal(&body)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\n\tkeyID, signature, err := params.Signer.SignBytes(c, serializedBody)\n\tif err != nil {\n\t\treturn nil, \"\", errors.WrapTransient(err)\n\t}\n\n\ttokenBinBlob, err := proto.Marshal(&tokenserver.MachineTokenEnvelope{\n\t\tTokenBody: serializedBody,\n\t\tKeyId: keyID,\n\t\tRsaSha256: signature,\n\t})\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\treturn &body, base64.RawStdEncoding.EncodeToString(tokenBinBlob), nil\n}", "title": "" }, { "docid": "ba4e8b876177c8a7c82de2e04a4c3cb9", "score": "0.55276257", "text": "func NewRequest(addr ledgerstate.Address, accessManaPledgeID, consensusManaPledgeID identity.ID, nonce uint64) *Request {\n\tp := &Request{\n\t\tpayloadType: Type,\n\t\taddress: addr,\n\t\taccessManaPledgeID: accessManaPledgeID,\n\t\tconsensusManaPledgeID: consensusManaPledgeID,\n\t\tnonce: nonce,\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "e9a484a68b75f431156d0e4828100937", "score": "0.5526314", "text": "func (_SampleERC20MintableToken *SampleERC20MintableTokenTransactor) Mint(opts *bind.TransactOpts, _to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _SampleERC20MintableToken.contract.Transact(opts, \"mint\", _to, _amount)\n}", "title": "" }, { "docid": "df9e57bf3f59772b90ec3b4831903613", "score": "0.5526222", "text": "func (c *InputService3ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "df9e57bf3f59772b90ec3b4831903613", "score": "0.5526222", "text": "func (c *InputService3ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "df9e57bf3f59772b90ec3b4831903613", "score": "0.5526222", "text": "func (c *InputService3ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "df9e57bf3f59772b90ec3b4831903613", "score": "0.5526222", "text": "func (c *InputService3ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "3f08789c693c1023f138d7a409e79857", "score": "0.55244553", "text": "func (c *InputService2ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "3f08789c693c1023f138d7a409e79857", "score": "0.55244553", "text": "func (c *InputService2ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "3f08789c693c1023f138d7a409e79857", "score": "0.55244553", "text": "func (c *InputService2ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "3f08789c693c1023f138d7a409e79857", "score": "0.55244553", "text": "func (c *InputService2ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "b54bd4146d919828f8fd4c42827ad936", "score": "0.5522962", "text": "func (c *InputService20ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "ecf09140ecaf9daa41bfeb8805039eb3", "score": "0.55228233", "text": "func (c *InputService15ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "1a62d33d478569010b126d6da50572e6", "score": "0.54999226", "text": "func (c *InputService18ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "5c2d7381d5b1b8311aedd136ebb6d309", "score": "0.5498338", "text": "func (c *InputService19ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "04dee47bdc98be808e0dcdd9942e8b41", "score": "0.5498099", "text": "func (_LivepeerToken *LivepeerTokenTransactor) Mint(opts *bind.TransactOpts, _to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _LivepeerToken.contract.Transact(opts, \"mint\", _to, _amount)\n}", "title": "" }, { "docid": "6255a9c42398a13d88d9f762dc44acc1", "score": "0.54918224", "text": "func (s *PingoneService) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := s.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "9c8edeb9253a086927135575324b4525", "score": "0.5479662", "text": "func (c *InputService16ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "0f3390c3661801065b159314ffbfff17", "score": "0.5473282", "text": "func (_ZapToken *ZapTokenTransactor) Mint(opts *bind.TransactOpts, _to common.Address, _amount *big.Int) (*types.Transaction, error) {\r\n\treturn _ZapToken.contract.Transact(opts, \"mint\", _to, _amount)\r\n}", "title": "" }, { "docid": "c4a277c9e9f61fb8e2531151a0ded12a", "score": "0.54722565", "text": "func (_IPancakePair *IPancakePairTransactor) Mint(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) {\n\treturn _IPancakePair.contract.Transact(opts, \"mint\", to)\n}", "title": "" }, { "docid": "61e3fa0e2e3b6d321b2ca65c4a520317", "score": "0.54639554", "text": "func GetCmdMint(cdc *codec.Codec) *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: \"mint\",\n\t\tShort: \"mint coin to sender address\",\n\t\tArgs: cobra.MaximumNArgs(1),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tinBuf := bufio.NewReader(cmd.InOrStdin())\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\n\t\t\ttxBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc))\n\t\t\tdenom := args[0]\n\n\t\t\tmsg := types.NewMsgMint(cliCtx.GetFromAddress(), cliCtx.GetFromAddress(), denom)\n\t\t\terr := msg.ValidateBasic()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg})\n\t\t},\n\t}\n}", "title": "" }, { "docid": "e7c22d1aeb0f0d169aaffac413522f34", "score": "0.5462911", "text": "func (c *InputService9ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "e7c22d1aeb0f0d169aaffac413522f34", "score": "0.5462911", "text": "func (c *InputService9ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "e7c22d1aeb0f0d169aaffac413522f34", "score": "0.5462911", "text": "func (c *InputService9ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "1fdb9b9740cd30895d19d89e02929c48", "score": "0.54628044", "text": "func (c *InputService4ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "1fdb9b9740cd30895d19d89e02929c48", "score": "0.54628044", "text": "func (c *InputService4ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "1fdb9b9740cd30895d19d89e02929c48", "score": "0.54628044", "text": "func (c *InputService4ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "1fdb9b9740cd30895d19d89e02929c48", "score": "0.54628044", "text": "func (c *InputService4ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "eb48dc5d6a3c300965af087f09929ccd", "score": "0.54517716", "text": "func (_PancakePair *PancakePairTransactor) Mint(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) {\n\treturn _PancakePair.contract.Transact(opts, \"mint\", to)\n}", "title": "" }, { "docid": "cf696351e92b87acdf210932699ed949", "score": "0.54502404", "text": "func (c *InputService25ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "03ac67b0a6dd4edb0da1da6f3318acec", "score": "0.54484826", "text": "func (c *InputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "373df6b6895cee682ac5e3f84b27b65e", "score": "0.5446233", "text": "func (c *InputService24ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "702af20907e798db9172bab50fe8a7a4", "score": "0.5440366", "text": "func (c *InputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "b90d619fd5ca37e908583f491cc6384c", "score": "0.5428297", "text": "func NewMytokenRequest() *MytokenFromMytokenRequest {\n\treturn &MytokenFromMytokenRequest{\n\t\tResponseType: model.ResponseTypeToken,\n\t\tGrantType: -1,\n\t}\n}", "title": "" }, { "docid": "8fc92639582b718ef3accaf1442bb58a", "score": "0.54167336", "text": "func (c *InputService5ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "8fc92639582b718ef3accaf1442bb58a", "score": "0.54167336", "text": "func (c *InputService5ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "8fc92639582b718ef3accaf1442bb58a", "score": "0.54167336", "text": "func (c *InputService5ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "8fc92639582b718ef3accaf1442bb58a", "score": "0.54167336", "text": "func (c *InputService5ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "4cf1cb791e3f3466a01b3dc96805f970", "score": "0.5415562", "text": "func (_NFT721 *NFT721Transactor) Mint(opts *bind.TransactOpts, to common.Address, tokenId *big.Int, tokenURI string) (*types.Transaction, error) {\n\treturn _NFT721.contract.Transact(opts, \"mint\", to, tokenId, tokenURI)\n}", "title": "" }, { "docid": "437ee4a946e2a8eaa645fd846f857451", "score": "0.5414051", "text": "func (_YongCoin *YongCoinTransactor) Mint(opts *bind.TransactOpts, reciver common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _YongCoin.contract.Transact(opts, \"mint\", reciver, amount)\n}", "title": "" }, { "docid": "90057721da3a383689a231e1dfaa948b", "score": "0.53966", "text": "func (my MytokenEndpoint) FromRequest(request interface{}) (string, *string, error) {\n\tresp, err := my.APIFromRequest(request)\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\tvar updatedMT *string\n\tif resp.TokenUpdate != nil {\n\t\tupdatedMT = &resp.TokenUpdate.Mytoken\n\t}\n\treturn resp.Mytoken, updatedMT, nil\n}", "title": "" }, { "docid": "45cda40ab6d03805a5948c6546757bb6", "score": "0.5385705", "text": "func (s *HttpConfigService) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := s.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "c21cf68c2a02664bfd3c5febe26eee18", "score": "0.5381702", "text": "func (_PairContract *PairContractTransactor) Mint(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) {\n\treturn _PairContract.contract.Transact(opts, \"mint\", to)\n}", "title": "" }, { "docid": "ffb4ef375dc334dd762041f767e2b632", "score": "0.5371354", "text": "func CreateModifyOutboundCallNumberRequest() (request *ModifyOutboundCallNumberRequest) {\n\trequest = &ModifyOutboundCallNumberRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"OutboundBot\", \"2019-12-26\", \"ModifyOutboundCallNumber\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "8c0ab055d4bcd280cfeabb711daf8eba", "score": "0.53661853", "text": "func (_IPairedErc20 *IPairedErc20Transactor) Mint(opts *bind.TransactOpts, account common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _IPairedErc20.contract.Transact(opts, \"mint\", account, amount)\n}", "title": "" }, { "docid": "229de69a1d3349576c9778aba7904f01", "score": "0.53587055", "text": "func (s *AdminSessionInfoService) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := s.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "145ad088b6aca6e5f8c531ad78515144", "score": "0.5357346", "text": "func (c *InputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "5b16f41fd5f1c46b7b08ac4082f58313", "score": "0.5355467", "text": "func (_Pxa *PxaTransactor) Mint(opts *bind.TransactOpts, _hash [32]byte, _price *big.Int, _weight *big.Int, _data string) (*types.Transaction, error) {\n\treturn _Pxa.contract.Transact(opts, \"mint\", _hash, _price, _weight, _data)\n}", "title": "" }, { "docid": "b7e183a737e1b013236939cd0e718286", "score": "0.53540456", "text": "func (c *Support) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\t// Run custom request initialization if present\n\tif initRequest != nil {\n\t\tinitRequest(req)\n\t}\n\n\treturn req\n}", "title": "" }, { "docid": "16e4711946663883e57b19f672c16ade", "score": "0.53441834", "text": "func (_Ticket721 *Ticket721Transactor) Mint(opts *bind.TransactOpts, to common.Address, tokenId *big.Int) (*types.Transaction, error) {\n\treturn _Ticket721.contract.Transact(opts, \"mint\", to, tokenId)\n}", "title": "" }, { "docid": "482f638e002d7bd0cd895ca253498ce7", "score": "0.5341481", "text": "func NewModifyNodeNumRequestWithoutParam() *ModifyNodeNumRequest {\n\n return &ModifyNodeNumRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/regions/{regionId}/instances/{instanceId}:modifyNodeNum\",\n Method: \"POST\",\n Header: nil,\n Version: \"v1\",\n },\n }\n}", "title": "" }, { "docid": "95ca6716aa5b7f9a88bf37daa4fd98f7", "score": "0.5340696", "text": "func (_Contract *ContractTransactor) Mint(opts *bind.TransactOpts, mintAmount *big.Int) (*types.Transaction, error) {\n\treturn _Contract.contract.Transact(opts, \"mint\", mintAmount)\n}", "title": "" }, { "docid": "7c728cad55520fd3f7e821cacac25ced", "score": "0.53382796", "text": "func (c *InputService7ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "7c728cad55520fd3f7e821cacac25ced", "score": "0.53382796", "text": "func (c *InputService7ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "7c728cad55520fd3f7e821cacac25ced", "score": "0.53382796", "text": "func (c *InputService7ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "7c728cad55520fd3f7e821cacac25ced", "score": "0.53382796", "text": "func (c *InputService7ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "df661356d94974084af898e87c67fad1", "score": "0.5337808", "text": "func GetCmdMintFor(cdc *codec.Codec) *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: \"mintfor [address] [denom]\",\n\t\tShort: \"mint coin for new address\",\n\t\tArgs: cobra.MinimumNArgs(1),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tinBuf := bufio.NewReader(cmd.InOrStdin())\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\n\t\t\ttxBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc))\n\n\t\t\taddress, _ := sdk.AccAddressFromBech32(args[0])\n\n\t\t\tdenom := args[1]\n\t\t\tmsg := types.NewMsgMint(cliCtx.GetFromAddress(), address, denom)\n\t\t\terr := msg.ValidateBasic()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg})\n\t\t},\n\t}\n}", "title": "" }, { "docid": "fbdc09fe0518de29a6ff04449ea908d3", "score": "0.5335097", "text": "func (c *Inspector) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\t// Run custom request initialization if present\n\tif initRequest != nil {\n\t\tinitRequest(req)\n\t}\n\n\treturn req\n}", "title": "" } ]
6a6a3b6643cbea5bc73f31f6ca1bfce8
TryLock mocks the method with the same name.
[ { "docid": "3ae02b2f079bb12b39886914b53b229a", "score": "0.76338214", "text": "func (mockPool *MockLockfile) TryLock() error {\n\treturn mockPool.Called().Error(0)\n}", "title": "" } ]
[ { "docid": "f53583f7f1cbd4d864214e81973a2294", "score": "0.7679568", "text": "func (m *MockTryLocker) TryLock() error {\n\tret := m.ctrl.Call(m, \"TryLock\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "0399997b82531a65e5f76e5f5924e83d", "score": "0.732031", "text": "func (m *MockIFullAPI) Lock(arg0 context.Context, arg1 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Lock\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "fc17fcf82c67741e598c25f973512da0", "score": "0.7208862", "text": "func (m *MockKvdb) Lock(arg0 string) (*kvdb.KVPair, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Lock\", arg0)\n\tret0, _ := ret[0].(*kvdb.KVPair)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "e239b4378ba2cefde501875a90bb3ecf", "score": "0.7074131", "text": "func (m *MockSyncAcl) Lock() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Lock\")\n}", "title": "" }, { "docid": "4838d79e0b58a8460398e0b9cd2c766a", "score": "0.7067998", "text": "func (m *MockStore) TryLock(v0 context.Context) (bool, func(err error) error, error) {\n\tr0, r1, r2 := m.TryLockFunc.nextHook()(v0)\n\tm.TryLockFunc.appendCall(StoreTryLockFuncCall{v0, r0, r1, r2})\n\treturn r0, r1, r2\n}", "title": "" }, { "docid": "1fdf787013b536a5c25e5766f2faed46", "score": "0.6960881", "text": "func (m *MockLockerService) Lock(arg0 context.Context, arg1 string, arg2 int64) (string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Lock\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "f734b5d7941e39f273c67f532ca18e00", "score": "0.69400394", "text": "func (m *IndexLockerMock) Lock(p insolar.ID) {\n\tcounter := atomic.AddUint64(&m.LockPreCounter, 1)\n\tdefer atomic.AddUint64(&m.LockCounter, 1)\n\n\tif len(m.LockMock.expectationSeries) > 0 {\n\t\tif counter > uint64(len(m.LockMock.expectationSeries)) {\n\t\t\tm.t.Fatalf(\"Unexpected call to IndexLockerMock.Lock. %v\", p)\n\t\t\treturn\n\t\t}\n\n\t\tinput := m.LockMock.expectationSeries[counter-1].input\n\t\ttestify_assert.Equal(m.t, *input, IndexLockerMockLockInput{p}, \"IndexLocker.Lock got unexpected parameters\")\n\n\t\treturn\n\t}\n\n\tif m.LockMock.mainExpectation != nil {\n\n\t\tinput := m.LockMock.mainExpectation.input\n\t\tif input != nil {\n\t\t\ttestify_assert.Equal(m.t, *input, IndexLockerMockLockInput{p}, \"IndexLocker.Lock got unexpected parameters\")\n\t\t}\n\n\t\treturn\n\t}\n\n\tif m.LockFunc == nil {\n\t\tm.t.Fatalf(\"Unexpected call to IndexLockerMock.Lock. %v\", p)\n\t\treturn\n\t}\n\n\tm.LockFunc(p)\n}", "title": "" }, { "docid": "c03af36dd87025669912fc6ceb7f5d0c", "score": "0.6874489", "text": "func MockRedisLock(\n\tmockRedisClient *redismocks.MockRedisClient,\n\tlockKey string,\n\tlockTimeoutMs int,\n\tlockResult bool,\n\terrLock error,\n) (calls *Calls) {\n\tcalls = NewCalls()\n\n\tcalls.Add(mockRedisClient.EXPECT().\n\t\tSetNX(lockKey, gomock.Any(), time.Duration(lockTimeoutMs)*time.Millisecond).\n\t\tReturn(goredis.NewBoolResult(lockResult, errLock)))\n\n\treturn calls\n}", "title": "" }, { "docid": "7a7347285e4336f7cd1cadbba925b79b", "score": "0.6822954", "text": "func (m *MockLocker) Lock(v0 context.Context, v1 int, v2 bool) (bool, locker.UnlockFunc, error) {\n\tr0, r1, r2 := m.LockFunc.nextHook()(v0, v1, v2)\n\tm.LockFunc.appendCall(LockerLockFuncCall{v0, v1, v2, r0, r1, r2})\n\treturn r0, r1, r2\n}", "title": "" }, { "docid": "7fcdbd01aff78864dd2f1a8dd7309c55", "score": "0.6800206", "text": "func (m *MockSectorIndex) StorageTryLock(arg0 context.Context, arg1 abi.SectorID, arg2, arg3 storiface.SectorFileType) (bool, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"StorageTryLock\", arg0, arg1, arg2, arg3)\n\tret0, _ := ret[0].(bool)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "6a39bf17520d46cfb75c65e5207149cb", "score": "0.6768347", "text": "func (m *MockProjectImpl) Lock(p *models.Project) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Lock\", p)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "64f7e929c3459f492c0fc845a78870b0", "score": "0.6756143", "text": "func (m *MockKvdb) LockWithTimeout(arg0, arg1 string, arg2, arg3 time.Duration) (*kvdb.KVPair, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LockWithTimeout\", arg0, arg1, arg2, arg3)\n\tret0, _ := ret[0].(*kvdb.KVPair)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "04a69094dd495bb9444291674277ed0e", "score": "0.67244995", "text": "func TestLockAPI(t *testing.T) {\n\n\t// TODO - how cleanup lockMap here between test runs?\n\ttestSimpleLocks(t)\n\ttestTwoThreadsExclLocking(t)\n\ttestTwoThreadsSharedLocking(t)\n\ttestTwoThreadsAndExclToShared(t)\n\ttestTwoThreadsAndSharedToExcl(t)\n\ttest100ThreadsSharedLocking(t)\n\ttest100ThreadsExclLocking(t)\n}", "title": "" }, { "docid": "e616245187da24577532eb177c53b7e0", "score": "0.6543029", "text": "func (m *MockSyncAcl) RLock() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"RLock\")\n}", "title": "" }, { "docid": "4a569190dca5bc2e278b54eedfa234d7", "score": "0.65419316", "text": "func (m *MockMutex) Lock(ctx context.Context) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Lock\", ctx)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "2d36447c2b2c41a813bbdd3c08bcd18a", "score": "0.65132296", "text": "func (n *M) TryLock(key string) (func(), bool) {\n\tunlock, tryAgain := n.tryLockInternal(key)\n\tif tryAgain != nil {\n\t\treturn unlock, false\n\t} else {\n\t\treturn unlock, true\n\t}\n}", "title": "" }, { "docid": "9c8ca73059986791cec74d6ae5ac26e1", "score": "0.64926696", "text": "func MockReturnRedisLock(\n\tmockRedisClient *redismocks.MockRedisClient,\n\tlockKey string,\n\terrLock error,\n) (calls *Calls) {\n\tcalls = NewCalls()\n\n\tcalls.Add(\n\t\tmockRedisClient.EXPECT().Ping().AnyTimes())\n\n\tcalls.Add(\n\t\tmockRedisClient.EXPECT().\n\t\t\tEval(gomock.Any(), []string{lockKey}, gomock.Any()).\n\t\t\tReturn(goredis.NewCmdResult(nil, errLock)))\n\n\treturn calls\n}", "title": "" }, { "docid": "86b52381ac51210dd48110de9b251e7e", "score": "0.6488128", "text": "func (mockPool *MockLockfile) TryLockExpireWithRetry(minutes int64) error {\n\treturn mockPool.Called(minutes).Error(0)\n}", "title": "" }, { "docid": "3d83794c091c3d7d56425b2c9e609390", "score": "0.64635396", "text": "func TestTryLock(t *testing.T) {\n\tc := setupRWMutexTest(t)\n\t// Insert the base lock\n\terr := c.Insert(&mongoLock{\n\t\tLockID: lockID,\n\t\tWriter: clientID,\n\t})\n\trequire.NoError(t, err)\n\n\t// client2 fails\n\tlock := NewRWMutex(c, lockID, clientID2)\n\trequire.Equal(t, lock.TryLock(), ErrNotOwner)\n\n\t// client1 succeeds\n\tlock = NewRWMutex(c, lockID, clientID)\n\trequire.NoError(t, lock.TryLock())\n\n\tvar mLock mongoLock\n\terr = c.Find(bson.M{\"lockID\": lockID}).One(&mLock)\n\trequire.NoError(t, err)\n\tassert.Equal(t, mongoLock{\n\t\tLockID: lockID,\n\t\tWriter: clientID,\n\t\tReaders: []string{},\n\t}, mLock)\n}", "title": "" }, { "docid": "e5ec5c101f397b8d4171f3dcfba571d9", "score": "0.6445365", "text": "func (mockPool *MockLockfile) TryLockExpire(minutes int64) error {\n\treturn mockPool.Called(minutes).Error(0)\n}", "title": "" }, { "docid": "b6cefb13e960838ee27ff0882cfa53e5", "score": "0.6444675", "text": "func (ls *LockServer) TryLock(req *grove_common.RPCRequest, reply *grove_common.RPCReply) {\n\tls.mu.Lock()\n\tls.sv.HandleRequest(ls.tryLock_core, req, reply)\n\tls.mu.Unlock()\n\treturn\n}", "title": "" }, { "docid": "08ec22838d9c638d5e684488cc85245a", "score": "0.64360327", "text": "func (m *Mutex) TryLock(ctx context.Context) error {\n\tresp, err := m.tryAcquire(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// if no key on prefix / the minimum rev is key, already hold the lock\n\townerKey := resp.Responses[1].GetResponseRange().Kvs\n\tif len(ownerKey) == 0 || ownerKey[0].CreateRevision == m.myRev {\n\t\tm.hdr = resp.Header\n\t\treturn nil\n\t}\n\tclient := m.s.Client()\n\t// Cannot lock, so delete the key\n\tif _, err := client.Delete(ctx, m.myKey); err != nil {\n\t\treturn err\n\t}\n\tm.myKey = \"\\x00\"\n\tm.myRev = -1\n\treturn ErrLocked\n}", "title": "" }, { "docid": "dd787fcb5788b220b6b233ef011a69ab", "score": "0.6406288", "text": "func (m *MockKvdb) LockWithID(arg0, arg1 string) (*kvdb.KVPair, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LockWithID\", arg0, arg1)\n\tret0, _ := ret[0].(*kvdb.KVPair)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "8020228f63bbf88fd30be8adbf9013cc", "score": "0.62885004", "text": "func (l *Lock) TryLock() error {\n\tvar err error\n\n\t// Clean older locks if necessary\n\tif err = l.initialize(); err != nil {\n\t\treturn err\n\t}\n\n\t// Create lock and fight\n\tl.lock, err = sequentialLockFight(l.client, l.Path, l.acl)\n\tif err != nil {\n\t\tl.Unlock()\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "47e866a95ee0e07e7635989a237f6666", "score": "0.6278115", "text": "func (agent *ActionAgent) RPCWrapLock(ctx context.Context, name string, args, reply interface{}, verbose bool, f func() error) error {\n\treturn agent.rpcWrapper(ctx, name, args, reply, verbose, f,\n\t\ttrue /*lock*/, false /*runAfterAction*/)\n}", "title": "" }, { "docid": "7bdda9af9e040dfcf3cfc05aa8b944c8", "score": "0.62324107", "text": "func (l *lockable) Lock(key string, timeout int) (bool, error) {\n\tvar res string\n\tif l.lockVal == uuid.Nil {\n\t\tl.lockVal = uuid.New()\n\t}\n\tt := fmt.Sprintf(\"%d\", timeout)\n\tif err := l.client.Do(lockScript.Cmd(&res, key, l.lockVal.String(), t)); err != nil {\n\t\treturn false, nil\n\t} else {\n\t\treturn res == \"OK\", nil\n\t}\n}", "title": "" }, { "docid": "aeea36e91241637b81a128640a89350b", "score": "0.6228125", "text": "func (l *Lockfile) TryLock(exclusive bool) error {\n\treturn l.flock(context.Background(), false, exclusive, false)\n}", "title": "" }, { "docid": "3a3c11a0c938680434c7edd758551805", "score": "0.6219883", "text": "func (m *MockIFullAPI) LockState(arg0 context.Context) bool {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LockState\", arg0)\n\tret0, _ := ret[0].(bool)\n\treturn ret0\n}", "title": "" }, { "docid": "c0e1b002ff8f9d573b8522a732d998b2", "score": "0.61835426", "text": "func TestLock(t *testing.T) {\n\tdl := New(\"a\", dlocktest.NewStore())\n\tvar wg sync.WaitGroup\n\twg.Add(3)\n\tfor i := 0; i < 3; i++ {\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tfor i := 0; i < 10; i++ {\n\t\t\t\tdl.Lock(context.Background())\n\t\t\t\ttime.Sleep(100 * time.Microsecond)\n\t\t\t\tdl.Unlock()\n\t\t\t}\n\t\t}()\n\t}\n\twg.Wait()\n}", "title": "" }, { "docid": "0326c0b8981f385ce3298721b3d7f9dd", "score": "0.617126", "text": "func (m *MockLock) Acquire(arg0 <-chan struct{}) (<-chan struct{}, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Acquire\", arg0)\n\tret0, _ := ret[0].(<-chan struct{})\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "018dbb8bf89b658ff1610e8ca42eaa25", "score": "0.6123996", "text": "func TestZookeeperLock_ALock_BLock_AUnlock_BLock_BUnlock(t *testing.T) {\n\n\tcomp := NewZookeeperLock(log.DefaultLogger)\n\tcomp.Init(cfg)\n\n\t//mock\n\tctrl := gomock.NewController(t)\n\tunlockConn := utils.NewMockZKConnection(ctrl)\n\tlockConn := utils.NewMockZKConnection(ctrl)\n\tfactory := utils.NewMockConnectionFactory(ctrl)\n\tpath := \"/\" + resouseId\n\n\tfactory.EXPECT().NewConnection(time.Duration(expireTime)*time.Second, comp.metadata).Return(lockConn, nil).Times(3)\n\n\tlockConn.EXPECT().Create(path, []byte(lockOwerA), int32(zk.FlagEphemeral), zk.WorldACL(zk.PermAll)).Return(\"\", nil).Times(1)\n\tlockConn.EXPECT().Create(path, []byte(lockOwerB), int32(zk.FlagEphemeral), zk.WorldACL(zk.PermAll)).Return(\"\", zk.ErrNodeExists).Times(1)\n\tlockConn.EXPECT().Create(path, []byte(lockOwerB), int32(zk.FlagEphemeral), zk.WorldACL(zk.PermAll)).Return(\"\", nil).Times(1)\n\tlockConn.EXPECT().Close().Return().Times(5)\n\n\tunlockConn.EXPECT().Get(path).Return([]byte(lockOwerA), &zk.Stat{Version: 123}, nil).Times(1)\n\tunlockConn.EXPECT().Get(path).Return([]byte(lockOwerB), &zk.Stat{Version: 124}, nil).Times(1)\n\tunlockConn.EXPECT().Delete(path, int32(123)).Return(nil).Times(2)\n\tunlockConn.EXPECT().Delete(path, int32(124)).Return(nil).Times(2)\n\n\tcomp.unlockConn = unlockConn\n\tcomp.factory = factory\n\n\t//A lock\n\ttryLock, err := comp.TryLock(&lock.TryLockRequest{\n\t\tResourceId: resouseId,\n\t\tLockOwner: lockOwerA,\n\t\tExpire: expireTime,\n\t})\n\tassert.NoError(t, err)\n\tassert.Equal(t, true, tryLock.Success)\n\t//B lock\n\ttryLock, err = comp.TryLock(&lock.TryLockRequest{\n\t\tResourceId: resouseId,\n\t\tLockOwner: lockOwerB,\n\t\tExpire: expireTime,\n\t})\n\tassert.NoError(t, err)\n\tassert.Equal(t, false, tryLock.Success)\n\t//A unlock\n\tunlock, _ := comp.Unlock(&lock.UnlockRequest{\n\t\tResourceId: resouseId,\n\t\tLockOwner: lockOwerA,\n\t})\n\tassert.NoError(t, err)\n\tassert.Equal(t, lock.SUCCESS, unlock.Status)\n\n\t//B lock\n\ttryLock, err = comp.TryLock(&lock.TryLockRequest{\n\t\tResourceId: resouseId,\n\t\tLockOwner: lockOwerB,\n\t\tExpire: expireTime,\n\t})\n\tassert.NoError(t, err)\n\tassert.Equal(t, true, tryLock.Success)\n\n\t//B unlock\n\tunlock, _ = comp.Unlock(&lock.UnlockRequest{\n\t\tResourceId: resouseId,\n\t\tLockOwner: lockOwerB,\n\t})\n\tassert.NoError(t, err)\n\tassert.Equal(t, lock.SUCCESS, unlock.Status)\n}", "title": "" }, { "docid": "769e30ca5fd20fa784f9eb35eca1ab61", "score": "0.6119559", "text": "func testTryFailsIfHeldExclusive(t *testing.T) {\n\tvar numThreads uint64 = 2\n\n\t// Initialize worker threads\n\tsetupThreads(numThreads)\n\n\t// Lock *exclusive* from thread 0 and wait until lock is owned.\n\tsendRequestToThread(0, t, writeLock, s1)\n\twaitCountOwners(s1, 1)\n\tmutex.Lock()\n\tlockOwner := currentLockOwner[s1]\n\tmutex.Unlock()\n\tassert := assert.New(t)\n\tassert.Equal(lockOwner, 0, \"Lock should be owned by thread 0.\")\n\n\t// Try write lock which should fail and there should not be any waiters.\n\tsendRequestToThread(1, t, tryWriteLock, s1)\n\twaitCountOwners(s1, 1)\n\twaitCountWaiters(s1, 0)\n\tmutex.Lock()\n\tlockOwner = currentLockOwner[s1]\n\tmutex.Unlock()\n\tassert.Equal(lockOwner, 0, \"Lock should be owned by thread 0.\")\n\n\t// Try read lock which should fail and there should not be any waiters.\n\tsendRequestToThread(1, t, tryReadLock, s1)\n\twaitCountOwners(s1, 1)\n\twaitCountWaiters(s1, 0)\n\tmutex.Lock()\n\tlockOwner = currentLockOwner[s1]\n\tmutex.Unlock()\n\tassert.Equal(lockOwner, 0, \"Lock should be owned by thread 0.\")\n\n\t// Release lock from thread 0. Owners should now be 0.\n\tsendRequestToThread(0, t, unlock, s1)\n\twaitCountOwners(s1, 0)\n\twaitCountWaiters(s1, 0)\n\n\t// Now try write lock from thread 1. This should work.\n\tsendRequestToThread(1, t, tryWriteLock, s1)\n\twaitCountOwners(s1, 1)\n\twaitCountWaiters(s1, 0)\n\tmutex.Lock()\n\tlockOwner = currentLockOwner[s1]\n\tmutex.Unlock()\n\tassert.Equal(lockOwner, 1, \"Lock should be owned by thread 1.\")\n\n\t// Unlock from thread 1 and try a read lock from thread 1. This should work.\n\tsendRequestToThread(1, t, unlock, s1)\n\twaitCountOwners(s1, 0)\n\twaitCountWaiters(s1, 0)\n\n\tsendRequestToThread(1, t, tryReadLock, s1)\n\twaitCountOwners(s1, 1)\n\twaitCountWaiters(s1, 0)\n\tmutex.Lock()\n\tlockOwner = currentLockOwner[s1]\n\tmutex.Unlock()\n\tassert.Equal(lockOwner, 1, \"Lock should be owned by thread 1.\")\n\n\t// A try of a write lock from thread 0 should fail if the lock is held shared by thread 1.\n\tsendRequestToThread(0, t, tryWriteLock, s1)\n\twaitCountOwners(s1, 1)\n\twaitCountWaiters(s1, 0)\n\tmutex.Lock()\n\tlockOwner = currentLockOwner[s1]\n\tmutex.Unlock()\n\tassert.Equal(lockOwner, 1, \"Lock should be owned by thread 1.\")\n\n\t// Release the lock\n\tsendRequestToThread(1, t, unlock, s1)\n\twaitCountWaiters(s1, 0)\n\twaitCountOwners(s1, 0)\n\n\t// Stop worker threads\n\tstopThreads(t)\n}", "title": "" }, { "docid": "a83a51c9f23f5efffed435c9f0ad7c6f", "score": "0.6088944", "text": "func TestTimelock(t *testing.T) {\n\tTestingT(t)\n}", "title": "" }, { "docid": "d873fc6569bc7bc0b992bf734a3332dd", "score": "0.6076392", "text": "func (m *MockKvdb) IsKeyLocked(arg0 string) (bool, string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IsKeyLocked\", arg0)\n\tret0, _ := ret[0].(bool)\n\tret1, _ := ret[1].(string)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}", "title": "" }, { "docid": "f0141c24f8214b19d73359b86e90700a", "score": "0.6072697", "text": "func TestZookeeperLock_ALock_AUnlock(t *testing.T) {\n\n\tcomp := NewZookeeperLock(log.DefaultLogger)\n\tcomp.Init(cfg)\n\n\t//mock\n\tctrl := gomock.NewController(t)\n\tunlockConn := utils.NewMockZKConnection(ctrl)\n\tlockConn := utils.NewMockZKConnection(ctrl)\n\tfactory := utils.NewMockConnectionFactory(ctrl)\n\tpath := \"/\" + resouseId\n\tfactory.EXPECT().NewConnection(time.Duration(expireTime)*time.Second, comp.metadata).Return(lockConn, nil).Times(2)\n\n\tlockConn.EXPECT().Create(path, []byte(lockOwerA), int32(zk.FlagEphemeral), zk.WorldACL(zk.PermAll)).Return(\"\", nil).Times(1)\n\tlockConn.EXPECT().Close().Return().Times(1)\n\n\tunlockConn.EXPECT().Get(path).Return([]byte(lockOwerA), &zk.Stat{Version: 123}, nil).Times(1)\n\tunlockConn.EXPECT().Delete(path, int32(123)).Return(nil).Times(1)\n\n\tcomp.unlockConn = unlockConn\n\tcomp.factory = factory\n\n\ttryLock, err := comp.TryLock(&lock.TryLockRequest{\n\t\tResourceId: resouseId,\n\t\tLockOwner: lockOwerA,\n\t\tExpire: expireTime,\n\t})\n\tassert.NoError(t, err)\n\tassert.Equal(t, tryLock.Success, true)\n\tunlock, _ := comp.Unlock(&lock.UnlockRequest{\n\t\tResourceId: resouseId,\n\t\tLockOwner: lockOwerA,\n\t})\n\tassert.NoError(t, err)\n\tassert.Equal(t, unlock.Status, lock.SUCCESS)\n\n}", "title": "" }, { "docid": "72fc68c61cae141093d6d9b028f75741", "score": "0.60622454", "text": "func (m *IndexLockerMock) MinimockWait(timeout time.Duration) {\n\ttimeoutCh := time.After(timeout)\n\tfor {\n\t\tok := true\n\t\tok = ok && m.LockFinished()\n\t\tok = ok && m.UnlockFinished()\n\n\t\tif ok {\n\t\t\treturn\n\t\t}\n\n\t\tselect {\n\t\tcase <-timeoutCh:\n\n\t\t\tif !m.LockFinished() {\n\t\t\t\tm.t.Error(\"Expected call to IndexLockerMock.Lock\")\n\t\t\t}\n\n\t\t\tif !m.UnlockFinished() {\n\t\t\t\tm.t.Error(\"Expected call to IndexLockerMock.Unlock\")\n\t\t\t}\n\n\t\t\tm.t.Fatalf(\"Some mocks were not called on time: %s\", timeout)\n\t\t\treturn\n\t\tdefault:\n\t\t\ttime.Sleep(time.Millisecond)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "119462097c8dc5281a0b353cb64d4464", "score": "0.60565615", "text": "func Lock(ctx context.Context, taskID string) error {\n\tif ctx.Value(MockSuccess) != nil {\n\t\treturn nil\n\t}\n\tif ctx.Value(MockError) != nil {\n\t\treturn errors.New(\"\")\n\t}\n\n\tcred, err := gaccount.GlobalCredential(ctx)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"new global cred\")\n\t}\n\tclient, err := gdb.NewClient(ctx, cred)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"new db client\")\n\t}\n\tdefer client.Close()\n\n\treturn client.Transaction(ctx, func(ctx context.Context, tx db.Transaction) error {\n\t\tobj, err := tx.Get(ctx, &Task{}, taskID)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"get task \"+taskID)\n\t\t}\n\t\tif obj == nil {\n\t\t\treturn errors.New(\"task not found \" + taskID)\n\t\t}\n\n\t\ttask := obj.(*Task)\n\t\terr = task.Lock()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = tx.Set(ctx, task)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"set task \"+taskID)\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "2f9e50a4fb91b2683474ad4219c1e5be", "score": "0.6048726", "text": "func (m *MockSectorIndex) StorageLock(arg0 context.Context, arg1 abi.SectorID, arg2, arg3 storiface.SectorFileType) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"StorageLock\", arg0, arg1, arg2, arg3)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "9078bf7f8505bebf7129d963bc21b0e9", "score": "0.60464376", "text": "func (s *SpinLock) TryLock() bool {\n\treturn atomic.CompareAndSwapInt32(&s.lock, 0, 1)\n}", "title": "" }, { "docid": "ad80035d03cc19c7b5c373508bc4bd8a", "score": "0.6041856", "text": "func withLock(c context.Context, buildID int64, f func() error) error {\n\t// Lock the build via memcache.\n\tlock := memcache.NewItem(c, \"retry-build-\"+strconv.FormatInt(buildID, 10))\n\tswitch err := memcache.Add(c, lock); {\n\tcase err == memcache.ErrNotStored:\n\t\tlogging.Infof(c, \"build %d is locked, letting go\", buildID)\n\t\treturn nil\n\n\tcase err != nil:\n\t\treturn errors.Annotate(err, \"could not lock on build %d\", buildID).Err()\n\t}\n\n\tunlock := true\n\tdefer func() {\n\t\tif unlock {\n\t\t\tif err := memcache.Delete(c, lock.Key()); err != nil {\n\t\t\t\t// too bad. The analysis algorithm will probably ignore this patchset.\n\t\t\t\tlogging.WithError(err).Errorf(c, \"could not unlock build\")\n\t\t\t}\n\t\t}\n\t}()\n\n\tif err := f(); err != nil {\n\t\treturn err\n\t}\n\n\tunlock = false\n\treturn nil\n}", "title": "" }, { "docid": "656de6c4d80542b879fc8dcae707ef71", "score": "0.6030014", "text": "func tryLock(client Registry, lockType LockType, name string, handle string,\n\tid string, ttl uint64) (bool, error) {\n\n\t// Get the lock queue in sorted order.\n\tresp, err := client.Get(path.Join(kLocksDir, name), true, true)\n\tif err != nil {\n\t\tglog.Errorf(\"Failed to read lock queue for %s with error %s\",\n\t\t\tname, err.Error())\n\t\treturn false, ErrLockGet\n\t}\n\n\tfor ii, node := range resp.Node.Nodes {\n\t\tvar state LockState\n\t\tif err := json.Unmarshal([]byte(node.Value), &state); err != nil {\n\t\t\tglog.Errorf(\"Unmarshal of lock %s failed with error %s\",\n\t\t\t\tname, err.Error())\n\t\t\treturn false, ErrLockUnmarshal\n\t\t}\n\n\t\t_, h := path.Split(node.Key)\n\n\t\t// For a write lock request to be successful, it needs to be\n\t\t// first in the queue.\n\t\tif lockType == LockTypeWrite && ii == 0 {\n\t\t\tif state.LockType != LockTypes[LockTypeWrite] ||\n\t\t\t\th != handle {\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\tif err := refreshTTL(client, lockType, name, handle, id,\n\t\t\t\tttl); err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\treturn true, nil\n\t\t}\n\n\t\t// For a read lock request to be successful, it should not hit\n\t\t// a write until its position in the queue.\n\t\tif state.LockType != LockTypes[LockTypeRead] {\n\t\t\treturn false, nil\n\t\t}\n\n\t\t// Reached the entry with matching handle, got the lock.\n\t\tif h == handle {\n\t\t\tif err := refreshTTL(client, lockType, name, handle, id,\n\t\t\t\tttl); err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\treturn true, nil\n\t\t}\n\t}\n\n\treturn false, ErrLockReqLost\n}", "title": "" }, { "docid": "fd1189c7ccde1acd701898f418492a53", "score": "0.6023797", "text": "func (mw *mutexWrapper) Lock(ctx context.Context) error {\n\tif mw == nil {\n\t\treturn oops.InternalService(\"tried to lock a nil locker\")\n\t}\n\n\tc := make(chan struct{})\n\n\tgo func() {\n\t\tmw.mu.Lock()\n\n\t\tselect {\n\t\tcase c <- struct{}{}:\n\t\t\t// This is the normal case\n\t\tdefault:\n\t\t\t// There is no receiver which means the function\n\t\t\t// has already returned because the timeout was\n\t\t\t// reached. We don't need this lock anymore.\n\t\t\tmw.Unlock()\n\t\t}\n\t}()\n\n\tselect {\n\tcase <-c:\n\t\treturn nil // Lock acquired\n\tcase <-ctx.Done():\n\t\treturn oops.WithMessage(ctx.Err(), \"failed to acquire lock in time\")\n\t}\n}", "title": "" }, { "docid": "6e93469a90f482d378f2be50c1a4b84c", "score": "0.6014273", "text": "func TestLockSuccess(t *testing.T) {\n\tc := setupRWMutexTest(t)\n\t// Insert the base lock\n\terr := c.Insert(&mongoLock{\n\t\tLockID: lockID,\n\t})\n\trequire.NoError(t, err)\n\n\tlock := NewRWMutex(c, lockID, clientID)\n\terr = lock.Lock()\n\trequire.NoError(t, err)\n\n\tvar mLock mongoLock\n\terr = c.Find(bson.M{\"lockID\": lockID}).One(&mLock)\n\trequire.NoError(t, err)\n\tassert.Equal(t, mongoLock{\n\t\tLockID: lockID,\n\t\tWriter: clientID,\n\t\tReaders: []string{},\n\t}, mLock)\n}", "title": "" }, { "docid": "e8542bc6dd275fd0df6cf1b29c44ffe6", "score": "0.59927386", "text": "func (m *MockDatabase) NewLock(arg0 string, arg1 time.Duration) moira.Lock {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"NewLock\", arg0, arg1)\n\tret0, _ := ret[0].(moira.Lock)\n\treturn ret0\n}", "title": "" }, { "docid": "cc16627a457bcbbf84fc54db189263f9", "score": "0.598996", "text": "func (m *MockRouter) AskABlock(height uint64, to string) error {\n\tret := m.ctrl.Call(m, \"AskABlock\", height, to)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "ad33c278da11b511cc9e01f2487b3e99", "score": "0.5987872", "text": "func testSimpleLocks(t *testing.T) {\n\tassert := assert.New(t)\n\n\tmyCookie := GenerateCallerID()\n\tmyRwLock := &RWLockStruct{LockID: s1, Notify: nil, LockCallerID: myCookie}\n\n\tmyRwLock.WriteLock()\n\twaitCountOwners(s1, 1)\n\twaitCountWaiters(s1, 0)\n\tassert.Equal(IsLockHeld(s1, myCookie, WRITELOCK), true)\n\tassert.Equal(IsLockHeld(s1, myCookie, ANYLOCK), true)\n\tassert.Equal(IsLockHeld(s1, myCookie, READLOCK), false)\n\n\tmyRwLock.Unlock()\n\twaitCountOwners(s1, 0)\n\twaitCountWaiters(s1, 0)\n\n\tmyRwLock.ReadLock()\n\twaitCountOwners(s1, 1)\n\twaitCountWaiters(s1, 0)\n\tassert.Equal(IsLockHeld(s1, myCookie, WRITELOCK), false)\n\tassert.Equal(IsLockHeld(s1, myCookie, ANYLOCK), true)\n\tassert.Equal(IsLockHeld(s1, myCookie, READLOCK), true)\n\n\tmyRwLock.Unlock()\n\twaitCountOwners(s1, 0)\n\twaitCountWaiters(s1, 0)\n\n\t// Try locks\n\terr := myRwLock.TryWriteLock()\n\tassert.Nil(err, \"TryWriteLock() should work if no lock owner.\")\n\twaitCountOwners(s1, 1)\n\twaitCountWaiters(s1, 0)\n\n\tmyRwLock.Unlock()\n\twaitCountOwners(s1, 0)\n\twaitCountWaiters(s1, 0)\n\n\terr = myRwLock.TryReadLock()\n\tassert.Nil(err, \"TryReadLock() should work if no lock owner.\")\n\twaitCountOwners(s1, 1)\n\twaitCountWaiters(s1, 0)\n\n\tmyRwLock.Unlock()\n\twaitCountOwners(s1, 0)\n\twaitCountWaiters(s1, 0)\n\tassert.Equal(IsLockHeld(s1, myCookie, WRITELOCK), false)\n\tassert.Equal(IsLockHeld(s1, myCookie, ANYLOCK), false)\n\tassert.Equal(IsLockHeld(s1, myCookie, READLOCK), false)\n}", "title": "" }, { "docid": "85c8b347d4ba9f9e7e913716f8569899", "score": "0.5970174", "text": "func (m *MockTryLocker) Unlock() error {\n\tret := m.ctrl.Call(m, \"Unlock\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "627b1673f980b19fd6fcb18e16432dca", "score": "0.59544045", "text": "func lock() error {\n\tvar err error\n\tvar lock lockfile.Lockfile\n\n\tdaemonMutex.Lock()\n\tlock, err = getLockfile()\n\tif err != nil {\n\t\tdaemonMutex.Unlock()\n\t\treturn fmt.Errorf(\"[lock] cannot init lockfile: %v\", err)\n\t}\n\n\t// Try to acquire the lock and in case of a temporary error, sleep for\n\t// two seconds until the next retry (at most 10 times). Return fatal\n\t// errors immediately, as we can't recover.\n\tfor i := 0; i < 10; i++ {\n\t\tif err = lock.TryLock(); err != nil {\n\t\t\tswitch err.(type) {\n\t\t\tcase lockfile.TemporaryError:\n\t\t\t\tlogrus.Debugf(\"[lock] busy: next retry in two seconds\")\n\t\t\t\ttime.Sleep(2 * time.Second)\n\t\t\tdefault:\n\t\t\t\tdaemonMutex.Unlock()\n\t\t\t\treturn fmt.Errorf(\"[lock] error acquiring lock: %s\", err)\n\t\t\t}\n\t\t}\n\t}\n\tif err != nil {\n\t\tdaemonMutex.Unlock()\n\t\treturn fmt.Errorf(\"[lock] error acquiring lock: too many tries\")\n\t}\n\n\tlogrus.Debugf(\"[lock] lock acquired\")\n\treturn nil\n}", "title": "" }, { "docid": "01a4e35442288b61085bf64f40e06c66", "score": "0.5952644", "text": "func TestLockWaitsForReader(t *testing.T) {\n\tc := setupRWMutexTest(t)\n\n\tfirstLock := NewRWMutex(c, lockID, \"client_2\")\n\terr := firstLock.RLock()\n\trequire.NoError(t, err)\n\t// check the lock after 10 milliseconds\n\tgo func() {\n\t\ttime.Sleep(time.Duration(10) * time.Millisecond)\n\t\tvar mLock mongoLock\n\t\terr := c.Find(bson.M{\"lockID\": lockID}).One(&mLock)\n\t\trequire.NoError(t, err)\n\t\tassert.Equal(t, mongoLock{\n\t\t\tLockID: lockID,\n\t\t\tWriter: \"\",\n\t\t\tReaders: []string{\"client_2\"},\n\t\t}, mLock)\n\t}()\n\t// clear the lock after 100 milliseconds\n\tgo func() {\n\t\ttime.Sleep(time.Duration(100) * time.Millisecond)\n\t\terr := firstLock.RUnlock()\n\t\trequire.NoError(t, err)\n\t}()\n\n\tsecondLock := NewRWMutex(c, lockID, clientID)\n\tsecondLock.SleepTime = time.Duration(5) * time.Millisecond\n\terr = secondLock.Lock()\n\trequire.NoError(t, err)\n\n\tvar mLock mongoLock\n\terr = c.Find(bson.M{\"lockID\": lockID}).One(&mLock)\n\trequire.NoError(t, err)\n\tassert.Equal(t, mongoLock{\n\t\tLockID: lockID,\n\t\tWriter: clientID,\n\t\tReaders: []string{},\n\t}, mLock)\n}", "title": "" }, { "docid": "463920ef046ea0d25e16764a527498c5", "score": "0.594226", "text": "func (m *VolTaskLocker) TryLock(ctx context.Context, vid proto.Vid) error {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\n\tspan := trace.SpanFromContextSafe(ctx)\n\tspan.Infof(\"vid %d mutex try lock\", vid)\n\n\tif _, ok := m.taskMap[vid]; ok {\n\t\treturn ErrVidTaskConflict\n\t}\n\tm.taskMap[vid] = struct{}{}\n\treturn nil\n}", "title": "" }, { "docid": "4e54bef2fe5c1edaa06e3cce47c812f7", "score": "0.5927436", "text": "func (m *Mutex) tryLock() (bool, error) {\n\tok, err := m.pluginAPI.KVSetWithOptions(m.key, []byte{1}, model.PluginKVSetOptions{\n\t\tAtomic: true,\n\t\tOldValue: nil, // No existing key value.\n\t\tExpireInSeconds: int64(ttl / time.Second),\n\t})\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"failed to set mutex kv\")\n\t}\n\n\treturn ok, nil\n}", "title": "" }, { "docid": "9a73d1fdc3ef997bbad179189629467f", "score": "0.59270114", "text": "func (kvclient *mockKVClient) AcquireLock(ctx context.Context, lockName string, timeout time.Duration) error {\n\treturn nil\n}", "title": "" }, { "docid": "81830c3434e098dda4e216aa2a02c9bb", "score": "0.5919258", "text": "func TestLockNewSuccess(t *testing.T) {\n\tc := setupRWMutexTest(t)\n\tlock := NewRWMutex(c, lockID, clientID)\n\terr := lock.Lock()\n\trequire.NoError(t, err)\n\n\tvar mLock mongoLock\n\terr = c.Find(bson.M{\"lockID\": lockID}).One(&mLock)\n\trequire.NoError(t, err)\n\tassert.Equal(t, mongoLock{\n\t\tLockID: lockID,\n\t\tWriter: clientID,\n\t\tReaders: []string{},\n\t}, mLock)\n}", "title": "" }, { "docid": "db5b1f9a8f5433e8834a3d2a70b6ad6e", "score": "0.58929664", "text": "func (_m *AgentsAPI) NewLock(name string, ttl time.Duration) (dynalock.Locker, error) {\n\tret := _m.Called(name, ttl)\n\n\tvar r0 dynalock.Locker\n\tif rf, ok := ret.Get(0).(func(string, time.Duration) dynalock.Locker); ok {\n\t\tr0 = rf(name, ttl)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(dynalock.Locker)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(string, time.Duration) error); ok {\n\t\tr1 = rf(name, ttl)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "4c4e82a1fdc0bea60504863faa914265", "score": "0.58904326", "text": "func TestLockWaitsForWriter(t *testing.T) {\n\tc := setupRWMutexTest(t)\n\n\tfirstLock := NewRWMutex(c, lockID, \"client_2\")\n\terr := firstLock.Lock()\n\trequire.NoError(t, err)\n\t// check the lock after 10 milliseconds\n\tgo func() {\n\t\ttime.Sleep(time.Duration(10) * time.Millisecond)\n\t\tvar mLock mongoLock\n\t\terr := c.Find(bson.M{\"lockID\": lockID}).One(&mLock)\n\t\trequire.NoError(t, err)\n\t\tassert.Equal(t, mongoLock{\n\t\t\tLockID: lockID,\n\t\t\tWriter: \"client_2\",\n\t\t\tReaders: []string{},\n\t\t}, mLock)\n\t}()\n\t// clear the lock after 100 milliseconds\n\tgo func() {\n\t\ttime.Sleep(time.Duration(100) * time.Millisecond)\n\t\terr := firstLock.Unlock()\n\t\trequire.NoError(t, err)\n\t}()\n\n\tsecondLock := NewRWMutex(c, lockID, clientID)\n\tsecondLock.SleepTime = time.Duration(5) * time.Millisecond\n\terr = secondLock.Lock()\n\trequire.NoError(t, err)\n\n\tvar mLock mongoLock\n\terr = c.Find(bson.M{\"lockID\": lockID}).One(&mLock)\n\trequire.NoError(t, err)\n\tassert.Equal(t, mongoLock{\n\t\tLockID: lockID,\n\t\tWriter: clientID,\n\t\tReaders: []string{},\n\t}, mLock)\n}", "title": "" }, { "docid": "3f2793f7a2525f3c4a71a430bbab5116", "score": "0.5883813", "text": "func NewMockLocker() *MockLocker {\n\treturn &MockLocker{\n\t\tLockFunc: &LockerLockFunc{\n\t\t\tdefaultHook: func(context.Context, int, bool) (bool, locker.UnlockFunc, error) {\n\t\t\t\treturn false, nil, nil\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "43aa75bb94f9887bc0e868b929b47913", "score": "0.58727896", "text": "func (m *PMutex) TryLock(ctx context.Context) bool {\n\n\tm.mx.Lock()\n\tif m.pr > 0 {\n\t\tm.mx.Unlock()\n\t\treturn m.lockST(ctx, false)\n\t}\n\n\tif m.state == 0 {\n\t\tm.state = -1\n\t\tm.mx.Unlock()\n\t\treturn true\n\t}\n\tm.mx.Unlock()\n\n\t// Slow way\n\treturn m.lockST(ctx, false)\n}", "title": "" }, { "docid": "57b25bf1ef66b99fd54163a7304f0139", "score": "0.5870475", "text": "func (m *mutex) Lock() {\n\tq := url.Values{\n\t\t\"name\": {m.object},\n\t\t\"uploadType\": {\"media\"},\n\t\t\"ifGenerationMatch\": {\"0\"},\n\t}\n\turl := fmt.Sprintf(\"%s/b/%s/o?%s\", storageLockURL, m.bucket, q.Encode())\n\tfor i := 1; ; i *= 2 {\n\t\tres, err := m.client.Post(url, \"plain/text\", bytes.NewReader([]byte(\"1\")))\n\t\tif err == nil {\n\t\t\tres.Body.Close()\n\t\t\tif res.StatusCode == 200 {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\ttime.Sleep(time.Duration(i) * time.Millisecond)\n\t}\n}", "title": "" }, { "docid": "756fb97897726d364590aef19f811885", "score": "0.58562386", "text": "func (mmLock *mStateStorageMockLock) Expect() *mStateStorageMockLock {\n\tif mmLock.mock.funcLock != nil {\n\t\tmmLock.mock.t.Fatalf(\"StateStorageMock.Lock mock is already set by Set\")\n\t}\n\n\tif mmLock.defaultExpectation == nil {\n\t\tmmLock.defaultExpectation = &StateStorageMockLockExpectation{}\n\t}\n\n\treturn mmLock\n}", "title": "" }, { "docid": "dd5f67ca09f1b668e9cd708cabbf6f9a", "score": "0.5856083", "text": "func TestZookeeperLock_ALock_BUnlock(t *testing.T) {\n\n\tcomp := NewZookeeperLock(log.DefaultLogger)\n\tcomp.Init(cfg)\n\n\t//mock\n\tctrl := gomock.NewController(t)\n\tunlockConn := utils.NewMockZKConnection(ctrl)\n\tlockConn := utils.NewMockZKConnection(ctrl)\n\tfactory := utils.NewMockConnectionFactory(ctrl)\n\tpath := \"/\" + resouseId\n\tfactory.EXPECT().NewConnection(time.Duration(expireTime)*time.Second, comp.metadata).Return(lockConn, nil).Times(2)\n\n\tlockConn.EXPECT().Create(path, []byte(lockOwerA), int32(zk.FlagEphemeral), zk.WorldACL(zk.PermAll)).Return(\"\", nil).Times(1)\n\tlockConn.EXPECT().Close().Return().Times(1)\n\n\tunlockConn.EXPECT().Get(path).Return([]byte(lockOwerA), &zk.Stat{Version: 123}, nil).Times(1)\n\tunlockConn.EXPECT().Delete(path, int32(123)).Return(nil).Times(1)\n\n\tcomp.unlockConn = unlockConn\n\tcomp.factory = factory\n\n\ttryLock, err := comp.TryLock(&lock.TryLockRequest{\n\t\tResourceId: resouseId,\n\t\tLockOwner: lockOwerA,\n\t\tExpire: expireTime,\n\t})\n\tassert.NoError(t, err)\n\tassert.Equal(t, tryLock.Success, true)\n\tunlock, err := comp.Unlock(&lock.UnlockRequest{\n\t\tResourceId: resouseId,\n\t\tLockOwner: lockOwerB,\n\t})\n\tassert.NoError(t, err)\n\tassert.Equal(t, unlock.Status, lock.LOCK_BELONG_TO_OTHERS)\n\n}", "title": "" }, { "docid": "a87ae7e6ae3511cde750b54ca393c2ed", "score": "0.5841515", "text": "func (m *MockLock) Release() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Release\")\n}", "title": "" }, { "docid": "702c0f32a4f1417ccb9afeec29d592fc", "score": "0.5829974", "text": "func (n *M) tryLockInternal(key string) (func(), chan bool) {\n\tn.masterMu.Lock()\n\tdefer n.masterMu.Unlock()\n\n\tif tryAgain, open := n.locks[key]; open {\n\t\treturn nil, tryAgain\n\t}\n\n\tunlocked := make(chan bool)\n\tn.locks[key] = unlocked\n\n\treturn func() {\n\t\tn.masterMu.Lock()\n\t\tdefer n.masterMu.Unlock()\n\n\t\tdelete(n.locks, key)\n\t\tclose(unlocked)\n\t}, nil\n}", "title": "" }, { "docid": "ed32b39566679c67370cfab91a0b3a08", "score": "0.58219886", "text": "func (m *mIndexLockerMockLock) Expect(p insolar.ID) *mIndexLockerMockLock {\n\tm.mock.LockFunc = nil\n\tm.expectationSeries = nil\n\n\tif m.mainExpectation == nil {\n\t\tm.mainExpectation = &IndexLockerMockLockExpectation{}\n\t}\n\tm.mainExpectation.input = &IndexLockerMockLockInput{p}\n\treturn m\n}", "title": "" }, { "docid": "91a4c69af7cce269d8fb9366f4104b79", "score": "0.58209026", "text": "func (t *Throttler) lock() bool {\n\tctx, cancel := context.WithTimeout(context.Background(), t.timeout)\n\tdefer cancel()\n\tvar err = t.semaphore.Acquire(ctx, 1)\n\treturn err == nil\n}", "title": "" }, { "docid": "095ed5862f8c4677b2697950b2548ac6", "score": "0.5812779", "text": "func lock(l sync.Locker) func() {\n\tl.Lock()\n\treturn l.Unlock\n}", "title": "" }, { "docid": "d4386dcebdb5037bf40f75214ed60110", "score": "0.5809993", "text": "func (t *TryRWMutex) TryLock() bool {\n\tif !t.intTryLock() {\n\t\treturn false\n\t}\n\tif t.rs != 0 {\n\t\tt.Unlock()\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "342dc1e22316499d3e979d7be5e932ab", "score": "0.58079726", "text": "func TestLockReenter(t *testing.T) {\n\tc := setupRWMutexTest(t)\n\t// Insert the base lock\n\terr := c.Insert(&mongoLock{\n\t\tLockID: lockID,\n\t\tWriter: clientID,\n\t})\n\trequire.NoError(t, err)\n\n\tlock := NewRWMutex(c, lockID, clientID)\n\terr = lock.Lock()\n\trequire.NoError(t, err)\n\n\tvar mLock mongoLock\n\terr = c.Find(bson.M{\"lockID\": lockID}).One(&mLock)\n\trequire.NoError(t, err)\n\tassert.Equal(t, mongoLock{\n\t\tLockID: lockID,\n\t\tWriter: clientID,\n\t\tReaders: []string{},\n\t}, mLock)\n}", "title": "" }, { "docid": "4aad0e8258621029c09c2d43ef6c1d4b", "score": "0.58037233", "text": "func openLock(deadends []string, target string) int {\n \n}", "title": "" }, { "docid": "6103630296f5cb0fb40ffd517efbea13", "score": "0.5791835", "text": "func (b *backoffEntry) tryLock() bool {\n\treturn atomic.CompareAndSwapInt32(&b.reqInFlight, 0, 1)\n}", "title": "" }, { "docid": "2f0a6b182e803366e27cee12c42b77f2", "score": "0.5791338", "text": "func (m *MockIFullAPI) Unlock(arg0 context.Context, arg1 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Unlock\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "98363e3b220e2e04d49b2b89db432e25", "score": "0.5780764", "text": "func test() {\n\t// Obtain a new mutex by using the same name for all instances wanting the\n\t// same lock.\n\tmutexname := \"my-global-mutex\"\n\tmutex := rlock.NewMutex(mutexname)\n\n\t// Obtain a lock for our given mutex. After this is successful, no one else\n\t// can obtain the same lock (the same mutex name) until we unlock it.\n\tif err := mutex.Lock(); err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Do your work that requires the lock.\n\n\t// Release the lock so other processes or threads can obtain a lock.\n\tif ok, err := mutex.Unlock(); !ok || err != nil {\n\t\tpanic(\"unlock failed\")\n\t}\n}", "title": "" }, { "docid": "fe5f2df47697a1fc5ea975f64e63c917", "score": "0.57716084", "text": "func (l *DynamoDBLock) tryToLock(stop, success chan struct{}, errors chan error) {\n\tticker := time.NewTicker(DynamoDBLockRetryInterval)\n\n\tfor {\n\t\tselect {\n\t\tcase <-stop:\n\t\t\tticker.Stop()\n\t\tcase <-ticker.C:\n\t\t\terr := l.writeItem()\n\t\t\tif err != nil {\n\t\t\t\tif err, ok := err.(awserr.Error); ok {\n\t\t\t\t\t// Don't report a condition check failure, this means that the lock\n\t\t\t\t\t// is already being held.\n\t\t\t\t\tif err.Code() != dynamodb.ErrCodeConditionalCheckFailedException {\n\t\t\t\t\t\terrors <- err\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Its not an AWS error, and is probably not transient, bail out.\n\t\t\t\t\terrors <- err\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tticker.Stop()\n\t\t\t\tclose(success)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3e505f7dcb62aa8cabe72d4af80b6f66", "score": "0.57673895", "text": "func (b *BoltLocker) TryLock(newLock models.ProjectLock) (bool, models.ProjectLock, error) {\n\tvar lockAcquired bool\n\tvar currLock models.ProjectLock\n\tkey := b.key(newLock.Project, newLock.Env)\n\tnewLockSerialized, _ := json.Marshal(newLock)\n\ttransactionErr := b.db.Update(func(tx *bolt.Tx) error {\n\t\tbucket := tx.Bucket(b.bucket)\n\n\t\t// if there is no run at that key then we're free to create the lock\n\t\tcurrLockSerialized := bucket.Get([]byte(key))\n\t\tif currLockSerialized == nil {\n\t\t\t// This will only error on readonly buckets, it's okay to ignore.\n\t\t\tbucket.Put([]byte(key), newLockSerialized) // nolint: errcheck\n\t\t\tlockAcquired = true\n\t\t\tcurrLock = newLock\n\t\t\treturn nil\n\t\t}\n\n\t\t// otherwise the lock fails, return to caller the run that's holding the lock\n\t\tif err := json.Unmarshal(currLockSerialized, &currLock); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to deserialize current lock\")\n\t\t}\n\t\tlockAcquired = false\n\t\treturn nil\n\t})\n\n\tif transactionErr != nil {\n\t\treturn false, currLock, errors.Wrap(transactionErr, \"DB transaction failed\")\n\t}\n\n\treturn lockAcquired, currLock, nil\n}", "title": "" }, { "docid": "708e3b872dcfd5ea8a6ab592f05c3944", "score": "0.57615876", "text": "func (m *MockKvdb) GetLockTryDuration() time.Duration {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetLockTryDuration\")\n\tret0, _ := ret[0].(time.Duration)\n\treturn ret0\n}", "title": "" }, { "docid": "c63a0b0a301f06fbae124403a7e32531", "score": "0.57595384", "text": "func (mockPool *MockLockfile) Unlock() error {\n\treturn mockPool.Called().Error(0)\n}", "title": "" }, { "docid": "54b4b670166ab35c6536998dae3c9fb4", "score": "0.57395893", "text": "func (m *MockInstallationDatabaseStoreInterface) LockMultitenantDatabase(multitenantdatabaseID, lockerID string) (bool, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LockMultitenantDatabase\", multitenantdatabaseID, lockerID)\n\tret0, _ := ret[0].(bool)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "58b1bb58d1f674a493a61ab49fa1459d", "score": "0.57372904", "text": "func test100ThreadsExclLocking(t *testing.T) {\n\tvar numThreads uint64 = 100\n\n\t// Initialize worker threads\n\tsetupThreads(numThreads)\n\n\tvar i uint64\n\tfor i = 0; i < numThreads; i++ {\n\t\tsendRequestToThread(i, t, writeLock, s1)\n\t\twaitCountOwners(s1, 1)\n\t\twaitCountWaiters(s1, i)\n\t}\n\twaitCountWaiters(s1, numThreads-1)\n\n\t// Any of the threads could get the lock once thread0 releases it.\n\t//\n\t// Therefore, we have to find the thread which currently owns the lock.\n\t//\n\t// We do this by having the thread that grabs the lock save its threadID\n\t// in the global currentLockOwner map.\n\twaiters := numThreads - 1\n\tvar prevOwner int64 = -1\n\tfor i = 0; i < numThreads; i++ {\n\n\twaitForLockAcquire:\n\t\tmutex.Lock()\n\t\towner, ok := currentLockOwner[s1]\n\t\tif !ok {\n\t\t\tmutex.Unlock()\n\t\t\t// Lock is not yet held, let us wait\n\t\t\ttime.Sleep(5 * time.Millisecond)\n\t\t\tgoto waitForLockAcquire\n\t\t}\n\t\tmutex.Unlock()\n\n\t\tif int64(owner) == prevOwner {\n\t\t\t// We ran before the next caller is able to grab the lock. Let us wait and retry again:\n\t\t\ttime.Sleep(5 * time.Millisecond)\n\t\t\tgoto waitForLockAcquire\n\t\t}\n\n\t\tprevOwner = int64(owner)\n\t\tsendRequestToThread(owner, t, unlock, s1)\n\n\t\t// Wait until next thread picks up lock\n\t\tif waiters > 0 {\n\t\t\twaiters--\n\t\t\twaitCountWaiters(s1, waiters)\n\t\t}\n\t}\n\twaitCountWaiters(s1, 0)\n\twaitCountOwners(s1, 0)\n\n\t// Stop worker threads\n\tstopThreads(t)\n}", "title": "" }, { "docid": "9006dd1490553943df35bcf9615d6313", "score": "0.5733267", "text": "func TestRWLockAcquireAndReleaseLocksReadBlocksWriteNoRaceDetection(t *testing.T) {\n\tskipRWLockTestIfRaceDetectionEnabled(t)\n\n\tcode := `\n require 'concurrent/rw_lock'\n\n lock = Concurrent::RWLock.new\n message = nil\n\n thread do\n lock.acquire_read_lock\n sleep 2\n message ||= \"thread 1\"\n lock.release_read_lock\n end\n\n thread do\n sleep 1\n lock.acquire_write_lock\n message ||= \"thread 2\"\n lock.release_write_lock\n end\n\n sleep 3\n lock.with_read_lock do\n message\n end\n `\n\n\texpected := \"thread 1\"\n\n\tv := initTestVM()\n\tevaluated := v.testEval(t, code, getFilename())\n\tverifyStringObject(t, i, evaluated, expected)\n\tv.checkCFP(t, i, 0)\n\tv.checkSP(t, i, 1)\n}", "title": "" }, { "docid": "33f214e36a1a11ef3f93833de1d674c8", "score": "0.57247955", "text": "func (image *Image) LockManage() error {\n return image.Lock(2)\n}", "title": "" }, { "docid": "9609eb7146b0524e84d91da366885207", "score": "0.57215464", "text": "func (rl RedisLock) Lock(key string, second int64) (bool, error) {\n\n\tif key == \"\" {\n\t\treturn false, fmt.Errorf(\"key can not be null\")\n\t}\n\n\tif second <= 0 {\n\t\treturn false, fmt.Errorf(\"second should greater than 0\")\n\t}\n\n\tclient, err := rl.getClient()\n\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"redis ping error %v\", err)\n\t}\n\n\td := time.Duration(second) * time.Second\n\n\tf, err := client.SetNX(key, 1, d).Result()\n\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"redis setnx error %v\", err)\n\t}\n\n\treturn f, nil\n}", "title": "" }, { "docid": "e025eaaf8748b516de3e8e5021060c91", "score": "0.57192004", "text": "func (m *Mutex) TryLock() bool {\n\tif m.state.Cas(0, -1) {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "6f4b63a05e22bd6be453b56c0a73c47d", "score": "0.5714819", "text": "func (_m *MockmdServerLocal) TruncateLock(ctx context.Context, id tlf.ID) (bool, error) {\n\tret := _m.ctrl.Call(_m, \"TruncateLock\", ctx, id)\n\tret0, _ := ret[0].(bool)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "e786e2bb45c62283f736e95e690efa3d", "score": "0.5707523", "text": "func (cl *CASLocker) TryLock() bool {\n\tif atomic.CompareAndSwapInt32((*int32)(unsafe.Pointer(&cl.mutex)), Unlocked, Locked) {\n\t\tatomic.AddInt32(cl.status, Locked)\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "909fb20a28d1b8e5ef3a24dfa113db17", "score": "0.5706101", "text": "func (m *DebugLock) Lock() {\n\ts := RandomString(10)\n\tlog.Info(fmt.Sprintf(\"try DebugLock lock %s\", s))\n\tm.Mutex.Lock()\n\tm.name = s\n\tlog.Info(fmt.Sprintf(\"%s DebugLock locked\", s))\n}", "title": "" }, { "docid": "6420afd5160c0658e8ce8f84ae8bc468", "score": "0.5695638", "text": "func TestLockRaceRegression(t *testing.T) {\n\tdefer leaktest.Check(t)()\n\n\thdone := make(chan struct{})\n\tlocal := server.NewLocal(handler.Map{\n\t\t// Do some busy-work and then try to get the server lock, in this case\n\t\t// via the CancelRequest helper.\n\t\t\"Kill\": handler.New(func(ctx context.Context, req *jrpc2.Request) error {\n\t\t\tdefer close(hdone) // signal we passed the deadlock point\n\n\t\t\tvar id string\n\t\t\tif err := req.UnmarshalParams(&handler.Args{&id}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tjrpc2.ServerFromContext(ctx).CancelRequest(id)\n\t\t\treturn nil\n\t\t}),\n\n\t\t// Block indefinitely, just to give the dispatcher something to do.\n\t\t\"Stall\": handler.New(func(ctx context.Context) error {\n\t\t\t<-ctx.Done()\n\t\t\treturn ctx.Err()\n\t\t}),\n\t}, nil)\n\tdefer local.Close()\n\n\tctx := context.Background()\n\tlocal.Client.Notify(ctx, \"Kill\", handler.Args{\"1\"})\n\n\tgo local.Client.Call(ctx, \"Stall\", nil)\n\n\tselect {\n\tcase <-time.After(10 * time.Second):\n\t\tt.Fatal(\"Notification handler is probably deadlocked\")\n\tcase <-hdone:\n\t\tt.Log(\"Notification handler completed successfully\")\n\t}\n}", "title": "" }, { "docid": "9881b786d7dc132fb69e2d4cf8ae92e5", "score": "0.5695039", "text": "func (m *MockLockerService) Unlock(arg0 context.Context, arg1, arg2 string) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Unlock\", arg0, arg1, arg2)\n}", "title": "" }, { "docid": "54de11ff0066076780e6f7aace970fc3", "score": "0.56891847", "text": "func (c *Calcium) Lock(ctx context.Context, name string, timeout int) (lock.DistributedLock, error) {\n\tlock, err := c.store.CreateLock(name, timeout)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err = lock.Lock(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\treturn lock, nil\n}", "title": "" }, { "docid": "cbe374d4e39e625ba7563a68331d05f5", "score": "0.5686803", "text": "func (*NoCopy) Lock() {}", "title": "" }, { "docid": "cbe374d4e39e625ba7563a68331d05f5", "score": "0.5686803", "text": "func (*NoCopy) Lock() {}", "title": "" }, { "docid": "cbe374d4e39e625ba7563a68331d05f5", "score": "0.5686803", "text": "func (*NoCopy) Lock() {}", "title": "" }, { "docid": "d4425e37ea08cbedc83a233764544d8d", "score": "0.5681574", "text": "func testTryLock(locker TryLocker, goroutines int, n int) int {\n\tups, downs := 10*goroutines, 7*goroutines\n\tarr := buildUpDowns(ups, downs)\n\t// fmt.Println(arr)\n\tcount := 0\n\twg := sync.WaitGroup{}\n\tfor g := 0; g < goroutines; g++ {\n\t\twg.Add(1)\n\t\tg := g\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tfor j := 0; j < 17; j++ {\n\t\t\t\t\tb := arr[17*g+j]\n\t\t\t\t\tif j <= 10 {\n\t\t\t\t\t\tfor !locker.TryLock() {\n\t\t\t\t\t\t\t// fmt.Println(\"TryAgain\")\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlocker.Lock()\n\t\t\t\t\t}\n\t\t\t\t\tif b {\n\t\t\t\t\t\tcount++\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcount--\n\t\t\t\t\t}\n\t\t\t\t\ttime.Sleep(100 * time.Millisecond)\n\t\t\t\t\tlocker.Unlock()\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\twg.Wait()\n\tif count != 3*goroutines*n {\n\t\tpanic(fmt.Errorf(\"Invalid count=%v go=%v n=%v\", count, goroutines, n))\n\t}\n\treturn count\n}", "title": "" }, { "docid": "e65e2ad5768e29fbd7a227d4edb61d1c", "score": "0.568027", "text": "func (this *StringsLock) TryLock(name string) bool {\n\tthis.lock.Lock()\n\tdefer this.lock.Unlock()\n\n\t_, ok := this.strings[name]\n\tif !ok {\n\t\tthis.strings[name] = struct{}{}\n\t}\n\treturn !ok\n}", "title": "" }, { "docid": "63a41f6fd3425ee9d2e7c48d8bdb7656", "score": "0.567337", "text": "func AssertLocked(m *sync.Mutex) {\n\tif m.TryLock() {\n\t\tm.Unlock()\n\t\tpanic(\"mutex is not locked\")\n\t}\n}", "title": "" }, { "docid": "a7b80192ccd73fa5b426233d1d2dd7d6", "score": "0.5652097", "text": "func (c *Client) LockWithTimeout(name, key string, timeout time.Duration) error {\n\tscheme, server, err := c.pickHost()\n\tif err != nil {\n\t\treturn err\n\t}\n\ttarget := url.URL{\n\t\tScheme: scheme,\n\t\tHost: server,\n\t\tPath: path.Join(\"/ex/lock-with-timeout/\", name, key),\n\t}\n\tq := target.Query()\n\tq.Set(\"t\", timeout.String())\n\ttarget.RawQuery = q.Encode()\n\t_, err = c.doRequest(http.MethodGet, target, nil)\n\treturn err\n}", "title": "" }, { "docid": "a0ea69888e6ee827041c9105119eadf9", "score": "0.56460434", "text": "func (m *MockOrderService) LockOrder(request request.LockOrderRequest) (response.OrderResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LockOrder\", request)\n\tret0, _ := ret[0].(response.OrderResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b4b0876679ebe3687c64f056957da0a4", "score": "0.56457293", "text": "func (memLock *InMemFileLock) TryLock() (bool, error) {\n\tif atomic.CompareAndSwapInt32(&memLock.state, unlockedStateValue, lockedStateValue) {\n\t\treturn true, nil\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "afd19adf71128c2d975bdb485209d147", "score": "0.56419116", "text": "func (kvclient *MockResKVClient) AcquireLock(ctx context.Context, lockName string, timeout time.Duration) error {\n\treturn nil\n}", "title": "" }, { "docid": "ff9a0e2fe17b6953280f8c224a50b918", "score": "0.5638511", "text": "func (s *Semaphore) TryLock() bool {\n\tselect {\n\tcase <-s.locks:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "87036f9da443010d78054c265651b0c4", "score": "0.5621039", "text": "func (card *Smartcard) Lock(pan *Panaccess) error {\n\t//Params\n\tparams := url.Values{}\n\tparams.Add(\"smartcardId\", card.SN)\n\t//Call Function\n\tresp, err := pan.Call(\n\t\t\"disableSmartcard\",\n\t\t&params,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !resp.Success {\n\t\treturn errors.New(resp.ErrorMessage)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "30215f3c243e9ffdfd47ba1d0efff3b3", "score": "0.5618768", "text": "func (s *Service) Lock(ctx context.Context,\n\tcredentials *checker.Credentials,\n\taccountName string,\n) (\n\tcore.Result,\n\terror,\n) {\n\tstarted := time.Now()\n\n\tif credentials == nil {\n\t\tlog.Error().Msg(\"No credentials supplied\")\n\t\treturn core.ResultFailed, nil\n\t}\n\n\tlog := log.With().\n\t\tStr(\"request_id\", credentials.RequestID).\n\t\tStr(\"client\", credentials.Client).\n\t\tStr(\"account\", accountName).\n\t\tStr(\"action\", \"Lock\").\n\t\tLogger()\n\tlog.Trace().Msg(\"Request received\")\n\n\twallet, account, checkRes := s.preCheck(ctx, credentials, accountName, nil, ruler.ActionLockAccount)\n\tif checkRes != core.ResultSucceeded {\n\t\ts.monitor.AccountManagerCompleted(started, \"lock\", checkRes)\n\t\treturn checkRes, nil\n\t}\n\n\t// Confirm approval via rules.\n\tresult := s.ruler.RunRules(ctx, credentials, ruler.ActionLockAccount, wallet.Name(), account.Name(), account.PublicKey().Marshal(), &rules.LockAccountData{})\n\tswitch result {\n\tcase rules.DENIED:\n\t\tlog.Debug().Str(\"result\", \"denied\").Msg(\"Denied by rules\")\n\t\ts.monitor.AccountManagerCompleted(started, \"lock\", core.ResultDenied)\n\t\treturn core.ResultDenied, nil\n\tcase rules.FAILED:\n\t\tlog.Error().Str(\"result\", \"failed\").Msg(\"Rules check failed\")\n\t\ts.monitor.AccountManagerCompleted(started, \"lock\", core.ResultFailed)\n\t\treturn core.ResultFailed, nil\n\t}\n\n\t// Lock it.\n\tlocker, isLocker := account.(e2wtypes.AccountLocker)\n\tif !isLocker {\n\t\t// We cannot lock this account, it may be through external means\n\t\t// (for example, a hardware key). We return success to allow the\n\t\t// control flow to proceed.\n\t\tlog.Debug().Str(\"result\", \"succeeded\").Msg(\"Not a lockable account\")\n\t\ts.monitor.AccountManagerCompleted(started, \"lock\", core.ResultSucceeded)\n\t\treturn core.ResultSucceeded, nil\n\t}\n\n\tif err := locker.Lock(ctx); err != nil {\n\t\tlog.Warn().Err(err).Str(\"result\", \"denied\").Msg(\"Failed to lock\")\n\t\ts.monitor.AccountManagerCompleted(started, \"lock\", core.ResultDenied)\n\t\treturn core.ResultDenied, nil\n\t}\n\n\tlog.Trace().Str(\"result\", \"succeeded\").Msg(\"Success\")\n\ts.monitor.AccountManagerCompleted(started, \"lock\", core.ResultSucceeded)\n\treturn core.ResultSucceeded, nil\n}", "title": "" } ]
1d99aff9616a99bbc760b57244f410b6
BalanceOf is a free data retrieval call binding the contract method 0x70a08231. Solidity: function balanceOf(_holder address) constant returns(uint256)
[ { "docid": "006781647f21320e0675824095b3b061", "score": "0.8177535", "text": "func (_RTCoin *RTCoinCaller) BalanceOf(opts *bind.CallOpts, _holder common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _RTCoin.contract.Call(opts, out, \"balanceOf\", _holder)\n\treturn *ret0, err\n}", "title": "" } ]
[ { "docid": "da3428fa3d562c14403091dbe3cfa4e3", "score": "0.8166848", "text": "func (_ZapToken *ZapTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\r\n\tvar (\r\n\t\tret0 = new(*big.Int)\r\n\t)\r\n\tout := ret0\r\n\terr := _ZapToken.contract.Call(opts, out, \"balanceOf\", _owner)\r\n\treturn *ret0, err\r\n}", "title": "" }, { "docid": "a0fc2ef241e22b4139e611267a5a9f26", "score": "0.81295186", "text": "func (_MintableToken *MintableTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\r\n\tvar (\r\n\t\tret0 = new(*big.Int)\r\n\t)\r\n\tout := ret0\r\n\terr := _MintableToken.contract.Call(opts, out, \"balanceOf\", _owner)\r\n\treturn *ret0, err\r\n}", "title": "" }, { "docid": "572293d190828c849b0f48fa5f2979c9", "score": "0.8113148", "text": "func (_DummyERC721Token *DummyERC721TokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _DummyERC721Token.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "ca1a5382593424efe0627003092289cb", "score": "0.8090519", "text": "func (_BurnableToken *BurnableTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _BurnableToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "288394b9271637e2925e479cc1ad2ac7", "score": "0.8086794", "text": "func (_ZapGetters *ZapGettersCaller) BalanceOf(opts *bind.CallOpts, _user common.Address) (*big.Int, error) {\r\n\tvar (\r\n\t\tret0 = new(*big.Int)\r\n\t)\r\n\tout := ret0\r\n\terr := _ZapGetters.contract.Call(opts, out, \"balanceOf\", _user)\r\n\treturn *ret0, err\r\n}", "title": "" }, { "docid": "672f13d64335ea13b435f0970e2aea59", "score": "0.80815285", "text": "func (_Token *TokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Token.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "672f13d64335ea13b435f0970e2aea59", "score": "0.80815285", "text": "func (_Token *TokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Token.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "1a2c6537ef1cf16597c005c083e21f9b", "score": "0.8078906", "text": "func (_BasToken *BasTokenCaller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _BasToken.contract.Call(opts, out, \"balanceOf\", owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "dc3b1cd44835e5cd839fcd609bb04692", "score": "0.80782115", "text": "func (_MintableToken *MintableTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _MintableToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "dc3b1cd44835e5cd839fcd609bb04692", "score": "0.80782115", "text": "func (_MintableToken *MintableTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _MintableToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "fdf4c414f1b4111f7db0659d0aa91287", "score": "0.80642694", "text": "func (_EthToken *EthTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _EthToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "4ea2e2a11c5d472bea41b92b5a6f96b5", "score": "0.80569524", "text": "func (_LivepeerToken *LivepeerTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _LivepeerToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "1393afd4174e051092ce9c9244850013", "score": "0.8056511", "text": "func (_WETH9 *WETH9) BalanceOf(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _WETH9.Call(opts, out, \"balanceOf\", arg0)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "72fd35fc5bb1c7df65f13fc4879937a3", "score": "0.8054645", "text": "func (_StarNFT *StarNFTCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _StarNFT.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "d0ca0bb1af41894efb05316a72868fc5", "score": "0.8051436", "text": "func (_ERC721Metadata *ERC721MetadataCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC721Metadata.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "d0ca0bb1af41894efb05316a72868fc5", "score": "0.8051436", "text": "func (_ERC721Metadata *ERC721MetadataCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC721Metadata.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "0ea0fe1456f3e83a96371d2c85608692", "score": "0.8049788", "text": "func (_Portalv3 *Portalv3Caller) BalanceOf(opts *bind.CallOpts, token common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Portalv3.contract.Call(opts, out, \"balanceOf\", token)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "7758b8877df63ac9a4365664a7aed2b5", "score": "0.8046865", "text": "func (_BEP20 *BEP20Caller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _BEP20.contract.Call(opts, &out, \"balanceOf\", account)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "69e99b7fa55abfc887397fa8570cec06", "score": "0.8043699", "text": "func (_EtherollToken *EtherollTokenCaller) BalanceOf(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _EtherollToken.contract.Call(opts, out, \"balanceOf\", arg0)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "c78249a9b6b9aaf4f9a7a2fcbca2836b", "score": "0.8041863", "text": "func (_SonmDummyToken *SonmDummyTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _SonmDummyToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "37fb1ee3086cb8cfe3dc05099004d647", "score": "0.80333394", "text": "func (_CryptoContract *CryptoContractCaller) BalanceOf(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _CryptoContract.contract.Call(opts, out, \"balanceOf\", arg0)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "b8cbbcd263fcd4271562545d85505130", "score": "0.80330735", "text": "func (_Safemoon *SafemoonCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Safemoon.contract.Call(opts, &out, \"balanceOf\", account)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "f2edb5a8cbf2cbb2bd2c2d38645ff5eb", "score": "0.80322593", "text": "func (_BasicToken *BasicTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\r\n\tvar (\r\n\t\tret0 = new(*big.Int)\r\n\t)\r\n\tout := ret0\r\n\terr := _BasicToken.contract.Call(opts, out, \"balanceOf\", _owner)\r\n\treturn *ret0, err\r\n}", "title": "" }, { "docid": "60ae149fc0507690f37a877482083088", "score": "0.80290216", "text": "func (_TokenERC20 *TokenERC20Caller) BalanceOf(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _TokenERC20.contract.Call(opts, out, \"balanceOf\", arg0)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "ac4c3e4c7f91af8a7e85d06c82b8ac15", "score": "0.80172706", "text": "func (_WETH *WETHCaller) BalanceOf(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _WETH.contract.Call(opts, &out, \"balanceOf\", arg0)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "39020dfcca195eb410e7ad660ba91142", "score": "0.8013394", "text": "func (_ZapMaster *ZapMasterCaller) BalanceOf(opts *bind.CallOpts, _user common.Address) (*big.Int, error) {\r\n\tvar (\r\n\t\tret0 = new(*big.Int)\r\n\t)\r\n\tout := ret0\r\n\terr := _ZapMaster.contract.Call(opts, out, \"balanceOf\", _user)\r\n\treturn *ret0, err\r\n}", "title": "" }, { "docid": "7d2bdd1dce0b078c34521b7021542a61", "score": "0.80115384", "text": "func (_Pxc *PxcCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Pxc.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "d8b5d86a2e2378fb299eaa79caada992", "score": "0.80052584", "text": "func (_StandardToken *StandardTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\r\n\tvar (\r\n\t\tret0 = new(*big.Int)\r\n\t)\r\n\tout := ret0\r\n\terr := _StandardToken.contract.Call(opts, out, \"balanceOf\", _owner)\r\n\treturn *ret0, err\r\n}", "title": "" }, { "docid": "c8d0f17c363b9ebc9e33b4ec3c29f79e", "score": "0.799005", "text": "func (_IUniswapV2ERC20 *IUniswapV2ERC20Caller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _IUniswapV2ERC20.contract.Call(opts, &out, \"balanceOf\", owner)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "96e22416de1cb21b4f4094e07a6b3cee", "score": "0.79900146", "text": "func (_Tellor *TellorCaller) BalanceOf(opts *bind.CallOpts, _user common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Tellor.contract.Call(opts, &out, \"balanceOf\", _user)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "050f1bc661ff3871621770fe5e44ccf9", "score": "0.79898614", "text": "func (_MintableToken *MintableTokenCaller) BalanceOf(opts *bind.CallOptsWithNumber, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _MintableToken.contract.CallWithNumber(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "4c587dcea1f6687118a5acd08aacc8f9", "score": "0.79834926", "text": "func (_BasicToken *BasicTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _BasicToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "4c587dcea1f6687118a5acd08aacc8f9", "score": "0.79834926", "text": "func (_BasicToken *BasicTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _BasicToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "6198eebe83705093ed797f22f8a54d26", "score": "0.79830265", "text": "func (_UniswapV2ERC20 *UniswapV2ERC20Caller) BalanceOf(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _UniswapV2ERC20.contract.Call(opts, &out, \"balanceOf\", arg0)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "1c4471e53bef2297363eb929fd42a0f6", "score": "0.79771566", "text": "func (_SampleToken *SampleTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _SampleToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "9ee9672273b0650b314c67ae0e975a90", "score": "0.79767996", "text": "func (_ERC721Token *ERC721TokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC721Token.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "9ee9672273b0650b314c67ae0e975a90", "score": "0.79767996", "text": "func (_ERC721Token *ERC721TokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC721Token.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "f2e96644068889a801af94baf74f1a57", "score": "0.79678905", "text": "func (_ERC721Basic *ERC721BasicCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC721Basic.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "f2e96644068889a801af94baf74f1a57", "score": "0.79678905", "text": "func (_ERC721Basic *ERC721BasicCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC721Basic.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "2711e831b3fc0bf53d141eb7ab1922e6", "score": "0.7965024", "text": "func (_LegacyERC20ETH *LegacyERC20ETHCaller) BalanceOf(opts *bind.CallOpts, _who common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _LegacyERC20ETH.contract.Call(opts, &out, \"balanceOf\", _who)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "08b64960828ebe3eec1004c653f10e37", "score": "0.7959751", "text": "func (_StandardToken *StandardTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _StandardToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "08b64960828ebe3eec1004c653f10e37", "score": "0.7959751", "text": "func (_StandardToken *StandardTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _StandardToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "08b64960828ebe3eec1004c653f10e37", "score": "0.7959751", "text": "func (_StandardToken *StandardTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _StandardToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "516898f17076aac632b4b7d7bde38f37", "score": "0.7958133", "text": "func (_NPT *NPTCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _NPT.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "fc90c08459cd901e80dae78297354cd3", "score": "0.79516846", "text": "func (_Pxa721 *Pxa721Caller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Pxa721.contract.Call(opts, out, \"balanceOf\", owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "c816ccf70b3691af8b1135bb33fd3d59", "score": "0.7949919", "text": "func (_IERC20 *IERC20Caller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _IERC20.contract.Call(opts, &out, \"balanceOf\", owner)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "462e54f4b263311146f0c2001947623b", "score": "0.794728", "text": "func (_Token *TokenCaller) BalanceOf(opts *bind.CallOpts, tokenOwner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Token.contract.Call(opts, out, \"balanceOf\", tokenOwner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "da9851daa271ba3e5818a1a6b8f06224", "score": "0.79430807", "text": "func (cc *Controller) BalanceOf(stub shim.ChaincodeStubInterface, params []string) sc.Response {\n\tif len(params) != 1 {\n\t\treturn shim.Error(\"the number of params must be one\")\n\t}\n\n\taddress := params[0]\n\n\tbalanceByte, err := stub.GetState(address)\n\tCheckErr(err, `stub.GetState(\"owner\")`)\n\tif balanceByte == nil {\n\t\treturn shim.Error(\"balanceByte is nil\")\n\t}\n\n\tfmt.Println(address + \"'s, balance is \" + string(balanceByte))\n\treturn shim.Success(balanceByte)\n}", "title": "" }, { "docid": "b5439cfa12db11aaf21c959c099953fa", "score": "0.7937244", "text": "func (_ERC721BasicToken *ERC721BasicTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC721BasicToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "b5439cfa12db11aaf21c959c099953fa", "score": "0.7937244", "text": "func (_ERC721BasicToken *ERC721BasicTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC721BasicToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "6da789e95d147c8a211da5d44b6459c6", "score": "0.7931086", "text": "func (_ERC721 *ERC721Caller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC721.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "6da789e95d147c8a211da5d44b6459c6", "score": "0.7931086", "text": "func (_ERC721 *ERC721Caller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC721.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "17168549658cd24d83e0cc0bbbd849d0", "score": "0.79164785", "text": "func (_BasicToken *BasicTokenCaller) BalanceOf(opts *bind.CallOptsWithNumber, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _BasicToken.contract.CallWithNumber(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "19beaf3d81303f781171faf4a3122fe6", "score": "0.79100543", "text": "func (_BikeCoin *BikeCoinCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _BikeCoin.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "bead1ea6a674d164bd1a359448417613", "score": "0.7909017", "text": "func (_ERC23TokenMock *ERC23TokenMockCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC23TokenMock.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "3c3c37b50800edbe45dce5e5eddffd1a", "score": "0.7908334", "text": "func (_ERC721Enumerable *ERC721EnumerableCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC721Enumerable.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "3c3c37b50800edbe45dce5e5eddffd1a", "score": "0.7908334", "text": "func (_ERC721Enumerable *ERC721EnumerableCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC721Enumerable.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "4de29f06f19f4f680e1e1f91cbbcc29c", "score": "0.7907493", "text": "func (_ReporterToken *ReporterTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ReporterToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "75b6ed8d3020825fef1273d6994221ff", "score": "0.790307", "text": "func (_ERC20Basic *ERC20BasicCaller) BalanceOf(opts *bind.CallOpts, who common.Address) (*big.Int, error) {\r\n\tvar (\r\n\t\tret0 = new(*big.Int)\r\n\t)\r\n\tout := ret0\r\n\terr := _ERC20Basic.contract.Call(opts, out, \"balanceOf\", who)\r\n\treturn *ret0, err\r\n}", "title": "" }, { "docid": "24509a88ea775cc871a1334cbe1b5e6b", "score": "0.79007953", "text": "func (_BasMiner *BasMinerCaller) BalanceOf(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _BasMiner.contract.Call(opts, out, \"balanceOf\", arg0)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "db9e4661a30ba42901d0666b3ed17f36", "score": "0.78962725", "text": "func (_ERC20 *ERC20Caller) BalanceOf(opts *bind.CallOpts, who common.Address) (*big.Int, error) {\r\n\tvar (\r\n\t\tret0 = new(*big.Int)\r\n\t)\r\n\tout := ret0\r\n\terr := _ERC20.contract.Call(opts, out, \"balanceOf\", who)\r\n\treturn *ret0, err\r\n}", "title": "" }, { "docid": "aa263e33635ca0370c5da92cac2de349", "score": "0.7893431", "text": "func (_ITellor *ITellorCaller) BalanceOf(opts *bind.CallOpts, _user common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _ITellor.contract.Call(opts, &out, \"balanceOf\", _user)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "3982494fd908a8d433775281adee0fe9", "score": "0.7880318", "text": "func (_UniswapV2Pair *UniswapV2PairCaller) BalanceOf(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _UniswapV2Pair.contract.Call(opts, &out, \"balanceOf\", arg0)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "f0d6fb8c3599e460960347fdab1e2db6", "score": "0.78752065", "text": "func (_StandardToken *StandardTokenCaller) BalanceOf(opts *bind.CallOptsWithNumber, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _StandardToken.contract.CallWithNumber(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "4d442ceb79380bac5e1e3b480051f7b8", "score": "0.7872512", "text": "func (_ERC20Basic *ERC20BasicCaller) BalanceOf(opts *bind.CallOpts, who common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC20Basic.contract.Call(opts, out, \"balanceOf\", who)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "4d442ceb79380bac5e1e3b480051f7b8", "score": "0.7872512", "text": "func (_ERC20Basic *ERC20BasicCaller) BalanceOf(opts *bind.CallOpts, who common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC20Basic.contract.Call(opts, out, \"balanceOf\", who)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "4d442ceb79380bac5e1e3b480051f7b8", "score": "0.7872512", "text": "func (_ERC20Basic *ERC20BasicCaller) BalanceOf(opts *bind.CallOpts, who common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC20Basic.contract.Call(opts, out, \"balanceOf\", who)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "12ee9b12042ba6070826c3375c69af74", "score": "0.7869559", "text": "func (_IUniswapV2Pair *IUniswapV2PairCaller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _IUniswapV2Pair.contract.Call(opts, &out, \"balanceOf\", owner)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "df57933b42204b42eece84d780133de1", "score": "0.7868605", "text": "func (_BToken *BTokenCaller) BalanceOf(opts *bind.CallOpts, whom common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _BToken.contract.Call(opts, &out, \"balanceOf\", whom)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "fe58ba4ba69c3fe2802a31eaca4520e3", "score": "0.78536755", "text": "func (_IBEP20 *IBEP20Caller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _IBEP20.contract.Call(opts, &out, \"balanceOf\", account)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "02cccd560aa5955b64f805f81ea01476", "score": "0.7847538", "text": "func (_WETH *WETHSession) BalanceOf(arg0 common.Address) (*big.Int, error) {\n\treturn _WETH.Contract.BalanceOf(&_WETH.CallOpts, arg0)\n}", "title": "" }, { "docid": "568b1b8ff7e85d4b9a76f215aa182023", "score": "0.78462225", "text": "func (_ERC20 *ERC20Caller) BalanceOf(opts *bind.CallOpts, who common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC20.contract.Call(opts, out, \"balanceOf\", who)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "568b1b8ff7e85d4b9a76f215aa182023", "score": "0.78462225", "text": "func (_ERC20 *ERC20Caller) BalanceOf(opts *bind.CallOpts, who common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC20.contract.Call(opts, out, \"balanceOf\", who)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "568b1b8ff7e85d4b9a76f215aa182023", "score": "0.78462225", "text": "func (_ERC20 *ERC20Caller) BalanceOf(opts *bind.CallOpts, who common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC20.contract.Call(opts, out, \"balanceOf\", who)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "980d66b2c5f5ea2853b0807cb3173a4f", "score": "0.7839754", "text": "func (_ExampleToken *ExampleTokenCaller) BalanceOf(opts *bind.CallOptsWithNumber, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ExampleToken.contract.CallWithNumber(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "2389218c005670c24590fa835200eb47", "score": "0.7839507", "text": "func (_TellorTransfer *TellorTransferCaller) BalanceOf(opts *bind.CallOpts, _user common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _TellorTransfer.contract.Call(opts, &out, \"balanceOf\", _user)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "74548a1f52643fe92302e78c4ab73457", "score": "0.78277135", "text": "func (_Token *TokenCaller) BalanceOf(opts *bind.CallOptsWithNumber, who common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Token.contract.CallWithNumber(opts, out, \"balanceOf\", who)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "b55e1804a8f685d1d34be776cc8d785d", "score": "0.78264344", "text": "func (_RTCoin *RTCoinSession) BalanceOf(_holder common.Address) (*big.Int, error) {\n\treturn _RTCoin.Contract.BalanceOf(&_RTCoin.CallOpts, _holder)\n}", "title": "" }, { "docid": "3737e2c13d9b567b3960380912a9d963", "score": "0.7823691", "text": "func (_TellorStake *TellorStakeCaller) BalanceOf(opts *bind.CallOpts, _user common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _TellorStake.contract.Call(opts, &out, \"balanceOf\", _user)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "d4d0eebfe699fa15fef9a064b07efecc", "score": "0.7815937", "text": "func (_RBACMintableToken *RBACMintableTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _RBACMintableToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "1ef8cf3bc7c073afe4c63626a5d9c498", "score": "0.7813182", "text": "func (_IERC20 *IERC20Caller) BalanceOf(opts *bind.CallOpts, whom common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _IERC20.contract.Call(opts, &out, \"balanceOf\", whom)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "dd275e51a1c7a261ff26d7ceebad007a", "score": "0.7802658", "text": "func (_SyrupBar *SyrupBarCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _SyrupBar.contract.Call(opts, &out, \"balanceOf\", account)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "ca1b871d16789ffe883cf52f2f70161e", "score": "0.78019553", "text": "func (_WETH *WETHCallerSession) BalanceOf(arg0 common.Address) (*big.Int, error) {\n\treturn _WETH.Contract.BalanceOf(&_WETH.CallOpts, arg0)\n}", "title": "" }, { "docid": "e25c2734158e7ed4c93d46384a982030", "score": "0.77991474", "text": "func (_CryptoContract *CryptoContractSession) BalanceOf(arg0 common.Address) (*big.Int, error) {\n\treturn _CryptoContract.Contract.BalanceOf(&_CryptoContract.CallOpts, arg0)\n}", "title": "" }, { "docid": "56f4a98694296afa280e79f8bb49509d", "score": "0.77836674", "text": "func (_CakeToken *CakeTokenCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _CakeToken.contract.Call(opts, &out, \"balanceOf\", account)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "fb480432d6511b6f9394908378986946", "score": "0.7781802", "text": "func (_RTCoin *RTCoinCallerSession) BalanceOf(_holder common.Address) (*big.Int, error) {\n\treturn _RTCoin.Contract.BalanceOf(&_RTCoin.CallOpts, _holder)\n}", "title": "" }, { "docid": "90949184b0a17c07fc2120782878e054", "score": "0.77817225", "text": "func (_ERC20Basic *ERC20BasicCaller) BalanceOf(opts *bind.CallOptsWithNumber, who common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC20Basic.contract.CallWithNumber(opts, out, \"balanceOf\", who)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "d5cd4cc7f1c45053583364cacd4b5b79", "score": "0.7769376", "text": "func (_MattsuCoin *MattsuCoinCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _MattsuCoin.contract.Call(opts, out, \"balanceOf\", account)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "1f99fe809b1f82bc83462ec8f0ea97d6", "score": "0.77504706", "text": "func (_ERC20 *ERC20Caller) BalanceOf(opts *bind.CallOptsWithNumber, who common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC20.contract.CallWithNumber(opts, out, \"balanceOf\", who)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "b0af86f69f19ead766e5279068b7a2df", "score": "0.7741519", "text": "func (_CryptoContract *CryptoContractCallerSession) BalanceOf(arg0 common.Address) (*big.Int, error) {\n\treturn _CryptoContract.Contract.BalanceOf(&_CryptoContract.CallOpts, arg0)\n}", "title": "" }, { "docid": "466404132f392bdd74aff5bed41a55be", "score": "0.7737562", "text": "func (_ERCTwentyDetailed *ERCTwentyDetailedCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _ERCTwentyDetailed.contract.Call(opts, &out, \"balanceOf\", account)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "02d0de9edf666b5242f5eabcb2a8a3ef", "score": "0.77300966", "text": "func (_Coin *CoinCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Coin.contract.Call(opts, &out, \"balanceOf\", account)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "38c6746d222376c95bc6afca885f9d9b", "score": "0.7712277", "text": "func (_StakeDelegatable *StakeDelegatableCaller) BalanceOf(opts *bind.CallOpts, _address common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _StakeDelegatable.contract.Call(opts, out, \"balanceOf\", _address)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "3ebb446b54a3c5f6bb05b9c30530ecff", "score": "0.7691166", "text": "func (_NFT1155 *NFT1155Caller) BalanceOf(opts *bind.CallOpts, account common.Address, id *big.Int) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _NFT1155.contract.Call(opts, &out, \"balanceOf\", account, id)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "20e7317454096a212822f9879003db10", "score": "0.7689115", "text": "func (_IUniswapV2Pair *IUniswapV2PairCallerSession) BalanceOf(owner common.Address) (*big.Int, error) {\n\treturn _IUniswapV2Pair.Contract.BalanceOf(&_IUniswapV2Pair.CallOpts, owner)\n}", "title": "" }, { "docid": "f69b34ec0db03d0256af2b29141ce3e3", "score": "0.7677391", "text": "func (_BPool *BPoolCaller) BalanceOf(opts *bind.CallOpts, whom common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _BPool.contract.Call(opts, &out, \"balanceOf\", whom)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "26c5d73e6b89dfc3c178e37bf9501750", "score": "0.76738137", "text": "func (_ZapGetters *ZapGettersSession) BalanceOf(_user common.Address) (*big.Int, error) {\r\n\treturn _ZapGetters.Contract.BalanceOf(&_ZapGetters.CallOpts, _user)\r\n}", "title": "" }, { "docid": "28a3a7d8f7e9c8bfc85baf0a43936f15", "score": "0.7668908", "text": "func (_ERC20FailingMock *ERC20FailingMockCaller) BalanceOf(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC20FailingMock.contract.Call(opts, out, \"balanceOf\", arg0)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "8c4b899a226a70325188fdffc7f75aa7", "score": "0.7668562", "text": "func (_UniswapV2Pair *UniswapV2PairCallerSession) BalanceOf(arg0 common.Address) (*big.Int, error) {\n\treturn _UniswapV2Pair.Contract.BalanceOf(&_UniswapV2Pair.CallOpts, arg0)\n}", "title": "" }, { "docid": "887d038fa4624d11b83a5e76c5862546", "score": "0.7661898", "text": "func (_TokenERC20 *TokenERC20CallerSession) BalanceOf(arg0 common.Address) (*big.Int, error) {\n\treturn _TokenERC20.Contract.BalanceOf(&_TokenERC20.CallOpts, arg0)\n}", "title": "" } ]
905f3e865552870854644888d1b1b491
Read reads a block of data from an inner stream and reports progress
[ { "docid": "4b1479649779167384ff4b7646ddb640", "score": "0.0", "text": "func (b *retryableRequestBody) Read(p []byte) (n int, err error) {\n\treturn b.body.Read(p)\n}", "title": "" } ]
[ { "docid": "6efc587ef9874a8456e0e5f003e0db53", "score": "0.6852505", "text": "func (r *ProgressReader) Read(b []byte) (int, error) {\n\tn, err := r.Reader.Read(b)\n\tr.progress += n\n\tif err != nil {\n\t\tr.timer.Stop()\n\t}\n\treturn n, err\n}", "title": "" }, { "docid": "14ba16ae76448f84236bbd9d4fd53e5e", "score": "0.68446815", "text": "func (r *streamReader) Read(p []byte) (n int, err error) {\n\tfor n < len(p) {\n\t\tif r.br == nil {\n\t\t\tbh, hlen, err := readBlockHeader(r.xz)\n\t\t\tif err != nil {\n\t\t\t\tif err == errIndexIndicator {\n\t\t\t\t\tif err = r.readTail(); err != nil {\n\t\t\t\t\t\treturn n, err\n\t\t\t\t\t}\n\t\t\t\t\treturn n, io.EOF\n\t\t\t\t}\n\t\t\t\treturn n, err\n\t\t\t}\n\t\t\txlog.Debugf(\"block %v\", *bh)\n\t\t\tr.br, err = r.ReaderConfig.newBlockReader(r.xz, bh,\n\t\t\t\thlen, r.newHash())\n\t\t\tif err != nil {\n\t\t\t\treturn n, err\n\t\t\t}\n\t\t}\n\t\tk, err := r.br.Read(p[n:])\n\t\tn += k\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tr.index = append(r.index, r.br.record())\n\t\t\t\tr.br = nil\n\t\t\t} else {\n\t\t\t\treturn n, err\n\t\t\t}\n\t\t}\n\t}\n\treturn n, nil\n}", "title": "" }, { "docid": "9c3e52b2f5760b2bd6eeb132312d1978", "score": "0.6813584", "text": "func (r *ProgressReader) Read(p []byte) (n int, err error) {\n\tn, err = r.Reader.Read(p)\n\tr.progress.UpdateProgress(int64(n))\n\treturn\n}", "title": "" }, { "docid": "b138c45289543bd5d5e656a7f70caace", "score": "0.6508009", "text": "func (s *StreamingUSReader) Read(buf []byte) (int, error) {\n\tswitch {\n\t// After the last chunk is read from underlying reader, we\n\t// never re-fill s.buf.\n\tcase s.done:\n\n\t// s.buf will be (re-)filled with next chunk when has lesser\n\t// bytes than asked for.\n\tcase s.buf.Len() < len(buf):\n\t\ts.chunkBufLen = 0\n\t\tfor {\n\t\t\tn1, err := s.baseReadCloser.Read(s.chunkBuf[s.chunkBufLen:])\n\t\t\t// Usually we validate `err` first, but in this case\n\t\t\t// we are validating n > 0 for the following reasons.\n\t\t\t//\n\t\t\t// 1. n > 0, err is one of io.EOF, nil (near end of stream)\n\t\t\t// A Reader returning a non-zero number of bytes at the end\n\t\t\t// of the input stream may return either err == EOF or err == nil\n\t\t\t//\n\t\t\t// 2. n == 0, err is io.EOF (actual end of stream)\n\t\t\t//\n\t\t\t// Callers should always process the n > 0 bytes returned\n\t\t\t// before considering the error err.\n\t\t\tif n1 > 0 {\n\t\t\t\ts.chunkBufLen += n1\n\t\t\t\ts.bytesRead += int64(n1)\n\n\t\t\t\tif s.chunkBufLen == payloadChunkSize ||\n\t\t\t\t\t(s.chunkNum == s.totalChunks-1 &&\n\t\t\t\t\t\ts.chunkBufLen == s.lastChunkSize) {\n\t\t\t\t\t// Sign the chunk and write it to s.buf.\n\t\t\t\t\ts.writeChunk(s.chunkBufLen, true)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tif err == io.EOF {\n\t\t\t\t\t// No more data left in baseReader - last chunk.\n\t\t\t\t\t// Done reading the last chunk from baseReader.\n\t\t\t\t\ts.done = true\n\n\t\t\t\t\t// bytes read from baseReader different than\n\t\t\t\t\t// content length provided.\n\t\t\t\t\tif s.bytesRead != s.contentLen {\n\t\t\t\t\t\treturn 0, fmt.Errorf(\"http: ContentLength=%d with Body length %d\", s.contentLen, s.bytesRead)\n\t\t\t\t\t}\n\n\t\t\t\t\t// Sign the chunk and write it to s.buf.\n\t\t\t\t\ts.writeChunk(0, len(s.trailer) == 0)\n\t\t\t\t\tif len(s.trailer) > 0 {\n\t\t\t\t\t\t// Trailer must be set now.\n\t\t\t\t\t\ts.addTrailer(s.trailer)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\treturn 0, err\n\t\t\t}\n\n\t\t}\n\t}\n\treturn s.buf.Read(buf)\n}", "title": "" }, { "docid": "2bca4ea99d4a3785b1dca1279db1e98d", "score": "0.6502404", "text": "func (c *chunks) Read(dat []byte) (int, error) {\r\n\tn, err := c.Reader.Read(dat)\r\n\tc.cChunk += int64(n)\r\n\tif err == nil {\r\n\t\tif c.Size > 0 {\r\n\t\t\tfmt.Printf(\"\\rDownloading (bytes)... %d / %d\", c.cChunk, c.Size)\r\n\t\t} else {\r\n\t\t\tfmt.Printf(\"\\rDownloading (bytes)... %d\", c.cChunk)\r\n\t\t}\r\n\t}\r\n\treturn n, err\r\n}", "title": "" }, { "docid": "a57070035d334b788cba3443c09bf921", "score": "0.64798665", "text": "func (f *FileReader2) Read(p []byte) (n int, err error) {\n\tlog.Printf(\"FileReader2 Read of %d bytes at offset %d\", len(p), f.position)\n\n\tfor len(p) > 0 {\n\t\tremainingBytes := expectedBytes - f.position\n\n\t\tif remainingBytes == 0 {\n\t\t\treturn 0, io.EOF\n\t\t}\n\n\t\t// Start a new http request if there isn't already one in progress.\n\t\tif f.httpResponse == nil {\n\t\t\trequestSize := min(remainingBytes, defaultReadSize)\n\t\t\tlog.Printf(\"remaining %d bytes, sending request for %d bytes\",\n\t\t\t\tremainingBytes, requestSize)\n\t\t\tresp, err := ReadAt(f.driveApi, f.id, requestSize, f.position)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Error calling ReadAt: %v\", err)\n\t\t\t\t// handle http 416 range not satisfiable\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tf.httpResponse = resp\n\t\t}\n\n\t\tn, err = io.ReadFull(f.httpResponse, p)\n\t\tlog.Printf(\"http request returned %d bytes: %v\", n, err)\n\n\t\tif err == io.EOF {\n\t\t\tlog.Printf(\"EOF for http request\")\n\t\t\tf.httpResponse.Close()\n\t\t\tf.httpResponse = nil\n\t\t}\n\n\t\t// Increment the readers position in the file.\n\t\tf.position += int64(n)\n\n\t\t// Point p at the next available space in the buffer.\n\t\tp = p[n:]\n\t}\n\n\treturn n, err\n}", "title": "" }, { "docid": "3c90b1091d20d3a39eec2a338e72b367", "score": "0.6389173", "text": "func (client *Conn) Read(data []byte) (int, error) {\n\tjob := newRillJob(_read, data)\n\tclient.jobs <- job\n\n\tresult := <-job.results\n\tif result.err != nil {\n\t\tresult.err = ErrIOError{_read, result.err}\n\t}\n\treturn result.n, result.err\n}", "title": "" }, { "docid": "f6d83405094cf4c6db386b21d02deb7e", "score": "0.63785535", "text": "func (r *reader) Read(b []byte) (int, error) {\n\tn, err := r.r.Read(b)\n\tr.pos += int64(n)\n\n\tif err != nil && err != io.EOF {\n\t\treturn n, err\n\t}\n\n\tq := readerReport{\n\t\tt: time.Now(),\n\t\tpos: r.pos,\n\t\tsize: r.size,\n\t\tbps: &r.bps,\n\t}\n\n\tselect {\n\tcase r.ch <- q:\n\tcase <-r.ctx.Done():\n\t}\n\n\treturn n, err\n}", "title": "" }, { "docid": "11baff0a42fc1914fdc310792a611e47", "score": "0.6373469", "text": "func (p *chunkedReader) Read(data []byte) (n int, err error) {\n\n // Don't send 0-length data. It looks like EOF for chunked encoding.\n if len(data) == 0 {\n return 0, nil\n }\n\n if p.bytesLeftInChunk != 0 {\n if p.bytesLeftInChunk > int64(len(data)) {\n n, err := p.reader.Read(data)\n p.bytesLeftInChunk -= int64(n)\n return n, err\n }\n n, err := p.reader.Read(data[0 : len(data)-int(p.bytesLeftInChunk)])\n p.bytesLeftInChunk -= int64(n)\n if err != nil {\n return n, err\n }\n n2, err := p.Read(data[n:])\n return n + n2, err\n }\n\n oneByte := make([]byte, 1)\n nl := make([]byte, 2)\n line := make([]byte, 16)\n offset := 0\n if p.endOfSection {\n bytesRead, err := p.reader.Read(nl)\n if err != nil || bytesRead != len(nl) || string(bytesRead) != \"\\r\\n\" {\n return 0, err\n }\n } else {\n p.endOfSection = true\n }\n for {\n bytesRead, err := p.reader.Read(oneByte)\n if err != nil || bytesRead != 1 {\n return 0, err\n }\n if oneByte[0] == '\\r' {\n // discard \\n\n p.reader.Read(oneByte)\n break\n }\n line[offset] = oneByte[0]\n offset++\n }\n p.bytesLeftInChunk, err = strconv.ParseInt(string(line[0:offset+1]), 10, 64)\n if err != nil {\n return 0, err\n }\n return p.Read(data)\n}", "title": "" }, { "docid": "48c559e88de89092d36ae75bd4a3b779", "score": "0.6367058", "text": "func (r *BlobReader) Read(p []byte) (int, error) {\n\tr.readCount++\n\tif r.errOn == r.readCount {\n\t\treturn 0, fmt.Errorf(\"deliberate err at readCount %d\", r.readCount)\n\t}\n\tif r.stopOn == r.readCount {\n\t\tr.stop()\n\t}\n\ttot := r.readChunk(p)\n\tfor tot < len(p) {\n\t\tr.currChunk++\n\t\ttot += r.readChunk(p[tot:])\n\t}\n\treturn tot, nil\n}", "title": "" }, { "docid": "aca37f975210f46f2339b1e5ebc1c6e9", "score": "0.6327147", "text": "func (i *ProgressIndicator) Read(p []byte) (n int, err error) {\n\treturn (*net.ProgressIndicator)(i).Read(p)\n}", "title": "" }, { "docid": "79d475fc77c246a6c4c1152ab02a2505", "score": "0.63151574", "text": "func (c *EndlessReader) Read(p []byte) (int, error) {\n\tc.tb.StopTimer()\n\tvar n int\n\tl := len(p)\n\tm := len(c.data)\n\tfor n < l {\n\t\tnn := copy(p[n:], c.data[c.offset:])\n\t\tn += nn\n\t\tc.offset += nn\n\t\tc.offset %= m\n\t}\n\tc.tb.StartTimer()\n\treturn n, nil\n}", "title": "" }, { "docid": "456976ffdc76cd29ab9afe5b0102c4c3", "score": "0.6207368", "text": "func (s *Stream) Read(p []byte) (int, error) {\n\treturn s.currentReader.Read(p)\n}", "title": "" }, { "docid": "be028a702834a25538002b1b602bc7a0", "score": "0.61812073", "text": "func (c chunkedLimitedReader) Read(p []byte) (n int, err error) {\n\t// If we've already read all our chunks and the remainders are <= 0, we're done\n\tif c.d.doneChunks >= c.d.numChunks || (c.d.remaining <= 0 && c.d.chunkRem <= 0) {\n\t\treturn 0, io.EOF\n\t}\n\n\t// Data is done, returning only buffer bytes now\n\tif c.d.remaining <= 0 {\n\t\tif int64(len(p)) > c.d.chunkRem {\n\t\t\tp = p[0:c.d.chunkRem]\n\t\t}\n\n\t\tfor i := range p {\n\t\t\tp[i] = 0\n\t\t}\n\n\t\tc.d.chunkRem -= int64(len(p))\n\t\treturn len(p), nil\n\t}\n\n\t// Data is not yet done, but chunk is\n\tif c.d.chunkRem <= 0 {\n\t\treturn 0, io.EOF\n\t}\n\n\t// Data and chunk not yet done, need to read from outside reader\n\tif int64(len(p)) > c.d.remaining || int64(len(p)) > c.d.chunkRem {\n\t\trem := int64(math.Min(float64(c.d.remaining), float64(c.d.chunkRem)))\n\t\tp = p[0:rem]\n\t}\n\n\tn, err = c.d.reader.Read(p)\n\tc.d.remaining -= int64(n)\n\tc.d.chunkRem -= int64(n)\n\n\treturn\n}", "title": "" }, { "docid": "478f86f4c536b4cc2babe79cc0697d04", "score": "0.61728793", "text": "func (b *Reader) Read(p []byte) (n int, err error) {}", "title": "" }, { "docid": "f91e121b900e4b492e4eb0fe4d31cd09", "score": "0.61604494", "text": "func httpReadRawStream(httpConnectionInfo *httpConnectionInfo_t, ioTimeOut int) (in_bytes int) {\n\n\t//TODO: use raw stream chunk pool\n\n\t//will try to read 5 * time.Now().Add(time.Duration(ioTimeOut) * time.Second\n\tvar io_try_count int = 0\n\tvar err error\n\tin_bytes = 0\n\n\thttpConnectionInfo.ioError = nil\n\tfor in_bytes == 0 && httpConnectionInfo.ioError == nil {\n\t\t//fmt.Printf(\"read round start, timeout %v, in_bytes %v bytes, tryCount %v.\\r\\n\", ioTimeOut, in_bytes, io_try_count)\n\t\t//fmt.Printf(\"%s\\r\\n\", httpConnectionInfo.ReadBuffer)\n\t\tif ioTimeOut > 0 {\n\t\t\thttpConnectionInfo.conn.SetReadDeadline(time.Now().Add(time.Duration(ioTimeOut) * time.Second))\n\t\t}\n\t\tio_try_count++\n\t\tin_bytes, err = httpConnectionInfo.conn.Read(httpConnectionInfo.ReadBuffer)\n\t\tif err != nil {\n\t\t\t//LEARN: check net error\n\t\t\tif nerr, ok := err.(net.Error); ok {\n\t\t\t\t//fmt.Printf(\"%s\\r\\n\", err.Error())\n\t\t\t\tswitch {\n\t\t\t\tcase ioTimeOut > 0 && (nerr.Timeout() || nerr.Temporary()):\n\t\t\t\t\t//fmt.Printf(\"reading Temporary/TimeOut: \\r\\n\")\n\t\t\t\t\tif io_try_count >= 5 && ioTimeOut > 0 {\n\t\t\t\t\t\t//println(\"Error reading, Temporary/Timeout:\", err.Error())\n\t\t\t\t\t\thttpConnectionSetState(httpConnectionInfo, HttpRequestStateReadTimeOut)\n\t\t\t\t\t\thttpConnectionInfo.ioError = err\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\t//fmt.Printf(\"Error reading: %s/%v\\r\\n\", nerr, nerr)\n\t\t\t\t\thttpConnectionSetState(httpConnectionInfo, HttpRequestStateReadError)\n\t\t\t\t\thttpConnectionInfo.ioError = err\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t//fmt.Printf(\"Error reading: %s/%v\\r\\n\", err, err)\n\t\t\t\thttpConnectionSetState(httpConnectionInfo, HttpRequestStateReadError)\n\t\t\t\thttpConnectionInfo.ioError = err\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\t//fmt.Printf(\"read round end, in_bytes %v bytes, tryCount %v.\\r\\n\", in_bytes, io_try_count)\n\t\t//fmt.Printf(\"%s\\r\\n\", httpConnectionInfo.ReadBuffer)\n\t\t//slicePosition int = 0\n\t}\n\thttpConnectionInfo.ReadRawStream = append(httpConnectionInfo.ReadRawStream, httpConnectionInfo.ReadBuffer[:in_bytes]...)\n\tif httpConnectionInfo.ioError == nil {\n\t\thttpConnectionSetState(httpConnectionInfo, HttpRequestStateReadDone)\n\t}\n\t//fmt.Printf(\"read round end, in_bytes %v bytes, tryCount %v.\\r\\n\", in_bytes, io_try_count)\n\t//fmt.Printf(\"%s\\r\\n\", httpConnectionInfo.ReadRawStream)\n\treturn\n}", "title": "" }, { "docid": "8ddb8d23ea6e21d095b672933f3f2ec6", "score": "0.6149244", "text": "func (c *Client) Read(ctx context.Context, filter *Filter, streamCb StreamCallback) error {\n\treq := &prompb.ReadRequest{\n\t\tQueries: []*prompb.Query{\n\t\t\t{\n\t\t\t\tStartTimestampMs: filter.StartTimestampMs,\n\t\t\t\tEndTimestampMs: filter.EndTimestampMs - 1,\n\t\t\t\tMatchers: c.matchers,\n\t\t\t},\n\t\t},\n\t}\n\tif c.useStream {\n\t\treq.AcceptedResponseTypes = []prompb.ReadRequest_ResponseType{prompb.ReadRequest_STREAMED_XOR_CHUNKS}\n\t}\n\tdata, err := proto.Marshal(req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to marshal read request: %w\", err)\n\t}\n\n\tb := snappy.Encode(nil, data)\n\tif err := c.fetch(ctx, b, streamCb); err != nil {\n\t\tif errors.Is(err, context.Canceled) {\n\t\t\treturn fmt.Errorf(\"fetch request has ben cancelled\")\n\t\t}\n\t\treturn fmt.Errorf(\"error while fetching data from remote storage: %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ff18cc77146e0789fbcf9eb23eb23de9", "score": "0.61245006", "text": "func (r *bufferedReadCloser) Read(p []byte) (n int, err error) {\n\t// Read from the underlying reader like normal.\n\tn, err = r.reader.Read(p)\n\n\t// If buffer isn't full, add to it.\n\tlength := int64(r.buf.Len())\n\tif length < r.max {\n\t\tif length+int64(n) < r.max {\n\t\t\tr.buf.Write(p[:n])\n\t\t} else {\n\t\t\tr.buf.Write(p[:int64(n)-(r.max-length)])\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "e4a33ba3dfa00df02771900ea58cc689", "score": "0.6121687", "text": "func (pr *ReaderProxy) Read(p []byte) (n int, err error) {\n\tn, err = pr.ReadCloser.Read(p)\n\tif n > 0 {\n\t\tpr.bar.IncrBy(n, time.Since(pr.iT))\n\t\tpr.iT = time.Now()\n\t}\n\tif err == io.EOF {\n\t\tgo pr.completer.Complete()\n\t}\n\treturn\n}", "title": "" }, { "docid": "8c1cbacc17d378e6f5d8a065d3d5fc62", "score": "0.6100639", "text": "func (u readCloser) Read(p []byte) (n int, err error) {\n\treturn u.reader.Read(p)\n}", "title": "" }, { "docid": "8c1cbacc17d378e6f5d8a065d3d5fc62", "score": "0.6100639", "text": "func (u readCloser) Read(p []byte) (n int, err error) {\n\treturn u.reader.Read(p)\n}", "title": "" }, { "docid": "60f02b67e83b5279483c843bfe6c4048", "score": "0.6079526", "text": "func (p *BlocksPipeReader) Read(b []byte) (int, error) {\n\tp.mutex.Lock()\n\tdefer p.mutex.Unlock()\n\tif p.pipe == nil {\n\t\tglog.V(1).Infof(\"BlocksPipeReader @ %p already closed\", p)\n\t\treturn 0, io.EOF\n\t}\n\tif p.front != nil {\n\t\tn := copy(b, p.front[p.offset:])\n//\t\tglog.V(1).Infof(\"BlocksPipeReader @ %p copied %d bytes of %d in existing buffer to caller\", p, n, len(p.front) - p.offset)\n\t\tp.offset += n\n\t\tif p.offset >= len(p.front) {\n//\t\t\tglog.V(1).Infof(\"BlocksPipeReader @ %p drained existing buffer\", p)\n\t\t\tp.pipe.empty <- p.front\n\t\t\tp.front = nil\n\t\t}\n\t\treturn n, nil\n\t}\n\tvar ok bool\n\tp.front, ok = <- p.pipe.data\n\tif !ok {\n\t\terr := p.pipe.err\n\t\tglog.V(1).Infof(\"BlocksPipeReader @ %p data channel closed, error: %v\", p, err)\n\t\tp.pipe = nil\n\t\tif err == nil {\n\t\t\terr = io.EOF\n\t\t}\n\t\treturn 0, err\n\t}\n\tn := copy(b, p.front)\n//\tglog.V(1).Infof(\"BlocksPipeReader @ %p copied %d bytes of %d to caller\", p, n, len(p.front))\n\tif n >= len(p.front) {\n\t\tp.pipe.empty <- p.front\n\t\tp.front = nil\n\t} else {\n\t\tp.offset = n\n\t}\n\treturn n, nil\n}", "title": "" }, { "docid": "5d0fd7031d7252bbcd7d8a3f14427fe1", "score": "0.6042336", "text": "func (r *Reader) Read(buf []byte) (int, error) {\n\tif len(buf)%8 != 0 {\n\t\treturn 0, errors.New(\"fpc: []byte passed to Reader.Read must have length which is a multiple of 8\")\n\t}\n\n\tif !r.initialized {\n\t\terr := r.initialize()\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tnRead := 0\n\tfor {\n\t\t// If available, read data from the block.\n\t\tn, err := r.readFromBlock(buf)\n\t\tif err != nil {\n\t\t\treturn n, err\n\t\t}\n\t\tnRead += n\n\t\t// We've read everything we need to.\n\t\tif nRead == len(buf) {\n\t\t\treturn nRead, nil\n\t\t}\n\n\t\t// End of block.\n\t\tif n == 0 {\n\t\t\t// Check whether counts match up.\n\t\t\tif r.block.nRecRead != r.block.nRec {\n\t\t\t\treturn nRead, DataError(\"block record length too short\")\n\t\t\t}\n\t\t\tif r.block.nByteRead != r.block.nByte {\n\t\t\t\treturn nRead, DataError(fmt.Sprintf(\"block byte length too short, have=%d want=%d\", r.block.nByteRead, r.block.nByte))\n\t\t\t}\n\n\t\t\t// Find a new block\n\t\t\tr.block, err = r.readBlockHeader()\n\t\t\tif err != nil {\n\t\t\t\treturn nRead, err\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7a18d52641a6e60cf77dd49321b6b570", "score": "0.602516", "text": "func (a *AsyncReader) Read(p []byte) (n int, err error) {\n\ta.mu.Lock()\n\tdefer a.mu.Unlock()\n\n\t// Swap buffer and maybe return error\n\terr = a.fill()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t// Copy what we can\n\tn = copy(p, a.cur.buffer())\n\ta.cur.increment(n)\n\n\t// If at end of buffer, return any error, if present\n\tif a.cur.isEmpty() {\n\t\ta.err = a.cur.err\n\t\treturn n, a.err\n\t}\n\treturn n, nil\n}", "title": "" }, { "docid": "3ccc02f59a3d9bd5f3e4c7511fe31903", "score": "0.60165274", "text": "func readFull(r io.Reader, b []byte, done <-chan struct{}) (int, error) {\n\ttype result struct {\n\t\tn int\n\t\terr error\n\t}\n\tch := make(chan result, 1)\n\tgo func() {\n\t\t// TODO(adg): this may leak goroutines if the requisite reads\n\t\t// never complete, but will that actually happen? It would be\n\t\t// great to have something like this hooked into the runtime.\n\t\tn, err := io.ReadFull(r, b)\n\t\tch <- result{n, err}\n\t}()\n\tselect {\n\tcase r := <-ch:\n\t\treturn r.n, r.err\n\tcase <-done:\n\t\treturn 0, io.EOF\n\t}\n}", "title": "" }, { "docid": "c8200e11433a01cf7fff6648776c428b", "score": "0.60012305", "text": "func (r *Reader) Read(p []byte) (n int, err error) {\n\t// If we have an open direct reader of a persisted fragment, delegate to it.\n\tif r.direct != nil {\n\n\t\t// Return EOF and close |direct| on reading through EndOffset.\n\t\tif r.Request.EndOffset != 0 {\n\t\t\tif remain := r.Request.EndOffset - r.Request.Offset; remain == 0 {\n\t\t\t\tif err = r.direct.Close(); err == nil {\n\t\t\t\t\tn, err = 0, io.EOF\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t} else if int64(len(p)) > remain {\n\t\t\t\tp = p[:remain]\n\t\t\t}\n\t\t}\n\n\t\tif n, err = r.direct.Read(p); err != nil {\n\t\t\t_ = r.direct.Close()\n\t\t}\n\t\tr.Request.Offset += int64(n)\n\t\treturn\n\t}\n\n\t// Is there remaining content in the last ReadResponse?\n\tif l, d := len(r.Response.Content), int(r.Request.Offset-r.Response.Offset); l != 0 && l > d {\n\t\tn = copy(p, r.Response.Content[d:])\n\t\tr.Request.Offset += int64(n)\n\t\treturn\n\t}\n\n\t// Lazy initialization: begin the Read RPC.\n\tif r.stream == nil {\n\t\tif r.stream, err = r.client.Read(\n\t\t\tpb.WithDispatchItemRoute(r.ctx, r.client, r.Request.Journal.String(), false),\n\t\t\t&r.Request,\n\t\t); err == nil {\n\t\t\tn, err = r.Read(p) // Recurse to attempt read against opened |r.stream|.\n\t\t} else {\n\t\t\terr = mapGRPCCtxErr(r.ctx, err)\n\t\t}\n\t\treturn\n\t}\n\n\t// Read and Validate the next frame.\n\tif err = r.stream.RecvMsg(&r.Response); err == nil {\n\t\tif err = r.Response.Validate(); err != nil {\n\t\t\terr = pb.ExtendContext(err, \"ReadResponse\")\n\t\t} else if r.Response.Status == pb.Status_OK && r.Response.Offset < r.Request.Offset {\n\t\t\terr = pb.NewValidationError(\"invalid ReadResponse offset (%d; expected >= %d)\",\n\t\t\t\tr.Response.Offset, r.Request.Offset) // Violation of Read API contract.\n\t\t}\n\t} else {\n\t\terr = mapGRPCCtxErr(r.ctx, err)\n\t}\n\n\t// A note on resource leaks: an invariant of Read is that in invocations where\n\t// the returned error != nil, an error has also been read from |r.stream|,\n\t// implying that the gRPC stream has been torn down. The exception is if\n\t// response validation fails, which indicates a client / server API version\n\t// incompatibility and cannot happen in normal operation.\n\n\tif err == nil {\n\t\t// If a Header was sent, advise of its advertised journal Route.\n\t\tif r.Response.Header != nil {\n\t\t\tr.client.UpdateRoute(r.Request.Journal.String(), &r.Response.Header.Route)\n\t\t}\n\n\t\tif r.Request.Offset < r.Response.Offset {\n\t\t\t// Offset jumps are uncommon, but possible if fragments were removed,\n\t\t\t// or if the requested offset was -1.\n\t\t\tr.Request.Offset = r.Response.Offset\n\t\t\terr = ErrOffsetJump\n\t\t}\n\n\t\tif r.Response.Status == pb.Status_OK {\n\t\t\t// Return empty read, to allow inspection of the updated |r.Response|.\n\t\t} else {\n\t\t\t// The broker will send a stream closure following a !OK status.\n\t\t\t// Recurse to read that closure, and _then_ return a final error.\n\t\t\tn, err = r.Read(p)\n\t\t}\n\t\treturn\n\n\t} else if err != io.EOF {\n\t\t// We read an error _other_ than a graceful tear-down of the stream.\n\t\treturn\n\t}\n\n\t// We read a graceful stream closure (err == io.EOF).\n\n\t// If the frame preceding EOF provided a fragment URL, open it directly.\n\tif !r.Request.MetadataOnly && r.Response.Status == pb.Status_OK && r.Response.FragmentUrl != \"\" {\n\t\tif r.direct, err = OpenFragmentURL(r.ctx, *r.Response.Fragment,\n\t\t\tr.Request.Offset, r.Response.FragmentUrl); err == nil {\n\t\t\tn, err = r.Read(p) // Recurse to attempt read against opened |r.direct|.\n\t\t}\n\t\treturn\n\t}\n\n\t// Otherwise, map Status of the preceding frame into a more specific error.\n\tswitch r.Response.Status {\n\tcase pb.Status_OK:\n\t\tif err != io.EOF {\n\t\t\tpanic(err.Error()) // Status_OK implies graceful stream closure.\n\t\t}\n\tcase pb.Status_NOT_JOURNAL_BROKER:\n\t\terr = ErrNotJournalBroker\n\tcase pb.Status_OFFSET_NOT_YET_AVAILABLE:\n\t\terr = ErrOffsetNotYetAvailable\n\tdefault:\n\t\terr = errors.New(r.Response.Status.String())\n\t}\n\treturn\n}", "title": "" }, { "docid": "3535c5a2949232f31a7eaac87af5c0b6", "score": "0.59989184", "text": "func (r *DecryptingReader) Read(p []byte) (int, error) {\n\tfor r.buf.Len() < len(p) {\n\t\tchunk, err := r.ReadChunk()\n\t\tr.buf.Write(chunk)\n\t\tif err != nil {\n\t\t\tn, _ := r.buf.Read(p)\n\t\t\treturn n, err\n\t\t}\n\t}\n\treturn r.buf.Read(p)\n}", "title": "" }, { "docid": "e46ffe0e71a0dbc766c50ba7ac1c982b", "score": "0.5983543", "text": "func (r *EndlessStream) Read(p []byte) (n int, err error) {\n\tif r.buf.Len() == 0 {\n\t\tif err := r.fill(); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\tlr := io.LimitReader(&r.buf, int64(len(p)))\n\tb, err := ioutil.ReadAll(lr)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tcopy(p, b)\n\treturn len(b), nil\n}", "title": "" }, { "docid": "03d453c69cb1da0a4f555bcde636e2b2", "score": "0.5982319", "text": "func (s *mockStream)Read(time.Duration) ([]byte, error){\n\treturn nil,nil\n}", "title": "" }, { "docid": "621f8abe086a2141bccde609676db350", "score": "0.5969557", "text": "func (s *stream) Read(p []byte) (int, error) {\n\tif atomic.LoadInt32(&s.eof) != 0 {\n\t\treturn 0, io.EOF\n\t}\n\n\tbytesRead := 0\n\tfor bytesRead < len(p) {\n\t\ts.mutex.Lock()\n\t\tframe := s.frameQueue.Head()\n\n\t\tif frame == nil && bytesRead > 0 {\n\t\t\tdefer s.mutex.Unlock()\n\t\t\treturn bytesRead, s.err\n\t\t}\n\n\t\tfor {\n\t\t\t// Stop waiting on errors\n\t\t\tif s.err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif frame != nil {\n\t\t\t\t// Pop and continue if the frame doesn't have any new data\n\t\t\t\tif frame.Offset+frame.DataLen() <= s.readOffset && !frame.FinBit {\n\t\t\t\t\ts.frameQueue.Pop()\n\t\t\t\t\tframe = s.frameQueue.Head()\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// If the frame's offset is <= our current read pos, and we didn't\n\t\t\t\t// go into the previous if, we can read data from the frame.\n\t\t\t\tif frame.Offset <= s.readOffset {\n\t\t\t\t\t// Set our read position in the frame properly\n\t\t\t\t\ts.readPosInFrame = int(s.readOffset - frame.Offset)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\ts.newFrameOrErrCond.Wait()\n\t\t\tframe = s.frameQueue.Head()\n\t\t}\n\t\ts.mutex.Unlock()\n\n\t\tif frame == nil {\n\t\t\tatomic.StoreInt32(&s.eof, 1)\n\t\t\t// We have an err and no data, return the error\n\t\t\treturn bytesRead, s.err\n\t\t}\n\n\t\tm := utils.Min(len(p)-bytesRead, int(frame.DataLen())-s.readPosInFrame)\n\t\tcopy(p[bytesRead:], frame.Data[s.readPosInFrame:])\n\n\t\ts.readPosInFrame += m\n\t\tbytesRead += m\n\t\ts.readOffset += protocol.ByteCount(m)\n\n\t\ts.flowControlManager.AddBytesRead(s.streamID, protocol.ByteCount(m))\n\t\ts.maybeTriggerWindowUpdate()\n\n\t\tif s.readPosInFrame >= int(frame.DataLen()) {\n\t\t\tfin := frame.FinBit\n\t\t\ts.mutex.Lock()\n\t\t\ts.frameQueue.Pop()\n\t\t\ts.mutex.Unlock()\n\t\t\tif fin {\n\t\t\t\tatomic.StoreInt32(&s.eof, 1)\n\t\t\t\treturn bytesRead, io.EOF\n\t\t\t}\n\t\t}\n\t}\n\n\treturn bytesRead, nil\n}", "title": "" }, { "docid": "b01fb564f5d23ff23cc65e281fe58a54", "score": "0.59686565", "text": "func (r *Reader) Read(data []byte) (int, error) {\n\tvar totalRead int\n\tdefer func() {\n\t\tr.len -= int64(totalRead)\n\t\tr.bytesBeforeSplit += int64(totalRead)\n\t}()\n\tfor len(data) > 0 {\n\t\tn, err := r.r.Read(data)\n\t\tdata = data[n:]\n\t\ttotalRead += n\n\t\tif err != nil {\n\t\t\tif err := r.nextDataRef(); err != nil {\n\t\t\t\treturn totalRead, err\n\t\t\t}\n\t\t}\n\t}\n\treturn totalRead, nil\n}", "title": "" }, { "docid": "b8c6a64f07138d7551b2e8c8cbd0d515", "score": "0.59682643", "text": "func (p *parallelReader) Read() ([][]byte, error) {\n\tnewBuf := make([][]byte, len(p.readers))\n\tvar newBufLK sync.RWMutex\n\n\tif p.offset+p.shardSize > p.shardFileSize {\n\t\tp.shardSize = p.shardFileSize - p.offset\n\t}\n\n\treadTriggerCh := make(chan bool, len(p.readers))\n\tfor i := 0; i < p.dataBlocks; i++ {\n\t\t// Setup read triggers for p.dataBlocks number of reads so that it reads in parallel.\n\t\treadTriggerCh <- true\n\t}\n\n\treaderIndex := 0\n\tvar wg sync.WaitGroup\n\t// if readTrigger is true, it implies next disk.ReadAt() should be tried\n\t// if readTrigger is false, it implies previous disk.ReadAt() was successful and there is no need\n\t// to try reading the next disk.\n\tfor readTrigger := range readTriggerCh {\n\t\tnewBufLK.RLock()\n\t\tcanDecode := p.canDecode(newBuf)\n\t\tnewBufLK.RUnlock()\n\t\tif canDecode {\n\t\t\tbreak\n\t\t}\n\t\tif readerIndex == len(p.readers) {\n\t\t\tbreak\n\t\t}\n\t\tif !readTrigger {\n\t\t\tcontinue\n\t\t}\n\t\twg.Add(1)\n\t\tgo func(i int) {\n\t\t\tdefer wg.Done()\n\t\t\tdisk := p.readers[i]\n\t\t\tif disk == nil {\n\t\t\t\t// Since disk is nil, trigger another read.\n\t\t\t\treadTriggerCh <- true\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif p.buf[i] == nil {\n\t\t\t\t// Reading first time on this disk, hence the buffer needs to be allocated.\n\t\t\t\t// Subsequent reads will re-use this buffer.\n\t\t\t\tp.buf[i] = make([]byte, p.shardSize)\n\t\t\t}\n\t\t\t// For the last shard, the shardsize might be less than previous shard sizes.\n\t\t\t// Hence the following statement ensures that the buffer size is reset to the right size.\n\t\t\tp.buf[i] = p.buf[i][:p.shardSize]\n\t\t\t_, err := disk.ReadAt(p.buf[i], p.offset)\n\t\t\tif err != nil {\n\t\t\t\tp.readers[i] = nil\n\t\t\t\t// Since ReadAt returned error, trigger another read.\n\t\t\t\treadTriggerCh <- true\n\t\t\t\treturn\n\t\t\t}\n\t\t\tnewBufLK.Lock()\n\t\t\tnewBuf[i] = p.buf[i]\n\t\t\tnewBufLK.Unlock()\n\t\t\t// Since ReadAt returned success, there is no need to trigger another read.\n\t\t\treadTriggerCh <- false\n\t\t}(readerIndex)\n\t\treaderIndex++\n\t}\n\twg.Wait()\n\n\tif p.canDecode(newBuf) {\n\t\tp.offset += p.shardSize\n\t\treturn newBuf, nil\n\t}\n\n\treturn nil, errXLReadQuorum\n}", "title": "" }, { "docid": "a65692296d08b8f1006c239fa322cd61", "score": "0.59561306", "text": "func (r *fileStreamReader) Read(b []byte) (int, error) {\n\tif err := r.ctx.Err(); err != nil {\n\t\treturn 0, err\n\t}\n\n\tn, err := r.file.Read(b)\n\t// Create a copy as not whole buffer can be filled.\n\treadBuff := b[:n]\n\n\tfor _, stream := range r.streams {\n\t\tif _, innerError := stream.Read(readBuff); innerError != nil {\n\t\t\t// Ignore EOF\n\t\t\tif err != io.EOF {\n\t\t\t\treturn 0, innerError\n\t\t\t}\n\t\t}\n\t}\n\n\treturn n, err\n}", "title": "" }, { "docid": "1143ed6173b5722bf246bca81d77a191", "score": "0.5950047", "text": "func (ec *Context) downloadStream(raw []byte, dgPb *repb.Digest, offset int64, write func([]byte)) error {\n\tif raw != nil {\n\t\to := int(offset)\n\t\tif int64(o) != offset || o > len(raw) {\n\t\t\treturn fmt.Errorf(\"offset %d is out of range for length %d\", offset, len(raw))\n\t\t}\n\t\twrite(raw[o:])\n\t} else if dgPb != nil {\n\t\tdg, err := digest.NewFromProto(dgPb)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbytes, stats, err := ec.client.GrpcClient.ReadBlobRange(ec.ctx, dg, offset, 0)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tec.Metadata.LogicalBytesDownloaded += stats.LogicalMoved\n\t\tec.Metadata.RealBytesDownloaded += stats.RealMoved\n\t\twrite(bytes)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3c78ee155a67e5a2718960dace7b6292", "score": "0.5943853", "text": "func (pt *PassThru) Read(p []byte) (int, error) {\n\tselect {\n\tcase <-pt.stop:\n\t\treturn 0, errors.New(\"EOF\")\n\tdefault:\n\t\tbreak\n\t}\n\tn, err := pt.Reader.Read(p)\n\tpt.total += int64(n)\n\ts := Status{WorkerId: pt.Worker.Id, Total: pt.total, Length: pt.length}\n\tfor _, c := range pt.subs {\n\t\tc <- Status{WorkerId: pt.Worker.Id, Total: pt.total, Length: pt.length}\n\t}\n\tpt.Worker.Status = s\n\treturn n, err\n}", "title": "" }, { "docid": "a96e46ee8ac02e9908f97e888f1252d5", "score": "0.5928786", "text": "func (e endlessReader) Read(p []byte) (int, error) {\n\treturn len(p), nil\n}", "title": "" }, { "docid": "0d7586d27e74695a94937816178dd461", "score": "0.59051216", "text": "func (r *TCPReaderStream) Read(p []byte) (int, error) {\n\tif !r.initiated {\n\t\tpanic(\"TCPReaderStream not created via NewReaderStream\")\n\t}\n\tvar ok bool\n\tr.stripEmpty()\n\tfor !r.closed && len(r.current) == 0 {\n\t\tif r.first {\n\t\t\tr.first = false\n\t\t} else {\n\t\t\tr.done <- true\n\t\t}\n\t\tif r.current, ok = <-r.reassembled; ok {\n\t\t\tr.stripEmpty()\n\t\t} else {\n\t\t\tr.closed = true\n\t\t}\n\t}\n\tif len(r.current) > 0 {\n\t\tcurrent := &r.current[0]\n\t\tif r.LossErrors && !r.lossReported && current.Skip != 0 {\n\t\t\tr.lossReported = true\n\t\t\treturn 0, DataLost\n\t\t}\n\t\tlength := copy(p, current.Bytes)\n\t\tcurrent.Bytes = current.Bytes[length:]\n\t\treturn length, nil\n\t}\n\treturn 0, io.EOF\n}", "title": "" }, { "docid": "be6fca38c7b6917812fd4742d543a9a1", "score": "0.58982265", "text": "func (r *Reader) Read(p []byte) (int, error) {\n\tr.span, _ = opentracing.StartSpanFromContext(r.ctx, \"blob-read\")\n\tr.span.SetTag(\"blob.key\", r.key)\n\n\tn, err := r.inner.Read(p)\n\tswitch {\n\tcase errors.Is(err, io.EOF):\n\t\treturn n, err\n\tcase err != nil:\n\t\treturn n, tracing.WithError(r.span, err)\n\tdefault:\n\t\tr.n += n\n\t\tr.span.SetTag(\"blob.bytes_read\", r.n)\n\t\treturn n, nil\n\t}\n}", "title": "" }, { "docid": "4b5da7a21f3dd4fe7ea877136689f603", "score": "0.5894523", "text": "func (br *blockReader) Read(p []byte) (int, error) {\n\tif br.pos == br.length {\n\t\treturn 0, io.EOF\n\t}\n\tplen := len(p)\n\tclen := len(br.cblock)\n\tif plen < clen {\n\t\tcopy(p, br.cblock)\n\t\tbr.cblock = br.cblock[plen:]\n\t\tbr.pos += int64(plen)\n\t\treturn plen, nil\n\t}\n\tvar read int\n\tfor br.cblock != nil && len(p) >= clen {\n\t\tcopy(p, br.cblock)\n\t\tbr.pos += int64(clen)\n\t\tp = p[clen:]\n\t\tread += clen\n\t\t_, br.cblock = br.c.Next()\n\t\tclen = len(br.cblock)\n\t}\n\tif br.pos == br.length {\n\t\treturn read, io.EOF\n\t}\n\treturn read, nil\n}", "title": "" }, { "docid": "2b683f092819188583a5fedc76488e43", "score": "0.58938915", "text": "func (s *Stream) Read(p []byte) (n int, err error) {\n\treturn s.Stream().Read(p)\n}", "title": "" }, { "docid": "28d4c6f88806d2a522c9deae5fb043d3", "score": "0.58693725", "text": "func (cr *Reader) Read(p []byte) (n int, err error) {\n\n\tbytesToRead := len(p)\n\n\tif cr.chunkLast && cr.chunkOffset == 0 {\n\t\treturn 0, io.EOF\n\t}\n\n\tfor {\n\t\tif cr.chunkBuf == nil {\n\t\t\tkey := cr.leaves[cr.leafNr].String()\n\t\t\t// TODO: [perf] Consider using a memory pool and reusing chunks?\n\n\t\t\t// Check whether chunk is available on local disk, if not, pull down to local disk\n\t\t\tchunkFile := getBlobPath(key)\n\t\t\tif _, err := os.Stat(chunkFile); os.IsNotExist(err) {\n\n\t\t\t\t// Chunk is missing, load file from back end\n\t\t\t\t// TODO: [perf] Ideally optimize here to just get the missing chunk (not whole file)\n\t\t\t\t_, err = PullDownOnDemand(cr.hash)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn 0, err\n\t\t\t\t}\n\n\t\t\t\t// Double check that missing chunk is now available\n\t\t\t\tif _, err := os.Stat(chunkFile); os.IsNotExist(err) {\n\t\t\t\t\treturn 0, errors.New(\"Failed to fetch missing chunk from remote back end\")\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcr.chunkBuf, err = ioutil.ReadFile(chunkFile)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\tcr.chunkOffset = 0\n\t\t\tcr.leafNr++\n\t\t\tcr.chunkLast = cr.leafNr == len(cr.leaves) // Mark when we have the last chunk\n\t\t}\n\n\t\tremainingInBuffer := len(cr.chunkBuf) - cr.chunkOffset\n\t\tbytesRead := min(bytesToRead, remainingInBuffer)\n\t\tcopy(p[len(p)-bytesToRead:], cr.chunkBuf[cr.chunkOffset:cr.chunkOffset+bytesRead])\n\t\tbytesToRead -= bytesRead\n\t\tremainingInBuffer -= bytesRead\n\t\tcr.chunkOffset += bytesRead\n\n\t\tif bytesToRead <= 0 {\n\t\t\treturn len(p)-bytesToRead, nil\n\t\t}\n\n\t\tif remainingInBuffer <= 0 {\n\t\t\tif cr.chunkLast {\n\t\t\t\treturn len(p)-bytesToRead, io.EOF\n\t\t\t}\n\t\t\tcr.chunkBuf = nil\n\t\t\tcr.chunkOffset = 0\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0aaa5ae2d88e80bfa5e3689d9761a60d", "score": "0.5865077", "text": "func (reader *chainedReader) Read(buf []byte) (int, error) {\n\tif reader.err != nil {\n\t\treturn 0, reader.err\n\t}\n\tn, err := reader.reader.Read(buf)\n\treader.err = err\n\treturn n, err\n}", "title": "" }, { "docid": "41bb37d1a07ebf8fbe0e0b91116656bb", "score": "0.5854834", "text": "func (b *loopingBuffer) bytesRead() int {\n\tb.mu.Lock()\n\tdefer b.mu.Unlock()\n\tv := b.r\n\tb.r = 0\n\treturn v\n}", "title": "" }, { "docid": "f4e4d21bbc4bc5dc2470a434184debee", "score": "0.5850392", "text": "func (r *LongRun) readToChannel(a chan *StreamData, cn chan int64, reader io.ReadCloser, isStderr bool) {\r\n\tvar byteCount int64 = 0\r\n\tdefer func() { recover() }()\r\n\tdefer func() {\r\n\t\t//a <- &StreamData{isStderr, nil}\r\n\t\tdefer func() { recover() }()\r\n\t\tif cn != nil {\r\n\t\t\tcn <- byteCount\r\n\t\t}\r\n\t}()\r\n\tif reader == nil {\r\n\t\treturn\r\n\t}\r\n\tscanner := bufio.NewScanner(reader)\r\n\tscanner.Split(r.SplitFunc) // bufio.ScanLines\r\n\tfor scanner.Scan() {\r\n\t\tb := scanner.Bytes()\r\n\t\tbyteCount += int64(len(b))\r\n\t\t//println(\"... \" + string(b))\r\n\t\ta <- &StreamData{isStderr, string(b)}\r\n\t}\r\n}", "title": "" }, { "docid": "93ab02c1b41d75060436213d8e98d13a", "score": "0.58492625", "text": "func (myFS *MyGoFS) Read (namespace string, size uint64) ([]byte, err.SysError) {\n\t// First we look up the namespace\n ns, mynserr := myFS.LookupNamespace (namespace)\n if (mynserr != err.NoErr) { return nil, err.ErrFatal }\n\n\tdata := make ([]byte, size)\n\n\tvar totalReadSize uint64 = 0\n\tfor (totalReadSize < size) {\n\t\t// Lookup where the data is (server + blockid)\n\t\tdataserver, blockid, _, _, global_offset, mylookuperr := myFS.LookupLastReadBlockUsed (namespace)\n\t\tif (mylookuperr != err.NoErr) { return nil, mylookuperr }\n\n\t\t// First thing to figure out: can we read more data from the last block we accessed?\n\t\tvar targetDS *Dataserver = nil\n\t\tvar di *DataInfo = nil\n\t\tfor i := 0; i < len (ns.datainfo); i++ {\n\t\t\tif (ns.datainfo[i].start <= global_offset && ns.datainfo[i].end > global_offset) {\n\t\t\t\ttargetDS = ns.datainfo[i].server\n\t\t\t\tdi = ns.datainfo[i]\n\t\t\t\tfmt.Println (\"Found data starting at\", global_offset, \", it is in block\", blockid, \"(\", di.start, \"-\", di.end, \")\")\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif (global_offset == ns.datainfo[i].end) {\n\t\t\t\t// We reached the end of the last block we read, so we look for the next chunk\n\t\t\t\ttargetDS = ns.datainfo[i+1].server\n\t\t\t\tdi = ns.datainfo[i+1]\n\t\t\t}\n\t\t}\n\n\t\t// if not the first read, global_offset points right now to the last piece\n\t\t// we already read so we will strat reading right after that\n\t\tnextReadGlobalOffset := global_offset\n\n\t\tif (targetDS != nil) {\n\t\t\t// We found a server, we start with some sanity checks\n\t\t\tif (dataserver != targetDS) {\n\t\t\t\tfmt.Println (\"Inconsistent server bookkeeping\")\n\t\t\t\treturn nil, err.ErrFatal\n\t\t\t}\n\n\t\t\t// How much more data can we get from there?\n\t\t\treadSize := di.end - nextReadGlobalOffset + 1\n\t\t\tif (readSize + totalReadSize > size) { readSize = size - totalReadSize }\n\n\t\t\t// Get that data\n\t\t\tfmt.Println (\"Sending read req to server\", dataserver.surl, \", blockid: \", di.blockid, \"offset: \", di.blockoffset, \", for \", readSize, \"bytes\")\n\t\t\tsenderr := myFS.SendReadReq (dataserver, namespace, di.blockid, di.blockoffset, readSize)\n\t\t\tif (senderr != err.NoErr) { return nil, senderr }\n\t\t\tmsgtype, datasize, blockdata, recverr := comm.RecvMsg (dataserver.conn)\n\t\t\tif (msgtype != comm.RDREPLY || datasize != readSize || blockdata == nil || recverr != err.NoErr) { return nil, err.ErrFatal }\n\t\t\tfmt.Println (\"Received data for range\", nextReadGlobalOffset, \"to\", nextReadGlobalOffset + readSize, \"(\", readSize, \"bytes) from\", dataserver.surl, \", blockid:\", di.blockid, \", offset:\", di.blockoffset)\n\n\t\t\t// Copy the received data to the target buffer\n\t\t\tfmt.Println (\"Copying data to target buffer\")\n\t\t\tcopy (data[totalReadSize:totalReadSize + readSize], blockdata)\n\n\t\t\tfmt.Println (\"Updating read info after reading\", readSize, \"byte\")\n\t\t\tmyFS.UpdateLastReadInfo (dataserver, namespace, di.blockid, readSize)\n\n\t\t\ttotalReadSize += readSize\n\t\t\tfmt.Println (\"We read\", totalReadSize, \"bytes so far\")\n\t\t} else {\n\t\t\t// Nothing to read\n\t\t\treturn nil, err.NoErr\n\t\t}\n\t}\n\tfmt.Println (\"****************\")\n\n\treturn data, err.NoErr\n}", "title": "" }, { "docid": "3a8e2eb808d13d4668b3a0765593c767", "score": "0.58442324", "text": "func (s *DataChunkFile) ReadFrom(src io.Reader) (n int64, err error) {\n\tn = 0\n\tp := make([]byte, 1024)\n\tfor {\n\t\tread, readErr := src.Read(p)\n\t\tn += int64(read)\n\t\tif read > 0 {\n\t\t\t// We've got some data and it has to be processed no matter what\n\t\t\t// Write these bytes to data stream\n\t\t\t_, writeErr := s.Write(p[:read])\n\t\t\tif writeErr != nil {\n\t\t\t\terr = writeErr\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif readErr != nil {\n\t\t\t// We have some kind of an error\n\t\t\tif readErr == io.EOF {\n\t\t\t\t// However, EOF is not an error on read\n\t\t\t\treadErr = nil\n\t\t\t}\n\t\t\t// In case of an error or EOF, break the read loop\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b53067047e6fc91130df7ff7de13a657", "score": "0.5840693", "text": "func (w *webSocketWrappedReader) Read(p []byte) (int, error) {\n\treturn w.reader.Read(p)\n}", "title": "" }, { "docid": "49adadb94293fc2f918cdc702ab3ef82", "score": "0.58390415", "text": "func (r *Reader) Read(p []byte) (n int, err error) {\n\tfor n < len(p) {\n\t\tif r.sr == nil {\n\t\t\tif r.SingleStream {\n\t\t\t\tdata := make([]byte, 1)\n\t\t\t\t_, err = io.ReadFull(r.xz, data)\n\t\t\t\tif err != io.EOF {\n\t\t\t\t\treturn n, errUnexpectedData\n\t\t\t\t}\n\t\t\t\treturn n, io.EOF\n\t\t\t}\n\t\t\tfor {\n\t\t\t\tr.sr, err = r.ReaderConfig.newStreamReader(r.xz)\n\t\t\t\tif err != errPadding {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn n, err\n\t\t\t}\n\t\t}\n\t\tk, err := r.sr.Read(p[n:])\n\t\tn += k\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tr.sr = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn n, err\n\t\t}\n\t}\n\treturn n, nil\n}", "title": "" }, { "docid": "264bca8211988dc226554baebd3403fc", "score": "0.58168584", "text": "func (f *HTTPSource) ExecuteReader(partitionsQ chan pipeline.PartsPartition, partsQ chan pipeline.Part, readPartsQ chan pipeline.Part, id int, wg *sync.WaitGroup) {\n\tvar blocksHandled = 0\n\tvar err error\n\tvar req *http.Request\n\tvar res *http.Response\n\tdefer wg.Done()\n\tfor {\n\t\tp, ok := <-partsQ\n\n\t\tif !ok {\n\t\t\treturn // no more blocks of file data to be read\n\t\t}\n\n\t\t//when in reference mode the assumption is that data won't be read, we just need to pass\n\t\t// the reference (source info and byte range) to the workers. The target scenario is when the target\n\t\t// reads directly from the source, which is the case of the Put Block from URL functionally for block blobs.\n\t\tif f.referenceMode {\n\t\t\treadPartsQ <- p\n\t\t\tcontinue\n\t\t}\n\n\t\tutil.RetriableOperation(func(r int) error {\n\t\t\tif req, err = http.NewRequest(\"GET\", p.SourceURI, nil); err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\n\t\t\theader := fmt.Sprintf(\"bytes=%v-%v\", p.Offset, p.Offset-1+uint64(p.BytesToRead))\n\t\t\treq.Header.Set(\"Range\", header)\n\t\t\treq.Header.Set(\"User-Agent\", internal.UserAgentStr)\n\n\t\t\tif res, err = f.HTTPClient.Do(req); err != nil || res.StatusCode != 206 {\n\t\t\t\tvar status int\n\t\t\t\tif res != nil {\n\t\t\t\t\tstatus = res.StatusCode\n\t\t\t\t\terr = fmt.Errorf(\"Invalid status code in the response. Status: %v Bytes: %v\", status, header)\n\t\t\t\t}\n\n\t\t\t\tif res != nil && res.Body != nil {\n\t\t\t\t\tres.Body.Close()\n\t\t\t\t}\n\n\t\t\t\tutil.PrintfIfDebug(\"ExecuteReader -> blockid:%v toread:%v status:%v err:%v head:%v\", p.BlockID, p.BytesToRead, status, err, header)\n\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t//p.Data, err = ioutil.ReadAll(res.Body)\n\t\t\tp.GetBuffer()\n\t\t\t_, err := io.ReadAtLeast(res.Body, p.Data, int(p.BytesToRead))\n\n\t\t\tif err != nil && err != io.ErrUnexpectedEOF {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tres.Body.Close()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif f.includeMD5 {\n\t\t\t\tp.MD5()\n\t\t\t}\n\n\t\t\tutil.PrintfIfDebug(\"ExecuteReader -> blockid:%v toread:%v status:%v read:%v head:%v\", p.BlockID, p.BytesToRead, res.StatusCode, res.ContentLength, header)\n\n\t\t\treturn nil\n\t\t})\n\n\t\treadPartsQ <- p\n\t\tblocksHandled++\n\t}\n\n}", "title": "" }, { "docid": "42d912c59f09df1f813766b3a6774532", "score": "0.5808548", "text": "func (b *buffer) readFrom(r io.Reader) (n int64, err error) {\n\tfor {\n\t\ti := b.grow(minRead)\n\t\tb.buf = b.buf[:i]\n\t\tm, e := r.Read(b.buf[i:cap(b.buf)])\n\t\tif m < 0 {\n\t\t\tpanic(errNegativeRead)\n\t\t}\n\n\t\tb.buf = b.buf[:i+m]\n\t\tn += int64(m)\n\n\t\tif e != nil {\n\t\t\treturn n, e\n\t\t}\n\n\t\treturn n, nil\n\t}\n}", "title": "" }, { "docid": "25469bc49d6a2d9fa95bbc4fb38ca1cd", "score": "0.5804856", "text": "func (t *reader) Read(b []byte) (n int, err error) {\n\tmax := cap(b)\n\n\t// Maximum receive size we can do in 'tau' time\n\treadSize := max\n\tif readSize > t.maxReadSize {\n\t\treadSize = t.maxReadSize\n\t}\n\n\tdt := time.Duration(tau) * time.Millisecond\n\terr = nil\n\tn = 0\n\tend := 0\n\n\tfor n < max {\n\t\ttime.Sleep(dt)\n\n\t\tend = n + readSize\n\t\tif end > max {\n\t\t\tend = max\n\t\t}\n\t\tread, err := t.in.Read(b[n:end])\n\t\tn += read\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn n, err\n}", "title": "" }, { "docid": "ade718819768ea18eace23d67b0d85a2", "score": "0.5796544", "text": "func (pt *PassThru) Read(p []byte) (int, error) {\n n, err := pt.Reader.Read(p)\n pt.total += uint64(n)\n\n if err == nil {\n output := fmt.Sprintf(\"(%s) \", humanize.Bytes(pt.total))\n fmt.Fprintf(os.Stderr, \"\\x1B[2K\\x1B[%dD%s\", len(output), output)\n }\n\n return n, err\n}", "title": "" }, { "docid": "76d5eaffc4fda336efc7ae5e81276600", "score": "0.57934844", "text": "func (pt *passThru) Read(p []byte) (int, error) {\n\tn, err := pt.Reader.Read(p)\n\tpt.total += int64(n)\n\treturn n, err\n}", "title": "" }, { "docid": "b90d399909edc99b18003eb83410aa5a", "score": "0.5790695", "text": "func (or *OutputReader) Read(p []byte) (int, error) {\n\tif or.off == math.MaxUint64 {\n\t\treturn 0, io.EOF\n\t} else if rem := math.MaxUint64 - or.off; uint64(len(p)) > rem {\n\t\tp = p[:rem]\n\t}\n\tlenp := len(p)\n\tfor len(p) > 0 {\n\t\tif or.off%blockLen == 0 {\n\t\t\tor.n.counter = or.off / blockLen\n\t\t\twords := or.n.compress()\n\t\t\twordsToBytes(words[:], or.block[:])\n\t\t}\n\n\t\tn := copy(p, or.block[or.off%blockLen:])\n\t\tp = p[n:]\n\t\tor.off += uint64(n)\n\t}\n\treturn lenp, nil\n}", "title": "" }, { "docid": "7770f5fd72a43736f7b012963a60fb67", "score": "0.5789512", "text": "func (lr *countingReader) Read(p []byte) (n int, err error) {\n\tn, err = lr.r.Read(p)\n\tlr.n += int64(n)\n\treturn n, err\n}", "title": "" }, { "docid": "47dafab67b91d16f8de342555811c935", "score": "0.57844174", "text": "func doRead(s *KinesisStream) {\n\n if verbose {\n fmt.Println(\"\\nReading from shard: \", s.ShardID)\n fmt.Println(\"With iterator type:\", s.ShardIteratorType)\n }\n\n var msecBehind int64 = 0\n var lastDelay int64 = 0\n emptyReads := 0\n\n s.ReadReset()\n for moreData := true; moreData; {\n\n output, err := s.GetRecords()\n if err != nil {\n printAWSError(err)\n log.Fatal(err)\n }\n\n // Keep reading until we're caught up or catchup and sleep if we're tailling.\n msecBehind = *output.MillisBehindLatest\n if msecBehind <= 0 {\n if tail {\n time.Sleep(time.Duration(sleepMilli) * time.Millisecond)\n } else {\n moreData = false\n }\n }\n\n // Share what you got.\n if showEmptyReads || verbose {\n if len(output.Records) > 0 {\n if emptyReads != 0 {\n fmt.Println(emptyReads, \"empty responses (no records) and delay is now:\",\n fmtMilliseconds(msecBehind), \"behind the tip of the stream.\")\n }\n if verbose {\n fmt.Println(\"Got \", len(output.Records), \" data records.\")\n fmt.Println(\"The response is \", fmtMilliseconds(msecBehind), \" behind the tip of the stream.\")\n }\n emptyReads = 0\n } else {\n if emptyReads == 0 {\n if lastDelay != msecBehind {\n lastDelay = msecBehind\n fmt.Printf(\"The response is %s behind the top of the stream.\\n\",\n fmtMilliseconds(msecBehind))\n }\n }\n emptyReads++\n }\n }\n\n for i, record := range output.Records {\n if verbose {\n fmt.Println(\"Data record: \", i+1)\n fmt.Println(\"Partition: \", *record.PartitionKey)\n fmt.Println(\"SequenceNumber: \", *record.SequenceNumber)\n fmt.Printf(\"Data: \")\n }\n fmt.Println(string(record.Data))\n }\n }\n}", "title": "" }, { "docid": "0d91630c00c3e1cdf6194c72b61727e5", "score": "0.5780428", "text": "func (f *File) ReadAt(b []byte, off int64) (int, error) {\n\tif len(b) <= f.c.maxPacket {\n\t\t// This should be able to be serviced with 1/2 requests.\n\t\t// So, just do it directly.\n\t\treturn f.readChunkAt(nil, b, off)\n\t}\n\n\tif f.c.disableConcurrentReads {\n\t\treturn f.readAtSequential(b, off)\n\t}\n\n\t// Split the read into multiple maxPacket-sized concurrent reads bounded by maxConcurrentRequests.\n\t// This allows writes with a suitably large buffer to transfer data at a much faster rate\n\t// by overlapping round trip times.\n\n\tcancel := make(chan struct{})\n\n\tconcurrency := len(b)/f.c.maxPacket + 1\n\tif concurrency > f.c.maxConcurrentRequests || concurrency < 1 {\n\t\tconcurrency = f.c.maxConcurrentRequests\n\t}\n\n\tresPool := newResChanPool(concurrency)\n\n\ttype work struct {\n\t\tid uint32\n\t\tres chan result\n\n\t\tb []byte\n\t\toff int64\n\t}\n\tworkCh := make(chan work)\n\n\t// Slice: cut up the Read into any number of buffers of length <= f.c.maxPacket, and at appropriate offsets.\n\tgo func() {\n\t\tdefer close(workCh)\n\n\t\tb := b\n\t\toffset := off\n\t\tchunkSize := f.c.maxPacket\n\n\t\tfor len(b) > 0 {\n\t\t\trb := b\n\t\t\tif len(rb) > chunkSize {\n\t\t\t\trb = rb[:chunkSize]\n\t\t\t}\n\n\t\t\tid := f.c.nextID()\n\t\t\tres := resPool.Get()\n\n\t\t\tf.c.dispatchRequest(res, &sshFxpReadPacket{\n\t\t\t\tID: id,\n\t\t\t\tHandle: f.handle,\n\t\t\t\tOffset: uint64(offset),\n\t\t\t\tLen: uint32(chunkSize),\n\t\t\t})\n\n\t\t\tselect {\n\t\t\tcase workCh <- work{id, res, rb, offset}:\n\t\t\tcase <-cancel:\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\toffset += int64(len(rb))\n\t\t\tb = b[len(rb):]\n\t\t}\n\t}()\n\n\ttype rErr struct {\n\t\toff int64\n\t\terr error\n\t}\n\terrCh := make(chan rErr)\n\n\tvar wg sync.WaitGroup\n\twg.Add(concurrency)\n\tfor i := 0; i < concurrency; i++ {\n\t\t// Map_i: each worker gets work, and then performs the Read into its buffer from its respective offset.\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\n\t\t\tfor packet := range workCh {\n\t\t\t\tvar n int\n\n\t\t\t\ts := <-packet.res\n\t\t\t\tresPool.Put(packet.res)\n\n\t\t\t\terr := s.err\n\t\t\t\tif err == nil {\n\t\t\t\t\tswitch s.typ {\n\t\t\t\t\tcase sshFxpStatus:\n\t\t\t\t\t\terr = normaliseError(unmarshalStatus(packet.id, s.data))\n\n\t\t\t\t\tcase sshFxpData:\n\t\t\t\t\t\tsid, data := unmarshalUint32(s.data)\n\t\t\t\t\t\tif packet.id != sid {\n\t\t\t\t\t\t\terr = &unexpectedIDErr{packet.id, sid}\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tl, data := unmarshalUint32(data)\n\t\t\t\t\t\t\tn = copy(packet.b, data[:l])\n\n\t\t\t\t\t\t\t// For normal disk files, it is guaranteed that this will read\n\t\t\t\t\t\t\t// the specified number of bytes, or up to end of file.\n\t\t\t\t\t\t\t// This implies, if we have a short read, that means EOF.\n\t\t\t\t\t\t\tif n < len(packet.b) {\n\t\t\t\t\t\t\t\terr = io.EOF\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\terr = unimplementedPacketErr(s.typ)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif err != nil {\n\t\t\t\t\t// return the offset as the start + how much we read before the error.\n\t\t\t\t\terrCh <- rErr{packet.off + int64(n), err}\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\n\t// Wait for long tail, before closing results.\n\tgo func() {\n\t\twg.Wait()\n\t\tclose(errCh)\n\t}()\n\n\t// Reduce: collect all the results into a relevant return: the earliest offset to return an error.\n\tfirstErr := rErr{math.MaxInt64, nil}\n\tfor rErr := range errCh {\n\t\tif rErr.off <= firstErr.off {\n\t\t\tfirstErr = rErr\n\t\t}\n\n\t\tselect {\n\t\tcase <-cancel:\n\t\tdefault:\n\t\t\t// stop any more work from being distributed. (Just in case.)\n\t\t\tclose(cancel)\n\t\t}\n\t}\n\n\tif firstErr.err != nil {\n\t\t// firstErr.err != nil if and only if firstErr.off > our starting offset.\n\t\treturn int(firstErr.off - off), firstErr.err\n\t}\n\n\t// As per spec for io.ReaderAt, we return nil error if and only if we read everything.\n\treturn len(b), nil\n}", "title": "" }, { "docid": "9ce5df1a02f3b9d1aa57cd19cd637130", "score": "0.57753366", "text": "func (client *Client) Read() {\n for {\n line, _ := client.reader.ReadBytes('\\n')\n client.in <- line\n }\n}", "title": "" }, { "docid": "a24a5bfd91291261b737a01a432a6d55", "score": "0.57752657", "text": "func readFull(r io.Reader, b []byte, t *time.Timer, d time.Duration) (o int, err error) {\n\tfor o < len(b) && err == nil {\n\t\tvar nn int\n\t\tnn, err = r.Read(b[o:])\n\t\to += nn\n\t\tt.Reset(d)\n\t}\n\tif o >= len(b) {\n\t\terr = nil\n\t}\n\treturn\n}", "title": "" }, { "docid": "cb93f38023c89d48485262bb9504b844", "score": "0.57689035", "text": "func (r *FullReader) Read(buf []byte) (int, error) {\n\tnumRead := 0\n\tfor numRead < len(buf) {\n\t\tn, err := r.Base.Read(buf[numRead:])\n\t\tnumRead += n\n\t\tif err != nil { //including io.EOF\n\t\t\treturn numRead, err\n\t\t}\n\t}\n\treturn numRead, nil\n}", "title": "" }, { "docid": "b7ce94811e41ad8713ad6e25b1e168a4", "score": "0.5764424", "text": "func (m *MockNetpollReader) Read(b []byte) (n int, err error) {\n\treturn\n}", "title": "" }, { "docid": "bdb515b468ec0db4d793f44a822ae77c", "score": "0.57510513", "text": "func (client *HTTPClient) Read(p []byte) (n int, err error) {\n\tif client.reader == nil {\n\t\terr = client.ResetReader()\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\treturn client.reader.Read(p)\n}", "title": "" }, { "docid": "a5262c62ffa17b2d577345938d9532b0", "score": "0.57509184", "text": "func (p *pipe) Read(d []byte) (n int, err error) {\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\tif p.c.L == nil {\n\t\tp.c.L = &p.mu\n\t}\n\tfor {\n\t\tif p.IoBuffer != nil && p.IoBuffer.Len() > 0 {\n\t\t\treturn p.IoBuffer.Read(d)\n\t\t}\n\t\tif p.err != nil {\n\t\t\treturn 0, p.err\n\t\t}\n\t\tp.c.Wait()\n\t}\n}", "title": "" }, { "docid": "eb4fe7409e5771849070f496d72c5fc6", "score": "0.57474893", "text": "func (reader *Reader) Read(out []byte) (n int, err error) {\n\tif len(reader.buf) == 0 {\n\t\t// we need to ge more data\n\t\t// we read in one block\n\t\treader.buf, err = readOneBlock(reader.src)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tif len(reader.buf) == 0 {\n\t\t\treturn 0, io.ErrShortWrite\n\t\t}\n\t}\n\n\t//we read more if needed\n\tfor len(reader.buf) < len(out) && err != io.EOF {\n\t\t// we need to ge more data\n\t\t// we read in one block at a time\n\t\tvar more []byte\n\t\tmore, err = readOneBlock(reader.src)\n\t\tif err != nil && err != io.EOF {\n\t\t\treturn 0, err\n\t\t}\n\t\treader.buf = append(reader.buf, more...)\n\t}\n\n\tn = copy(out, reader.buf)\n\n\tif n < len(reader.buf) {\n\t\terr = io.ErrShortBuffer\n\t}\n\n\treader.buf = reader.buf[n:]\n\treturn\n}", "title": "" }, { "docid": "e9c5c04620a503ab47fe4f840b809056", "score": "0.57415336", "text": "func (c *Command) runRead(ctx context.Context) error {\n\tfile, err := os.Open(c.path)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to open file for reading\")\n\t}\n\tdefer file.Close()\n\n\thasher := sha256.New()\n\tticker := time.NewTicker(c.iterSleep)\n\tbuf := make([]byte, 0, c.blockSize)\n\ttotalRead := 0\n\tlog.Printf(\"Starting read from %q\", c.path)\n\tfor {\n\t\t// Wait for the interval\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn errors.Wrap(ctx.Err(), \"reading cancelled\")\n\t\tcase <-ticker.C:\n\t\t}\n\n\t\tbytesRead, err := file.Read(buf[:cap(buf)])\n\t\tif err != nil && err != io.EOF {\n\t\t\treturn errors.Wrap(err, \"failed to read segment from file\")\n\t\t}\n\t\ttotalRead += bytesRead\n\n\t\t// Add the read bytes to the hash\n\t\thasher.Write(buf[:bytesRead])\n\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tlog.Printf(\"Reading finished from %q (%d bytes)\", c.path, totalRead)\n\n\t// Print the hash out as hex\n\tcomputedHash := hex.EncodeToString(hasher.Sum(nil))\n\tlog.Printf(\"SHA-256 hash: %s\", computedHash)\n\treturn nil\n}", "title": "" }, { "docid": "b2864fd74734b53387d0b18486c99e00", "score": "0.57360274", "text": "func Read(r io.Reader) ([]byte, error) { return BlockReader(r, defaultBlockSize, nil) }", "title": "" }, { "docid": "31b5f8447e5bfda77d9942c6d21fed5c", "score": "0.5724241", "text": "func (w *wrapReadCloser) Read(p []byte) (int, error) {\n\tw.RLock()\n\tdefer w.RUnlock()\n\tif w.closed {\n\t\treturn 0, io.EOF\n\t}\n\treturn w.r.Read(p)\n}", "title": "" }, { "docid": "43637cbbacee40fece67cb112a3b3455", "score": "0.57195944", "text": "func (r *EndlessReader) Read(p []byte) (int, error) {\n\t_, err := r.Reader.Read(p)\n\tExpect(err).ToNot(HaveOccurred())\n\treturn 0, nil\n}", "title": "" }, { "docid": "6e85e38f83a25c933a03bd5cc34eab6a", "score": "0.5709771", "text": "func (p *Player) Read(data []byte) (n int, err error) {\n\tfor written := 0; written < len(data); written += n {\n\t\terr := p.Socket.SetReadDeadline(time.Now().Add(time.Second * time.Duration(15)))\n\t\tif err != nil {\n\t\t\t// timeout after 15 seconds of nothing\n\t\t\treturn -1, errors.NewNetworkError(\"Deadline reached\", true)\n\t\t}\n\t\tif p.IsWebsocket() && p.Reader.Buffered() < len(data) {\n\t\t\t// reset buffer read index and create the next reader\n\t\t\theader, reader, err := wsutil.NextReader(p.Socket, ws.StateServerSide)\n\t\t\tp.webFrame = header\n\t\t\tif err != nil {\n\t\t\t\tif err == io.EOF && !header.Fin {\n\t\t\t\t\treturn -1, errors.NewNetworkError(\"EOF in the middle of a frame (kill websocket??)\", true)\n\t\t\t\t} else if err == io.ErrUnexpectedEOF || strings.Contains(err.Error(), \"connection reset by peer\") || strings.Contains(err.Error(), \"use of closed\") {\n\t\t\t\t\treturn -1, errors.NewNetworkError(\"closed conn\", true)\n\t\t\t\t} else if e, ok := err.(stdnet.Error); ok && e.Timeout() {\n\t\t\t\t\treturn -1, errors.NewNetworkError(\"timed out\", true)\n\t\t\t\t}\n\t\t\t\tlog.Warn(\"Problem creating reader for next websocket frame:\", err)\n\t\t\t\treturn -1, err\n\t\t\t}\n\t\t\tp.Reader.Reset(io.LimitReader(reader, header.Length))\n\t\t}\n\t\tn, err = p.Reader.Read(data[written:])\n\t\tif err != nil {\n\t\t\tif err == io.EOF && p.IsWebsocket() && !p.webFrame.Fin {\n\t\t\t\t// TODO: Figure best actions to take upon these events\n\t\t\t\treturn -1, errors.NewNetworkError(\"EOF in the middle of a frame (kill websocket??)\", true)\n\t\t\t} else if err == io.ErrUnexpectedEOF || strings.Contains(err.Error(), \"connection reset by peer\") || strings.Contains(err.Error(), \"use of closed\") {\n\t\t\t\treturn -1, errors.NewNetworkError(\"closed conn\", true)\n\t\t\t} else if e, ok := err.(stdnet.Error); ok && e.Timeout() {\n\t\t\t\treturn -1, errors.NewNetworkError(\"timed out\", true)\n\t\t\t}\n\t\t\tlog.Warn(\"Problem reading from player socket:\", err)\n\t\t\treturn -1, err\n\t\t\t// continue\n\t\t}\n\t}\n\treturn len(data), nil\n}", "title": "" }, { "docid": "dc204c9d7c73edad9812cb90106f1794", "score": "0.569919", "text": "func (c *meteredConn) Read(b []byte) (n int, err error) {\n\tn, err = c.TCPConn.Read(b)\n\tingressTrafficMeter.Mark(int64(n))\n\treturn\n}", "title": "" }, { "docid": "68481a772208d16e1c39da8a31b27183", "score": "0.5695419", "text": "func (pr PooledReader) ReadFull(buf []byte) (n int, err error) {\n\tif pr.ioWorkers != nil {\n\t\tw := pr.ioWorkers.Apply()\n\t\tdefer pr.ioWorkers.Recycle(w)\n\t}\n\treturn io.ReadFull(pr.reader, buf)\n}", "title": "" }, { "docid": "fd63220e341445560f39a3dd8192deaa", "score": "0.5686845", "text": "func (pt *PassThru) Read(p []byte) (int, error) {\n\tn, err := pt.Reader.Read(p)\n\tpt.total += int64(n)\n\n\tif pt.total == 1024*1024*1024 {\n\t\treturn 0, fmt.Errorf(\"File more than 1GB\")\n\t}\n\n\treturn n, err\n}", "title": "" }, { "docid": "1e4db97a041974a76a4b705f7fac4bb0", "score": "0.56822944", "text": "func (notifier *Notifier) read(source io.Reader, data []byte) (size int, res []byte, err error) {\n\tsize, err = source.Read(data)\n\tif err != nil {\n\t\treturn 0, nil, err\n\t}\n\tif size == len(data) {\n\t\t// read full message and return as func return value\n\t\tres := make([]byte, len(data))\n\t\tcopy(data, res)\n\n\t\tvar n = size\n\t\tfor n == len(data) {\n\t\t\tn, err = source.Read(data)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, nil, err\n\t\t\t}\n\t\t\tres = append(res, data...)\n\t\t\tsize += n\n\t\t}\n\t\treturn size, res, nil\n\t}\n\t// info stored in data\n\treturn size, nil, nil\n}", "title": "" }, { "docid": "c4b349f1f8c532ef91c3a1c8dea64a9d", "score": "0.5674084", "text": "func (c *Chunk3) Read(r io.Reader, chunkBodyLen uint32) error {\n\theader := make([]byte, 1)\n\t_, err := io.ReadFull(r, header)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.ChunkStreamID = header[0] & 0x3F\n\n\tc.Body = make([]byte, chunkBodyLen)\n\t_, err = io.ReadFull(r, c.Body)\n\treturn err\n}", "title": "" }, { "docid": "14256544f3c671e235ea8f33aba27af2", "score": "0.56703657", "text": "func (self *File) ChunkedRead(chunkSize int64) *Read {\n\tchunkCount := self.Size() / chunkSize\n\tif (self.Size() % chunkSize) != 0 {\n\t\tchunkCount += 1\n\t}\n\tvar chunks = []Chunk{}\n\tfor index := int64(0); index < chunkCount; index++ {\n\t\tchunks = append(chunks, Chunk{\n\t\t\tOffset: (index * chunkSize),\n\t\t\tLength: chunkSize,\n\t\t})\n\t}\n\treturn &Read{\n\t\tFile: self,\n\t\tAtomic: true,\n\t\tReadAt: time.Now(),\n\t\tChunks: chunks,\n\t}\n}", "title": "" }, { "docid": "083b4b34f7ed37412027750da16385e8", "score": "0.5668969", "text": "func (socket *RLBot) startReadingBytes(payloadChannel chan *payload, errChan chan error) {\n\tfor {\n\t\tdataInfo := make([]byte, 4)\n\t\t_, err := io.ReadFull(socket.conn, dataInfo)\n\t\tif err != nil && err != io.EOF {\n\t\t\terrChan <- err\n\t\t\tbreak\n\t\t}\n\n\t\tdataType := binary.BigEndian.Uint16(dataInfo[:2])\n\t\tdataSize := binary.BigEndian.Uint16(dataInfo[2:])\n\n\t\tdata := make([]byte, dataSize)\n\t\t_, err = io.ReadFull(socket.conn, data)\n\t\tif err != nil && err != io.EOF {\n\t\t\terrChan <- err\n\t\t\tbreak\n\t\t}\n\n\t\tpayloadChannel <- &payload{\n\t\t\tdata: data,\n\t\t\tdataType: dataType,\n\t\t\tdataSize: dataSize,\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "ce6ccde0748339b06a5007e31d70b2e6", "score": "0.5666249", "text": "func (sr StreamReader) Read(ctx context.Context) chan ReadResult {\n\tresult := make(chan ReadResult, 1)\n\n\tgo func() {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tresult <- ReadResult{Error: errors.New(\"cancelled\")}\n\t\tcase r := <-sr.streamChan:\n\t\t\tresult <- r\n\t\t}\n\t\tclose(result)\n\t}()\n\treturn result\n}", "title": "" }, { "docid": "0ddd2b63ef7b3f52faf4857fcbf74af4", "score": "0.5661772", "text": "func (d *RedisStreamReader) Read(p []byte) (n int, err error) {\n\tif d.Client == nil || d.Stream == \"\" {\n\t\treturn 0, errors.New(\"redis connection and name of the stream required\")\n\t}\n\n\t// cannot write if no space\n\tif len(p) == 0 {\n\t\treturn 0, errors.New(\"must have at least one byte in slice to write\")\n\t}\n\t// do we send a linefeed?\n\tif d.nextLF {\n\t\tp[0] = 0x0a\n\t\td.nextLF = false\n\t\treturn 1, nil\n\t}\n\n\t// lets see if we need to get some more messages from the stream first\n\tif len(d.data) == 0 {\n\t\tif d.offset == \"\" {\n\t\t\td.offset = \"0\"\n\t\t}\n\n\t\trecords, err := d.Client.XRead(&redis.XReadArgs{\n\t\t\tStreams: []string{d.Stream, d.offset},\n\t\t\tBlock: time.Millisecond, // do a non-blocking read\n\t\t\tCount: 1,\n\t\t}).Result()\n\t\t// it is weird that the library would return \"redis: nil\" for a non-blocking read\n\t\tif (err != nil && err.Error() != \"redis: nil\") || len(records) > 1 {\n\t\t\treturn 0, errors.New(\"failed to read from stream\")\n\t\t}\n\t\tif records == nil || len(records[0].Messages) == 0 {\n\t\t\treturn 0, nil\n\t\t} else {\n\t\t\td.offset = records[0].Messages[0].ID\n\t\t\ts, ok := records[0].Messages[0].Values[\"object\"].(string)\n\t\t\tif !ok {\n\t\t\t\treturn 0, errors.New(\"failed to read from stream\")\n\t\t\t}\n\n\t\t\t// maybe there's a clever way to go straight from msgpack -> JSON?\n\t\t\tvar data interface{}\n\t\t\terr = msgpack.Unmarshal([]byte(s), &data)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, errors.New(\"failed to read from stream\")\n\t\t\t}\n\t\t\tres, err := json.Marshal(data)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, errors.New(\"failed to read from stream\")\n\t\t\t}\n\n\t\t\td.data = res\n\t\t}\n\t}\n\n\t// transfer the data\n\tconsumed := 0\n\tif len(d.data) > 0 {\n\t\tconsumed = copy(p, d.data)\n\t\td.data = d.data[consumed:]\n\t}\n\n\t// indicate that the next read should include a linefeed\n\tif d.LineFeed {\n\t\td.nextLF = true\n\t}\n\n\treturn consumed, nil\n}", "title": "" }, { "docid": "1448c5fc2cb69de5630a86858d3a0641", "score": "0.56593335", "text": "func (d *Decoder) readChunk(r io.Reader) (n int, err error) {\n\tbuf := vorbis.OggSyncBuffer(&d.syncState, DATA_CHUNK_SIZE)\n\tn, err = io.ReadFull(r, buf[:DATA_CHUNK_SIZE])\n\tvorbis.OggSyncWrote(&d.syncState, int(n))\n\tif err == io.ErrUnexpectedEOF {\n\t\treturn n, io.EOF\n\t}\n\treturn n, err\n}", "title": "" }, { "docid": "0f992dccba471a05cf68ac43457f1021", "score": "0.56513464", "text": "func (d Decoder) read() (*bytes.Buffer, error) {\n\toutput := &bytes.Buffer{}\n\tfor {\n\t\tlengthBytes := make([]byte, 2)\n\t\tif numRead, err := io.ReadFull(d.r, lengthBytes); numRead != 2 {\n\t\t\treturn nil, errors.Wrap(err, \"Couldn't read expected bytes for message length. Read: %d Expected: 2.\", numRead)\n\t\t}\n\n\t\t// Chunk header contains length of current message\n\t\tmessageLen := binary.BigEndian.Uint16(lengthBytes)\n\t\tif messageLen == 0 {\n\t\t\t// If the length is 0, the chunk is done.\n\t\t\treturn output, nil\n\t\t}\n\n\t\tdata, err := d.readData(messageLen)\n\t\tif err != nil {\n\t\t\treturn output, errors.Wrap(err, \"An error occurred reading message data\")\n\t\t}\n\n\t\tnumWritten, err := output.Write(data)\n\t\tif numWritten < len(data) {\n\t\t\treturn output, errors.New(\"Didn't write full data on output. Expected: %d Wrote: %d\", len(data), numWritten)\n\t\t} else if err != nil {\n\t\t\treturn output, errors.Wrap(err, \"Error writing data to output\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f28cb766f3c4a157b62a62694275164a", "score": "0.5650133", "text": "func (c *Channel) Read(b []byte) (int, error) {\n\tif err := c.tomb.Err(); err != tomb.ErrStillAlive {\n\t\treturn 0, err\n\t}\n\tn, err := c.cr.Read(b)\n\treturn n, c.maybePipeError(err)\n}", "title": "" }, { "docid": "bb93fec3357f53a1067ac7bc845663c5", "score": "0.5649301", "text": "func (s *StatsConn) Read(buf []byte) (n int, err error) {\n\tn, err = s.Conn.Read(buf)\n\ts.InBytes += int64(n)\n\treturn\n}", "title": "" }, { "docid": "18115da50be0226a7c0b04b464921dd3", "score": "0.5647667", "text": "func (trace *Trace) read(addr uint64, size uint32) []byte {\n\t// make sure the provided address is within the valid range\n\tif addr > uint64(trace.nRepeats)*trace.size {\n\t\tLog(LOG_ERR, \"Trace read address exceeds trace size\")\n\t}\n\n\tif addr/trace.size != (addr+uint64(size)-1)/trace.size {\n\t\t// file read extends across wrap-around memory boundary\n\n\t\t// number of bytes to read until end of trace\n\t\tsizeRemaining := uint32(trace.size - addr%trace.size)\n\n\t\t// return smaller data block\n\t\treturn trace.data[addr%trace.size : addr%trace.size+uint64(sizeRemaining)]\n\t}\n\n\t// file read does not extend across wrap-around memory boundary\n\treturn trace.data[addr%trace.size : addr%trace.size+uint64(size)]\n}", "title": "" }, { "docid": "5b290258704889f1428f1eac08e7d172", "score": "0.56382537", "text": "func (r *ReadLimiter) Read(p []byte) (int, error) {\n\tif r.l == nil {\n\t\treturn r.r.Read(p)\n\t}\n\tn, err := r.r.Read(p)\n\tif err != nil {\n\t\treturn n, err\n\t}\n\tif err := r.l.WaitN(r.ctx, n); err != nil {\n\t\treturn n, err\n\t}\n\treturn n, nil\n}", "title": "" }, { "docid": "cd30074619421f216bb247b1c9551e99", "score": "0.5636826", "text": "func (b *DecReader) Read(p []byte) (int, error) {\n\tread := 0\n\tfor i := range p {\n\t\tif b.index == 0 {\n\t\t\terr := b.nextChunk()\n\t\t\tif err != nil {\n\t\t\t\treturn read, err\n\t\t\t}\n\t\t}\n\t\tp[i] = b.buf[b.index]\n\t\tb.index++\n\t\tread++\n\t\tif b.index >= len(b.buf) {\n\t\t\tb.index = 0\n\t\t}\n\t}\n\treturn read, nil\n}", "title": "" }, { "docid": "21044b093c97cc67a59d8a705add18ca", "score": "0.56301266", "text": "func (s *slowReader) Read(p []byte) (int, error) {\n\tif s.limiter == nil {\n\t\treturn s.r.Read(p)\n\t}\n\tn, err := s.r.Read(p)\n\tif err != nil {\n\t\treturn n, err\n\t}\n\t// consume n tokens from our bucket, where n is the amount of bytes read\n\tif err := s.limiter.WaitN(context.Background(), n); err != nil {\n\t\treturn n, err\n\t}\n\treturn n, nil\n}", "title": "" }, { "docid": "5c490dc4771587eaf88192bbcc837645", "score": "0.56273", "text": "func (d DecoderV2) read() (*bytes.Buffer, error) {\n\toutput := &bytes.Buffer{}\n\tfor {\n\t\tlengthBytes := make([]byte, 2)\n\t\tif numRead, err := io.ReadFull(d.r, lengthBytes); numRead != 2 {\n\t\t\treturn nil, errors.Wrap(err, \"Couldn't read expected bytes for message length. Read: %d Expected: 2.\", numRead)\n\t\t}\n\n\t\t// Chunk header contains length of current message\n\t\tmessageLen := binary.BigEndian.Uint16(lengthBytes)\n\t\tif messageLen == 0 {\n\t\t\t// If the length is 0, the chunk is done.\n\t\t\treturn output, nil\n\t\t}\n\n\t\tdata, err := d.readData(messageLen)\n\t\tif err != nil {\n\t\t\treturn output, errors.Wrap(err, \"An error occurred reading message data\")\n\t\t}\n\n\t\tnumWritten, err := output.Write(data)\n\t\tif numWritten < len(data) {\n\t\t\treturn output, errors.New(\"Didn't write full data on output. Expected: %d Wrote: %d\", len(data), numWritten)\n\t\t} else if err != nil {\n\t\t\treturn output, errors.Wrap(err, \"Error writing data to output\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6700e5a744260dfac169be6c2318238f", "score": "0.5612335", "text": "func (connection *tdsConnection) Read(b []byte) (n int, err error) {\n\tif !connection.enabled {\n\t\treturn connection.conn.Read(b)\n\t}\n\toutput := b\n\tsoFar := 0\n\tfor len(output) > len(connection.remainder) {\n\t\tcopy(output, connection.remainder)\n\t\toutput = output[len(connection.remainder):]\n\t\tsoFar = soFar + len(connection.remainder)\n\t\tconnection.remainder = make([]byte, 0)\n\t\t// BEGIN FIXME\n\t\tconnection.conn.SetReadDeadline(time.Now().Add(1e9))\n\t\theader, err := readTDSHeader(connection.conn)\n\t\tif err != nil {\n\t\t\treturn soFar, err\n\t\t}\n\t\t// END FIXME\n\t\tconnection.remainder = make([]byte, header.Length-8)\n\t\t_, err = io.ReadFull(connection.conn, connection.remainder)\n\t\tif err != nil {\n\t\t\tlogrus.Debugf(\"Error reading body: %v\", err)\n\t\t\treturn soFar, err\n\t\t}\n\t\ttoCopy := min(len(output), len(connection.remainder))\n\t\tcopy(output, connection.remainder[0:toCopy])\n\t\toutput = output[toCopy:]\n\t\tconnection.remainder = connection.remainder[toCopy:]\n\t\tsoFar = soFar + toCopy\n\t}\n\t// now len(output) <= len(remainder)\n\tcopy(output, connection.remainder)\n\tconnection.remainder = connection.remainder[len(output):]\n\treturn len(b), nil\n}", "title": "" }, { "docid": "a4ee1c9fbe1bd45c89745237b6b38fc4", "score": "0.5605409", "text": "func (r *PipeReader) Read(data []byte) (int, error) {\n\tr.cond.L.Lock()\n\tdefer r.cond.L.Unlock()\n\nRETRY:\n\tn, err := r.buf.Read(data)\n\t// If not closed and no read, wait for writing.\n\tif err == io.EOF && r.rerr == nil && n == 0 {\n\t\tr.cond.Wait()\n\t\tgoto RETRY\n\t}\n\tif err == io.EOF {\n\t\treturn n, r.rerr\n\t}\n\treturn n, err\n}", "title": "" }, { "docid": "82a1dc58b2b9de37c0cd0c079165f0f2", "score": "0.5603331", "text": "func (s *system) read(b []byte) (int, error) {\n\tvar i int = 100\n\tvar err error\n\treturn 0, err\n}", "title": "" }, { "docid": "52086f826e59f682d088fe3cb5e48de0", "score": "0.5603", "text": "func (r *Ring) Read(buf []byte) (n int,err error) {\n for n = 0; r.N > 0 && n < len(buf); n++ {\n off := r.off\n buf[n] = r.buf[off]\n\n off++\n if off == len(r.buf){\n off = 0\n }\n\n r.off = off\n r.N--\n }\n return\n}", "title": "" }, { "docid": "494c24816580eda0a74b9f8a6ea976c7", "score": "0.5602033", "text": "func (p *Pipe) Read(bytes int) (error, error) {\n\tb := make([]byte, bytes)\n\t_, err := p.reader.Read(b)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn errors.New(string(b)), nil\n}", "title": "" }, { "docid": "cbfad61b6e644a4b9cb77afd70ebd92a", "score": "0.56011343", "text": "func (suite *DriverSuite) TestConcurrentStreamReads(c *check.C) {\n\tvar filesize int64 = 128 * 1024 * 1024\n\n\tif testing.Short() {\n\t\tfilesize = 10 * 1024 * 1024\n\t\tc.Log(\"Reducing file size to 10MB for short mode\")\n\t}\n\n\tfilename := randomPath(32)\n\tcontents := randomContents(filesize)\n\n\tdefer suite.deletePath(c, firstPart(filename))\n\n\terr := suite.StorageDriver.PutContent(suite.ctx, filename, contents)\n\tc.Assert(err, check.IsNil)\n\n\tvar wg sync.WaitGroup\n\n\treadContents := func() {\n\t\tdefer wg.Done()\n\t\t/* #nosec G404 */\n\t\toffset := rand.Int63n(int64(len(contents)))\n\t\treader, err := suite.StorageDriver.Reader(suite.ctx, filename, offset)\n\t\tc.Assert(err, check.IsNil)\n\n\t\treadContents, err := ioutil.ReadAll(reader)\n\t\tc.Assert(err, check.IsNil)\n\t\tc.Assert(readContents, check.DeepEquals, contents[offset:])\n\t}\n\n\twg.Add(10)\n\tfor i := 0; i < 10; i++ {\n\t\tgo readContents()\n\t}\n\twg.Wait()\n}", "title": "" }, { "docid": "fdfb3dddab4f92da0fbad78d1e46340b", "score": "0.55871505", "text": "func (c *Conn) Read(p []byte) (int, error) {\n\tfor {\n\t\ti, err := c.parent.Read(p)\n\t\tif err != nil {\n\t\t\treturn i, err\n\t\t}\n\n\t\tif !isSRTP(p[:i]) {\n\t\t\treturn i, nil\n\t\t}\n\n\t\tc.inboundHandler(p[:i])\n\t}\n}", "title": "" }, { "docid": "c4926afd94f4d7590e71b524c82d7ec4", "score": "0.558298", "text": "func CountBytesInStream(input io.ReadCloser) int64 {\n\tbuf, _ := io.ReadAll(input)\n\treturn int64(len(buf))\n}", "title": "" }, { "docid": "38c3143a35b56a2cf77d8a1781452f71", "score": "0.5581084", "text": "func (s *Stream) Read(p []byte) (int, error) {\n\treturn s.decoded.Read(p)\n}", "title": "" }, { "docid": "38c3143a35b56a2cf77d8a1781452f71", "score": "0.5581084", "text": "func (s *Stream) Read(p []byte) (int, error) {\n\treturn s.decoded.Read(p)\n}", "title": "" }, { "docid": "f28a3b6a3f8657b64a5d8e003cfc40b3", "score": "0.557658", "text": "func (f *ChecksumFile) ReadAt(b []byte, off int64) (n int, err error) {\n\tn = 0\n\tvar block *checksumBlock\n\n\t// Read into 'b' block by block.\n\tfor len(b) > 0 {\n\t\tblockNo := int(off / blockDataLength)\n\t\tstart := int(off % blockDataLength)\n\t\tvar nb int\n\t\t// Try fast path:\n\t\tif start == 0 && cap(b) >= blockLength {\n\t\t\tif nb, err = f.readBlockInPlace(b, blockNo); err != nil {\n\t\t\t\treturn n, err\n\t\t\t}\n\t\t\tif nb > len(b) {\n\t\t\t\tnb = len(b)\n\t\t\t}\n\t\t} else {\n\t\t\tif block == nil {\n\t\t\t\tblock = getChecksumBlock()\n\t\t\t\tdefer returnChecksumBlock(block)\n\t\t\t}\n\n\t\t\t// This is the block we're currently reading.\n\t\t\tif err = f.readBlock(block, blockNo); nil != err {\n\t\t\t\treturn n, err\n\t\t\t}\n\n\t\t\t// What data in this block are we interested in?\n\t\t\tif block.length <= start {\n\t\t\t\t// The offset we want to read is in this block but past the end of the\n\t\t\t\t// available data in the block. Stop here.\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// Copy as much of the block's data as we can into the caller's buffer.\n\t\t\tnb = copy(b, block.data()[start:])\n\t\t}\n\t\toff += int64(nb)\n\t\tb = b[nb:]\n\t\tn += nb\n\t}\n\n\t// If we're here, there wasn't an error reading blocks, but we might not have read every block.\n\tif len(b) != 0 {\n\t\t// We couldn't read as much as the user wanted. We follow the convention of\n\t\t// os.ReadAt and return io.EOF.\n\t\treturn n, io.EOF\n\t}\n\n\t// We read everything the user wanted, no error.\n\treturn n, nil\n}", "title": "" }, { "docid": "c6a982752eb9530e3541f5cb108aa2c2", "score": "0.55698967", "text": "func (r *Reader) Read(p []byte) (n int, err error) {\n\t// Check context\n\tif err = r.ctx.Err(); err != nil {\n\t\treturn\n\t}\n\n\t// Read\n\treturn r.reader.Read(p)\n}", "title": "" }, { "docid": "94d071b004ec470fb89a630611bacfc8", "score": "0.55674994", "text": "func (rself *privateReaderAdapter) Read(data []byte) (int, error) {\n\tlenToCopy := len(rself.bufferToBeRead)\n\tif lenToCopy == 0 {\n\t\trself.workReceipt = <-rself.Writer.workChan\n\t\tif rself.workReceipt == nil {\n\t\t\t// no more data to consume\n\t\t\trself.closeReceived = true\n\t\t\treturn 0, io.EOF\n\t\t}\n\t\trself.bufferToBeRead = *rself.workReceipt\n\t\tlenToCopy = len(rself.bufferToBeRead)\n\t}\n\tif lenToCopy > len(data) {\n\t\tlenToCopy = len(data)\n\t}\n\tcopy(data[:lenToCopy], rself.bufferToBeRead[:lenToCopy])\n\trself.bufferToBeRead = rself.bufferToBeRead[lenToCopy:]\n\tif len(rself.bufferToBeRead) == 0 {\n\t\trself.Writer.doneWorkChan <- rself.workReceipt\n\t\trself.workReceipt = nil\n\t}\n\treturn lenToCopy, nil\n}", "title": "" }, { "docid": "dd40b2ea08de7660a676fdc73c8b693a", "score": "0.5552215", "text": "func (er Reader) Read(p []byte) (int, error) {\nagain:\n\tn, err := er.reader.Read(p)\n\tif err == nil {\n\t\treturn n, nil\n\t}\n\n\t// keep retrying on EAGAIN\n\tok, errno := getErrno(err)\n\tif ok && (errno == syscall.EAGAIN || errno == syscall.EINTR) {\n\t\tgoto again\n\t}\n\n\treturn n, err\n}", "title": "" } ]
d67de1bb997759d8ca5910cee2c4c46f
Show get detail of matching document, if version is not set will get the latest version
[ { "docid": "a98b7cd36fdc4f393c156af8b95d9794", "score": "0.65470284", "text": "func Show(doc string, id int64, v ...int) (*Document, error) {\n\tbs := bson.M{\"type\": doc, \"id\": id}\n\n\tif len(v) > 0 && v[0] != 0 {\n\t\tbs[\"v\"] = v[0]\n\t}\n\n\tvar d Document\n\tvar e error\n\tif e = collection().Find(bs).Sort(\"-$natural\").Limit(1).One(&d); e == nil {\n\t\tjson.Unmarshal([]byte(d.Data.(string)), &d.DataPresented)\n\t\tjson.Unmarshal([]byte(d.UpdatedBy.(string)), &d.UserPresented)\n\t}\n\n\treturn &d, e\n}", "title": "" } ]
[ { "docid": "13045ba56fb44891ec0331b9b2c2ad00", "score": "0.5839558", "text": "func (d *Database) Show(name, docID string, params url.Values) (http.Header, []byte, error) {\n\tdesignDocPath := designPath(name, \"_show\")\n\tif docID != \"\" {\n\t\tdesignDocPath = fmt.Sprintf(\"%s/%s\", designDocPath, docID)\n\t}\n\treturn d.resource.Get(designDocPath, nil, params)\n}", "title": "" }, { "docid": "c9ca99220399dd0cf002ed6e1b5cfbfb", "score": "0.57671565", "text": "func game_version_show(ctx *iris.Context) {\n gameshort := ctx.GetString(\"gameshort\")\n game := &objects.Game{}\n app.Database.Where(\"short = ?\", gameshort).Or(\"id = ?\", cast.ToUint(gameshort)).First(game)\n if game.Short != gameshort && game.ID != cast.ToUint(gameshort) {\n utils.WriteJSON(ctx, iris.StatusNotFound, utils.Error(\"The game does not exist.\").Code(2125))\n return\n }\n\n // Get game version\n friendly_version := ctx.GetString(\"friendly_version\")\n version := &objects.GameVersion{}\n app.Database.Where(\"friendly_version = ?\", friendly_version).Or(\"id = ?\", cast.ToUint(friendly_version)).Where(\"game_id = ?\", game.ID).First(version)\n if version.FriendlyVersion != friendly_version && version.ID != cast.ToUint(friendly_version) {\n utils.WriteJSON(ctx, iris.StatusNotFound, utils.Error(\"This version name does not exist.\").Code(2185))\n return\n }\n\n // Return info\n utils.WriteJSON(ctx, iris.StatusOK, iris.Map{\"error\": false, \"count\": 1, \"data\": utils.ToMap(version)})\n}", "title": "" }, { "docid": "905367593fd18c447ec1983695951201", "score": "0.56532645", "text": "func (s *ShowEntity) ShowVersion() ShowVersion {\n\thandle, _ := s.node.GetHandle(\"json\")\n\tvar showversion ShowVersion\n\thandle.AddCommand(&showversion)\n\thandle.Call()\n\thandle.Close()\n\treturn showversion\n}", "title": "" }, { "docid": "73ec3c2479958127a189dd516804c27c", "score": "0.56524485", "text": "func (c *client) Version(ctx context.Context) (*driver.Version, error) {\n\ti := &info{}\n\t_, err := c.DoJSON(ctx, http.MethodGet, \"/\", nil, i)\n\treturn &driver.Version{\n\t\tVersion: i.Version,\n\t\tVendor: i.Vendor.Name,\n\t\tFeatures: i.Features,\n\t\tRawResponse: i.Data,\n\t}, err\n}", "title": "" }, { "docid": "1ad983226d41188edbb313d0f3c7860c", "score": "0.56218296", "text": "func GetChartVersion(w http.ResponseWriter, req *http.Request, params Params) {\n\tvar chart models.Chart\n\tchartID := fmt.Sprintf(\"%s/%s\", params[\"repo\"], params[\"chartName\"])\n\n\tchartCollection := db.Collection(chartCollection)\n\tfilter := bson.M{\n\t\t\"_id\": chartID,\n\t\t\"chartversions\": bson.M{\"$elemMatch\": bson.M{\"version\": params[\"version\"]}},\n\t}\n\tprojection := bson.M{\n\t\t\"name\": 1, \"repo\": 1, \"description\": 1, \"home\": 1, \"keywords\": 1, \"maintainers\": 1, \"sources\": 1,\n\t\t\"chartversions\": 1,\n\t}\n\tfindResult := chartCollection.FindOne(context.Background(), filter, &chart, options.FindOne().SetProjection(projection))\n\tif findResult == mongo.ErrNoDocuments {\n\t\tlog.WithError(findResult).Errorf(\"could not find chart with id %s\", chartID)\n\t\tresponse.NewErrorResponse(http.StatusNotFound, \"could not find chart\").Write(w)\n\t\treturn\n\t}\n\n\tfor i := range chart.ChartVersions {\n\t\tif chart.ChartVersions[i].Version == params[\"version\"] {\n\t\t\tchart.ChartVersions = chart.ChartVersions[i : i+1]\n\t\t\tbreak\n\t\t}\n\t}\n\t// Cut the versions slice down to just one element\n\tcvr := newChartVersionResponse(&chart, chart.ChartVersions[0])\n\tresponse.NewDataResponse(cvr).Write(w)\n}", "title": "" }, { "docid": "65ce988146a697bcc4d13aeb2e4740d1", "score": "0.56184596", "text": "func (db *Database) getAvailableRev(doc *document, revid string) (Body, error) {\n\tfor ; revid != \"\"; revid = doc.History[revid].Parent {\n\t\tif body := doc.getRevision(revid); body != nil {\n\t\t\treturn body, nil\n\t\t}\n\t}\n\treturn nil, &base.HTTPError{404, \"missing\"}\n}", "title": "" }, { "docid": "2b9a561f9d6e2616a49c8b08f46f6534", "score": "0.56109697", "text": "func Show(param *ShowParam, name string) error {\n\tsess := session.New()\n\tst := storage.New(sess)\n\n\tvar (\n\t\trel *release.Release\n\t\terr error\n\t)\n\tif param.Timestamp == \"\" {\n\t\trel, err = st.FindLatestRelease(name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\trel, err = st.FindReleaseByTimestamp(name, param.Timestamp)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Format in tab-separated columns with a tab stop of 8.\n\ttw := tabwriter.NewWriter(os.Stdout, 0, 8, 1, '\\t', 0)\n\trel.Inspect(tw)\n\ttw.Flush()\n\n\treturn nil\n}", "title": "" }, { "docid": "9b834fb3b03e32f2cb7fbff5b29177a5", "score": "0.55902135", "text": "func (a *API) GetVersion(c *gin.Context) {\n\tnamespace := c.Param(\"namespace\")\n\tname := c.Param(\"name\")\n\tdata := &models.GetMetadata{\n\t\tNamespace: namespace,\n\t\tName: name,\n\t}\n\tversion, err := a.Store.GetMetadata(c.Request.Context(), data)\n\tif err != nil {\n\t\tc.Error(err).SetMeta(models.ErrGetMetadataFailed)\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, version)\n}", "title": "" }, { "docid": "0e8868205eb38ac2dff79fffaa77c018", "score": "0.5585283", "text": "func getRevInfo(resp *http.Response) (string, error) {\n\tif rev := resp.Header.Get(\"ETag\"); rev == \"\" {\n\t\treturn \"\", fmt.Errorf(\"CouchDB did not return rev info\")\n\t} else {\n\t\treturn rev[1 : len(rev)-1], nil\n\t}\n}", "title": "" }, { "docid": "892fa9fa015dcbe6936d5d838bfdc8b5", "score": "0.5580615", "text": "func (db *Database) Get(docid string) (Body, error) {\n\treturn db.GetRev(docid, \"\", false, nil)\n}", "title": "" }, { "docid": "cee3539c2a7560a01a3e5891053c53db", "score": "0.5551424", "text": "func GetChartVersionReadme(w http.ResponseWriter, req *http.Request, params Params) {\n\n\tvar files models.ChartFiles\n\tfileID := fmt.Sprintf(\"%s/%s-%s\", params[\"repo\"], params[\"chartName\"], params[\"version\"])\n\n\tfilesCollection := db.Collection(filesCollection)\n\tfilter := bson.M{\"_id\": fileID}\n\tfindResult := filesCollection.FindOne(context.Background(), filter, &files, options.FindOne())\n\tif findResult == mongo.ErrNoDocuments {\n\t\tlog.WithError(findResult).Errorf(\"could not find files with id %s\", fileID)\n\t\thttp.NotFound(w, req)\n\t\treturn\n\t}\n\treadme := []byte(files.Readme)\n\tif len(readme) == 0 {\n\t\tlog.Errorf(\"could not find a README for id %s\", fileID)\n\t\thttp.NotFound(w, req)\n\t\treturn\n\t}\n\tw.Write(readme)\n}", "title": "" }, { "docid": "f9e87e29401a42ff143ffc1fb0e02499", "score": "0.55427647", "text": "func (a *App) Version(ref string) (*Version, error) {\n\n\treq := a.bucket.r.newRequest(fmt.Sprintf(`\n query {\n bucket(name: \"%s\") {\n app(name: \"%s\") {\n version(ref: \"%s\") {\n id\n uploadedTimeplate\n }\n }\n }\n }\n `, a.bucket.Name(), a.Name(), ref))\n\n\ttype responseContainer struct {\n\t\tBucket objects.Bucket `json:\"bucket\"`\n\t}\n\n\tresp := new(responseContainer)\n\terr := a.bucket.r.mgr.c.graphql.Run(a.bucket.r.mgr.c.ctx, req, &resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Version{\n\t\tapp: a,\n\t\tid: resp.Bucket.App.Version.ID,\n\t\tuploadedTimeplate: time.Unix(int64(resp.Bucket.App.Version.UploadedTimeplate), 0),\n\t}, nil\n}", "title": "" }, { "docid": "140ca957547cb364305ffa51840db5bf", "score": "0.5535183", "text": "func (d *Direct) getVersion(asset string) (Version, error) {\n\tresp, err := http.Get(d.getRoot() + asset)\n\tif err != nil {\n\t\treturn Version{}, err\n\t}\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn Version{}, err\n\t}\n\n\tres := directVersionRegex.FindStringSubmatch(string(body))\n\tnames := directVersionRegex.SubexpNames()\n\tver := Version{\n\t\tBranch: d.ReleaseBranch,\n\t}\n\n\tfor i := range res {\n\t\tif i != 0 {\n\t\t\tswitch names[i] {\n\t\t\tcase \"Build\":\n\t\t\t\tver.BuildNumber = res[i]\n\t\t\tcase \"Hash\":\n\t\t\t\tver.VersionHash = res[i]\n\t\t\t}\n\t\t}\n\t}\n\tif len(ver.BuildNumber) == 0 || len(ver.VersionHash) == 0 {\n\t\treturn Version{}, errors.New(\"fail to extract the build info\")\n\t}\n\treturn ver, nil\n}", "title": "" }, { "docid": "8657e963e2d001637333766c75054671", "score": "0.55346036", "text": "func GetDoc(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\t// validate parameters\n\tid := params[\"id\"]\n\tver := params[\"version\"]\n\tif !validate(id, ver) {\n\t\thttp.Error(w, \"Invalid parameters\", 400)\n\t\treturn\n\t}\n\n\t// get the document and server it\n\tmime, file, err := ServiceGetDoc(id, ver)\n\tif err == nil {\n\t\t// calculare baseurl & replace in data file\n\t\tbaseurl := fmt.Sprintf(\"http://%s\", r.Host)\n\t\tif r.TLS != nil {\n\t\t\tbaseurl = fmt.Sprintf(\"https://%s\", r.Host)\n\t\t}\n\t\tdata := strings.Replace(string(file), \"<<baseurl>>\", baseurl, -1)\n\t\t// write file\n\t\tw.Header().Set(\"Content-Type\", mime)\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write([]byte(data))\n\t} else {\n\t\thttp.NotFound(w, r)\n\t}\n}", "title": "" }, { "docid": "15c0731eaed039f5a163b605fba9ff04", "score": "0.55196583", "text": "func getVersion(ctx context.Context, client papi.PAPI, property *papi.Property, readVersion string) (*papi.GetPropertyVersionsResponse, error) {\n\tversions, err := client.GetPropertyVersions(ctx, papi.GetPropertyVersionsRequest{\n\t\tPropertyID: property.PropertyID,\n\t\tContractID: property.ContractID,\n\t\tGroupID: property.GroupID,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif readVersion == \"LATEST\" {\n\t\tversion, err := client.GetLatestVersion(ctx, papi.GetLatestVersionRequest{\n\t\t\tPropertyID: versions.PropertyID,\n\t\t\tActivatedOn: \"\",\n\t\t\tContractID: versions.ContractID,\n\t\t\tGroupID: versions.GroupID,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn version, nil\n\t}\n\n\tv, err := strconv.Atoi(readVersion)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%w: %s\", ErrPropertyVersionNotValid, err)\n\t}\n\tfor _, item := range versions.Versions.Items {\n\t\tif item.PropertyVersion == v {\n\t\t\treturn &papi.GetPropertyVersionsResponse{\n\t\t\t\tPropertyID: versions.PropertyID,\n\t\t\t\tPropertyName: versions.PropertyName,\n\t\t\t\tAccountID: versions.AccountID,\n\t\t\t\tContractID: versions.ContractID,\n\t\t\t\tGroupID: versions.GroupID,\n\t\t\t\tAssetID: versions.AssetID,\n\t\t\t\tVersion: item,\n\t\t\t}, nil\n\t\t}\n\t}\n\n\treturn nil, ErrPropertyVersionNotFound\n}", "title": "" }, { "docid": "48c70e3335cdda9d1bd4725d59d4a545", "score": "0.55195636", "text": "func (this *v1apiManager) GetVersion() string { return this.version }", "title": "" }, { "docid": "06e24ca7f46e96c30584d72dd9fc24df", "score": "0.5508516", "text": "func (r rootRoutes) getVersion(c echo.Context) error {\n\n\turl := c.QueryParam(\"q\")\n\n\tif len(url) > 0 {\n\t\tresp, err := cmdversions.GetVersionByUrlOrErr(url)\n\t\tif err != nil {\n\t\t\tr.logger.KV(\"err\", \"could not fetch version by url\").Error(err)\n\t\t\treturn c.String(500, \"Error\")\n\t\t}\n\t\treturn c.JSON(200, resp)\n\t}\n\n\tresp, err := cmdversions.GetDefaultOrErr(r.deps)\n\n\tif err != nil {\n\t\tr.logger.KV(\"err\", \"Failure to fetch default version\").Error(err)\n\t\treturn c.String(500, \"Error\")\n\t}\n\n\treturn c.JSON(200, resp)\n\n}", "title": "" }, { "docid": "23728979a3f6830865f82d60c5312640", "score": "0.55081713", "text": "func GetDocument(resp http.ResponseWriter, req *http.Request, ps httprouter.Params) {\n\tdoc := store.Details(ps.ByName(\"ident\"))\n\tlog.Info().Str(\"identifier\", ps.ByName(\"ident\")).Msg(\"Loading document from store\")\n\traw, err := json.Marshal(doc)\n\tif err != nil {\n\t\tresp.WriteHeader(http.StatusInternalServerError)\n\t} else if doc.Identifier == \"\" {\n\t\tresp.WriteHeader(http.StatusNotFound)\n\t} else {\n\t\tresp.Header().Add(\"Content-Type\", \"application/json\")\n\t\tresp.Write(raw)\n\t}\n}", "title": "" }, { "docid": "d6d4fe4d8a19ec57b5d2767b53932fa7", "score": "0.5469517", "text": "func Version(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tfmt.Fprintf(w, \"Version us %s, Repo is %s, Commit is %s\", version.RELEASE, version.REPO, version.COMMIT)\n}", "title": "" }, { "docid": "757ce3cc0ce95320ef3b4d162b70d500", "score": "0.5468796", "text": "func (cc *DocumentCC) Version() string { return ccVersion }", "title": "" }, { "docid": "b16e60a440728083c7bdb619374edc69", "score": "0.5457886", "text": "func getDoc(c echo.Context) error {\n\tkey := c.Param(\"id\")\n\tfilePath := dataDir + \"/\" + key\n\tfs, err := os.Stat(filePath)\n\tif err != nil || fs.Size() <= 0 {\n\t\treturn c.JSON(statusErr, newErrorResp(key, \"key not found\", err))\n\t}\n\tf, err := os.Open(dataDir + \"/\" + key)\n\tdefer f.Close()\n\tif err != nil {\n\t\treturn c.JSON(statusErr, newErrorResp(key, \"unable to open data\", err))\n\t}\n\td, err := ioutil.ReadAll(f)\n\tif err != nil {\n\t\treturn c.JSON(statusErr, newErrorResp(key, \"error reading file\", err))\n\t}\n\n\tmetadata, err := getMetadata(key)\n\tif err != nil {\n\t\treturn c.JSON(statusErr, newErrorResp(key, \"error reading metadata\", err))\n\t}\n\tr := newSuccessResp(key, \"\")\n\tr.Timestamp = metadata.Timestamp\n\tr.Name = metadata.Name\n\tr.ContentType = metadata.ContentType\n\tr.Extractor = metadata.Extractor\n\tr.Title = metadata.Title\n\tr.CreationDate = metadata.CreationDate\n\tr.ModificationDate = metadata.ModificationDate\n\tr.Document = string(d)\n\n\treturn c.JSON(statusOk, r)\n}", "title": "" }, { "docid": "3428513237f22bf526370a0e10936141", "score": "0.544406", "text": "func (bt *BlipTester) GetDocAtRev(requestedDocID, requestedDocRev string) (resultDoc RestDocument, err error) {\n\n\tdocs := map[string]RestDocument{}\n\tchangesFinishedWg := sync.WaitGroup{}\n\trevsFinishedWg := sync.WaitGroup{}\n\n\tdefer func() {\n\t\t// Clean up all profile handlers that are registered as part of this test\n\t\tdelete(bt.blipContext.HandlerForProfile, \"changes\")\n\t\tdelete(bt.blipContext.HandlerForProfile, \"rev\")\n\t}()\n\n\t// -------- Changes handler callback --------\n\tbt.blipContext.HandlerForProfile[\"changes\"] = func(request *blip.Message) {\n\n\t\t// Send a response telling the other side we want ALL revisions\n\n\t\tbody, err := request.Body()\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"Error getting request body: %v\", err))\n\t\t}\n\n\t\tif string(body) == \"null\" {\n\t\t\tchangesFinishedWg.Done()\n\t\t\treturn\n\t\t}\n\n\t\tif !request.NoReply() {\n\n\t\t\t// unmarshal into json array\n\t\t\tchangesBatch := [][]interface{}{}\n\n\t\t\tif err := base.JSONUnmarshal(body, &changesBatch); err != nil {\n\t\t\t\tpanic(fmt.Sprintf(\"Error unmarshalling changes. Body: %vs. Error: %v\", string(body), err))\n\t\t\t}\n\n\t\t\tresponseVal := [][]interface{}{}\n\t\t\tfor _, change := range changesBatch {\n\t\t\t\trevId := change[2].(string)\n\t\t\t\tresponseVal = append(responseVal, []interface{}{revId})\n\t\t\t\trevsFinishedWg.Add(1)\n\t\t\t}\n\n\t\t\tresponse := request.Response()\n\t\t\tresponseValBytes, err := base.JSONMarshal(responseVal)\n\t\t\tlog.Printf(\"responseValBytes: %s\", responseValBytes)\n\t\t\tif err != nil {\n\t\t\t\tpanic(fmt.Sprintf(\"Error marshalling response: %v\", err))\n\t\t\t}\n\t\t\tresponse.SetBody(responseValBytes)\n\n\t\t}\n\t}\n\n\t// -------- Rev handler callback --------\n\tbt.blipContext.HandlerForProfile[\"rev\"] = func(request *blip.Message) {\n\n\t\tdefer revsFinishedWg.Done()\n\t\tbody, err := request.Body()\n\t\tvar doc RestDocument\n\t\terr = base.JSONUnmarshal(body, &doc)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"Unexpected err: %v\", err))\n\t\t}\n\t\tdocId := request.Properties[\"id\"]\n\t\tdocRev := request.Properties[\"rev\"]\n\t\tdoc.SetID(docId)\n\t\tdoc.SetRevID(docRev)\n\t\tdocs[docId] = doc\n\n\t\tif docId == requestedDocID && docRev == requestedDocRev {\n\t\t\tresultDoc = doc\n\t\t}\n\n\t}\n\n\t// Send subChanges to subscribe to changes, which will cause the \"changes\" profile handler above to be called back\n\tchangesFinishedWg.Add(1)\n\tsubChangesRequest := blip.NewRequest()\n\tsubChangesRequest.SetProfile(\"subChanges\")\n\tsubChangesRequest.Properties[\"continuous\"] = \"false\"\n\n\tsent := bt.sender.Send(subChangesRequest)\n\tif !sent {\n\t\tpanic(fmt.Sprintf(\"Unable to subscribe to changes.\"))\n\t}\n\n\tchangesFinishedWg.Wait()\n\trevsFinishedWg.Wait()\n\n\treturn resultDoc, nil\n\n}", "title": "" }, { "docid": "5c602a3a74e55a6fe5a3c0dbfb24c2bc", "score": "0.5439491", "text": "func GetVersionInfo(e ld.Entity) interface{} { return e.Get(Prop_VersionInfo.ID) }", "title": "" }, { "docid": "694e4b4243d6f4b80e387ce602dab743", "score": "0.5427753", "text": "func (r *queryResolver) Version(ctx context.Context, id string) (*restModel.APIVersion, error) {\n\tv, err := model.VersionFindOneId(id)\n\tif err != nil {\n\t\treturn nil, InternalServerError.Send(ctx, fmt.Sprintf(\"Error while finding version with id: `%s`: %s\", id, err.Error()))\n\t}\n\tif v == nil {\n\t\treturn nil, ResourceNotFound.Send(ctx, fmt.Sprintf(\"Unable to find version with id: `%s`\", id))\n\t}\n\tapiVersion := restModel.APIVersion{}\n\tapiVersion.BuildFromService(*v)\n\treturn &apiVersion, nil\n}", "title": "" }, { "docid": "060e24d919cbad0e96ba81ef17530ab0", "score": "0.542713", "text": "func GetDocument(myParms ParamStruct, indexParm string, typeParm string, recParm string)(resp *http.Response, respStr string){\n\tmyParms.Url = myParms.Url + \"/\" + indexParm + \"/\" + typeParm + \"/\" + recParm\n\tmyParms.Method = \"GET\"\n\tresp, respStr = getURL(myParms,\"\")\n\treturn resp, respStr\n}", "title": "" }, { "docid": "c4603bf98778eaf7815a2b4f3e757efa", "score": "0.54172206", "text": "func (c *Client) Version() (version *routes.VersionResult, err error) {\n\tversion = new(routes.VersionResult)\n\terr = c.get(version, c.URL(\"version\"))\n\terr = errors.Wrap(err, \"getting version from API\")\n\treturn\n}", "title": "" }, { "docid": "85b9a42d2249a19077a302415941d90f", "score": "0.54160875", "text": "func (h *ArticleHandler) GetDetail(c *fiber.Ctx) error {\n\tslug := c.Params(\"slug\")\n\n\ta, err := h.repository.FindBySlug(slug)\n\ta.Viewed++\n\n\t// update viewed is not critical error can be ignored\n\t_ = h.repository.Update(a, a.ID)\n\n\tif err != nil {\n\t\tlog.Debugf(\"Error while get detail: %s\", err)\n\t\treturn h.Error(404)\n\t}\n\n\treturn h.JSON(c, 200, &a)\n}", "title": "" }, { "docid": "4beb8b032071862999af436e616316c4", "score": "0.5395588", "text": "func Detail(w http.ResponseWriter, r *http.Request) {\n\tpk, err := strconv.ParseInt(chi.URLParam(r, \"pk\"), 10, 64)\n\tif err != nil {\n\t\thttp.Error(w, http.StatusText(400), 400)\n\t\treturn\n\t}\n\n\tbook, ok := books[pk]\n\tif !ok {\n\t\thttp.Error(w, http.StatusText(404), 404)\n\t\treturn\n\t}\n\n\trender.JSON(w, r, book)\n}", "title": "" }, { "docid": "7eb6c43c65fd81c7de413548cce9f590", "score": "0.5356007", "text": "func (bt *BlipTester) GetDocAtRev(requestedDocID, requestedDocRev string) (resultDoc rest.RestDocument, err error) {\n\n\tdocs := map[string]rest.RestDocument{}\n\tchangesFinishedWg := sync.WaitGroup{}\n\trevsFinishedWg := sync.WaitGroup{}\n\n\tdefer func() {\n\t\t// Clean up all profile handlers that are registered as part of this test\n\t\tdelete(bt.blipContext.HandlerForProfile, \"changes\")\n\t\tdelete(bt.blipContext.HandlerForProfile, \"rev\")\n\t}()\n\n\t// -------- Changes handler callback --------\n\tbt.blipContext.HandlerForProfile[\"changes\"] = func(request *blip.Message) {\n\n\t\t// Send a response telling the other side we want ALL revisions\n\n\t\tbody, err := request.Body()\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"Error getting request body: %v\", err))\n\t\t}\n\n\t\tif string(body) == \"null\" {\n\t\t\tchangesFinishedWg.Done()\n\t\t\treturn\n\t\t}\n\n\t\tif !request.NoReply() {\n\n\t\t\t// unmarshal into json array\n\t\t\tchangesBatch := [][]interface{}{}\n\n\t\t\tif err := json.Unmarshal(body, &changesBatch); err != nil {\n\t\t\t\tpanic(fmt.Sprintf(\"Error unmarshalling changes. Body: %vs. Error: %v\", string(body), err))\n\t\t\t}\n\n\t\t\tresponseVal := [][]interface{}{}\n\t\t\tfor _, change := range changesBatch {\n\t\t\t\trevId := change[2].(string)\n\t\t\t\tresponseVal = append(responseVal, []interface{}{revId})\n\t\t\t\trevsFinishedWg.Add(1)\n\t\t\t}\n\n\t\t\tresponse := request.Response()\n\t\t\tresponseValBytes, err := json.Marshal(responseVal)\n\t\t\tlog.Printf(\"responseValBytes: %s\", responseValBytes)\n\t\t\tif err != nil {\n\t\t\t\tpanic(fmt.Sprintf(\"Error marshalling response: %v\", err))\n\t\t\t}\n\t\t\tresponse.SetBody(responseValBytes)\n\n\t\t}\n\t}\n\n\t// -------- Rev handler callback --------\n\tbt.blipContext.HandlerForProfile[\"rev\"] = func(request *blip.Message) {\n\n\t\tdefer revsFinishedWg.Done()\n\t\tbody, err := request.Body()\n\t\tvar doc rest.RestDocument\n\t\terr = json.Unmarshal(body, &doc)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"Unexpected err: %v\", err))\n\t\t}\n\t\tdocId := request.Properties[\"id\"]\n\t\tdocRev := request.Properties[\"rev\"]\n\t\tdoc.SetID(docId)\n\t\tdoc.SetRevID(docRev)\n\t\tdocs[docId] = doc\n\n\t\tif docId == requestedDocID && docRev == requestedDocRev {\n\t\t\tresultDoc = doc\n\t\t}\n\n\t}\n\n\t// Send subChanges to subscribe to changes, which will cause the \"changes\" profile handler above to be called back\n\tchangesFinishedWg.Add(1)\n\tsubChangesRequest := blip.NewRequest()\n\tsubChangesRequest.SetProfile(\"subChanges\")\n\tsubChangesRequest.Properties[\"continuous\"] = \"false\"\n\n\tsent := bt.sender.Send(subChangesRequest)\n\tif !sent {\n\t\tpanic(fmt.Sprintf(\"Unable to subscribe to changes.\"))\n\t}\n\n\tchangesFinishedWg.Wait()\n\trevsFinishedWg.Wait()\n\n\treturn resultDoc, nil\n\n}", "title": "" }, { "docid": "74911d6f4843a4a1d04f54d7de556c02", "score": "0.53441715", "text": "func (c *Connection) Version(ctx context.Context) (string, error) {\n\tresp, err := c.Request(ctx).\n\t\tSetResult(&api.VersionResponse{}).\n\t\tGet(\"/version\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn resp.Result().(*api.VersionResponse).Version, nil\n}", "title": "" }, { "docid": "6b7b8ed38730030e8dbd5fb6b1718472", "score": "0.53430724", "text": "func (o LookupImageResultOutput) Version() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupImageResult) string { return v.Version }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8da711bc6fd0d23de44635aa91de6ecf", "score": "0.532921", "text": "func (o VersionResponseOutput) Revision() pulumi.StringOutput {\n\treturn o.ApplyT(func(v VersionResponse) string { return v.Revision }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "5d4546dc25981bfb36b8046037a786b2", "score": "0.53262365", "text": "func (v Versioning) Get(r Reference) (interface{}, error) {\n\tif err := v.checkReference(r); err != nil {\n\t\treturn nil, err\n\t}\n\tr2, err := RemoveFragment(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tversions, err := v.load(r2)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif u := r.URI(); v.p.MatchString(u.Fragment) {\n\t\tm := v.p.FindStringSubmatch(u.Fragment)\n\t\tswitch {\n\t\tcase m[1] == \"versions\":\n\t\t\treturn versions, nil\n\t\tcase m[2] == \"version\":\n\t\t\tx, err := strconv.ParseInt(m[3], 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tvr, err := versions.Find(int(x))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tr, err := ParseRef(vr.TargetURI)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn v.c.Get(r)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unrecognized uri fragment: %q\", u.Fragment)\n\t\t}\n\t}\n\tif len(versions) == 0 {\n\t\treturn nil, NotFound\n\t}\n\t// return the latest version\n\tr3, err := ParseRef(versions[len(versions)-1].TargetURI)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn v.c.Get(r3)\n}", "title": "" }, { "docid": "cd46501236e40dfd0ba74503419006c9", "score": "0.52966195", "text": "func (dbclient *couchDatabase) getDocumentRevision(id string) string {\n\trev := \"\"\n\n\t// See if the document already exists, we need the rev for saves and deletes\n\t_, revdoc, err := dbclient.readDoc(id)\n\tif err == nil {\n\t\t// set the revision to the rev returned from the document read\n\t\trev = revdoc\n\t}\n\treturn rev\n}", "title": "" }, { "docid": "4d8310bdda584a9be3067eef179e0bb5", "score": "0.52954686", "text": "func (sc *SourceContext) Version() SourceID {\n\tv := nearestVersion(append([]Tag{sc.NearestTag}, sc.Tags...))\n\t// Append revision ID.\n\tv.Meta = sc.Revision\n\tv.DefaultFormat = semv.Complete //XXX issue with semv?\n\n\tsv := SourceID{\n\t\tLocation: SourceLocation{\n\t\t\tRepo: sc.RemoteURL,\n\t\t\tDir: sc.OffsetDir,\n\t\t},\n\t\tVersion: v,\n\t}\n\tlogging.Log.Debug.Printf(\"Version: % #v\", sv)\n\treturn sv\n}", "title": "" }, { "docid": "a26435e0273aa36594c9485f5cdef6df", "score": "0.52922267", "text": "func (r Version1Resource) Get(request *http.Request) (interface{}, error) {\n\treturn &ServiceDocument{\n\t\tLinks: map[string]rest.Link{\n\t\t\t\"self\": r.Self(),\n\t\t\t\"masterkey\": r.masterKeyResource.Self(),\n\t\t\t\"identities\": r.identitiesResource.Self(),\n\t\t\t\"secrets\": r.secretsResource.Self(),\n\t\t\t\"estimate\": r.estimateResource.Self(),\n\t\t\t\"generate\": r.generateResource.Self(),\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "d5a8a584ab4c2d3645b38bab74d08a80", "score": "0.5290076", "text": "func (c *AdminController) GetVersion(ctx echo.Context) error {\n\tresult := mailslurper.Version{\n\t\tVersion: c.serverVersion,\n\t}\n\n\treturn ctx.JSON(http.StatusOK, result)\n}", "title": "" }, { "docid": "ad930f22493fdf4133c9571d387ec399", "score": "0.52878433", "text": "func (s Service) GetVersionTransferDetail(ctx context.Context, docID, versionID, transferID []byte) (*transferdetails.TransferDetail, documents.Model, error) {\n\tmodel, err := s.coreAPISrv.GetDocumentVersion(ctx, docID, versionID)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tdata, model, err := s.transferDetailsService.DeriveTransferDetail(ctx, model, transferID)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn data, model, nil\n}", "title": "" }, { "docid": "5510651c89dd0aa62e47b6eee66fabbd", "score": "0.5286134", "text": "func (c *CommonController) Version(writer http.ResponseWriter, request *http.Request) {\n\tresponse := commonDTO.NewVersionResponse(edgex.Version, c.serviceName)\n\tc.sendResponse(writer, request, common.ApiVersionRoute, response, http.StatusOK)\n}", "title": "" }, { "docid": "fdc523ff19607c467d02b54dd090df6b", "score": "0.5274012", "text": "func (db *Database) getRevFromDoc(doc *document, revid string, listRevisions bool) (Body, error) {\n\tif err := AuthorizeAnyDocChannels(db.user, doc.Channels); err != nil {\n\t\t// FIX: This only authorizes vs the current revision, not the one the client asked for!\n\t\treturn nil, err\n\t}\n\tif revid == \"\" {\n\t\trevid = doc.CurrentRev\n\t\tif doc.History[revid].Deleted == true {\n\t\t\treturn nil, &base.HTTPError{Status: 404, Message: \"deleted\"}\n\t\t}\n\t}\n\tbody := doc.getRevision(revid)\n\tif body == nil {\n\t\treturn nil, &base.HTTPError{Status: 404, Message: \"missing\"}\n\t}\n\tif doc.History[revid].Deleted {\n\t\tbody[\"_deleted\"] = true\n\t}\n\tif listRevisions {\n\t\thistory := doc.History.getHistory(revid)\n\t\tbody[\"_revisions\"] = encodeRevisions(history)\n\t}\n\treturn body, nil\n}", "title": "" }, { "docid": "66d7c47a43bfb69e054389c8128e8437", "score": "0.5273674", "text": "func (a *Client) RetrieveSinglePolicyVersionShort(params *RetrieveSinglePolicyVersionParams, authInfo runtime.ClientAuthInfoWriter) (*RetrieveSinglePolicyVersionOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewRetrieveSinglePolicyVersionParams()\n\t}\n\n\tif params.Context == nil {\n\t\tparams.Context = context.Background()\n\t}\n\n\tif params.RetryPolicy != nil {\n\t\tparams.SetHTTPClientTransport(params.RetryPolicy)\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"retrieveSinglePolicyVersion\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/agreement/admin/policies/{policyId}/versions\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &RetrieveSinglePolicyVersionReader{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\n\tswitch v := result.(type) {\n\n\tcase *RetrieveSinglePolicyVersionOK:\n\t\treturn v, nil\n\tcase *RetrieveSinglePolicyVersionNotFound:\n\t\treturn nil, v\n\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Unexpected Type %v\", reflect.TypeOf(v))\n\t}\n}", "title": "" }, { "docid": "0d2a0aa614a9c3b616f2bfa53b147d5b", "score": "0.5269921", "text": "func (*API) Version(args *struct{}, res *string) error {\n\t*res, _ = narada.Version()\n\treturn nil\n}", "title": "" }, { "docid": "8c88679a3e0e2122631e47c56c05c85a", "score": "0.5266477", "text": "func (response *Response) Version() string {\n\treturn response.doc.FindElement(\"/Response\").SelectAttrValue(\"Version\", \"\")\n}", "title": "" }, { "docid": "591397b15c8a35589e357d6fd207b15d", "score": "0.5264646", "text": "func (o SBOMReferenceNoteResponseOutput) Version() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SBOMReferenceNoteResponse) string { return v.Version }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4c0ccd02da62eab2779f43038ec3cb14", "score": "0.5256947", "text": "func Version(ctx context.Context) (string, error) {\n\treq, err := http.NewRequest(\"GET\", \"https://golang.org/dl/\", nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treq = req.WithContext(ctx)\n\n\tres, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode != http.StatusOK {\n\t\treturn \"\", fmt.Errorf(\"status code error: %d %s\", res.StatusCode, res.Status)\n\t}\n\n\tdoc, err := goquery.NewDocumentFromReader(res.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\ts := doc.Find(\"div.toggleVisible\").First()\n\tver, exists := s.Attr(\"id\")\n\tif !exists {\n\t\treturn \"\", errors.New(\"id attribute not found in div.toggleVisible\")\n\t}\n\n\tif !strings.HasPrefix(ver, versionPrefix) {\n\t\treturn \"\", fmt.Errorf(\"id attribute div.toggleVisible does not start with %s, ver=%s\", versionPrefix, ver)\n\t}\n\n\treturn ver[len(versionPrefix):], nil\n}", "title": "" }, { "docid": "6d7a1f793ef1804fd1897796f316d6c2", "score": "0.5252932", "text": "func (o *PCSearchResult) Version() int {\n\n\treturn 1\n}", "title": "" }, { "docid": "64ac8d194ea2cb4007fcf108d4075d80", "score": "0.5250392", "text": "func findRevisionInVersionDetail(v *v2alpha2.VersionDetail) (string, error) {\n\treturn experiment.FindVariableInVersionDetail(v, \"revision\")\n}", "title": "" }, { "docid": "d79784c9c82c16bfa27b308c21cf03fe", "score": "0.5247331", "text": "func (c *Client) Get(index string, id string) (*Response, error) {\n\treqURL := fmt.Sprintf(\"%s://%s/%s/_doc/%s\", c.Protocol, c.Addr,\n\t\turl.QueryEscape(index),\n\t\turl.QueryEscape(id))\n\n\treturn c.Do(\"GET\", reqURL, nil)\n}", "title": "" }, { "docid": "45596f1b9f1bb62948ed58f9412e7c7f", "score": "0.52386934", "text": "func Show(c ProductionAPIGetter, id int, queryParams ...func(q url.Values)) (*File, error) {\n\tf := &File{}\n\tr := Resource{Endpoint: SHOW, Id: id}\n\terr := c.Get(r, f, queryParams...)\n\treturn f, err\n}", "title": "" }, { "docid": "2a1bde149475a8c4da72add50f4a5d2f", "score": "0.52345955", "text": "func (m *Mongo) GetVersion(id, editionID, versionID, state string) (*models.Version, error) {\n\ts := m.Session.Copy()\n\tdefer s.Close()\n\n\tversionNumber, err := strconv.Atoi(versionID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tselector := buildVersionQuery(id, editionID, state, versionNumber)\n\n\tvar version models.Version\n\terr = s.DB(m.Database).C(\"instances\").Find(selector).One(&version)\n\tif err != nil {\n\t\tif err == mgo.ErrNotFound {\n\t\t\treturn nil, errs.ErrVersionNotFound\n\t\t}\n\t\treturn nil, err\n\t}\n\treturn &version, nil\n}", "title": "" }, { "docid": "11f95e93e45fc7a10ed9c28f55ab6f1c", "score": "0.5232842", "text": "func view(c *cli.Context) error {\n\tif c.Int(\"build-number\") == 0 {\n\t\treturn util.InvalidCommand(\"build-number\")\n\t}\n\n\t// get org, repo and number information from cmd flags\n\torg, repo, number := c.String(\"org\"), c.String(\"repo\"), c.Int(\"build-number\")\n\n\t// create a vela client\n\tclient, err := vela.NewClient(c.String(\"addr\"), nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set token from global config\n\tclient.Authentication.SetTokenAuth(c.String(\"token\"))\n\n\tbuild, _, err := client.Build.Get(org, repo, number)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tswitch c.String(\"output\") {\n\tcase \"json\":\n\t\toutput, err := json.MarshalIndent(build, \"\", \" \")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfmt.Println(string(output))\n\tdefault:\n\t\t// default output should contain all resources fields\n\t\toutput, err := yaml.Marshal(build)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfmt.Println(string(output))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a8987d58237f97a4e4af916cc6184a7e", "score": "0.5225146", "text": "func (o *SoftwarerepositoryReleaseAllOf) GetVersion() string {\n\tif o == nil || o.Version == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Version\n}", "title": "" }, { "docid": "94997805de5d3adb3d764511118b7750", "score": "0.51957166", "text": "func DefaultReadAppVersion(ctx context.Context, in *AppVersion, db *gorm1.DB, fs *query1.FieldSelection) (*AppVersion, error) {\n\tif in == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif ormObj.Id == \"\" {\n\t\treturn nil, errors1.EmptyIdError\n\t}\n\tif hook, ok := interface{}(&ormObj).(AppVersionORMWithBeforeReadApplyQuery); ok {\n\t\tif db, err = hook.BeforeReadApplyQuery(ctx, db, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif db, err = gorm2.ApplyFieldSelection(ctx, db, fs, &AppVersionORM{}); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(AppVersionORMWithBeforeReadFind); ok {\n\t\tif db, err = hook.BeforeReadFind(ctx, db, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tormResponse := AppVersionORM{}\n\tif err = db.Where(&ormObj).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormResponse).(AppVersionORMWithAfterReadFind); ok {\n\t\tif err = hook.AfterReadFind(ctx, db, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "title": "" }, { "docid": "95dce3113c6ab5311d195abddccff128", "score": "0.5184684", "text": "func (c *Client) Version() (api.Version, error) {\n\tvar ver api.Version\n\terr := c.do(\"GET\", \"/version\", nil, &ver)\n\treturn ver, err\n}", "title": "" }, { "docid": "3f22f94424c27479923f1a1ce9976087", "score": "0.51829916", "text": "func (o PackageNoteResponseOutput) Version() VersionResponseOutput {\n\treturn o.ApplyT(func(v PackageNoteResponse) VersionResponse { return v.Version }).(VersionResponseOutput)\n}", "title": "" }, { "docid": "a3cad8164d2bd5a7e840d8b72f7742b8", "score": "0.51629114", "text": "func (o PackageOccurrenceResponseOutput) Version() VersionResponseOutput {\n\treturn o.ApplyT(func(v PackageOccurrenceResponse) VersionResponse { return v.Version }).(VersionResponseOutput)\n}", "title": "" }, { "docid": "50aa0894e0183c61b818e501bd451deb", "score": "0.51565623", "text": "func (q *Query) Version() Version {\n\treturn Version(q.FirstField(QueryFieldNameVersion)).Normalize()\n}", "title": "" }, { "docid": "d592db64a496fb8c6041e2e11888a815", "score": "0.5154407", "text": "func (m *Monitor) QueryVersion() (ret VersionInfo, err error) {\n\tcmd := struct {\n\t}{}\n\tbs, err := json.Marshal(map[string]interface{}{\n\t\t\"execute\": \"query-version\",\n\t\t\"arguments\": cmd,\n\t})\n\tif err != nil {\n\t\treturn\n\t}\n\tbs, err = m.mon.Run(bs)\n\tif err != nil {\n\t\treturn\n\t}\n\tres := struct {\n\t\tRes json.RawMessage `json:\"return\"`\n\t}{}\n\tif err = json.Unmarshal(bs, &res); err != nil {\n\t\treturn\n\t}\n\tif err = json.Unmarshal([]byte(res.Res), &ret); err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "1eafe2b4fa5bb1d94de3d7447001b01f", "score": "0.5148269", "text": "func (*SystemController) GetVersion(ctx *gin.Context) {\n\tctx.JSON(http.StatusOK, gin.H{\"version\": Version})\n}", "title": "" }, { "docid": "663048fefdc90f5d472b8be81d731871", "score": "0.51477563", "text": "func (c *VersionInfoDaoImpl) GetLatestScsVersion(sid string) (*model.VersionInfo, error) {\n\tvar result model.VersionInfo\n\tif err := c.DB.Where(\"service_id=? and final_status='success'\", sid).Last(&result).Error; err != nil {\n\t\treturn nil, err\n\t}\n\treturn &result, nil\n}", "title": "" }, { "docid": "a7622287368131e90f8dc4b27a08fe22", "score": "0.51473397", "text": "func (o UserSourceInfoResponseOutput) Version() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v UserSourceInfoResponse) *string { return v.Version }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f4374b02b58df0b5f84a57c02cae0625", "score": "0.51444495", "text": "func (o MavenArtifactResponseOutput) Version() pulumi.StringOutput {\n\treturn o.ApplyT(func(v MavenArtifactResponse) string { return v.Version }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2cdd82cb67717081e5da7e622e071d14", "score": "0.51428986", "text": "func Version(w http.ResponseWriter, r *http.Request) {\n\tv := mustAuthority(r.Context()).Version()\n\trender.JSON(w, VersionResponse{\n\t\tVersion: v.Version,\n\t\tRequireClientAuthentication: v.RequireClientAuthentication,\n\t})\n}", "title": "" }, { "docid": "58ba7aae7e55a1bf93861b39c4c107bf", "score": "0.51304173", "text": "func printDocsFromSearchResults(searchResults *bleve.SearchResult) {\n\t// collect the original documents\n for _, val := range searchResults.Hits {\n id := val.ID\n doc, _ := BleveIndex.Document(id)\n\n rv := struct {\n ID string `json:\"id\"`\n Fields map[string]interface{} `json:\"fields\"`\n }{\n ID: id,\n Fields: map[string]interface{}{},\n }\n\n for _, field := range doc.Fields {\n var newval interface{}\n switch field := field.(type) {\n case *document.TextField:\n newval = string(field.Value())\n case *document.NumericField:\n n, err := field.Number()\n if err == nil {\n newval = n\n }\n case *document.DateTimeField:\n d, err := field.DateTime()\n if err == nil {\n newval = d.Format(time.RFC3339Nano)\n }\n }\n existing, existed := rv.Fields[field.Name()]\n if existed {\n switch existing := existing.(type) {\n case []interface{}:\n rv.Fields[field.Name()] = append(existing, newval)\n case interface{}:\n arr := make([]interface{}, 2)\n arr[0] = existing\n arr[1] = newval\n rv.Fields[field.Name()] = arr\n }\n } else {\n rv.Fields[field.Name()] = newval\n }\n }\n\n js, _ := json.MarshalIndent(rv, \"\", \" \")\n fmt.Printf(\"%s\\n\", js)\n }\n\n}", "title": "" }, { "docid": "3360a30cc867993c672c12d7eb15a15d", "score": "0.512118", "text": "func (a *App) Latest() (*Version, error) {\n\n\treq := a.bucket.r.newRequest(fmt.Sprintf(`\n query {\n bucket(name: \"%s\") {\n app(name: \"%s\") {\n latest {\n id\n uploadedTimeplate\n }\n }\n }\n }\n `, a.bucket.Name(), a.Name()))\n\n\ttype responseContainer struct {\n\t\tBucket objects.Bucket `json:\"bucket\"`\n\t}\n\n\tresp := new(responseContainer)\n\terr := a.bucket.r.mgr.c.graphql.Run(a.bucket.r.mgr.c.ctx, req, &resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Version{\n\t\tapp: a,\n\t\tid: resp.Bucket.App.Latest.ID,\n\t\tuploadedTimeplate: time.Unix(int64(resp.Bucket.App.Latest.UploadedTimeplate), 0),\n\t}, nil\n}", "title": "" }, { "docid": "0615b31193cd496ecd3e7bcbcce3d81e", "score": "0.5120757", "text": "func (b *boltDb) RetrieveVersion(ids ...string) (result []*wyc.Version, err error) {\n\terr = b.db.View(func(tx *bolt.Tx) error {\n\t\tbucket := tx.Bucket(bucketVersion)\n\t\tfor _, id := range ids {\n\t\t\tvalue := bucket.Get([]byte(id))\n\t\t\tif value == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tobj := &wyc.Version{}\n\t\t\terr := obj.UnmarshalJSON(value)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tresult = append(result, obj)\n\t\t}\n\t\treturn nil\n\t})\n\treturn\n}", "title": "" }, { "docid": "ee2d987a8e8b571e7abbc0f2f4f787c4", "score": "0.51137584", "text": "func (e *Experiment) GetVersionDetail(versionName string) (*v2alpha2.VersionDetail, error) {\n\tif e == nil {\n\t\treturn nil, errors.New(\"getVersionDetail(...) called on nil experiment\")\n\t}\n\tif e.Spec.VersionInfo != nil {\n\t\tif e.Spec.VersionInfo.Baseline.Name == versionName {\n\t\t\treturn &e.Spec.VersionInfo.Baseline, nil\n\t\t}\n\t\tfor i := 0; i < len(e.Spec.VersionInfo.Candidates); i++ {\n\t\t\tif e.Spec.VersionInfo.Candidates[i].Name == versionName {\n\t\t\t\treturn &e.Spec.VersionInfo.Candidates[i], nil\n\t\t\t}\n\t\t}\n\t}\n\treturn nil, errors.New(\"no version found with name \" + versionName)\n}", "title": "" }, { "docid": "43ad8f7fa794b554087d26efa2ae0703", "score": "0.5112344", "text": "func (r rootRoutes) getAppVersion(c echo.Context) error {\n\n\tv, err := cmdversions.GetAppVersionOrErr()\n\n\tif err != nil {\n\t\tr.logger.KV(\"err\", \"error reading file\").Error(err)\n\t\treturn c.String(500, \"Error\")\n\t}\n\n\treturn c.JSON(200, v)\n\n}", "title": "" }, { "docid": "0e889319bca56778a27ac213c93bc739", "score": "0.510111", "text": "func readLatestVersion(ctx context.Context, t *testing.T) string {\n\tclient, err := storage.NewClient(ctx)\n\tif err != nil {\n\t\tt.Fatalf(\"Cannot create cloud storage client: err %s\", err)\n\t}\n\trc, err := client.Bucket(\"fuchsia\").Object(\"development/F1_LINUX\").NewReader(ctx)\n\tif err != nil {\n\t\tt.Fatalf(\"Cannot create cloud storage reader: err %s\", err)\n\t}\n\tversion, err := io.ReadAll(rc)\n\trc.Close()\n\tif err != nil {\n\t\tt.Fatalf(\"Cannot read from cloud storage: err %s\", err)\n\t}\n\tt.Logf(\"Latest Version: %s\", version)\n\treturn strings.TrimSuffix(string(version), \"\\n\")\n}", "title": "" }, { "docid": "773399893b074b3179dbdfff1adcc0a5", "score": "0.51001275", "text": "func (c *client) GetVersion(req *GetVersionRequest) (resp *GetVersionResponse, err error) {\n\terr = c.do(\"get_version\", &req, &resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn\n}", "title": "" }, { "docid": "3fcd392797ef2c0099389d44fcc042e6", "score": "0.5099065", "text": "func findSelectedVersion(ctx context.Context, modDir, modPath string) (latestVersion string, err error) {\n\tdefer func() {\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"could not find selected version for %s: %v\", modPath, err)\n\t\t}\n\t}()\n\n\tcmd := exec.CommandContext(ctx, \"go\", \"list\", \"-m\", \"-f\", \"{{.Version}}\", \"--\", modPath)\n\tcmd.Env = copyEnv(ctx, cmd.Env)\n\tcmd.Dir = modDir\n\tout, err := cmd.Output()\n\tif err != nil {\n\t\treturn \"\", cleanCmdError(err)\n\t}\n\treturn strings.TrimSpace(string(out)), nil\n}", "title": "" }, { "docid": "8f57dad0841a969205f154dbd6a387fb", "score": "0.5095134", "text": "func (o AppEngineRoutingResponseOutput) Version() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AppEngineRoutingResponse) string { return v.Version }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c35839ab5283debe1ca59ea90c376566", "score": "0.50947785", "text": "func (o DistributionResponseOutput) LatestVersion() VersionResponseOutput {\n\treturn o.ApplyT(func(v DistributionResponse) VersionResponse { return v.LatestVersion }).(VersionResponseOutput)\n}", "title": "" }, { "docid": "f59989f3c4535b40a1126cfd3487eb77", "score": "0.50920403", "text": "func GetVersion(c *gin.Context) {\n\tinfo := AppInfo{\n\t\tVersion: variable.Version,\n\t\tDeployed: variable.BuildTime,\n\t}\n\tc.JSON(http.StatusOK, info)\n}", "title": "" }, { "docid": "b8953fa71381a987b86fd28f299a6134", "score": "0.50860417", "text": "func (o *ViewProjectFile) GetVersion() ViewRelationship {\n\tif o == nil || o.Version == nil {\n\t\tvar ret ViewRelationship\n\t\treturn ret\n\t}\n\treturn *o.Version\n}", "title": "" }, { "docid": "73ab29fbbdc9a34a9c81a2d22a43ad9c", "score": "0.50659287", "text": "func (db *CRDTMvDB) GetVersion( t byte, key []byte, vv *utils.VersionVector) (*MvDBCRDT,error) {\n\tkeybase := createKeyBase( key)\n\tif db.prefs.StoreLast {\n\t\tobj, err := db.getLatest( t, keybase)\n\t\tif err != nil {\n\t\t\treturn obj, nil\n\t\t}\n\t\tif obj.Vv.SmallerOrEqual( vv) {\n\t\t\treturn obj, err\n\t\t}\n\t}\n\treturn db.buildVersion( t, keybase, vv)\n}", "title": "" }, { "docid": "a7d993e5ab6afb864df2f0199d5d3c98", "score": "0.5064608", "text": "func (o *ViewProjectFile) GetVersionOk() (*ViewRelationship, bool) {\n\tif o == nil || o.Version == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Version, true\n}", "title": "" }, { "docid": "f065ec81e97b08728d1d300be41def13", "score": "0.50583994", "text": "func GetVersion(cName string) string {\n\tc, err := GetCollection(cName)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn c.Version\n}", "title": "" }, { "docid": "0a4c9d4b56ecf9680610757bff4d6f42", "score": "0.50561434", "text": "func (dbclient *couchDatabase) readDoc(id string) (*couchDoc, string, error) {\n\tvar couchDoc couchDoc\n\tattachments := []*attachmentInfo{}\n\tdbName := dbclient.dbName\n\n\tcouchdbLogger.Debugf(\"[%s] Entering ReadDoc() id=[%s]\", dbName, id)\n\tdefer couchdbLogger.Debugf(\"[%s] Exiting ReadDoc()\", dbclient.dbName)\n\n\tif !utf8.ValidString(id) {\n\t\treturn nil, \"\", errors.Errorf(\"doc id [%x] not a valid utf8 string\", id)\n\t}\n\n\treadURL, err := url.Parse(dbclient.couchInstance.url())\n\tif err != nil {\n\t\tcouchdbLogger.Errorf(\"URL parse error: %s\", err)\n\t\treturn nil, \"\", errors.Wrapf(err, \"error parsing CouchDB URL: %s\", dbclient.couchInstance.url())\n\t}\n\n\tquery := readURL.Query()\n\tquery.Add(\"attachments\", \"true\")\n\n\t// get the number of retries\n\tmaxRetries := dbclient.couchInstance.conf.MaxRetries\n\n\tresp, couchDBReturn, err := dbclient.handleRequest(http.MethodGet, \"ReadDoc\", readURL, nil, \"\", \"\", maxRetries, true, &query, id)\n\tif err != nil {\n\t\tif couchDBReturn != nil && couchDBReturn.StatusCode == 404 {\n\t\t\tcouchdbLogger.Debugf(\"[%s] Document not found (404), returning nil value instead of 404 error\", dbclient.dbName)\n\t\t\t// non-existent document should return nil value instead of a 404 error\n\t\t\t// for details see https://github.com/hyperledger-archives/fabric/issues/936\n\t\t\treturn nil, \"\", nil\n\t\t}\n\t\tcouchdbLogger.Debugf(\"[%s] couchDBReturn=%v\\n\", dbclient.dbName, couchDBReturn)\n\t\treturn nil, \"\", err\n\t}\n\tdefer closeResponseBody(resp)\n\n\t// Get the media type from the Content-Type header\n\tmediaType, params, err := mime.ParseMediaType(resp.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Get the revision from header\n\trevision, err := getRevisionHeader(resp)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\n\t// Handle as JSON if multipart is NOT detected\n\tif !strings.HasPrefix(mediaType, \"multipart/\") {\n\t\tcouchDoc.jsonValue, err = io.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", errors.Wrap(err, \"error reading response body\")\n\t\t}\n\n\t\treturn &couchDoc, revision, nil\n\t}\n\n\t// Handle as attachment.\n\t// Set up the multipart reader based on the boundary.\n\tmultipartReader := multipart.NewReader(resp.Body, params[\"boundary\"])\n\tfor {\n\t\tp, err := multipartReader.NextPart()\n\t\tif err == io.EOF {\n\t\t\tbreak // processed all parts\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, \"\", errors.Wrap(err, \"error reading next multipart\")\n\t\t}\n\n\t\tdefer p.Close()\n\n\t\tcouchdbLogger.Debugf(\"[%s] part header=%s\", dbclient.dbName, p.Header)\n\n\t\tif p.Header.Get(\"Content-Type\") == \"application/json\" {\n\t\t\tpartdata, err := io.ReadAll(p)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, \"\", errors.Wrap(err, \"error reading multipart data\")\n\t\t\t}\n\t\t\tcouchDoc.jsonValue = partdata\n\t\t\tcontinue\n\t\t}\n\n\t\t// Create an attachment structure and load it.\n\t\tattachment := &attachmentInfo{}\n\t\tattachment.ContentType = p.Header.Get(\"Content-Type\")\n\t\tcontentDispositionParts := strings.Split(p.Header.Get(\"Content-Disposition\"), \";\")\n\n\t\tif strings.TrimSpace(contentDispositionParts[0]) != \"attachment\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tswitch p.Header.Get(\"Content-Encoding\") {\n\t\tcase \"gzip\": // See if the part is gzip encoded\n\n\t\t\tvar respBody []byte\n\n\t\t\tgr, err := gzip.NewReader(p)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, \"\", errors.Wrap(err, \"error creating gzip reader\")\n\t\t\t}\n\t\t\trespBody, err = io.ReadAll(gr)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, \"\", errors.Wrap(err, \"error reading gzip data\")\n\t\t\t}\n\n\t\t\tcouchdbLogger.Debugf(\"[%s] Retrieved attachment data\", dbclient.dbName)\n\t\t\tattachment.AttachmentBytes = respBody\n\t\t\tattachment.Length = uint64(len(attachment.AttachmentBytes))\n\t\t\tattachment.Name = p.FileName()\n\t\t\tattachments = append(attachments, attachment)\n\n\t\tdefault:\n\n\t\t\t// retrieve the data, this is not gzip\n\t\t\tpartdata, err := io.ReadAll(p)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, \"\", errors.Wrap(err, \"error reading multipart data\")\n\t\t\t}\n\t\t\tcouchdbLogger.Debugf(\"[%s] Retrieved attachment data\", dbclient.dbName)\n\t\t\tattachment.AttachmentBytes = partdata\n\t\t\tattachment.Length = uint64(len(attachment.AttachmentBytes))\n\t\t\tattachment.Name = p.FileName()\n\t\t\tattachments = append(attachments, attachment)\n\t\t}\n\t}\n\n\tcouchDoc.attachments = attachments\n\treturn &couchDoc, revision, nil\n}", "title": "" }, { "docid": "3c00d1c338147772c619868238250f34", "score": "0.50456846", "text": "func ShowVersion() string {\n\treturn fmt.Sprintf(`\n\t-----------------------------------------------------------------------\n\tEKS DNS Troubleshooter\n\tRelease: %v\n\tBuild: %v\n\tRepository: %v\n\t-----------------------------------------------------------------------\n\t`, RELEASE, COMMIT, REPO)\n}", "title": "" }, { "docid": "3aa60d7f3dceaa02be53efab8d065421", "score": "0.5043794", "text": "func (o TargetResponseOutput) Version() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v TargetResponse) *string { return v.Version }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "6efe5c84378b793792c82a934ed74bff", "score": "0.50429165", "text": "func (c *Controller) Version(writer http.ResponseWriter, request *http.Request) {\n\tresponse := commonDtos.NewVersionSdkResponse(internal.ApplicationVersion, internal.SDKVersion)\n\tc.sendResponse(writer, request, common.ApiVersionRoute, response, http.StatusOK)\n}", "title": "" }, { "docid": "ec31f4ee48fd6c2a9099e7257d55f024", "score": "0.50424814", "text": "func (p *PackageDetailView) Retrieve(w http.ResponseWriter, r *http.Request) response.Response {\n\tslug := mux.Vars(r)[\"slug\"]\n\n\tpack := &Package{}\n\n\tif p.Config.DB().Where(\"name = ?\", slug).Preload(\"Versions\").Preload(\"Versions.License\").First(pack).RecordNotFound() {\n\t\treturn response.New(http.StatusNotFound)\n\t}\n\n\treturn response.OK().Result(pack)\n\n}", "title": "" }, { "docid": "14c8e665a2cc775f3617867572f0f9d3", "score": "0.5042246", "text": "func GetFullVersion() string {\n\treturn \"scribe \" + GetVersion()\n}", "title": "" }, { "docid": "61b1338d1306c5d6bf8a86b79082f769", "score": "0.5038972", "text": "func (s *SearchService) Version(version bool) *SearchService {\r\n\ts.searchSource = s.searchSource.Version(version)\r\n\treturn s\r\n}", "title": "" }, { "docid": "fd76cf2a5c3cfd9ce018d6747fda0b0c", "score": "0.5029298", "text": "func (o SDKInfoResponseOutput) Version() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SDKInfoResponse) string { return v.Version }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "5ba5321c094515d63ba7873068fbca20", "score": "0.5025942", "text": "func GetVersionIRI(e ld.Entity) interface{} { return e.Get(Prop_VersionIRI.ID) }", "title": "" }, { "docid": "19c7a3ad53012716cac8555d5e877850", "score": "0.50242925", "text": "func (s *SmartContract) getDocHistory(stub shim.ChaincodeStubInterface, args []string) sc.Response {\n\n\tfmt.Println(\"Inside HISTORY\")\n\n\t//check number of arguments recvd\n\tif len(args) != 1 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting 1 AssetID\")\n\t}\n\n\t//args[0] user1\n\t//args[1] assetID\n\tid := args[0]\n\n\t// Read history\n\tresultsIterator, err := stub.GetHistoryForKey(id)\n\tif err != nil {\n\t\treturn shim.Error(\"Not Found\")\n\t}\n\tdefer resultsIterator.Close()\n\n\t// Write return buffer\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(\"{ \\\"values\\\": [\")\n\tfor resultsIterator.HasNext() {\n\t\tit, _ := resultsIterator.Next()\n\t\tif buffer.Len() > 15 {\n\t\t\tbuffer.WriteString(\",\")\n\t\t}\n\t\t//var doc Doc\n\t\tbuffer.WriteString(\"{\\\"timestamp\\\":\\\"\")\n\t\tbuffer.WriteString(time.Unix(it.Timestamp.Seconds, int64(it.Timestamp.Nanos)).Format(time.Stamp))\n\t\tbuffer.WriteString(\"\\\", \\\"text\\\":\")\n\t\tbuffer.WriteString(string(it.Value))\n\t\tbuffer.WriteString(\"}\")\n\t}\n\tbuffer.WriteString(\"]}\")\n\n\treturn shim.Success(buffer.Bytes())\n}", "title": "" }, { "docid": "0cd51fd2980c3075651b922f98ac2a54", "score": "0.5023936", "text": "func (vs *ViewServer) Get(args *GetArgs, reply *GetReply) error {\n\n\t// Your code here.\n\t// the clerk can ask for the latest view from the view service\n\t// without doing Ping(). it uses Get() to fetch the latest view.\n\tvs.rwm.Lock()\n\tdefer vs.rwm.Unlock()\n\n\tif vs.currview != nil {\n\t\treply.View = *vs.currview\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b735f3c53ed6497a54ed48925e0bb657", "score": "0.50191253", "text": "func (c *Changelog) Version(version string) *Version {\n\tfor _, v := range c.Versions {\n\t\tif strings.ToLower(v.Name) == strings.ToLower(version) {\n\t\t\treturn v\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e24e8987706651a845a3d19e14987ec6", "score": "0.5007728", "text": "func (o GitFileSourceResponseOutput) Revision() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GitFileSourceResponse) string { return v.Revision }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "a62b3047fcd8881b80ad8ca8f1a46015", "score": "0.499998", "text": "func (c *Client) GetVersion(ctx context.Context) (vi VersionInfo, err error) {\n\treq, err := c.newRequest(http.MethodGet, pathVersion, \"\", nil)\n\tif err != nil {\n\t\treturn VersionInfo{}, err\n\t}\n\n\tres, err := c.HTTPClient.Do(req.WithContext(ctx))\n\tif err != nil {\n\t\treturn VersionInfo{}, err\n\t}\n\tdefer res.Body.Close()\n\n\tif err := jsonresp.ReadResponse(res.Body, &vi); err != nil {\n\t\treturn VersionInfo{}, err\n\t}\n\treturn vi, nil\n}", "title": "" }, { "docid": "759b1ae4caf6492a1f5372992b44a8ee", "score": "0.49996948", "text": "func getVersion(w http.ResponseWriter, r *http.Request) {\n\tlog.Trace(\"resource/version:getVersion() Entering\")\n\tdefer log.Trace(\"resource/version:getVersion() Leaving\")\n\tw.WriteHeader(http.StatusOK)\n\tlog.Debugf(\"resource/version:getVersion() WLS Version: %s CommitHash: %s\", version.Version, version.GitHash)\n\tw.Write([]byte(fmt.Sprintf(\"%s-%s\", version.Version, version.GitHash)))\n}", "title": "" }, { "docid": "63b0fe33b208d484986323fb523c83a8", "score": "0.49949443", "text": "func (s *SearchService) Version(version bool) *SearchService {\n\ts.searchSource = s.searchSource.Version(version)\n\treturn s\n}", "title": "" }, { "docid": "25d7914f83d5b43892b5a3cd5a820ab7", "score": "0.4993194", "text": "func Get(doc string, id int64) ([]*Document, error) {\n\tbs := bson.M{\"type\": doc, \"id\": id}\n\n\tvar d []*Document\n\te := collection().Find(bs).Sort(\"-v\").All(&d)\n\n\treturn d, e\n}", "title": "" }, { "docid": "9a4152929f7e720e79832de3ec43a312", "score": "0.49929333", "text": "func (o PCSearchResultsList) Version() int {\n\n\treturn 1\n}", "title": "" }, { "docid": "cd3aaad773b63fc1b1e370f35ea99b7a", "score": "0.49819383", "text": "func (c *SingleSpoe) GetVersion(transactionID string) (int64, error) {\n\treturn c.getVersion(transactionID)\n}", "title": "" }, { "docid": "887985b476a6c8f7e668ad62a0516e0c", "score": "0.49818882", "text": "func (r *InfoActionRunner) Detail() string {\n\treturn fmt.Sprintf(\"Get API version info\")\n}", "title": "" }, { "docid": "f323bac648faec1d49e14b4e59cc16f9", "score": "0.49758774", "text": "func (o UpgradeNoteResponseOutput) Version() VersionResponseOutput {\n\treturn o.ApplyT(func(v UpgradeNoteResponse) VersionResponse { return v.Version }).(VersionResponseOutput)\n}", "title": "" }, { "docid": "4dca16877e6a390a951e974994ee5eaf", "score": "0.49747142", "text": "func GetLatestLink(w http.ResponseWriter, r *http.Request) {\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tvar opt options.FindOptions\n\topt.SetBatchSize(15)\n\topt.SetLimit(15)\n\n\tctx, _ := context.WithTimeout(context.Background(), 10*time.Second)\n\tcur, err := collection.Find(ctx, bson.M{}, &opt)\n\tif err != nil {\n\t\t// https://stackoverflow.com/a/40096757/12985309\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(\"500 - Something bad happened! \" + err.Error()))\n\t\treturn\n\t}\n\n\tctx, _ = context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cur.Close(ctx)\n\n\tvar result []structs.Link\n\n\tctx, _ = context.WithTimeout(context.Background(), 10*time.Second)\n\tfor cur.Next(ctx) {\n\t\tvar doc structs.Link\n\t\terr := cur.Decode(&doc)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\t// do something with result....\n\t\tresult = append(result, doc)\n\t}\n\n\tm, _ := json.Marshal(result)\n\tfmt.Fprint(w, string(m))\n}", "title": "" } ]
5aaf8ff4caf9c9964bed3683b1138953
GetIsRevert retrieves the IsRevert value from the union, returning ok if the union's switch indicated the value is valid.
[ { "docid": "c78f26bc93b1ca5a52fcf83724e36ec6", "score": "0.8104588", "text": "func (u ManageContractOpData) GetIsRevert() (result bool, ok bool) {\n\tarmName, _ := u.ArmForSwitch(int32(u.Action))\n\n\tif armName == \"IsRevert\" {\n\t\tresult = *u.IsRevert\n\t\tok = true\n\t}\n\n\treturn\n}", "title": "" } ]
[ { "docid": "45a65af7bc3a3a324c4b7421e21ad846", "score": "0.6080051", "text": "func (u ManageContractOpData) MustIsRevert() bool {\n\tval, ok := u.GetIsRevert()\n\n\tif !ok {\n\t\tpanic(\"arm IsRevert is not set\")\n\t}\n\n\treturn val\n}", "title": "" }, { "docid": "7d1bb89b3d84d8233042ec0708bc31ed", "score": "0.5771449", "text": "func (o *NetInterfaceInfoType) IsAutoRevert() bool {\n\tvar r bool\n\tif o.IsAutoRevertPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.IsAutoRevertPtr\n\treturn r\n}", "title": "" }, { "docid": "e480a13c9161986c1f64e9e0378306d2", "score": "0.5365967", "text": "func (o *NetInterfaceInfoType) SetIsAutoRevert(newValue bool) *NetInterfaceInfoType {\n\to.IsAutoRevertPtr = &newValue\n\treturn o\n}", "title": "" }, { "docid": "f8a60da315c4df102d7f04c7e2f52d01", "score": "0.5352171", "text": "func (s Style) GetReverse() bool {\n\treturn s.getAsBool(reverseKey, false)\n}", "title": "" }, { "docid": "860f02a1339b189f33e6489f34f2b452", "score": "0.51264423", "text": "func (o *Ga4ghLogic) GetNegateOk() (bool, bool) {\n\tif o == nil || o.Negate == nil {\n\t\tvar ret bool\n\t\treturn ret, false\n\t}\n\treturn *o.Negate, true\n}", "title": "" }, { "docid": "fc2ecc0c973a34db5bbd2889f2009522", "score": "0.50873023", "text": "func (p OperationPhase) IsRolledBack() bool {\n\treturn p.GetState() == OperationPhaseStateRolledBack\n}", "title": "" }, { "docid": "08f9a96859abb9c727c0ac6663546ddb", "score": "0.5058278", "text": "func (o *Ga4ghLogic) GetNegate() bool {\n\tif o == nil || o.Negate == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.Negate\n}", "title": "" }, { "docid": "efffc4af9c6c0f56bb7235ee4260c0e8", "score": "0.4885347", "text": "func isCulpritRevertible(ctx context.Context, gerritClient *gerrit.Client,\n\tculprit *gerritpb.ChangeInfo) (bool, string, error) {\n\t// Check if the culprit's description has disabled autorevert\n\thasFlag, err := gerrit.HasAutoRevertOffFlagSet(ctx, culprit)\n\tif err != nil {\n\t\treturn false, \"\", errors.Annotate(err, \"error checking for auto-revert flag\").Err()\n\t}\n\tif hasFlag {\n\t\treturn false, \"auto-revert has been disabled for this CL by its description\", nil\n\t}\n\n\t// Check if the author of the culprit is irrevertible\n\tcannotRevert, err := HasIrrevertibleAuthor(ctx, culprit)\n\tif err != nil {\n\t\treturn false, \"\", errors.Annotate(err, \"error getting culprit's commit author\").Err()\n\t}\n\tif cannotRevert {\n\t\treturn false, \"LUCI Bisection cannot revert changes from this CL's author\", nil\n\t}\n\n\t// Check if there are other merged changes depending on the culprit\n\thasDep, err := gerritClient.HasDependency(ctx, culprit)\n\tif err != nil {\n\t\treturn false, \"\", errors.Annotate(err, \"error checking for dependencies\").Err()\n\t}\n\tif hasDep {\n\t\treturn false, \"there are merged changes depending on it\", nil\n\t}\n\n\t// Check if LUCI Bisection's Gerrit config allows revert creation\n\tcfg, err := config.Get(ctx)\n\tif err != nil {\n\t\treturn false, \"\", errors.Annotate(err, \"error fetching configs\").Err()\n\t}\n\tcanCreate, reason, err := config.CanCreateRevert(ctx, cfg.GerritConfig)\n\tif err != nil {\n\t\treturn false, \"\", errors.Annotate(err, \"error checking Create Revert configs\").Err()\n\t}\n\tif !canCreate {\n\t\treturn false, reason, nil\n\t}\n\n\treturn true, \"\", nil\n}", "title": "" }, { "docid": "41584b9b5da0f9997516284f6f26dd7c", "score": "0.48575073", "text": "func (g *GitPullRequest) GetIsDraft() bool {\n\tif g == nil || g.IsDraft == nil {\n\t\treturn false\n\t}\n\treturn *g.IsDraft\n}", "title": "" }, { "docid": "9bbf95c7ca70d7172882c4f2f62e1ca3", "score": "0.48510632", "text": "func (b *Background) GetIsDark() (value bool) {\n\tif b == nil {\n\t\treturn\n\t}\n\treturn b.IsDark\n}", "title": "" }, { "docid": "af0d0c31d385d43fc0c0390f45639840", "score": "0.4842583", "text": "func (v *Variant) GetBoolean() bool {\n\treturn gobool(C.g_variant_get_boolean(v.native()))\n}", "title": "" }, { "docid": "d03eda463200e8053b538571dbbc46d6", "score": "0.48253185", "text": "func (m *UserSimulationDetails) GetIsCompromised()(*bool) {\n val, err := m.GetBackingStore().Get(\"isCompromised\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "title": "" }, { "docid": "d83b187e6c8e46c44cfabf0e3e7917c3", "score": "0.4803873", "text": "func (r *RunAutomaton) IsAccept(state int) bool {\n\treturn r.accept[state]\n}", "title": "" }, { "docid": "04c05de0542f9d429c2405a82126e0d4", "score": "0.47961092", "text": "func (o *EqualsCompareOperationAllOf) GetNegate() bool {\n\tif o == nil || o.Negate == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.Negate\n}", "title": "" }, { "docid": "0c22947240d5ba94664987fd220d24ee", "score": "0.47694492", "text": "func (mr *MockGerritClientMockRecorder) GetPureRevert(ctx, in interface{}, opts ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{ctx, in}, opts...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetPureRevert\", reflect.TypeOf((*MockGerritClient)(nil).GetPureRevert), varargs...)\n}", "title": "" }, { "docid": "49b598554523514a4ff661b2b8991c82", "score": "0.47660145", "text": "func (o *EqualsCompareOperationAllOf) GetNegateOk() (*bool, bool) {\n\tif o == nil || o.Negate == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Negate, true\n}", "title": "" }, { "docid": "09580fa701a56053e31e89f84ef7df6d", "score": "0.4762144", "text": "func (m *Money) IsNegative() bool {\n\treturn m.amount.Sign() == -1\n}", "title": "" }, { "docid": "488ba3be2c0c92e29ef85f2e38e07e15", "score": "0.47360364", "text": "func (o *Team) GetIsArchived() bool {\n\tif o == nil || o.IsArchived == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.IsArchived\n}", "title": "" }, { "docid": "8b070bce5f5ddefddc9de14a7e117902", "score": "0.472434", "text": "func (o *Pool) GetIsDecryptedOk() (*bool, bool) {\n\tif o == nil || o.IsDecrypted == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IsDecrypted, true\n}", "title": "" }, { "docid": "24dd931576242142b407f0da1b2d8803", "score": "0.47096652", "text": "func (this *AccountUserSplit) GetReverse() bool {\n\tr := C.purple_account_user_split_get_reverse(this.aus)\n\treturn c2goBool(r)\n}", "title": "" }, { "docid": "725e4ffef8bdca8b9099d6bb304c2098", "score": "0.47085026", "text": "func (l *LanguagePackInfo) GetIsRtl() (value bool) {\n\tif l == nil {\n\t\treturn\n\t}\n\treturn l.IsRtl\n}", "title": "" }, { "docid": "d2f408f5711274ad076f0f8d55d00641", "score": "0.47003147", "text": "func (c *Call) GetIsOutgoing() (value bool) {\n\tif c == nil {\n\t\treturn\n\t}\n\treturn c.IsOutgoing\n}", "title": "" }, { "docid": "5ab800b73cea0dd1613394180d1aac7d", "score": "0.4673139", "text": "func (o *Pool) GetIsDecrypted() bool {\n\tif o == nil || o.IsDecrypted == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.IsDecrypted\n}", "title": "" }, { "docid": "c8e7cb81eb478f098d78b04e8d4beeef", "score": "0.46517462", "text": "func (ib invertedBool) Get() bool {\n\treturn !bool(ib)\n}", "title": "" }, { "docid": "8a8e6cafcf719a1e199b8bcc426d50ee", "score": "0.46488515", "text": "func (v *FieldElement) IsNegative() int {\n\tvar b [32]byte\n\tv.Bytes(b[:0])\n\treturn int(b[0] & 1)\n}", "title": "" }, { "docid": "682cca53e3c84a248e6b7111ab4e752d", "score": "0.46031505", "text": "func (o *Bank) GetIsTestBank() bool {\n\tif o == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\n\treturn o.IsTestBank\n}", "title": "" }, { "docid": "b5ede08a629b02b8bc5400ff6d0d10e2", "score": "0.4601526", "text": "func (mr *MockGerritServerMockRecorder) GetPureRevert(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetPureRevert\", reflect.TypeOf((*MockGerritServer)(nil).GetPureRevert), arg0, arg1)\n}", "title": "" }, { "docid": "72dffb9a2f6dd92cf62e9dec7588acdd", "score": "0.45830998", "text": "func (feb *FEBoolean) GetBool() bool {\n\tif feb.TVal != nil && *feb.TVal == true {\n\t\treturn true\n\t} else if feb.TVal1 != nil && *feb.TVal1 == true {\n\t\treturn true\n\t} else if feb.FVal != nil && *feb.FVal == true {\n\t\treturn false\n\t} else if feb.FVal1 != nil && *feb.FVal1 == true {\n\t\treturn false\n\t}\n\treturn false\n}", "title": "" }, { "docid": "5fe248a82bce9d4bc62aa696da12e853", "score": "0.45810336", "text": "func (dec Decimal) IsNegative() bool {\n\treturn dec.i.Sign() < 0\n}", "title": "" }, { "docid": "f8ed8309215028c8f57412c9802713fe", "score": "0.45250517", "text": "func (m Money) IsNegative() bool {\n\treturn m.usd < 0\n}", "title": "" }, { "docid": "855ae0deab1aa1bdb3c57eba5686da8c", "score": "0.45211494", "text": "func IsUndo(e ld.Entity) bool { return ld.Is(e, Class_Undo.ID) }", "title": "" }, { "docid": "72a97b56033b85d368ceda35ffbb92d5", "score": "0.4507744", "text": "func (ba *BatchRequest) IsReverse() bool {\n\treturn ba.hasFlag(isReverse)\n}", "title": "" }, { "docid": "02eac8e5ddd57e7c367dd878d6c5503b", "score": "0.44981867", "text": "func (p *PremiumStatePaymentOption) GetIsUpgrade() (value bool) {\n\tif p == nil {\n\t\treturn\n\t}\n\treturn p.IsUpgrade\n}", "title": "" }, { "docid": "41a5aab801b18b92249e611e8de0e0d6", "score": "0.44871148", "text": "func (d TGDecimal) IsNegative() bool {\n\treturn d.Sign() == -1\n}", "title": "" }, { "docid": "6105a9a5708bdd5eb3394d6587ee9d93", "score": "0.44762912", "text": "func (o *WorkflowWorkflowPropertiesAllOf) GetRollbackOnCancel() bool {\n\tif o == nil || o.RollbackOnCancel == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.RollbackOnCancel\n}", "title": "" }, { "docid": "4ce3e9c49a2092a198124cf8f367bb6f", "score": "0.44572532", "text": "func (o *Team) GetIsArchivedOk() (bool, bool) {\n\tif o == nil || o.IsArchived == nil {\n\t\tvar ret bool\n\t\treturn ret, false\n\t}\n\treturn *o.IsArchived, true\n}", "title": "" }, { "docid": "304d6ec5c93d5c6de4d1eac4a6460cd9", "score": "0.44521293", "text": "func (o *Bank) GetIsTestBankOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.IsTestBank, true\n}", "title": "" }, { "docid": "3538b351088026276b1b544fcbd0bc1f", "score": "0.4450671", "text": "func (o *StandaloneInvestmentTransactionType) GetTransferOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Transfer, true\n}", "title": "" }, { "docid": "4c3ae5980a4418249098685b63ce00b1", "score": "0.4448002", "text": "func (r *Run) IsOpposite(dir Direction) bool {\n\treturn dir != r.Dir\n}", "title": "" }, { "docid": "edfd69eb949f601b700706771b260dd6", "score": "0.44336691", "text": "func (st Staker) IsWithdrawn() bool {\n\treturn st.Status&sfcStatusWithdrawn > 0\n}", "title": "" }, { "docid": "70c538282953477a0ea579725cc93cdb", "score": "0.4430493", "text": "func GetBool(v *bool) (bool, bool) {\n\tif v != nil {\n\t\treturn *v, true\n\t}\n\n\treturn false, false\n}", "title": "" }, { "docid": "8107963e0513123fcaf7dc916b9ab803", "score": "0.44214195", "text": "func (o *Transaction) GetAbort() bool {\n\tif o == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\n\treturn o.Abort\n}", "title": "" }, { "docid": "1549decdc53dd4daa96447e4041249be", "score": "0.43833068", "text": "func (o *InlineResponse200116MessageReplies) GetIsOriginal() string {\n\tif o == nil || o.IsOriginal == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.IsOriginal\n}", "title": "" }, { "docid": "e1000ad3fd3f46cfca713f1e1d579df8", "score": "0.43799475", "text": "func (s *Service) GetBehindReverseProxyFlag() bool {\n\treturn s.behindReverseProxy\n}", "title": "" }, { "docid": "cd04a0cfe2bb272c52ff13bddecbada4", "score": "0.43748105", "text": "func (m *Money) IsNegative() bool {\n return m.amount.val < 0\n}", "title": "" }, { "docid": "a2bec22ac611b5623f0be97acaa92337", "score": "0.4369799", "text": "func (o *BankTransfer) GetDirectionOk() (*BankTransferDirection, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Direction.Get(), o.Direction.IsSet()\n}", "title": "" }, { "docid": "f9f17799cc8c1e471b85bbf26d2ab7da", "score": "0.4367022", "text": "func (coin Coin) IsNegative() bool {\n\treturn coin.Amount.IsNegative()\n}", "title": "" }, { "docid": "42512e9f3f9dd728478332771b5ca06f", "score": "0.43655878", "text": "func (o *WebhookAllOf) GetDeactivatedOk() (*string, bool) {\n\tif o == nil || o.Deactivated == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Deactivated, true\n}", "title": "" }, { "docid": "c0e2f2e71376ab102c811869e5cba3dd", "score": "0.43632862", "text": "func (E_SrlNokiaInterfacesIpDhcpRelay_OperState) IsYANGGoEnum() {}", "title": "" }, { "docid": "daa2fc0c9457f9ac080db456324a5d89", "score": "0.4356479", "text": "func (ce *ConditionalExpression) IsNegated() bool {\n\treturn ce.Token.Type == token.UNLESS\n}", "title": "" }, { "docid": "fd17e62e069a88e89e0c8d4dffd10be8", "score": "0.43542257", "text": "func (E_SrlNokiaInterfacesLocalMirrorDestination_OperState) IsYANGGoEnum() {}", "title": "" }, { "docid": "859ab901418e4013b030e09b65f4dbcb", "score": "0.4344801", "text": "func (d Direction) IsOpposite(other Direction) bool {\n\treturn d.X*-1 == other.X && d.Y*-1 == other.Y\n}", "title": "" }, { "docid": "618e5dc9979c1f291757112d4de48656", "score": "0.43428278", "text": "func (c *Call) GetIsVideo() (value bool) {\n\tif c == nil {\n\t\treturn\n\t}\n\treturn c.IsVideo\n}", "title": "" }, { "docid": "6b54c8b5212aa2837a627bbfbb17a225", "score": "0.43313268", "text": "func (u ManageContractResponseData) GetIsCompleted() (result bool, ok bool) {\n\tarmName, _ := u.ArmForSwitch(int32(u.Action))\n\n\tif armName == \"IsCompleted\" {\n\t\tresult = *u.IsCompleted\n\t\tok = true\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "606758ce62ec12cdd633c124f435b105", "score": "0.43191096", "text": "func (o *DnsRrDataData) GetZoneIsReverseOk() (*string, bool) {\n\tif o == nil || o.ZoneIsReverse == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ZoneIsReverse, true\n}", "title": "" }, { "docid": "6d7f3b93816806d2cf857da870b58011", "score": "0.43184406", "text": "func (o *DnsRrDataData) GetZoneIsReverse() string {\n\tif o == nil || o.ZoneIsReverse == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ZoneIsReverse\n}", "title": "" }, { "docid": "39d4e315a25a7f973fb88654d2373e25", "score": "0.4312541", "text": "func (s *SmartContract) IsRevoked(ctx contractapi.TransactionContextInterface, pck string) (bool,error) {\r\n\t//we pull from the world state the data for the delegation\r\n\tdelegation, _ := s.IsDelegation(ctx, pck)\r\n\r\n\t//we check if this delegation is Revoked and we return true or false \r\n\tif delegation.Revoked == true {\r\n\t\treturn true, nil \r\n\t} else {\r\n\t\treturn false, nil \r\n\t}\r\n}", "title": "" }, { "docid": "482102072fb9058f5753876bdfb97ce6", "score": "0.43066546", "text": "func GetBool(v interface{}) bool {\n\tswitch val := v.(type) {\n\tcase bool:\n\t\treturn val\n\tcase Bool:\n\t\treturn val.value\n\t}\n\tpanic(\"invalid data type\")\n}", "title": "" }, { "docid": "d1d656257b2ca2fd43f179da6e7167a0", "score": "0.42970818", "text": "func (fe *FieldElement) IsNegativeI() int32 {\n\tvar buf [32]byte\n\tfe.BytesInto(&buf)\n\treturn int32(buf[0] & 1)\n}", "title": "" }, { "docid": "07bdbb984c0d51169b5c491a5a9d8ee2", "score": "0.42957234", "text": "func IsNegative(m *pb.Money) bool {\n\treturn IsValid(m) && m.GetUnits() < 0 || (m.GetUnits() == 0 && m.GetNanos() < 0)\n}", "title": "" }, { "docid": "443ef51482427cc4812156c155af37ae", "score": "0.429152", "text": "func (o *Conversation) GetPreviewOk() (string, bool) {\n\tif o == nil || o.Preview == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Preview, true\n}", "title": "" }, { "docid": "3aa26bdcd609c11da870613d3d20f787", "score": "0.42878518", "text": "func (s *Status) IsSkip() bool {\n\treturn s.Code() == Skip\n}", "title": "" }, { "docid": "fa520f35270bdcea06c7d755201f33b0", "score": "0.42864522", "text": "func GetBool(v interface{}) bool {\n\tswitch result := v.(type) {\n\tcase bool:\n\t\treturn result\n\tdefault:\n\t\tif d := GetString(v); d != \"\" {\n\t\t\tvalue, _ := strconv.ParseBool(d)\n\t\t\treturn value\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "fa520f35270bdcea06c7d755201f33b0", "score": "0.42864522", "text": "func GetBool(v interface{}) bool {\n\tswitch result := v.(type) {\n\tcase bool:\n\t\treturn result\n\tdefault:\n\t\tif d := GetString(v); d != \"\" {\n\t\t\tvalue, _ := strconv.ParseBool(d)\n\t\t\treturn value\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "0dd558838c6f52b39081c3e45cabf77d", "score": "0.42847124", "text": "func (o *InlineResponse200116MessageReplies) GetIsOriginalOk() (*string, bool) {\n\tif o == nil || o.IsOriginal == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IsOriginal, true\n}", "title": "" }, { "docid": "f916380cb8c211e60d388a079c0380f3", "score": "0.42748177", "text": "func (b Bool) Negate() ref.Val {\n\treturn !b\n}", "title": "" }, { "docid": "557d81b8a5d1a6ce0d9390d53044e649", "score": "0.4272286", "text": "func (t *Transition) IsDerelict() bool {\n\treturn t.Location != defs.LocationPrevious && t.Location >= 128\n}", "title": "" }, { "docid": "9696ec8ea2ad3e5e3f9de9610db0847f", "score": "0.4268659", "text": "func (v *VolumeRollback) GetDestroy() bool {\n\treturn v.Destroy\n}", "title": "" }, { "docid": "392e0ff5e195220fd2add3e6a409fab0", "score": "0.42585966", "text": "func (t *Interface) GetLogical() bool {\n\tif t == nil || t.Logical == nil {\n\t\treturn false\n\t}\n\treturn *t.Logical\n}", "title": "" }, { "docid": "5e8be00b293bd515133d1faee36ef064", "score": "0.42503306", "text": "func (trq *transferRequest1_1) IsCancel() bool {\n\treturn trq.Type == uint64(types.CancelMessage)\n}", "title": "" }, { "docid": "882c3267069a73d2d3bee7d31b9357ab", "score": "0.4249763", "text": "func (o *Transaction) GetAbortOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Abort, true\n}", "title": "" }, { "docid": "31e2a8e45ed13085bf93137df33e55e0", "score": "0.42461628", "text": "func (o *WorkflowWorkflowPropertiesAllOf) GetRollbackOnCancelOk() (*bool, bool) {\n\tif o == nil || o.RollbackOnCancel == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RollbackOnCancel, true\n}", "title": "" }, { "docid": "d921618d2e049c0a24e8ba69b3aeb047", "score": "0.42420223", "text": "func (f *FlagData) GetDisable() bool {\n\tif f.Disable == nil {\n\t\treturn false\n\t}\n\treturn *f.Disable\n}", "title": "" }, { "docid": "bf57d8dd50eaad0cfea49dc68ce53c9e", "score": "0.42418712", "text": "func (m *MockGerritClient) GetPureRevert(ctx context.Context, in *GetPureRevertRequest, opts ...grpc.CallOption) (*PureRevertInfo, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, in}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"GetPureRevert\", varargs...)\n\tret0, _ := ret[0].(*PureRevertInfo)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "3f3573a75a0b90c94424b0dbd620e8da", "score": "0.4239647", "text": "func (e Bool) IsSet() bool {\n\treturn e.Valid\n}", "title": "" }, { "docid": "55a5ba7b5c60f0793d1e8bad4cf45054", "score": "0.42385948", "text": "func IsUnspecifiedStop(state int) (returnValue bool) {\n\tif state >= UnspecifiedStopState && state <= UnspecifiedStopState+9999 { // new data model\n\t\treturnValue = true\n\t} else if state == 1 { // old data model\n\t\treturnValue = true\n\t}\n\treturn\n}", "title": "" }, { "docid": "34c4beebe34243a94299cfca3db9398a", "score": "0.42246652", "text": "func (E_SrlNokiaTunnelInterfaces_TunnelInterface_VxlanInterface_OperState) IsYANGGoEnum() {}", "title": "" }, { "docid": "3fea09a913a40097ba416c3de3b98cf7", "score": "0.42179558", "text": "func (s *ChiHostReconcileAttributes) IsRemove() bool {\n\tif s == nil {\n\t\treturn false\n\t}\n\treturn s.remove\n}", "title": "" }, { "docid": "83a230b94cb24dfcb4655536c0fcf653", "score": "0.4213727", "text": "func (m *ManagedDevice) GetIsEncrypted()(*bool) {\n val, err := m.GetBackingStore().Get(\"isEncrypted\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "title": "" }, { "docid": "949bfc5c4c59295db431e3ff3c142379", "score": "0.42126954", "text": "func (x *Flow) GetReply() bool {\n\tif x != nil {\n\t\treturn x.Reply\n\t}\n\treturn false\n}", "title": "" }, { "docid": "7aecb66d67ee24aa0bf8a6fdfc5a5a78", "score": "0.4212663", "text": "func (o *MicrosoftGraphEvent) GetIsCancelledOk() (bool, bool) {\n\tif o == nil || o.IsCancelled == nil {\n\t\tvar ret bool\n\t\treturn ret, false\n\t}\n\treturn *o.IsCancelled, true\n}", "title": "" }, { "docid": "3913ab2b90b583fa1c7de4259b6507f6", "score": "0.42107466", "text": "func (o *Bank) GetIsSupported() bool {\n\tif o == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\n\treturn o.IsSupported\n}", "title": "" }, { "docid": "55d5695cc20f5cda586be62f009088e1", "score": "0.420815", "text": "func IsFalse(t *testing.T, got bool, args ...any) bool {\n\tif !got {\n\t\treturn true\n\t}\n\n\tt.Helper()\n\tEqualErrorMessage(t, true, false, args...)\n\treturn false\n}", "title": "" }, { "docid": "ddcecec9133e420644dbd9afa001d10f", "score": "0.42065585", "text": "func (E_SrlNokiaMirroring_OperState) IsYANGGoEnum() {}", "title": "" }, { "docid": "1ad502dad72f5f23300ad9883cc6d549", "score": "0.42010665", "text": "func isRollbackEvent(e *api.Event) (bool, string) {\n\trollbackEventReasons := []string{deploymentutil.RollbackRevisionNotFound, deploymentutil.RollbackTemplateUnchanged, deploymentutil.RollbackDone}\n\tfor _, reason := range rollbackEventReasons {\n\t\tif e.Reason == reason {\n\t\t\tif reason == deploymentutil.RollbackDone {\n\t\t\t\treturn true, \"rolled back\"\n\t\t\t}\n\t\t\treturn true, fmt.Sprintf(\"skipped rollback (%s: %s)\", e.Reason, e.Message)\n\t\t}\n\t}\n\treturn false, \"\"\n}", "title": "" }, { "docid": "50cd10f68203c8ed7892c5b0bfde87ee", "score": "0.41978288", "text": "func GetBoolean(data []byte, keys ...string) (val bool, err error) {\n\tv, t, _, e := get(true, data, keys...)\n\n\tif e != nil {\n\t\treturn false, e\n\t}\n\n\tif t != Boolean {\n\t\treturn false, fmt.Errorf(\"Value is not a boolean: %s\", string(v))\n\t}\n\n\treturn ParseBoolean(v)\n}", "title": "" }, { "docid": "2254623732d3bf584fa9f22cc447ea69", "score": "0.4197561", "text": "func (l Float) IsNegative() Bool {\n\t// Generated from float.go:605.\n\tctx := l.ctx\n\tval := wrapValue(ctx, func() C.Z3_ast {\n\t\treturn C.Z3_mk_fpa_is_negative(ctx.c, l.c)\n\t})\n\truntime.KeepAlive(l)\n\treturn Bool(val)\n}", "title": "" }, { "docid": "00e4303ea5066799c74b3ff5ddf2d135", "score": "0.41972613", "text": "func (s *switcher) IsOff() bool {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tstate := s.getState()\n\treturn state == SwitcherStateOff\n}", "title": "" }, { "docid": "ff4fbb97f981a42e65b35f744ac774ed", "score": "0.4196755", "text": "func (ir IR) BackRight() bool {\n\treturn ir.getIR(\"backright\")\n}", "title": "" }, { "docid": "7be8cbc73c054cd905da70f72fdc2ac1", "score": "0.4190008", "text": "func GetBoolean(data []byte, keys ...string) (val bool, err error) {\n\tv, t, _, e := Get(data, keys...)\n\n\tif e != nil {\n\t\treturn false, e\n\t}\n\n\tif t != Boolean {\n\t\tif t == Null {\n\t\t\treturn false, NullValueError\n\t\t}\n\t\treturn false, fmt.Errorf(\"Value is not a boolean: %s\", string(v))\n\t}\n\n\treturn ParseBoolean(v)\n}", "title": "" }, { "docid": "77aff0c595a768f4c5ce89c3d40cb4d3", "score": "0.41868252", "text": "func (s Status) IsSet() bool {\n\treturn s != StatusUnset\n}", "title": "" }, { "docid": "8d832cfda4817244e33c965eeeeecbc2", "score": "0.4181721", "text": "func (p *PremiumStatePaymentOption) GetIsCurrent() (value bool) {\n\tif p == nil {\n\t\treturn\n\t}\n\treturn p.IsCurrent\n}", "title": "" }, { "docid": "f1c0f7e1cb6bf0e69b0246326cd85042", "score": "0.4180728", "text": "func (o *StandaloneInvestmentTransactionType) GetCancelOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Cancel, true\n}", "title": "" }, { "docid": "2304074dc90878af8cfdf31cd4e0a1a8", "score": "0.41672063", "text": "func (o *Credit1099) GetSecondaryStateOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SecondaryState.Get(), o.SecondaryState.IsSet()\n}", "title": "" }, { "docid": "6d466100f54db37e24c03d04fa4007d9", "score": "0.41669065", "text": "func (m *MockGerritServer) GetPureRevert(arg0 context.Context, arg1 *GetPureRevertRequest) (*PureRevertInfo, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetPureRevert\", arg0, arg1)\n\tret0, _ := ret[0].(*PureRevertInfo)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "20296316c5875f6b291906a6e62629e2", "score": "0.41648552", "text": "func (E_SrlNokiaSystem_System_Mirroring_MirroringInstance_OperDownReason) IsYANGGoEnum() {}", "title": "" }, { "docid": "9264671a604258978564d586fc96a2c0", "score": "0.41590676", "text": "func (o *Transaction) GetModeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Mode, true\n}", "title": "" }, { "docid": "b0d6ed74054dee0b5534ca5250811919", "score": "0.41578862", "text": "func (this *PeerCom) GetRelay() bool {\n\treturn this.relay\n}", "title": "" }, { "docid": "7071e8df9061fde6152e8c42fd78d690", "score": "0.41577184", "text": "func (E_SrlNokiaInterfaces_Interface_Subinterface_Ipv4_DhcpRelay_Option) IsYANGGoEnum() {}", "title": "" }, { "docid": "6417f480977534ebd41d6d09cd85f22c", "score": "0.41548544", "text": "func (i Integer) IsNegative() bool {\n\treturn i < 0\n}", "title": "" } ]
462cafa16364b9b8e69cb4f4f6af29f3
The current state of the static route.
[ { "docid": "c20136bcc8031e1174d58821ae150f08", "score": "0.0", "text": "func (o VpnConnectionRouteTypeOutput) State() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v VpnConnectionRouteType) *string { return v.State }).(pulumi.StringPtrOutput)\n}", "title": "" } ]
[ { "docid": "e70589e3a6b169fef365f6adf28adc44", "score": "0.563967", "text": "func (o LocalGatewayRouteTableOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *LocalGatewayRouteTable) pulumi.StringOutput { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "17314c37b54c933b1e0ff0fcf16e44f9", "score": "0.5575156", "text": "func (th *Theme) Static() string {\n\treturn \"static\"\n}", "title": "" }, { "docid": "8e6b7493036689d08fe99fe1df335720", "score": "0.54891235", "text": "func (v *Virtualizer) State() string {\n\treturn v.state\n}", "title": "" }, { "docid": "460c247ca8206008795ef5293e2aa45d", "score": "0.5344448", "text": "func (v VlanConfig) State() string {\n\treturn v[\"state\"]\n}", "title": "" }, { "docid": "d9b76a8b18b7029d2136765854437361", "score": "0.53190297", "text": "func (r *Route) Static(dirpath string) *Route {\n\treturn r.StaticFS(newOnlyFileFS(dirpath))\n}", "title": "" }, { "docid": "6cbbab88120aa449fb1caa8b0ee4ae31", "score": "0.5306181", "text": "func (StaticConfig) Name() string { return \"static\" }", "title": "" }, { "docid": "def77577ce8650dd97ef53bd3b49ab4f", "score": "0.5301274", "text": "func (r *runtime) State() server.State {\n\treturn r.state\n}", "title": "" }, { "docid": "def77577ce8650dd97ef53bd3b49ab4f", "score": "0.5301274", "text": "func (r *runtime) State() server.State {\n\treturn r.state\n}", "title": "" }, { "docid": "4320f2367ed27581523a13aa11d195d2", "score": "0.5296518", "text": "func get_state(c echo.Context) string {\n\treturn c.QueryParam(\"state\")\n}", "title": "" }, { "docid": "d6e62ad4f775900504c863929d140c13", "score": "0.52511317", "text": "func (e *endpoint) State() uint32 {\n\treturn uint32(e.net.State())\n}", "title": "" }, { "docid": "d9f3d1c2f7e9340bacabef8b9ee42cb2", "score": "0.5238641", "text": "func (r *NodeResolver) State() string {\n\treturn r.node.State\n}", "title": "" }, { "docid": "4d14e29c9d3c6ba837f66795e7c39fa2", "score": "0.52338547", "text": "func (v *Virtualizer) State() string {\n\treturn \"\"\n}", "title": "" }, { "docid": "cc8fc61608e90a0da1868a4bd392b89a", "score": "0.51710826", "text": "func (ctx *Context) IsStaticRoute() bool {\n\tif ctx.route != nil {\n\t\treturn ctx.route.IsStatic\n\t}\n\treturn false\n}", "title": "" }, { "docid": "cc8fc61608e90a0da1868a4bd392b89a", "score": "0.51710826", "text": "func (ctx *Context) IsStaticRoute() bool {\n\tif ctx.route != nil {\n\t\treturn ctx.route.IsStatic\n\t}\n\treturn false\n}", "title": "" }, { "docid": "7d41c30ddfe181750ce9d4b4065c2a5c", "score": "0.5156627", "text": "func (manager *DomainProjectUpdateManager) State() string {\n\treturn manager.stage.state\n}", "title": "" }, { "docid": "5600b8650b9eac715166450dd1a026e8", "score": "0.512887", "text": "func (f *File) Static() []byte {\n\treturn f.static\n}", "title": "" }, { "docid": "e1e249acb8b6601eb5bae3f869aa23a1", "score": "0.51115644", "text": "func (s *Determination) State() State {\n\treturn s.stat.get()\n}", "title": "" }, { "docid": "bf8f8d70f5219fc728419f72e2d538ed", "score": "0.5107114", "text": "func (r *Router) Static(w http.ResponseWriter, req *http.Request) {\n\tw.WriteHeader(http.StatusNotFound)\n\tw.Write([]byte(\"Nothing to see here...yet\"))\n}", "title": "" }, { "docid": "8a9a004819262cc9e6d772a3f9276de4", "score": "0.5087713", "text": "func (c *Context) Path() string { return c.req.URL.Path }", "title": "" }, { "docid": "2d4e9eca8707199d37bf93c2d65ffa4f", "score": "0.5086164", "text": "func getState(sc clusteragent.ServerContext) func(w http.ResponseWriter, r *http.Request) {\n\tif sc.ClusterCheckHandler == nil {\n\t\treturn clusterChecksDisabledHandler\n\t}\n\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// No redirection for this one, internal endpoint\n\t\tresponse, err := sc.ClusterCheckHandler.GetState()\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\twriteJSONResponse(w, response)\n\t}\n}", "title": "" }, { "docid": "a3d0c242876e56cda5684886d6ac8f10", "score": "0.50604534", "text": "func (o *Service) GetIsStatic() bool {\n\tif o == nil || o.IsStatic == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.IsStatic\n}", "title": "" }, { "docid": "1fb4d367aad39625f92d6bddf0c027be", "score": "0.5034605", "text": "func (r *Instance) State() pulumi.StringOutput {\n\treturn (pulumi.StringOutput)(r.s.State[\"state\"])\n}", "title": "" }, { "docid": "04272e666428be3ff07d4f62d1542969", "score": "0.5032378", "text": "func (t *ProxyMachine) State() raft.RaftState {\n\treturn t.state.State()\n}", "title": "" }, { "docid": "98f0534bc7578be02857074d6d209b57", "score": "0.5027244", "text": "func (r *RuleImpl) StaticResult() string {\n\treturn r.staticResult\n}", "title": "" }, { "docid": "de0a576f49d25ae44d7f93189922fa29", "score": "0.50047576", "text": "func (s *SimpleScheduleResponse) State() ScheduleState {\n\treturn s.state\n}", "title": "" }, { "docid": "774f534f66d525bea61b3fe0433abb7a", "score": "0.50017285", "text": "func (ld *LinkData) State() int {\n\treturn ld.state\n}", "title": "" }, { "docid": "91f92c8c6adef2d270dde8a79002552d", "score": "0.49988848", "text": "func (s *Func) Static() bool {\n\treturn s.FunStatic\n}", "title": "" }, { "docid": "d526d3487a04166faf61b0eb32e663c7", "score": "0.49958", "text": "func (p *Pellet) GetDirection() constants.Direction {\n\treturn constants.DirStatic\n}", "title": "" }, { "docid": "cdbbf46e3980a15c056006dcfe674e0b", "score": "0.4991744", "text": "func (r *State) CompletedRouting() map[string]error {\n\treturn r.completedRouting\n}", "title": "" }, { "docid": "2e660bb9c90da6edb1426538058f97f8", "score": "0.49795312", "text": "func (_m *Router) StaticRoot(fs http.Handler) {\n\t_m.Called(fs)\n}", "title": "" }, { "docid": "43798c1f0c322777f0a4e9803c3243d3", "score": "0.49785188", "text": "func (engine *Engine) State() string {\n\n\tengine.RLock()\n\tdefer engine.RUnlock()\n\treturn stateText[engine.state]\n}", "title": "" }, { "docid": "c02df81541c56359bf93203bd5824b8d", "score": "0.4975935", "text": "func (o LookupLocalGatewayRouteTableResultOutput) State() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LookupLocalGatewayRouteTableResult) *string { return v.State }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "034b20f49ca5cb9ad8a8752b01a04659", "score": "0.4975064", "text": "func (h HistoryState) Current() string {\n\treturn h.current\n}", "title": "" }, { "docid": "df8b3e9ba35413dd57eafc9c26375b99", "score": "0.49723947", "text": "func (o EndpointOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Endpoint) pulumi.StringOutput { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "074a4a860255a2603d4ed04f736cbcfd", "score": "0.49668682", "text": "func (bow *Browser) State() *jar.State {\n\treturn bow.state\n}", "title": "" }, { "docid": "826be698bf3237814d61f1bcf657c7ed", "score": "0.49591205", "text": "func (pi *Instance) State() int {\n\treturn pi.state\n}", "title": "" }, { "docid": "f2fd153f4cee1685f12ee70e0ff7826e", "score": "0.49500287", "text": "func (group *Routes) Static(relativePath, root string) gin.IRoutes {\n\trelativePath = group.RouterGroup.BasePath() + relativePath\n\tgroup.List.Set(relativePath, http.MethodGet)\n\treturn group.Router.Static(relativePath, root)\n}", "title": "" }, { "docid": "a5ff85322844ee0dde481601879a442e", "score": "0.49494082", "text": "func CurrentRoute(r *http.Request) *Route {\n\tif rv := r.Context().Value(routeKey); rv != nil {\n\t\treturn rv.(*Route)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3469d3e646a8ab0dffc90a54485b9e5d", "score": "0.4940267", "text": "func (r *VpcEndpoint) State() pulumi.StringOutput {\n\treturn (pulumi.StringOutput)(r.s.State[\"state\"])\n}", "title": "" }, { "docid": "2f2830e7a66e889e45c234deff6f2a93", "score": "0.49322832", "text": "func (controller *clockController) State() ClockState {\n\treturn controller.state\n}", "title": "" }, { "docid": "77b8ede0f813fab83a6f6395bc71447e", "score": "0.49276125", "text": "func (z *Zone) State() int {\n\treturn z.state\n}", "title": "" }, { "docid": "e513e377b0cc16c526f7fd6cdd7fa3bf", "score": "0.4925526", "text": "func (s Site) Status() (Status, error) {\n resp, err := http.Get(s.url)\n status := s.last_status\n\n if (err == nil) && (resp.StatusCode == 200) {\n status = UP\n } else {\n status = DOWN\n }\n\n return status, err\n}", "title": "" }, { "docid": "a3e6040a0630e543c04d067e9ecddb83", "score": "0.4914498", "text": "func (msg MsgCheckExecution) Route() string { return RouterKey }", "title": "" }, { "docid": "e1ac8163c72dc84a768d176d5aeaf8e3", "score": "0.49058613", "text": "func (ma *Model) IsStatic() bool {\n\treturn ma.isStatic\n}", "title": "" }, { "docid": "ea0080594868cde40f69884f1c468d6c", "score": "0.48801318", "text": "func (o SelfHostedIntegrationRuntimeStatusResponseOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SelfHostedIntegrationRuntimeStatusResponse) string { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "aa1bf66782a74ff4354a3ab9c203cd35", "score": "0.48635247", "text": "func (h *Hoster) Status() bool {\n\tresp, err := h.svc.Routes.Get(h.conf.Project, h.rname).Context(*h.ctx).Do()\n\n\tif err == nil {\n\t\treturn resp.NextHopInstance == h.selflink\n\t}\n\n\t// route not found is ok, means we don't \"own\" the IP\n\tif apierr, ok := err.(*googleapi.Error); ok {\n\t\tif apierr.Code == 404 {\n\t\t\treturn false\n\t\t}\n\t}\n\n\th.log.Fatalf(\"Failed to get route status: %v\\n\", err)\n\n\treturn false\n}", "title": "" }, { "docid": "1b96e0a87530afd4c2b1f03ddd229945", "score": "0.4853427", "text": "func (group *RouterGroup) Static(relativePath, root string) IRoutes {\n\treturn group.StaticFS(relativePath, util.Dir(root, false))\n}", "title": "" }, { "docid": "efbc538854b16a54237e951810151804", "score": "0.4842347", "text": "func (f *FSM) Current() string {\n\tf.stateMu.RLock()\n\tdefer f.stateMu.RUnlock()\n\treturn f.current\n}", "title": "" }, { "docid": "8824ad3f556e0e782d6c94195a8613bd", "score": "0.4835348", "text": "func (eng *engine) State() *State { return eng.data.state }", "title": "" }, { "docid": "e623b860a45c21121df7e839bcade150", "score": "0.4832325", "text": "func (c *LightBulb) GetState() (state bool) {return c.state}", "title": "" }, { "docid": "f8098831e9b65e30810f0ee9511eef01", "score": "0.48318502", "text": "func (c *TileCacheStaticPath) Path() string {\n\treturn c.path\n}", "title": "" }, { "docid": "814c4ef99c3698f1bfb1888776e58d98", "score": "0.4822438", "text": "func Current(ctx context.Context) (res *State) {\n\tres, _ = ctx.Value(stateKey).(*State)\n\treturn\n}", "title": "" }, { "docid": "a49115fb24c1c9c52160a73aadd46931", "score": "0.48215455", "text": "func (o ShareAccessOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ShareAccess) pulumi.StringOutput { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "39d47ae291108db59846f1a933a7fff5", "score": "0.48157525", "text": "func (server *HTTPServer) StartedAt() time.Time {\n\treturn server.startedAt\n}", "title": "" }, { "docid": "435f4216c9d9e2ab130ed3157d9876ea", "score": "0.47937074", "text": "func (s *service) State(ctx context.Context, r *taskAPI.StateRequest) (*taskAPI.StateResponse, error) {\n\treturn s.runc.State(ctx, r)\n}", "title": "" }, { "docid": "8a536933462ede8c1c47485a9d0cccf6", "score": "0.4785073", "text": "func (v *VM) State() State {\n\treturn v.state\n}", "title": "" }, { "docid": "b267725cb36020f7c423615a44257459", "score": "0.477803", "text": "func GetRotorStateEndpoint(w http.ResponseWriter, r *http.Request) {\n\tsafeRespondWithJSON(w, http.StatusOK, &rotctl)\n}", "title": "" }, { "docid": "fccd562be76fef651daf4f6e7056f759", "score": "0.4776929", "text": "func (r *Recorder) State() *api.GlobalState {\n\treturn r.S\n}", "title": "" }, { "docid": "9fdadb1ccfe83c1f2bec85706a07f4d3", "score": "0.47593647", "text": "func (o VmwareClusterOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *VmwareCluster) pulumi.StringOutput { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "eb0c31dd1c90ada982ecf2335d40a9a4", "score": "0.47416797", "text": "func (node *PlaceNode) State() string {\n\t_, _, state, _ := node.JurisdictionalEntities()\n\n\treturn state\n}", "title": "" }, { "docid": "e6def4564ae07e6ea6040d1adf4c97b6", "score": "0.47243863", "text": "func (o MSTIDataConnectorDataTypesBingSafetyPhishingURLOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v MSTIDataConnectorDataTypesBingSafetyPhishingURL) string { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d4c3edc919890f8d2f23e30a4676745c", "score": "0.47241732", "text": "func (r *ResourceSystem) State(name string) []byte {\n\tfullpath := filepath.Join(r.paths[\"states\"], name+\".json\")\n\tres := r.resourceWithFullpath(fullpath)\n\treturn res\n}", "title": "" }, { "docid": "2512e1f7cbcfd1a4635bc749a55fda2c", "score": "0.47225013", "text": "func (i *Index) Path() string { return i.path }", "title": "" }, { "docid": "99403c83c3bf7dd32d103ad7f0e8b574", "score": "0.47220764", "text": "func (w *WorkerInfo) State() (state WorkerState, from time.Time, runningExploit ServiceExploitName) {\n\tstate = w.state\n\tfrom = w.from\n\trunningExploit = w.running\n\treturn\n}", "title": "" }, { "docid": "4da5802e6b54c9f24b45e15d416b22bf", "score": "0.47217917", "text": "func (this *App) static(prefix, root string, middleware ...MiddlewareFunc) {\n\tthis.addwithlog(false, GET, prefix+\"/*filepath\", func(c *Context) error {\n\t\treturn c.File(path.Join(root, c.PathParamByIndex(0)))\n\t}, middleware...)\n\tLog.Sys(\"| %7s | %-30s | %v\", GET, prefix+\"/*filepath\", root)\n}", "title": "" }, { "docid": "7b8561bc0f779734230f4ec0d3d700b3", "score": "0.46991074", "text": "func (r *RoutesStatic) Get(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn get(client, \"/api/nodes/routes.static\", &r.Value, options...)\n}", "title": "" }, { "docid": "cf5b5d8ffc192561f555681b282ec74a", "score": "0.46942675", "text": "func (r *router) Static(relativePath string, filePath string) {\n\tr.Request(\"Static\", relativePath,nil, filePath)\n}", "title": "" }, { "docid": "f8d45a4db264a1de81eaa1c968bf38c4", "score": "0.46921587", "text": "func (s *AutoRollStateMachine) Current() string {\n\treturn s.s.Current()\n}", "title": "" }, { "docid": "2abb97b5c2cd88efa515de60ee1e7b78", "score": "0.46783277", "text": "func RouterHealth() error { return get(\"router\") }", "title": "" }, { "docid": "44b5571115dbaa151b75222d9c1c7966", "score": "0.46744338", "text": "func (dsl *PutDSL) StaticRoute(val *l3.Route) vppclient.PutDSL {\n\tdsl.parent.txn.Put(models.Key(val), val)\n\treturn dsl\n}", "title": "" }, { "docid": "03c1a267e7501169874b361abc9c87fb", "score": "0.46731177", "text": "func (h *Harness) State() State {\n\treturn h.state\n}", "title": "" }, { "docid": "2fbdac4b780d8b8a1d8aab7b5d3fd227", "score": "0.46725005", "text": "func CurrentState() State {\r\n\tlock.RLock()\r\n\tret := current\r\n\tlock.RUnlock()\r\n\treturn ret\r\n}", "title": "" }, { "docid": "027686fdd878c37aee3afc404a1208d1", "score": "0.46676752", "text": "func (dsl *DataResyncDSL) StaticRoute(val *l3.StaticRoutes_Route) defaultplugins.DataResyncDSL {\n\t_, dstAddr, _ := net.ParseCIDR(val.DstIpAddr)\n\tdsl.txnPutStaticRoute[l3.RouteKey(val.VrfId, dstAddr, val.NextHopAddr)] = val\n\n\treturn dsl\n}", "title": "" }, { "docid": "f44dfcde5d696ed28b2e49300ff63897", "score": "0.46563154", "text": "func StaticRoute(staticRouteCfg map[string]interface{}, parent *vspk.Domain) *vspk.StaticRoute {\n\tstaticRoutes, err := parent.StaticRoutes(&bambou.FetchingInfo{\n\t\tFilter: staticRouteCfg[\"Address\"].(string)})\n\thandleError(err, \"READ\", \"staticRoute\")\n\n\tstaticRoute := &vspk.StaticRoute{}\n\n\tif staticRoutes != nil {\n\t\tlog.Infof(\"staticRoute already exists\")\n\n\t\tstaticRoute = staticRoutes[0]\n\t\tlog.Infof(\"Static Route: %#v\", staticRoute)\n\t\terrMergo := mergo.Map(staticRoute, staticRouteCfg, mergo.WithOverride)\n\t\tif errMergo != nil {\n\t\t\tlog.Fatal(errMergo)\n\t\t}\n\n\t\tlog.Infof(\"Static Route: %#v\", staticRoute)\n\t\tstaticRoute.Save()\n\t} else {\n\t\terrMergo := mergo.Map(staticRoute, staticRouteCfg, mergo.WithOverride)\n\t\tif errMergo != nil {\n\t\t\tlog.Fatal(errMergo)\n\t\t}\n\n\t\tlog.Infof(\"Static Route: %#v\", staticRoute)\n\n\t\terr := parent.CreateStaticRoute(staticRoute)\n\t\thandleError(err, \"CREATE\", \"staticRoute\")\n\n\t\tlog.Infof(\"staticRoute created\")\n\t}\n\n\tlog.Infof(\"%#v \\n\", staticRoute)\n\treturn staticRoute\n}", "title": "" }, { "docid": "70c58be10f3a1d7eb7da9f9a0760b9ff", "score": "0.46553394", "text": "func (s *Method) IsStatic() bool {\n\treturn s.isStatic\n}", "title": "" }, { "docid": "cd72ffba1352ff46cccdc19711fd0135", "score": "0.46533498", "text": "func (p *Path) Current() string {\n\tif len(p.segments) < p.index+1 {\n\t\treturn \"\"\n\t}\n\treturn p.segments[p.index]\n}", "title": "" }, { "docid": "b0ddcb0f77ceebf69c831f0b63257c91", "score": "0.4652007", "text": "func (dsl *DataResyncDSL) StaticRoute(val *vpp_l3.Route) linuxclient.DataResyncDSL {\n\tdsl.req.StaticRoutes = append(dsl.req.StaticRoutes, val)\n\treturn dsl\n}", "title": "" }, { "docid": "8a5aa9aead2b1f37a400564ffb4cc7e5", "score": "0.46519646", "text": "func (server *ServerRaftStatus) State() (ServerRaftState, error) {\n\tstate := ServerRaftState(server.StateRaw)\n\tif !state.isValid() {\n\t\treturn -1, fmt.Errorf(\"Zone server State: this state value is not currently handled: %d\\n\", server.StateRaw)\n\t}\n\treturn state, nil\n}", "title": "" }, { "docid": "95f427a402d3ae9227ecbfb67982576d", "score": "0.4651026", "text": "func (t Task) State() string {\n\tswitch t.Status {\n\tdefault:\n\t\treturn \"TODO\"\n\tcase 1:\n\t\treturn \"DOING\"\n\tcase 2:\n\t\treturn \"DONE\"\n\tcase 3:\n\t\treturn \"WAIVE\"\n\t}\n}", "title": "" }, { "docid": "ff0fe20d0e819c975cdcd6c45820c622", "score": "0.46451578", "text": "func (rs *RouteSetting) GetStatus(w http.ResponseWriter, r *http.Request) {\n\trs.Responser.ResponseWithJSON(w, r, http.StatusOK, map[string]string{\"current_status\": \"dev\"})\n}", "title": "" }, { "docid": "7b4018e76f526ee5462aa07ed84f9b91", "score": "0.46335214", "text": "func (n *NearCache) Statics() *Stats {\n\treturn n.stats\n}", "title": "" }, { "docid": "d81e3d4800767e1168110ee13765b657", "score": "0.463161", "text": "func (w *taskWorker) State() (WorkerState, time.Time) {\n\tw.stateLock.RLock()\n\tdefer w.stateLock.RUnlock()\n\treturn w.state, w.stateAt\n}", "title": "" }, { "docid": "723816d49a95cef947022f1de5ebfaf4", "score": "0.46249303", "text": "func (c *Context) Path() string {\n\treturn c.Request.URL.Path\n}", "title": "" }, { "docid": "577dcabfa47c6e40b238e1bb993e3d45", "score": "0.46204716", "text": "func (t *TaskStatus) State() State {\n\treturn t.state\n}", "title": "" }, { "docid": "4d96411767642228ced4c28035d506d7", "score": "0.46165133", "text": "func (AppModule) Route() string { return RouterKey }", "title": "" }, { "docid": "a36a72afb5ebfe1fb90b515581846e50", "score": "0.46153185", "text": "func (o *Service) GetIsStaticOk() (*bool, bool) {\n\tif o == nil || o.IsStatic == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IsStatic, true\n}", "title": "" }, { "docid": "e94d62d1d633ef6f6051faac4f36a526", "score": "0.46149907", "text": "func (v *VM) State() int {\n\tv.lock.Lock()\n\tdefer v.lock.Unlock()\n\treturn v.state\n}", "title": "" }, { "docid": "90ace6bbe1d0883f6ed34a0d36bb7435", "score": "0.46126357", "text": "func (h *handler) GetState(w http.ResponseWriter, r *http.Request) {\n\tlocationMap := map[string]coord{\n\t\t\"L0001\": coord{X: 38.219635, Y: -85.763125},\n\t\t\"L0002\": coord{X: 38.219685, Y: -85.763116},\n\t\t\"L0003\": coord{X: 38.219733, Y: -85.763108},\n\t\t\"L0004\": coord{X: 38.219805, Y: -85.763092},\n\t\t\"L0005\": coord{X: 38.219894, Y: -85.763082},\n\t\t\"L0006\": coord{X: 38.219975, Y: -85.763068},\n\t\t\"L0007\": coord{X: 38.220070, Y: -85.763051},\n\t\t\"L0008\": coord{X: 38.220159, Y: -85.763036},\n\t\t\"L0009\": coord{X: 38.220263, Y: -85.763027},\n\t\t\"L0010\": coord{X: 38.220782, Y: -85.762562},\n\t\t\"L0011\": coord{X: 38.220776, Y: -85.762504},\n\t\t\"L0012\": coord{X: 38.220771, Y: -85.762426},\n\t\t\"L0013\": coord{X: 38.220764, Y: -85.762363},\n\t\t\"L0014\": coord{X: 38.220757, Y: -85.762302},\n\t\t\"L0015\": coord{X: 38.220742, Y: -85.762167},\n\t\t\"L0016\": coord{X: 38.220734, Y: -85.762097},\n\t\t\"L0017\": coord{X: 38.220729, Y: -85.762034},\n\t\t\"L0018\": coord{X: 38.220721, Y: -85.761962},\n\t\t\"L0019\": coord{X: 38.220715, Y: -85.761899},\n\t\t\"L0020\": coord{X: 38.220702, Y: -85.761812},\n\t}\n\tcurrent := []state{}\n\th.Lock()\n\tfor s, o := range h.spots {\n\t\tspot := state{ID: s, Occupied: o, Price: 2.50, Location: locationMap[s]}\n\t\tcurrent = append(current, spot)\n\t}\n\th.Unlock()\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(current)\n}", "title": "" }, { "docid": "93fc76615fc90e9c2ca40c2ea2b14f2e", "score": "0.46105203", "text": "func (obj *world) CurrentSceneIndex() uint {\n\treturn obj.currentSceneIndex\n}", "title": "" }, { "docid": "71272a4e53c7b0ea27ffb1389f97579d", "score": "0.46097746", "text": "func (gui *Gui) currentStaticContext() Context {\n\tgui.State.ContextManager.RLock()\n\tdefer gui.State.ContextManager.RUnlock()\n\n\tstack := gui.State.ContextManager.ContextStack\n\n\tif len(stack) == 0 {\n\t\treturn gui.defaultSideContext()\n\t}\n\n\t// find the first context in the stack without a popup type\n\tfor i := range stack {\n\t\tcontext := stack[len(stack)-1-i]\n\n\t\tif context.GetKind() != TEMPORARY_POPUP && context.GetKind() != PERSISTENT_POPUP {\n\t\t\treturn context\n\t\t}\n\t}\n\n\treturn gui.defaultSideContext()\n}", "title": "" }, { "docid": "3b09a36cdadc1873fe70180039322b04", "score": "0.45972082", "text": "func (s *Sym) Static() bool { return s.Type >= 'a' }", "title": "" }, { "docid": "3ee223e5b3650298ad5af6d92b06b2f5", "score": "0.45946392", "text": "func (t Traveler) GetCurrent() *aql.QueryResult {\n\tlt := t.State[stateCurrent]\n\treturn &lt\n}", "title": "" }, { "docid": "5d338e72407b1a8cda858c7ab5195698", "score": "0.45928097", "text": "func (msg MsgUpdateRecipe) Route() string { return RouterKey }", "title": "" }, { "docid": "1b511fbc7ed1492b31dafc6cb1e80727", "score": "0.45887747", "text": "func (r *RoutingOspfRedistributeStaticStatus) Get(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn get(client, \"/api/nodes/routing.ospf.redistribute.static.status\", &r.Value, options...)\n}", "title": "" }, { "docid": "1c749a7d4dab3ba2acdc8e8426f50213", "score": "0.45865119", "text": "func (o MSTIDataConnectorDataTypesResponseBingSafetyPhishingURLOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v MSTIDataConnectorDataTypesResponseBingSafetyPhishingURL) string { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "75664e25432d8522aa7a948a7b8752d8", "score": "0.45865098", "text": "func (o FlexTemplateJobOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *FlexTemplateJob) pulumi.StringOutput { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6f2c9fc641da48698d197e0bf0e813b9", "score": "0.45857012", "text": "func (node *SerfDiscoverNode) State() serf.SerfState {\n\treturn node.delegate.Serf().State()\n}", "title": "" }, { "docid": "b9941df926e6ddfcb82b937989bd30d4", "score": "0.4582754", "text": "func (s *State) Current() int64 { return atomic.LoadInt64(&s.current) }", "title": "" }, { "docid": "acbecc7623e01ee9d64feda4a80d38dc", "score": "0.45813662", "text": "func (e *Equivocation) Route() string { return RouteEquivocation }", "title": "" }, { "docid": "39698c7220d11f389cf37aab4ea7f771", "score": "0.4581241", "text": "func (d *MockPutDSL) StaticRoute(val *l3.StaticRoutes_Route) vppclient.PutDSL {\n\top := dsl.TxnOp{Key: l3.RouteKey(val.VrfId, val.DstIpAddr, val.NextHopAddr), Value: val}\n\td.parent.Ops = append(d.parent.Ops, op)\n\treturn d\n}", "title": "" }, { "docid": "52a638309e2d2bebad3faa5ec4598648", "score": "0.45783356", "text": "func (s *ServerRoute) IsAlive() (alive bool) {\n\ts.Lock.Lock()\n\talive = s.Alive\n\ts.Lock.Unlock()\n\treturn alive\n}", "title": "" } ]
eec4c8cc6cee4a767dfc2f3f2eadebff
SortStable sorts slice of ChannelAdminLogEventActionParticipantJoinByInvite.
[ { "docid": "cbcb3cd30ad0604c87da1c32a24e6fae", "score": "0.7668648", "text": "func (s ChannelAdminLogEventActionParticipantJoinByInviteArray) SortStable(less func(a, b ChannelAdminLogEventActionParticipantJoinByInvite) bool) ChannelAdminLogEventActionParticipantJoinByInviteArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" } ]
[ { "docid": "e1dcfb50466b79f5dd0a494fe96bce28", "score": "0.761622", "text": "func (s ChannelAdminLogEventActionParticipantJoinByInviteArray) Sort(less func(a, b ChannelAdminLogEventActionParticipantJoinByInvite) bool) ChannelAdminLogEventActionParticipantJoinByInviteArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "70645aa7b667d56871d57a825430c3b4", "score": "0.7003791", "text": "func (s ChannelAdminLogEventActionParticipantInviteArray) Sort(less func(a, b ChannelAdminLogEventActionParticipantInvite) bool) ChannelAdminLogEventActionParticipantInviteArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "50ccd33a390e9d16084976a42694ff1e", "score": "0.6953852", "text": "func (s ChannelAdminLogEventActionParticipantInviteArray) SortStable(less func(a, b ChannelAdminLogEventActionParticipantInvite) bool) ChannelAdminLogEventActionParticipantInviteArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "0dfc67e73541f2c13e5b4d27dfafea9b", "score": "0.6471798", "text": "func (s ChannelAdminLogEventActionExportedInviteEditArray) Sort(less func(a, b ChannelAdminLogEventActionExportedInviteEdit) bool) ChannelAdminLogEventActionExportedInviteEditArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "ab93b92117b4a5cf1743e4e3c59a79b2", "score": "0.64055777", "text": "func (s ChannelAdminLogEventActionExportedInviteEditArray) SortStable(less func(a, b ChannelAdminLogEventActionExportedInviteEdit) bool) ChannelAdminLogEventActionExportedInviteEditArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "a67882191f0d54dfb1a632f20549c7ef", "score": "0.6302051", "text": "func (s ChannelAdminLogEventActionExportedInviteRevokeArray) SortStable(less func(a, b ChannelAdminLogEventActionExportedInviteRevoke) bool) ChannelAdminLogEventActionExportedInviteRevokeArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "9d12eae0ff01026f06c582557a379cb1", "score": "0.6282552", "text": "func (s ChannelAdminLogEventActionToggleInvitesArray) Sort(less func(a, b ChannelAdminLogEventActionToggleInvites) bool) ChannelAdminLogEventActionToggleInvitesArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "e8aabccf84235a9a5f9434ba32bf0744", "score": "0.6261483", "text": "func (s ChannelAdminLogEventActionExportedInviteDeleteArray) SortStable(less func(a, b ChannelAdminLogEventActionExportedInviteDelete) bool) ChannelAdminLogEventActionExportedInviteDeleteArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "b140ccf46bf310333c025c9bcaad90cb", "score": "0.6194707", "text": "func (s ChannelAdminLogEventActionExportedInviteRevokeArray) Sort(less func(a, b ChannelAdminLogEventActionExportedInviteRevoke) bool) ChannelAdminLogEventActionExportedInviteRevokeArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "770abacbd05379000756f9ca1abccc78", "score": "0.6180388", "text": "func (s ChannelAdminLogEventActionExportedInviteDeleteArray) Sort(less func(a, b ChannelAdminLogEventActionExportedInviteDelete) bool) ChannelAdminLogEventActionExportedInviteDeleteArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "8a08edabf21fe154b19a629cea2b5d91", "score": "0.6143811", "text": "func (s ChannelAdminLogEventActionToggleInvitesArray) SortStable(less func(a, b ChannelAdminLogEventActionToggleInvites) bool) ChannelAdminLogEventActionToggleInvitesArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "8c418ad265cea1f37754cd74a548ce82", "score": "0.61390543", "text": "func (s ChannelAdminLogEventActionParticipantToggleBanArray) Sort(less func(a, b ChannelAdminLogEventActionParticipantToggleBan) bool) ChannelAdminLogEventActionParticipantToggleBanArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "9dc572c6710f905f40e0c9ad632b61ac", "score": "0.59807074", "text": "func (s ChannelAdminLogEventActionParticipantToggleBanArray) SortStable(less func(a, b ChannelAdminLogEventActionParticipantToggleBan) bool) ChannelAdminLogEventActionParticipantToggleBanArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "93be9666f5c3afa94960de8a8361b5de", "score": "0.5936429", "text": "func (s MessagesExportedChatInviteArray) SortStable(less func(a, b MessagesExportedChatInvite) bool) MessagesExportedChatInviteArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "c8c774250207ba373adcb2105efac296", "score": "0.5935476", "text": "func (s ChannelAdminLogEventActionParticipantToggleAdminArray) Sort(less func(a, b ChannelAdminLogEventActionParticipantToggleAdmin) bool) ChannelAdminLogEventActionParticipantToggleAdminArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "b849af2f0fd5eba2fa3c1f6b25856140", "score": "0.5922403", "text": "func (s MessagesExportedChatInviteArray) Sort(less func(a, b MessagesExportedChatInvite) bool) MessagesExportedChatInviteArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "6f803b160e1e564923c30cbb3e300439", "score": "0.5860209", "text": "func (s ChannelAdminLogEventActionParticipantToggleAdminArray) SortStable(less func(a, b ChannelAdminLogEventActionParticipantToggleAdmin) bool) ChannelAdminLogEventActionParticipantToggleAdminArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "696aa18be082e4b8145bb88c98d2162a", "score": "0.58559823", "text": "func (s ChannelAdminLogEventActionParticipantUnmuteArray) Sort(less func(a, b ChannelAdminLogEventActionParticipantUnmute) bool) ChannelAdminLogEventActionParticipantUnmuteArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "155f2c2b8683f9475526939f3cb2a7ff", "score": "0.568088", "text": "func (s ChannelAdminLogEventActionParticipantUnmuteArray) SortStable(less func(a, b ChannelAdminLogEventActionParticipantUnmute) bool) ChannelAdminLogEventActionParticipantUnmuteArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "eeca9b54dd6f7b7337259346e2f2a030", "score": "0.5612523", "text": "func (s ChannelAdminLogEventActionChangeLinkedChatArray) SortStable(less func(a, b ChannelAdminLogEventActionChangeLinkedChat) bool) ChannelAdminLogEventActionChangeLinkedChatArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "24eda565572b868f767b5fcbb62660b3", "score": "0.5602867", "text": "func (s ChannelAdminLogEventActionParticipantMuteArray) Sort(less func(a, b ChannelAdminLogEventActionParticipantMute) bool) ChannelAdminLogEventActionParticipantMuteArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "a497edd50767413fb69df5fa449adc8e", "score": "0.5555488", "text": "func (s ChannelAdminLogEventActionStartGroupCallArray) SortStable(less func(a, b ChannelAdminLogEventActionStartGroupCall) bool) ChannelAdminLogEventActionStartGroupCallArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "78b0db15ef4be13d4776ff9ba89d6b93", "score": "0.5528989", "text": "func (s ChannelAdminLogEventActionChangeLinkedChatArray) Sort(less func(a, b ChannelAdminLogEventActionChangeLinkedChat) bool) ChannelAdminLogEventActionChangeLinkedChatArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "13c6b98d44cdcb03e1983a9462e4537d", "score": "0.55169183", "text": "func (s MessagesExportedChatInviteClassArray) SortStable(less func(a, b MessagesExportedChatInviteClass) bool) MessagesExportedChatInviteClassArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "d7e588b6f6e07021e8832aca65598f8e", "score": "0.5490556", "text": "func (s ChannelAdminLogEventActionParticipantVolumeArray) Sort(less func(a, b ChannelAdminLogEventActionParticipantVolume) bool) ChannelAdminLogEventActionParticipantVolumeArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "94eb4a0dc3f394d838ee34d819ebc98f", "score": "0.54588515", "text": "func (s ChannelAdminLogEventActionClassArray) AsChannelAdminLogEventActionParticipantJoinByInvite() (to ChannelAdminLogEventActionParticipantJoinByInviteArray) {\n\tfor _, elem := range s {\n\t\tvalue, ok := elem.(*ChannelAdminLogEventActionParticipantJoinByInvite)\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": "25eed87b7f40208597e4831c7b4fb400", "score": "0.5434442", "text": "func (s ChannelAdminLogEventActionEditMessageArray) SortStable(less func(a, b ChannelAdminLogEventActionEditMessage) bool) ChannelAdminLogEventActionEditMessageArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "9f7f6326e9f3b4da8848ccebc1f8b00a", "score": "0.5402491", "text": "func (s ChannelAdminLogEventActionChangeAboutArray) SortStable(less func(a, b ChannelAdminLogEventActionChangeAbout) bool) ChannelAdminLogEventActionChangeAboutArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "2dfc2d1c19e0a5f7a8f207886bda68ec", "score": "0.54019934", "text": "func (s PrivacyValueDisallowChatParticipantsArray) Sort(less func(a, b PrivacyValueDisallowChatParticipants) bool) PrivacyValueDisallowChatParticipantsArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "0561dcf247e5c8e2b03aa63fedc72629", "score": "0.539081", "text": "func (s PrivacyValueAllowChatParticipantsArray) Sort(less func(a, b PrivacyValueAllowChatParticipants) bool) PrivacyValueAllowChatParticipantsArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "fdc228f9aa02458fcf68b99f96bc880f", "score": "0.53686714", "text": "func (l Leaderboard) sortByActivityCount(k *Kraftee) {\n\tsort.Slice(l, func(i, j int) bool {\n\t\tif k != nil && l[i].AllCount == l[j].AllCount {\n\t\t\treturn l[i].ID != k.StravaId\n\t\t} else {\n\t\t\treturn l[i].AllCount > l[j].AllCount\n\t\t}\n\t})\n}", "title": "" }, { "docid": "86942e1715a26ca62828888362e66318", "score": "0.5364752", "text": "func (s ChannelAdminLogEventActionParticipantMuteArray) SortStable(less func(a, b ChannelAdminLogEventActionParticipantMute) bool) ChannelAdminLogEventActionParticipantMuteArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "c72c6296cb54eb3648b6654bf39ec835", "score": "0.5347014", "text": "func (s ChannelAdminLogEventActionChangeAboutArray) Sort(less func(a, b ChannelAdminLogEventActionChangeAbout) bool) ChannelAdminLogEventActionChangeAboutArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "d06ddfb09b1468745b76de47c5049af6", "score": "0.5338402", "text": "func (s ChannelAdminLogEventActionParticipantVolumeArray) SortStable(less func(a, b ChannelAdminLogEventActionParticipantVolume) bool) ChannelAdminLogEventActionParticipantVolumeArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "26068b4795fad62608b2fa1b39b0a98b", "score": "0.5303083", "text": "func (s MessagesExportedChatInviteReplacedArray) Sort(less func(a, b MessagesExportedChatInviteReplaced) bool) MessagesExportedChatInviteReplacedArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "cb8cbdb16cc31bde81b6f769621f6421", "score": "0.52815163", "text": "func (s ChannelAdminLogEventActionDeleteMessageArray) SortStable(less func(a, b ChannelAdminLogEventActionDeleteMessage) bool) ChannelAdminLogEventActionDeleteMessageArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "762183739fd454153a3e6c9f7f5a7f73", "score": "0.52712834", "text": "func (s PrivacyValueDisallowChatParticipantsArray) SortStable(less func(a, b PrivacyValueDisallowChatParticipants) bool) PrivacyValueDisallowChatParticipantsArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "d703d19b9de662354e9d30e036e574f7", "score": "0.52645934", "text": "func (s MessagesExportedChatInviteReplacedArray) SortStable(less func(a, b MessagesExportedChatInviteReplaced) bool) MessagesExportedChatInviteReplacedArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "1ccbdbd4472cabee87b44bfdbd831bac", "score": "0.52503496", "text": "func (s PrivacyValueAllowChatParticipantsArray) SortStable(less func(a, b PrivacyValueAllowChatParticipants) bool) PrivacyValueAllowChatParticipantsArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "2dafa74a60395b00fe67d2c02787c635", "score": "0.5247138", "text": "func (s ChannelAdminLogEventActionStartGroupCallArray) Sort(less func(a, b ChannelAdminLogEventActionStartGroupCall) bool) ChannelAdminLogEventActionStartGroupCallArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "ec07b63aea083dc0b995d763e66b2f64", "score": "0.5246349", "text": "func (*ChannelAdminLogEventActionParticipantJoinByInvite) TypeName() string {\n\treturn \"channelAdminLogEventActionParticipantJoinByInvite\"\n}", "title": "" }, { "docid": "37721b2bf9426e0dc232022e731f280e", "score": "0.52286714", "text": "func (s MessagesExportedChatInviteClassArray) Sort(less func(a, b MessagesExportedChatInviteClass) bool) MessagesExportedChatInviteClassArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "250c6717903626f1ba11a543d579bdba", "score": "0.5218172", "text": "func (s ChannelAdminLogEventActionChangeUsernameArray) SortStable(less func(a, b ChannelAdminLogEventActionChangeUsername) bool) ChannelAdminLogEventActionChangeUsernameArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "08b8b1a5adce0bdbb4d1694d83551ae5", "score": "0.5210425", "text": "func (s ChannelAdminLogEventActionToggleSignaturesArray) SortStable(less func(a, b ChannelAdminLogEventActionToggleSignatures) bool) ChannelAdminLogEventActionToggleSignaturesArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "1dc7db5cb112b1fb3915368de53fe6b1", "score": "0.51922", "text": "func (s ChannelAdminLogEventActionToggleGroupCallSettingArray) SortStable(less func(a, b ChannelAdminLogEventActionToggleGroupCallSetting) bool) ChannelAdminLogEventActionToggleGroupCallSettingArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "42a741b5f9e249b862606eeafe9ad87e", "score": "0.51563865", "text": "func (s ChannelAdminLogEventActionClassArray) SortStable(less func(a, b ChannelAdminLogEventActionClass) bool) ChannelAdminLogEventActionClassArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "854f3b6b28442e68eed3aaf31398490e", "score": "0.51480794", "text": "func (s ChannelAdminLogEventActionToggleSignaturesArray) Sort(less func(a, b ChannelAdminLogEventActionToggleSignatures) bool) ChannelAdminLogEventActionToggleSignaturesArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "c71a460fe92cfd78cdc7f8146964e35e", "score": "0.51327014", "text": "func sortEmailNotify(en []EmailNotify) {\n\tsort.Slice(en, func(i, j int) bool {\n\t\tfirst := en[i]\n\t\tsecond := en[j]\n\t\temailResult := strings.Compare(first.Email, second.Email)\n\t\tif emailResult == 0 {\n\t\t\treturn strings.Compare(first.Template, second.Template) < 0\n\t\t}\n\t\treturn emailResult < 0\n\t})\n}", "title": "" }, { "docid": "93b1ba12cf01c8a4cf2d96f6d5c17810", "score": "0.5118645", "text": "func (s ChannelAdminLogEventActionDiscardGroupCallArray) SortStable(less func(a, b ChannelAdminLogEventActionDiscardGroupCall) bool) ChannelAdminLogEventActionDiscardGroupCallArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "0dc55ec551507bc2f17fe207b9898033", "score": "0.51091766", "text": "func (s ChannelAdminLogEventActionEditMessageArray) Sort(less func(a, b ChannelAdminLogEventActionEditMessage) bool) ChannelAdminLogEventActionEditMessageArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "07f29689dfcad2d11fae194bbe2a0d5b", "score": "0.50917256", "text": "func (s ChannelAdminLogEventActionUpdatePinnedArray) SortStable(less func(a, b ChannelAdminLogEventActionUpdatePinned) bool) ChannelAdminLogEventActionUpdatePinnedArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "663615bddb8ffc84f31e672c36593d98", "score": "0.5055888", "text": "func (s ChannelAdminLogEventActionUpdatePinnedArray) Sort(less func(a, b ChannelAdminLogEventActionUpdatePinned) bool) ChannelAdminLogEventActionUpdatePinnedArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "66d44819fccfed7baab4b92dac8d42bd", "score": "0.50269765", "text": "func (s ChannelAdminLogEventActionChangeTitleArray) SortStable(less func(a, b ChannelAdminLogEventActionChangeTitle) bool) ChannelAdminLogEventActionChangeTitleArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "a9920c64b319af9bea0104a74ad27578", "score": "0.5026612", "text": "func (s ChannelAdminLogEventActionDefaultBannedRightsArray) SortStable(less func(a, b ChannelAdminLogEventActionDefaultBannedRights) bool) ChannelAdminLogEventActionDefaultBannedRightsArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "3e614f683af6e85a59d48b6438fc165a", "score": "0.50253916", "text": "func (s ChannelAdminLogEventActionChangeUsernameArray) Sort(less func(a, b ChannelAdminLogEventActionChangeUsername) bool) ChannelAdminLogEventActionChangeUsernameArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "3669b3a6398e0547715fe7f90de58b27", "score": "0.49953637", "text": "func (s ChannelAdminLogEventActionStopPollArray) SortStable(less func(a, b ChannelAdminLogEventActionStopPoll) bool) ChannelAdminLogEventActionStopPollArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "770b0a923fb15896358e678a7c169e22", "score": "0.4974311", "text": "func (s ChannelAdminLogEventActionToggleSlowModeArray) Sort(less func(a, b ChannelAdminLogEventActionToggleSlowMode) bool) ChannelAdminLogEventActionToggleSlowModeArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "5043a5692ce6fcbe54d333a1925c5262", "score": "0.4965173", "text": "func (s ChannelAdminLogEventActionTogglePreHistoryHiddenArray) Sort(less func(a, b ChannelAdminLogEventActionTogglePreHistoryHidden) bool) ChannelAdminLogEventActionTogglePreHistoryHiddenArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "4562b34e8a0cbddeabec34e8f3fc4346", "score": "0.49611154", "text": "func (s ChannelAdminLogEventActionDiscardGroupCallArray) Sort(less func(a, b ChannelAdminLogEventActionDiscardGroupCall) bool) ChannelAdminLogEventActionDiscardGroupCallArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "2c6adddf3aea052f1482aa17d3c274ba", "score": "0.49545822", "text": "func (s ChannelAdminLogEventActionToggleGroupCallSettingArray) Sort(less func(a, b ChannelAdminLogEventActionToggleGroupCallSetting) bool) ChannelAdminLogEventActionToggleGroupCallSettingArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "0e59718b8d507f5eb9830e69f16c2744", "score": "0.49274424", "text": "func (s ChannelAdminLogEventActionToggleSlowModeArray) SortStable(less func(a, b ChannelAdminLogEventActionToggleSlowMode) bool) ChannelAdminLogEventActionToggleSlowModeArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "8a7b7dd0f193a793771049a49ae5e13d", "score": "0.49165034", "text": "func (s ChannelAdminLogEventActionTogglePreHistoryHiddenArray) SortStable(less func(a, b ChannelAdminLogEventActionTogglePreHistoryHidden) bool) ChannelAdminLogEventActionTogglePreHistoryHiddenArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "4849a1058f646b392c8c8d57605fea30", "score": "0.48719114", "text": "func (s ChannelAdminLogEventActionChangeHistoryTTLArray) Sort(less func(a, b ChannelAdminLogEventActionChangeHistoryTTL) bool) ChannelAdminLogEventActionChangeHistoryTTLArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "0884de75dd94bb1237388c1f35a06045", "score": "0.48703805", "text": "func (s ChannelAdminLogEventActionDefaultBannedRightsArray) Sort(less func(a, b ChannelAdminLogEventActionDefaultBannedRights) bool) ChannelAdminLogEventActionDefaultBannedRightsArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "3f77ecabaf60f6b36b61acd0a78467ee", "score": "0.48623875", "text": "func (*ChannelAdminLogEventActionParticipantJoinByInvite) TypeID() uint32 {\n\treturn ChannelAdminLogEventActionParticipantJoinByInviteTypeID\n}", "title": "" }, { "docid": "cb8abd529b7804f54614d2464b531ac5", "score": "0.48601913", "text": "func (listeners Listeners) Sort() {\n\t// Sort listeners by routegroup, paths\n\tsort.SliceStable(listeners, func(i, j int) bool {\n\t\tif listeners[i].Port == listeners[j].Port {\n\t\t\treturn listeners[i].Name < listeners[j].Name\n\t\t}\n\t\treturn listeners[i].Port < listeners[j].Port\n\t})\n}", "title": "" }, { "docid": "7213c5bac4acccb2906a0866629a7dbf", "score": "0.48558924", "text": "func (s ChannelAdminLogEventActionChangePhotoArray) SortStable(less func(a, b ChannelAdminLogEventActionChangePhoto) bool) ChannelAdminLogEventActionChangePhotoArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "fa0ed06b6b4aa4cbba50aa0ec5ecb728", "score": "0.4850815", "text": "func (s ChannelAdminLogEventActionChangeHistoryTTLArray) SortStable(less func(a, b ChannelAdminLogEventActionChangeHistoryTTL) bool) ChannelAdminLogEventActionChangeHistoryTTLArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "8f6910c26d93deb167b17345f1d730b7", "score": "0.48388007", "text": "func SliceSort(wg *sync.WaitGroup, threadID int, items []int) {\n\n\tfmt.Printf(\"On thread #[%d] - Slice received %v\\n\", threadID, items)\n\tfmt.Printf(\"On thread #[%d] - Sorting ...\\n\", threadID)\n\n\tsort.Sort(sort.IntSlice(items))\n\n\tfmt.Printf(\"On thread #[%d] - Slice sorted %v. Exiting thread...\\n\", threadID, items)\n\twg.Done()\n}", "title": "" }, { "docid": "45d69f51b5d8ecc3e1c99d340353a3e2", "score": "0.48290426", "text": "func (s ChannelAdminLogEventActionStopPollArray) Sort(less func(a, b ChannelAdminLogEventActionStopPoll) bool) ChannelAdminLogEventActionStopPollArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "40aa61544d614a99236b026775c22aa8", "score": "0.48236775", "text": "func (t *Test) SortEvents() {\n\tsort.Slice(t.Events, func(i, j int) bool {\n\t\treturn t.Events[i].Time.Before(t.Events[j].Time)\n\t})\n}", "title": "" }, { "docid": "5b1d96a8d7c4a51d974d5e8d82387b0a", "score": "0.48186216", "text": "func (s ChannelAdminLogEventActionDeleteMessageArray) Sort(less func(a, b ChannelAdminLogEventActionDeleteMessage) bool) ChannelAdminLogEventActionDeleteMessageArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "e35957b73ceff747da280f5b34fa7a94", "score": "0.4801737", "text": "func (s ChannelAdminLogEventActionClassArray) AsChannelAdminLogEventActionParticipantInvite() (to ChannelAdminLogEventActionParticipantInviteArray) {\n\tfor _, elem := range s {\n\t\tvalue, ok := elem.(*ChannelAdminLogEventActionParticipantInvite)\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": "fe7c4c87ee4e3605e7ebee0d88b9d564", "score": "0.47874707", "text": "func SortActivities(activities []v1.PipelineActivity) {\n\tsort.Sort(ByTimestamp(activities))\n}", "title": "" }, { "docid": "0aa179ca7ce7616499ac368dd729d1cb", "score": "0.47754592", "text": "func TestAlertSliceSort2(t *testing.T) {\n\tvar (\n\t\tga10 = &Alert{\n\t\t\tAlert: model.Alert{\n\t\t\t\tLabels: model.LabelSet{\n\t\t\t\t\t\"alarmType\": \"300\",\n\t\t\t\t\t\"alertname\": \"ServerNotResponding\",\n\t\t\t\t\t\"job\": \"netserver\",\n\t\t\t\t\t\"instance\": \"127.0.0.1:2119\",\n\t\t\t\t\t\"system\": \"server\",\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\tga11 = &Alert{\n\t\t\tAlert: model.Alert{\n\t\t\t\tLabels: model.LabelSet{\n\t\t\t\t\t\"alarmType\": \"300\",\n\t\t\t\t\t\"alertname\": \"ServerNotResponding\",\n\t\t\t\t\t\"job\": \"netserver\",\n\t\t\t\t\t\"instance\": \"127.0.0.2:2119\",\n\t\t\t\t\t\"system\": \"server\",\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\tga12 = &Alert{\n\t\t\tAlert: model.Alert{\n\t\t\t\tLabels: model.LabelSet{\n\t\t\t\t\t\"alarmType\": \"300\",\n\t\t\t\t\t\"alertname\": \"ServerNotResponding\",\n\t\t\t\t\t\"job\": \"omserver\",\n\t\t\t\t\t\"instance\": \"127.0.0.1:1796\",\n\t\t\t\t\t\"system\": \"server\",\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\tbcl8a = &Alert{\n\t\t\tAlert: model.Alert{\n\t\t\t\tLabels: model.LabelSet{\n\t\t\t\t\t\"alarmType\": \"100\",\n\t\t\t\t\t\"alertname\": \"BackhaulConnectionLost\",\n\t\t\t\t\t\"gatewayUUID\": \"000000000800000a\",\n\t\t\t\t\t\"job\": \"omserver\",\n\t\t\t\t\t\"system\": \"gateway\",\n\t\t\t\t\t\"type\": \"udp\",\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\tbcl8b = &Alert{\n\t\t\tAlert: model.Alert{\n\t\t\t\tLabels: model.LabelSet{\n\t\t\t\t\t\"alarmType\": \"100\",\n\t\t\t\t\t\"alertname\": \"BackhaulConnectionLost\",\n\t\t\t\t\t\"gatewayUUID\": \"000000000800000b\",\n\t\t\t\t\t\"job\": \"omserver\",\n\t\t\t\t\t\"system\": \"gateway\",\n\t\t\t\t\t\"type\": \"udp\",\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\tnkn8a = &Alert{\n\t\t\tAlert: model.Alert{\n\t\t\t\tLabels: model.LabelSet{\n\t\t\t\t\t\"alarmType\": \"103\",\n\t\t\t\t\t\"alertname\": \"NetServerKeepAliveNotFunctional\",\n\t\t\t\t\t\"gatewayUUID\": \"000000000800000a\",\n\t\t\t\t\t\"job\": \"omserver\",\n\t\t\t\t\t\"system\": \"gateway\",\n\t\t\t\t\t\"type\": \"nsdl\",\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\tbcl7dT2 = &Alert{\n\t\t\tAlert: model.Alert{\n\t\t\t\tLabels: model.LabelSet{\n\t\t\t\t\t\"alarmType\": \"100\",\n\t\t\t\t\t\"alertname\": \"BackhaulConnectionLost\",\n\t\t\t\t\t\"gatewayUUID\": \"000000000700000d\",\n\t\t\t\t\t\"job\": \"omserver\",\n\t\t\t\t\t\"system\": \"gateway\",\n\t\t\t\t\t\"type\": \"udp\",\n\t\t\t\t\t\"tenantid\": \"2-7cc1e424-048c-4ec3-a3cf-a37b6305af07\",\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\tbcl8cT7 = &Alert{\n\t\t\tAlert: model.Alert{\n\t\t\t\tLabels: model.LabelSet{\n\t\t\t\t\t\"alarmType\": \"100\",\n\t\t\t\t\t\"alertname\": \"BackhaulConnectionLost\",\n\t\t\t\t\t\"gatewayUUID\": \"000000000800000c\",\n\t\t\t\t\t\"job\": \"omserver\",\n\t\t\t\t\t\"system\": \"gateway\",\n\t\t\t\t\t\"type\": \"udp\",\n\t\t\t\t\t\"tenantid\": \"7cc1e424-048c-4ec3-a3cf-a37b6305af07\",\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\tbcl8dT7 = &Alert{\n\t\t\tAlert: model.Alert{\n\t\t\t\tLabels: model.LabelSet{\n\t\t\t\t\t\"alarmType\": \"100\",\n\t\t\t\t\t\"alertname\": \"BackhaulConnectionLost\",\n\t\t\t\t\t\"gatewayUUID\": \"000000000800000d\",\n\t\t\t\t\t\"job\": \"omserver\",\n\t\t\t\t\t\"system\": \"gateway\",\n\t\t\t\t\t\"type\": \"udp\",\n\t\t\t\t\t\"tenantid\": \"7cc1e424-048c-4ec3-a3cf-a37b6305af07\",\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\tbcl9cT2 = &Alert{\n\t\t\tAlert: model.Alert{\n\t\t\t\tLabels: model.LabelSet{\n\t\t\t\t\t\"alarmType\": \"100\",\n\t\t\t\t\t\"alertname\": \"BackhaulConnectionLost\",\n\t\t\t\t\t\"gatewayUUID\": \"000000000900000c\",\n\t\t\t\t\t\"job\": \"omserver\",\n\t\t\t\t\t\"system\": \"gateway\",\n\t\t\t\t\t\"type\": \"udp\",\n\t\t\t\t\t\"tenantid\": \"2-7cc1e424-048c-4ec3-a3cf-a37b6305af07\",\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\tnkn7dT2 = &Alert{\n\t\t\tAlert: model.Alert{\n\t\t\t\tLabels: model.LabelSet{\n\t\t\t\t\t\"alarmType\": \"103\",\n\t\t\t\t\t\"alertname\": \"NetServerKeepAliveNotFunctional\",\n\t\t\t\t\t\"gatewayUUID\": \"000000000700000d\",\n\t\t\t\t\t\"job\": \"omserver\",\n\t\t\t\t\t\"system\": \"gateway\",\n\t\t\t\t\t\"type\": \"nsdl\",\n\t\t\t\t\t\"tenantid\": \"2-7cc1e424-048c-4ec3-a3cf-a37b6305af07\",\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\tnkn8cT7 = &Alert{\n\t\t\tAlert: model.Alert{\n\t\t\t\tLabels: model.LabelSet{\n\t\t\t\t\t\"alarmType\": \"103\",\n\t\t\t\t\t\"alertname\": \"NetServerKeepAliveNotFunctional\",\n\t\t\t\t\t\"gatewayUUID\": \"000000000800000c\",\n\t\t\t\t\t\"job\": \"omserver\",\n\t\t\t\t\t\"system\": \"gateway\",\n\t\t\t\t\t\"type\": \"nsdl\",\n\t\t\t\t\t\"tenantid\": \"7cc1e424-048c-4ec3-a3cf-a37b6305af07\",\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\tnkn8dT7 = &Alert{\n\t\t\tAlert: model.Alert{\n\t\t\t\tLabels: model.LabelSet{\n\t\t\t\t\t\"alarmType\": \"103\",\n\t\t\t\t\t\"alertname\": \"NetServerKeepAliveNotFunctional\",\n\t\t\t\t\t\"gatewayUUID\": \"000000000800000d\",\n\t\t\t\t\t\"job\": \"omserver\",\n\t\t\t\t\t\"system\": \"gateway\",\n\t\t\t\t\t\"type\": \"nsdl\",\n\t\t\t\t\t\"tenantid\": \"7cc1e424-048c-4ec3-a3cf-a37b6305af07\",\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\tnkn9cT2 = &Alert{\n\t\t\tAlert: model.Alert{\n\t\t\t\tLabels: model.LabelSet{\n\t\t\t\t\t\"alarmType\": \"103\",\n\t\t\t\t\t\"alertname\": \"NetServerKeepAliveNotFunctional\",\n\t\t\t\t\t\"gatewayUUID\": \"000000000900000c\",\n\t\t\t\t\t\"job\": \"omserver\",\n\t\t\t\t\t\"system\": \"gateway\",\n\t\t\t\t\t\"type\": \"nsdl\",\n\t\t\t\t\t\"tenantid\": \"2-7cc1e424-048c-4ec3-a3cf-a37b6305af07\",\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\tlro8a = &Alert{\n\t\t\tAlert: model.Alert{\n\t\t\t\tLabels: model.LabelSet{\n\t\t\t\t\t\"alarmSeverity\": \"3\",\n\t\t\t\t\t\"alertname\": \"LoRaRadioOFF\",\n\t\t\t\t\t\"alarmType\": \"3\",\n\t\t\t\t\t\"gatewayUUID\": \"000000000800000a\",\n\t\t\t\t\t\"gatewayType\": \"Tracknet TabsHub, 863-870MHz\",\n\t\t\t\t\t\"job\": \"omserver\",\n\t\t\t\t\t\"system\": \"gateway\",\n\t\t\t\t\t\"type\": \"udp\",\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\tlro8bT2 = &Alert{\n\t\t\tAlert: model.Alert{\n\t\t\t\tLabels: model.LabelSet{\n\t\t\t\t\t\"alarmSeverity\": \"3\",\n\t\t\t\t\t\"alertname\": \"LoRaRadioOFF\",\n\t\t\t\t\t\"alarmType\": \"102\",\n\t\t\t\t\t\"description\": \"LoRa radio is OFF\",\n\t\t\t\t\t\"entity\": \"GTW\",\n\t\t\t\t\t\"gatewayType\": \"Tracknet TabsHub, 863-870MHz\",\n\t\t\t\t\t\"gatewayUUID\": \"000000000800000b\",\n\t\t\t\t\t\"job\": \"omserver\",\n\t\t\t\t\t\"message\": \"LoRa radio is OFF\",\n\t\t\t\t\t\"tenantid\": \"2-7cc1e424-048c-4ec3-a3cf-a37b6305af07\",\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t)\n\n\t_ = bcl9cT2\n\t_ = bcl7dT2\n\t_ = nkn9cT2\n\t_ = nkn7dT2\n\tcases := []struct {\n\t\talerts AlertSlice\n\t\texp AlertSlice\n\t}{\n\t\t{\n\t\t\talerts: AlertSlice{bcl8b, bcl7dT2, bcl8dT7, bcl8a, bcl9cT2, lro8bT2, ga11, nkn8dT7, nkn9cT2, nkn7dT2, nkn8a, bcl8cT7, ga12, ga10, nkn8cT7, lro8a},\n\t\t\texp: AlertSlice{ga10, ga11, ga12, bcl8a, bcl8b, nkn8a, bcl7dT2, bcl8cT7, bcl8dT7, bcl9cT2, nkn7dT2, nkn8cT7, nkn8dT7, nkn9cT2, lro8a, lro8bT2},\n\t\t}}\n\tfor _, tc := range cases {\n\t\tsort.Stable(tc.alerts)\n\t\tfor _, al := range tc.alerts {\n\t\t\t// todo iterate on map\n\t\t\tfmt.Printf(\"%v %v\\n\", len(al.Labels), al.Labels)\n\t\t}\n\t\tif !reflect.DeepEqual(tc.alerts, tc.exp) {\n\t\t\tt.Fatalf(\"expected %v but got %v\", tc.exp, tc.alerts)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bd528b05e59b8dbe81d191d154a95fdd", "score": "0.47573557", "text": "func main() {\n\n\ttime_slice := make([]DisplayCountTable, 0)\n\ttime_slice = append(time_slice, DisplayCountTable{IndexName: \"2015-11-23\", Count: 3})\n\ttime_slice = append(time_slice, DisplayCountTable{IndexName: \"2014-12-03\", Count: 2})\n\ttime_slice = append(time_slice, DisplayCountTable{IndexName: \"2014-11-25\", Count: 1})\n\ttime_slice = append(time_slice, DisplayCountTable{IndexName: \"2016-10-25\", Count: 8})\n\tfmt.Println(\"Before sort:\", time_slice)\n\tsort.Sort(SortByTime(time_slice))\n\tfmt.Println(\"After sort:\", time_slice)\n\n\tfmt.Println(\"Less sort:\", SortByTime(time_slice).Less(1, 2))\n}", "title": "" }, { "docid": "544ec5a85ece931c81c1aa7232613d95", "score": "0.47476268", "text": "func (s ChannelAdminLogEventActionClassArray) Sort(less func(a, b ChannelAdminLogEventActionClass) bool) ChannelAdminLogEventActionClassArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "563176a07314fcce587bd4c973d54fad", "score": "0.47288948", "text": "func (s ChannelAdminLogEventActionChangeStickerSetArray) Sort(less func(a, b ChannelAdminLogEventActionChangeStickerSet) bool) ChannelAdminLogEventActionChangeStickerSetArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "1dc8d8dac41d52f2a239c67fd71162d1", "score": "0.47209138", "text": "func (a *apiServer) sort(\n\tslice interface{}, order apiv1.OrderBy, keys ...interface{},\n) {\n\trv := reflect.ValueOf(slice)\n\tsort.Slice(slice, func(i, j int) bool {\n\t\ta1 := rv.Index(i).Interface().(proto.Message).ProtoReflect()\n\t\ta2 := rv.Index(j).Interface().(proto.Message).ProtoReflect()\n\t\tif order == apiv1.OrderBy_ORDER_BY_DESC {\n\t\t\ta2, a1 = a1, a2\n\t\t}\n\t\td1, d2 := a1.Descriptor(), a2.Descriptor()\n\t\tfor _, key := range keys {\n\t\t\tkey := reflect.ValueOf(key).Int()\n\t\t\tif key == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfn := pref.FieldNumber(key)\n\t\t\tfd1, fd2 := d1.Fields().ByNumber(fn), d2.Fields().ByNumber(fn)\n\t\t\tf1, f2 := a1.Get(fd1), a2.Get(fd2)\n\n\t\t\tif fd1.Cardinality() == pref.Repeated {\n\t\t\t\tpanic(fmt.Sprintf(\"incomparable cardinality for field: %s\", fd1.FullName()))\n\t\t\t}\n\t\t\tswitch fd1.Kind() {\n\t\t\tcase pref.BoolKind:\n\t\t\t\tv1, v2 := f1.Bool(), f2.Bool()\n\t\t\t\tif v1 == v2 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\treturn v1\n\t\t\tcase pref.EnumKind:\n\t\t\t\tv1, v2 := f1.Enum(), f2.Enum()\n\t\t\t\tif v1 == v2 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\treturn v1 < v2\n\t\t\tcase pref.Int32Kind, pref.Sint32Kind, pref.Int64Kind,\n\t\t\t\tpref.Sint64Kind, pref.Sfixed32Kind, pref.Sfixed64Kind:\n\t\t\t\tv1, v2 := f1.Int(), f2.Int()\n\t\t\t\tif v1 == v2 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\treturn v1 < v2\n\t\t\tcase pref.Uint32Kind, pref.Uint64Kind, pref.Fixed32Kind, pref.Fixed64Kind:\n\t\t\t\tv1, v2 := f1.Uint(), f2.Uint()\n\t\t\t\tif v1 == v2 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\treturn v1 < v2\n\t\t\tcase pref.FloatKind, pref.DoubleKind:\n\t\t\t\tv1, v2 := f1.Float(), f2.Float()\n\t\t\t\tif v1 == v2 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\treturn v1 < v2\n\t\t\tcase pref.StringKind:\n\t\t\t\tv1, v2 := f1.String(), f2.String()\n\t\t\t\tif v1 == v2 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\treturn v1 < v2\n\t\t\tcase pref.MessageKind:\n\t\t\t\tv1, v2 := f1.Message().Interface(), f2.Message().Interface()\n\t\t\t\tswitch {\n\t\t\t\tcase v1 == nil && v2 == nil:\n\t\t\t\t\tcontinue\n\t\t\t\tcase v1 == nil:\n\t\t\t\t\treturn true\n\t\t\t\tcase v2 == nil:\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t\tswitch t1 := v1.(type) {\n\t\t\t\tcase *timestamppb.Timestamp:\n\t\t\t\t\tt2 := v2.(*timestamppb.Timestamp)\n\t\t\t\t\tif t1.Seconds == t2.Seconds {\n\t\t\t\t\t\tif t1.Nanos == t2.Nanos {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn t1.Nanos < t2.Nanos\n\t\t\t\t\t}\n\t\t\t\t\treturn t1.Seconds < t2.Seconds\n\t\t\t\tcase *wrapperspb.DoubleValue:\n\t\t\t\t\tt2 := v2.(*wrapperspb.DoubleValue)\n\t\t\t\t\tswitch {\n\t\t\t\t\tcase t1 != nil && t2 != nil:\n\t\t\t\t\t\treturn t1.Value < t2.Value\n\t\t\t\t\tcase t1 == nil && t2 != nil:\n\t\t\t\t\t\treturn true\n\t\t\t\t\t}\n\t\t\t\t\treturn false\n\t\t\t\tdefault:\n\t\t\t\t\tpanic(fmt.Sprintf(\"incomparable message type: %T\", t1))\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tpanic(fmt.Sprintf(\"incomparable field type for %s: %s\", fd1.FullName(), fd1.Kind()))\n\t\t\t}\n\t\t}\n\t\treturn false\n\t})\n}", "title": "" }, { "docid": "d85eacbb17c5752241b57dab6acc9a10", "score": "0.47056293", "text": "func sortTickets(tickets *Tickets) ([]Ticket, []Ticket) {\n\tvar incidentsRecent []Ticket\n\tvar incidentsPrev []Ticket\n\n\tfor _, ticket := range *tickets {\n\t\tif ticket.CreatedAt.After(time.Now().Add(-14 * 24 * time.Hour)) {\n\t\t\tincidentsRecent = append(incidentsRecent, ticket)\n\t\t} else {\n\t\t\tincidentsPrev = append(incidentsPrev, ticket)\n\t\t}\n\t}\n\n\tsort.Slice(incidentsRecent, func(i, j int) bool {\n\t\treturn incidentsRecent[i].CreatedAt.Before(incidentsRecent[j].CreatedAt)\n\t})\n\n\tsort.Slice(incidentsPrev, func(i, j int) bool {\n\t\treturn incidentsPrev[i].CreatedAt.Before(incidentsPrev[j].CreatedAt)\n\t})\n\n\treturn incidentsRecent, incidentsPrev\n}", "title": "" }, { "docid": "867de688d7e53a96829e8cb99fbaa64e", "score": "0.46980745", "text": "func (s ChannelAdminLogEventActionChangeLocationArray) SortStable(less func(a, b ChannelAdminLogEventActionChangeLocation) bool) ChannelAdminLogEventActionChangeLocationArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "b2bf47b9d059d972ff07e05638cec038", "score": "0.4678368", "text": "func (s ChannelAdminLogEventActionChangeStickerSetArray) SortStable(less func(a, b ChannelAdminLogEventActionChangeStickerSet) bool) ChannelAdminLogEventActionChangeStickerSetArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "56fbfd5e41c8061c5e25d17c5dd4344e", "score": "0.46768692", "text": "func (zs *Zaps) FetchSorted(i uint8) ChanViewersList {\n\tvar bv ByViewers\n\n\tif PrintTimes {\n\t\tdefer zap.TimeElapsed(time.Now(), zs.String()+\".FetchSorted\")\n\t}\n\n\tbv.ChanViewersList = zs.ChannelsViewers()\n\tsort.Sort(sort.Reverse(ByViewers(bv)))\n\treturn bv.ChanViewersList[:i]\n}", "title": "" }, { "docid": "9851f8cc9e1c09ce023fde7ab52d4451", "score": "0.46602014", "text": "func (txs *TransactionList) SortByTxFee() {\n\ttxs.mux.Lock()\n\tdefer txs.mux.Unlock()\n\tif len(txs.TxList) > 1 {\n\n\t\tsort.Slice(txs.TxList, func(i, j int) bool {\n\t\t\treturn txs.TxList[i].TransactionData.Msg.TxFee < txs.TxList[j].TransactionData.Msg.TxFee\n\t\t})\n\t}\n\t//fmt.Println(\"By TX fee:\", txs.TxList)\n}", "title": "" }, { "docid": "de52eaddf4f0dfd31d27266ffc36efc7", "score": "0.46393293", "text": "func (s PeerChatArray) Sort(less func(a, b PeerChat) bool) PeerChatArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "254ec0245c8afbba01bccc6d65617a46", "score": "0.4622539", "text": "func (s PeerChatArray) SortStable(less func(a, b PeerChat) bool) PeerChatArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "e1136171183a8b20cac8e83f274f4aec", "score": "0.46224135", "text": "func sort(meetings []meeting) {\n\tfor i := 0; i < len(meetings); i++ {\n\t\tearliestMeeting := meetings[i]\n\t\tearliestIndex := i\n\t\tfor j := i + 1; j < len(meetings); j++ {\n\t\t\t// Search through the rest of the array to find something smaller.\n\t\t\tnextMeeting := meetings[j]\n\t\t\tif nextMeeting.startTime < earliestMeeting.startTime {\n\t\t\t\tearliestIndex = j\n\t\t\t\tearliestMeeting = meetings[j]\n\t\t\t}\n\t\t}\n\t\tif earliestIndex != i {\n\t\t\t// Swap current with earliest index.\n\t\t\tswap(i, earliestIndex, meetings)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "36a2afe4e230f4918d43c38f1e3946ea", "score": "0.46089154", "text": "func (s ChannelAdminLogEventActionChangeTitleArray) Sort(less func(a, b ChannelAdminLogEventActionChangeTitle) bool) ChannelAdminLogEventActionChangeTitleArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "ecf6b0ecd21180d475220de5807026bc", "score": "0.4493241", "text": "func (s PeerChannelArray) Sort(less func(a, b PeerChannel) bool) PeerChannelArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "bf311c9a602e49e42ee1dce125289e1c", "score": "0.44846565", "text": "func (s ChannelAdminLogEventActionParticipantJoinByInviteArray) First() (v ChannelAdminLogEventActionParticipantJoinByInvite, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[0], true\n}", "title": "" }, { "docid": "53790771eb50ef9cac4c7e9c15490e80", "score": "0.44771436", "text": "func (s ChannelAdminLogEventActionChangeLocationArray) Sort(less func(a, b ChannelAdminLogEventActionChangeLocation) bool) ChannelAdminLogEventActionChangeLocationArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "13b7f43c2ee5072ab969dd7772a32fe4", "score": "0.44747454", "text": "func (s ChannelAdminLogEventActionChangePhotoArray) Sort(less func(a, b ChannelAdminLogEventActionChangePhoto) bool) ChannelAdminLogEventActionChangePhotoArray {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "dc71d5ef5f019d8c938c672308046ca6", "score": "0.44690508", "text": "func (*ChannelAdminLogEventActionParticipantInvite) TypeName() string {\n\treturn \"channelAdminLogEventActionParticipantInvite\"\n}", "title": "" }, { "docid": "d6dac17fc5f69542e8cc553057e0cecd", "score": "0.44455415", "text": "func (s PeerChannelArray) SortStable(less func(a, b PeerChannel) bool) PeerChannelArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" }, { "docid": "994017e5163f380c6fbb2135782e70d3", "score": "0.44325686", "text": "func sortTriggers(t []*internal.Trigger) {\n\tsort.Slice(t, func(i, j int) bool { return isTriggerOlder(t[i], t[j]) })\n}", "title": "" }, { "docid": "3f7716ed95338f591460be8a60c51b03", "score": "0.44262823", "text": "func main() { \n var wg sync.WaitGroup\n slice := generateSlice()\n howl := len(slice)\n var segm int\n if (howl % 4 == 0) {\n segm = (howl/4)\n } else {\n segm = (howl/3)\n }\n ch := make(chan int, howl)\n for i := 0; i < howl; i = i + segm {\n count := 0\n if ((howl - i) < 4) {\n segm = (howl-i)\n }\n var sli []int = slice[i:(i+segm)]\n switch count {\n case 1:\n go sortIt1(sli, ch)\n case 2:\n go sortIt2(sli, ch)\n case 3:\n go sortIt3(sli, ch)\n default: {\n go sortItfin(sli, ch, &wg)\n wg.Add(1)\n }\n }\n wg.Wait()\n count++\n } \n appendIt(howl, ch)\n}", "title": "" }, { "docid": "f01480e91052255018cb919e05368805", "score": "0.43741336", "text": "func (a ByRecipientsAmount) Swap(i, j int) {\n\ta[i], a[j] = a[j], a[i]\n}", "title": "" }, { "docid": "60c21a52b1a26e6613365497cf4aaff7", "score": "0.43629098", "text": "func (c *ChannelAdminLogEventActionParticipantJoinByInvite) GetInvite() (value ChatInviteExported) {\n\treturn c.Invite\n}", "title": "" }, { "docid": "4ea92b731971bd60128c4429b327196a", "score": "0.43582007", "text": "func SortRecent(messages []*events.LogMessage) []*events.LogMessage {\n\tsort.Stable(logMessageSlice(messages))\n\treturn messages\n}", "title": "" }, { "docid": "209454b65463cf530628d9c1964cc8f8", "score": "0.4350548", "text": "func (s InputGroupCallStreamArray) SortStable(less func(a, b InputGroupCallStream) bool) InputGroupCallStreamArray {\n\tsort.SliceStable(s, func(i, j int) bool {\n\t\treturn less(s[i], s[j])\n\t})\n\treturn s\n}", "title": "" } ]
8cd80a84f32fcf54d4278d6987396496
/ Solution 2 Using BFS. Use a temp node to swap the left and right nodes. Continue until we have nodes.
[ { "docid": "f27cd048fe4196916b7779402657e380", "score": "0.6167839", "text": "func InvertTreeBFS(root *TreeNode) *TreeNode {\n\tif root == nil {\n\t\treturn root\n\t}\n\tqueue := []*TreeNode{root}\n\tfor len(queue) > 0 {\n\t\tcurr, rest := queue[0], queue[1:]\n\t\ttemp := curr.Left\n\t\tcurr.Left = curr.Right\n\t\tcurr.Right = temp\n\t\tqueue = rest\n\t\tif curr.Left != nil {\n\t\t\tqueue = append(queue, curr.Left)\n\t\t}\n\t\tif curr.Right != nil {\n\t\t\tqueue = append(queue, curr.Right)\n\t\t}\n\t}\n\treturn root\n}", "title": "" } ]
[ { "docid": "7e284e741ad4bbcf2b0aa29fcd8c2966", "score": "0.6763854", "text": "func swapNodes(tree huffmanTree, path uint32, len uint32) {\n\tfor len > 0 {\n\t\t// get current bit\n\t\tlen--\n\t\tone := path & 1\n\t\tpath = path >> 1\n\n\t\t// check if we are correct\n\t\tif tree.IsLeaf() {\n\t\t\t_panicf(\"Touching leaf in node swap, %d left in path\", len)\n\t\t}\n\n\t\t// switch on the type\n\t\tif one == 1 {\n\t\t\ttree = tree.Right()\n\t\t} else {\n\t\t\ttree = tree.Left()\n\t\t}\n\t}\n\n\tnode := tree.(*huffmanNode)\n\tnode.left, node.right = node.right, node.left\n}", "title": "" }, { "docid": "5703b319728c40bc5424886600098cc2", "score": "0.643188", "text": "func bfs(root *Node) []*Node {\n\troot.depth = 0\n\tgray := enqueue([]*Node{}, root)\n\tblack := []*Node{}\n\tvar node *Node\n\tfor len(gray) > 0 {\n\t\t// fmt.Println(\"gray before dequeue:\", gray)\n\t\tgray, node = dequeue(gray)\n\t\t// fmt.Println(\"gray after dequeue:\", gray)\n\t\tfor i := 0; i < len(node.neighbor); i++ {\n\t\t\t// the node was already discovered\n\t\t\tif node.neighbor[i].depth != -1 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tnode.neighbor[i].parent = node\n\t\t\tnode.neighbor[i].depth = node.depth + 1\n\t\t\tgray = enqueue(gray, node.neighbor[i])\n\t\t\t// fmt.Println(\"gray:\", gray)\n\t\t}\n\t\tblack = enqueue(black, node)\n\t\t// fmt.Println(\"black\", black)\n\t}\n\treturn black\n}", "title": "" }, { "docid": "d65c8fa525d9953c208d4c97b5d2aa21", "score": "0.64160514", "text": "func SwapNodes(i, j int) {\n\tsetup()\n\n\t// find the element(p-1)\n\tp0 := list.FindByIndex(i-1)\n\tp1 := p0.nextNode\n\n\tn0 := list.FindByIndex(j-1)\n\tn1 := n0.nextNode\n\n\t// From ....p0->p1.....n0->n1...\n\t// To ....p0->n1->.....n0->p1->...\n\n\tp0.nextNode = n1\n\tn0.nextNode = p1\n\n\toldP1next := p1.nextNode\n\toldN1next := n1.nextNode\n\n\tn1.nextNode = oldP1next\n\tp1.nextNode = oldN1next\n\n\tlist.IterateList()\n}", "title": "" }, { "docid": "35b4764827d0d8082ffe51a3975b4d93", "score": "0.6276505", "text": "func Swap(n1, n2 *TreeNode) {\n\ttmp := n1.Left\n\tn1.Left = n2.Left\n\tn2.Left = tmp\n\n\ttmp = n1.Right\n\tn1.Right = n2.Right\n\tn2.Right = tmp\n}", "title": "" }, { "docid": "e2c12ebf2f9de23e9a7bbc9460fe6584", "score": "0.6270844", "text": "func (h *binaryMinimumHeap) shiftDown() {\n\tfor index := 1; index*2 <= h.size; { // loop when 'index' is not leaf node\n\t\tleft := h.array[index]\n\t\tright := h.array[index]\n\n\t\tif left > h.array[index*2] {\n\t\t\tleft = h.array[index*2]\n\t\t}\n\t\tif index*2+1 <= h.size && right > h.array[index*2+1] {\n\t\t\tright = h.array[index*2+1]\n\t\t}\n\n\t\tif left == h.array[index] && right == h.array[index] { // 'index' <= left child and right child(or not exist)\n\t\t\tbreak\n\t\t}\n\n\t\t// swap 'index' with its smaller child\n\t\tif left <= right {\n\t\t\th.array[index], h.array[index*2] = h.array[index*2], h.array[index]\n\t\t\tindex *= 2\n\t\t} else {\n\t\t\th.array[index], h.array[index*2+1] = h.array[index*2+1], h.array[index]\n\t\t\tindex = index*2 + 1\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2bfaf9adccacdd97da01582cf1e5f9b1", "score": "0.6260441", "text": "func BuildTreeByBFS(nodes []*int) *TreeNode {\n\tlength := len(nodes)\n\tif length == 0 {\n\t\treturn nil\n\t}\n\tidx := 0\n\troot := TreeNode{*nodes[idx], nil, nil}\n\tidx++\n\tcurr := &root\n\tqueue := list.New()\n\tqueue.PushBack(curr)\n\tfor queue.Len() > 0 && idx < len(nodes) {\n\t\te := queue.Front()\n\t\tnode := e.Value.(*TreeNode)\n\t\tif node != nil {\n\t\t\tvar val = nodes[idx]\n\t\t\tif val != nil {\n\t\t\t\tnode.Left = &TreeNode{*val, nil, nil}\n\t\t\t}\n\t\t\tqueue.PushBack(node.Left)\n\t\t\tidx++\n\t\t\tval = nodes[idx]\n\t\t\tif val != nil {\n\t\t\t\tnode.Right = &TreeNode{*val, nil, nil}\n\t\t\t}\n\t\t\tqueue.PushBack(node.Right)\n\t\t}\n\t\tqueue.Remove(e)\n\t\tidx++\n\t}\n\treturn &root\n}", "title": "" }, { "docid": "e76f94a6a9e5e42c7716661a0261b08e", "score": "0.62255496", "text": "func (tr *Tree) swapOneTime(nodes map[int]*Node, ls []int) bool {\n\tbestCost := tr.Cost()\n\tfor _, i := range ls {\n\t\t// removes the node\n\t\tn := nodes[i]\n\t\tif n.Anc == tr.Root {\n\t\t\tcontinue\n\t\t}\n\n\t\ta := n.Anc\n\t\tsis := a.Left\n\t\tif sis == n {\n\t\t\tsis = a.Right\n\t\t}\n\t\ta.Left = n\n\t\ta.Right = nil\n\n\t\tgf := a.Anc\n\t\tunc := gf.Left\n\t\tif unc == a {\n\t\t\tunc = gf.Right\n\t\t}\n\t\tgf.Left = unc\n\t\tgf.Right = sis\n\t\ta.Anc = nil\n\t\tsis.Anc = gf\n\n\t\tincreDown(gf)\n\t\tfor x := gf; x != nil; x = x.Anc {\n\t\t\tcopy(x.charsCopy, x.Chars)\n\t\t\tx.costCopy = x.Cost\n\t\t}\n\n\t\t// test positions of the node\n\t\tfor _, j := range ls {\n\t\t\tp := nodes[j]\n\t\t\tif p.IsDesc(a) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif p == sis {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif p.Anc == tr.Root {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tpa := p.Anc\n\t\t\tpsis := pa.Left\n\t\t\tif psis == p {\n\t\t\t\tpsis = pa.Right\n\t\t\t}\n\t\t\tpa.Left = psis\n\t\t\tpa.Right = a\n\t\t\tp.Anc = a\n\t\t\ta.Right = p\n\t\t\ta.Anc = pa\n\n\t\t\tcost, stop := increBound(a, bestCost)\n\t\t\tif cost < bestCost {\n\t\t\t\t// The new position is the best\n\t\t\t\t// so update backups and return\n\t\t\t\tfor x := a; x != nil; x = x.Anc {\n\t\t\t\t\tcopy(x.charsCopy, x.Chars)\n\t\t\t\t\tx.costCopy = x.Cost\n\t\t\t\t}\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\t// restore positions\n\t\t\tp.Anc = pa\n\t\t\tpa.Right = p\n\t\t\ta.Anc = nil\n\t\t\ta.Right = nil\n\n\t\t\t// Restore assignations\n\t\t\tfor x := p; x != nil; x = x.Anc {\n\t\t\t\tcopy(x.Chars, x.charsCopy)\n\t\t\t\tx.Cost = x.costCopy\n\t\t\t\tif x == stop {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// restore the node\n\t\tsis.Anc = a\n\t\ta.Right = sis\n\t\ta.Anc = gf\n\t\tgf.Left = unc\n\t\tgf.Right = a\n\t\tcopy(a.Chars, a.charsCopy)\n\t\ta.Cost = a.costCopy\n\t\tincreDown(gf)\n\t\tfor x := gf; x != nil; x = x.Anc {\n\t\t\tcopy(x.charsCopy, x.Chars)\n\t\t\tx.costCopy = x.Cost\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "3446a56311367a101501fb0aa53c9f10", "score": "0.61918795", "text": "func adjustTree(newNode *linkedNode) {\n\tcurrent := newNode\n\n\tfor current != nil {\n\t\tcurrent.weight++\n\n\t\tvar insertpoint *linkedNode\n\n\t\tvar prev *linkedNode\n\n\t\t// Go backwards thru the list looking for the insertion point\n\t\tinsertpoint = current\n\n\t\tfor {\n\t\t\tprev = insertpoint.prev\n\t\t\tif prev == nil {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif prev.weight >= current.weight {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tinsertpoint = prev\n\t\t}\n\n\t\t// No insertion point found\n\t\tif insertpoint == current {\n\t\t\tcurrent = current.parent\n\t\t\tcontinue\n\t\t}\n\n\t\t// The following code basically swaps insertpoint with current\n\n\t\t// remove insert point\n\t\tif insertpoint.prev != nil {\n\t\t\tinsertpoint.prev.next = insertpoint.next\n\t\t}\n\n\t\tinsertpoint.next.prev = insertpoint.prev\n\n\t\t// insert insertpoint after current\n\t\tinsertpoint.next = current.next\n\t\tinsertpoint.prev = current\n\n\t\tif current.next != nil {\n\t\t\tcurrent.next.prev = insertpoint\n\t\t}\n\n\t\tcurrent.next = insertpoint\n\n\t\t// remove current\n\t\tcurrent.prev.next = current.next\n\t\tcurrent.next.prev = current.prev\n\n\t\t// insert current after prev\n\t\tif prev == nil {\n\t\t\tlog.Fatal(\"previous frame not defined!\")\n\t\t}\n\n\t\ttemp := prev.next\n\t\tcurrent.next = temp\n\t\tcurrent.prev = prev\n\t\ttemp.prev = current\n\t\tprev.next = current\n\n\t\t// Set up parent/child links\n\t\tcurrentparent := current.parent\n\t\tinsertparent := insertpoint.parent\n\n\t\tif currentparent.child0 == current {\n\t\t\tcurrentparent.child0 = insertpoint\n\t\t}\n\n\t\tif currentparent != insertparent && insertparent.child0 == insertpoint {\n\t\t\tinsertparent.child0 = current\n\t\t}\n\n\t\tcurrent.parent = insertparent\n\t\tinsertpoint.parent = currentparent\n\n\t\tcurrent = current.parent\n\t}\n}", "title": "" }, { "docid": "4887a08623d5d1d978678cc282d90ea1", "score": "0.6180458", "text": "func swapNodes(indexes [][]int32, queries []int32) [][]int32 {\n\n\tvar ret [][]int32\n\n\tif len(queries) == 0 {\n\t\treturn append(ret, getBinaryTreeState(indexes))\n\t}\n\n\tindexes_ := indexes\n\tfor _, v := range queries {\n\t\tindexes_ = swapIndexes(indexes_, v)\n\t\tret = append(ret, getBinaryTreeState(indexes_))\n\t}\n\n\treturn ret\n}", "title": "" }, { "docid": "31b54bb7c67dd71495e17e324e7f2666", "score": "0.61370397", "text": "func BFS(t *tree.BTree) []int {\n\tqueue := []*tree.BTree{}\n\tresult := []int{}\n\n\tqueue = append(queue, t)\n\n\tfor len(queue) != 0 {\n\t\tcurrent := queue[0]\n\t\t// Assign value to result\n\t\tresult = append(result, current.Value)\n\n\t\t// Dequeue zeroth value\n\t\tqueue = queue[1:]\n\n\t\t// Add left and right to queue\n\t\tif current.LTree != nil {\n\t\t\tqueue = append(queue, current.LTree)\n\t\t}\n\n\t\tif current.RTree != nil {\n\t\t\tqueue = append(queue, current.RTree)\n\t\t}\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "c66ddc284e406c7b9db7adad555eccb4", "score": "0.61358297", "text": "func visitNodes(tree *BinarySearchTree, visit visitor) {\n\t//visit the nodes in BFS order\n\tqueue := list.New()\n\tqueue.PushBack(tree.root)\n\n\tfor queue.Len() > 0 {\n\t\t//pop from front of queue\n\t\tn := queue.Remove(queue.Front()).(*node)\n\t\t//fmt.Printf(\"At node %v\\n\", n)\n\t\tvisit(n)\n\t\tif n.left != nil {\n\t\t\tqueue.PushBack(n.left)\n\t\t}\n\t\tif n.right != nil {\n\t\t\tqueue.PushBack(n.right)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c258773a9b9c0671ce37fe1bab67906c", "score": "0.6111128", "text": "func Bfs(root *Node, visit func(*Node), visited func(*Node) bool, f func(*Node)) {\n\ttodo := list.New()\n\ttodo.PushBack(root)\n\n\tfor todo.Len() > 0 {\n\t\tel := todo.Front()\n\t\tnode := el.Value.(*Node)\n\t\ttodo.Remove(el)\n\n\t\tif visited(node) {\n\t\t\tcontinue\n\t\t}\n\n\t\tvisit(node)\n\t\tf(node)\n\n\t\tfor _, ngh := range node.Neighbours {\n\t\t\ttodo.PushBack(ngh)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "621fcd8b3aa58c6488d743fd04f981b7", "score": "0.6088399", "text": "func (n *node) rebalanceOrMerge(i int) {\n\tswitch {\n\tcase i > 0 && n.children[i-1].count > minItems:\n\t\t// Rebalance from left sibling.\n\t\t//\n\t\t// +-----------+\n\t\t// | y |\n\t\t// +----/-\\----+\n\t\t// / \\\n\t\t// v v\n\t\t// +-----------+ +-----------+\n\t\t// | x | | |\n\t\t// +----------\\+ +-----------+\n\t\t// \\\n\t\t// v\n\t\t// a\n\t\t//\n\t\t// After:\n\t\t//\n\t\t// +-----------+\n\t\t// | x |\n\t\t// +----/-\\----+\n\t\t// / \\\n\t\t// v v\n\t\t// +-----------+ +-----------+\n\t\t// | | | y |\n\t\t// +-----------+ +/----------+\n\t\t// /\n\t\t// v\n\t\t// a\n\t\t//\n\t\tleft := mut(&n.children[i-1])\n\t\tchild := mut(&n.children[i])\n\t\txLa, grandChild := left.popBack()\n\t\tyLa := n.items[i-1]\n\t\tchild.pushFront(yLa, grandChild)\n\t\tn.items[i-1] = xLa\n\t\tchild.subtreeCount++\n\t\tleft.subtreeCount--\n\t\tif grandChild != nil {\n\t\t\tchild.subtreeCount += grandChild.subtreeCount\n\t\t\tleft.subtreeCount -= grandChild.subtreeCount\n\t\t}\n\n\tcase i < int(n.count) && n.children[i+1].count > minItems:\n\t\t// Rebalance from right sibling.\n\t\t//\n\t\t// +-----------+\n\t\t// | y |\n\t\t// +----/-\\----+\n\t\t// / \\\n\t\t// v v\n\t\t// +-----------+ +-----------+\n\t\t// | | | x |\n\t\t// +-----------+ +/----------+\n\t\t// /\n\t\t// v\n\t\t// a\n\t\t//\n\t\t// After:\n\t\t//\n\t\t// +-----------+\n\t\t// | x |\n\t\t// +----/-\\----+\n\t\t// / \\\n\t\t// v v\n\t\t// +-----------+ +-----------+\n\t\t// | y | | |\n\t\t// +----------\\+ +-----------+\n\t\t// \\\n\t\t// v\n\t\t// a\n\t\t//\n\t\tright := mut(&n.children[i+1])\n\t\tchild := mut(&n.children[i])\n\t\txLa, grandChild := right.popFront()\n\t\tyLa := n.items[i]\n\t\tchild.pushBack(yLa, grandChild)\n\t\tchild.subtreeCount++\n\t\tright.subtreeCount--\n\t\tif grandChild != nil {\n\t\t\tchild.subtreeCount += grandChild.subtreeCount\n\t\t\tright.subtreeCount -= grandChild.subtreeCount\n\t\t}\n\t\tn.items[i] = xLa\n\n\tdefault:\n\t\t// Merge with either the left or right sibling.\n\t\t//\n\t\t// +-----------+\n\t\t// | u y v |\n\t\t// +----/-\\----+\n\t\t// / \\\n\t\t// v v\n\t\t// +-----------+ +-----------+\n\t\t// | x | | z |\n\t\t// +-----------+ +-----------+\n\t\t//\n\t\t// After:\n\t\t//\n\t\t// +-----------+\n\t\t// | u v |\n\t\t// +-----|-----+\n\t\t// |\n\t\t// v\n\t\t// +-----------+\n\t\t// | x y z |\n\t\t// +-----------+\n\t\t//\n\t\tif i >= int(n.count) {\n\t\t\ti = int(n.count - 1)\n\t\t}\n\t\tchild := mut(&n.children[i])\n\t\t// Make mergeChild mutable, bumping the refcounts on its children if necessary.\n\t\t_ = mut(&n.children[i+1])\n\t\tmergeLa, mergeChild := n.removeAt(i)\n\t\tchild.items[child.count] = mergeLa\n\t\tcopy(child.items[child.count+1:], mergeChild.items[:mergeChild.count])\n\t\tif !child.leaf {\n\t\t\tcopy(child.children[child.count+1:], mergeChild.children[:mergeChild.count+1])\n\t\t}\n\t\tchild.count += mergeChild.count + 1\n\t\tchild.subtreeCount += mergeChild.subtreeCount + 1\n\n\t\tmergeChild.decRef(false /* contentsToo */, nil)\n\t}\n}", "title": "" }, { "docid": "215c53e65f561f45a57f0b3988ed44e5", "score": "0.6072315", "text": "func (n *node) rebalanceOrMerge(i int) {\n\tswitch {\n\tcase i > 0 && n.children[i-1].count > minItems:\n\t\t// Rebalance from left sibling.\n\t\t//\n\t\t// +-----------+\n\t\t// | y |\n\t\t// +----/-\\----+\n\t\t// / \\\n\t\t// v v\n\t\t// +-----------+ +-----------+\n\t\t// | x | | |\n\t\t// +----------\\+ +-----------+\n\t\t// \\\n\t\t// v\n\t\t// a\n\t\t//\n\t\t// After:\n\t\t//\n\t\t// +-----------+\n\t\t// | x |\n\t\t// +----/-\\----+\n\t\t// / \\\n\t\t// v v\n\t\t// +-----------+ +-----------+\n\t\t// | | | y |\n\t\t// +-----------+ +/----------+\n\t\t// /\n\t\t// v\n\t\t// a\n\t\t//\n\t\tleft := mut(&n.children[i-1])\n\t\tchild := mut(&n.children[i])\n\t\txLa, grandChild := left.popBack()\n\t\tyLa := n.items[i-1]\n\t\tchild.pushFront(yLa, grandChild)\n\t\tn.items[i-1] = xLa\n\n\t\tleft.adjustUpperBoundOnRemoval(xLa, grandChild)\n\t\tchild.adjustUpperBoundOnInsertion(yLa, grandChild)\n\n\tcase i < int(n.count) && n.children[i+1].count > minItems:\n\t\t// Rebalance from right sibling.\n\t\t//\n\t\t// +-----------+\n\t\t// | y |\n\t\t// +----/-\\----+\n\t\t// / \\\n\t\t// v v\n\t\t// +-----------+ +-----------+\n\t\t// | | | x |\n\t\t// +-----------+ +/----------+\n\t\t// /\n\t\t// v\n\t\t// a\n\t\t//\n\t\t// After:\n\t\t//\n\t\t// +-----------+\n\t\t// | x |\n\t\t// +----/-\\----+\n\t\t// / \\\n\t\t// v v\n\t\t// +-----------+ +-----------+\n\t\t// | y | | |\n\t\t// +----------\\+ +-----------+\n\t\t// \\\n\t\t// v\n\t\t// a\n\t\t//\n\t\tright := mut(&n.children[i+1])\n\t\tchild := mut(&n.children[i])\n\t\txLa, grandChild := right.popFront()\n\t\tyLa := n.items[i]\n\t\tchild.pushBack(yLa, grandChild)\n\t\tn.items[i] = xLa\n\n\t\tright.adjustUpperBoundOnRemoval(xLa, grandChild)\n\t\tchild.adjustUpperBoundOnInsertion(yLa, grandChild)\n\n\tdefault:\n\t\t// Merge with either the left or right sibling.\n\t\t//\n\t\t// +-----------+\n\t\t// | u y v |\n\t\t// +----/-\\----+\n\t\t// / \\\n\t\t// v v\n\t\t// +-----------+ +-----------+\n\t\t// | x | | z |\n\t\t// +-----------+ +-----------+\n\t\t//\n\t\t// After:\n\t\t//\n\t\t// +-----------+\n\t\t// | u v |\n\t\t// +-----|-----+\n\t\t// |\n\t\t// v\n\t\t// +-----------+\n\t\t// | x y z |\n\t\t// +-----------+\n\t\t//\n\t\tif i >= int(n.count) {\n\t\t\ti = int(n.count - 1)\n\t\t}\n\t\tchild := mut(&n.children[i])\n\t\t// Make mergeChild mutable, bumping the refcounts on its children if necessary.\n\t\t_ = mut(&n.children[i+1])\n\t\tmergeLa, mergeChild := n.removeAt(i)\n\t\tchild.items[child.count] = mergeLa\n\t\tcopy(child.items[child.count+1:], mergeChild.items[:mergeChild.count])\n\t\tif !child.leaf {\n\t\t\tcopy(child.children[child.count+1:], mergeChild.children[:mergeChild.count+1])\n\t\t}\n\t\tchild.count += mergeChild.count + 1\n\n\t\tchild.adjustUpperBoundOnInsertion(mergeLa, mergeChild)\n\t\tmergeChild.decRef(false /* recursive */)\n\t}\n}", "title": "" }, { "docid": "7b85e8166c169789faca5a8e31aa0150", "score": "0.6012376", "text": "func bfs_shortestAlternatingPaths(n int,red_graph [][]bool,blue_graph [][]bool,is_red bool,res []int){\n\tsteps := 1\n\tvar q list.List\n\tq.PushBack(0)\n\tvar visited [][][2]bool = make([][][2]bool,n)//prevent circle\n\tfor i := 0;i < n;i++{\n\t\tvisited[i] = make([][2]bool,n)\n\t}\n\tfor q.Len() > 0{\n\t\tvar l int = q.Len()\n\t\tfor i := 0;i < l;i++{\n\t\t\tcur := q.Front().Value.(int)\n\t\t\tq.Remove(q.Front())\n\t\t\tif is_red{\n\t\t\t\tfor j := 0;j < len(red_graph[cur]);j++{\n\t\t\t\t\tif red_graph[cur][j] && !visited[cur][j][0] {\n\t\t\t\t\t\tif res[j] == -1{\n\t\t\t\t\t\t\tres[j] = steps\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tres[j] = min_int(res[j],steps)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tq.PushBack(j)\n\t\t\t\t\t\tvisited[cur][j][0] = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tfor j := 0;j < len(blue_graph[cur]);j++{\n\t\t\t\t\tif blue_graph[cur][j] && !visited[cur][j][1] {\n\t\t\t\t\t\tif res[j] == -1{\n\t\t\t\t\t\t\tres[j] = steps\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tres[j] = min_int(res[j],steps)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tq.PushBack(j)\n\t\t\t\t\t\tvisited[cur][j][1] = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tis_red = !is_red\n\t\tsteps++\n\t}\n}", "title": "" }, { "docid": "1ce09e271415610294624023388dfcf7", "score": "0.5990774", "text": "func (n *Node) Swap(i, j int) {\n\tn.edges[i], n.edges[j] = n.edges[j], n.edges[i]\n}", "title": "" }, { "docid": "80bcf2a3305dcc1a0fa29c43c400398c", "score": "0.59663236", "text": "func BFS(adjList *[]list.List, s int) {\n\tQ := list.New()\n\tsize := numberOfVertices(adjList)\n\tvisited := make([]bool, size)\n\n\tvisited[s] = true\n\tQ.PushBack(s)\n\n\tfor Q.Len() != 0 {\n\t\ts = Q.Front().Value.(int)\n\t\ttmp := Q.Front()\n\t\tQ.Remove(tmp)\n\t\tfmt.Println(s)\n\t\tfor v := (*adjList)[s].Front(); v != nil; v = v.Next() {\n\t\t\tif !visited[v.Value.(int)] {\n\t\t\t\tvisited[v.Value.(int)] = true\n\t\t\t\tQ.PushBack(v.Value.(int))\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "da3919423bd3ce39f71319c9fb176d91", "score": "0.595767", "text": "func branch(node *DualTreeNode, nodes *[]*DualTreeNode) {\n\tif node.left != nil {\n\t\tbranch(node.left, nodes)\n\t\t*nodes = append(*nodes, node)\n\t\tbranch(node.right, nodes)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "e3c504fc1eb453b6759fec7023bc9418", "score": "0.5930945", "text": "func (q BackupQueue) Swap(i, j int) {\n\tq.nodes[i], q.nodes[j] = q.nodes[j], q.nodes[i]\n\tq.depths[i], q.depths[j] = q.depths[j], q.depths[i]\n\n}", "title": "" }, { "docid": "67978ca40a8791479ac072469f5a1f7a", "score": "0.5892553", "text": "func avlTreeSwapWithSuccessor(root **AvlNode, X *AvlNode, leftDeletedRet *bool) *AvlNode {\n\n\tvar Y, ret, Q *AvlNode\n\n\tY = X.right\n\tif Y.left == nil {\n\t\t//\n\t\t// P? P? P?\n\t\t// | | |\n\t\t// X Y Y\n\t\t// / \\ / \\ / \\\n\t\t// A Y => A X => A B?\n\t\t// / \\ / \\\n\t\t// (0) B? (0) B?\n\t\t//\n\t\t// [ X unlinked, Y returned ]\n\t\t//\n\n\t\tret = Y\n\t\t*leftDeletedRet = false\n\t} else {\n\n\t\tfor {\n\t\t\tQ = Y\n\t\t\tY = Y.left\n\t\t\tif Y.left == nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\t//\n\t\t// P? P? P?\n\t\t// | | |\n\t\t// X Y Y\n\t\t// / \\ / \\ / \\\n\t\t// A ... => A ... => A ...\n\t\t// | | |\n\t\t// Q Q Q\n\t\t// / / /\n\t\t// Y X B?\n\t\t// / \\ / \\\n\t\t// (0) B? (0) B?\n\t\t//\n\t\t//\n\t\t// [ X unlinked, Q returned ]\n\t\t//\n\n\t\tQ.left = Y.right\n\t\tif Q.left != nil {\n\t\t\tavlSetParent(Q.left, Q)\n\t\t}\n\t\tY.right = X.right\n\t\tavlSetParent(X.right, Y)\n\t\tret = Q\n\t\t*leftDeletedRet = true\n\t}\n\n\tY.left = X.left\n\tavlSetParent(X.left, Y)\n\n\tY.parent = X.parent\n\tY.balance = X.balance\n\tavlReplaceChild(root, avlGetParent(X), X, Y)\n\n\treturn ret\n}", "title": "" }, { "docid": "6fa2de80f70618abebacfaf8da33461a", "score": "0.58444047", "text": "func UpdateMatrixBFS(matrix [][]int) [][]int {\n\tif matrix == nil {\n\t\treturn [][]int{{}}\n\t}\n\tm := len(matrix)\n\tif m < 1 {\n\t\treturn [][]int{{}}\n\t}\n\tn := len(matrix[0])\n\tif n < 1 {\n\t\treturn [][]int{{}}\n\t}\n\n\tvar queue [][2]int\n\tdir := [][]int{{-1, 0}, {1, 0}, {0, -1}, {0, 1}}\n\n\tfor i := 0; i < m; i++ {\n\t\tfor j := 0; j < n; j++ {\n\t\t\tif matrix[i][j] == 1 {\n\t\t\t\tmatrix[i][j] = -1\n\t\t\t} else {\n\t\t\t\tqueue = append(queue, [2]int{i, j})\n\t\t\t}\n\t\t}\n\t}\n\n\tfor len(queue) > 0 {\n\t\tvar nextQueue [][2]int\n\t\tfor _, q := range queue {\n\t\t\tfor _, d := range dir {\n\t\t\t\tx := q[0] + d[0]\n\t\t\t\ty := q[1] + d[1]\n\n\t\t\t\tif x < 0 || y < 0 || x >= m || y >= n {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif matrix[x][y] == -1 {\n\t\t\t\t\tmatrix[x][y] = matrix[q[0]][q[1]] + 1\n\t\t\t\t\tnextQueue = append(nextQueue, [2]int{x, y})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tqueue = nextQueue\n\t}\n\n\treturn matrix\n}", "title": "" }, { "docid": "8f3c2403530b24ae947c1882d068003b", "score": "0.58232665", "text": "func BFS(connected map[string][]Eki, start string, end string) []Eki{\n \n q := make([][]Eki,0)\n q = append(q, []Eki{makeEki(start)})\n route := make([]Eki,0)\n \n for len(q) != 0 {\n \n route = q[0]\n here := route[len(route)-1].EkiName \n\n if here == end {\n return route\n }\n \n //a := len(q)\n \n \n newq := make([][]Eki,0)\n newroute := make([]Eki,len(route)+1)\n for _, temp := range connected[here]{\n go func(newEki Eki){\n if EkiInRoute(newEki.EkiName, route) == false{\n newroute = append(route, newEki)\n newq = append(newq, newroute)\n } \n }(temp)\n }\n q = append(q, newq...)\n \n q = q[1:] \n \n \n }\n return nil\n \n}", "title": "" }, { "docid": "f9d9e27c094b599c88b929b444ab880c", "score": "0.5787224", "text": "func (g Graph) BFS(startNode *Node) *Node {\n\t// if I'm already a mango seller, I don't need another!\n\tif startNode.MangoSeller {\n\t\treturn startNode\n\t}\n\n\t// initialize queue\n\tvar queue []*Node\n\tfor _, n := range g.Edges[startNode] {\n\t\tqueue = append(queue, n)\n\t}\n\n\tvar searched []*Node\n\n\t// search all my friends\n\tfor len(queue) != 0 {\n\n\t\t// pops node from queue\n\t\tvar n *Node\n\t\tn, queue = queue[len(queue)-1], queue[:len(queue)-1]\n\n\t\t// verify if node was already searched\n\t\tvar alreadySearched bool\n\t\tfor _, s := range searched {\n\t\t\tif s == n {\n\t\t\t\talreadySearched = true\n\t\t\t}\n\t\t}\n\n\t\t// if it wasn't searched\n\t\tif !alreadySearched {\n\n\t\t\t// if is the mango seller, return it\n\t\t\tif n.MangoSeller {\n\t\t\t\treturn n\n\t\t\t} else {\n\t\t\t\t// otherwise, push all Node's friends to the list\n\t\t\t\tfor _, near := range g.Edges[n] {\n\t\t\t\t\tqueue = append([]*Node{near}, queue...)\n\t\t\t\t}\n\n\t\t\t\t// mark node as searched\n\t\t\t\tsearched = append(searched, n)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3c00b3cac9f0233ef906e2a13791988b", "score": "0.57836765", "text": "func BFS[T comparable](root *Node[T], quit <-chan struct{}) <-chan *Node[T] {\n\tnChan := make(chan *(Node[T]))\n\n\tgo func() {\n\t\tdefer close(nChan)\n\t\tqueue := [](*Node[T]){root}\n\t\tvar curr *Node[T]\n\n\t\tfor len(queue) > 0 {\n\t\t\tcurr, queue = queue[0], queue[1:]\n\n\t\t\tselect {\n\t\t\tcase <-quit:\n\t\t\t\treturn\n\t\t\tcase nChan <- curr:\n\t\t\t}\n\n\t\t\tnext := curr.firstChild\n\t\t\tfor next != nil {\n\t\t\t\tqueue = append(queue, next)\n\t\t\t\tnext = next.nextSibling\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn nChan\n}", "title": "" }, { "docid": "53acbb747223e297dba167988388da45", "score": "0.5776743", "text": "func (tree *Tree) rebalance(node *Node, deletedKey interface{}) {\n\t// check if rebalancing is needed\n\tif node == nil || len(node.Entries) >= tree.minEntries() {\n\t\treturn\n\t}\n\n\t// try to borrow from left sibling\n\tleftSibling, leftSiblingIndex := tree.leftSibling(node, deletedKey)\n\tif leftSibling != nil && len(leftSibling.Entries) > tree.minEntries() {\n\t\t// rotate right\n\t\tnode.Entries = append([]*Entry{node.Parent.Entries[leftSiblingIndex]}, node.Entries...) // prepend parent's separator entry to node's entries\n\t\tnode.Parent.Entries[leftSiblingIndex] = leftSibling.Entries[len(leftSibling.Entries)-1]\n\t\ttree.deleteEntry(leftSibling, len(leftSibling.Entries)-1)\n\t\tif !tree.isLeaf(leftSibling) {\n\t\t\tleftSiblingRightMostChild := leftSibling.Children[len(leftSibling.Children)-1]\n\t\t\tleftSiblingRightMostChild.Parent = node\n\t\t\tnode.Children = append([]*Node{leftSiblingRightMostChild}, node.Children...)\n\t\t\ttree.deleteChild(leftSibling, len(leftSibling.Children)-1)\n\t\t}\n\t\treturn\n\t}\n\n\t// try to borrow from right sibling\n\trightSibling, rightSiblingIndex := tree.rightSibling(node, deletedKey)\n\tif rightSibling != nil && len(rightSibling.Entries) > tree.minEntries() {\n\t\t// rotate left\n\t\tnode.Entries = append(node.Entries, node.Parent.Entries[rightSiblingIndex-1]) // append parent's separator entry to node's entries\n\t\tnode.Parent.Entries[rightSiblingIndex-1] = rightSibling.Entries[0]\n\t\ttree.deleteEntry(rightSibling, 0)\n\t\tif !tree.isLeaf(rightSibling) {\n\t\t\trightSiblingLeftMostChild := rightSibling.Children[0]\n\t\t\trightSiblingLeftMostChild.Parent = node\n\t\t\tnode.Children = append(node.Children, rightSiblingLeftMostChild)\n\t\t\ttree.deleteChild(rightSibling, 0)\n\t\t}\n\t\treturn\n\t}\n\n\t// merge with siblings\n\tif rightSibling != nil {\n\t\t// merge with right sibling\n\t\tnode.Entries = append(node.Entries, node.Parent.Entries[rightSiblingIndex-1])\n\t\tnode.Entries = append(node.Entries, rightSibling.Entries...)\n\t\tdeletedKey = node.Parent.Entries[rightSiblingIndex-1].Key\n\t\ttree.deleteEntry(node.Parent, rightSiblingIndex-1)\n\t\ttree.appendChildren(node.Parent.Children[rightSiblingIndex], node)\n\t\ttree.deleteChild(node.Parent, rightSiblingIndex)\n\t} else if leftSibling != nil {\n\t\t// merge with left sibling\n\t\tentries := append([]*Entry(nil), leftSibling.Entries...)\n\t\tentries = append(entries, node.Parent.Entries[leftSiblingIndex])\n\t\tnode.Entries = append(entries, node.Entries...)\n\t\tdeletedKey = node.Parent.Entries[leftSiblingIndex].Key\n\t\ttree.deleteEntry(node.Parent, leftSiblingIndex)\n\t\ttree.prependChildren(node.Parent.Children[leftSiblingIndex], node)\n\t\ttree.deleteChild(node.Parent, leftSiblingIndex)\n\t}\n\n\t// make the merged node the root if its parent was the root and the root is empty\n\tif node.Parent == tree.Root && len(tree.Root.Entries) == 0 {\n\t\ttree.Root = node\n\t\tnode.Parent = nil\n\t\treturn\n\t}\n\n\t// parent might underflow, so try to rebalance if necessary\n\ttree.rebalance(node.Parent, deletedKey)\n}", "title": "" }, { "docid": "66354596005463a85c4b561c442554ad", "score": "0.5736803", "text": "func bfs(g *graph.Graph, root int, sought int) bool {\n var queue vector.IntVector\n queue.Push(root)\n \n for len(queue) != 0 {\n // dequeue\n n := queue.At(0)\n queue.Delete(0)\n fmt.Printf(\"Arrived at node %d\\n\", n)\n if n == sought {\n return true\n } \n if g.Nodes[n] == 0 {\n g.Nodes[n] = 1 // discovered, ignore later\n for i, val := range g.Adj[n] {\n if val != 0 && g.Nodes[i] == 0 { // has an edge to i and it hasn't been visited\n queue.Push(i)\n }\n }\n }\n }\n return false\n}", "title": "" }, { "docid": "5575a375031ee30133451f1a8642e393", "score": "0.5726119", "text": "func BFS(g *Graph, s *Vertex) {\n neighbour := make([]*Vertex, 0)\n s.status = true\n\n for _, v := range g.Vertices[s.name] {\n if v.status == false {\n fmt.Println(\"Adding\")\n neighbour = append(neighbour, v)\n }\n }\n\n for _, v := range neighbour {\n v.distance = s.distance + 1\n v.pi = s\n v.status = true\n BFS(g, v)\n }\n}", "title": "" }, { "docid": "72150c1b1fe922e4f532e0748f5a08e7", "score": "0.57205355", "text": "func reheapTop(pq []*stateT) {\n l := len(pq)\n i := 0\t\t\t// at the root we start\n for {\t\t\t// index 2i+1 is the left, index 2i+2 the right son of i\n\tif 2*i+1 >= l {\t\t// no left son? ==> leaf: we are done.\n\t return\n\t}\n\tif 2*i+2 >= l {\t\t// only a left son\n\t if pq[i].phi >= pq[2*i+1].phi {\t// left son is not greater? done.\n\t return\n\t }\n\t j := 2*i+1\t\t\t\t// the left son is greater\n\t pq[i], pq[j] = pq[j], pq[i]\t\t// we swap and proceed\n\t i = j\n\t} else {\t\t// left and right son\n\t if pq[i].phi >= pq[2*i+1].phi && pq[i].phi >= pq[2*i+2].phi {\n\t return\t\t// greater or equal than both sons? done.\n\t }\n\t j := 2*i+1\t\t// at least one son is greater, maybe the left\n\t if pq[2*i+2].phi > pq[2*i+1].phi {\t// but eventually the right\n\t j = 2*i+2\n\t }\n\t pq[i], pq[j] = pq[j], pq[i]\t\t// we swap with the larger son\n\t i = j\t\t\t\t// and proceed\n\t}\n }\n}", "title": "" }, { "docid": "35472c95a9e5f89fc61d5190babc9f03", "score": "0.57120293", "text": "func (g graph) BFS() []string {\n\n\tif len(g) == 0 {\n\t\tfmt.Println(\"\\n-- Graph is empty. --\")\n\t\treturn nil\n\t}\n\n\tvisited := make(map[string]bool)\n\n\tvar queue []string\n\tvar result []string\n\tvar currentVtx string\n\n\tfor i := range g {\n\t\tif !visited[i] {\n\t\t\tvisited[i] = true\n\t\t\tqueue = append(queue, i)\n\n\t\t\tfor len(queue) != 0 {\n\t\t\t\tcurrentVtx = queue[0] // get the element from the queue\n\t\t\t\tqueue = queue[1:] // remove element from the queue\n\t\t\t\tresult = append(result, currentVtx) // push the current vertex in result\n\n\t\t\t\tfor j := range g[currentVtx] {\n\t\t\t\t\tif !visited[g[currentVtx][j]] {\n\t\t\t\t\t\tvisited[g[currentVtx][j]] = true // mark as visited\n\t\t\t\t\t\tqueue = append(queue, g[currentVtx][j]) // push neighbors of current vertex in the queue\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "183337bb6ecadd603cf00a2e37200c92", "score": "0.57063013", "text": "func (candidates *NodeCandidates) Swap(i, j int) {\n\tcandidates.Lock()\n\tcandidates.Nodes[i], candidates.Nodes[j] = candidates.Nodes[j], candidates.Nodes[i]\n\tcandidates.Unlock()\n}", "title": "" }, { "docid": "6b3edb333ecfa0c69a8baf864f091e42", "score": "0.57002175", "text": "func bfs (tar int){\n\t\tvar Q []int\n\t\tvar vis []bool\n\t\t\n\t\t// initialize visited & parent arrays\n\t\tfor i := 0; i <= len(adjacencyList); i++ {\n\t\t\tvis = append(vis,false)\n\t\t\tparent = append(parent,i)\n\t\t}\n\t\t\n\t\tQ = make([]int,1)\n\t\tQ [0] = 1\n\t\tvis[1] = true\n\t\t\n\t\tfor !empty(Q) {\n\t\t\tu := top(Q)\n\t\t\tQ = pop(Q)\n\t\t\t\n\t\t\t// loop on node's adjList\n\t\t\tfor i := 0; i< len(adjacencyList[u]); i++{\n\t\t\t\tp := adjacencyList[u][i]\n\t\t\t\t//fmt.Printf(\"p:%d\\n\",p)\n\t\t\t\tif vis[p] {\n\t\t\t\t\tcontinue \n\t\t\t\t}\n\t\t\t\tvis[p] = true\n\t\t\t\tparent[p] = u\n\t\t\t\tQ = push(Q,p)\n\t\t\t}\t\n\t\t}\n\t\t\n}", "title": "" }, { "docid": "347ceb4afc0cd4bf167fafbd4f617cfa", "score": "0.5687209", "text": "func (paths *Paths) BFS(s int) {\n\n\tqueue := list.New()\n\tpaths.marked = make([]bool, len(paths.g.list))\n\tpaths.edgeTo = make([]int, len(paths.g.list))\n\n\tqueue.PushBack(s)\n\tpaths.marked[s] = true\n\t//fmt.Println(\"BFS visiting\", s)\n\n\tfor queue.Len() != 0 {\n\t\t//v := queue.Front().Value.(int)\n\t\tv := queue.Remove(queue.Front()).(int)\n\n\t\tcurrent := paths.g.adj(v).head\n\t\tfor current != nil {\n\t\t\tn := current.Data.(int)\n\t\t\tif !paths.marked[n] {\n\t\t\t\tqueue.PushBack(n)\n\t\t\t\tpaths.marked[n] = true\n\t\t\t\t//fmt.Println(\"BFS visiting\", n)\n\t\t\t\tpaths.edgeTo[n] = v\n\t\t\t}\n\t\t\tcurrent = current.Next\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "5293b022f48eeccdf718018739a2ec20", "score": "0.567715", "text": "func insertIntoNodeAfterSplitting(root, oldNode *node, leftIndex int, key []byte, right *node) *node {\n\n\tvar i, j int\n\tvar tmpKeys [M][]byte\n\tvar tmpPtrs [M + 1]unsafe.Pointer\n\n\tfor i, j = 0, 0; i < oldNode.numk+1; i, j = i+1, j+1 {\n\t\tif j == leftIndex+1 {\n\t\t\tj++\n\t\t}\n\t\ttmpPtrs[j] = oldNode.ptrs[i]\n\t}\n\n\tfor i, j = 0, 0; i < oldNode.numk; i, j = i+1, j+1 {\n\t\tif j == leftIndex {\n\t\t\tj++\n\t\t}\n\t\ttmpKeys[j] = oldNode.keys[i]\n\t}\n\n\ttmpPtrs[leftIndex+1] = unsafe.Pointer(right)\n\ttmpKeys[leftIndex] = key\n\n\tsplit := cut(M)\n\n\tnewNode := newNode()\n\toldNode.numk = 0\n\n\tfor i = 0; i < split-1; i++ {\n\t\toldNode.ptrs[i] = tmpPtrs[i]\n\t\toldNode.keys[i] = tmpKeys[i]\n\t\toldNode.numk++\n\t}\n\n\toldNode.ptrs[i] = tmpPtrs[i]\n\n\tprime := tmpKeys[split-1]\n\n\tfor i, j = i+1, 0; i < M; i, j = i+1, j+1 {\n\t\tnewNode.ptrs[j] = tmpPtrs[i]\n\t\tnewNode.keys[j] = tmpKeys[i]\n\t\tnewNode.numk++\n\t}\n\n\tnewNode.ptrs[j] = tmpPtrs[i]\n\n\t// free tmps...\n\tfor i = 0; i < M; i++ {\n\t\ttmpKeys[i] = nil\n\t\ttmpPtrs[i] = nil\n\t}\n\ttmpPtrs[M] = nil\n\n\tnewNode.rent = oldNode.rent\n\n\tfor i = 0; i <= newNode.numk; i++ {\n\t\tn := (*node)(unsafe.Pointer(newNode.ptrs[i]))\n\t\tn.rent = newNode\n\t}\n\treturn insertIntoRent(root, oldNode, prime, newNode)\n}", "title": "" }, { "docid": "58e5b0a4fb2ba84ad3d9989e4045e38a", "score": "0.5646832", "text": "func bfs(begin, end string, patterns map[string][]string, ret *[][]string) {\n\tq := NewQueue()\n\tpath := []string{begin}\n\tq.Push(path) //queue保存路径\n\tvisited := map[string]bool{begin:true} //visit保存节点\n\n\tisFound := false //是否找到end\n\tfor !q.Empty() && !isFound {\n\t\tlevelSize := q.Size()\n\t\tsubVisited := []string{} //当前层已访问节点\n\t\tfor i:=0; i<levelSize; i++ {\n\t\t\tpath = q.Pop()\n\t\t\ttmp := path[len(path)-1]\n\t\t\twords := generateNextWords(tmp, patterns)\n\t\t\tfor _, word := range words {\n\t\t\t\tif !visited[word] {\n\t\t\t\t\t//这里要新建一个slice,保证互不影响!!!\n\t\t\t\t\t//如果用newpath := append(path, word)可能会指向path,如果path改动会影响newpath\n\t\t\t\t\tnewpath := append([]string{}, append(path, word)...)\n\t\t\t\t\tq.Push(newpath)\n\t\t\t\t\tsubVisited = append(subVisited, word)\n\n\t\t\t\t\tif word == end {\n\t\t\t\t\t\tisFound = true\n\t\t\t\t\t\t*ret = append(*ret, newpath)\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//同一level遍历结束后才可以添加到visit\n\t\tfor _, v := range subVisited {\n\t\t\tvisited[v] = true\n\t\t}\n\t}\n}", "title": "" }, { "docid": "65e970d45db056c193e3067be6c3b03b", "score": "0.56350654", "text": "func bfs(graph Graph, start int, root int) ([]Chain) {\n\tvar queue Queue\n\tvar visited map[int]bool\n\tvar prev, vertexLevelMap map[int]int\n\tvar levelVertexMap map[int][]int\n\tvar level, maxLevel int\n\n\tprev = make(map[int]int)\n\tvisited = make(map[int]bool)\n\tvertexLevelMap = make(map[int]int)\t\t// vertex => level\n\tlevelVertexMap = make(map[int][]int)\t// level => vertexes that has a certain level\n\n\tvisited[start] = true\t\t// To prevent visiting start vertex again\n\tvisited[root] = true\t\t// To prevent going to the root vertex that start is separated\n\n\tqueue.Push(start)\n\tmaxLevel = -1\t\t\t// Will store level of farthest vertexes\n\n\tfor !queue.IsEmpty() {\n\t\t/*\n\t\t\tGet the first vertex in queue and pop it\n\t\t*/\n\t\tu, _ := queue.Pop()\n\n\t\t/*\n\t\t\tSet the level of vertex u to the level of previous vertex plus 1\n\t\t*/\n\t\tlevel = vertexLevelMap[prev[u]] + 1\n\t\tvertexLevelMap[u] = level\n\n\t\t/*\n\t\t\tAppend vertex u to map of level => vertexes\n\t\t*/\n\t\t_, ok := levelVertexMap[level]\n\t\tif ok {\n\t\t\tlevelVertexMap[level] = append(levelVertexMap[level], u)\n\t\t} else {\n\t\t\tlevelVertexMap[level] = []int{u}\n\t\t}\n\n\t\tif maxLevel < level {\n\t\t\tmaxLevel = level\t\t// replace maxLevel if it's smaller than level\n\t\t}\n\n\t\t/*\n\t\t\tIterate adjancent vertexes and push them into queue\n\t\t*/\n\t\tvertexes := graph.GetAdjacentVertexes(u)\n\t\tfor _, v := range vertexes {\n\t\t\tif !visited[v] {\n\t\t\t\tvisited[v] = true\t// Set vertex v as visited\n\t\t\t\tqueue.Push(v)\n\t\t\t\tprev[v] = u\t\t\t\t// Set the previous vertex of vertex v to u\n\t\t\t}\n\t\t}\n\t}\n\n\tvar chains []Chain\t\t// Will store chains that connect each farthest vertex to start\n\n\t/*\n\t\tIterate farthest vertexes and find a chain that connects it to start vertex\n\t*/\n\tfor _, vertex := range levelVertexMap[maxLevel] {\n\t\tvar chain Chain\n\n\t\tend := vertex\n\t\tokay := true\n\n\t\tfor okay {\n\t\t\tchain = append(chain, end)\n\t\t\tend, okay = prev[end]\n\t\t}\n\n\t\tchains = append(chains, chain)\n\t}\n\n\treturn chains\n}", "title": "" }, { "docid": "0a24a954dcae58fd4bb6ccca12b4fd27", "score": "0.56116354", "text": "func InvertTree_BFS_Iter(root *TreeNode) *TreeNode {\n\tif root == nil{\n\t\treturn root\n\t}\n\tli := []*TreeNode{root}\n\n\tfor i:= 0; i< len(li); i++{\n\t\tv := li[i]\n\t\tif v.Left != nil{\n\t\t\tli = append(li, v.Left)\n\t\t}\n\t\tif v.Right != nil{\n\t\t\tli = append(li, v.Right)\n\t\t}\n\t\tv.Left,v.Right = v.Right, v.Left\n\t}\n\treturn root\n}", "title": "" }, { "docid": "8f36e0581c010e9dd7fc7e9fa75f2b12", "score": "0.56010145", "text": "func main() {\n\thead := &Node{Value: \"0\"}\n\thead.Left = &Node{Value: \"1 left\"}\n\thead.Right = &Node{Value: \"1 right\"}\n\thead.Right.Left = &Node{Value: \"2 left\"}\n\thead.Right.Right = &Node{Value: \"2 right\"}\n\thead.Right.Left.Left = &Node{Value: \"D\"} //D\n\thead.Right.Left.Right = &Node{Value: \"E\"} //E\n\thead.Right.Right.Left = &Node{Value: \"3 left\"}\n\thead.Right.Right.Left.Left = &Node{Value: \"F\"} //F\n\thead.Right.Right.Left.Right = &Node{Value: \"G\"} //G\n\thead.Right.Right.Right = &Node{Value: \"3 right\"}\n\thead.Right.Right.Right.Left = &Node{Value: \"H\"} //H\n\thead.Right.Right.Right.Right = &Node{Value: \"J\"} //J\n\thead.Left.Left = &Node{Value: \"2 left\"}\n\thead.Left.Right = &Node{Value: \"C\"} //C\n\thead.Left.Left.Left = &Node{Value: \"A\"} //A\n\thead.Left.Left.Right = &Node{Value: \"B\"} //B\n\tfmt.Println(\"###########################################\")\n\tfmt.Println(\" 4.4 linked list per depth of binary tree\")\n\tfmt.Println(\"###########################################\")\n\tlists := BuildList(head)\n\tPrint(lists)\n}", "title": "" }, { "docid": "cc550aabefbbbb878196b5b6e53e617c", "score": "0.5579083", "text": "func splitBST776(root *TNode, V int) []*TNode {\n\tif root == nil {\n\t\treturn []*TNode{nil, nil}\n\t}\n\n\t// V == root.Val\n\tif root.Val == V {\n\t\tr := root.Right\n\t\troot.Right = nil\n\t\treturn []*TNode{root, r}\n\t}\n\n\tl, r := helper776(root, nil, V), root\n\tif l != nil && r != nil {\n\t\tif l.Val == r.Val {\n\t\t\treturn []*TNode{l, r.Right}\n\t\t}\n\t}\n\treturn []*TNode{l, r}\n}", "title": "" }, { "docid": "91c24c1415ce0d6bc0fdcff93ea324a3", "score": "0.55748355", "text": "func flagSwitchNodes(g *cfg.Graph, dom path.DominatorTree, head, follow, n *cfg.Node, switchNodes map[*cfg.Node]bool, traversed map[*cfg.Node]bool) {\n\ttraversed[n] = true\n\tif n == follow {\n\t\treturn\n\t}\n\tif g.From(n.ID()).Len() > 2 {\n\t\treturn\n\t}\n\tif immedDom := node(dom.DominatorOf(n)); !switchNodes[immedDom] {\n\t\treturn\n\t}\n\tswitchNodes[n] = true\n\tn.SwitchHead = head\n\tfor _, succ := range cfg.SortByRevPost(graph.NodesOf(g.From(n.ID()))) {\n\t\tif traversed[succ] {\n\t\t\tcontinue\n\t\t}\n\t\tflagSwitchNodes(g, dom, head, follow, succ, switchNodes, traversed)\n\t}\n}", "title": "" }, { "docid": "02ab0ef8cc44cc67cd18c77c66b01bf3", "score": "0.55574787", "text": "func BreadthFirstSearch(root *Node, visit func(*Node)) {\n\tvisit(root)\n visited[root] = true\n\tqueue := NewQueue(0)\n\tfor _, n := range root.Adjacent() {\n\t\tqueue.Push(n)\n\t}\n\n for n := queue.Pop(); n !=nil; {\n for _, a := range n.Adjacent() {\n _, in := visited[a]\n if !in {\n visit(a)\n visited[a] := true\n queue.Push(a)\n }\n }\n }\n}", "title": "" }, { "docid": "cac71b36072388ea577441a66cc3d42d", "score": "0.554236", "text": "func reheapBottom(pq []*stateT) {\n l := len(pq)\n i := l-1\t\t\t// at the last element we start\n for {\n if i==0 {\t\t// We have reached the root? done.\n\t return\n\t}\n\tifath := (i-1)/2\t// index of father\n\tif pq[ifath].phi >= pq[i].phi {\t// son is not greater? done.\n\t return\n\t}\n\tpq[i], pq[ifath] = pq[ifath], pq[i]\t// son is greater: we swap\n\ti = ifath\t\t\t\t// and proceed\n }\n}", "title": "" }, { "docid": "50b6f7402f74675c680796d175e745d1", "score": "0.5517464", "text": "func (s *nodeSorter) Swap(i, j int) {\r\n\ts.nodes[i], s.nodes[j] = s.nodes[j], s.nodes[i]\r\n}", "title": "" }, { "docid": "1d990b4a981a6b24b625e88f56a20f1f", "score": "0.55166656", "text": "func (g *Graph) BfsTraverse() {\n\tmyGraphQueue := queue.NewQueue()\n\tvisitedNode := make(map[string]bool)\n\tfor i := range g.Vertices {\n\t\tvisitedNode[g.Vertices[i].Label] = false\n\t}\n\tmyGraphQueue.Add(g.Vertices[0])\n\tvisitedNode[g.Vertices[0].Label] = true\n\tfor {\n\t\tnode, err := myGraphQueue.Pop()\n\t\tassertedNode, ok := node.(*Vertex)\n\t\tfmt.Println(assertedNode.Label)\n\t\tvisitedNode[assertedNode.Label] = true\n\t\tif err != nil || ok == false {\n\t\t\tbreak\n\t\t}\n\t\tfor _, v := range assertedNode.AdjList {\n\t\t\tif visitedNode[v.Label] != true {\n\t\t\t\tmyGraphQueue.Add(v)\n\t\t\t}\n\t\t}\n\t\tif myGraphQueue.IsEmpty() == true {\n\t\t\tbreak\n\t\t}\n\t}\n\tfmt.Printf(\"\\n\")\n}", "title": "" }, { "docid": "d48180caa97f8bcb0e9c627a5bd3c5c0", "score": "0.5514932", "text": "func (l byEdge) Swap(i, j int) { l[i], l[j] = l[j], l[i] }", "title": "" }, { "docid": "0f3a56e8f7afdce93be4f6ea4db895d6", "score": "0.55124736", "text": "func replaceLeftPointers(tr, ul, bl, u, b *Trapezoid, lpy float64) {\n\tif ul != nil && geom.F64eq(ul.bot[right], lpy) {\n\t\tfmt.Println(\"Case 0\")\n\t\t// U matches exactly to ul,\n\t\t// B matches exactly to bl.\n\t\t//\n\t\t// ~ ~ ~ ~ ~ ~\n\t\t// ul | u\n\t\t// -----lpy-----\n\t\t// bl | b\n\t\t// ~ ~ ~ ~ ~ ~\n\t\t//\n\t\tul.replaceNeighbors(tr, u)\n\t\tbl.replaceNeighbors(tr, b)\n\t} else if (ul != nil && geom.F64eq(ul.top[right], lpy)) ||\n\t\t(ul == nil && bl != nil && geom.F64eq(bl.top[right], lpy)) {\n\t\tfmt.Println(\"Case 1\")\n\t\t// U does not border the left edge\n\t\t//\n\t\t// ~ ~ ~ lpy \\\n\t\t// (ul) \\ \\ u\n\t\t// ~ ~ ~ ~ \\ b \\\n\t\t// (bl) \\ \\\n\t\t// ~ ~ ~ ~ ~ ~ ~\n\t\tul.replaceNeighbors(tr, b)\n\t\tbl.replaceNeighbors(tr, b)\n\t\tif ul != nil {\n\t\t\tb.Neighbors[upleft] = ul\n\t\t} else {\n\t\t\tb.Neighbors[upleft] = bl\n\t\t}\n\t\tif bl != nil {\n\t\t\tb.Neighbors[botleft] = bl\n\t\t} else {\n\t\t\tb.Neighbors[botleft] = ul\n\t\t}\n\t\tu.Lefts(b)\n\t} else if (bl != nil && geom.F64eq(bl.bot[right], lpy)) ||\n\t\t(bl == nil && ul != nil && geom.F64eq(ul.bot[right], lpy)) {\n\t\tfmt.Println(\"Case 2\")\n\t\t// D does not border the left edge\n\t\t//\n\t\t// ~ ~ ~ ~ ~ ~ ~ ~\n\t\t// (ul) / /\n\t\t// ~ ~ ~ ~ / u /\n\t\t// (bl) / / b\n\t\t// ~ ~ ~ lpy / ~ ~\n\t\t//\n\t\tul.replaceNeighbors(tr, u)\n\t\tbl.replaceNeighbors(tr, u)\n\t\tif bl != nil {\n\t\t\tu.Neighbors[botleft] = bl\n\t\t} else {\n\t\t\tu.Neighbors[botleft] = ul\n\t\t}\n\t\tif ul != nil {\n\t\t\tu.Neighbors[upleft] = ul\n\t\t} else {\n\t\t\tu.Neighbors[upleft] = bl\n\t\t}\n\t\tb.Lefts(u)\n\t} else if ul != nil && ul.bot[right] < lpy {\n\t\tfmt.Println(\"Case 3\")\n\t\t// UL expands past FE\n\t\t//\n\t\t// ~ ~ ~ ~ ~ ~ ~ ~ ~\n\t\t// ul | u\n\t\t// lpy ~ ~ ~\n\t\t// ~ ~ ~ ~ | b\n\t\t// bl |\n\t\t// ~ ~ ~ ~ ~ ~ ~ ~ ~\n\t\t//\n\t\tif ul != bl {\n\t\t\tbl.replaceNeighbors(tr, b)\n\t\t}\n\t\tul.replaceNeighbor(upright, tr, u)\n\t\tul.replaceNeighbor(botright, tr, b)\n\t\tu.Lefts(ul)\n\t\tb.Neighbors[upleft] = ul\n\t\tb.Neighbors[botleft] = bl\n\t} else if bl != nil && bl.top[right] > lpy {\n\t\tfmt.Println(\"Case 4\")\n\t\t// BL expands past FE\n\t\t//\n\t\t// ~ ~ ~ ~ ~ ~ ~ ~ ~\n\t\t// ul | u\n\t\t// ~ ~ ~ ~ |\n\t\t// lpy ~ ~ ~\n\t\t// bl | b\n\t\t// ~ ~ ~ ~ ~ ~ ~ ~ ~\n\t\t//\n\t\tif ul != bl {\n\t\t\tul.replaceNeighbors(tr, u)\n\t\t}\n\t\tbl.replaceNeighbor(upright, tr, u)\n\t\tbl.replaceNeighbor(botright, tr, b)\n\t\tb.Lefts(bl)\n\t\tu.Neighbors[upleft] = ul\n\t\tu.Neighbors[botleft] = bl\n\t} else {\n\t\tfmt.Println(\"No left pointer case satisfied.\")\n\t\tfmt.Println(\"Both neighbors nil:\", ul == nil && bl == nil)\n\t\tfmt.Println(ul, bl)\n\t\tfmt.Println(u, b)\n\t\tfmt.Println(lpy)\n\t}\n}", "title": "" }, { "docid": "8297c03055cad07bc1301b694105d0da", "score": "0.5510492", "text": "func BFS(root *tree.Node, target int) bool {\n\tif root == nil {\n\t\treturn false\n\t}\n\t// BFS uses a queue to store the current level's nodes\n\tq := []*tree.Node{root}\n\tfor len(q) > 0 {\n\t\t// number of items on current level\n\t\tlevel := len(q)\n\t\tfor level > 0 {\n\t\t\tcur, q := q[0], q[1:]\n\t\t\tif cur.Value == target {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif cur.Left != nil {\n\t\t\t\tq = append(q, cur.Left)\n\t\t\t}\n\t\t\tif cur.Right != nil {\n\t\t\t\tq = append(q, cur.Right)\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "5e79a49180f90991c478f755c51d49bd", "score": "0.5506448", "text": "func ReconstructBst(preOrderTraversalValues []int) *BST {\n\t// If we run out of values we return nil\n\tif len(preOrderTraversalValues) <= 0 {\n\t\treturn nil\n\t}\n\n\t// value for new node will be first in the list\n\tcurrentValue := preOrderTraversalValues[0]\n\t// update the rest of the array\n\tpreOrderTraversalValues = preOrderTraversalValues[1:]\n\n\t// create new bst with currentValue\n\tbst := CreateBST(currentValue)\n\n\t// to reconstruct the left and right sub trees we need to find\n\t// all the values less than the current one value the left tree\n\t// and all values greater than the current value for the right tree\n\tn := GetIndexOfFirstValueGreaterOrEqualToN(currentValue, preOrderTraversalValues)\n\n\tvar leftSubTreeValues []int\n\tvar rightSubTreeValues []int\n\tif n == -1 {\n\t\t// no value greater than current, so right is empty array\n\t\tleftSubTreeValues = preOrderTraversalValues\n\t\trightSubTreeValues = []int{}\n\t} else {\n\t\t// split the traversl values for left and right trees\n\t\tleftSubTreeValues = preOrderTraversalValues[:n]\n\t\trightSubTreeValues = preOrderTraversalValues[n:]\n\t}\n\n\t// recursively reconstruct the left and right subtrees\n\tbst.Left = ReconstructBst(leftSubTreeValues)\n\tbst.Right = ReconstructBst(rightSubTreeValues)\n\n\treturn bst\n}", "title": "" }, { "docid": "b52bfa50ddb42d222c79a7417d70d5a6", "score": "0.5502368", "text": "func Remove(root *Node, node *Node) (*Node, *Node) {\n\tif root == nil {\n\t\treturn nil, nil\n\t}\n\tvar dn *Node\n\tif root.greater(node) {\n\t\troot.left, dn = Remove(root.left, node)\n\t\t// Update the parent of the left node\n\t\tif root.left != nil {\n\t\t\troot.left.parent = root\n\t\t}\n\t\treturn root, dn\n\t} else if node.greater(root) {\n\t\troot.right, dn = Remove(root.right, node)\n\t\t// Update the parent of the right node\n\t\tif root.right != nil {\n\t\t\troot.right.parent = root\n\t\t}\n\t\treturn root, dn\n\t}\n\n\t// if this is a leaf node\n\tif root.left == nil && root.right == nil {\n\t\t/*\n\t\t\texample:\n\t\t\t 6\n\t\t\t /\n\t\t\t\t 4\n\t\t\t\t \\\n\t\t\t\t 5\n\n\t\t\tDeleting 5 should result in 4's next pointer to 6\n\t\t*/\n\t\tif root.prev != nil {\n\t\t\troot.prev.next = root.next\n\t\t}\n\t\tif root.next != nil {\n\t\t\troot.next.prev = root.prev\n\t\t}\n\t\treturn nil, root\n\t}\n\n\t// Node with only right node\n\tif root.left == nil {\n\t\t/*\n\t\t\t\texample:\n\t\t\t\t 2\n\t\t\t \\\n\t\t\t\t\t 4\n\t\t\t\t \\\n\t\t\t 5\n\n\t\t\t\tDeleting 4 should result in 5's prev pointer to 2\n\t\t*/\n\t\tif root.prev != nil {\n\t\t\troot.prev.next = root.next\n\t\t}\n\t\tif root.next != nil {\n\t\t\troot.next.prev = root.prev\n\t\t}\n\t\treturn root.right, root\n\t}\n\n\t// Node with only left node\n\tif root.right == nil {\n\t\t// Same as above example inverted\n\t\tif root.prev != nil {\n\t\t\troot.prev.next = root.next\n\t\t}\n\t\tif root.next != nil {\n\t\t\troot.next.prev = root.prev\n\t\t}\n\t\treturn root.left, root\n\t}\n\n\t// For nodes with both left & right, rotate and move the node to the bottom (same as sink)\n\tif root.left.Size() > root.right.Size() {\n\t\troot = rotateRight(root)\n\t\troot, dn = Remove(root, root.right)\n\t} else {\n\t\troot = rotateLeft(root)\n\t\troot, dn = Remove(root, root.left)\n\t}\n\treturn root, dn\n}", "title": "" }, { "docid": "60c7617b94624ed28a545ebd3cce446c", "score": "0.5495226", "text": "func (n *GraphNode[T]) BFS(ctx context.Context, reverse bool, fn GraphSearchFunc[T]) error {\n\treturn n.graph.BFS(ctx, reverse, n, fn)\n}", "title": "" }, { "docid": "ed11dafcf812c1a12e2439d7eb1b285b", "score": "0.5488753", "text": "func (r *Ring) Swap(i, j int) {\n\tr.vnodes[i], r.vnodes[j] = r.vnodes[j], r.vnodes[i]\n}", "title": "" }, { "docid": "d65bfd3b9c8fd65860359c5a703f69d9", "score": "0.5488317", "text": "func BuildTree_2(inorder []int, postorder []int) *TreeNode {\n\tif inorder == nil || len(inorder) == 0 {\n\t\treturn nil;\n\t}\n\troot := &TreeNode{Val: postorder[len(postorder)-1]}\n\tpostorder = postorder[:len(postorder)-1]\n\tvar leftInorder, leftPostorder, rightInorder, rightPostorder []int\n\tfor index, value := range inorder {\n\t\tif value == root.Val {\n\t\t\tleftPostorder = postorder[:index]\n\t\t\trightPostorder = postorder[index:]\n\t\t\tleftInorder = inorder[:index]\n\t\t\trightInorder = inorder[index+1:]\n\t\t\tbreak\n\t\t}\n\t}\n\troot.Right = BuildTree_2(rightInorder, rightPostorder);\n\troot.Left = BuildTree_2(leftInorder, leftPostorder);\n\treturn root\n}", "title": "" }, { "docid": "aaca331c95772fa504bb6898f69f1070", "score": "0.5483946", "text": "func bfsShortestPath(graph map[string][]string, start, goal string) []string {\n\n\t// set up a path list\n\tpath := []string{start}\n\n\t// return a simple path if start is the goal\n\tif start == goal {\n\t\treturn path\n\t}\n\n\t// list to keep track of all visited nodes\n\texplored := []string{}\n\n\t// the FIFO queue\n\tqueue := queue.New()\n\n\t// add the first path to the queue\n\tqueue.Enqueue(path)\n\n\t// keep looping until there are no nodes still to be checked\n\tfor queue.Len() > 0 {\n\t\t// pop first item from queue (FIFO)\n\t\tpath := queue.Dequeue().([]string)\n\n\t\t// retrieve the node from the path list\n\t\tnode := path[len(path)-1]\n\n\t\t// check if the node has already been explored\n\t\tif !stringInSlice(node, explored) {\n\n\t\t\t// add node to list of checked nodes\n\t\t\texplored = append(explored, node)\n\n\t\t\t// get neighbours\n\t\t\tneighbours, exists := graph[node]\n\n\t\t\t// if no neighbours ignore\n\t\t\tif exists {\n\n\t\t\t\t// go through all neighbour nodes\n\t\t\t\tfor _, neighbour := range neighbours {\n\n\t\t\t\t\t// make a copy of the current path\n\t\t\t\t\tpath1 := make([]string, len(path))\n\t\t\t\t\tcopy(path1, path)\n\n\t\t\t\t\t// add this neighbour to the path\n\t\t\t\t\tpath1 = append(path1, neighbour)\n\n\t\t\t\t\t// return path if neighbour is goal\n\t\t\t\t\tif neighbour == goal {\n\t\t\t\t\t\treturn path1\n\t\t\t\t\t}\n\n\t\t\t\t\t// push it onto the queue for further exploration\n\t\t\t\t\tqueue.Enqueue(path1)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// we couldn't find the goal... :(\n\treturn nil\n\n}", "title": "" }, { "docid": "91b7496fdda0fd07f1eda036c473f6e9", "score": "0.5479835", "text": "func increasingBST(root *TreeNode) *TreeNode {\n\n\tif root == nil {\n\t\treturn nil\n\t}\n\n\tif root.Left == nil && root.Right == nil {\n\t\treturn root\n\t}\n\n\tleft := increasingBST(root.Left)\n\tright := increasingBST(root.Right)\n\troot.Right = right\n\troot.Left = nil\n\n\tif left == nil {\n\t\treturn root\n\t}\n\n\ttemp := left\n\tfor temp != nil && temp.Right != nil {\n\t\ttemp = temp.Right\n\t}\n\ttemp.Right = root\n\treturn left\n}", "title": "" }, { "docid": "4a6cd8e54491f032637d8e923c7b4ad8", "score": "0.54782426", "text": "func helper897(node *TreeNode, current *TreeNode) *TreeNode {\n\tif node == nil {\n\t\treturn current\n\t}\n\tcurrent = helper897(node.Left, current)\n\tnode.Left = nil\n\tcurrent.Right, current = node, node\n\tcurrent = helper897(node.Right, current)\n\treturn current\n}", "title": "" }, { "docid": "043c21f582d79d7a162f2d7204a685c5", "score": "0.54778934", "text": "func helper(root *TreeNode, next *TreeNode) *TreeNode{\n\tif root == nil {\n\t\treturn next\n\t}\n\tres := helper(root.Left, root)\n\troot.Left = nil\n\troot.Right = helper(root.Right, next)\n\treturn res\n}", "title": "" }, { "docid": "2bf6b15d8d5ac5e086b1057545423b5d", "score": "0.545291", "text": "func (c *Children) SwapNodes(n1, n2 *Node) (err error) {\n\ti1, err1 := c.Index(n1)\n\ti2, err2 := c.Index(n2)\n\tif err1 != nil {\n\t\terr = err1\n\t} else if err2 != nil {\n\t\terr = err2\n\t} else {\n\t\tc.Swap(i1, i2)\n\t}\n\treturn\n}", "title": "" }, { "docid": "8b54c196ea00ea42af0af4fdb74562fe", "score": "0.5446664", "text": "func blockSwap(sd sort.Interface, left, mid, right int) {\n\ti := mid - left\n\tj := right - mid + 1\n\tfor i != j {\n\t\tif i > j {\n\t\t\tswapRange(sd, mid-i, mid, j)\n\t\t\ti -= j\n\t\t} else {\n\t\t\tswapRange(sd, mid-i, mid+j-i, i)\n\t\t\tj -= i\n\t\t}\n\t}\n\tswapRange(sd, mid-i, mid, i)\n}", "title": "" }, { "docid": "58b1566430acaf27fbe1cee7541747b3", "score": "0.54387486", "text": "func main() {\n\troot := NewNode(4)\n\tleftNode := NewNode(2)\n\trightNode := NewNode(7)\n\tlleftNode1 :=NewNode(1)\n\tlleftNode2 :=NewNode(3)\n\trrightNode1 :=NewNode(6)\n\trrightNode2 :=NewNode(9)\n\troot.Left=leftNode\n\troot.Right=rightNode\n\tleftNode.Left=lleftNode1\n\tleftNode.Right=lleftNode2\n\trightNode.Left=rrightNode1\n\trightNode.Right=rrightNode2\n\n\t// 前序遍历打印翻转前的树\n\tPrintTreePre(root)\n\tPrintTree(root)\n\tv2 := invertTree(root)\n\t// 前序遍历打印翻转后的树\n\tPrintTreePre(v2)\n}", "title": "" }, { "docid": "0d45465aba8ac80d8e29a1a1684e4bdf", "score": "0.54338807", "text": "func (h *Heap) Fixdown() {\n\tlength := len(h.Elems)\n\tif length == 0 {\n\t\treturn\n\t}\n\th.Elems = h.Elems[:len(h.Elems)-1]\n\tlength--\n\ti := 0\n\t// (i+1)*2 ensures current node has two children\n\tfor (i+1)*2 < length {\n\t\tvar childIndex int\n\t\tif h.MaxHeap {\n\t\t\tif h.Elems[i] >= h.Elems[2*i+1] &&\n\t\t\t\th.Elems[i] >= h.Elems[2*i+2] {\n\t\t\t\treturn //done\n\t\t\t}\n\t\t\tif h.Elems[2*i+1] > h.Elems[2*i+2] {\n\t\t\t\tchildIndex = 2*i + 1\n\t\t\t} else {\n\t\t\t\tchildIndex = 2*i + 2\n\t\t\t}\n\t\t} else {\n\t\t\tif h.Elems[i] <= h.Elems[2*i+1] &&\n\t\t\t\th.Elems[i] <= h.Elems[2*i+2] {\n\t\t\t\treturn //done\n\t\t\t}\n\t\t\tif h.Elems[2*i+1] < h.Elems[2*i+2] {\n\t\t\t\tchildIndex = 2*i + 1\n\t\t\t} else {\n\t\t\t\tchildIndex = 2*i + 2\n\t\t\t}\n\t\t}\n\t\tswapElems(h.Elems, i, childIndex)\n\t\ti = childIndex\n\t}\n\n\t//This check is for one child case in the last possible swap\n\tif (i*2 + 1) < length {\n\t\tif h.Elems[i] < h.Elems[i*2+1] && h.MaxHeap ||\n\t\t\th.Elems[i] > h.Elems[i*2+1] && !h.MaxHeap {\n\t\t\tswapElems(h.Elems, i, i*2+1)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b82f81880b9271435471c139b533ab38", "score": "0.54255205", "text": "func Backtracking(g graph.MazeGraph, r *rand.Rand) {\n\tn := g.N()\n\tcurrent := rand.Intn(n - 1)\n\tvisited := make([]bool, n)\n\tvisited[current] = true\n\tvar stack []int\n\n\tfor {\n\t\tneighbors := g.Neighbors(current)\n\t\tvar notVisited []int\n\t\tfor _, n := range neighbors {\n\t\t\tif !visited[n] {\n\t\t\t\tnotVisited = append(notVisited, n)\n\t\t\t}\n\t\t}\n\n\t\tif len(notVisited) > 0 {\n\t\t\tnext := notVisited[r.Intn(len(notVisited))]\n\t\t\t*g.Wall(current, next) = false\n\t\t\tvisited[next] = true\n\t\t\tstack = append(stack, current)\n\t\t\tcurrent = next\n\t\t} else if len(stack) > 0 {\n\t\t\tnext := stack[len(stack)-1]\n\t\t\tstack = stack[:len(stack)-1]\n\t\t\tcurrent = next\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bcd41340afca64ac119a774b3e94ddcc", "score": "0.5419268", "text": "func (g *DAG[T]) BFS(ctx context.Context, reverse bool, start *GraphNode[T], search GraphSearchFunc[T]) error {\n\tvar visited = NewSet[string]()\n\tstack := NewStack[*searchItem[T]]()\n\tctx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\tif err := g.breadthFirstSearch(ctx, &breadthFirstSearchState[T]{\n\t\tvisited: visited,\n\t\tstack: stack,\n\t\treverse: reverse,\n\t\troot: start,\n\t\tnext: start,\n\t\trelationship: \"\",\n\t}); err != nil {\n\t\treturn err\n\t}\n\tstack.Range(func(element *searchItem[T]) bool {\n\t\tif element.node.ID() != start.ID() {\n\t\t\treturn search(ctx, element.relationship, element.node)\n\t\t}\n\t\treturn true\n\t})\n\treturn nil\n}", "title": "" }, { "docid": "595a1adf7617a3fa38a3867947f9f8b9", "score": "0.541864", "text": "func (h Nodes) Swap(i, j int) {\n\th[i], h[j] = h[j], h[i]\n}", "title": "" }, { "docid": "5e054bbd9f60b855cb80fc8782d11477", "score": "0.5413279", "text": "func makeTree(nums []int) *TreeNode {\n\n\tnodes := []*TreeNode{}\n\n\t// make nodes same length as nums\n\tfor range nums {\n\t\tnodes = append(nodes, nil)\n\t}\n\n\tqueue := []int{}\n\tindex := 0\n\n\t// populate our queue\n\tqueue = append(queue, index)\n\n\t// create the first node. Others will be added in the loop\n\tnodes[index] = &TreeNode{\n\t\tVal: nums[index],\n\t}\n\n\tfor {\n\t\tnext := queue[0]\n\t\tqueue = queue[1:]\n\n\t\tnode := nodes[next]\n\n\t\tindex++\n\t\tif index >= len(nums) {\n\t\t\tbreak\n\t\t}\n\n\t\tif nums[index] != -1 {\n\t\t\tqueue = append(queue, index)\n\n\t\t\tnodes[index] = &TreeNode{\n\t\t\t\tVal: nums[index],\n\t\t\t}\n\n\t\t\tnode.Left = nodes[index]\n\t\t}\n\n\t\tindex++\n\t\tif index >= len(nums) {\n\t\t\tbreak\n\t\t}\n\n\t\tif nums[index] != -1 {\n\t\t\tqueue = append(queue, index)\n\n\t\t\tnodes[index] = &TreeNode{\n\t\t\t\tVal: nums[index],\n\t\t\t}\n\n\t\t\tnode.Right = nodes[index]\n\t\t}\n\t}\n\n\treturn nodes[0]\n}", "title": "" }, { "docid": "a2a470f31b02976b3a3f874b5327a218", "score": "0.54115415", "text": "func DfsEdge(root *Node, visit func(*Node), visited func(*Node) bool, f func(from, to *Node)) {\n\ttodo := list.New()\n\tparents := list.New()\n\ttodo.PushBack(root)\n\tparents.PushBack(root)\n\n\tfor todo.Len() > 0 {\n\t\tel := todo.Back()\n\t\tpar := parents.Back()\n\t\tnode := el.Value.(*Node)\n\t\tvar parNode *Node\n\t\tparNode = par.Value.(*Node)\n\t\ttodo.Remove(el)\n\t\tparents.Remove(par)\n\n\t\tif visited(node) {\n\t\t\tcontinue\n\t\t}\n\n\t\tvisit(node)\n\t\tf(parNode, node)\n\n\t\tfor _, ngh := range node.Neighbours {\n\t\t\tif visited(ngh) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttodo.PushBack(ngh)\n\t\t\tparents.PushBack(node)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "aea7fa738f85b5df9880ffd6b91c2142", "score": "0.5410259", "text": "func (np *NodePool) Swap(i uint64, j uint64) {\n\ttemp := np.nodes[i]\n\tnp.nodes[i] = np.nodes[j]\n\tnp.nodes[j] = temp\n}", "title": "" }, { "docid": "ab8b14ce6e3dc366cee4322d7f606301", "score": "0.5410115", "text": "func bfs(A [][]int) int {\n\tmoves := [][]int{{-1, 0}, {1, 0}, {0, -1}, {0, 1}}\n\tsteps := 0\n\n\tfor len(island) > 0 {\n\t\tnext := [][]int{}\n\t\tfor _, block := range island {\n\t\t\tfor k := 0; k < 4; k++ {\n\t\t\t\ti, j := block[0]+moves[k][0], block[1]+moves[k][1]\n\t\t\t\tif isValid(A, i, j) {\n\t\t\t\t\tif A[i][j] == 1 {\n\t\t\t\t\t\treturn steps\n\t\t\t\t\t} else {\n\t\t\t\t\t\tA[i][j] = -1\n\t\t\t\t\t\tnext = append(next, []int{i, j})\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tsteps++\n\t\tisland = next\n\t}\n\treturn steps\n}", "title": "" }, { "docid": "a3570f9d6cb26b11888f9ff5de31c7c6", "score": "0.53848594", "text": "func main() {\n\tvar N, K int\n\tfmt.Scanf(\"%d\", &N)\n\tnodes = make([]*Node, N)\n\tfor i := 0; i < N; i++ {\n\t\tnodes[i] = &Node{\n\t\t\tmake(map[int]bool),\n\t\t\tfalse,\n\t\t\tmake(map[int]bool),\n\t\t}\n\t}\n\ta, b := 0, 0\n\tfor i := 0; i < N-1; i++ {\n\t\tfmt.Scanf(\"%d%d\", &a, &b)\n\t\tnodes[a-1].next[b-1] = true\n\t\tnodes[b-1].next[a-1] = true\n\t}\n\n\t// Building the tree.\n\tbuildTree(0)\n\n\tfmt.Scanf(\"%d\", &K)\n\tfor i := 0; i < K; i++ {\n\t\tfmt.Scanf(\"%d%d\", &a, &b)\n\t\tnodes[a-1].checked = true\n\t\tnodes[a-1].values[b] = true\n\t}\n\tbfs(nodes[a-1])\n\tfmt.Println(\"Yes\")\n}", "title": "" }, { "docid": "65ab39c0800fa7266fdb61293db90c66", "score": "0.5375572", "text": "func insert_into_node_after_splitting(root, old_node *node, left_index int, k []byte, right *node) *node {\n\tvar i, j, split int\n\tvar new_node, child *node\n\tvar tmp_keys [order][]byte\n\tvar tmp_ptrs [order + 1]interface{}\n\tvar k_prime []byte\n\n\tfor i < old_node.num_keys+1 {\n\t\tif j == left_index+1 {\n\t\t\tj++\n\t\t}\n\t\ttmp_ptrs[j] = old_node.ptrs[i]\n\t\ti++\n\t\tj++\n\t}\n\n\ti = 0\n\tj = 0\n\n\tfor i < old_node.num_keys {\n\t\tif j == left_index {\n\t\t\tj++\n\t\t}\n\t\ttmp_keys[j] = old_node.keys[i]\n\t\ti++\n\t\tj++\n\t}\n\n\ttmp_ptrs[left_index+1] = right\n\ttmp_keys[left_index] = k\n\n\tsplit = cut(order)\n\tnew_node = make_node()\n\told_node.num_keys = 0\n\n\tfor i = 0; i < split-1; i++ {\n\t\told_node.ptrs[i] = tmp_ptrs[i]\n\t\told_node.keys[i] = tmp_keys[i]\n\t\told_node.num_keys++\n\t}\n\n\told_node.ptrs[i] = tmp_ptrs[i]\n\tk_prime = tmp_keys[split-1]\n\n\tj = 0\n\tfor i += 1; i < order; i++ {\n\t\tnew_node.ptrs[j] = tmp_ptrs[i]\n\t\tnew_node.keys[j] = tmp_keys[i]\n\t\tnew_node.num_keys++\n\t\tj++\n\t}\n\n\tnew_node.ptrs[j] = tmp_ptrs[i]\n\n\t// free tmps...\n\tfor i = 0; i < order; i++ {\n\t\ttmp_keys[i] = nil\n\t\ttmp_ptrs[i] = nil\n\t}\n\ttmp_ptrs[order] = nil\n\n\tnew_node.parent = old_node.parent\n\n\tfor i = 0; i <= new_node.num_keys; i++ {\n\t\tchild = new_node.ptrs[i].(*node)\n\t\tchild.parent = new_node\n\t}\n\treturn insert_into_parent(root, old_node, k_prime, new_node)\n}", "title": "" }, { "docid": "007fa358ce8fc3ae6eb81bbe3d45e146", "score": "0.5364898", "text": "func createNode(nodeList []treeNode, nodeListIdx *int, repList []string, repListIdx *int, move [2]byte, newRep []byte, parentNodeIdx int) int {\n\trepeatedRep := 0\n\tretVal := -1\n\t// Check if board (representation) is repeated to avoid dummy nodes\n\tfor k := 0; k < *repListIdx; k++ {\n\t\tif string(newRep[:]) == repList[*repListIdx] {\n\t\t\trepeatedRep = 1\n\t\t\tbreak\n\t\t}\n\t}\n\tif repeatedRep == 0 {\n\t\trepList[*repListIdx] = string(newRep[:])\n\t\tnodeList[*nodeListIdx].rep = make([]byte, 20)\n\t\tnodeList[*nodeListIdx].parentIdx = parentNodeIdx\n\t\tnodeList[*nodeListIdx].idx = *nodeListIdx\n\t\tcopy(nodeList[*nodeListIdx].move[:], move[:])\n\t\tcopy(nodeList[*nodeListIdx].rep[:], newRep[:])\n\t\t// Check for single exit move possibility\n\t\tif (newRep[17] == 'b') && (newRep[18] == 'b') {\n\t\t\tsolution = string(nodeList[*nodeListIdx].move[:]) + \"bD\"\n\t\t\tretVal = nodeList[*nodeListIdx].parentIdx\n\t\t} else if (newRep[17] == 'x') && (newRep[18] == 'x') { // Check for double exit move possibility\n\t\t\tif (newRep[13] == 'b') && (newRep[14] == 'b') {\n\t\t\t\tsolution = string(nodeList[*nodeListIdx].move[:]) + \"BD\"\n\t\t\t\tretVal = nodeList[*nodeListIdx].parentIdx\n\t\t\t}\n\t\t}\n\t\t// Check memory limits\n\t\tif *repListIdx >= maxIdx {\n\t\t\tretVal = -2\n\t\t} else {\n\t\t\t(*nodeListIdx)++\n\t\t\t(*repListIdx)++\n\t\t}\n\t}\n\treturn retVal\n}", "title": "" }, { "docid": "35aed85804f18318c4a190d72ba12387", "score": "0.53624886", "text": "func TestBFS2(t *testing.T) {\n\tn := 100\n\ta := minMaxHeap.GenerateAscedingComparables(n)\n\n\t// fmt.Println(\"a\", a)\n\t// heap := NewMaxHeap([]Comparable{})\n\theap := NewMaxHeap(a)\n\n\ttop := float64(10) // 91 <-> 100\n\tilevel := int(math.Ceil(math.Log2(top - 1)))\n\t// fmt.Println(\"level\", ilevel)\n\n\t// fmt.Println(\"a\", a)\n\t// heap.Heapsort(a)\n\t// fmt.Println(\"heapsort\", heap)\n\n\tbfs, err := heap.BFS(ilevel)\n\tfmt.Println(\"bfs\", bfs[:10])\n\tif err != nil {\n\t\tt.Errorf(msg, bfs, err)\n\t}\n}", "title": "" }, { "docid": "a0ba8e19fc728e9871aea1e7243d9892", "score": "0.5360622", "text": "func (m *TileMap) BFS(start Point, until func(c Point) bool) map[Point]int {\n\tfrontier := []Point{start}\n\tdistance := make(map[Point]int)\n\tdistance[start] = 0\n\tfor len(frontier) > 0 {\n\t\tvar current Point\n\t\tcurrent, frontier = frontier[0], frontier[1:]\n\t\tif until(current) {\n\t\t\treturn distance\n\t\t}\n\t\tfor _, next := range m.neighbours(current) {\n\t\t\tif _, ok := distance[next.Point]; !ok {\n\t\t\t\tfrontier = append(frontier, next.Point)\n\t\t\t\tdistance[next.Point] = 1 + distance[current]\n\t\t\t}\n\t\t}\n\t}\n\treturn distance\n}", "title": "" }, { "docid": "4769ea120b1b8f0cc88c862d3b13d488", "score": "0.5353076", "text": "func insert(key Item, value interface{}, p *Node) (*Node, bool, bool) {\n\th := false\n\tif nil == p { // insert new node\n\t\th = true\n\t\tp = newNode(key, value)\n\t\treturn p, true, h\n\t}\n\tadded := false\n\tswitch p.key.Compare(key) {\n\tcase +1: // p.key > key\n\t\tp.left, added, h = insert(key, value, p.left)\n\t\tif added {\n\t\t\tp.leftNodes += 1\n\t\t}\n\t\tif h {\n\t\t\tif nil != p.left {\n\t\t\t\tp.left.up = p\n\t\t\t}\n\n\t\t\t// left branch has grown\n\t\t\tif 1 == p.balance {\n\t\t\t\tp.balance = 0\n\t\t\t\th = false\n\t\t\t} else if 0 == p.balance {\n\t\t\t\tp.balance = -1\n\t\t\t} else { // balance == -1, rebalance\n\t\t\t\tp1 := p.left\n\t\t\t\tif -1 == p1.balance {\n\t\t\t\t\t// single LL rotation\n\t\t\t\t\tp.left = p1.right\n\t\t\t\t\tp1.right = p\n\n\t\t\t\t\tp.balance = 0\n\n\t\t\t\t\tnn := 1 + p1.rightNodes + p.rightNodes\n\t\t\t\t\tp.leftNodes = p1.rightNodes\n\t\t\t\t\tp1.rightNodes = nn\n\n\t\t\t\t\tp1.up = p.up\n\t\t\t\t\tp.up = p1\n\t\t\t\t\tif nil != p.left {\n\t\t\t\t\t\tp.left.up = p\n\t\t\t\t\t}\n\n\t\t\t\t\tp = p1\n\t\t\t\t} else {\n\t\t\t\t\t// double LR rotation\n\t\t\t\t\tp2 := p1.right\n\t\t\t\t\tp1.right = p2.left\n\t\t\t\t\tp2.left = p1\n\t\t\t\t\tp.left = p2.right\n\t\t\t\t\tp2.right = p\n\t\t\t\t\tif -1 == p2.balance {\n\t\t\t\t\t\tp.balance = 1\n\t\t\t\t\t} else {\n\t\t\t\t\t\tp.balance = 0\n\t\t\t\t\t}\n\t\t\t\t\tif +1 == p2.balance {\n\t\t\t\t\t\tp1.balance = -1\n\t\t\t\t\t} else {\n\t\t\t\t\t\tp1.balance = 0\n\t\t\t\t\t}\n\n\t\t\t\t\tnl := 1 + p1.leftNodes + p2.leftNodes\n\t\t\t\t\tnr := 1 + p2.rightNodes + p.rightNodes\n\n\t\t\t\t\tp1.rightNodes = p2.leftNodes\n\t\t\t\t\tp.leftNodes = p2.rightNodes\n\n\t\t\t\t\tp2.leftNodes = nl\n\t\t\t\t\tp2.rightNodes = nr\n\n\t\t\t\t\tif nil != p.left {\n\t\t\t\t\t\tp.left.up = p\n\t\t\t\t\t}\n\t\t\t\t\tif nil != p1.right {\n\t\t\t\t\t\tp1.right.up = p1\n\t\t\t\t\t}\n\t\t\t\t\tp2.up = p.up\n\t\t\t\t\tp.up = p2\n\t\t\t\t\tp1.up = p2\n\n\t\t\t\t\tp = p2\n\t\t\t\t}\n\t\t\t\tp.balance = 0\n\t\t\t\th = false\n\t\t\t}\n\t\t}\n\tcase -1: // p.key < key\n\t\tp.right, added, h = insert(key, value, p.right)\n\t\tif added {\n\t\t\tp.rightNodes += 1\n\t\t}\n\t\tif h {\n\t\t\tif nil != p.right {\n\t\t\t\tp.right.up = p\n\t\t\t}\n\n\t\t\t// right branch has grown\n\t\t\tif -1 == p.balance {\n\t\t\t\tp.balance = 0\n\t\t\t\th = false\n\t\t\t} else if 0 == p.balance {\n\t\t\t\tp.balance = 1\n\t\t\t} else { // balance = +1, rebalance\n\t\t\t\tp1 := p.right\n\t\t\t\tif 1 == p1.balance {\n\t\t\t\t\t// single RR rotation\n\t\t\t\t\tp.right = p1.left\n\t\t\t\t\tp1.left = p\n\n\t\t\t\t\tp.balance = 0\n\n\t\t\t\t\tnn := 1 + p.leftNodes + p1.leftNodes\n\t\t\t\t\tp.rightNodes = p1.leftNodes\n\t\t\t\t\tp1.leftNodes = nn\n\n\t\t\t\t\tp1.up = p.up\n\t\t\t\t\tp.up = p1\n\t\t\t\t\tif nil != p.right {\n\t\t\t\t\t\tp.right.up = p\n\t\t\t\t\t}\n\n\t\t\t\t\tp = p1\n\t\t\t\t} else {\n\t\t\t\t\t// double RL rotation\n\t\t\t\t\tp2 := p1.left\n\t\t\t\t\tp1.left = p2.right\n\t\t\t\t\tp2.right = p1\n\t\t\t\t\tp.right = p2.left\n\t\t\t\t\tp2.left = p\n\t\t\t\t\tif +1 == p2.balance {\n\t\t\t\t\t\tp.balance = -1\n\t\t\t\t\t} else {\n\t\t\t\t\t\tp.balance = 0\n\t\t\t\t\t}\n\t\t\t\t\tif -1 == p2.balance {\n\t\t\t\t\t\tp1.balance = 1\n\t\t\t\t\t} else {\n\t\t\t\t\t\tp1.balance = 0\n\t\t\t\t\t}\n\n\t\t\t\t\tnl := 1 + p.leftNodes + p2.leftNodes\n\t\t\t\t\tnr := 1 + p2.rightNodes + p1.rightNodes\n\n\t\t\t\t\tp.rightNodes = p2.leftNodes\n\t\t\t\t\tp1.leftNodes = p2.rightNodes\n\n\t\t\t\t\tp2.leftNodes = nl\n\t\t\t\t\tp2.rightNodes = nr\n\n\t\t\t\t\tif nil != p.right {\n\t\t\t\t\t\tp.right.up = p\n\t\t\t\t\t}\n\t\t\t\t\tif nil != p1.left {\n\t\t\t\t\t\tp1.left.up = p1\n\t\t\t\t\t}\n\t\t\t\t\tp2.up = p.up\n\t\t\t\t\tp.up = p2\n\t\t\t\t\tp1.up = p2\n\n\t\t\t\t\tp = p2\n\t\t\t\t}\n\t\t\t\tp.balance = 0\n\t\t\t\th = false\n\t\t\t}\n\t\t}\n\tdefault:\n\t\tp.value = value\n\t}\n\treturn p, added, h\n}", "title": "" }, { "docid": "15963ea77b024e5fb4130aa0b1727862", "score": "0.53507423", "text": "func traverse(graph *Graph, start, goal uint64, algo SearchAlgorithm, heuristic Heuristic) (closedSet map[uint64]uint64) {\n\tclosedSet = make(map[uint64]uint64)\n\n\tif heuristic == nil {\n\t\theuristic = NullHeuristic\n\t}\n\n\t// Initialize the open set, according to the type of search passed in\n\tvar openSet OpenSet\n\tswitch algo {\n\tcase BreadthFirstSearch:\n\t\topenSet = &OpenQueue{container.NewQueue()} // FIFO approach to expand nodes\n\tcase DepthFirstSearch:\n\t\topenSet = &OpenStack{container.NewStack()} // LIFO approach to expand nodes\n\tcase Dijkstra, Astar:\n\t\topenSet = &container.PQueue{} // Priority queue if Dijkstra or A*\n\t}\n\n\tstate := &searchstate{start, 0, 0}\n\topenSet.Push(state, 0)\n\n\tfor openSet.Len() > 0 {\n\t\titem := openSet.Pop()\n\t\tstate = item.(*searchstate)\n\n\t\t// Only consider non expanded nodes (not present in closedSet)\n\t\tif _, ok := closedSet[state.node]; !ok {\n\t\t\t// Store this node in the closed list, with a reference to its parent\n\t\t\tclosedSet[state.node] = state.parent\n\n\t\t\tif state.node == goal && start != goal {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Add the nodes not present in the closedSet into the openSet\n\t\t\tsucc, ok := graph.Neighbors(state.node)\n\t\t\tif !ok {\n\t\t\t\tcontinue // Malformed Graph. Skip this node\n\t\t\t}\n\n\t\t\t// for depth-first search, we have to alter the order in which we add the successors to the stack,\n\t\t\t// to ensure items are expanded as expected (in the order they have been passed in)\n\t\t\tif algo == DepthFirstSearch {\n\t\t\t\tfor i, j := 0, len(succ)-1; i < j; i, j = i+1, j-1 {\n\t\t\t\t\tsucc[i], succ[j] = succ[j], succ[i]\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor _, node := range succ {\n\t\t\t\tif _, ok := closedSet[node]; !ok {\n\t\t\t\t\tif edge, ok := graph.Edge(state.node, node); ok {\n\t\t\t\t\t\tnextState := &searchstate{node, state.node, state.cost + edge.Weight}\n\t\t\t\t\t\topenSet.Push(nextState, nextState.cost+heuristic(node, goal))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "c39d389c5428cf128e95823178153cb8", "score": "0.53472334", "text": "func siftDown(i int, array []Comparable, n int) {\n\t// parent(i) = (i-1)/2\n\t// leftchild(i) = 2i+1\n\t// rightchild(i) = 2i+2.\n\n\t// we want to move temp down the heap\n\t// until it fulfills the heap-order property\n\ttemp := array[i]\n\t// child starts as the left child of i\n\tchild := 2*i + 1\n\tfor child < n {\n\t\t// if right child is within heap (bounds checking)\n\t\t// and the right child is larger than the left\n\t\tif child+1 < n && array[child].Compare(array[child+1]) < 0 {\n\t\t\t// right child exists and is bigger\n\t\t\t// so set child to the right child\n\t\t\tchild++\n\t\t}\n\t\t// Is the largest child larger than the node we're trying to move down?\n\t\tif array[child].Compare(temp) > 0 {\n\t\t\tarray[i] = array[child] // overwrite that node with the child\n\t\t\ti = child // move the current node to the child\n\t\t\tchild = 2*i + 1 // and look at its left child\n\t\t} else {\n\t\t\t// if temp isn't bigger than the child\n\t\t\t// then it's in the right place and we can stop\n\t\t\tbreak\n\t\t}\n\t}\n\tarray[i] = temp\n}", "title": "" }, { "docid": "9bb8354ecc1c11bf9aa57507c4c6ae77", "score": "0.5344128", "text": "func (th treeHeap) Swap(i, j int) {\n\tth[i], th[j] = th[j], th[i]\n}", "title": "" }, { "docid": "544e0a47ff6e27be606dd5000a913304", "score": "0.53418756", "text": "func shortestPathBinaryMatrix(grid [][]int) int {\n\t// DP:DFS -> F(i,j) = min(F(i-1,j-1),F(i-1,j),F(i-1,j+1),F(i,j-1)...)+1:行不通\n\t// BFS\n\tr, c := len(grid), len(grid[0])\n\tif grid[0][0] == 1 || grid[r-1][c-1] == 1 {\n\t\treturn -1\n\t}\n\tdp := make([][]int, r)\n\tfor i := 0; i < r; i++ {\n\t\tdp[i] = make([]int, c)\n\t}\n\tdx, dy := [8]int{-1, -1, -1, 0, 0, 1, 1, 1}, [8]int{-1, 0, 1, -1, 1, -1, 0, 1}\n\tdp[0][0] = 1\n\tqueue := []*Point{{0, 0}}\n\t//for len(queue) > 0 && dp[r-1][c-1] == 0 {\n\t//\tcurr := queue[0]\n\t//\tfor i := 0; i < 8; i++ {\n\t//\t\tnX, nY := curr.x+dx[i], curr.y+dy[i]\n\t//\t\tif nX >= 0 && nX < r && nY >= 0 && nY < c && grid[nX][nY] == 0 && dp[nX][nY] == 0 {\n\t//\t\t\tdp[nX][nY] = dp[curr.x][curr.y] + 1\n\t//\t\t\t//if nX == eX && nY == eY { // 找到答案\n\t//\t\t\t//\treturn dp[nX][nY]\n\t//\t\t\t//}\n\t//\t\t\tqueue = append(queue, &Point{nX, nY})\n\t//\t\t}\n\t//\t}\n\t//\tqueue = queue[1:]\n\t//}\n\tfor idx := 0; idx < len(queue) && dp[r-1][c-1] == 0; idx++ {\n\t\tcurr := queue[idx]\n\t\tfor i := 0; i < 8; i++ {\n\t\t\tnX, nY := curr.x+dx[i], curr.y+dy[i]\n\t\t\tif nX >= 0 && nX < r && nY >= 0 && nY < c && grid[nX][nY] == 0 && dp[nX][nY] == 0 {\n\t\t\t\tdp[nX][nY] = dp[curr.x][curr.y] + 1\n\t\t\t\t//if nX == eX && nY == eY { // 找到答案\n\t\t\t\t//\treturn dp[nX][nY]\n\t\t\t\t//}\n\t\t\t\tqueue = append(queue, &Point{nX, nY})\n\t\t\t}\n\t\t}\n\t}\n\tif dp[r-1][c-1] == 0 {\n\t\treturn -1\n\t}\n\treturn dp[r-1][c-1]\n}", "title": "" }, { "docid": "813db876b84ea082795481406524f652", "score": "0.53390145", "text": "func (tree *Tree) BreadthFirst(list *LinkedList) {\n\ttree.RLock()\n\tdefer tree.RUnlock()\n\tvar queue Queue\n\tqueue.Push(tree.root)\n\tfor queue.Size() > 0 {\n\t\tnode := queue.Pop().(*TreeNode)\n\t\tlist.Insert(node.key)\n\t\tif node.left != nil {\n\t\t\tqueue.Push(node.left)\n\t\t}\n\t\tif node.right != nil {\n\t\t\tqueue.Push(node.right)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "82d0c868a09141fa0843b9a3e3f0996d", "score": "0.5324997", "text": "func (g *Graph) BfsWalk(start *Vertex) {\n\tstatus := make(map[*Vertex]bool) // true == > visited ,false == > unvisited\n\tfor _, v := range g.Vertices {\n\t\tstatus[v] = false\n\t}\n\tqueue := NewQueue(10 * len(g.Vertices))\n\tstatus[start] = true\n\tqueue.Enqueue(start)\n\tfor !queue.IsEmpty() {\n\t\tstart, _ = queue.Dequeue()\n\t\tfor _, edge := range start.Edges {\n\t\t\tif !status[edge.End] {\n\t\t\t\tedgeState[edge] = true\n\t\t\t\tstatus[edge.End] = true\n\t\t\t\tcounter++\n\t\t\t\tqueue.Enqueue(edge.End)\n\t\t\t} else if !status[edge.Start] {\n\t\t\t\tedgeState[edge] = true\n\t\t\t\tcounter++\n\t\t\t\tstatus[edge.Start] = true\n\t\t\t\tqueue.Enqueue(edge.Start)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "aaeb517c284847b382923978303814af", "score": "0.53191084", "text": "func generateTree(current *node, lastMove, lastMove2 coordinate) {\n\tvar y int8\n\tvar x int8\n\tvar threatSpace int8 = 4\t// Depth 10 works with threatSpace = 1\n\n\tfor y = lastMove.y - threatSpace; y <= lastMove.y+threatSpace; y++ {\n\t\tfor x = lastMove.x - threatSpace; x <= lastMove.x+threatSpace; x++ {\n\t\t\tgenerateBoards(current, lastMove, y, x)\n\t\t}\n\t}\n\tfor y = lastMove2.y - threatSpace; y <= lastMove2.y+threatSpace; y++ {\n\t\tfor x = lastMove2.x - threatSpace; x <= lastMove2.x+threatSpace; x++ {\n\t\t\tif !(y >= lastMove.y-threatSpace && y <= lastMove.y+threatSpace && x >= lastMove.x-threatSpace && x <= lastMove.x+threatSpace) {\n\t\t\t\t// optimized so the threat-space searches don't overlap\n\t\t\t\tgenerateBoards(current, lastMove2, y, x)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2f9d52658d2d0a4052c9db3dafb51ca2", "score": "0.53078306", "text": "func assignGroup(remaining []entry, left, right *rTreeNode, minBranch int) {\n\n\tvar nextIdx int\n\tvar bestLeftDiff, bestRightDiff float64\n\n\tfor len(remaining) > 0 {\n\n\t\tmaxDiff := -1.0\n\n\t\tleftBB := left.computeBoundingBox()\n\t\trightBB := right.computeBoundingBox()\n\n\t\tfor i, e := range remaining {\n\t\t\tleftDiff := boundingBox(leftBB, e.bb).size - leftBB.size\n\t\t\trightDiff := boundingBox(rightBB, e.bb).size - rightBB.size\n\t\t\tdiff := math.Abs(leftDiff - rightDiff)\n\t\t\tif diff > maxDiff {\n\t\t\t\tmaxDiff = diff\n\n\t\t\t\tbestLeftDiff = leftDiff\n\t\t\t\tbestRightDiff = rightDiff\n\t\t\t\tnextIdx = i\n\t\t\t}\n\t\t}\n\n\t\tnextE := remaining[nextIdx]\n\n\t\tswitch {\n\t\t// prevent underflow of branches\n\t\tcase len(left.entries)+len(remaining) <= minBranch:\n\t\t\tassign(nextE, left)\n\t\tcase len(right.entries)+len(remaining) <= minBranch:\n\t\t\tassign(nextE, right)\n\n\t\t// choose the split node with least enlargement\n\t\tcase bestLeftDiff < bestRightDiff:\n\t\t\tassign(nextE, left)\n\t\tcase bestRightDiff < bestLeftDiff:\n\t\t\tassign(nextE, right)\n\n\t\t// in tie, choose the split node with the smaller area\n\t\tcase leftBB.size < rightBB.size:\n\t\t\tassign(nextE, left)\n\t\tcase rightBB.size < leftBB.size:\n\t\t\tassign(nextE, right)\n\n\t\t// in tie, choose node with fewer entries\n\t\tcase len(left.entries) < len(right.entries):\n\t\t\tassign(nextE, left)\n\t\tdefault:\n\t\t\tassign(nextE, right)\n\t\t}\n\n\t\t// update remaining entries to be inserted\n\t\tremaining = append(remaining[:nextIdx], remaining[nextIdx+1:]...)\n\t}\n}", "title": "" }, { "docid": "3c435a7521d89c253d61a381d8cc4064", "score": "0.5301834", "text": "func build(tree[][]int, data []int, ind, left, right int) {\n\tif left == right {\n\t\ttree[ind] = data[left: left+1] // single element array, refer to data since we won't update\n\t\treturn\n\t}\n\tleftSub, rightSub, mid := ind*2+1, ind*2+2, left+(right-left)/2\n\tbuild(tree, data, leftSub, left, mid) \n\tbuild(tree, data, rightSub, mid+1, right)\n\n\t// merge two sub trees: merge 2 sorted lists\n\ttree[ind] = make([]int, right-left+1)\n\ti, j, llen, rlen := 0, 0, mid-left+1, right-mid\n\tfor i < llen && j < rlen {\n\t\tif tree[leftSub][i] < tree[rightSub][j] {\n\t\t\ttree[ind][i+j] = tree[leftSub][i]\n\t\t\ti++\n\t\t} else {\n\t\t\ttree[ind][i+j] = tree[rightSub][j]\n\t\t\tj++\n\t\t}\n\t}\n\tfor i < llen {\n\t\ttree[ind][i+j] = tree[leftSub][i]\n\t\ti++\n\t}\n\tfor j < rlen {\n\t\ttree[ind][i+j] = tree[rightSub][j]\n\t\tj++\n\t}\n}", "title": "" }, { "docid": "a4078c892b015910bfc6d65ae91085fe", "score": "0.52950656", "text": "func (t *FHQTreap) merge(x, y int) int {\r\n\tif x == 0 || y == 0 {\r\n\t\treturn x + y\r\n\t}\r\n\r\n\tif int(t.fastRand()*(uint64(t.nodes[x].size)+uint64(t.nodes[y].size))>>32) < t.nodes[x].size {\r\n\t\tt.pushDown(x)\r\n\t\tt.nodes[x].right = t.merge(t.nodes[x].right, y)\r\n\t\tt.pushUp(x)\r\n\t\treturn x\r\n\t} else {\r\n\t\tt.pushDown(y)\r\n\t\tt.nodes[y].left = t.merge(x, t.nodes[y].left)\r\n\t\tt.pushUp(y)\r\n\t\treturn y\r\n\t}\r\n}", "title": "" }, { "docid": "8ef10af3adc7ea26f779ac1d9873db7b", "score": "0.52950364", "text": "func (heap *Heap) bubbleDown() {\n\tindex := 0\n\tsize := heap.list.Size()\n\tfor leftIndex := index<<1 + 1; leftIndex < size; leftIndex = index<<1 + 1 {\n\t\trightIndex := index<<1 + 2\n\t\tsmallerIndex := leftIndex\n\t\tleftValue, _ := heap.list.Get(leftIndex)\n\t\trightValue, _ := heap.list.Get(rightIndex)\n\t\tif rightIndex < size && heap.comparator(leftValue, rightValue) > 0 {\n\t\t\tsmallerIndex = rightIndex\n\t\t}\n\t\tindexValue, _ := heap.list.Get(index)\n\t\tsmallerValue, _ := heap.list.Get(smallerIndex)\n\t\tif heap.comparator(indexValue, smallerValue) > 0 {\n\t\t\theap.list.Swap(index, smallerIndex)\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t\tindex = smallerIndex\n\t}\n}", "title": "" }, { "docid": "56cdaa125c722910228dd4d86ca19b87", "score": "0.5294357", "text": "func BFS(adj [][]int, s int) int {\n\n\tcounter := 0\n\tn := len(adj)\n\tvisited := make([]bool, n)\n\tq := make([]int, 0)\n\n\tvisited[s] = true\n\tq = append(q, s)\n\n\tfor len(q) != 0 {\n\t\ts = q[len(q)-1]\n\t\tq = q[:len(q)-1]\n\n\t\tfor i, val := range adj[s] {\n\t\t\tif visited[i] == false && val != 0 {\n\t\t\t\tq = append(q, i)\n\t\t\t\tvisited[i] = true\n\t\t\t\tcounter++\n\n\t\t\t}\n\t\t}\n\t}\n\n\treturn counter\n}", "title": "" }, { "docid": "e63baad7107e1882001187f8370fdbbb", "score": "0.52929246", "text": "func topologicalSort2(graph *Graph, workerCount int, timeBase int) (NodeList, error) {\n\tinDegree := make(map[Node]int, len(graph.nodes))\n\tfor _, n := range graph.nodes {\n\t\tinDegree[n] = 0\n\t}\n\n\t// Store lists of edges nodes in a map.\n\tadjacency := make(map[Node]NodeList, len(graph.nodes))\n\n\tfor _, e := range graph.edges {\n\t\tif _, ok := adjacency[e.start]; !ok {\n\t\t\tadjacency[e.start] = NodeList{e.end}\n\t\t} else {\n\t\t\tadjacency[e.start] = append(adjacency[e.start], e.end)\n\t\t}\n\t}\n\n\t// Initialize in-degree for each node.\n\tfor _, v := range adjacency {\n\t\tfor _, v2 := range v {\n\t\t\tinDegree[v2]++\n\t\t}\n\t}\n\n\t// Enqueue all vertices with in-degree of 0.\n\tqueue := make(NodeList, 0)\n\tfor k, v := range inDegree {\n\t\tif v == 0 {\n\t\t\tqueue = append(queue, k)\n\t\t}\n\t}\n\n\t// Counter of visited vertices.\n\tcount := 0\n\n\t// Store result.\n\torder := make(NodeList, 0)\n\n\tt := 0\n\tworkers := make(Workers, workerCount)\n\n\tvar u Node\n\tfor {\n\t\tif len(queue) == 0 && workers.AllIdle() {\n\t\t\tworkers.Print(t, order)\n\t\t\tbreak\n\t\t}\n\n\t\t// Assign as many workers as possible.\n\t\tfor {\n\t\t\tif len(queue) == 0 || workers.AllOccupied() {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tworker, err := workers.FirstIdleWorker()\n\t\t\tif err == nil && len(queue) > 0 {\n\t\t\t\tsort.Sort(queue)\n\t\t\t\tu, queue = queue[0], queue[1:]\n\t\t\t\tworkers[worker] = &Task{u, int(u) - 'A' + timeBase}\n\t\t\t}\n\t\t}\n\n\t\tworkers.Print(t, order)\n\n\t\tfor _, task := range workers {\n\t\t\tif task != nil && task.progress == 0 {\n\t\t\t\t// Update state when task is finished.\n\t\t\t\torder = append(order, task.node)\n\t\t\t\tfor _, n := range adjacency[task.node] {\n\t\t\t\t\tinDegree[n]--\n\t\t\t\t\tif inDegree[n] == 0 {\n\t\t\t\t\t\tqueue = append(queue, n)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcount++\n\t\t\t}\n\t\t}\n\n\t\tworkers.Step()\n\n\t\tt++\n\t}\n\n\tif count != len(graph.nodes) {\n\t\treturn nil, errors.New(\"cycle detected\")\n\t}\n\n\treturn order, nil\n}", "title": "" }, { "docid": "1983fde4863637a456bbafb7f06bd0b8", "score": "0.52888393", "text": "func bfs(s string, adj map[string][]string) map[string]string {\n\n\tfrontier := []string{s}\n\tlevel := make(map[string]int) // visited\n\tparent := make(map[string]string)\n\ti := 0\n\tlevel[s] = i\n\tfor len(frontier) != 0 {\n\t\tfor _, u := range frontier {\n\n\t\t\tnext := []string{}\n\t\t\tfor _, v := range adj[u] {\n\t\t\t\tif _, exist := level[v]; !exist {\n\t\t\t\t\ti++\n\t\t\t\t\tlevel[v] = i\n\t\t\t\t\tnext = append(next, v)\n\t\t\t\t\tparent[v] = u\n\t\t\t\t}\n\t\t\t}\n\t\t\tfrontier = next\n\t\t}\n\n\t}\n\treturn parent\n\n}", "title": "" }, { "docid": "f2b66cec77414d7db3a0ed66dc74c0c9", "score": "0.52867466", "text": "func (bsw BPTreeRootIdxWrapper) Swap(i, j int) {\n\tbsw.BSGroup[i], bsw.BSGroup[j] = bsw.BSGroup[j], bsw.BSGroup[i]\n}", "title": "" }, { "docid": "af37de2b870b7437522b1c3d8eeb1cfb", "score": "0.5280471", "text": "func (node *TreeNode) recursivePostOrder(result *LinkedList) {\n\tif node == nil {\n\t\treturn\n\t}\n\tnode.left.recursivePostOrder(result)\n\tnode.right.recursivePostOrder(result)\n\tresult.Insert(node.key)\n}", "title": "" }, { "docid": "241e1325f5e64118d07f95eec341577b", "score": "0.527418", "text": "func CreatePath(g Graph, node int) PathImpl {\n\tmarked := make([]bool, g.Vertices())\n\tpathTo := make([]int, g.Vertices())\n\tfor i := 0; i < len(pathTo); i++ {\n\t\tpathTo[i] = -1\n\t}\n\ttodo := make([]int, 0, g.Vertices())\n\tadjacent := make([][]int, 0, g.Vertices()) //is it better to add capacity and append?\n\t//populate adjacent\n\tfor i := 0; i < g.Vertices(); i++ {\n\t\tadjacent = append(adjacent, g.Adjacent(i))\n\t}\n\tlog.Println(adjacent)\n\t//DFS in a while loop\n\ttodo = append(todo, node)\n\tpathTo[node] = node\n\tfor len(todo) > 0 {\n\t\tcurrent := todo[len(todo)-1] //using slice as a stack just keep taking the last one\n\t\tmarked[current] = true\n\n\t\tif len(adjacent[current]) > 0 {\n\t\t\tnext := adjacent[current][len(adjacent[current])-1]\n\t\t\tadjacent[current] = adjacent[current][:len(adjacent[current])-1] //pop, ideally pull one at random instead of from end every time\n\t\t\tfor marked[next] && len(adjacent[current]) > 0 {\n\t\t\t\tadjacent[current] = adjacent[current][:len(adjacent[current])-1] //pop, ideally pull one at random instead of from end every time\n\t\t\t\tnext = adjacent[current][len(adjacent[current])-1]\n\t\t\t}\n\t\t\tif len(adjacent[current]) == 0 && marked[next] {\n\t\t\t\tlog.Printf(\"finished processing %d, it has no more adjacents\", todo[len(todo)-1])\n\t\t\t\ttodo = todo[:len(todo)-1] //pop\n\t\t\t} else {\n\t\t\t\ttodo = append(todo, next)\n\t\t\t\tlog.Printf(\"processing next %d and removing from adjacent slice, adj is now %v todo is %v\\n\", next, adjacent[current], todo)\n\t\t\t\t//first encounter\n\t\t\t\tlog.Printf(\"setting path to %d as %d \\n\", next, current)\n\t\t\t\tpathTo[next] = current\n\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Printf(\"finished processing %d, it has no more adjacents\", todo[len(todo)-1])\n\t\t\ttodo = todo[:len(todo)-1] //pop\n\t\t}\n\n\t}\n\treturn PathImpl{\n\t\tfromNode: node,\n\t\tpathTo: pathTo,\n\t}\n\t// return nil\n}", "title": "" }, { "docid": "05432cdd614a6d12d3a24207183273ce", "score": "0.5272316", "text": "func breadthFirst(f func(item string) []string, worklist [] string) {\n // dictionary to keep track of nodes that are already visited\n seen := make(map[string]bool)\n for len(worklist) > 0 {\n items := worklist\n worklist = nil\n for _, item := range items {\n if !seen[item]{\n seen[item] = true\n // the ... opeartor does unpacking of list returned by f\n // this causes all the items in the ;ist returned by f to\n // be appended to worklist\n worklist = append(worklist, f(item)...)\n }\n }\n }\n}", "title": "" }, { "docid": "6ba0bcbf98767f99ca496a1c566f6e57", "score": "0.52671945", "text": "func (m *Map) rotateRight(n, p *node) (*node, *node) {\n\t//_ = assertOn && assert(l == n.ln, \"new node is not left child of new parent\")\n\t//_ = assertOn && assert(p == nil || n == p.rn,\n\t//\t\"node is not the right child of parent\")\n\tvar l = n.ln //assume n.ln is already a copy.\n\n\tif p != nil {\n\t\tif n.isLeftChildOf(p) {\n\t\t\tp.ln = l\n\t\t} else {\n\t\t\tp.rn = l\n\t\t}\n\t} /* else {\n\t\tm.root = l\n\t} */\n\n\tn.ln = l.rn //handle anticipated orphaned node\n\tl.rn = n //now orphan it\n\n\treturn n, l\n}", "title": "" }, { "docid": "044f5fa94349253f0237105f1c7a911a", "score": "0.5266299", "text": "func removeDupe(root *Node) {\n\n if root != nil {\n // fuck... should bail one early..\n for curP := root ; curP != nil ; curP = (*curP).next {\n fmt.Println(\"curP\", curP)\n // inner loop should not assign to outer loop...\n for prevP, nextP := curP, (*curP).next ; nextP != nil ; {\n fmt.Println(\">NP PP\",nextP, prevP)\n if (*nextP).val == (*curP).val {\n fmt.Println(\"deleting\")\n tempP := nextP\n nextP = (*nextP).next\n (*tempP).next = nil\n (*prevP).next = nextP\n } else {\n // this increment should only happen if you are not deleting something...\n fmt.Println(\"increment\")\n prevP = (*prevP).next\n nextP = (*nextP).next\n }\n }\n fmt.Println(\">>>>>>>\")\n printList(root)\n }\n }\n}", "title": "" }, { "docid": "d8b22b212a04e857e43f45249e42188c", "score": "0.52662325", "text": "func buildTree2(inorder []int, postorder []int) *TreeNode {\n\n\tif inorder == nil || len(inorder) == 0 {\n\t\treturn nil\n\t}\n\tif len(inorder) == 1 {\n\t\treturn &TreeNode{Val: inorder[0]}\n\t}\n\n\troot := postorder[len(postorder)-1]\n\trootNode := &TreeNode{Val: root}\n\trootIndex := 0\n\tfor i := 0; i < len(inorder); i++ {\n\t\tif inorder[i] == root {\n\t\t\trootIndex = i\n\t\t\tbreak\n\t\t}\n\t}\n\n\tleftInorder := inorder[:rootIndex]\n\tleftPostOrder := postorder[:len(leftInorder)]\n\trightInorder := inorder[rootIndex+1:]\n\trightPostOrder := postorder[len(leftInorder) : len(leftInorder)+len(rightInorder)]\n\trootNode.Left = buildTree(leftInorder, leftPostOrder)\n\trootNode.Right = buildTree(rightInorder, rightPostOrder)\n\n\treturn rootNode\n\n}", "title": "" }, { "docid": "651d317fd2f2bd64a2514df6530777fc", "score": "0.5264908", "text": "func SwapActiveNodes(an []string){\r\n\tMtx.Lock()\r\n\tActiveNodes = an\r\n\tMtx.Unlock()\r\n\r\n}", "title": "" }, { "docid": "bab46db7410d8fce9788ad5a423b7e28", "score": "0.5262546", "text": "func solveGraph(g *Graph) {\n\tfmt.Fprintln(os.Stderr, \"Grafo:\\n\", g)\n\tfor _, node := range g.getActiveNodes() {\n\t\tnear := g.getActiveNeighbours(node)\n\t\tfmt.Fprintln(os.Stderr, node)\n\t\tfmt.Fprintln(os.Stderr, near)\n\t\tif len(near)*2 == node.size {\n\t\t\tg.makeConnection(node, 2, near)\n\t\t} else if node.size == 1 && len(near) == 1 {\n\t\t\tg.makeConnection(node, 1, near)\n\t\t} else if node.size == 2 && len(near) == 2 {\n\t\t\tg.makeConnection(node, 1, near[:len(near)-2])\n\t\t\tg.makeConnection(node, 1, near[len(near)-2:])\n\n\t\t} else if node.size == 3 && len(near) == 2 {\n\t\t\tnear1 := near[0]\n\t\t\tnear2 := near[1]\n\t\t\tif near1.size+near2.size == 3 {\n\t\t\t\tif near1.size == 1 {\n\t\t\t\t\tg.makeConnection(node, 1, near[:len(near)-1])\n\t\t\t\t\tg.makeConnection(node, 2, near[len(near)-2:])\n\t\t\t\t} else {\n\t\t\t\t\tg.makeConnection(node, 2, near[:len(near)-1])\n\t\t\t\t\tg.makeConnection(node, 1, near[len(near)-2:])\n\t\t\t\t}\n\t\t\t}\n\t\t} else if len(near) == node.size {\n\t\t\tg.makeConnection(node, 1, near)\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "12dd7dad051d1eeae4b8321f8f667291", "score": "0.52552783", "text": "func bstFromPreorderHelper(preorder []int, i *int, upperBound int) *TreeNode {\n\tif *i == len(preorder) || preorder[*i] > upperBound {\n\t\treturn nil\n\t}\n\troot := &TreeNode{preorder[*i], nil, nil}\n\t*i++\n\troot.Left = bstFromPreorderHelper(preorder, i, root.Val)\n\troot.Right = bstFromPreorderHelper(preorder, i, upperBound)\n\n\treturn root\n}", "title": "" }, { "docid": "9b0c1ae7cbe82cfb3c2e6b34ade26bf4", "score": "0.52528715", "text": "func (c ConnectedNodeList) Swap(i, j int) {\n\tc[i], c[j] = c[j], c[i]\n}", "title": "" }, { "docid": "ee5d2b8bb76078af0ce5145638679863", "score": "0.5252248", "text": "func siftDown_func(data lessSwap, lo, hi, first int) {\r\n\troot := lo\r\n\tfor {\r\n\t\tchild := 2*root + 1\r\n\t\tif child >= hi {\r\n\t\t\tbreak\r\n\t\t}\r\n\t\tif child+1 < hi && data.Less(first+child, first+child+1) {\r\n\t\t\tchild++\r\n\t\t}\r\n\t\tif !data.Less(first+root, first+child) {\r\n\t\t\treturn\r\n\t\t}\r\n\t\tdata.Swap(first+root, first+child)\r\n\t\troot = child\r\n\t}\r\n}", "title": "" }, { "docid": "25e5d176d45be149cd8300656a4e38a5", "score": "0.52317685", "text": "func (g *Graph) BFS(src Node) (map[Node]int, error) {\n\tcosts := make(map[Node]int)\n\tfor _, n := range g.Nodes() {\n\t\tcosts[n] = -1\n\t}\n\tif _, ok := g.graph[src]; !ok {\n\t\treturn nil, fmt.Errorf(\"source node %v not in graph\", src)\n\t}\n\tcosts[src] = 0\n\n\tlevel := []Node{src}\n\tfor jumps := 1; len(level) > 0; jumps++ {\n\t\tvar nextLevel []Node\n\t\tfor _, u := range level {\n\t\t\tvs, _ := g.Neighbours(u)\n\t\t\tfor _, v := range vs {\n\t\t\t\tif costs[v] != -1 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tcosts[v] = jumps\n\t\t\t\tnextLevel = append(nextLevel, v)\n\t\t\t}\n\t\t}\n\t\tlevel = nextLevel\n\t}\n\treturn costs, nil\n}", "title": "" }, { "docid": "8807abf2e84ae8d8760bf023021caaad", "score": "0.5229504", "text": "func main() {\n\troot := NewNode('A')\n\tnodeB := root.AddChildElement('B')\n\tnodeC := root.AddChildElement('C')\n\n\tnodeB.AddChildElement('D')\n\tnodeB.AddChildElement('E')\n\tnodeC.AddChildElement('F')\n\n\tBreadthFirstSearch(root)\n}", "title": "" } ]
3d7f8dd403a054a6d3c1723da0909f85
Decode parses a xbps plist stream into a `Pkgdb`
[ { "docid": "225198721de3cc792ea01c7f4e30ab08", "score": "0.72580856", "text": "func Decode(r io.Reader) (Pkgdb, error) {\n\tret := make(Pkgdb)\n\terr := plist.NewDecoder(r).Decode(&ret)\n\treturn ret, err\n\n}", "title": "" } ]
[ { "docid": "7e9542a6fe41ce334d6da4024d52fdd2", "score": "0.639947", "text": "func (p *Decoder) Decode(v interface{}) (err error) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tif _, ok := r.(runtime.Error); ok {\n\t\t\t\tpanic(r)\n\t\t\t}\n\t\t\terr = r.(error)\n\t\t}\n\t}()\n\n\theader := make([]byte, 6)\n\tp.reader.Read(header)\n\tp.reader.Seek(0, 0)\n\n\tvar parser parser\n\tvar pval cfValue\n\tif bytes.Equal(header, []byte(\"bplist\")) {\n\t\tparser = newBplistParser(p.reader)\n\t\tpval, err = parser.parseDocument()\n\t\tif err != nil {\n\t\t\t// Had a bplist header, but still got an error: we have to die here.\n\t\t\treturn err\n\t\t}\n\t\tp.Format = BinaryFormat\n\t} else {\n\t\tparser = newXMLPlistParser(p.reader)\n\t\tpval, err = parser.parseDocument()\n\t\tif _, ok := err.(invalidPlistError); ok {\n\t\t\t// Rewind: the XML parser might have exhausted the file.\n\t\t\tp.reader.Seek(0, 0)\n\t\t\t// We don't use parser here because we want the textPlistParser type\n\t\t\ttp := newTextPlistParser(p.reader)\n\t\t\tpval, err = tp.parseDocument()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tp.Format = tp.format\n\t\t\tif p.Format == OpenStepFormat {\n\t\t\t\t// OpenStep property lists can only store strings,\n\t\t\t\t// so we have to turn on lax mode here for the unmarshal step later.\n\t\t\t\tp.lax = true\n\t\t\t}\n\t\t} else {\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tp.Format = XMLFormat\n\t\t}\n\t}\n\n\tp.unmarshal(pval, reflect.ValueOf(v))\n\treturn\n}", "title": "" }, { "docid": "350fe3a41fde6b7bdbb5c843243e0a71", "score": "0.57997555", "text": "func (d *Decoder) Decode(v *Plist) error {\n\tstart, err := d.decodeStartElement(\"plist\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(start.Attr) != 1 || start.Attr[0].Name.Local != \"version\" {\n\t\treturn fmt.Errorf(\"plist: missing version\")\n\t}\n\tv.Version = start.Attr[0].Value\n\n\t// Start element of plist content\n\tse, ee, err := d.decodeStartOrEndElement(\"\", *start)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif ee != nil {\n\t\t// empty plist\n\t\tdebug(\"empty plist\")\n\t\treturn nil\n\t}\n\n\tswitch se.Name.Local {\n\tcase \"dict\":\n\t\td, err := d.decodeDict(*se)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdebug(\"read dict: %s\", d)\n\t\tv.Root = d\n\tcase \"array\":\n\t\ta, err := d.decodeArray(*se)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdebug(\"read array: %s\", a)\n\t\tv.Root = a\n\tdefault:\n\t\treturn fmt.Errorf(\"plist: bad root element: must be dict or array\")\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "06856c11918ea555fc6cd417efa3f423", "score": "0.5572046", "text": "func DecodeRepoData(r io.Reader) (Pkgdb, error) {\n\tvar err error\n\n\trgz, err := gzip.NewReader(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer closer.Do(rgz)\n\n\trtar := tar.NewReader(rgz)\n\n\tfor {\n\t\tvar h *tar.Header\n\t\th, err = rtar.Next()\n\t\tif err == nil && h.Name == \"index.plist\" {\n\t\t\treturn Decode(rtar)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "01a6ae1aec7df72a9fa00160b6e6b7bf", "score": "0.53917146", "text": "func (plistCodec PlistCodec) Decode(r io.Reader) ([]byte, error) {\n\tif r == nil {\n\t\treturn nil, errors.New(\"Reader was nil\")\n\t}\n\tbuf := make([]byte, 4)\n\terr := binary.Read(r, binary.BigEndian, buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlength := binary.BigEndian.Uint32(buf)\n\tpayloadBytes := make([]byte, length)\n\tn, err := io.ReadFull(r, payloadBytes)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"lockdown Payload had incorrect size: %d expected: %d original error: %s\", n, length, err)\n\t}\n\treturn payloadBytes, nil\n}", "title": "" }, { "docid": "7407850b096ce19d65fdeaeed7fc9f39", "score": "0.5353431", "text": "func parseDpkgDB(scanner *bufio.Scanner) (binaryPackage *database.Feature, sourcePackage *database.Feature) {\n\tvar (\n\t\tname string\n\t\tversion string\n\t\tsourceName string\n\t\tsourceVersion string\n\t)\n\n\tfor {\n\t\tline := strings.TrimSpace(scanner.Text())\n\t\tif line == \"\" {\n\t\t\tbreak\n\t\t}\n\n\t\tif strings.HasPrefix(line, \"Package: \") {\n\t\t\tname = strings.TrimSpace(strings.TrimPrefix(line, \"Package: \"))\n\t\t} else if strings.HasPrefix(line, \"Source: \") {\n\t\t\t// Source line (Optional)\n\t\t\t// Gives the name of the source package\n\t\t\t// May also specifies a version\n\n\t\t\tsrcCapture := dpkgSrcCaptureRegexp.FindAllStringSubmatch(line, -1)[0]\n\t\t\tmd := map[string]string{}\n\t\t\tfor i, n := range srcCapture {\n\t\t\t\tmd[dpkgSrcCaptureRegexpNames[i]] = strings.TrimSpace(n)\n\t\t\t}\n\n\t\t\tsourceName = md[\"name\"]\n\t\t\tif md[\"version\"] != \"\" {\n\t\t\t\tsourceVersion = md[\"version\"]\n\t\t\t}\n\t\t} else if strings.HasPrefix(line, \"Version: \") {\n\t\t\t// Version line\n\t\t\t// Defines the version of the package\n\t\t\t// This version is less important than a version retrieved from a Source line\n\t\t\t// because the Debian vulnerabilities often skips the epoch from the Version field\n\t\t\t// which is not present in the Source version, and because +bX revisions don't matter\n\t\t\tversion = strings.TrimPrefix(line, \"Version: \")\n\t\t}\n\n\t\tif !scanner.Scan() {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif name != \"\" && version != \"\" {\n\t\tif err := versionfmt.Valid(dpkg.ParserName, version); err != nil {\n\t\t\tlog.WithError(err).WithFields(log.Fields{\"name\": name, \"version\": version}).Warning(\"skipped unparseable package\")\n\t\t} else {\n\t\t\tbinaryPackage = &database.Feature{name, version, dpkg.ParserName, database.BinaryPackage}\n\t\t}\n\t}\n\n\t// Source version and names are computed from binary package names and versions\n\t// in dpkg.\n\t// Source package name:\n\t// https://git.dpkg.org/cgit/dpkg/dpkg.git/tree/lib/dpkg/pkg-format.c#n338\n\t// Source package version:\n\t// https://git.dpkg.org/cgit/dpkg/dpkg.git/tree/lib/dpkg/pkg-format.c#n355\n\tif sourceName == \"\" {\n\t\tsourceName = name\n\t}\n\n\tif sourceVersion == \"\" {\n\t\tsourceVersion = version\n\t}\n\n\tif sourceName != \"\" && sourceVersion != \"\" {\n\t\tif err := versionfmt.Valid(dpkg.ParserName, version); err != nil {\n\t\t\tlog.WithError(err).WithFields(log.Fields{\"name\": name, \"version\": version}).Warning(\"skipped unparseable package\")\n\t\t} else {\n\t\t\tsourcePackage = &database.Feature{sourceName, sourceVersion, dpkg.ParserName, database.SourcePackage}\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "ef0ef4f6de2b71c5942a8fe8be6765e2", "score": "0.53481746", "text": "func Decode(spack string) (result pkg.Package, err error) {\n\tscnr := scanner.Scanner{}\n\tparsr := parser.Parser{}\n\tscnr.Init(spack)\n\n\terr = parsr.Parse(scnr, &result)\n\tif err != nil {\n\t\treturn result, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "3ecf46c1d07deed01e492f3a5ba6010e", "score": "0.53162944", "text": "func readListPackV2(slice *sliceBuffer) (value []byte, err error) {\n\tvar special byte\n\tif special, err = slice.ReadByte(); err != nil {\n\t\treturn nil, err\n\t}\n\tif (special & rdbLpEncoding7BitUintMask) == rdbLpEncoding7BitUint { // mask 128 -> 0xxx xxxx\n\t\tslice.Skip(1)\n\t\tvalue = i642bytes((uint64(special) & 0x7f)) // 0x7f 127\n\n\t} else if (special & rdbLpEncoding6BitStrMask) == rdbLpEncoding6BitStr { // mask 192 -> 00xx xxxx\n\t\tlen := special & 0x3f // 0x3f 63\n\t\tskip := 1 + int(len)\n\t\tvalue, err = slice.First(int(len))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tslice.Skip(int(skip))\n\n\t} else if (special & rdbLpEncoding13BitIntMask) == rdbLpEncoding13BitInt { // mask 224 -> 000x xxxx\n\t\tnext, err := slice.ReadByte()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvalue = i642bytes(((uint64(special&0x1f) << 8) | uint64(next)))\n\t\tslice.Skip(2)\n\n\t} else if (special & rdbLpEncoding16BitIntMask) == rdbLpEncoding16BitInt { // mask 255\n\t\tvalue, err = slice.First(2)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tslice.Skip(3)\n\n\t} else if (special & rdbLpEncoding24BitIntMask) == rdbLpEncoding24BitInt {\n\t\tvalue, err = slice.First(3)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tslice.Skip(4)\n\n\t} else if (special & rdbLpEncoding32BitIntMask) == rdbLpEncoding32BitInt {\n\t\tvalue, err = slice.First(4)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tslice.Skip(5)\n\n\t} else if (special & rdbLpEncoding64BitIntMask) == rdbLpEncoding64BitInt {\n\t\tvalue, err = slice.First(8)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tslice.Skip(9)\n\n\t} else if (special & rdbLpEncoding12BitStrMask) == rdbLpEncoding12BitStr {\n\t\tb, err := slice.ReadByte()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlen := ((uint64(special) & 0x0f) << 8) | uint64(b)\n\t\tvalue, err = slice.First(int(len))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tslice.Skip(2 + int(len))\n\n\t} else if (special & rdbLpEncoding32BitStrMask) == rdbLpEncoding32BitStr {\n\t\tlen, err := slice.First(4)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trealLength, err := readuInt(len)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvalue, err = slice.First(int(realLength))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tslice.Skip(5 + int(realLength))\n\n\t} else {\n\t\treturn nil, fmt.Errorf(\"Unsupported operation exception %q\", special)\n\t}\n\t// <element-tot-len>\n\n\treturn value, nil\n}", "title": "" }, { "docid": "2185061132119c909373f17ba5c20452", "score": "0.5244971", "text": "func parseRpmDB(resolver source.FileResolver, dbLocation source.Location, reader io.Reader) ([]pkg.Package, error) {\n\tf, err := ioutil.TempFile(\"\", internal.ApplicationName+\"-rpmdb\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create temp rpmdb file: %w\", err)\n\t}\n\n\tdefer func() {\n\t\terr = os.Remove(f.Name())\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"failed to remove temp rpmdb file: %+v\", err)\n\t\t}\n\t}()\n\n\t_, err = io.Copy(f, reader)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to copy rpmdb contents to temp file: %w\", err)\n\t}\n\n\tdb, err := rpmdb.Open(f.Name())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpkgList, err := db.ListPackages()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tallPkgs := make([]pkg.Package, 0)\n\n\tfor _, entry := range pkgList {\n\t\tp := pkg.Package{\n\t\t\tName: entry.Name,\n\t\t\tVersion: fmt.Sprintf(\"%s-%s\", entry.Version, entry.Release), // this is what engine does, instead of fmt.Sprintf(\"%d:%s-%s.%s\", entry.Epoch, entry.Version, entry.Release, entry.Arch)\n\t\t\tLocations: []source.Location{dbLocation},\n\t\t\tFoundBy: catalogerName,\n\t\t\tType: pkg.RpmPkg,\n\t\t\tMetadataType: pkg.RpmdbMetadataType,\n\t\t\tMetadata: pkg.RpmdbMetadata{\n\t\t\t\tName: entry.Name,\n\t\t\t\tVersion: entry.Version,\n\t\t\t\tEpoch: entry.Epoch,\n\t\t\t\tArch: entry.Arch,\n\t\t\t\tRelease: entry.Release,\n\t\t\t\tSourceRpm: entry.SourceRpm,\n\t\t\t\tVendor: entry.Vendor,\n\t\t\t\tLicense: entry.License,\n\t\t\t\tSize: entry.Size,\n\t\t\t\tFiles: extractRpmdbFileRecords(resolver, entry),\n\t\t\t},\n\t\t}\n\n\t\tallPkgs = append(allPkgs, p)\n\t}\n\n\treturn allPkgs, nil\n}", "title": "" }, { "docid": "239a6fc4f6951fc11b0300e4fe69fe62", "score": "0.5214446", "text": "func BytesParser(byteList []byte) (v interface{}, err error) {\n\tif byteList[17] != 0x09 {\n\t\treturn nil, fmt.Errorf(\"unknown header type %02x, expecting %02x\", byteList[14], 0x09)\n\t}\n\t// Don't know what's stored in byteList[23] ¯\\_(ツ)_/¯\n\tmessageTimestamp := byteArrayToTime(append(append([]byte{}, byteList[19:23]...), byteList[24:27]...))\n\n\tcursor := cursorType{17 + 2 + int(byteList[18])}\n\tif byteList[cursor.position] != 0x02 {\n\t\treturn nil, fmt.Errorf(\"unknown message type %02x, expecting %02x\", byteList[cursor.position], 0x02)\n\t}\n\n\t// Checksum everything except delimiters (start & end bytes) and checksum bytes\n\tpackageChecksum := uint16(byteList[len(byteList)-2])<<8 + uint16(byteList[len(byteList)-3])\n\tcalculatedChecksum := crc16.ChecksumCCITT(byteList[1 : len(byteList)-3])\n\tif calculatedChecksum != packageChecksum {\n\t\treturn nil, fmt.Errorf(\"Calculated checksum was %x but the transmitted checksum was %x\\n%s\", calculatedChecksum, packageChecksum, bytesToHexStrings(byteList[1:len(byteList)-1]))\n\t}\n\n\tmessageType := messageTypes(byteList[cursor.position+1])\n\tcursor.position += 2\n\n\tbaseItem := BaseItem{\n\t\tMeterTime: messageTimestamp,\n\t\tHostTime: time.Now(),\n\t\tMessageType: messageType,\n\t}\n\n\tswitch messageType {\n\tcase messageType1:\n\t\tv = &MessageType1{\n\t\t\tBaseItem: baseItem,\n\t\t\tActPowPos: extractInt(&cursor, byteList),\n\t\t}\n\tcase singleFaseMessageType2:\n\t\tv = &SingleFaseMessageType2{\n\t\t\tBaseItem: baseItem,\n\t\t\tObisListVersion: extractString(&cursor, byteList),\n\t\t\tGs1: extractString(&cursor, byteList),\n\t\t\tMeterModel: extractString(&cursor, byteList),\n\t\t\tActPowPos: extractInt(&cursor, byteList),\n\t\t\tActPowNeg: extractInt(&cursor, byteList),\n\t\t\tReactPowPos: extractInt(&cursor, byteList),\n\t\t\tReactPowNeg: extractInt(&cursor, byteList),\n\t\t\tCurrL1: extractInt(&cursor, byteList),\n\t\t\tVoltL1: extractInt(&cursor, byteList),\n\t\t}\n\tcase threeFaseMessageType2:\n\t\tv = &ThreeFaseMessageType2{\n\t\t\tBaseItem: baseItem,\n\t\t\tObisListVersion: extractString(&cursor, byteList),\n\t\t\tGs1: extractString(&cursor, byteList),\n\t\t\tMeterModel: extractString(&cursor, byteList),\n\t\t\tActPowPos: extractInt(&cursor, byteList),\n\t\t\tActPowNeg: extractInt(&cursor, byteList),\n\t\t\tReactPowPos: extractInt(&cursor, byteList),\n\t\t\tReactPowNeg: extractInt(&cursor, byteList),\n\t\t\tCurrL1: extractInt(&cursor, byteList),\n\t\t\tCurrL2: extractInt(&cursor, byteList),\n\t\t\tCurrL3: extractInt(&cursor, byteList),\n\t\t\tVoltL1: extractInt(&cursor, byteList),\n\t\t\tVoltL2: extractInt(&cursor, byteList),\n\t\t\tVoltL3: extractInt(&cursor, byteList),\n\t\t}\n\tcase singleFaseMessageType3:\n\t\tv = &SingleFaseMessageType3{\n\t\t\tBaseItem: baseItem,\n\t\t\tObisListVersion: extractString(&cursor, byteList),\n\t\t\tGs1: extractString(&cursor, byteList),\n\t\t\tMeterModel: extractString(&cursor, byteList),\n\t\t\tActPowPos: extractInt(&cursor, byteList),\n\t\t\tActPowNeg: extractInt(&cursor, byteList),\n\t\t\tReactPowPos: extractInt(&cursor, byteList),\n\t\t\tReactPowNeg: extractInt(&cursor, byteList),\n\t\t\tCurrL1: extractInt(&cursor, byteList),\n\t\t\tVoltL1: extractInt(&cursor, byteList),\n\t\t\tDateTime: extractTime(&cursor, byteList),\n\t\t\tActEnergyPos: extractInt(&cursor, byteList),\n\t\t\tActEnergyNeg: extractInt(&cursor, byteList),\n\t\t\tReactEnergyPos: extractInt(&cursor, byteList),\n\t\t\tReactEnergyNeg: extractInt(&cursor, byteList),\n\t\t}\n\tcase threeFaseMessageType3:\n\t\tv = &ThreeFaseMessageType3{\n\t\t\tBaseItem: baseItem,\n\t\t\tObisListVersion: extractString(&cursor, byteList),\n\t\t\tGs1: extractString(&cursor, byteList),\n\t\t\tMeterModel: extractString(&cursor, byteList),\n\t\t\tActPowPos: extractInt(&cursor, byteList),\n\t\t\tActPowNeg: extractInt(&cursor, byteList),\n\t\t\tReactPowPos: extractInt(&cursor, byteList),\n\t\t\tReactPowNeg: extractInt(&cursor, byteList),\n\t\t\tCurrL1: extractInt(&cursor, byteList),\n\t\t\tCurrL2: extractInt(&cursor, byteList),\n\t\t\tCurrL3: extractInt(&cursor, byteList),\n\t\t\tVoltL1: extractInt(&cursor, byteList),\n\t\t\tVoltL2: extractInt(&cursor, byteList),\n\t\t\tVoltL3: extractInt(&cursor, byteList),\n\t\t\tDateTime: extractTime(&cursor, byteList),\n\t\t\tActEnergyPa: extractInt(&cursor, byteList),\n\t\t\tActEnergyMa: extractInt(&cursor, byteList),\n\t\t\tActEnergyPr: extractInt(&cursor, byteList),\n\t\t\tActEnergyMr: extractInt(&cursor, byteList),\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "752ecf2eda4d78624dba068c923cfd4d", "score": "0.5189194", "text": "func Unpack(p ProtocolType, b []byte) ([]byte, error) {\n\tif len(b) < 6 {\n\t\treturn nil, errors.New(\"invalid data\")\n\t}\n\n\t// find magic code head and valid\n\tidx := bytes.LastIndex(b, []byte{0x0f, byte(p)})\n\tif idx == -1 {\n\t\treturn nil, errors.New(\"magic code head is not valid\")\n\t}\n\n\t// find magic code tail and valid\n\tif !bytes.Equal(b[len(b)-1:], []byte{0xf0}) {\n\t\treturn nil, errors.New(\"magic code tail is not valid\")\n\t}\n\n\t// got data\n\tdata := b[idx:]\n\n\t// valid data length\n\tvar shouldLen uint16\n\tif err := binary.Read(bytes.NewReader(data[2:4]), binary.BigEndian, &shouldLen); err != nil {\n\t\treturn nil, err\n\t}\n\tif len(data) != int(shouldLen+4+2) {\n\t\treturn nil, errors.New(\"data length is not valid\")\n\t}\n\n\treturn data[4 : shouldLen+4], nil\n}", "title": "" }, { "docid": "fabdf0b77467c2497b32980e02924ffd", "score": "0.51847535", "text": "func (pd *packageData) Decode(data []byte) (err error) {\n\tarray := strings.SplitN(string(data), \"&\", 4)\n\tif len(array) != 4 {\n\t\treturn errors.New(\"data struct is wrong\")\n\t}\n\tpd.GroupID, err = strconv.Atoi(array[0])\n\tif err != nil {\n\t\treturn err\n\t}\n\tpd.SyncID, err = strconv.Atoi(array[1])\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpd.Code, err = strconv.Atoi(array[2])\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpd.Data = array[3]\n\treturn\n}", "title": "" }, { "docid": "d5cab23082caa5d99b6130327fd51793", "score": "0.51742804", "text": "func Unpack(b []byte) (Tuple, error) {\n\tvar t Tuple\n\n\tvar i int\n\n\tfor i < len(b) {\n\t\tvar el interface{}\n\t\tvar off int\n\n\t\tswitch {\n\t\tcase b[i] == 0x00:\n\t\t\tel = nil\n\t\t\toff = 1\n\t\tcase b[i] == 0x01:\n\t\t\tel, off = decodeBytes(b[i:])\n\t\tcase b[i] == 0x02:\n\t\t\tel, off = decodeString(b[i:])\n\t\tcase 0x0c <= b[i] && b[i] <= 0x1c:\n\t\t\tel, off = decodeInt(b[i:])\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unable to decode tuple element with unknown typecode %02x\", b[i])\n\t\t}\n\n\t\tt = append(t, el)\n\t\ti += off\n\t}\n\n\treturn t, nil\n}", "title": "" }, { "docid": "df0fb6ea54c7992c424e45ab13431bb2", "score": "0.5141291", "text": "func decode(buff []byte) []flowutils.InterpretedField {\n\tsession := flowutils.NewSession()\n\tsession.LoadTemplateRecords(ipfix.GeneratePensandoTemplates())\n\ti := flowutils.NewInterpreter(session)\n\tentry := ipfix.GenerateEnterpriseElements()\n\n\tfor d := range entry {\n\t\ti.AddDictionaryEntry(entry[d])\n\t}\n\n\tds, err := session.ParseBuffer(buff[:])\n\tif err != nil {\n\t\tlog.Errorf(\"ipfix parse error, %v\", err)\n\t\treturn nil\n\t}\n\n\tlog.Infof(\"+++ got %v\", ds)\n\n\tvar fieldList []flowutils.InterpretedField\n\tfor _, rec := range ds.DataRecords {\n\t\tlog.Infof(\"++ %v \\n\", rec)\n\t\tfieldList = i.InterpretInto(rec, fieldList[:cap(fieldList)])\n\t\t// handle the field list\n\t}\n\n\treturn fieldList\n}", "title": "" }, { "docid": "89edf0b000710a18b621ff625a42f03d", "score": "0.50900054", "text": "func ParseSignedBList(in io.Reader) (sList *SignedBList, err error) {\n\n\tvar (\n\t\tline []byte\n\t\tpubKey *rsa.PublicKey\n\t\ttitle string\n\t\tt xu.Timestamp // binary form\n\t)\n\tbin := bufio.NewReader(in)\n\n\t// Read the header part -----------------------------------------\n\tline, err = xc.NextLineWithoutCRLF(bin)\n\tif err == nil {\n\t\ttitle = string(line)\n\t\tline, err = xc.NextLineWithoutCRLF(bin)\n\t\tif err == nil {\n\t\t\tt, err = xu.ParseTimestamp(string(line))\n\t\t\tif err == nil {\n\t\t\t\tline, err = xc.NextLineWithoutCRLF(bin)\n\t\t\t\tif err == nil {\n\t\t\t\t\tline = append(line, 10) // NEWLINE\n\t\t\t\t\tpubKey, err = xc.RSAPubKeyFromDisk(line)\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\tline, err = xc.NextLineWithoutCRLF(bin)\n\t\t\t\t\t\tif err == nil {\n\t\t\t\t\t\t\tif !bytes.Equal(line, xc.CONTENT_START) {\n\t\t\t\t\t\t\t\terr = xc.MissingContentStart\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Build and populate the SignedBList object ---------------------\n\tif err == nil {\n\t\tvar bList *xc.BuildList\n\t\tbList, err = xc.NewBuildList(title, t)\n\t\tif err == nil {\n\t\t\tsList = &SignedBList{\n\t\t\t\tPubKey: pubKey,\n\t\t\t\tBuildList: *bList,\n\t\t\t}\n\t\t\t// Read the content lines and then the dig sig ----------\n\t\t\terr = ReadContents(bin, sList, true) // true = is signed\n\t\t\tif err == nil {\n\t\t\t\t// try to read the digital signature line\n\t\t\t\tvar digSig []byte\n\t\t\t\tline, err = xc.NextLineWithoutCRLF(bin)\n\t\t\t\tif err == nil || err == io.EOF {\n\t\t\t\t\tdigSig, err = base64.StdEncoding.DecodeString(string(line))\n\t\t\t\t\tif err == nil || err == io.EOF {\n\t\t\t\t\t\tsList.SetDigSig(digSig)\n\t\t\t\t\t\tif err == io.EOF {\n\t\t\t\t\t\t\terr = nil\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}\n\t}\n\treturn\n}", "title": "" }, { "docid": "49aa16a87b0ffd32f333f97b232c8d09", "score": "0.5086084", "text": "func (stp *STP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {\n\tstpLength := 35\n\tif len(data) < stpLength {\n\t\tdf.SetTruncated()\n\t\treturn fmt.Errorf(\"STP length %d too short\", len(data))\n\t}\n\n\tstp.ProtocolID = binary.BigEndian.Uint16(data[:2])\n\tstp.Version = uint8(data[2])\n\tstp.Type = uint8(data[3])\n\tstp.TC = data[4]&0x01 != 0\n\tstp.TCA = data[4]&0x80 != 0\n\tstp.RouteID.Priority = binary.BigEndian.Uint16(data[5:7]) & 0xf000\n\tstp.RouteID.SysID = binary.BigEndian.Uint16(data[5:7]) & 0x0fff\n\tstp.RouteID.HwAddr = net.HardwareAddr(data[7:13])\n\tstp.Cost = binary.BigEndian.Uint32(data[13:17])\n\tstp.BridgeID.Priority = binary.BigEndian.Uint16(data[17:19]) & 0xf000\n\tstp.BridgeID.SysID = binary.BigEndian.Uint16(data[17:19]) & 0x0fff\n\tstp.BridgeID.HwAddr = net.HardwareAddr(data[19:25])\n\tstp.PortID = binary.BigEndian.Uint16(data[25:27])\n\tstp.MessageAge = binary.BigEndian.Uint16(data[27:29])\n\tstp.MaxAge = binary.BigEndian.Uint16(data[29:31])\n\tstp.HelloTime = binary.BigEndian.Uint16(data[31:33])\n\tstp.FDelay = binary.BigEndian.Uint16(data[33:35])\n\tstp.Contents = data[:stpLength]\n\tstp.Payload = data[stpLength:]\n\n\treturn nil\n}", "title": "" }, { "docid": "1f81f644d8d094e13ca0ae5e8168a97c", "score": "0.5070852", "text": "func (d *decodeState) unmarshal(x interface{}) error {\n\n\tvar topMap propertyMap\n\ttopMap = make(propertyMap)\n\n\td.generateMap(topMap, reflect.ValueOf(x))\n\n\tpropStack := NewPropMapStack()\n\tpropStack.Push(topMap)\n\n\t// for every line in file\n\tfor d.scanner.Scan() {\n\n\t\tif d.savedError != nil {\n\t\t\tbreak // breaks on first error\n\t\t}\n\n\t\td.line = d.scanner.Text()\n\t\td.lineNum++\n\n\t\tline := strings.TrimSpace(d.line)\n\n\t\tif len(line) < 1 || line[0] == ';' || line[0] == '#' {\n\t\t\tcontinue // skip comments\n\t\t}\n\n\t\t// Two types of lines:\n\t\t// 1. NAME=VALUE (at least one equal sign - breaks on first)\n\t\t// 2. [HEADER] (no equals sign, square brackets NOT required)\n\t\tmatches := strings.SplitN(line, \"=\", 2)\n\t\tmatched := false\n\t\tpn := \"\"\n\t\tpv := \"\"\n\n\t\tif len(matches) == 2 {\n\t\t\t// NAME=VALUE\n\t\t\tpn = strings.ToLower(strings.TrimSpace(matches[0]))\n\t\t\tpv = strings.TrimSpace(matches[1])\n\t\t\tprop := propStack.Peek()[pn]\n\n\t\t\tif prop.isInitialized {\n\t\t\t\tif prop.isArray {\n\t\t\t\t\tvalue := reflect.New(prop.value.Type().Elem())\n\t\t\t\t\td.setValue(reflect.Indirect(value), pv)\n\t\t\t\t\tappendValue(prop.value, value)\n\n\t\t\t\t} else {\n\t\t\t\t\td.setValue(prop.value, pv)\n\t\t\t\t}\n\n\t\t\t\tmatched = true\n\t\t\t}\n\n\t\t\t// What if property is umatched - keep popping the stack\n\t\t\t// until a potential map is found or stay within current section?\n\t\t\t// Think answer is pop.\n\t\t\t// NOPE\n\t\t\t// Section could have unmatched name=value if user doesn't\n\t\t\t// care about certain values - only stack crawling happens\n\t\t\t// during numMatches==1 time?\n\t\t\t// This means if there is > 1 section, there needs to be\n\t\t\t// section breaks for everything\n\n\t\t} else {\n\t\t\t// [Header] section\n\t\t\tpn = strings.ToLower(strings.TrimSpace(matches[0]))\n\n\t\t\tfor propStack.Size() > 0 {\n\t\t\t\tprop := propStack.Peek()[pn]\n\t\t\t\tif prop.isInitialized {\n\t\t\t\t\tpropStack.Push(prop.children)\n\t\t\t\t\tmatched = true\n\t\t\t\t\tbreak\n\t\t\t\t} else if propStack.Size() > 1 {\n\t\t\t\t\t_ = propStack.Pop()\n\t\t\t\t} else {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif !matched {\n\t\t\td.unmatched = append(d.unmatched, Unmatched{d.lineNum, d.line})\n\t\t}\n\t}\n\n\treturn d.savedError\n}", "title": "" }, { "docid": "b9a79c23aeba1606e3d0ee22ca0c9444", "score": "0.5048782", "text": "func parseP1bPayload(s string) (c.ProcessID, *ballot, map[uint64]*pValue) {\n\tsSlice := strings.SplitN(s, \" \", 4)\n\taccID, _ := strconv.ParseUint(sSlice[0], 10, 64)\n\tbID, _ := strconv.ParseUint(sSlice[1], 10, 64)\n\tbn, _ := strconv.ParseUint(sSlice[2], 10, 64)\n\tpVals := make(map[uint64]*pValue)\n\n\t// Parse and populate pVals\n\tvar dat map[string]interface{}\n\tif err := json.Unmarshal([]byte(sSlice[3]), &dat); err != nil {\n\t\tfmt.Println(\"HELP\")\n\t\tpanic(err)\n\t}\n\tfor k, v := range dat {\n\t\tslot, _ := strconv.ParseUint(k, 10, 64)\n\t\tpVal := parsePValue(v.(string))\n\t\tpVals[slot] = pVal\n\t}\n\treturn c.ProcessID(accID), &ballot{c.ProcessID(bID), bn}, pVals\n}", "title": "" }, { "docid": "ac4828b5d1771d22c7e03994c6dde71f", "score": "0.50048995", "text": "func (p *Pubcomp) Unpack(r *bytes.Buffer) error {\n\tvar err error\n\tsuccess := r.Len() == 2\n\tnoProps := r.Len() == 3\n\tp.PacketID, err = readUint16(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !success {\n\t\tp.ReasonCode, err = r.ReadByte()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif !noProps {\n\t\t\terr = p.Properties.Unpack(r, PUBACK)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c65c9ba36be7ad988394e031e422d6ee", "score": "0.5001386", "text": "func parseApkDB(_ string, reader io.Reader) ([]pkg.Package, error) {\n\t// larger capacity for the scanner.\n\tconst maxScannerCapacity = 1024 * 1024\n\t// a new larger buffer for the scanner\n\tbufScan := make([]byte, maxScannerCapacity)\n\tpackages := make([]pkg.Package, 0)\n\n\tscanner := bufio.NewScanner(reader)\n\tscanner.Buffer(bufScan, maxScannerCapacity)\n\tonDoubleLF := func(data []byte, atEOF bool) (advance int, token []byte, err error) {\n\t\tfor i := 0; i < len(data); i++ {\n\t\t\tif i > 0 && data[i-1] == '\\n' && data[i] == '\\n' {\n\t\t\t\treturn i + 1, data[:i-1], nil\n\t\t\t}\n\t\t}\n\t\tif !atEOF {\n\t\t\treturn 0, nil, nil\n\t\t}\n\t\t// deliver the last token (which could be an empty string)\n\t\treturn 0, data, bufio.ErrFinalToken\n\t}\n\n\tscanner.Split(onDoubleLF)\n\tfor scanner.Scan() {\n\t\tmetadata, err := parseApkDBEntry(strings.NewReader(scanner.Text()))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif metadata != nil {\n\t\t\tpackages = append(packages, pkg.Package{\n\t\t\t\tName: metadata.Package,\n\t\t\t\tVersion: metadata.Version,\n\t\t\t\tLicenses: strings.Split(metadata.License, \" \"),\n\t\t\t\tType: pkg.ApkPkg,\n\t\t\t\tMetadataType: pkg.ApkMetadataType,\n\t\t\t\tMetadata: *metadata,\n\t\t\t})\n\t\t}\n\t}\n\n\tif err := scanner.Err(); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse APK DB file: %w\", err)\n\t}\n\n\treturn packages, nil\n}", "title": "" }, { "docid": "daa38ee36fb17c5fdf6ad0cc7b7107d4", "score": "0.49729845", "text": "func (p *TFTPOptionPkt) Unpack(data []byte) {\n\tp.Opcode = binary.BigEndian.Uint16(data[:2])\n\tmsgParsed := bytes.Split(data[2:len(data)], []byte{00})\n\tparsedLen := len(msgParsed)\n\tp.Filename = string(msgParsed[0])\n\tp.Mode = string(msgParsed[1])\n\tk := 2\n\tv := 3\n\tif parsedLen > 2 {\n\t\tfor parsedLen > v {\n\t\t\tp.Options[string(msgParsed[k])] = string(msgParsed[v])\n\t\t\tk = k + 2\n\t\t\tv = v + 2\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2e4b01aa97a23b3ee575df89db843182", "score": "0.49691477", "text": "func (pkt *SubDelNotify) Decode(bytes []byte) (err error) {\n\tvar used int\n\toffset := 4 // header\n\n\tqidCount, used, err := XdrGetUint32(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tfor i := uint32(0); i < qidCount; i++ {\n\t\tpkt.QuenchIDs[i], used, err = XdrGetInt64(bytes[offset:])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\toffset += used\n\t}\n\n\tpkt.TermID, used, err = XdrGetUint64(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\treturn nil\n}", "title": "" }, { "docid": "c81ecbd9a618e2b53fba84b9aa038e46", "score": "0.494904", "text": "func (tool capnpTool) decodePacked(typ string, r io.Reader) (string, error) {\n\tout, err := tool.run(r, \"decode\", \"--short\", \"--packed\", schemaPath, typ)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(out), nil\n}", "title": "" }, { "docid": "49670cd795de95b70dce882ebc099102", "score": "0.49455178", "text": "func parseP2bPayload(s string) (c.ProcessID, uint64, *ballot) {\n\tsSlice := strings.SplitN(s, \" \", 4)\n\taccID, _ := strconv.ParseUint(sSlice[0], 10, 64)\n\tslot, _ := strconv.ParseUint(sSlice[1], 10, 64)\n\tbID, _ := strconv.ParseUint(sSlice[2], 10, 64)\n\tbn, _ := strconv.ParseUint(sSlice[3], 10, 64)\n\treturn c.ProcessID(accID), slot, &ballot{c.ProcessID(bID), bn}\n}", "title": "" }, { "docid": "80c450b0b888d1e87b49c00cb159af5f", "score": "0.49383762", "text": "func fromPlist(item plistChild) readinglistItem {\n\tpreview := item.ReadingListNonSync.PreviewText\n\tif preview == \"\" {\n\t\tpreview = item.ReadingList.PreviewText\n\t}\n\n\ttitle := item.ReadingListNonSync.Title\n\tif title == \"\" {\n\t\ttitle = item.URIDictionary.Title\n\t}\n\n\treturn readinglistItem{\n\t\tTitle: title,\n\t\tPreview: preview,\n\t\tURL: item.URLString,\n\t\tUUID: item.WebBookmarkUUID,\n\t\tSource: item.ReadingList.SourceLocalizedAppName,\n\t\tRead: !item.ReadingList.DateLastViewed.IsZero(),\n\t\tAdded: item.ReadingList.DateAdded,\n\t\tViewed: item.ReadingList.DateLastViewed,\n\t\tfetched: item.ReadingListNonSync.DateLastFetched,\n\t}\n}", "title": "" }, { "docid": "ef2c6ba778cdcfaedc3beb774b0bd90d", "score": "0.49341485", "text": "func Decode(buffer []byte) (pkgType int, body []byte) {\n\tpkgType = int(buffer[0])\n\tbody = buffer[PKG_HEAD_BYTES:]\n\treturn\n}", "title": "" }, { "docid": "315301012299da33481cfc8481bcc368", "score": "0.4921302", "text": "func (c *Connection) unpackPackageAndDecode(msg *model.Message) error {\n\trawData, err := packer.NewReader(c).Read()\n\tif err != nil {\n\t\tklog.Errorf(\"failed to read, error: %+v\", err)\n\t\treturn err\n\t}\n\n\t// convert raw data to protocol buf message, then into model message.\n\treturn translator.NewTransCoding().Decode(rawData, msg)\n}", "title": "" }, { "docid": "31b27a0ae1a303c171c59208cd3adbb0", "score": "0.4910814", "text": "func readPackages(c ResolverConfig, r io.Reader, isBinaryPackages bool) (*PackageInfo, error) {\n\tpackages := make(map[string]map[version.Version]*deb.Paragraph)\n\tvirtualPackages := make(map[string][]*deb.Paragraph)\n\td := deb.NewDecoder(r)\n\n\tfor {\n\t\tvar p deb.Paragraph\n\t\terr := d.Decode(&p)\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif err := pkgInfoAppend(&p, packages, virtualPackages); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn &PackageInfo{\n\t\tConfig: c,\n\t\tBinaryPackages: isBinaryPackages,\n\t\tPackages: packages,\n\t\tvirtualPackages: virtualPackages,\n\t}, nil\n}", "title": "" }, { "docid": "9804a173ea8bb69b8f73814e9798fe14", "score": "0.48935932", "text": "func (c *AdapterProxy) ParsePackage(buff []byte) (int, int) {\n\treturn c.servantProxy.proto.ParsePackage(buff)\n}", "title": "" }, { "docid": "258ac544d7da9616d962d2312d4b26a0", "score": "0.4869637", "text": "func parseLookupList(lytt *LayoutTable, b fontBinSegm, err error) error {\n\tif err != nil {\n\t\treturn err\n\t}\n\tlloffset := lytt.header.offsetFor(LayoutLookupSection)\n\tif lloffset >= len(b) {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\tb = b[lloffset:]\n\t//\n\tll := LookupList{base: b}\n\tll.array, ll.err = parseArray16(b, 0)\n\tlytt.LookupList = ll\n\t// r := bytes.NewReader(b)\n\t// var count uint16\n\t// if err := binary.Read(r, binary.BigEndian, &count); err != nil {\n\t// \treturn fmt.Errorf(\"reading lookup count: %s\", err)\n\t// }\n\t// trace().Debugf(\"font has %d lookup list entries\", count)\n\t// if count > 0 {\n\t// \tlookupOffsets := make([]uint16, count, count)\n\t// \tif err := binary.Read(r, binary.BigEndian, &lookupOffsets); err != nil {\n\t// \t\treturn fmt.Errorf(\"reading lookup offsets: %s\", err)\n\t// \t}\n\t// \tlytt.LookupList = nil\n\t// \tfor i := 0; i < int(count); i++ {\n\t// \t\t//trace().Debugf(\"lookup offset #%d = %d\", i, lookupOffsets[i])\n\t// \t\tlookup, err := parseLookup(b, lookupOffsets[i])\n\t// \t\tif err != nil {\n\t// \t\t\treturn err\n\t// \t\t}\n\t// \t\tlytt.LookupList = append(lytt.LookupList, lookup)\n\t// \t}\n\t// }\n\treturn nil\n}", "title": "" }, { "docid": "c0b757f0d3215be368241f524b1a5591", "score": "0.48660392", "text": "func (p *TFTPReadWritePkt) Unpack(data []byte) {\n\tp.Opcode = binary.BigEndian.Uint16(data[:2])\n\tmsgParsed := bytes.Split(data[2:len(data)], []byte{00})\n\tp.Filename = string(msgParsed[0])\n\tp.Mode = string(msgParsed[1])\n}", "title": "" }, { "docid": "87efcc69ee5b62468950598c775faf9d", "score": "0.48634288", "text": "func UnmarshalFile(filename string) (*Plist, error) {\n\txmlFile, err := os.Open(filename)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"plist: error opening plist: %s\", err)\n\t}\n\tdefer xmlFile.Close()\n\n\txmlData, err := ioutil.ReadAll(xmlFile)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"plist: error reading plist file: %s\", err)\n\t}\n\n\tif !bytes.HasPrefix(xmlData, []byte(\"<?xml \")) {\n\t\tdebug(\"non-text XML -- assuming binary\")\n\t\txmlData, err = exec.Command(\"plutil\", \"-convert\", \"xml1\", \"-o\", \"-\",\n\t\t\tfilename).Output()\n\t\tif err != nil || !bytes.HasPrefix(xmlData, []byte(\"<?xml \")) {\n\t\t\treturn nil, fmt.Errorf(\"plist: invalid plist file \" + filename)\n\t\t}\n\t}\n\n\tvar plist Plist\n\terr = Unmarshal(xmlData, &plist)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &plist, err\n}", "title": "" }, { "docid": "77b0dd87ddbfedb858075355b46e90ca", "score": "0.4845573", "text": "func (n *RegistryNotification) ParseFrom(b []byte) error {\n if len(b) < MinRegistryNotificationSize {\n return ErrParsingFailed\n }\n n.NotificationHeader.ParseFrom(b)\n n.RegistryAction = binary.LittleEndian.Uint16(b[24:26])\n n.Truncated = binary.LittleEndian.Uint16(b[26:28])\n n.ValueName = decodeUnicodeByteBuffer(b[28:156])\n n.KeyPath = decodeUnicodeByteBuffer(b[156:])\n return nil\n}", "title": "" }, { "docid": "b8fb0d52ec253e00c205bfb87d1bd3f5", "score": "0.48296532", "text": "func (c *MyClient) ParsePackage(buff []byte) (pkgLen, status int) {\n\tif len(buff) < 4 {\n\t\treturn 0, transport.PackageLess\n\t}\n\tlength := binary.BigEndian.Uint32(buff[:4])\n\n\tif length > 1048576000 || len(buff) > 1048576000 { // 1000MB\n\t\treturn 0, transport.PackageError\n\t}\n\tif len(buff) < int(length) {\n\t\treturn 0, transport.PackageLess\n\t}\n\treturn int(length), transport.PackageFull\n}", "title": "" }, { "docid": "182a5f12cfcc533abdee264dce5efcb6", "score": "0.48220664", "text": "func DecodeFile(file string) (Pkgdb, error) {\n\tf, err := os.Open(file)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer closer.Do(f)\n\n\treturn Decode(f)\n}", "title": "" }, { "docid": "a49fbe10ac3b5a8b5ee6af5e9c841b9f", "score": "0.4818302", "text": "func Unpack(b []byte) (field, shortb []byte, marker int, err error) {\n\tif len(b) < 7 { // No space for any field\n\t\terr = ErrFieldTooShort\n\t\treturn\n\t}\n\tmarker, err = Btoi(b[0:3])\n\tif err != nil {\n\t\treturn\n\t}\n\tlength, err := Btoi(b[3:6])\n\tif err != nil {\n\t\treturn\n\t}\n\tif len(b) < length+6 {\n\t\terr = ErrFieldCorrupt\n\t\treturn\n\t}\n\tfield = b[6 : 6+length]\n\tshortb = b[6+length:]\n\treturn\n}", "title": "" }, { "docid": "050ed908b1b8d66114e941ea6660dc9a", "score": "0.48013827", "text": "func decodeBookmarksFile(path string) ([]Bookmark, error) {\n\t// TODO(DH): Parse the PLIST\n\tpanic(\"unimplemented\")\n}", "title": "" }, { "docid": "89425b0ce49994420f66d1c9f0a4ad6f", "score": "0.4800773", "text": "func init() {\n\tbs, err := pbFiles.ReadFile(\"database.pbtxt\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\terr = prototext.Unmarshal(bs, &DB)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "7b7ba42fa4b2cd600b23c7f9f2c285dc", "score": "0.47973046", "text": "func ReadPack(r *bufio.Reader) (pack *Pack, err error) {\n\t// Read the fixed header\n\tvar (\n\t\tfixed byte\n\t\tn int\n\t\ttemp_byte byte\n\t\tcount_len = 1\n\t)\n\tfixed, err = r.ReadByte()\n\tif err != nil {\n\t\treturn\n\t}\n\t// Parse the fixed header\n\tpack = new(Pack)\n\tpack.msg_type = fixed >> 4\n\tfixed = fixed & 15\n\tpack.dup_flag = fixed >> 3\n\tfixed = fixed & 7\n\tpack.qos_level = fixed >> 1\n\tpack.retain = fixed & 1\n\t// Get the length of the pack\n\ttemp_byte, err = r.ReadByte()\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Read the high\n\tmultiplier := 1\n\tfor {\n\t\tcount_len++\n\t\tpack.length += (int(temp_byte&127) * multiplier)\n\t\tif temp_byte>>7 != 0 && count_len < 4 {\n\t\t\ttemp_byte, err = r.ReadByte()\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tmultiplier *= 128\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\t// Read the Variable header and the playload\n\t// Check the msg type\n\tswitch pack.msg_type {\n\tcase CONNECT:\n\t\t// Read the protocol name\n\t\tvar flags byte\n\t\tvar conn = new(Connect)\n\t\tpack.variable = conn\n\t\tconn.protocol, n, err = readString(r)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tif n > (pack.length - 4) {\n\t\t\terr = fmt.Errorf(\"out of range:%v\", pack.length-n)\n\t\t\tbreak\n\t\t}\n\t\t// Read the version\n\t\tconn.version, err = r.ReadByte()\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tflags, err = r.ReadByte()\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\t// Read the keep alive timer\n\t\tconn.keep_alive_timer, err = readInt(r, 2)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tparse_flags(flags, conn)\n\t\t// Read the playload\n\t\tplayload_len := pack.length - 2 - n - 4\n\t\t// Read the Client Identifier\n\t\tconn.id, n, err = readString(r)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tif n > 23 || n < 1 {\n\t\t\terr = fmt.Errorf(\"Identifier Rejected length is:%v\", n)\n\t\t\tconn.return_code = 2\n\t\t\tbreak\n\t\t}\n\t\tplayload_len -= n\n\t\tif n < 1 && (conn.will_flag || conn.password || n < 0) {\n\t\t\terr = fmt.Errorf(\"length error : %v\", playload_len)\n\t\t\tbreak\n\t\t}\n\t\tif conn.will_flag {\n\t\t\t// Read the will topic and the will message\n\t\t\tconn.will_topic, n, err = readString(r)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tplayload_len -= n\n\t\t\tif playload_len < 0 {\n\t\t\t\terr = fmt.Errorf(\"length error : %v\", playload_len)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tconn.will_msg, n, err = readString(r)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tplayload_len -= n\n\t\t}\n\t\tif conn.user_name && playload_len > 0 {\n\t\t\tconn.uname, n, err = readString(r)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tplayload_len -= n\n\t\t\tif playload_len < 0 {\n\t\t\t\terr = fmt.Errorf(\"length error : %v\", playload_len)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif conn.password && playload_len > 0 {\n\t\t\tconn.upassword, n, err = readString(r)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tplayload_len -= n\n\t\t\tif playload_len < 0 {\n\t\t\t\terr = fmt.Errorf(\"length error : %v\", playload_len)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\tcase PUBLISH:\n\t\tpub := new(Publish)\n\t\tpack.variable = pub\n\t\t// Read the topic\n\t\tpub.topic_name, n, err = readString(r)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tvlen := pack.length - n\n\t\tif n < 1 || vlen < 2 {\n\t\t\terr = fmt.Errorf(\"length error :%v\", vlen)\n\t\t\tbreak\n\t\t}\n\t\t// Read the msg id\n\t\tpub.mid, err = readInt(r, 2)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tvlen -= 2\n\t\t// Read the playload\n\t\tpub.msg = make([]byte, vlen)\n\t\t_, err = io.ReadFull(r, pub.msg)\n\tcase PUBACK:\n\t\tif pack.length == 2 {\n\t\t\tack := new(Puback)\n\t\t\tack.mid, err = readInt(r, 2)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tpack.variable = ack\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"Pack(%v) length(%v) != 2\", pack.msg_type, pack.length)\n\t\t}\n\tcase PINGREQ:\n\t\t// Pass\n\t\t// Nothing to do\n\tcase DISCONNECT:\n\t\t// Pass, nothing to do.\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "7af754764366fc04a51e4677739a60d1", "score": "0.47915298", "text": "func (u *UnsubscribePacket) Unpack(b io.Reader) error {\n\tvar err error\n\tu.MessageID, err = decodeUint16(b)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor topic, err := decodeString(b); err == nil && topic != \"\"; topic, err = decodeString(b) {\n\t\tu.Topics = append(u.Topics, topic)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "5f249431500b72c6725fb931d7440633", "score": "0.47905523", "text": "func unpackPByteString(str string) (*C.nk_byte, *cgoAllocMap) {\n\tstr = safeString(str)\n\th := (*stringHeader)(unsafe.Pointer(&str))\n\treturn (*C.nk_byte)(h.Data), cgoAllocsUnknown\n}", "title": "" }, { "docid": "accd45330537f5fd7c80f0671e3c58c7", "score": "0.47859576", "text": "func decodeMsgPack(buf []byte, out interface{}) error {\n\tr := bytes.NewBuffer(buf)\n\thd := codec.MsgpackHandle{}\n\tdec := codec.NewDecoder(r, &hd)\n\treturn dec.Decode(out)\n}", "title": "" }, { "docid": "accd45330537f5fd7c80f0671e3c58c7", "score": "0.47859576", "text": "func decodeMsgPack(buf []byte, out interface{}) error {\n\tr := bytes.NewBuffer(buf)\n\thd := codec.MsgpackHandle{}\n\tdec := codec.NewDecoder(r, &hd)\n\treturn dec.Decode(out)\n}", "title": "" }, { "docid": "accd45330537f5fd7c80f0671e3c58c7", "score": "0.47859576", "text": "func decodeMsgPack(buf []byte, out interface{}) error {\n\tr := bytes.NewBuffer(buf)\n\thd := codec.MsgpackHandle{}\n\tdec := codec.NewDecoder(r, &hd)\n\treturn dec.Decode(out)\n}", "title": "" }, { "docid": "accd45330537f5fd7c80f0671e3c58c7", "score": "0.47859576", "text": "func decodeMsgPack(buf []byte, out interface{}) error {\n\tr := bytes.NewBuffer(buf)\n\thd := codec.MsgpackHandle{}\n\tdec := codec.NewDecoder(r, &hd)\n\treturn dec.Decode(out)\n}", "title": "" }, { "docid": "63f73583f1ba38be9b0e84f32c7750de", "score": "0.47754008", "text": "func (p *CmppReceiptPkt) Unpack(data []byte) error {\n\tvar r = newPacketReader(data)\n\n\tr.ReadInt(binary.BigEndian, &p.MsgId)\n\n\tstat := r.ReadCString(7)\n\tp.Stat = string(stat)\n\n\tsubmitTime := r.ReadCString(10)\n\tp.SubmitTime = string(submitTime)\n\n\tdoneTime := r.ReadCString(10)\n\tp.DoneTime = string(doneTime)\n\n\tdestTerminalId := r.ReadCString(21)\n\tp.DestTerminalId = string(destTerminalId)\n\n\tr.ReadInt(binary.BigEndian, &p.SmscSequence)\n\treturn r.Error()\n}", "title": "" }, { "docid": "f422d7ae2db36841b58225b90be7c546", "score": "0.47660315", "text": "func parsePSIData(i *astikit.BytesIterator) (d *PSIData, err error) {\n\t// Init data\n\td = &PSIData{}\n\n\t// Get next byte\n\tvar b byte\n\tif b, err = i.NextByte(); err != nil {\n\t\terr = fmt.Errorf(\"astits: fetching next byte failed: %w\", err)\n\t\treturn\n\t}\n\n\t// Pointer field\n\td.PointerField = int(b)\n\n\t// Pointer filler bytes\n\ti.Skip(d.PointerField)\n\n\t// Parse sections\n\tvar s *PSISection\n\tvar stop bool\n\tfor i.HasBytesLeft() && !stop {\n\t\tif s, stop, err = parsePSISection(i); err != nil {\n\t\t\terr = fmt.Errorf(\"astits: parsing PSI table failed: %w\", err)\n\t\t\treturn\n\t\t}\n\t\td.Sections = append(d.Sections, s)\n\t}\n\treturn\n}", "title": "" }, { "docid": "1a4f52f36418d4d0b6758b0cbbc6945e", "score": "0.47646388", "text": "func (msg *PUBXSVStatus) decode(fields []string) (err error) {\n\tif len(fields) > 0 {\n\t\tmsg.Header = Header(fields[0])\n\t}\n\tif len(fields) > 1 {\n\t\tv := 0\n\t\tv, err = strconv.Atoi(fields[1])\n\t\tmsg.PUBXType = PUBXType(v)\n\t}\n\tif err == nil && len(fields) > 2 {\n\t\tmsg.NumSV, err = strconv.Atoi(fields[2])\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tmsg.SVInfo = make([]PUBXSVInfo, msg.NumSV)\n\tfor i := 0; i < msg.NumSV; i++ {\n\t\tif len(fields) < 3+6*i {\n\t\t\tbreak\n\t\t}\n\t\tif err = decodeMsg(&msg.SVInfo[i], fields[3+6*i:8+6*i]); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f4f7c6646f671c5798b482b504ad50d5", "score": "0.47644615", "text": "func (mb *tcpPackager) Decode(adu []byte) (pdu *ProtocolDataUnit, err error) {\n\t// Read length value in the header\n\tlength := binary.BigEndian.Uint16(adu[4:])\n\tpduLength := len(adu) - tcpHeaderSize\n\tif pduLength <= 0 || pduLength != int(length-1) {\n\t\terr = fmt.Errorf(\"modbus: length in response '%v' does not match pdu data length '%v'\", length-1, pduLength)\n\t\treturn\n\t}\n\tpdu = &ProtocolDataUnit{}\n\t// The first byte after header is function code\n\tpdu.FunctionCode = adu[tcpHeaderSize]\n\tpdu.Data = adu[tcpHeaderSize+1:]\n\treturn\n}", "title": "" }, { "docid": "bde2829eb780c3f8462d2a4f334198d9", "score": "0.4738334", "text": "func decodeFileDescriptorProto(element string, fdb []byte) (*dpb.FileDescriptorProto, error) {\n\traw, err := decompress(fdb)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to decompress %q descriptor: %v\", element, err)\n\t}\n\tfd := dpb.FileDescriptorProto{}\n\tif err := proto.Unmarshal(raw, &fd); err != nil {\n\t\treturn nil, fmt.Errorf(\"bad descriptor for %q: %v\", element, err)\n\t}\n\treturn &fd, nil\n}", "title": "" }, { "docid": "4ff6594347ce712759d22ad4852c3cb3", "score": "0.47264114", "text": "func parseFeatureList(lytt *LayoutTable, b []byte, err error) error {\n\tif err != nil {\n\t\treturn err\n\t}\n\t// floffset := lytt.header.OffsetFor(LayoutFeatureSection)\n\t// if floffset >= len(b) {\n\t// \treturn io.ErrUnexpectedEOF\n\t// }\n\t// flist, n, err := lytt.data.varLenView(floffset, 2, 0, 6)\n\t// r := bytes.NewReader(flist[2:])\n\t// frecords := make([]featureRecord, n, n)\n\t// if err := binary.Read(r, binary.BigEndian, &frecords); err != nil {\n\t// \treturn fmt.Errorf(\"reading feature records: %s\", err)\n\t// }\n\t// lytt.features = frecords\n\t// return nil\n\tlytt.FeatureList = tagRecordMap16{}\n\tlink := link16{base: b, offset: uint16(lytt.header.offsetFor(LayoutFeatureSection))}\n\tfeatures := link.Jump() // now we stand at the FeatureList table\n\tfeatureRecords := parseTagRecordMap16(features.Bytes(), 0, features.Bytes(), \"FeatureList\", \"Feature\")\n\tlytt.FeatureList = featureRecords\n\treturn nil\n}", "title": "" }, { "docid": "834a14291840c28d1b48e0b8dd6f596e", "score": "0.47158185", "text": "func UnpackStruct(r io.Reader, ptr interface{}) error {\n\tvar err error\n\tvar head byte\n\n\tif err = binary.Read(r, binary.BigEndian, &head); err != nil {\n\t\treturn err\n\t}\n\tif head == 0xc0 { // nil\n\t\treflect.ValueOf(ptr).Elem().Set(reflect.Zero(reflect.TypeOf(ptr).Elem()))\n\t\treturn nil\n\t}\n\n\tvar srcLen = 0\n\tif head&0xf0 == 0x80 { // map\n\t\tsrcLen = int(head & 0x0f)\n\t} else if head == 0xde {\n\t\tvar temp uint16\n\t\tif err = binary.Read(r, binary.BigEndian, &temp); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsrcLen = int(temp)\n\t} else if head == 0xdf {\n\t\tvar temp uint32\n\t\tif err = binary.Read(r, binary.BigEndian, &temp); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsrcLen = int(temp)\n\t} else {\n\t\treturn fmt.Errorf(\"msgp: unpacked value is not a map\")\n\t}\n\n\ttype StructField struct {\n\t\tProps FieldProps\n\t\tVal reflect.Value\n\t}\n\tfieldMap := make(map[string]StructField)\n\n\tstructTyp := reflect.TypeOf(ptr).Elem()\n\tstructVal := reflect.ValueOf(ptr).Elem()\n\n\tstructVal.Set(reflect.Zero(structTyp)) // init with zero value\n\n\tstructNumField := structTyp.NumField()\n\tfor inx := 0; inx < structNumField; inx++ {\n\t\tvar fp FieldProps\n\n\t\tfieldTyp := structTyp.Field(inx)\n\t\tfieldVal := structVal.Field(inx)\n\t\tfp.parseTag(fieldTyp)\n\t\tif fp.Skip {\n\t\t\tcontinue\n\t\t}\n\t\tfieldMap[fp.Name] = StructField{fp, fieldVal}\n\t}\n\n\tfor inx := 0; inx < srcLen; inx++ {\n\t\tvar key string\n\t\tif err = Unpack(r, &key); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tstructField, ok := fieldMap[key]\n\t\tif ok {\n\t\t\tif structField.Props.Skip {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif structField.Props.String {\n\t\t\t\tvar str string\n\t\t\t\tif err = Unpack(r, &str); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif err = assignValueFromString(structField.Val, str); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif err = Unpack(r, structField.Val.Addr().Interface()); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d6cb2bc058da1f3e02b41e65e5335673", "score": "0.47094724", "text": "func (b *Block) DecodeRLP(s *rlp.Stream) error {\r\n\tvar eb extblock\r\n\t_, size, _ := s.Kind()\r\n\tif err := s.Decode(&eb); err != nil {\r\n\t\treturn err\r\n\t}\r\n\tb.header, b.uncles, b.transactions, b.inputTxs, b.hbftStages = eb.Header, eb.Uncles, eb.Txs, eb.InputTxs, eb.HbftStages\r\n\tb.size.Store(common.StorageSize(rlp.ListSize(size)))\r\n\treturn nil\r\n}", "title": "" }, { "docid": "871abcba7520c4d36045475cafae7eb5", "score": "0.4704435", "text": "func (bPtr *Block) DecodeRLP(s *rlp.Stream) error {\n\tvar eb extblock\n\t_, size, _ := s.Kind()\n\tif err := s.Decode(&eb); err != nil {\n\t\treturn err\n\t}\n\tbPtr.HeaderPtr, bPtr.uncles, bPtr.transactions = ebPtr.HeaderPtr, ebPtr.Uncles, ebPtr.Txs\n\tbPtr.size.Store(bgcomon.StorageSize(rlp.ListSize(size)))\n\treturn nil\n}", "title": "" }, { "docid": "9aa0a02a14ff15973ae0865d83e429c6", "score": "0.4700154", "text": "func (tx *Transaction) DecodeRLP(s *rlp.Stream) error {\n\t_, size, _ := s.Kind()\n\terr := s.Decode(&tx.data)\n\tif err == nil {\n\t\ttx.size.Store(ethcmn.StorageSize(rlp.ListSize(size)))\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "c1e352ebc55021d5715f6a19d39d781f", "score": "0.4692121", "text": "func (f *Track1) Unpack(data []byte) (int, error) {\n\tdataLen, prefBytes, err := f.spec.Pref.DecodeLength(f.spec.Length, data)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"failed to decode length: %w\", err)\n\t}\n\n\traw, read, err := f.spec.Enc.Decode(data[prefBytes:], dataLen)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"failed to decode content: %w\", err)\n\t}\n\n\tif f.spec.Pad != nil {\n\t\traw = f.spec.Pad.Unpad(raw)\n\t}\n\n\tif len(raw) > 0 {\n\t\terr = f.unpack(raw)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\treturn read + prefBytes, nil\n}", "title": "" }, { "docid": "4d3d37f8b2e48fa7b2750f75ad29864a", "score": "0.4682239", "text": "func Parse(blob []byte) (map[string]interface{}, error) {\n\treturn vdfp.Parse(string(blob))\n}", "title": "" }, { "docid": "c459b0cbe4178dfee3f7449c57042e9f", "score": "0.4671094", "text": "func UnsnappyMe(res interface{}, r io.Reader) {\n\tgreader := snappystream.NewReader(r, false)\n\tdecoder := gob.NewDecoder(greader)\n\tif err := decoder.Decode(res); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "0a783c00b7febc76185b93b38011e077", "score": "0.46658668", "text": "func decodeProcessedTransaction(ptBytes []byte, pt *modules.ProcessedTransaction) error {\n\terr := encoding.Unmarshal(ptBytes, pt)\n\treturn err\n}", "title": "" }, { "docid": "d6a582650c427aad740c83d5a468b03c", "score": "0.46641505", "text": "func (bufferQueueParam *BufferQueueParam) ExtractFromStream(stream *nex.StreamIn) error {\n\t// TODO check size\n\n\tbufferQueueParam.DataID = stream.ReadUInt64LE()\n\tbufferQueueParam.Slot = stream.ReadUInt32LE()\n\n\treturn nil\n}", "title": "" }, { "docid": "c68bdac120e26b22658b8835404c9b48", "score": "0.46633378", "text": "func (q *Eval) Unpack(r io.Reader) (err error) {\n\tvar i int\n\tvar k int\n\n\tdecoder := msgpack.NewDecoder(r)\n\n\tif i, err = decoder.DecodeMapLen(); err != nil {\n\t\treturn\n\t}\n\n\tif i != 2 {\n\t\treturn errors.New(\"Eval.Unpack: expected map of length 2\")\n\t}\n\n\tfor ; i > 0; i-- {\n\t\tif k, err = decoder.DecodeInt(); err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tswitch k {\n\t\tcase KeyExpression:\n\t\t\tif q.Expression, err = decoder.DecodeString(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase KeyTuple:\n\t\t\tq.Tuple, err = decoder.DecodeSlice()\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif len(q.Tuple) == 0 {\n\t\t\t\tq.Tuple = nil\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "20e83d3cf0d434c159c2ab8f260608c8", "score": "0.46575478", "text": "func (plc *PuplocCascade) UnpackFlp(cf string) (*PuplocCascade, error) {\n\tflpc, err := ioutil.ReadFile(cf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn plc.UnpackCascade(flpc)\n}", "title": "" }, { "docid": "1b495c0dc6c926b9b2190cd8b35043b4", "score": "0.4644869", "text": "func (p *Publish) Unpack(r io.Reader) error {\n\tvar err error\n\trestBuffer := make([]byte, p.FixHeader.RemainLength)\n\t_, err = io.ReadFull(r, restBuffer)\n\tif err != nil {\n\t\treturn codes.ErrMalformed\n\t}\n\tbufr := bytes.NewBuffer(restBuffer)\n\tp.TopicName, err = readUTF8String(true, bufr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !ValidTopicName(true, p.TopicName) {\n\t\treturn codes.ErrMalformed\n\t}\n\tif p.Qos > Qos0 {\n\t\tp.PacketID, err = readUint16(bufr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif p.Version == Version5 {\n\t\tp.Properties = &Properties{}\n\t\tif err := p.Properties.Unpack(bufr, PUBLISH); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tp.Payload = bufr.Next(bufr.Len())\n\treturn nil\n}", "title": "" }, { "docid": "405f5b3feb978646eae8aa8fa359ff4a", "score": "0.46425393", "text": "func(dp *DataPack) Unpack(binaryData []byte)(abstract_interface.AMessage,error){\n\t//make a ioReader\n\tdataBuff :=bytes.NewReader(binaryData)\n\t//Unzip head only\n\tmsg :=&Message{}\n\t//read datalen\n\tif err :=binary.Read(dataBuff,binary.LittleEndian,&msg.DataLen);err !=nil{\n\t\treturn nil,err\n\t}\n\t//read msgid\n\tif err :=binary.Read(dataBuff,binary.LittleEndian,&msg.Id);err !=nil{\n\t\treturn nil,err\n\t}\n\tif (utils.GlobalObject.MaxPackageSize>0&&msg.DataLen>utils.GlobalObject.MaxPackageSize) {\n\t\treturn nil,errors.New(\"too large msg data\")\n\t}\n\treturn msg,nil\n}", "title": "" }, { "docid": "e6005c55c1efa29aebb40abc75f77c15", "score": "0.4639807", "text": "func parseSimpleBits(br *bitReader, item *Item) error {\n\t// offset: 0 \"J\"\n\tj, err := br.ReadByte()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// offset: 8, \"M\"\n\tm, err := br.ReadByte()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif string(j) != \"J\" || string(m) != \"M\" {\n\t\treturn errors.New(\"failed to find item header JM\")\n\t}\n\n\t// offset: 16, unknown\n\tbr.ReadBits(4)\n\n\t// offset: 20\n\tif item.Identified, err = br.ReadBits(1); err != nil {\n\t\treturn err\n\t}\n\n\t// offset: 21, unknown\n\tbr.ReadBits(6)\n\n\t// offset: 27\n\tif item.Socketed, err = br.ReadBits(1); err != nil {\n\t\treturn err\n\t}\n\n\t// offset 28, unknown\n\tbr.ReadBits(1)\n\n\t// offset 29\n\tif item.New, err = br.ReadBits(1); err != nil {\n\t\treturn err\n\t}\n\n\t// offset 30, unknown\n\tbr.ReadBits(2)\n\n\t// offset 32\n\tif item.IsEar, err = br.ReadBits(1); err != nil {\n\t\treturn err\n\t}\n\n\t// offset 33\n\tif item.StarterItem, err = br.ReadBits(1); err != nil {\n\t\treturn err\n\t}\n\n\t// offset 34, unknown\n\tbr.ReadBits(3)\n\n\t// offset 37, if it's a simple item, it only contains 111 bits data\n\tif item.SimpleItem, err = br.ReadBits(1); err != nil {\n\t\treturn err\n\t}\n\n\t// offset 38\n\tif item.Ethereal, err = br.ReadBits(1); err != nil {\n\t\treturn err\n\t}\n\n\t// offset 39, unknown\n\tbr.ReadBits(1)\n\n\t// offset 40\n\tif item.Personalized, err = br.ReadBits(1); err != nil {\n\t\treturn err\n\t}\n\n\t// offset 41, unknown\n\tbr.ReadBits(1)\n\n\t// offset 42\n\tif item.GivenRuneword, err = br.ReadBits(1); err != nil {\n\t\treturn err\n\t}\n\n\t// offset 43, unknown\n\tbr.ReadBits(5)\n\n\t// offset 48\n\tif item.Version, err = br.ReadBits(8); err != nil {\n\t\treturn err\n\t}\n\n\t// offset 56, unknown\n\tbr.ReadBits(2)\n\n\t// offset 58\n\tif item.LocationID, err = br.ReadBits(3); err != nil {\n\t\treturn err\n\t}\n\n\t// offset 61\n\tif item.EquippedID, err = br.ReadBits(4); err != nil {\n\t\treturn err\n\t}\n\n\t// offset 65\n\tif item.PositionX, err = br.ReadBits(4); err != nil {\n\t\treturn err\n\t}\n\n\t// offset 69\n\tif item.PositionY, err = br.ReadBits(3); err != nil {\n\t\treturn err\n\t}\n\n\t// offset 72\n\tbr.ReadBits(1)\n\n\t// offset 73, if item is neither equipped or in the belt, this tells us where it is.\n\tif item.AltPositionID, err = br.ReadBits(3); err != nil {\n\t\treturn err\n\t}\n\n\tif item.IsEar == 0 {\n\t\t// offset 76, item type, 4 chars, each 8 bit (not byte aligned)\n\t\tvar itemType string\n\t\tfor j := 0; j < 4; j++ {\n\t\t\tt, err := br.ReadBits(8)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\titemType += fmt.Sprintf(\"%c\", t)\n\t\t}\n\n\t\titem.Type = strings.Trim(itemType, \" \")\n\t\titem.TypeID = item.getTypeID()\n\n\t\tswitch item.TypeID {\n\t\tcase armor:\n\t\t\ttypeName, ok := armorCodes[item.Type]\n\t\t\tif ok {\n\t\t\t\titem.TypeName = typeName\n\t\t\t}\n\t\tcase shield:\n\t\t\ttypeName, ok := shieldCodes[item.Type]\n\t\t\tif ok {\n\t\t\t\titem.TypeName = typeName\n\t\t\t}\n\t\tcase weapon:\n\t\t\ttypeName, ok := weaponCodes[item.Type]\n\t\t\tif ok {\n\t\t\t\titem.TypeName = typeName\n\t\t\t}\n\n\t\t\t// Weapons have base damage, so we'll check our\n\t\t\t// map for the base damage of this weapon type.\n\t\t\tbaseDamage, ok := weaponDamageMap[item.Type]\n\t\t\tif ok {\n\n\t\t\t\t// If the item is ethereal we need to add 50% enhanced\n\t\t\t\t// damage to the base damage.\n\t\t\t\tif item.Ethereal == 1 {\n\t\t\t\t\tbaseDamage.Min = int((float64(baseDamage.Min) * 1.5))\n\t\t\t\t\tbaseDamage.Max = int((float64(baseDamage.Max) * 1.5))\n\t\t\t\t\tbaseDamage.TwoMin = int((float64(baseDamage.TwoMin) * 1.5))\n\t\t\t\t\tbaseDamage.TwoMax = int((float64(baseDamage.TwoMax) * 1.5))\n\t\t\t\t}\n\n\t\t\t\titem.BaseDamage = &baseDamage\n\t\t\t}\n\t\tcase other:\n\t\t\ttypeName, ok := miscCodes[item.Type]\n\t\t\tif ok {\n\t\t\t\titem.TypeName = typeName\n\t\t\t}\n\t\t}\n\n\t\t// offset 108\n\t\t// If sockets exist, read the items, they'll be 108 bit basic items * nrOfSockets\n\t\tif item.NrOfItemsInSockets, err = br.ReadBits(3); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\t// offset 76, the item is an ear, we need to read the ear data.\n\t\tearClass, err := br.ReadBits(3)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tearLevel, err := br.ReadBits(7)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tvar name string\n\t\tfor {\n\t\t\tc, err := br.ReadBits(7)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif c == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tname += fmt.Sprintf(\"%c\", c)\n\t\t}\n\n\t\titem.EarAttributes = earAttributes{\n\t\t\tClass: earClass,\n\t\t\tLevel: earLevel,\n\t\t\tName: name,\n\t\t}\n\n\t\t// If the ear is not byte aligned, we'll have to byte align it before\n\t\t// reading the next property.\n\t\tbr.Align()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "92ddf4f618a90695f7659000bdda9447", "score": "0.46378526", "text": "func (update *addStorageFolderUpdate) DecodeRLP(st *rlp.Stream) (err error) {\n\tvar pUpdate addStorageFolderUpdatePersist\n\tif err = st.Decode(&pUpdate); err != nil {\n\t\treturn\n\t}\n\tupdate.path, update.size = pUpdate.Path, pUpdate.Size\n\treturn nil\n}", "title": "" }, { "docid": "fec7bacdae914cab518d4a2acaaec51e", "score": "0.4636367", "text": "func DecodeFrom(r io.Reader, d *DBFileEntry) (int, error) {\n\treturn NewDecoder(r).Decode(d)\n}", "title": "" }, { "docid": "bb49494afb09e8c53bbb450de5c26969", "score": "0.46289495", "text": "func Decode(versioned []byte, item interface{}, mapper Mapper) error {\n\tvar version, data []byte\n\n\terr := byframe.DecodeTuple(versioned, &version, &data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttasks, item, err := migrateTasks(item, version, mapper)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tencoding, ok := item.(Encoding)\n\tif ok {\n\t\terr = encoding.Decode(data)\n\t} else {\n\t\terr = msgpack.Unmarshal(data, item)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor i := len(tasks) - 1; i >= 0; i-- {\n\t\telem := tasks[i]\n\n\t\telem.Migrate(item)\n\n\t\titem = elem\n\t}\n\n\tif len(tasks) > 0 {\n\t\treturn ErrMigrated\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1aa023233ebada32668e0d0d8634e8a3", "score": "0.4624698", "text": "func Unmarshal(data []byte, v *Plist) error {\n\tdec := NewDecoder(bytes.NewBuffer(data))\n\treturn dec.Decode(v)\n}", "title": "" }, { "docid": "1861a313335488b00aec957f1124a3a9", "score": "0.46222448", "text": "func Unpack(data map[string]interface{}) *MetaInfo {\n\tannounce := data[\"announce\"].(string)\n\tannounceList := data[\"announce-list\"].([]interface{})\n\tunpackedList := make([]string, 0, len(announceList))\n\tfor i := 0; i < len(announceList); i++ {\n\t\tannounceURL := announceList[i].([]interface{})\n\t\tunpackedList = append(unpackedList, announceURL[0].(string))\n\t}\n\n\tmeta := &MetaInfo{\n\t\tAnnounce: announce,\n\t\tAnnounceList: unpackedList,\n\t}\n\n\t// unpack info dictionary\n\tinf := data[\"info\"].(map[string]interface{})\n\tpieceLength := inf[\"piece length\"].(int64)\n\tpieces := inf[\"pieces\"].(string)\n\tname := inf[\"name\"].(string)\n\n\tinfoDict := &InfoDictionary{\n\t\tPieceLength: pieceLength,\n\t\tPieces: pieces,\n\t\tName: name,\n\t}\n\n\t// unpack files list\n\tvar fPieces []*FilePiece\n\n\t// Multi-file torrent\n\tif _, ok := inf[\"files\"]; ok {\n\t\tfiles := inf[\"files\"].([]interface{})\n\t\tfPieces = make([]*FilePiece, len(files))\n\t\tfor i := 0; i < len(files); i++ {\n\t\t\tmp := files[i].(map[string]interface{})\n\t\t\tpLength := mp[\"length\"].(int64)\n\t\t\tpathSlice := mp[\"path\"].([]interface{})\n\n\t\t\tpPath := \"\"\n\t\t\tfor i := 0; i < len(pathSlice); i++ {\n\t\t\t\tf := pathSlice[i].(string)\n\t\t\t\tpPath = filepath.Join(pPath, f)\n\t\t\t}\n\n\t\t\tfPieces[i] = &FilePiece{Length: pLength, Path: pPath}\n\t\t}\n\n\t} else {\n\t\t// Single-file torrent\n\t\tfname := inf[\"name\"].(string)\n\t\tlength := inf[\"length\"].(int64)\n\t\tfp := &FilePiece{Path: fname, Length: length}\n\t\tfPieces = append(fPieces, fp)\n\t}\n\n\tinfoDict.Files = fPieces\n\tmeta.Info = infoDict\n\treturn meta\n}", "title": "" }, { "docid": "d89c84fe123a22f98472e89d0a94a27c", "score": "0.46066537", "text": "func (pkt *SubAddNotify) Decode(bytes []byte) (err error) {\n\tvar used int\n\toffset := 4 // header\n\n\tsecureQidsCount, used, err := XdrGetUint32(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tfor i := uint32(0); i < secureQidsCount; i++ {\n\t\tpkt.SecureQuenchIDs[i], used, err = XdrGetInt64(bytes[offset:])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\toffset += used\n\t}\n\n\tinsecureQidsCount, used, err := XdrGetUint32(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tfor i := uint32(0); i < insecureQidsCount; i++ {\n\t\tpkt.InsecureQuenchIDs[i], used, err = XdrGetInt64(bytes[offset:])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\toffset += used\n\t}\n\n\tpkt.TermID, used, err = XdrGetUint64(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\t// FIXME\n\t// pkt.SubExpr\n\n\treturn nil\n}", "title": "" }, { "docid": "9c35ebd66b76eae25d7c3be5acc83c36", "score": "0.45937347", "text": "func parse(buf []byte) (string, string, string) {\n line := string(buf)\n tmp := strings.Split(line, \"|\")\n kv, msgType := tmp[0], tmp[1]\n\n tmp = strings.Split(kv, \":\")\n key, val := tmp[0], tmp[1]\n\n return key, val, msgType\n}", "title": "" }, { "docid": "9185526097409f97a8e178d937f1d68f", "score": "0.459276", "text": "func (u *UniProt) extractPDBs() error {\n\t// Extract from SIFTS\n\tpdbs, err := getSIFTSBestStructures(u.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tu.PDBs = pdbs\n\n\t// r, _ := regexp.Compile(`(?ms)PDB; (.*?); (.*?); ([\\.0-9]*).*?;.*?$`)\n\t// rStartEnd, _ := regexp.Compile(\"([0-9]*)-([0-9]*)\")\n\n\t// matches := r.FindAllStringSubmatch(string(u.Raw), -1)\n\t// // Parse each PDB match in TXT\n\t// for _, m := range matches {\n\t// \tcoverage := 0.0\n\t// \trangeMatches := rStartEnd.FindAllStringSubmatch(m[0], -1)\n\t// \tfor _, rm := range rangeMatches {\n\t// \t\tstartPos, _ := strconv.Atoi(rm[1])\n\t// \t\tendPos, _ := strconv.Atoi(rm[2])\n\t// \t\tcoverage += float64(endPos - startPos)\n\t// \t}\n\n\t// \tcoverage = coverage / float64(len(u.Sequence))\n\t// \tresolution, _ := strconv.ParseFloat(m[3], 64)\n\t// \tif m[2] == \"X-ray\" {\n\t// \t\tu.PDBs = append(u.PDBs, PDB{\n\t// \t\t\tID: m[1],\n\t// \t\t\tCoverage: coverage,\n\t// \t\t\tMethod: m[2],\n\t// \t\t\tResolution: resolution,\n\t// \t\t})\n\t// \t}\n\t// }\n\n\treturn nil\n}", "title": "" }, { "docid": "161ced495b923c51ce061521fb91d16c", "score": "0.45924014", "text": "func parseStackFromBytes(data []byte) (stack *v1alpha1.Stack, err error) {\n\terr = yaml.Unmarshal(data, &stack)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "9ff23217ccf1732d9e5925a26cb5793f", "score": "0.45815286", "text": "func (pp *Pkt) Parse(buf []byte) error {\n\tif len(buf) < 4 {\n\t\treturn fmt.Errorf(\"not enough bytes for a PAP pkt %d\", len(buf))\n\t}\n\tpp.Code = Code(buf[0])\n\tpp.ID = uint8(buf[1])\n\tpp.Len = binary.BigEndian.Uint16(buf[2:4])\n\tswitch pp.Code {\n\tcase CodeAuthRequest:\n\t\tif pp.Len < 6 {\n\t\t\treturn fmt.Errorf(\"invalid PAP Auth request length %d\", pp.Len)\n\t\t}\n\t\tif buf[4] == 0 || buf[4] > 249 {\n\t\t\treturn fmt.Errorf(\"invalid Peer ID length %d\", buf[4])\n\t\t}\n\t\tpp.PeerID = buf[5 : 5+buf[4]]\n\t\tif buf[5+buf[4]] == 0 || buf[5+buf[4]] > 249 {\n\t\t\treturn fmt.Errorf(\"invalid Passwd length %d\", buf[5+buf[4]])\n\t\t}\n\t\tpp.Passwd = buf[6+buf[4]:]\n\tdefault:\n\t\tif buf[4] > 250 {\n\t\t\treturn fmt.Errorf(\"invalid msg length %d\", buf[4])\n\t\t}\n\t\tpp.Msg = buf[5:]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a838714841634ed2708697c6d618fe86", "score": "0.45645782", "text": "func UnMarshal(db string, v *model.KValDBType) error {\n\tb, err := ReadFile(db)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\treturn json.Unmarshal(b, v)\n}", "title": "" }, { "docid": "192510fced8b6bfd807489a6ffe19ff5", "score": "0.4558386", "text": "func (wks *RDataWKS) unpack(packet []byte) error {\n\twks.Address = append(wks.Address, packet[0:4]...)\n\twks.Protocol = packet[4]\n\twks.BitMap = packet[5:]\n\treturn nil\n}", "title": "" }, { "docid": "efdcb6c03371319517bdd38b70afd4d1", "score": "0.45513797", "text": "func (p *POUpdates) ParsePackage(pkg []byte, db *sql.DB) (code int, err error) {\n\t//09.27.2013 naj - unpack the data and make sure we have the minimum required data.\n\terr = json.Unmarshal(pkg, &p.PurchaseOrders)\n\n\tif err != nil {\n\t\tcode = http.StatusBadRequest\n\t\treturn code, err\n\t}\n\n\tfor i := 0; i < len(p.PurchaseOrders); i++ {\n\t\tc := p.PurchaseOrders[i]\n\n\t\t//09.27.2013 naj - check to see if we have a Merx PO Number\n\t\t//matched, err := regexp.MatchString(\"^MERX-.*\", c.InternalID)\n\n\t\tif err != nil {\n\t\t\tcode = http.StatusInternalServerError\n\t\t\treturn code, err\n\t\t}\n\n\t\t//if !matched || c.InternalID == \"\" {\n\t\t//\tcode = http.StatusBadRequest\n\t\t//\terr = errors.New(\"Missing Internal ID\")\n\t\t//\treturn code, err\n\t\t//}\n\n\t\tif c.Status <= 0 {\n\t\t\tcode = http.StatusBadRequest\n\t\t\terr = errors.New(\"Missing Status\")\n\t\t\treturn code, err\n\t\t}\n\n\t}\n\n\tp.db = db\n\treturn 0, nil\n}", "title": "" }, { "docid": "e29ca7c4a570cdc8312de2ac5f4a4f4d", "score": "0.45424426", "text": "func (b *ImportLookupBody) DecodeFromBytes(data []byte, version uint8) error {\n\tfamily := addressFamilyFromApi(b.Api, version)\n\taddrByteLen, err := addressByteLength(family)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(data) < addrByteLen {\n\t\treturn fmt.Errorf(\"message length invalid\")\n\t}\n\n\tbuf := make([]byte, addrByteLen)\n\tcopy(buf, data[0:addrByteLen])\n\tpos := addrByteLen\n\n\tb.Addr = net.IP(buf).To4()\n\n\tif len(data[pos:]) > int(1+addrByteLen) {\n\t\tb.Metric = binary.BigEndian.Uint32(data[pos : pos+4])\n\t\tpos += 4\n\t\tb.Nexthops = []Nexthop{}\n\t\tif nexthopsByteLen, err := decodeNexthopsFromBytes(&b.Nexthops, data[pos:], family, version); err != nil {\n\t\t\treturn err\n\t\t} else {\n\t\t\tpos += nexthopsByteLen\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "74f33122851a3eedd351eb18d849747a", "score": "0.4534237", "text": "func (s *ESSHBannerRecord) decodeFromBytes(data []byte, df gopacket.DecodeFeedback) (int, error) {\n\t/*\tif len(data) > maxVersionStringBytes {\n\t\treturn 0, fmt.Errorf(\"Invalid version string, it should be less than %d characters including <CR><LF>\",\n\t\t\tmaxVersionStringBytes,\n\t\t)\n\t}*/\n\n\tversionString := make([]byte, 0, 64)\n\tvar ok bool\n\tvar buf [1]byte\n\tcrlf := 0\n\n\tr := bytes.NewReader(data)\n\n\tfor length := 0; length < maxVersionStringBytes; length++ {\n\t\t_, err := io.ReadFull(r, buf[:])\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\t// The RFC says that the version should be terminated with \\r\\n\n\t\t// but several SSH servers actually only send a \\n.\n\t\tif buf[0] == '\\n' {\n\t\t\tif !bytes.HasPrefix(versionString, []byte(\"SSH-\")) {\n\t\t\t\t// RFC 4253 says we need to ignore all version string lines\n\t\t\t\t// except the one containing the SSH version (provided that\n\t\t\t\t// all the lines do not exceed 255 bytes in total).\n\t\t\t\tversionString = versionString[:0]\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcrlf += 1\n\t\t\tok = true\n\t\t\tbreak\n\t\t}\n\n\t\t// non ASCII chars are disallowed, but we are lenient,\n\t\t// since Go doesn't use null-terminated strings.\n\n\t\t// The RFC allows a comment after a space, however,\n\t\t// all of it (version and comments) goes into the\n\t\t// session hash.\n\t\tversionString = append(versionString, buf[0])\n\t}\n\n\tif !ok {\n\t\treturn 0, errors.New(\"invalid version string\")\n\t}\n\n\t// There might be a '\\r' on the end which we should remove.\n\tif len(versionString) > 0 && versionString[len(versionString)-1] == '\\r' {\n\t\tversionString = versionString[:len(versionString)-1]\n\t\tcrlf += 1\n\t}\n\n\tlvs := len(versionString)\n\n\t// First 4 bytes are \"SSH-\", we skip these.\n\tbptr := 4\n\n\t// Next is the protocol version before the next `-`\n\tp := bytes.Index(data[bptr:], []byte(\"-\"))\n\tif p < 1 {\n\t\treturn 0, errors.New(\"invalid version string: length of protocol version is too short\")\n\t}\n\ts.ProtoVersion = string(data[bptr:(bptr + p)])\n\tbptr += p\n\tbptr += 1 // skip -\n\n\t// Next is the software version before either a space or end of versionstring.\n\tsp := bytes.Index(data[bptr:], []byte{0x20})\n\tif sp < 0 {\n\t\t// No comment given\n\t\ts.SoftwareVersion = string(data[bptr:lvs])\n\t\tbptr = lvs\n\t} else {\n\t\t// Software version is everything before the space.\n\t\ts.SoftwareVersion = string(data[bptr:(bptr + sp)])\n\t\tbptr += sp\n\t}\n\n\tbptr += crlf // Skip the line feed bytes.\n\treturn bptr, nil\n}", "title": "" }, { "docid": "d4437200957613d955c7f352c8ce5043", "score": "0.45337108", "text": "func (p *TFTPErrPkt) Unpack(data []byte) {\n\tp.Opcode = binary.BigEndian.Uint16(data[:2])\n\tp.ErrCode = binary.BigEndian.Uint16(data[2:4])\n\tp.ErrMsg = string(bytes.TrimSuffix(data[4:], []byte{00}))\n}", "title": "" }, { "docid": "a4401b9bd77a0b27dfa633c52404aa51", "score": "0.4532314", "text": "func loadDBSData(data []byte) []utils.Record {\n\tvar out []utils.Record\n\n\t// to prevent json.Unmarshal behavior to convert all numbers to float\n\t// we'll use json decode method with instructions to use numbers as is\n\tbuf := bytes.NewBuffer(data)\n\tdec := json.NewDecoder(buf)\n\tdec.UseNumber()\n\terr := dec.Decode(&out)\n\n\t// original way to decode data\n\t// err := json.Unmarshal(data, &out)\n\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"DBS unable to unmarshal the data, data=%s, error=%v\", string(data), err)\n\t\tlog.Error(msg)\n\t}\n\treturn out\n}", "title": "" }, { "docid": "7834cdc563f3e245517bd68ef770cc1a", "score": "0.45297638", "text": "func ParseUncompressed(d []byte) (*big.Int, *big.Int, error) {\n\tif len(d) != 65 {\n\t\treturn nil, nil, fmt.Errorf(\"Input has wrong length %d (expected 65).\", len(d))\n\t}\n\tif d[0] != 0x04 {\n\t\treturn nil, nil, fmt.Errorf(\"Input has wrong prefix 0x%x (expected 0x04).\", d[0])\n\t}\n\treturn new(big.Int).SetBytes(d[1:33]), new(big.Int).SetBytes(d[33:65]), nil\n}", "title": "" }, { "docid": "b8aa2b07129a1ff6fe70335f09a3b8f7", "score": "0.45285308", "text": "func TransactionUnpack([]byte) Transaction { panic(\"\") }", "title": "" }, { "docid": "1fe0c62c57b7f3dcb173774670f52cab", "score": "0.45235762", "text": "func (Ptr) DecodeFromPtr(p Ptr) Ptr { return p }", "title": "" }, { "docid": "490cd7cb587edcb9eab843aeab3a1b54", "score": "0.45084772", "text": "func (p *TFTPDataPkt) Unpack(data []byte) {\n\tp.Opcode = binary.BigEndian.Uint16(data[:2])\n\tp.Block = binary.BigEndian.Uint16(data[2:4])\n\tp.Data = data[4:]\n}", "title": "" }, { "docid": "b54d1c1512c686398df653d9c5668b76", "score": "0.45067006", "text": "func parseUnpinRPC(rpc *protocol.RPC) *protocol.UnPin {\n\t// Check type is correct\n\tif rpc.MessageType != protocol.RPC_UNPIN {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"Message\": rpc,\n\t\t}).Error(\"Wrong message type recieved. STORE ANSWER expected.\")\n\n\t\treturn nil\n\t}\n\n\t// Parse message as Store\n\tstore := &protocol.UnPin{}\n\tif err := proto.Unmarshal(rpc.Message, store); err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"Error\": err,\n\t\t\t\"Msg\": rpc.Message,\n\t\t}).Error(\"Failed to parse incomming Store answer message.\")\n\t}\n\n\treturn store\n}", "title": "" }, { "docid": "a644670bd1c98af1f238762f4c006bce", "score": "0.45059496", "text": "func (d *Decoder) Decode(db *Database) error {\n\t// Read header\n\tdb.Header = new(DBHeader)\n\tif err := db.Header.readFrom(d.r); err != nil {\n\t\treturn err\n\t}\n\n\t// Calculate transformed key to decrypt and calculate HMAC\n\ttransformedKey, err := db.getTransformedKey()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Read hashes and validate them (Kdbx v4)\n\tif db.Header.IsKdbx4() {\n\t\tdb.Hashes = new(DBHashes)\n\t\tif err := db.Hashes.readFrom(d.r); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif db.Options.ValidateHashes {\n\t\t\tif err := db.Header.ValidateSha256(db.Hashes.Sha256); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\thmacKey := buildHmacKey(db, transformedKey)\n\t\t\tif err := db.Header.ValidateHmacSha256(hmacKey, db.Hashes.Hmac); err != nil {\n\t\t\t\treturn errors.New(\"Wrong password? HMAC-SHA256 of header mismatching\")\n\t\t\t}\n\t\t}\n\t}\n\n\t// Decode raw content\n\trawContent, _ := ioutil.ReadAll(d.r)\n\tif err := decodeRawContent(db, rawContent, transformedKey); err != nil {\n\t\treturn err\n\t}\n\n\tcontentReader := bytes.NewReader(db.Content.RawData)\n\n\t// Read InnerHeader (Kdbx v4)\n\tif db.Header.IsKdbx4() {\n\t\tdb.Content.InnerHeader = new(InnerHeader)\n\t\tif err := db.Content.InnerHeader.readFrom(contentReader); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Decode xml\n\txmlDecoder := xml.NewDecoder(contentReader)\n\treturn xmlDecoder.Decode(db.Content)\n}", "title": "" }, { "docid": "6a88aa28e3d973650286c257bfee7952", "score": "0.45021537", "text": "func Parse(r io.Reader, fieldKey string, failOnDup bool) (packages map[string]Package, err error) {\n\tif !strings.Contains(strings.Join(Fields, \"|\"), fieldKey) {\n\t\terr = fmt.Errorf(\"unknown field can't be used as map key: %s\", fieldKey)\n\t\treturn\n\t}\n\n\tpackages = make(map[string]Package)\n\tregList := make(map[string]*regexp.Regexp)\n\tfor _, field := range Fields {\n\t\tregList[field] = regexp.MustCompile(fmt.Sprintf(\"(?i)^%s: (.+)$\", field))\n\t}\n\n\ts := bufio.NewScanner(r)\n\tp := Package{}\n\tkey := \"\"\n\tfor s.Scan() {\n\t\tcurStr := s.Text()\n\t\tif curStr == \"\" {\n\t\t\tif failOnDup {\n\t\t\t\tif _, ok := packages[key]; ok {\n\t\t\t\t\terr = fmt.Errorf(\"duplicate package for field key %s: %s\", fieldKey, key)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tpackages[key] = p\n\n\t\t\tp = Package{}\n\t\t\tkey = \"\"\n\t\t}\n\t\tfor field, reg := range regList {\n\t\t\tmatch := reg.FindAllStringSubmatch(curStr, -1)\n\t\t\tif len(match) == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tval := match[0][1]\n\n\t\t\tif field == fieldKey {\n\t\t\t\tkey = val\n\t\t\t}\n\n\t\t\tswitch field {\n\t\t\tcase \"Package\":\n\t\t\t\tp.setPackage(val)\n\t\t\t\tbreak\n\t\t\tcase \"Priority\":\n\t\t\t\tp.setPriority(val)\n\t\t\t\tbreak\n\t\t\tcase \"Section\":\n\t\t\t\tp.setSection(val)\n\t\t\t\tbreak\n\t\t\tcase \"Installed-Size\":\n\t\t\t\tvar valInt int\n\t\t\t\tvalInt, err = strconv.Atoi(val)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tp.setInstalledSize(int64(valInt))\n\t\t\t\tbreak\n\t\t\tcase \"Maintainer\":\n\t\t\t\tp.setMaintainer(val)\n\t\t\t\tbreak\n\t\t\tcase \"Architecture\":\n\t\t\t\tp.setArchitecture(val)\n\t\t\t\tbreak\n\t\t\tcase \"Version\":\n\t\t\t\tp.setVersion(val)\n\t\t\t\tbreak\n\t\t\tcase \"Depends\":\n\t\t\t\tp.setDepends(val)\n\t\t\t\tbreak\n\t\t\tcase \"Filename\":\n\t\t\t\tp.setFilename(val)\n\t\t\t\tbreak\n\t\t\tcase \"Size\":\n\t\t\t\tvar valInt int\n\t\t\t\tvalInt, err = strconv.Atoi(val)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tp.setSize(int64(valInt))\n\t\t\t\tbreak\n\t\t\tcase \"MD5sum\":\n\t\t\t\tp.setMD5sum(val)\n\t\t\t\tbreak\n\t\t\tcase \"SHA1\":\n\t\t\t\tp.setSHA1(val)\n\t\t\t\tbreak\n\t\t\tcase \"SHA256\":\n\t\t\t\tp.setSHA256(val)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t}\n\treturn\n}", "title": "" }, { "docid": "18b2cc39d98e946ac1bc5d78eb5d7633", "score": "0.44965178", "text": "func Decode(pfxData []byte, password string) (privateKey interface{}, certificate *x509.Certificate, err error) {\n\tencodedPassword, err := bmpString(password)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tbags, encodedPassword, err := getSafeContents(pfxData, encodedPassword)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tif len(bags) != 2 {\n\t\terr = errors.New(\"pkcs12: expected exactly two safe bags in the PFX PDU\")\n\t\treturn\n\t}\n\n\tfor _, bag := range bags {\n\t\tswitch {\n\t\tcase bag.Id.Equal(oidCertBag):\n\t\t\tif certificate != nil {\n\t\t\t\terr = errors.New(\"pkcs12: expected exactly one certificate bag\")\n\t\t\t}\n\n\t\t\tcertsData, err := decodeCertBag(bag.Value.Bytes)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t\tcerts, err := x509.ParseCertificates(certsData)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t\tif len(certs) != 1 {\n\t\t\t\terr = errors.New(\"pkcs12: expected exactly one certificate in the certBag\")\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t\tcertificate = certs[0]\n\n\t\tcase bag.Id.Equal(oidPKCS8ShroudedKeyBag):\n\t\t\tif privateKey != nil {\n\t\t\t\terr = errors.New(\"pkcs12: expected exactly one key bag\")\n\t\t\t}\n\n\t\t\tif privateKey, err = decodePkcs8ShroudedKeyBag(bag.Value.Bytes, encodedPassword); err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\tif certificate == nil {\n\t\treturn nil, nil, errors.New(\"pkcs12: certificate missing\")\n\t}\n\tif privateKey == nil {\n\t\treturn nil, nil, errors.New(\"pkcs12: private key missing\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "8114a8e21911d0dcbf089938657d2a4d", "score": "0.449468", "text": "func UnpackMap(r io.Reader, ptr interface{}) error {\n\tvar err error\n\tvar head byte\n\n\tmapTyp := reflect.TypeOf(ptr).Elem()\n\tmapVal := reflect.ValueOf(ptr).Elem()\n\n\tif err = binary.Read(r, binary.BigEndian, &head); err != nil {\n\t\treturn err\n\t}\n\n\tif head == 0xc0 { // nil\n\t\treflect.ValueOf(ptr).Elem().Set(reflect.Zero(reflect.TypeOf(ptr).Elem()))\n\t\treturn nil\n\t}\n\n\tvar srcLen = 0\n\tif head&0xf0 == 0x80 { // map\n\t\tsrcLen = int(head & 0x0f)\n\t} else if head == 0xde {\n\t\tvar temp uint16\n\t\tif err = binary.Read(r, binary.BigEndian, &temp); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsrcLen = int(temp)\n\t} else if head == 0xdf {\n\t\tvar temp uint32\n\t\tif err = binary.Read(r, binary.BigEndian, &temp); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsrcLen = int(temp)\n\t} else {\n\t\treturn fmt.Errorf(\"msgp: unpacked value is not a map\")\n\t}\n\n\tmapVal.Set(reflect.MakeMap(reflect.MapOf(mapTyp.Key(), mapTyp.Elem()))) // map 생성.\n\tfor inx := 0; inx < srcLen; inx++ {\n\t\tkeyPtr := reflect.New(mapTyp.Key())\n\t\tif err = Unpack(r, keyPtr.Interface()); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tvalPtr := reflect.New(mapTyp.Elem())\n\t\tif err = Unpack(r, valPtr.Interface()); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tmapVal.SetMapIndex(keyPtr.Elem(), valPtr.Elem())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ae418b4832e376477512d1622557cf26", "score": "0.44924846", "text": "func (p *rfc5424) Parse(bs []byte) (map[string]interface{}, error) {\n\tnext, pri, err := ParsePriority(bs)\n\tif err != nil {\n\t\tif '\"' == bs[0] {\n\t\t\tnext, pri, err = ParsePriority(bs[1:]) // p.parsePriority()\n\t\t\tif err != nil {\n\t\t\t\ttxt := string(bs)\n\t\t\t\treturn map[string]interface{}{\n\t\t\t\t\t\"priority\": 0,\n\t\t\t\t\t\"facility\": 0,\n\t\t\t\t\t\"severity\": 0,\n\t\t\t\t\t\"version\": NO_VERSION,\n\t\t\t\t\t\"timestamp\": time.Now(),\n\t\t\t\t\t\"message\": txt,\n\t\t\t\t}, nil\n\t\t\t}\n\n\t\t\tif bs[len(bs)-1] == '\"' && next[len(next)-1] == '\"' {\n\t\t\t\tnext = next[:len(next)-1]\n\t\t\t}\n\t\t}\n\t}\n\t// fmt.Println(\"====1\", string(next))\n\tnext, version, _ := ParseVersion(next)\n\t// fmt.Println(\"====2\", string(next))\n\tnext, ts, _ := p.parseTimestamp(next)\n\t// fmt.Println(\"====3\", string(next), ts)\n\tvar hostname, appName, msgId, sd string\n\tvar procId interface{}\n\tif !ts.IsZero() {\n\t\tnext, hostname = ParseHostname(next)\n\t\t//fmt.Println(\"====4\", string(next))\n\t\tnext, appName, _ = p.parseAppName(next)\n\t\t//fmt.Println(\"====5\", string(next))\n\t\tnext, procId, _ = p.parseProcId(next)\n\t\t//fmt.Println(\"====6\", string(next))\n\t\tnext, msgId, _ = p.parseMsgId(next)\n\t\t//fmt.Println(\"====7\", string(next))\n\t\tnext, sd, _ = p.parseStructuredData(next)\n\t\t//fmt.Println(\"====7\", string(next))\n\t}\n\tmessage := bytes.TrimSpace(next)\n\tif ts.IsZero() {\n\t\tts = time.Now()\n\t}\n\n\t//result := sd\n\t//if result == nil {\n\tresult := map[string]interface{}{}\n\t//}\n\tresult[\"priority\"] = pri.P\n\tresult[\"facility\"] = pri.F.Value\n\tresult[\"severity\"] = pri.S.Value\n\tresult[\"version\"] = version\n\tresult[\"timestamp\"] = ts\n\tresult[\"host\"] = hostname\n\tresult[\"app\"] = appName\n\tresult[\"pid\"] = procId\n\tresult[\"message_id\"] = msgId\n\tresult[\"structured_data\"] = sd\n\tresult[\"message\"] = string(message)\n\treturn result, nil\n}", "title": "" }, { "docid": "cc6b58061811d15be3b464369c3df55d", "score": "0.44881687", "text": "func TestParseBFD(t *testing.T) {\n\trawFile := filepath.Join(testdataDir, \"scion-bfd.bin\")\n\traw, err := os.ReadFile(rawFile)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tpkt := gopacket.NewPacket(raw, slayers.LayerTypeSCION, gopacket.Default)\n\tpe := pkt.ErrorLayer()\n\tif pe != nil {\n\t\trequire.NoError(t, pe.Error())\n\t}\n\tbfd := pkt.Layer(layers.LayerTypeBFD)\n\trequire.NotNil(t, bfd)\n\tassert.IsType(t, &layers.BFD{}, bfd)\n}", "title": "" }, { "docid": "2a56ee57581aa1143cff421b0e10d1d2", "score": "0.44855353", "text": "func decodePPPoE(data []byte, p gopacket.PacketBuilder) error {\n\tpppoe := &PPPoE{\n\t\tVersion: data[0] >> 4,\n\t\tType: data[0] & 0x0F,\n\t\tCode: PPPoECode(data[1]),\n\t\tSessionId: binary.BigEndian.Uint16(data[2:4]),\n\t\tLength: binary.BigEndian.Uint16(data[4:6]),\n\t}\n\tpppoe.BaseLayer = BaseLayer{data[:6], data[6 : 6+pppoe.Length]}\n\tp.AddLayer(pppoe)\n\treturn p.NextDecoder(pppoe.Code)\n}", "title": "" }, { "docid": "75a599c6d924e800bc778ef86c82bfd5", "score": "0.44848984", "text": "func Decode(pfxData []byte, password string) (privateKey interface{}, certificate *x509.Certificate, err error) {\n\tencodedPassword, err := bmpString(password)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tbags, encodedPassword, err := getSafeContents(pfxData, encodedPassword)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tif len(bags) != 2 {\n\t\terr = errors.New(\"pkcs12: expected exactly two safe bags in the PFX PDU\")\n\t\treturn\n\t}\n\n\tfor _, bag := range bags {\n\t\tswitch {\n\t\tcase bag.Id.Equal(oidCertBag):\n\t\t\tif certificate != nil {\n\t\t\t\terr = errors.New(\"pkcs12: expected exactly one certificate bag\")\n\t\t\t}\n\n\t\t\tcertsData, err := decodeCertBag(bag.Value.Bytes)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t\tcerts, err := x509.ParseCertificates(certsData)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t\tif len(certs) != 1 {\n\t\t\t\terr = errors.New(\"pkcs12: expected exactly one certificate in the certBag\")\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t\tcertificate = certs[0]\n\n\t\tcase bag.Id.Equal(oidPKCS8ShroundedKeyBag):\n\t\t\tif privateKey != nil {\n\t\t\t\terr = errors.New(\"pkcs12: expected exactly one key bag\")\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\n\t\t\tif privateKey, err = decodePkcs8ShroudedKeyBag(bag.Value.Bytes, encodedPassword); err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\tif certificate == nil {\n\t\treturn nil, nil, errors.New(\"pkcs12: certificate missing\")\n\t}\n\tif privateKey == nil {\n\t\treturn nil, nil, errors.New(\"pkcs12: private key missing\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "1fb7503ce1013ebc930e17961b3d93a0", "score": "0.44845602", "text": "func (b *BloomFilter) Unpack(rawbytes []byte) error {\n\t/*\n\t\trawbytes, err := base64.StdEncoding.DecodeString(packed)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}*/\n\n\ttmp := [3]uint64{0, 0, 0}\n\tgr, err := gzip.NewReader(bytes.NewReader(rawbytes))\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = binary.Read(gr, binary.LittleEndian, &tmp)\n\tif err != nil {\n\t\treturn err\n\t}\n\tb.advised = 0\n\tb.estError = 0.0\n\tb.size = tmp[0]\n\tb.keys = tmp[1]\n\tb.nadded = tmp[2]\n\n\tb.parts = make([]uint64, 1+(b.size/64))\n\n\t// force reload on next hash\n\tb.h0State = b.h0State[:0]\n\tb.h1State = b.h1State[:0]\n\n\treturn binary.Read(gr, binary.LittleEndian, b.parts)\n}", "title": "" }, { "docid": "2d257121426c6b510e333aaed1c88be6", "score": "0.448101", "text": "func (s *SCMP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {\n\tif size := len(data); size < 4 {\n\t\tdf.SetTruncated()\n\t\treturn serrors.New(\"SCMP layer length is less then 4 bytes\", \"minimum\", 4, \"actual\", size)\n\t}\n\ts.TypeCode = CreateSCMPTypeCode(SCMPType(data[0]), SCMPCode(data[1]))\n\ts.Checksum = binary.BigEndian.Uint16(data[2:4])\n\ts.BaseLayer = BaseLayer{Contents: data[:4], Payload: data[4:]}\n\treturn nil\n}", "title": "" }, { "docid": "fac4cdac27eb8352b23a431c6aa3a7b9", "score": "0.44789678", "text": "func Unpack(value string) (Value, error) {\n\tfields := strings.Fields(value)\n\tif len(fields) < 3 {\n\t\treturn Value{}, fmt.Errorf(\"invalid number of fields: %q\", value)\n\t}\n\tkey, err := strconv.ParseUint(fields[0], 10, 32)\n\tif err != nil {\n\t\treturn Value{}, err\n\t}\n\tsecs, err := strconv.ParseInt(fields[1], 10, 64)\n\tif err != nil {\n\t\treturn Value{}, err\n\t}\n\tdata, err := hex.DecodeString(fields[2])\n\tif err != nil {\n\t\treturn Value{}, err\n\t}\n\tmsg := &dns.Msg{}\n\tif err := msg.Unpack(data); err != nil {\n\t\treturn Value{}, err\n\t}\n\treturn Value{\n\t\tKey: uint32(key),\n\t\tCreatedAt: time.Unix(secs, 0),\n\t\tmsg: msg,\n\t}, nil\n}", "title": "" }, { "docid": "9663c49f2aac1b7f370215a7b308f8f9", "score": "0.4478129", "text": "func (p *BitcoinBlockParser) UnpackTx(buf []byte) (*bchain.Tx, uint32, error) {\n\theight := binary.BigEndian.Uint32(buf)\n\tbt, l := vlq.Int(buf[4:])\n\ttx, err := p.ParseTx(buf[4+l:])\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\ttx.Blocktime = bt\n\treturn tx, height, nil\n}", "title": "" }, { "docid": "9873bcc57982c39867296ec56f86cc3b", "score": "0.44780484", "text": "func Unpack(b []byte) (out map[string]interface{}) {\n\t_ = json.Unmarshal(b, &out)\n\treturn\n}", "title": "" }, { "docid": "9873bcc57982c39867296ec56f86cc3b", "score": "0.44780484", "text": "func Unpack(b []byte) (out map[string]interface{}) {\n\t_ = json.Unmarshal(b, &out)\n\treturn\n}", "title": "" } ]
5c67ecac7c8975783d086087288f176a
setBucketMetadata set bucket metadata
[ { "docid": "19540e79542e43cbb610934af9d77410", "score": "0.8470253", "text": "func (donut API) setBucketMetadata(bucketName string, bucketMetadata map[string]string) error {\n\tif err := donut.listDonutBuckets(); err != nil {\n\t\treturn iodine.New(err, nil)\n\t}\n\tmetadata, err := donut.getDonutBucketMetadata()\n\tif err != nil {\n\t\treturn iodine.New(err, nil)\n\t}\n\toldBucketMetadata := metadata.Buckets[bucketName]\n\tacl, ok := bucketMetadata[\"acl\"]\n\tif !ok {\n\t\treturn iodine.New(InvalidArgument{}, nil)\n\t}\n\toldBucketMetadata.ACL = BucketACL(acl)\n\tmetadata.Buckets[bucketName] = oldBucketMetadata\n\treturn donut.setDonutBucketMetadata(metadata)\n}", "title": "" } ]
[ { "docid": "8b049e73288929505b2b907ef4f43b59", "score": "0.8343396", "text": "func (d donut) SetBucketMetadata(bucket string, bucketMetadata map[string]string) error {\n\terr := d.getDonutBuckets()\n\tif err != nil {\n\t\treturn iodine.New(err, nil)\n\t}\n\tmetadata, err := d.getDonutBucketMetadata()\n\tif err != nil {\n\t\treturn iodine.New(err, nil)\n\t}\n\toldBucketMetadata := metadata[bucket]\n\t// TODO ignore rest of the keys for now, only mutable data is \"acl\"\n\toldBucketMetadata[\"acl\"] = bucketMetadata[\"acl\"]\n\tmetadata[bucket] = oldBucketMetadata\n\treturn d.setDonutBucketMetadata(metadata)\n}", "title": "" }, { "docid": "c83bc19126262f1d399fd3194db38478", "score": "0.6620964", "text": "func setFSBucketsMetadataPath(metadataPath string) {\n\tbucketsMetadataPath = metadataPath\n}", "title": "" }, { "docid": "3fb8acebb8bd00cf78cf01b3612fa8c6", "score": "0.6354882", "text": "func (b BlobURL) SetMetadata(ctx context.Context, metadata Metadata, ac BlobAccessConditions) (*BlobSetMetadataResponse, error) {\n\tifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.ModifiedAccessConditions.pointers()\n\treturn b.blobClient.SetMetadata(ctx, nil, metadata, ac.LeaseAccessConditions.pointers(),\n\t\tifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil)\n}", "title": "" }, { "docid": "2b79c5c28f1b16e579ebfe1fe8847c8e", "score": "0.61866933", "text": "func (b *Client) SetMetadata(ctx context.Context, metadata map[string]*string, o *SetMetadataOptions) (SetMetadataResponse, error) {\n\tbasics := generated.BlobClientSetMetadataOptions{Metadata: metadata}\n\tleaseAccessConditions, cpkInfo, cpkScope, modifiedAccessConditions := o.format()\n\tresp, err := b.generated().SetMetadata(ctx, &basics, leaseAccessConditions, cpkInfo, cpkScope, modifiedAccessConditions)\n\treturn resp, err\n}", "title": "" }, { "docid": "5e3bb93388019e799fa1006f4a24e155", "score": "0.6172994", "text": "func (m *metricData) SetMetadata(name string, repo string, group string, domain string, aggregator string) {\n\tm.Meta = map[string]string{\"repo\": repo, \"group\": group, \"domain\": domain, \"aggregator\": aggregator}\n}", "title": "" }, { "docid": "8c68bb8840f212852791bbbf0102037f", "score": "0.6158976", "text": "func (r *AWSAmplifyBranch) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "3e0146f5927da8a7f8b3b199662ba338", "score": "0.6088111", "text": "func (client blobsClient) SetMetadata(ctx context.Context, timeout *int32, metadata map[string]string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatches *ETag, ifNoneMatch *ETag, requestID *string) (*BlobsSetMetadataResponse, error) {\n\tif err := validate([]validation{\n\t\t{targetValue: timeout,\n\t\t\tconstraints: []constraint{{target: \"timeout\", name: null, rule: false,\n\t\t\t\tchain: []constraint{{target: \"timeout\", name: inclusiveMinimum, rule: 0, chain: nil}}}}},\n\t\t{targetValue: metadata,\n\t\t\tconstraints: []constraint{{target: \"metadata\", name: null, rule: false,\n\t\t\t\tchain: []constraint{{target: \"metadata\", name: pattern, rule: `^[a-zA-Z]+$`, chain: nil}}}}}}); err != nil {\n\t\treturn nil, err\n\t}\n\treq, err := client.setMetadataPreparer(timeout, metadata, leaseID, ifModifiedSince, ifUnmodifiedSince, ifMatches, ifNoneMatch, requestID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.setMetadataResponder}, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp.(*BlobsSetMetadataResponse), err\n}", "title": "" }, { "docid": "07f4a244a439c95cf743673fee8c9482", "score": "0.6036214", "text": "func saveBucketsMetadata(buckets Buckets) *probe.Error {\n\tqc, err := quick.New(buckets)\n\tif err != nil {\n\t\treturn err.Trace()\n\t}\n\tif err := qc.Save(bucketsMetadataPath); err != nil {\n\t\treturn err.Trace()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a99c43c9728a932988674b3bbd7e7d9d", "score": "0.5965085", "text": "func (r *AWSGluePartition_StorageDescriptor) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "d1177828af043a90ee633854658bdc71", "score": "0.5954957", "text": "func putMetadata(db storage.Table, p peer.ID, key string, val interface{}) error {\n\tk := pmBase.ChildString(p.Pretty()).ChildString(key)\n\tvar buf pool.Buffer\n\tif err := gob.NewEncoder(&buf).Encode(&val); err != nil {\n\t\treturn err\n\t}\n\treturn db.Put(k.Bytes(), buf.Bytes())\n}", "title": "" }, { "docid": "801560e9f05359d81a21d3b1badfe7dc", "score": "0.5891817", "text": "func (u AccountUpdater) SetMetadata(metadata string) AccountUpdater {\n\tu.fields[string(AccountDBSchema.Metadata)] = metadata\n\treturn u\n}", "title": "" }, { "docid": "26a311be4e74ecde7692e03721d8ab96", "score": "0.585729", "text": "func (client shareClient) SetMetadata(ctx context.Context, timeout *int32, metadata map[string]string) (*ShareSetMetadataResponse, error) {\n\tif err := validate([]validation{\n\t\t{targetValue: timeout,\n\t\t\tconstraints: []constraint{{target: \"timeout\", name: null, rule: false,\n\t\t\t\tchain: []constraint{{target: \"timeout\", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {\n\t\treturn nil, err\n\t}\n\treq, err := client.setMetadataPreparer(timeout, metadata)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.setMetadataResponder}, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp.(*ShareSetMetadataResponse), err\n}", "title": "" }, { "docid": "bdd149e0933b7821e40f49dc1b94354a", "score": "0.58383286", "text": "func CacheBucketSet(name, location string) *S3BucketCacheItem {\n\tbucket := S3BucketCacheItem{\n\t\tCacheItem: s3CacheItem{Timestamp: time.Now(), TTL: Options.BucketCacheTTL},\n\t\tName: name,\n\t\tLocation: location,\n\t}\n\tmutexB.Lock()\n\tdefer mutexB.Unlock()\n\ts3Buckets[name] = &bucket\n\tLogInfo(\"S3 Bucket Cache Set - \" + bucket.String())\n\treturn &bucket\n}", "title": "" }, { "docid": "5fce0483e3d32c14605257115f43a94b", "score": "0.57754505", "text": "func (m *ObjectMapping) SetMetadata(value []ObjectMappingMetadataEntryable)() {\n err := m.GetBackingStore().Set(\"metadata\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "f63e6b9a5b3280f7ce3e3a76e6b486ff", "score": "0.57310426", "text": "func (client Client) SetBucketTagging(bucketName string, tagging Tagging, options ...Option) error {\n\tvar err error\n\tvar bs []byte\n\tbs, err = xml.Marshal(tagging)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbuffer := new(bytes.Buffer)\n\tbuffer.Write(bs)\n\n\tcontentType := http.DetectContentType(buffer.Bytes())\n\theaders := map[string]string{}\n\theaders[HTTPHeaderContentType] = contentType\n\n\tparams := map[string]interface{}{}\n\tparams[\"tagging\"] = nil\n\tresp, err := client.do(\"PUT\", bucketName, params, headers, buffer, options...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\treturn CheckRespCode(resp.StatusCode, []int{http.StatusOK})\n}", "title": "" }, { "docid": "5d2a9094362ac24aaee50725f4895ad4", "score": "0.5730072", "text": "func getMetadata(w io.Writer, bucket, object string) (*storage.ObjectAttrs, error) {\n\t// bucket := \"bucket-name\"\n\t// object := \"object-name\"\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"storage.NewClient: %w\", err)\n\t}\n\tdefer client.Close()\n\n\tctx, cancel := context.WithTimeout(ctx, time.Second*10)\n\tdefer cancel()\n\n\to := client.Bucket(bucket).Object(object)\n\tattrs, err := o.Attrs(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Object(%q).Attrs: %w\", object, err)\n\t}\n\tfmt.Fprintf(w, \"Bucket: %v\\n\", attrs.Bucket)\n\tfmt.Fprintf(w, \"CacheControl: %v\\n\", attrs.CacheControl)\n\tfmt.Fprintf(w, \"ContentDisposition: %v\\n\", attrs.ContentDisposition)\n\tfmt.Fprintf(w, \"ContentEncoding: %v\\n\", attrs.ContentEncoding)\n\tfmt.Fprintf(w, \"ContentLanguage: %v\\n\", attrs.ContentLanguage)\n\tfmt.Fprintf(w, \"ContentType: %v\\n\", attrs.ContentType)\n\tfmt.Fprintf(w, \"Crc32c: %v\\n\", attrs.CRC32C)\n\tfmt.Fprintf(w, \"Generation: %v\\n\", attrs.Generation)\n\tfmt.Fprintf(w, \"KmsKeyName: %v\\n\", attrs.KMSKeyName)\n\tfmt.Fprintf(w, \"Md5Hash: %v\\n\", attrs.MD5)\n\tfmt.Fprintf(w, \"MediaLink: %v\\n\", attrs.MediaLink)\n\tfmt.Fprintf(w, \"Metageneration: %v\\n\", attrs.Metageneration)\n\tfmt.Fprintf(w, \"Name: %v\\n\", attrs.Name)\n\tfmt.Fprintf(w, \"Size: %v\\n\", attrs.Size)\n\tfmt.Fprintf(w, \"StorageClass: %v\\n\", attrs.StorageClass)\n\tfmt.Fprintf(w, \"TimeCreated: %v\\n\", attrs.Created)\n\tfmt.Fprintf(w, \"Updated: %v\\n\", attrs.Updated)\n\tfmt.Fprintf(w, \"Event-based hold enabled? %t\\n\", attrs.EventBasedHold)\n\tfmt.Fprintf(w, \"Temporary hold enabled? %t\\n\", attrs.TemporaryHold)\n\tfmt.Fprintf(w, \"Retention expiration time %v\\n\", attrs.RetentionExpirationTime)\n\tfmt.Fprintf(w, \"Custom time %v\\n\", attrs.CustomTime)\n\tfmt.Fprintf(w, \"\\n\\nMetadata\\n\")\n\tfor key, value := range attrs.Metadata {\n\t\tfmt.Fprintf(w, \"\\t%v = %v\\n\", key, value)\n\t}\n\treturn attrs, nil\n}", "title": "" }, { "docid": "c5b33159e4490d02595f3202625707a1", "score": "0.5722393", "text": "func (h *CuratorSrvHandler) SetMetadata(req core.SetMetadataReq, reply *core.Error) error {\n\top := h.opm.Start(\"SetMetadata\")\n\tdefer op.EndWithBlbError(reply)\n\n\tif !h.pendingSem.TryAcquire() {\n\t\top.TooBusy()\n\t\treturn errBusy\n\t}\n\tdefer h.pendingSem.Release()\n\n\t*reply = h.curator.setMetadata(req.Blob, req.Metadata)\n\n\tlog.Infof(\"SetMetadata: req %+v reply %+v\", req, *reply)\n\n\treturn nil\n}", "title": "" }, { "docid": "1f0caae5e80271fa4848e6e411761414", "score": "0.57195944", "text": "func (b *BCacheClient) Set(bucket, key, value string) error {\n\tu := b.addr + bucket + \"/\" + key\n\n\treq, err := http.NewRequest(\"PUT\", u, bytes.NewBuffer([]byte(value)))\n\treq.Header.Add(\"User-Agent\", \"BCache client \"+version)\n\n\t// Create a new client\n\tclient := &http.Client{}\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\n\treturn nil\n}", "title": "" }, { "docid": "02a7a135ead0e836d3741d0a16c8d3d1", "score": "0.5678749", "text": "func (inst *MintNft) SetMetadataAccount(metadata ag_solanago.PublicKey) *MintNft {\n\tinst.AccountMetaSlice[4] = ag_solanago.Meta(metadata).WRITE()\n\treturn inst\n}", "title": "" }, { "docid": "4ab3f5556342a87e40da26ac9397f50d", "score": "0.5575338", "text": "func (svc service) GetMetadataBucket() abstract.ObjectStorageBucket {\n\tif svc.IsNull() {\n\t\treturn abstract.ObjectStorageBucket{}\n\t}\n\treturn svc.metadataBucket\n}", "title": "" }, { "docid": "e6fb6604168504c012ec1f97e4512004", "score": "0.55542266", "text": "func ExtractBucketMetadata(boltPath string) ([]api.BucketMetadataManifest, error) {\n\tdb, err := bbolt.Open(boltPath, 0666, &bbolt.Options{ReadOnly: true, Timeout: 1 * time.Second})\n\tif err != nil {\n\t\t// Hack to give a slightly nicer error message for a known failure mode when bolt calls\n\t\t// mmap on a file system that doesn't support the MAP_SHARED option.\n\t\t//\n\t\t// See: https://github.com/boltdb/bolt/issues/272\n\t\t// See: https://stackoverflow.com/a/18421071\n\t\tif err.Error() == \"invalid argument\" {\n\t\t\treturn nil, fmt.Errorf(\"unable to open boltdb: mmap of %q may not support the MAP_SHARED option\", boltPath)\n\t\t}\n\n\t\treturn nil, fmt.Errorf(\"unable to open boltdb: %w\", err)\n\t}\n\tdefer db.Close()\n\n\t// Read raw metadata needed to construct a manifest.\n\tvar buckets []influxdbBucketSchema\n\torgNamesById := map[string]string{}\n\tdbInfoByBucketId := map[string]*DatabaseInfo{}\n\n\tif err := db.View(func(tx *bbolt.Tx) error {\n\t\tbucketDB := tx.Bucket(bucketsBoltBucket)\n\t\tif bucketDB == nil {\n\t\t\treturn errors.New(\"bucket metadata not found in local KV store\")\n\t\t}\n\n\t\tif err := bucketDB.ForEach(func(k, v []byte) error {\n\t\t\tvar b influxdbBucketSchema\n\t\t\tif err := json.Unmarshal(v, &b); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif b.Type != 1 { // 1 == \"system\"\n\t\t\t\tbuckets = append(buckets, b)\n\t\t\t}\n\t\t\treturn nil\n\t\t}); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to read bucket metadata from local KV store: %w\", err)\n\t\t}\n\n\t\torgsDB := tx.Bucket(organizationsBoltBucket)\n\t\tif orgsDB == nil {\n\t\t\treturn errors.New(\"organization metadata not found in local KV store\")\n\t\t}\n\n\t\tif err := orgsDB.ForEach(func(k, v []byte) error {\n\t\t\tvar o influxdbOrganizationSchema\n\t\t\tif err := json.Unmarshal(v, &o); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\torgNamesById[o.ID] = o.Name\n\t\t\treturn nil\n\t\t}); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to read organization metadata from local KV store: %w\", err)\n\t\t}\n\n\t\tv1DB := tx.Bucket(v1MetadataBoltBucket)\n\t\tif v1DB == nil {\n\t\t\treturn errors.New(\"v1 database info not found in local KV store\")\n\t\t}\n\t\tfullMeta := v1DB.Get(v1MetadataBoltKey)\n\t\tif fullMeta == nil {\n\t\t\treturn errors.New(\"v1 database info not found in local KV store\")\n\t\t}\n\n\t\tvar pb Data\n\t\tif err := proto.Unmarshal(fullMeta, &pb); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to unmarshal v1 database info: %w\", err)\n\t\t}\n\t\tfor _, rawDBI := range pb.GetDatabases() {\n\t\t\tdbInfoByBucketId[*rawDBI.Name] = rawDBI\n\t\t}\n\n\t\treturn nil\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\tmanifests := make([]api.BucketMetadataManifest, len(buckets))\n\tfor i, b := range buckets {\n\t\torgName, ok := orgNamesById[b.OrgID]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"local KV store in inconsistent state: no organization found with ID %q\", b.OrgID)\n\t\t}\n\t\tdbi, ok := dbInfoByBucketId[b.ID]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"local KV store in inconsistent state: no V1 database info found for bucket %q\", b.Name)\n\t\t}\n\t\tmanifests[i] = combineMetadata(b, orgName, dbi)\n\t}\n\n\treturn manifests, nil\n}", "title": "" }, { "docid": "73a570e959e81e07f75b2816db18c6ea", "score": "0.55425084", "text": "func (d donut) GetBucketMetadata(bucket string) (map[string]string, error) {\n\terr := d.getDonutBuckets()\n\tif err != nil {\n\t\treturn nil, iodine.New(err, nil)\n\t}\n\tif _, ok := d.buckets[bucket]; !ok {\n\t\treturn nil, iodine.New(BucketNotFound{Bucket: bucket}, nil)\n\t}\n\tmetadata, err := d.getDonutBucketMetadata()\n\tif err != nil {\n\t\treturn nil, iodine.New(err, nil)\n\t}\n\treturn metadata[bucket], nil\n}", "title": "" }, { "docid": "8a8b020752e0a09d0d5448f25beffa46", "score": "0.55255187", "text": "func (b *DataBuilder) Bucket(bucket string) *DataBuilder {\n\tb.data.Bucket = bucket\n\treturn b\n}", "title": "" }, { "docid": "3adf1e5ccef1d7cf7bddeee7bb2f5c0f", "score": "0.5516516", "text": "func (donut API) getBucketMetadata(bucketName string) (BucketMetadata, error) {\n\tif err := donut.listDonutBuckets(); err != nil {\n\t\treturn BucketMetadata{}, iodine.New(err, nil)\n\t}\n\tif _, ok := donut.buckets[bucketName]; !ok {\n\t\treturn BucketMetadata{}, iodine.New(BucketNotFound{Bucket: bucketName}, nil)\n\t}\n\tmetadata, err := donut.getDonutBucketMetadata()\n\tif err != nil {\n\t\treturn BucketMetadata{}, iodine.New(err, nil)\n\t}\n\treturn metadata.Buckets[bucketName], nil\n}", "title": "" }, { "docid": "d19ebef227b0c9b5bccc673ef6e411d1", "score": "0.55136234", "text": "func (client Client) SetBucketLifecycle(bucketName string, rules []LifecycleRule) error {\n\terr := verifyLifecycleRules(rules)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlifecycleCfg := LifecycleConfiguration{Rules: rules}\n\tbs, err := xml.Marshal(lifecycleCfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbuffer := new(bytes.Buffer)\n\tbuffer.Write(bs)\n\n\tcontentType := http.DetectContentType(buffer.Bytes())\n\theaders := map[string]string{}\n\theaders[HTTPHeaderContentType] = contentType\n\n\tparams := map[string]interface{}{}\n\tparams[\"lifecycle\"] = nil\n\tresp, err := client.do(\"PUT\", bucketName, params, headers, buffer)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\treturn CheckRespCode(resp.StatusCode, []int{http.StatusOK})\n}", "title": "" }, { "docid": "5139732dc38049bbf2b293dec66c55c4", "score": "0.5504114", "text": "func (self Canvas) SetMetadata(key string, value string) error {\n\tsuccess := C.MagickSetImageProperty(self.wand, C.CString(key), C.CString(value))\n\tif success == C.MagickFalse {\n\t\treturn fmt.Errorf(\"Could not set metadata: %s\", self.Error())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5d7afa88c796f9d99bb49a0ab7ef4c53", "score": "0.5496216", "text": "func (me *UnstructuredSloMapping) SetMetadata(metadata map[string]interface{}) {\n\tme.Object[\"metadata\"] = metadata\n}", "title": "" }, { "docid": "837eeda4e2e92ff502080f3697f25a3d", "score": "0.5486721", "text": "func (r *AWSPinpointSegment_SegmentDimensions) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "0d87e4e5849e5bfd7a1e6c0a5e4b9909", "score": "0.5482538", "text": "func SetMetadata(md []string) {\n\tlogMutex.Lock()\n\tdefer logMutex.Unlock()\n\n\tmetadata = md\n}", "title": "" }, { "docid": "1795e9ced32e6f72035466625ee9b0f1", "score": "0.54511774", "text": "func SetBucketProps(bp BaseParams, bck cmn.Bck, props *cmn.BucketPropsToUpdate) (string, error) {\n\tb := cos.MustMarshal(apc.ActMsg{Action: apc.ActSetBprops, Value: props})\n\treturn patchBprops(bp, bck, b)\n}", "title": "" }, { "docid": "f1e647c6584223c2962bd7f002bd442b", "score": "0.54452085", "text": "func (r *AWSCloudFrontDistribution_DistributionConfig) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "57281f5291ca3715f15ebb3b7f07af24", "score": "0.5430705", "text": "func (m *K8sObjectMutation) SetMetadata(s []string) {\n\tm.metadata = &s\n}", "title": "" }, { "docid": "3f158097638174a1cc1c399539996664", "score": "0.54156107", "text": "func (k KeybaseServiceMeasured) PutGitMetadata(\n\tctx context.Context, folder keybase1.FolderHandle, repoID keybase1.RepoID,\n\tmetadata keybase1.GitLocalMetadata) (err error) {\n\tk.putGitMetadataTimer.Time(func() {\n\t\terr = k.delegate.PutGitMetadata(ctx, folder, repoID, metadata)\n\t})\n\treturn err\n}", "title": "" }, { "docid": "1b4262ae7ad83801d41612255e249251", "score": "0.53942895", "text": "func (m *DeviceManagementCachedReportConfiguration) SetMetadata(value *string)() {\n err := m.GetBackingStore().Set(\"metadata\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "e32a0b9ea56afd85c69f0b26b3ff4802", "score": "0.5352583", "text": "func (r cliCommand) getFileMetadata(key, bucket string) (*s3.HeadObjectOutput, error) {\n\treturn r.s3Client.HeadObject(&s3.HeadObjectInput{\n\t\tBucket: aws.String(bucket),\n\t\tKey: aws.String(key),\n\t})\n}", "title": "" }, { "docid": "b39137bd61a2df4bcea5b368767008d3", "score": "0.5347387", "text": "func (c Client) PutObjectWithMetadata(bucketName, objectName string, reader io.Reader, metadata map[string][]string, progress io.Reader) (n int64, err error) {\n\treturn c.PutObjectWithProgress(bucketName, objectName, reader, metadata, progress)\n}", "title": "" }, { "docid": "60d554a922be04acdde543634bf5999b", "score": "0.5340995", "text": "func (client Client) SetBucketLogging(bucketName, targetBucket, targetPrefix string,\n\tisEnable bool) error {\n\tvar err error\n\tvar bs []byte\n\tif isEnable {\n\t\tlxml := LoggingXML{}\n\t\tlxml.LoggingEnabled.TargetBucket = targetBucket\n\t\tlxml.LoggingEnabled.TargetPrefix = targetPrefix\n\t\tbs, err = xml.Marshal(lxml)\n\t} else {\n\t\tlxml := loggingXMLEmpty{}\n\t\tbs, err = xml.Marshal(lxml)\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbuffer := new(bytes.Buffer)\n\tbuffer.Write(bs)\n\n\tcontentType := http.DetectContentType(buffer.Bytes())\n\theaders := map[string]string{}\n\theaders[HTTPHeaderContentType] = contentType\n\n\tparams := map[string]interface{}{}\n\tparams[\"logging\"] = nil\n\tresp, err := client.do(\"PUT\", bucketName, params, headers, buffer)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\treturn CheckRespCode(resp.StatusCode, []int{http.StatusOK})\n}", "title": "" }, { "docid": "b8589e297c3412f177b987abf7f74bb8", "score": "0.533794", "text": "func (t *CommitFile) SetMetadata(v string) {\n\tt.Metadata = &v\n}", "title": "" }, { "docid": "a9c81b89336fc0c8f70d228745c6e87b", "score": "0.5333898", "text": "func Write(b *bytes.Buffer, projectID *string, bucketName string, objectName string, attr map[string]interface{}) error {\n\tctx := context.Background()\n\n\tclient, err := storage.NewClient(ctx, getCreds())\n\tif e, ok := err.(*googleapi.Error); ok {\n\t\tif e.Code == 409 {\n\t\t\tlog.Printf(\"error %v\\n\", e.Error())\n\t\t}\n\t}\n\t// create bucket handle\n\tbkt := client.Bucket(bucketName)\n\n\t//test if bkthandle exists?\n\tif err := existsBucket(ctx, bkt); err != nil {\n\t\tbkt, err = createBucket(ctx, projectID, bucketName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// TODO: sort attributes on the bucket\n\tba, err := bkt.Attrs(ctx)\n\tboa, err := bkt.DefaultObjectACL().List(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Printf(\"Attributes %v\\n\", ba)\n\tlog.Printf(\"Default Object ACL %v\\n\", boa)\n\t// if not sync'd need to error so as not to create insecure stuff\n\n\twc := bkt.Object(objectName).NewWriter(ctx)\n\twc.ContentType = \"text/json\"\n\n\tif _, err = io.Copy(wc, b); err != nil {\n\t\tlog.Printf(\"Error: %v\\n\", err)\n\t}\n\n\t//push new attr triples at some point in future\n\twc.ACL = []storage.ACLRule{{Entity: storage.AllUsers, Role: storage.RoleReader}}\n\tlog.Println(\"updated object:\", wc.Attrs())\n\n\tif err := wc.Close(); err != nil {\n\t\tlog.Printf(\"Error: %v\\n\", err)\n\t}\n\treturn nil\n\n}", "title": "" }, { "docid": "eeb838615ddd2a7b43f1b6a06ec8f9c2", "score": "0.5293283", "text": "func loadBucketsMetadata() (*Buckets, *probe.Error) {\n\tbuckets := &Buckets{}\n\tbuckets.Version = \"1\"\n\tbuckets.Metadata = make(map[string]*BucketMetadata)\n\tqc, err := quick.New(buckets)\n\tif err != nil {\n\t\treturn nil, err.Trace()\n\t}\n\tif err := qc.Load(bucketsMetadataPath); err != nil {\n\t\treturn nil, err.Trace()\n\t}\n\treturn qc.Data().(*Buckets), nil\n}", "title": "" }, { "docid": "e1691077ee727c59d96a37907ad5da02", "score": "0.5285767", "text": "func (r *AWSServerlessApi) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "997a92f342eec72ba95b0396e4fda026", "score": "0.5272819", "text": "func (c *Client) PutBucketCors(ctx context.Context, bucketName string, xmlCors string) (err error) {\n\t// Validate the input arguments.\n\tif err := s3utils.CheckValidBucketNameStrict(bucketName); err != nil {\n\t\treturn err\n\t}\n\n\turlValues := make(url.Values)\n\turlValues.Set(`cors`, ``)\n\n\th := http.Header{}\n\th.Set(`content-md5`, sumMD5Base64([]byte(xmlCors)))\n\n\tbyt := []byte(xmlCors)\n\n\t// PUT bucket request metadata.\n\treqMetadata := requestMetadata{\n\t\tbucketName: bucketName,\n\t\tcontentBody: bytes.NewReader(byt),\n\t\tcontentLength: int64(len(byt)),\n\t\tqueryValues: urlValues,\n\t\tcustomHeader: h,\n\t}\n\n\t// Execute PUT to create a new bucket.\n\tresp, err := c.executeMethod(ctx, http.MethodPut, reqMetadata)\n\tdefer closeResponse(resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif resp != nil {\n\t\tif resp.StatusCode != http.StatusOK {\n\t\t\treturn httpRespToErrorResponse(resp, bucketName, \"\")\n\t\t}\n\t}\n\n\t// Success.\n\treturn nil\n}", "title": "" }, { "docid": "6867146661ec1cf2aa674237ec6354f9", "score": "0.5263979", "text": "func (r *BucketRequest) putBucketTagging() error {\n\n\tclient := &http.Client{Transport: util.InsecureHTTPTransport}\n\ts3Status := &r.SysClient.NooBaa.Status.Services.ServiceS3\n\ts3Config := &aws.Config{\n\t\tCredentials: credentials.NewStaticCredentials(\n\t\t\tr.SysClient.SecretAdmin.StringData[\"AWS_ACCESS_KEY_ID\"],\n\t\t\tr.SysClient.SecretAdmin.StringData[\"AWS_SECRET_ACCESS_KEY\"],\n\t\t\t\"\",\n\t\t),\n\t\tRegion: aws.String(\"us-east-1\"),\n\t\tEndpoint: aws.String(s3Status.InternalDNS[0]),\n\t\tS3ForcePathStyle: aws.Bool(true),\n\t\tHTTPClient: client,\n\t}\n\ts3Session, err := session.NewSession(s3Config)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts3Client := s3.New(s3Session)\n\n\t// convert labels to tagging array\n\ttaggingArray := []*s3.Tag{}\n\tfor key, value := range r.OBC.Labels {\n\t\t// no need to put tagging of these labels\n\t\tif !util.Contains([]string{\"app\", \"noobaa-domain\", \"bucket-provisioner\"}, key) {\n\t\t\tkeyPointer := key\n\t\t\tvaluePointer := value\n\t\t\ttaggingArray = append(taggingArray, &s3.Tag{Key: &keyPointer, Value: &valuePointer})\n\t\t}\n\t}\n\tlogrus.Infof(\"put bucket tagging on bucket: %s tagging: %+v \", r.BucketName, taggingArray)\n\tif len(taggingArray) == 0 {\n\t\treturn nil\n\t}\n\t_, err = s3Client.PutBucketTagging(&s3.PutBucketTaggingInput{\n\t\tBucket: &r.BucketName,\n\t\tTagging: &s3.Tagging{\n\t\t\tTagSet: taggingArray,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e88297b1ff4671ac15a88d5adf25e5f7", "score": "0.52551234", "text": "func (s *Server) PutMeta(ctx context.Context, request *pm.PutMetaRequest) (*pm.PutMetaResponse, error) {\n\ts.m.RLock()\n\tbucket, ok := s.Bucket[request.Bucket]\n\tif !ok {\n\t\ts.m.RUnlock()\n\t\treturn nil, status.Error(codes.NotFound, \"bucket not exist\")\n\t}\n\tbucket.m.Lock()\n\tdefer bucket.m.Unlock()\n\ts.m.RUnlock()\n\tentry := &Entry{\n\t\tKey: request.Key,\n\t\tTag: request.Tag,\n\t\tName: request.Name,\n\t\tAddress: request.Address,\n\t\tVolume: request.VolumeId,\n\t\tOffset: request.Offset,\n\t\tSize: request.Size,\n\t\tCreateTime: time.Now().Unix(),\n\t}\n\n\tbucket.MemoTree.put(request.Key, entry)\n\tbucket.MemoSize += request.Size\n\ts.TagMap[request.Tag] = &EntryMeta{\n\t\tAddress: request.Address,\n\t\tVolume: request.VolumeId,\n\t\tOffset: request.Offset,\n\t\tSize: request.Size,\n\t}\n\tif bucket.MemoTree.size() >= s.config.LayerKeyThreshold {\n\t\tvolumes, err := bucket.rotate()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, v := range volumes {\n\t\t\tlogrus.WithField(\"action\", \"put\").Debugf(\"Reference increase on volume %v\", v)\n\t\t\ts.ref[v]++\n\t\t}\n\t}\n\treturn &pm.PutMetaResponse{}, nil\n}", "title": "" }, { "docid": "7d78d13e9d5b8b888a2c8a269f058bf6", "score": "0.52525234", "text": "func (l *Logger) SetMetadata(meta map[string]interface{}) {\n\tl.metadata = meta\n}", "title": "" }, { "docid": "21e377a14f977e9d0daec0e9ee5bb4ff", "score": "0.52515894", "text": "func (m *AggregationOption) SetBucketDefinition(value BucketAggregationDefinitionable)() {\n err := m.GetBackingStore().Set(\"bucketDefinition\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "0ce91398d827603723ec59ea43f8db1b", "score": "0.5249163", "text": "func (c *Client) SetBucketNotification(ctx context.Context, bucketName string, config notification.Configuration) error {\n\t// Input validation.\n\tif err := s3utils.CheckValidBucketName(bucketName); err != nil {\n\t\treturn err\n\t}\n\n\t// Get resources properly escaped and lined up before\n\t// using them in http request.\n\turlValues := make(url.Values)\n\turlValues.Set(\"notification\", \"\")\n\n\tnotifBytes, err := xml.Marshal(&config)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnotifBuffer := bytes.NewReader(notifBytes)\n\treqMetadata := requestMetadata{\n\t\tbucketName: bucketName,\n\t\tqueryValues: urlValues,\n\t\tcontentBody: notifBuffer,\n\t\tcontentLength: int64(len(notifBytes)),\n\t\tcontentMD5Base64: sumMD5Base64(notifBytes),\n\t\tcontentSHA256Hex: sum256Hex(notifBytes),\n\t}\n\n\t// Execute PUT to upload a new bucket notification.\n\tresp, err := c.executeMethod(ctx, http.MethodPut, reqMetadata)\n\tdefer closeResponse(resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif resp != nil {\n\t\tif resp.StatusCode != http.StatusOK {\n\t\t\treturn httpRespToErrorResponse(resp, bucketName, \"\")\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "87d3132955db738c91557e9051884a11", "score": "0.5237202", "text": "func SetBucketLifecycle(s3Client Client, bucketName string) error {\n\tbucketLifecycleConfigurationInput := &s3.PutBucketLifecycleConfigurationInput{\n\t\tBucket: aws.String(bucketName),\n\t\tLifecycleConfiguration: &s3.BucketLifecycleConfiguration{\n\t\t\tRules: []*s3.LifecycleRule{\n\t\t\t\t{\n\t\t\t\t\tID: aws.String(\"Backup Expiry\"),\n\t\t\t\t\tStatus: aws.String(\"Enabled\"),\n\t\t\t\t\tFilter: &s3.LifecycleRuleFilter{\n\t\t\t\t\t\tPrefix: aws.String(\"backups/\"),\n\t\t\t\t\t},\n\t\t\t\t\tExpiration: &s3.LifecycleExpiration{\n\t\t\t\t\t\tDays: aws.Int64(90),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tif err := bucketLifecycleConfigurationInput.Validate(); err != nil {\n\t\treturn fmt.Errorf(\"unable to validate %v bucket lifecycle configuration: %v\", bucketName, err)\n\t}\n\n\t_, err := s3Client.PutBucketLifecycleConfiguration(bucketLifecycleConfigurationInput)\n\n\treturn err\n}", "title": "" }, { "docid": "ab91aac508901f94c9f9d469d06af23a", "score": "0.52350074", "text": "func (c *jsiiProxy_CfnAsset) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "a549fbc0fad7579b607861a4cdd9f173", "score": "0.52175343", "text": "func (me *AbstractCollector) SetMetadata(m *matrix.Matrix) {\n\tme.Metadata = m\n}", "title": "" }, { "docid": "0b4c3cfed21fe6f6c63122f342071a86", "score": "0.52136654", "text": "func (s *SignPayloadOutput) SetMetadata(v map[string]*string) *SignPayloadOutput {\n\ts.Metadata = v\n\treturn s\n}", "title": "" }, { "docid": "e889eecc4eca77106e27985bde82e545", "score": "0.5208655", "text": "func (r *AWSKinesisFirehoseDeliveryStream_OrcSerDe) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "7cc3eb5a99005b5df2f9917a9ad97743", "score": "0.52004087", "text": "func (c *Client) SetBucket(req *RpbSetBucketReq) (err error) {\n\tprof := NewProfile(\"set_bucket\", string(req.GetBucket()))\n\tdefer c.instrument(prof, err)\n\n\terr = c.retry(func() error {\n\t\treturn c.do(MsgRpbSetBucketReq, req, nil, prof)\n\t}, prof)\n\n\treturn\n}", "title": "" }, { "docid": "abeff87b477d8f8236c720b12dd7384d", "score": "0.5195897", "text": "func (r *AWSBackupBackupSelection_BackupSelectionResourceType) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "ef672f2af83c14fd0589a00723c78741", "score": "0.51914215", "text": "func (a *API) PutBucket(name string, acl ACLType) error {\n\treturn a.Do(\"PUT\", name, \"\", nil, ACL(acl))\n}", "title": "" }, { "docid": "e9bb48adbfe80d4ee94de6c744cf7d12", "score": "0.5187511", "text": "func (o SpacesBucketObjectOutput) Metadata() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v *SpacesBucketObject) pulumi.StringMapOutput { return v.Metadata }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "1c1c63353365ff8cc9d1e55b7d7b7631", "score": "0.5187315", "text": "func (w *GenericWriter[T]) SetKeyValueMetadata(key, value string) {\n\tw.base.SetKeyValueMetadata(key, value)\n}", "title": "" }, { "docid": "37fe8cf3f194a24d34ab1f2103275072", "score": "0.51768094", "text": "func (msa *MetadataServiceSpace) setMetadataJsonForItem(itemPtr metadata_typedefs.IMetadataItem, version *core.AppVersion) error {\n if msa.mdVersionList.IsVersionValid(version) == false {\n return errors.New(\"invalid version\")\n }\n\n var err error\n var metadataJsonBytes []byte\n if config.GetEnvironmentConfiguration().AppEnvironment == config.PRODUCTION {\n metadataJsonBytes, err = json.Marshal(itemPtr)\n } else {\n metadataJsonBytes, err = json.MarshalIndent(itemPtr, \"\", \" \")\n }\n if err != nil {\n return errors.New(\"error deserializing metadata|error=\" + err.Error())\n }\n metadataJson := string(metadataJsonBytes)\n\n // If version is marked as current, also update the cache\n if msa.mdVersionList.IsVersionCurrent(version) {\n\n cachedMetadataForVersion, ok := msa.mdCache[version.String()]\n if !ok {\n logger.LogError(\"failed to find cached metadata while writing\" +\n \"|metadata space=\" + itemPtr.GetMetadataSpace().String() +\n \"|metadata item key=\" + itemPtr.GetKey() +\n \"|version=\" + version.String())\n return errors.New(\"failed to find cached metadata for version (this should theoretically never happen)\")\n }\n cachedMetadataForVersion.Cache[itemPtr.GetKey()] = metadataJson\n }\n\n // Save the metadata item\n err = msa.mdFetcher.SetMetadataJsonByKey(itemPtr.GetKey(), metadataJson, version.String())\n if err != nil {\n return errors.New(\"error saving metadata json|error=\" + err.Error())\n }\n\n // Generate hash of the file's contents\n hashBytes := md5.Sum([]byte(metadataJson))\n hash := hex.EncodeToString(hashBytes[:])\n\n // Update the metadata manifest for this version\n manifest, err := msa.getMetadataManifestForVersion(version)\n if err != nil {\n return errors.New(\"error getting metadata manifest for version|error=\" + err.Error())\n }\n manifest.SetManifestItem(itemPtr.GetKey(), hash)\n err = msa.setMetadataManifestForVersion(manifest, version)\n if err != nil {\n return errors.New(\"error updating metadata manifest for version|error=\" + err.Error())\n }\n\n return nil\n}", "title": "" }, { "docid": "f41afb7874f43f0ba17d68b1ab14dee5", "score": "0.5176115", "text": "func (d *Devfile200) SetMetadata(name, version string) {\n\td.Metadata = common.DevfileMetadata{\n\t\tName: name,\n\t\tVersion: version,\n\t}\n}", "title": "" }, { "docid": "94844a2aabfc987742bee13929f3f0eb", "score": "0.51703364", "text": "func PutObjectWithSetters(sess *session.Session, bucket *string, key *string) error {\n //snippet-start:[s3.go.put_object.call]\n svc := s3.New(sess)\n\n _, err := svc.PutObject((&s3.PutObjectInput{}).\n SetBucket(*bucket).\n SetKey(*key).\n SetBody(strings.NewReader(\"object body\")), //.\n // SetWebsiteRedirectLocation(\"https://example.com/something\"),\n )\n //snippet-end:[s3.go.put_object.call]\n if err != nil {\n return err\n }\n\n return nil\n}", "title": "" }, { "docid": "ce29b00ac2bd2a8fd00329ca5ed29382", "score": "0.5169843", "text": "func (c *jsiiProxy_CfnJobQueue) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "7207a3d60f0310d79dd9dc4bfe81144f", "score": "0.5167213", "text": "func (o *Object) setMetaData(info *api.Item) {\n\to.hasMetaData = true\n\to.size = info.Size\n\n\t// Docs: https://dev.onedrive.com/facets/hashes_facet.htm\n\t//\n\t// The docs state both that the hashes are returned as hex\n\t// strings, and as base64 strings. Testing reveals they are in\n\t// fact uppercase hex strings.\n\t//\n\t// In OneDrive for Business, SHA1 and CRC32 hash values are not returned for files.\n\tif info.File != nil {\n\t\to.mimeType = info.File.MimeType\n\t\tif info.File.Hashes.Sha1Hash != \"\" {\n\t\t\to.sha1 = strings.ToLower(info.File.Hashes.Sha1Hash)\n\t\t}\n\t}\n\tif info.FileSystemInfo != nil {\n\t\to.modTime = time.Time(info.FileSystemInfo.LastModifiedDateTime)\n\t} else {\n\t\to.modTime = time.Time(info.LastModifiedDateTime)\n\t}\n\to.id = info.ID\n}", "title": "" }, { "docid": "309f3543a8a0a875358f53b66c8dbb4a", "score": "0.51574546", "text": "func (client Client) SetBucketWebsite(bucketName, indexDocument, errorDocument string) error {\n\twxml := WebsiteXML{}\n\twxml.IndexDocument.Suffix = indexDocument\n\twxml.ErrorDocument.Key = errorDocument\n\n\tbs, err := xml.Marshal(wxml)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbuffer := new(bytes.Buffer)\n\tbuffer.Write(bs)\n\n\tcontentType := http.DetectContentType(buffer.Bytes())\n\theaders := make(map[string]string)\n\theaders[HTTPHeaderContentType] = contentType\n\n\tparams := map[string]interface{}{}\n\tparams[\"website\"] = nil\n\tresp, err := client.do(\"PUT\", bucketName, params, headers, buffer)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\treturn CheckRespCode(resp.StatusCode, []int{http.StatusOK})\n}", "title": "" }, { "docid": "2bdb55fd3e13f78ff8ab2e0ced1fc5c7", "score": "0.5152386", "text": "func (o BucketObjectOutput) Metadata() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v *BucketObject) pulumi.StringMapOutput { return v.Metadata }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "8070a639ab392fafc7534739aea6894b", "score": "0.51314497", "text": "func (db *DB) Set(bucket, key, value []byte) error {\n\tif len(bucket) == 0 {\n\t\treturn ErrEmptyBucket\n\t}\n\n\treturn db.db.Batch(func(tx *bolt.Tx) error {\n\t\tb, err := tx.CreateBucketIfNotExists(bucket)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn b.Put(key, value)\n\t})\n}", "title": "" }, { "docid": "9b368e9e3a6ad046b08c4482396ca778", "score": "0.512287", "text": "func (g *GoFakeS3) headBucket(bucket string, w http.ResponseWriter, r *http.Request) error {\n\tg.log.Print(LogInfo, \"HEAD BUCKET\", bucket)\n\tg.log.Print(LogInfo, \"bucketname:\", bucket)\n\n\tif err := g.ensureBucketExists(bucket); err != nil {\n\t\treturn err\n\t}\n\n\tw.Write([]byte{})\n\treturn nil\n}", "title": "" }, { "docid": "26336e0d7d95cb393609e30bcdac5df9", "score": "0.5109908", "text": "func (client Client) SetBucketAsyncTask(bucketName string, asynConf AsyncFetchTaskConfiguration, options ...Option) (AsyncFetchTaskResult, error) {\n\tvar out AsyncFetchTaskResult\n\tparams := map[string]interface{}{}\n\tparams[\"asyncFetch\"] = nil\n\n\tvar bs []byte\n\tbs, err := xml.Marshal(asynConf)\n\n\tif err != nil {\n\t\treturn out, err\n\t}\n\n\tbuffer := new(bytes.Buffer)\n\tbuffer.Write(bs)\n\n\tcontentType := http.DetectContentType(buffer.Bytes())\n\theaders := make(map[string]string)\n\theaders[HTTPHeaderContentType] = contentType\n\n\tresp, err := client.do(\"POST\", bucketName, params, headers, buffer, options...)\n\n\tif err != nil {\n\t\treturn out, err\n\t}\n\n\tdefer resp.Body.Close()\n\terr = xmlUnmarshal(resp.Body, &out)\n\treturn out, err\n}", "title": "" }, { "docid": "1d1bbae3d4a9b00343d23582e52a05ed", "score": "0.5077525", "text": "func (o *ResourceAddReqWeb) SetMetadata(v map[string]string) {\n\to.Metadata = &v\n}", "title": "" }, { "docid": "fb00f0ced1096ab84daebd30013b3b43", "score": "0.507088", "text": "func (*awsProvider) HeadBucket(_ ctx, bck *meta.Bck) (bckProps cos.StrKVs, errCode int, err error) {\n\tvar (\n\t\tsvc *s3.S3\n\t\tregion string\n\t\terrC error\n\t\tcloudBck = bck.RemoteBck()\n\t)\n\tsvc, region, errC = newClient(sessConf{bck: cloudBck}, \"\")\n\tif superVerbose {\n\t\tnlog.Infof(\"[head_bucket] %s (%v)\", cloudBck.Name, errC)\n\t}\n\tif region == \"\" {\n\t\t// AWS bucket may not yet exist in the BMD -\n\t\t// get the region manually and recreate S3 client.\n\t\tif region, err = getBucketLocation(svc, cloudBck.Name); err != nil {\n\t\t\terrCode, err = awsErrorToAISError(err, cloudBck)\n\t\t\treturn\n\t\t}\n\t\t// Create new svc with the region details.\n\t\tif svc, _, err = newClient(sessConf{region: region}, \"\"); err != nil {\n\t\t\terrCode, err = awsErrorToAISError(err, cloudBck)\n\t\t\treturn\n\t\t}\n\t}\n\tregion = *svc.Config.Region\n\tdebug.Assert(region != \"\")\n\n\t// NOTE: return a few assorted fields, specifically to fill-in vendor-specific `cmn.ExtraProps`\n\tbckProps = make(cos.StrKVs, 4)\n\tbckProps[apc.HdrBackendProvider] = apc.AWS\n\tbckProps[apc.HdrS3Region] = region\n\tbckProps[apc.HdrS3Endpoint] = \"\"\n\tif bck.Props != nil {\n\t\tbckProps[apc.HdrS3Endpoint] = bck.Props.Extra.AWS.Endpoint\n\t}\n\tversioned, errV := getBucketVersioning(svc, cloudBck)\n\tif errV != nil {\n\t\terrCode, err = awsErrorToAISError(errV, cloudBck)\n\t\treturn\n\t}\n\tbckProps[apc.HdrBucketVerEnabled] = strconv.FormatBool(versioned)\n\treturn\n}", "title": "" }, { "docid": "d246d123cd8f3fe2a4eb42a7515bb0c2", "score": "0.5054449", "text": "func (client Client) SetBucketACL(bucketName string, bucketACL ACLType) error {\n\theaders := map[string]string{HTTPHeaderOssACL: string(bucketACL)}\n\tparams := map[string]interface{}{}\n\tparams[\"acl\"] = nil\n\tresp, err := client.do(\"PUT\", bucketName, params, headers, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\treturn CheckRespCode(resp.StatusCode, []int{http.StatusOK})\n}", "title": "" }, { "docid": "a1362508e75b2b19c8b9f012f06e1d56", "score": "0.50439423", "text": "func (r *AWSECSTaskDefinition_KernelCapabilities) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "b5b125577943e60cf51dc18e6fd9d40a", "score": "0.5034122", "text": "func (s *Channel) SetMetadata(v string) *Channel {\n\ts.Metadata = &v\n\treturn s\n}", "title": "" }, { "docid": "40ded65a2fa84c757090eb3471f41780", "score": "0.50297433", "text": "func (r *AWSAppMeshVirtualNode_AwsCloudMapServiceDiscovery) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "b3361b29e7d2f7563153487e214240aa", "score": "0.50281566", "text": "func (a *API) PutBucketCORS(bucket string, cors *CORSConfiguration) error {\n\treturn a.Do(\"PUT\", bucket, \"?cors\", nil, XMLBody(cors), ContentMD5)\n}", "title": "" }, { "docid": "599c33fa3f5cb7f2ba19eef423e96331", "score": "0.5023746", "text": "func (yk *YubiKey) SetMetadata(key [24]byte, m *Metadata) error {\n\treturn ykSetProtectedMetadata(yk.tx, key, m)\n}", "title": "" }, { "docid": "b3eb858ffbb2e64c81daae050574bbb7", "score": "0.50209635", "text": "func (o *ResourceUpdateReqWeb) SetMetadata(v map[string]string) {\n\to.Metadata = &v\n}", "title": "" }, { "docid": "d84becda79ba3d28383d718fb9382263", "score": "0.5019749", "text": "func (s *TopicSubscription) SetMetadata(metadata map[string]string) error {\n\tif s.Metadata != nil {\n\t\treturn fmt.Errorf(\"subscription for topic %s on pubsub %s already has metadata set\", s.Topic, s.PubsubName)\n\t}\n\ts.Metadata = metadata\n\n\treturn nil\n}", "title": "" }, { "docid": "060485bd5a02b7412e1a1fcc4d862ff9", "score": "0.5017633", "text": "func (tx *transaction) Metadata() database.Bucket {\n\treturn tx.metaBucket\n}", "title": "" }, { "docid": "37bcc0754eadcb8d9ddc2d72460f1f4e", "score": "0.5015776", "text": "func (a *azureObjects) SetBucketPolicies(bucket string, policyInfo policy.BucketAccessPolicy) error {\n\tvar policies []BucketAccessPolicy\n\n\tfor prefix, policy := range policy.GetPolicies(policyInfo.Statements, bucket) {\n\t\tpolicies = append(policies, BucketAccessPolicy{\n\t\t\tPrefix: prefix,\n\t\t\tPolicy: policy,\n\t\t})\n\t}\n\tprefix := bucket + \"/*\" // For all objects inside the bucket.\n\tif len(policies) != 1 {\n\t\treturn traceError(NotImplemented{})\n\t}\n\tif policies[0].Prefix != prefix {\n\t\treturn traceError(NotImplemented{})\n\t}\n\tif policies[0].Policy != policy.BucketPolicyReadOnly {\n\t\treturn traceError(NotImplemented{})\n\t}\n\tperm := storage.ContainerPermissions{\n\t\tAccessType: storage.ContainerAccessTypeContainer,\n\t\tAccessPolicies: nil,\n\t}\n\terr := a.client.SetContainerPermissions(bucket, perm, 0, \"\")\n\treturn azureToObjectError(traceError(err), bucket)\n}", "title": "" }, { "docid": "9735a63b24ad14a62eb80ccd1b8e3911", "score": "0.5012131", "text": "func (client shareClient) setMetadataPreparer(timeout *int32, metadata map[string]string) (pipeline.Request, error) {\n\treq, err := pipeline.NewRequest(\"PUT\", client.url, nil)\n\tif err != nil {\n\t\treturn req, pipeline.NewError(err, \"failed to create request\")\n\t}\n\tparams := req.URL.Query()\n\tif timeout != nil {\n\t\tparams.Set(\"timeout\", strconv.FormatInt(int64(*timeout), 10))\n\t}\n\tparams.Set(\"restype\", \"share\")\n\tparams.Set(\"comp\", \"metadata\")\n\treq.URL.RawQuery = params.Encode()\n\tif metadata != nil {\n\t\tfor k, v := range metadata {\n\t\t\treq.Header.Set(\"x-ms-meta-\"+k, v)\n\t\t}\n\t}\n\treq.Header.Set(\"x-ms-version\", ServiceVersion)\n\treturn req, nil\n}", "title": "" }, { "docid": "362a5aebd0213f0afb042001896f5eee", "score": "0.49955994", "text": "func (client blobsClient) setMetadataResponder(resp pipeline.Response) (pipeline.Response, error) {\n\terr := validateResponse(resp, http.StatusOK)\n\tif resp == nil {\n\t\treturn nil, err\n\t}\n\treturn &BlobsSetMetadataResponse{rawResponse: resp.Response()}, err\n}", "title": "" }, { "docid": "dd73f27d7813f58e0a8a7a1e28befae7", "score": "0.4991211", "text": "func (a *Asset) injectMetadata(stub *sw.StubWrapper) errors.ICCError {\n\tvar err error\n\n\t// Generate object key\n\tkey, err := GenerateKey(*a)\n\tif err != nil {\n\t\treturn errors.WrapError(err, \"error generating key for asset\")\n\t}\n\t(*a)[\"@key\"] = key\n\n\tlastTouchBy, err := stub.GetMSPID()\n\tif err != nil {\n\t\treturn errors.WrapErrorWithStatus(err, \"error getting tx creator\", 500)\n\t}\n\t(*a)[\"@lastTouchBy\"] = lastTouchBy\n\n\tlastTx, _ := stub.Stub.GetFunctionAndParameters()\n\t(*a)[\"@lastTx\"] = lastTx\n\n\treturn nil\n}", "title": "" }, { "docid": "759fc40b43981a0f893658de89a53dd2", "score": "0.49870083", "text": "func (m *AggregationOption) SetBucketDefinition(value BucketAggregationDefinitionable)() {\n m.bucketDefinition = value\n}", "title": "" }, { "docid": "c864c2e7a292c96232dd0e6e6c097934", "score": "0.4985433", "text": "func (t *IssueSummary) SetMetadata(v string) {\n\tt.Metadata = &v\n}", "title": "" }, { "docid": "231f354101cb4e1d624ab269bcdcce13", "score": "0.49791145", "text": "func getBucketMetaPath(dir string) string {\n\tseparator := string(filepath.Separator)\n\treturn getMetaPath(dir) + separator + \"bucket\"\n}", "title": "" }, { "docid": "006f87f2a3fe51b66bebe76eb1eda370", "score": "0.4977933", "text": "func (a *API) PutBucketReferer(name string, config *RefererConfiguration) error {\n\treturn a.Do(\"PUT\", name, \"?referer\", nil, XMLBody(config))\n}", "title": "" }, { "docid": "3b5ce5161c5a9e0310ec1a07e202b934", "score": "0.4974705", "text": "func updatePushedMetadata(cb *Callback, agent *Agent) {\n\tfor _, meta := range cb.Metadata {\n\t\tmeta := meta\n\t\tif mapOfValue := agent.PushedMetaFileMap[meta.Name]; mapOfValue == nil {\n\t\t\tagent.PushedMetaFileMap[meta.Name] = make(map[string]struct{})\n\t\t}\n\t\tagent.PushedMetaFileMap[meta.Name][meta.Value] = struct{}{}\n\t\tlogrus.Debugf(\"pushed meta: key: %s, value: %s\\n\", meta.Name, meta.Value)\n\t}\n}", "title": "" }, { "docid": "59b827e025071f16509927052caf7b7b", "score": "0.4970873", "text": "func (o *Object) setMetadataFromEntry(info putio.File) error {\n\to.file = &info\n\to.modtime = info.UpdatedAt.Time\n\treturn nil\n}", "title": "" }, { "docid": "0894edd92a4ffe83e5e625090de4a321", "score": "0.49643052", "text": "func (options *ReplaceOfferingOptions) SetMetadata(metadata interface{}) *ReplaceOfferingOptions {\n\toptions.Metadata = metadata\n\treturn options\n}", "title": "" }, { "docid": "7d7018e63c312ec678097cd0f24c3007", "score": "0.49612838", "text": "func (c DiskBlockCacheClient) UpdateBlockMetadata(ctx context.Context, __arg UpdateBlockMetadataArg) (err error) {\n\terr = c.Cli.Call(ctx, \"kbgitkbfs.1.DiskBlockCache.UpdateBlockMetadata\", []interface{}{__arg}, nil)\n\treturn\n}", "title": "" }, { "docid": "981742164f270dba6e3b0b3578dfe211", "score": "0.49610537", "text": "func SetS3(accessKey, secretAccessKey, region, bucketName string) error {\n\tif bucketName == \"\" {\n\t\treturn fmt.Errorf(\"cannot have empty string for s3 bucket name\")\n\t}\n\tbucket = bucketName\n\ts3creds := credentials.NewCredentials(&credentials.StaticProvider{Value: credentials.Value{\n\t\tAccessKeyID: accessKey,\n\t\tSecretAccessKey: secretAccessKey,\n\t}})\n\tvar err error\n\ts3sess, err = session.NewSession(&aws.Config{\n\t\tRegion: aws.String(region),\n\t\tCredentials: s3creds,\n\t})\n\tif err != nil {\n\t\terr = fmt.Errorf(\"unable to create aws session for s3: %v\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "52407dd522806b60f4e17897caf02fb5", "score": "0.49564722", "text": "func (bc *BoltClient) initializeBucket() {\n\tbc.boltDB.Update(func(tx *bolt.Tx) error {\n\t\t\t_, err := tx.CreateBucket([]byte(\"PetBucket\"))\n\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"create bucket failed: %s\", err)\n\t\t\t}\n\t\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "a6d504db39d7953ba3e9e34cf551172d", "score": "0.4955368", "text": "func (o *ContainerImage) SetMetadata(metadata []string) {\n\n\to.Metadata = metadata\n}", "title": "" }, { "docid": "4426ee7c9976a3b9b481a1a25636cf50", "score": "0.49512595", "text": "func (client Client) SetBucketCORS(bucketName string, corsRules []CORSRule) error {\n\tcorsxml := CORSXML{}\n\tfor _, v := range corsRules {\n\t\tcr := CORSRule{}\n\t\tcr.AllowedMethod = v.AllowedMethod\n\t\tcr.AllowedOrigin = v.AllowedOrigin\n\t\tcr.AllowedHeader = v.AllowedHeader\n\t\tcr.ExposeHeader = v.ExposeHeader\n\t\tcr.MaxAgeSeconds = v.MaxAgeSeconds\n\t\tcorsxml.CORSRules = append(corsxml.CORSRules, cr)\n\t}\n\n\tbs, err := xml.Marshal(corsxml)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbuffer := new(bytes.Buffer)\n\tbuffer.Write(bs)\n\n\tcontentType := http.DetectContentType(buffer.Bytes())\n\theaders := map[string]string{}\n\theaders[HTTPHeaderContentType] = contentType\n\n\tparams := map[string]interface{}{}\n\tparams[\"cors\"] = nil\n\tresp, err := client.do(\"PUT\", bucketName, params, headers, buffer)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\treturn CheckRespCode(resp.StatusCode, []int{http.StatusOK})\n}", "title": "" }, { "docid": "4b4f7716bff155933632dddd82ae5e0c", "score": "0.49478474", "text": "func bindMetadata(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(MetadataABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "8e4348baa02ced878367854daee9cc31", "score": "0.4943266", "text": "func (s *CreateChannelInput) SetMetadata(v string) *CreateChannelInput {\n\ts.Metadata = &v\n\treturn s\n}", "title": "" }, { "docid": "603312ff2d90c2d0485e5a32a68b990e", "score": "0.49430302", "text": "func (c *jsiiProxy_CfnJobDefinition) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "981b9adbec788dee60f93c20e4a7def2", "score": "0.49399567", "text": "func (s *GetContainerAPIMetadataOutput) SetMetadata(v []map[string]*string) *GetContainerAPIMetadataOutput {\n\ts.Metadata = v\n\treturn s\n}", "title": "" }, { "docid": "27aef573881b3eca8bd8e77c840cad9a", "score": "0.49365923", "text": "func (client Client) SetBucketEncryption(bucketName string, encryptionRule ServerEncryptionRule, options ...Option) error {\n\tvar err error\n\tvar bs []byte\n\tbs, err = xml.Marshal(encryptionRule)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbuffer := new(bytes.Buffer)\n\tbuffer.Write(bs)\n\n\tcontentType := http.DetectContentType(buffer.Bytes())\n\theaders := map[string]string{}\n\theaders[HTTPHeaderContentType] = contentType\n\n\tparams := map[string]interface{}{}\n\tparams[\"encryption\"] = nil\n\tresp, err := client.do(\"PUT\", bucketName, params, headers, buffer, options...)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\treturn CheckRespCode(resp.StatusCode, []int{http.StatusOK})\n}", "title": "" }, { "docid": "183df1be84c7273ef5226c6543db3e2b", "score": "0.49298355", "text": "func (f *File) updateMetadata() error {\n\tmetadata, err := filesCDN.GetMetadata(f.UID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf.Width = metadata.Width\n\tf.Height = metadata.Height\n\treturn nil\n}", "title": "" } ]
7e6ca9b7bbd00c0e82ad1a65acd72cb1
/ Execute executes the request
[ { "docid": "fa70d54c98c76d571f821969a3c31b5d", "score": "0.0", "text": "func (a *VmApiService) CreateVmsExecute(r ApiCreateVmsRequest) (CreateVmsResponse, *_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 CreateVmsResponse\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"VmApiService.CreateVms\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/CreateVms\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = r.createVmsRequest\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\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 ErrorResponse\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 ErrorResponse\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 ErrorResponse\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": "ff9862d4843e5915777b7bc10b90795c", "score": "0.77509993", "text": "func (c *Client) Execute(req request.Request) (resp *request.Results, err error) {\n\tresp, err = c.Client.Execute(context.Background(), &req)\n\treturn resp, err\n}", "title": "" }, { "docid": "11d081ca95b03cce0afe05c5049b5693", "score": "0.7291259", "text": "func (c *Client) Execute(ctx context.Context, req *Request) (string, error) {\n\tif req.URL == \"\" {\n\t\treturn \"\", errors.New(\"missing request url\")\n\t}\n\tbody, contentType := req.body()\n\tdigestBody, err := url.QueryUnescape(body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\thttpReq, err := http.NewRequest(http.MethodPost, req.URL, strings.NewReader(body))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\thttpReq.Header.Add(\"Content-Type\", contentType)\n\thttpReq.Header.Add(\"x-companyid\", c.props.companyID)\n\thttpReq.Header.Add(\"x-datadigest\", Digest(digestBody+c.props.key))\n\n\tresp, err := c.opts.httpClient.Do(httpReq.WithContext(ctx))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer resp.Body.Close()\n\n\tif st := resp.StatusCode; st >= http.StatusBadRequest {\n\t\treturn \"\", fmt.Errorf(\"%d %s\", st, http.StatusText(st))\n\t}\n\tbodyBytes, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(bodyBytes), nil\n}", "title": "" }, { "docid": "80b6576e2d6f2e4c8b3f7096f876c4bd", "score": "0.7130954", "text": "func Execute(req *http.Request) (string, error) {\n\tresp, err := app.Http().Do(req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif resp == nil {\n\t\treturn \"\", errors.New(\"no response\")\n\t}\n\n\t// close response\n\tdefer func() {\n\t\t_ = resp.Body.Close()\n\t}()\n\n\treturn DefaultAdapter.StringifyResponse(resp)\n}", "title": "" }, { "docid": "ad3c6d728eac5a240fab2ab16669750c", "score": "0.70972586", "text": "func (h *Handler) Execute(req *Request, res *Response) (err error) {\n\tif req.Action == \"\" {\n\t\terr = errors.New(\"A action must be specified\")\n\t\treturn\n\t}\n\n\tif handler, OK := h.Actions[req.Action]; OK {\n\t\terr = handler(req, res)\n\t\treturn\n\t}\n\n\terr = errors.New(\"Action[\" + req.Action + \"] is not found\")\n\treturn\n}", "title": "" }, { "docid": "f4669a0bb977dfd679990ff7f3e901f1", "score": "0.708566", "text": "func (self *Endpoint) Execute(ctx context.Context, requester Requester) (httpStatus int, responseBody []byte) {\n\tspan, ctx := opentracing.StartSpanFromContext(ctx, \"Execute()\")\n\tdefer span.Finish()\n\n\tctx = context.Localize(ctx)\n\n\t// Every invocation of an endpoint creates its own logger instance.\n\tctx = log.WithContext(ctx, self.Config.LogConfig)\n\n\tvar responseMimeType *MimeTypeHandler\n\n\t// Defer recover at this point so that logging and context has been initialized.\n\tdefer func() {\n\t\tif err := errors.Recover(recover()); err != nil {\n\t\t\tlog.Error(ctx, \"panic: %+v\", err)\n\t\t\t// Convert the panic error to an internal server error. Never expose panics directly.\n\t\t\terr = errors.Wrap(err, ErrInternalServerError)\n\t\t\thttpStatus, responseBody = self.processErrorResponse(ctx, requester, responseMimeType, http.StatusInternalServerError, err)\n\t\t}\n\t}()\n\n\trequester.SetResponseHeader(\"X-Request-Id\", requester.RequestId())\n\n\t// Setup log.\n\t{\n\t\tlogSpan, ctx := opentracing.StartSpanFromContext(ctx, \"setup log\")\n\n\t\tlog.Tag(ctx, \"request_id\", requester.RequestId())\n\t\tlog.Tag(ctx, \"method\", string(requester.Method()))\n\t\tlog.Tag(ctx, \"route\", requester.MatchedPath())\n\t\tlog.Tag(ctx, \"path\", string(requester.Path()))\n\t\tlog.Tag(ctx, \"action\", self.Name())\n\n\t\t// Each path parameter is added as a log tag.\n\t\t// Note: It helps if the path parameter name is descriptive.\n\t\tfor param := range self.handlerData.pathParameters {\n\t\t\tif value, ok := requester.PathParam(param); ok {\n\t\t\t\tlog.Tag(ctx, param, value)\n\t\t\t}\n\t\t}\n\n\t\tlogSpan.Finish()\n\t}\n\n\tlog.Trace(ctx, \"executing endpoint\")\n\n\tvar err error\n\n\t// Content-Type and Accept\n\tvar requestMimeType *MimeTypeHandler\n\t{\n\t\tmimeTypeSpan, ctx := opentracing.StartSpanFromContext(ctx, \"setup mime types\")\n\n\t\tvar ok bool\n\n\t\tif self.handlerData.hasRequestBody {\n\t\t\tlog.Trace(ctx, \"processing request body mime type\")\n\n\t\t\tcontentType := requester.ContentType()\n\t\t\tif len(contentType) == 0 {\n\t\t\t\tlog.Debug(ctx, \"header Content-Type not found\")\n\t\t\t\tmimeTypeSpan.Finish()\n\n\t\t\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, http.StatusUnsupportedMediaType, errors.Wrap(ErrInvalidMimeType, errors.New(\"Content-Type MIME type not provided\")))\n\t\t\t}\n\n\t\t\trequestMimeType, ok = self.Config.MimeTypeHandlers.Get(contentType, self.handlerData.requestMimeTypes)\n\t\t\tif !ok {\n\t\t\t\tlog.Debug(ctx, \"mime type handler not available: %s\", contentType)\n\t\t\t\tmimeTypeSpan.Finish()\n\n\t\t\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, http.StatusUnsupportedMediaType, errors.Wrap(ErrInvalidMimeType, errors.New(\"Content-Type MIME type not supported: %s\", contentType)))\n\t\t\t}\n\n\t\t\tlog.Trace(ctx, \"found request mime type handler: %s\", contentType)\n\t\t}\n\n\t\t// Always process the Accept header since an error may be returned even if there is no response body.\n\t\tlog.Trace(ctx, \"processing response body mime type\")\n\n\t\taccept := requester.Accept()\n\t\tif len(accept) == 0 {\n\t\t\tlog.Debug(ctx, \"header Accept not found\")\n\t\t\tmimeTypeSpan.Finish()\n\n\t\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, http.StatusUnsupportedMediaType, errors.Wrap(ErrInvalidMimeType, errors.New(\"Accept MIME type not provided\")))\n\t\t}\n\n\t\tresponseMimeType, ok = self.Config.MimeTypeHandlers.Get(accept, self.handlerData.responseMimeTypes)\n\t\tif !ok {\n\t\t\tlog.Debug(ctx, \"mime type handler not available: %s\", accept)\n\t\t\tmimeTypeSpan.Finish()\n\n\t\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, http.StatusUnsupportedMediaType, errors.Wrap(ErrInvalidMimeType, errors.New(\"Accept MIME type not supported: %s\", accept)))\n\t\t}\n\t\t// All responses after this must be marshalable to the mime type.\n\t\trequester.SetResponseContentType(responseMimeType.MimeType)\n\n\t\tlog.Trace(ctx, \"found response mime type handler: %s\", accept)\n\n\t\tmimeTypeSpan.Finish()\n\t}\n\n\tlog.Trace(ctx, \"allocating handler\")\n\n\tallocSpan, ctx := opentracing.StartSpanFromContext(ctx, \"handler allocation\")\n\n\thandlerAlloc := self.handlerData.allocateHandler()\n\tif err = self.handlerData.setResources(handlerAlloc.handlerValue, self.Config.Resources); err != nil {\n\t\tlog.Debug(ctx, \"failed to set resources\")\n\t\tallocSpan.Finish()\n\n\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, http.StatusInternalServerError, errors.Wrap(err, ErrInternalServerError))\n\t}\n\tif err = self.handlerData.setPathParameters(handlerAlloc.handlerValue, requester); err != nil {\n\t\tlog.Debug(ctx, \"failed to set path parameters\")\n\t\tallocSpan.Finish()\n\n\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, http.StatusBadRequest, errors.Wrap(err, ErrBadRequest))\n\t}\n\tif err = self.handlerData.setQueryParameters(handlerAlloc.handlerValue, requester); err != nil {\n\t\tlog.Debug(ctx, \"failed to set query parameters\")\n\t\tallocSpan.Finish()\n\n\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, http.StatusBadRequest, errors.Wrap(err, ErrBadRequest))\n\t}\n\n\tallocSpan.Finish()\n\n\t// Authentication\n\t{\n\t\tauthSpan, ctx := opentracing.StartSpanFromContext(ctx, \"authorization\")\n\n\t\tif handlerAlloc.auth != nil {\n\t\t\tlog.Trace(ctx, \"processing auth handler\")\n\n\t\t\tif asAuthorizer, ok := handlerAlloc.auth.(Authorizer); ok {\n\t\t\t\thttpStatus, err = asAuthorizer.Authorization(ctx, requester.PeekHeader)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Debug(ctx, \"authorization failed\")\n\t\t\t\t\tauthSpan.Finish()\n\n\t\t\t\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, httpStatus, err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlog.Debug(ctx, \"authorization object does not implement Authorizer\")\n\t\t\t\tauthSpan.Finish()\n\n\t\t\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, httpstatus.InternalServerError, errors.Wrap(err, ErrInternalServerError))\n\t\t\t}\n\t\t}\n\n\t\tauthSpan.Finish()\n\t}\n\n\t// Handle Request Body\n\t{\n\t\trequestBodySpan, ctx := opentracing.StartSpanFromContext(ctx, \"process request body\")\n\n\t\tif self.handlerData.hasRequestBody {\n\t\t\tlog.Trace(ctx, \"processing request body\")\n\n\t\t\trequestBodyBytes := requester.RequestBody()\n\n\t\t\terr = self.setHandlerRequestBody(ctx, requestMimeType, handlerAlloc.requestBody, requestBodyBytes)\n\t\t\tif err != nil {\n\t\t\t\tlog.Debug(ctx, \"failed processing request body\")\n\t\t\t\trequestBodySpan.Finish()\n\n\t\t\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, http.StatusBadRequest, err)\n\t\t\t}\n\n\t\t\tif self.Config.RequestValidator != nil && self.handlerData.shouldValidateRequest {\n\t\t\t\tlog.Trace(ctx, \"processing validation handler\")\n\n\t\t\t\tvar validationFailure error\n\t\t\t\thttpStatus, validationFailure = self.Config.RequestValidator.ValidateRequest(ctx, requestBodyBytes)\n\t\t\t\tif validationFailure != nil {\n\t\t\t\t\tlog.Debug(ctx, \"failed request body validation\")\n\n\t\t\t\t\t// Validation failures are not hard errors and should be passed through to the error handler.\n\t\t\t\t\t// The failure is passed through since it is assumed this error contains information to be returned in the response.\n\t\t\t\t\trequestBodySpan.Finish()\n\n\t\t\t\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, httpStatus, validationFailure)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\trequestBodySpan.Finish()\n\t}\n\n\tif !ShouldContinue(ctx) {\n\t\tlog.Debug(ctx, \"request canceled or timed out\")\n\n\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, http.StatusRequestTimeout, ErrRequestTimeout)\n\t}\n\n\t// Run the endpoint handler.\n\tlog.Trace(ctx, \"running endpoint handler\")\n\n\thandlerSpan, ctx := opentracing.StartSpanFromContext(ctx, \"Handle()\")\n\thttpStatus, err = handlerAlloc.handler.Handle(ctx)\n\thandlerSpan.Finish()\n\n\tlog.Trace(ctx, \"completed endpoint handler\")\n\tif err != nil {\n\t\tlog.Debug(ctx, \"handler error\")\n\n\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, httpStatus, err)\n\t}\n\n\tif !ShouldContinue(ctx) {\n\t\tlog.Debug(ctx, \"request canceled or timed out\")\n\n\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, http.StatusRequestTimeout, ErrRequestTimeout)\n\t}\n\n\t// Handle Response Body\n\t{\n\t\tresponseBodySpan, ctx := opentracing.StartSpanFromContext(ctx, \"process response body\")\n\n\t\tresponseBody, err = self.getHandlerResponseBody(ctx, requester, responseMimeType, handlerAlloc.responseBody)\n\t\tif err != nil {\n\t\t\tlog.Debug(ctx, \"failed processing response\")\n\t\t\tresponseBodySpan.Finish()\n\n\t\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, http.StatusInternalServerError, err)\n\t\t}\n\n\t\tif self.Config.ResponseValidator != nil && self.handlerData.shouldValidateResponse {\n\t\t\tlog.Trace(ctx, \"processing response validation handler\")\n\n\t\t\tvar validationFailure error\n\t\t\thttpStatus, validationFailure = self.Config.ResponseValidator.ValidateResponse(ctx, httpStatus, responseBody)\n\t\t\tif validationFailure != nil {\n\t\t\t\tlog.Debug(ctx, \"failed response validation\")\n\t\t\t\t// Validation failures are not hard errors and should be passed through to the error handler.\n\t\t\t\t// The failure is passed through since it is assumed this error contains information to be returned in the response.\n\t\t\t\tresponseBodySpan.Finish()\n\n\t\t\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, httpStatus, validationFailure)\n\t\t\t}\n\t\t}\n\n\t\tresponseBodySpan.Finish()\n\t}\n\n\tlog.Debug(ctx, \"success response: %d %s\", httpStatus, responseBody)\n\n\tif self.handlerData.eTagEnabled {\n\t\tlog.Trace(ctx, \"eTagEnabled, handling etag\")\n\n\t\treturn HandleETag(ctx, requester, self.handlerData.maxAgeSeconds, httpStatus, responseBody)\n\t}\n\n\treturn httpStatus, responseBody\n}", "title": "" }, { "docid": "91e5a1bdcb3354e1e3a2234ee2f077de", "score": "0.68982273", "text": "func (c *Client) Execute(name string) (msg string, err error) {\n\tvar (\n\t\trequest = &core.Request{Name: name}\n\t\tresponse = new(core.Response)\n\t)\n\n\terr = c.client.Call(core.HandlerName, request, response)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tmsg = response.Message\n\treturn\n\n}", "title": "" }, { "docid": "62ea5fcb102a66d77519912c9c46de39", "score": "0.6896732", "text": "func Execute(customerID string, apiKey string, httpTimeout int,\n\treq *http.Request, resource string, body string, resParser responseParser) (Response, error) {\n\tnonce, _ := uuid.NewRandom()\n\tsigData := buildSignature(time.Now(), nonce.String(), req.Method, resource,\n\t\treq.Header.Get(\"Content-Type\"), body)\n\tsig := fmt.Sprintf(\"TSA %s:%s\", customerID, createSignature(apiKey, sigData))\n\n\treq.Header.Add(\"User-Agent\", userAgent)\n\treq.Header.Add(\"X-TS-Auth-Method\", authMethod)\n\treq.Header.Add(\"Authorization\", sig)\n\treq.Header.Add(\"X-TS-Nonce\", sigData.Nonce)\n\treq.Header.Add(\"Date\", sigData.Date)\n\n\tclient := getClient(httpTimeout)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// fmt.Println(string(respBody))\n\n\treturn resParser(resp.StatusCode, respBody)\n}", "title": "" }, { "docid": "0336ce115187aa622daccfa28eef7b41", "score": "0.6850316", "text": "func (c *DefaultClient) execute(req *http.Request, responsePtr interface{}) error {\n\tlog.Debug(fmt.Sprintf(\"[Xignite API] request url=%v\", req.URL))\n\n\t// execute the HTTP request\n\tresp, err := c.httpClient.Do(req)\n\tif err != nil {\n\t\treturn errors.Wrap(err, fmt.Sprintf(\"failed to execute HTTP request. request=%v\", req))\n\t}\n\tdefer func() {\n\t\tif cerr := resp.Body.Close(); err == nil {\n\t\t\terr = errors.Wrap(cerr, fmt.Sprintf(\"failed to close HTTP response. resp=%v\", resp))\n\t\t}\n\t}()\n\n\t// read the response body and parse to a json\n\tb, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn errors.Wrap(err, fmt.Sprintf(\"failed to read the response body. resp=%v\", resp))\n\t}\n\t// API response body is too big to output...\n\t// log.Debug(fmt.Sprintf(\"[Xignite API response] url=%v, response= %v\", req.URL, string(b)))\n\n\tif err := json.Unmarshal(b, responsePtr); err != nil {\n\t\treturn errors.Wrap(err, fmt.Sprintf(\"failed to json_parse the response body. resp.Body=%v\", string(b)))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3423046e7fced44736778f747d9c929b", "score": "0.68480206", "text": "func ExecuteHTTPRequest(\n\tctx context.Context,\n\tclient common.HTTPClient,\n\turl string,\n\tmethod string,\n\theaders map[string]string,\n\tbody io.Reader,\n) (*http.Response, error) {\n\treturn ExecuteHTTPRequestWithQuery(ctx, client, url, nil, method, headers, body)\n}", "title": "" }, { "docid": "3373d91d3eef7f6e3ab389e9a41450c1", "score": "0.68183416", "text": "func (c *BotCommand) Execute(request *Request, response ResponseWriter) {\n\tc.handler(request, response)\n}", "title": "" }, { "docid": "431cbc43c309fb9a1164d16bfdd06767", "score": "0.67533594", "text": "func (tu *Utils) ExecuteRequest(method, endpoint string) <-chan *httptest.ResponseRecorder {\n\treturn tu.ExecuteRequestWithParameters(method, endpoint, nil)\n}", "title": "" }, { "docid": "0d7907ebf117016f9ab011c5f18670cc", "score": "0.67252874", "text": "func (h *HTTP) Execute() error {\n\treq, err := http.NewRequest(h.method, h.url, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp, err := h.client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif resp.StatusCode != h.code {\n\t\treturn fmt.Errorf(\"HTTP/HTTPS health check expected %v, got %v\", h.code, resp.StatusCode)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cb60c13d0ebf48e0c9c4eb36f515c2e1", "score": "0.6687895", "text": "func (c *Client) execute(req *http.Request) (*Response, error) {\n\tresp, err := c.client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresponse := newResponse(resp)\n\n\terr = CheckResponse(resp)\n\t// even though there was an error, we still return the response\n\t// in case the caller wants to inspect it further\n\treturn response, err\n}", "title": "" }, { "docid": "8c85a4ad74cd0c5e48be87124e40558a", "score": "0.6675558", "text": "func (c *SPClient) Execute(req *http.Request) (*http.Response, error) {\n\n\t// Read stored creds and config\n\tif c.ConfigPath != \"\" && c.AuthCnfg.GetSiteURL() == \"\" {\n\t\tc.AuthCnfg.ReadConfig(c.ConfigPath)\n\t}\n\tif c.AuthCnfg.GetSiteURL() == \"\" {\n\t\tres := &http.Response{\n\t\t\tStatus: \"400 Bad Request\",\n\t\t\tStatusCode: 400,\n\t\t\tRequest: req,\n\t\t}\n\t\treturn res, fmt.Errorf(\"client initialization error, no siteUrl is provided\")\n\t}\n\n\t// Wrap SharePoint authentication\n\terr := c.AuthCnfg.SetAuth(req, c)\n\tif err != nil {\n\t\tres := &http.Response{\n\t\t\tStatus: \"401 Unauthorized\",\n\t\t\tStatusCode: 401,\n\t\t\tRequest: req,\n\t\t}\n\t\treturn res, err\n\t}\n\n\t// Inject X-RequestDigest header when needed\n\tdigestIsRequired := req.Method == \"POST\" &&\n\t\t!strings.Contains(strings.ToLower(req.URL.Path), \"/_api/contextinfo\") &&\n\t\treq.Header.Get(\"X-RequestDigest\") == \"\"\n\n\tif digestIsRequired {\n\t\tdigest, err := GetDigest(c)\n\t\tif err != nil {\n\t\t\tres := &http.Response{\n\t\t\t\tStatus: \"400 Bad Request\",\n\t\t\t\tStatusCode: 400,\n\t\t\t\tRequest: req,\n\t\t\t}\n\t\t\treturn res, err\n\t\t}\n\t\treq.Header.Add(\"X-RequestDigest\", digest)\n\t}\n\n\tresp, err := c.Do(req)\n\n\tif err == nil && !(resp.StatusCode >= 200 && resp.StatusCode < 300) {\n\t\terr = fmt.Errorf(\"%s\", resp.Status)\n\t}\n\n\treturn resp, err\n}", "title": "" }, { "docid": "0a3a959e575c2fb48f0092ee96efbe8b", "score": "0.66272306", "text": "func (c *Client) Execute(req *Request, successData, errorData interface{}) (bool, error) {\n\tresp, err := c.Do(req.Request)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tdefer func() {\n\t\tif err := resp.Body.Close(); err != nil {\n\t\t\t// TODO: what is the best thing to do here?\n\t\t\tlog.Print(err)\n\t\t}\n\t}()\n\n\tif resp.StatusCode >= 400 {\n\t\tif errorData != nil {\n\t\t\tif err := json.NewDecoder(resp.Body).Decode(&errorData); err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\treturn false, nil\n\t\t}\n\t\treturn false, fmt.Errorf(\"%d:%s\", resp.StatusCode, resp.Body)\n\t}\n\n\tif successData != nil {\n\t\tif err := json.NewDecoder(resp.Body).Decode(&successData); err != nil {\n\t\t\treturn true, err\n\t\t}\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "8f4713ad044b1ea6c090126d9e6806d2", "score": "0.6581271", "text": "func (c *Client) executeRequest(message *internal.RequestWrapper) (*internal.ResponseWrapper, error) {\n\trefId, err := c.sendMessage(message)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.waitForResponse(refId)\n}", "title": "" }, { "docid": "2ae07f36828a210fbf3b8e40f2d33d90", "score": "0.6517868", "text": "func (srv *Server) Execute(ctx context.Context, req Request) Response {\n\tquery := req.ValidatedQuery\n\tif query == nil {\n\t\tvar errs []*ResponseError\n\t\tquery, errs = srv.schema.Validate(req.Query)\n\t\tif len(errs) > 0 {\n\t\t\treturn Response{Errors: errs}\n\t\t}\n\t} else if query.schema != srv.schema {\n\t\treturn Response{\n\t\t\tErrors: []*ResponseError{\n\t\t\t\t{Message: \"query validated with a schema different from the server\"},\n\t\t\t},\n\t\t}\n\t}\n\treturn srv.executeValidated(ctx, Request{\n\t\tValidatedQuery: query,\n\t\tOperationName: req.OperationName,\n\t\tVariables: req.Variables,\n\t})\n}", "title": "" }, { "docid": "edf561f4df337428e808979883fee8bb", "score": "0.6478267", "text": "func Execute() {\n\tif err := makeHTTPCmd().Execute(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "79da49e7334abade77107d7dd184c9dd", "score": "0.64479244", "text": "func (sq *Query) execute(path string, output string) (*http.Response, error) {\n\tquery := url.Values{}\n\tfor k, v := range sq.parameter {\n\t\tquery.Add(k, v)\n\t}\n\tquery.Add(\"source\", \"go\")\n\tquery.Add(\"output\", output)\n\tendpoint := \"https://serpapi.com\" + path + \"?\" + query.Encode()\n\tvar client = &http.Client{\n\t\tTimeout: time.Second * 60,\n\t}\n\trsp, err := client.Get(endpoint)\n\treturn rsp, err\n}", "title": "" }, { "docid": "3c46256b1505175dc2b637f872f3bbf1", "score": "0.64280903", "text": "func (p *appsec) Exec(r *http.Request, out interface{}, in ...interface{}) (*http.Response, error) {\n\treturn p.Session.Exec(r, out, in...)\n}", "title": "" }, { "docid": "3fe722be6aea33aeb7082294e3a7be8e", "score": "0.6400326", "text": "func Exec(l hclog.Logger, a Authenticator) int {\n\tr, err := reqFromEnvironment()\n\tif err != nil {\n\t\tl.Debug(\"Error constructing request\", \"error\", err)\n\t\treturn 1\n\t}\n\tif err := r.getSecret(); err != nil {\n\t\tl.Debug(\"Error reading secret\", \"error\", err)\n\t\treturn 2\n\t}\n\n\ta.SetServiceName(r.service)\n\tif err := a.AuthEntity(context.Background(), r.entity, r.secret); err != nil {\n\t\tl.Debug(\"Authentication failed\", \"error\", err)\n\t\treturn 1\n\t}\n\n\treturn 0\n}", "title": "" }, { "docid": "90dfbabea5106a0733d85b71a92e26cc", "score": "0.63662493", "text": "func (c *Client) executeRequest(req *http.Request, respModel interface{}) error {\n\thttpClient := &http.Client{\n\t\tTimeout: c.ReqTimeout,\n\t}\n\tif !c.IsEnvProduction {\n\t\thttpClient.Transport = &http.Transport{\n\t\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t\t}\n\t}\n\n\tif c.LogLevel > 1 {\n\t\tc.Logger.Println(PaymentName, \" Request \", req.Method, \": \", req.URL.Host, req.URL.Path)\n\t}\n\n\tres, err := httpClient.Do(req)\n\tif err != nil {\n\t\tif c.LogLevel > 0 {\n\t\t\tc.Logger.Println(PaymentName, \" Cannot send request: \", err)\n\t\t}\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\n\tresBody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\tif c.LogLevel > 0 {\n\t\t\tc.Logger.Println(PaymentName, \" Cannot read response body: \", err)\n\t\t}\n\t\treturn err\n\t}\n\n\tif c.LogLevel > 2 {\n\t\tc.Logger.Println(PaymentName, \" Response: \", string(resBody))\n\t}\n\n\t// why? total different struct response on recurring\n\tif res.StatusCode == http.StatusUnauthorized && strings.Contains(fmt.Sprintf(\"%s%s\", req.URL.Host, req.URL.Path), \"recurring\") {\n\t\treturn fmt.Errorf(\"%w: HTTP Status %d\\nResp Body: %s\", ErrUnauthorize, res.StatusCode, string(resBody))\n\t}\n\n\tif err = json.Unmarshal(resBody, respModel); err != nil {\n\t\tif c.LogLevel > 0 {\n\t\t\tc.Logger.Println(PaymentName, \" Cannot unmarshal response body: \", err)\n\t\t}\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a9d029adebd5d18210f24db108577bee", "score": "0.6361669", "text": "func (h *networkRequestSelContained) Execute(filePath string) error {\n\tts := testutils.NewTCPServer(nil, defaultStaticPort, func(conn net.Conn) {\n\t\tdefer conn.Close()\n\n\t\t_, _ = conn.Write([]byte(\"Authentication successful\"))\n\t})\n\tdefer ts.Close()\n\tresults, err := testutils.RunNucleiTemplateAndGetResults(filePath, \"\", debug)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn expectResultsCount(results, 1)\n}", "title": "" }, { "docid": "fa251275cb4f029c2bd9c907d54bfedd", "score": "0.63568616", "text": "func (c *Controller) Execute(ctx context.Context) error {\n\treturn nil\n}", "title": "" }, { "docid": "ed0e46fff171db8c1292e0d6468152ba", "score": "0.6345296", "text": "func (t *Test) Execute(host string) {\n\tt.Executed = true\n\n\tt.URL = \"http\" + \"://\" + path.Join(host, t.Path)\n\n\tdata := strings.Join(t.Data, \"\")\n\treq, err := http.NewRequest(t.Method, t.URL, strings.NewReader(data))\n\tif err != nil {\n\t\tt.Err = err\n\t\treturn\n\t}\n\n\tfor k, v := range t.Headers {\n\t\treq.Header.Set(k, v)\n\t}\n\n\tclient := &http.Client{Timeout: time.Second * 2}\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tt.Err = err\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\tt.StatusCode = resp.StatusCode\n\tt.Status = resp.Status\n}", "title": "" }, { "docid": "04ad5c3ab4e85f6c1bd64e9ebf9e3a9e", "score": "0.6339996", "text": "func executeRequest(ta App, req *http.Request) *httptest.ResponseRecorder {\n\trr := httptest.NewRecorder()\n\tta.server.Router.ServeHTTP(rr, req)\n\treturn rr\n}", "title": "" }, { "docid": "1bc2e35a5d7b7ae99c3e713357c4daf7", "score": "0.6304752", "text": "func (fn *FunctionInvoker) Execute(event interface{}, context events.ExecutionContext) (string, error) {\n\treqBody := CoreRuntimeRequest{\n\t\tEvent: event,\n\t\tContext: context,\n\t\tHandlerName: fn.HandlerName,\n\t\tHandlerPath: fn.HandlerFilePath,\n\t}\n\n\tres, err := fn.streamRequest(reqBody)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tresponseBody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\tlog.Printf(\"Read response body error, %v\", err)\n\t\treturn \"\", err\n\t}\n\n\t// If an error occured in sub-runtime\n\tif res.StatusCode == http.StatusInternalServerError {\n\t\t// Error message is the response body\n\t\treturn \"\", handlerExecutionError(string(responseBody))\n\t}\n\n\treturn string(responseBody), nil\n}", "title": "" }, { "docid": "fd3cce753e8ff2255d0e7843af8e68f4", "score": "0.6299258", "text": "func (c *Client) Perform(req *http.Request) (*http.Response, error) {\n\tvar (\n\t\tdupReqBody io.Reader\n\t)\n\n\t// Get URL from the Selector\n\t//\n\tu, err := c.getURL()\n\tif err != nil {\n\t\t// TODO(karmi): Log error\n\t\treturn nil, fmt.Errorf(\"cannot get URL: %s\", err)\n\t}\n\n\t// Update request\n\t//\n\tc.setURL(u, req)\n\tc.setUserAgent(req)\n\tc.setAuthorization(u, req)\n\n\t// Duplicate request body for logger\n\t//\n\tif c.logger != nil && c.logger.RequestBodyEnabled() {\n\t\tif req.Body != nil && req.Body != http.NoBody {\n\t\t\tdupReqBody, req.Body, _ = duplicateBody(req.Body)\n\t\t}\n\t}\n\n\t// Set up time measures and execute the request\n\t//\n\tstart := time.Now().UTC()\n\tres, err := c.transport.RoundTrip(req)\n\tdur := time.Since(start)\n\n\t// Log request and response\n\t//\n\tif c.logger != nil {\n\t\tc.logRoundTrip(req, res, dupReqBody, err, start, dur)\n\t}\n\n\t// TODO(karmi): Wrap error\n\treturn res, err\n}", "title": "" }, { "docid": "d3693f28c6d3c262dea8ab46079461d9", "score": "0.62770116", "text": "func (r apiGetAPITestResultRequest) Execute() (SyntheticsAPITestResultFull, *_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 SyntheticsAPITestResultFull\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"SyntheticsApiService.GetAPITestResult\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/synthetics/tests/{public_id}/results/{result_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"public_id\"+\"}\", _neturl.PathEscape(parameterToString(r.publicId, \"\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"result_id\"+\"}\", _neturl.PathEscape(parameterToString(r.resultId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\n\t// Set Operation-ID header for telemetry\n\tlocalVarHeaderParams[\"DD-OPERATION-ID\"] = \"GetAPITestResult\"\n\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"apiKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-API-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"appKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-APPLICATION-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "d7acf8ee151f7c16b330690d679779c4", "score": "0.6255708", "text": "func (r *Request) Run() {\n\tdefer r.wg.Done() // finished processing\n\n\tObject, err := r.action()\n\n\tr.Respond = Object // Stored the result of the action\n\tr.err = err // Stored the error of the action\n}", "title": "" }, { "docid": "244af534cae8d45c685f1937d5274c12", "score": "0.62424964", "text": "func (r apiGetTestRequest) Execute() (SyntheticsTestDetails, *_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 SyntheticsTestDetails\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"SyntheticsApiService.GetTest\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/synthetics/tests/{public_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"public_id\"+\"}\", _neturl.PathEscape(parameterToString(r.publicId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\n\t// Set Operation-ID header for telemetry\n\tlocalVarHeaderParams[\"DD-OPERATION-ID\"] = \"GetTest\"\n\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"apiKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-API-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"appKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-APPLICATION-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "117131c6dc050fe13d0a0638353deef1", "score": "0.6241237", "text": "func (s *Service) Execute(a *Action) (*Response, error) {\n\tif s.actions == nil {\n\t\ts.actions = make([]*Action, 0)\n\t}\n\tif s.Modules == nil || s.Modules[a.Module] == nil {\n\t\treturn nil, errors.New(\"invalid module provided by action\")\n\t}\n\tm := s.Modules[a.Module]\n\tc, err := m.Command(a.Command)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tres, err := c.Execute(a.Arguments)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.actions = append(s.actions, a)\n\treturn &Response{\n\t\tAction: a,\n\t\tValue: res.Value,\n\t}, nil\n}", "title": "" }, { "docid": "d81911a58b72b9d1a92db68f577cf174", "score": "0.6237411", "text": "func (c *Client) Execute(ctx context.Context, req *repb.ExecuteRequest) (res regrpc.Execution_ExecuteClient, err error) {\n\treturn c.execution.Execute(ctx, req, c.RPCOpts()...)\n}", "title": "" }, { "docid": "c45221b0320cb1eb6b66f0ab0a7cf9b6", "score": "0.62308586", "text": "func (cb *CircuitBreaker) Execute(req func() (interface{}, error)) (interface{}, error) {\n\treturn cb.currentState.execute(req)\n}", "title": "" }, { "docid": "b19be6c2e40b784bc0feb6259aecf309", "score": "0.6223373", "text": "func (r FindStructure) 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 FindStructure query execution: %w\", err)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "ab3af0473a84e7445f9aa85f679a6100", "score": "0.6202319", "text": "func (vtg *VTGate) Execute(ctx context.Context, request *pb.ExecuteRequest) (response *pb.ExecuteResponse, err error) {\n\tdefer vtg.server.HandlePanic(&err)\n\tctx = callerid.NewContext(callinfo.GRPCCallInfo(ctx),\n\t\trequest.CallerId,\n\t\tcallerid.NewImmediateCallerID(\"grpc client\"))\n\treply := new(proto.QueryResult)\n\tbv, err := tproto.Proto3ToBindVariables(request.Query.BindVariables)\n\tif err != nil {\n\t\treturn nil, vterrors.ToGRPCError(err)\n\t}\n\texecuteErr := vtg.server.Execute(ctx, string(request.Query.Sql), bv, request.TabletType, request.Session, request.NotInTransaction, reply)\n\tresponse = &pb.ExecuteResponse{\n\t\tError: vtgate.RPCErrorToVtRPCError(reply.Err),\n\t}\n\tif executeErr != nil {\n\t\treturn nil, vterrors.ToGRPCError(executeErr)\n\t}\n\tresponse.Result = mproto.QueryResultToProto3(reply.Result)\n\tresponse.Session = reply.Session\n\treturn response, nil\n}", "title": "" }, { "docid": "153f9f82093b14abd9ea7661b5f226ec", "score": "0.6194755", "text": "func executeRequest(req *http.Request) *httptest.ResponseRecorder {\n\trr := httptest.NewRecorder()\n\tRouter().ServeHTTP(rr, req)\n\treturn rr\n}", "title": "" }, { "docid": "e544392eb4a3356f24ec8c497e8ab1e2", "score": "0.6189235", "text": "func (s *Server) Execute(req string, res *Response) error {\n\tif req == \"disable\" {\n\t\tif *s.IsRunning {\n\t\t\ts.Stop()\n\t\t\tres.Message = \"disabled\"\n\t\t\treturn nil\n\t\t}\n\t\tres.Message = \"service is already disabled\"\n\t\treturn nil\n\t}\n\tif req == \"enable\" {\n\t\tif !*s.IsRunning {\n\t\t\tgo s.Start()\n\t\t\tres.Message = \"enabled\"\n\t\t\treturn nil\n\t\t}\n\t\tres.Message = \"service already enabled/running\"\n\t\treturn nil\n\t}\n\tif req == \"status\" {\n\t\tif *s.IsRunning {\n\t\t\tres.Message = \"enabled\"\n\t\t\treturn nil\n\t\t}\n\t\tres.Message = \"disabled\"\n\t\treturn nil\n\t}\n\tif req == \"quit\" {\n\t\tgo func() {\n\t\t\ttime.Sleep(100 * time.Millisecond)\n\t\t\ts.Quit()\n\t\t}()\n\t\tres.Message = \"quit\"\n\t\treturn nil\n\t}\n\tres.Message = \"invalid\"\n\treturn errors.New(\"invalid command\")\n}", "title": "" }, { "docid": "bd5f34ddcee85b506c7d34ae5baf0444", "score": "0.6178679", "text": "func (r *RunsServerTransport) Do(req *http.Request) (*http.Response, error) {\n\trawMethod := req.Context().Value(runtime.CtxAPINameKey{})\n\tmethod, ok := rawMethod.(string)\n\tif !ok {\n\t\treturn nil, nonRetriableError{errors.New(\"unable to dispatch request, missing value for CtxAPINameKey\")}\n\t}\n\n\tvar resp *http.Response\n\tvar err error\n\n\tswitch method {\n\tcase \"RunsClient.BeginCancel\":\n\t\tresp, err = r.dispatchBeginCancel(req)\n\tcase \"RunsClient.Get\":\n\t\tresp, err = r.dispatchGet(req)\n\tcase \"RunsClient.GetLogSasURL\":\n\t\tresp, err = r.dispatchGetLogSasURL(req)\n\tcase \"RunsClient.NewListPager\":\n\t\tresp, err = r.dispatchNewListPager(req)\n\tcase \"RunsClient.BeginUpdate\":\n\t\tresp, err = r.dispatchBeginUpdate(req)\n\tdefault:\n\t\terr = fmt.Errorf(\"unhandled API %s\", method)\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "5381d46c9549d71852dfc746a4d8640a", "score": "0.61602545", "text": "func (middleware *PrepareUploadRequest) Execute(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tf, header, err := r.FormFile(\"file\")\n\t\tif err != nil {\n\t\t\te := kerr.NewErr(\n\t\t\t\tkerr.ErrLvlError,\n\t\t\t\tErrorDomain,\n\t\t\t\tFormFileErrorCode,\n\t\t\t\tfmt.Errorf(\"request form error\"),\n\t\t\t\tnil)\n\n\t\t\t_ = presenter.JsonError(w, e, 402)\n\t\t\treturn\n\t\t}\n\n\t\ttags := r.MultipartForm.Value[\"tags\"]\n\n\t\tcmd := file.UploadFileCommand{\n\t\t\tFile: f,\n\t\t\tHeader: header,\n\t\t\tTags: tags,\n\t\t\tNodeId: middleware.cfg.Id,\n\t\t}\n\n\t\tctx := context.WithValue(r.Context(), \"command\", cmd)\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t})\n}", "title": "" }, { "docid": "6796d26eb8335199bd07437d1724c8da", "score": "0.6160197", "text": "func (c *Client) exec(timestamp, method, path string, body []byte, qp *QueryParams, v interface{}) error {\n\treq, sig, err := c.createAndSignReq(timestamp, method, path, body, qp)\n\tif err != nil {\n\t\treturn err\n\t}\n\tres, err := c.do(timestamp, sig, req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\tif err := json.NewDecoder(res.Body).Decode(&v); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8ee5f3250ef29cceb5c9433c6a13fbe5", "score": "0.6148328", "text": "func (s *CustomMetadataServer) Execute(ctx context.Context, req *thunderpb.ExecuteRequest) (*thunderpb.ExecuteResponse, error) {\n\tmd, _ := metadata.FromOutgoingContext(ctx)\n\tfor k, v := range md {\n\t\tctx = context.WithValue(ctx, k, v[0])\n\t}\n\n\treturn ExecuteRequest(ctx, req, s.schema, s.localExecutor)\n}", "title": "" }, { "docid": "be473dbc34892c4e8222288647c2b61d", "score": "0.61432105", "text": "func (c *Client) Exec(req *Request, v interface{}) (*Response, error) {\n\treturn c.Result(c.Do(req), &v)\n}", "title": "" }, { "docid": "6913d580c86d85e26b897e7b9848d14b", "score": "0.613441", "text": "func (r apiGetBrowserTestRequest) Execute() (SyntheticsTestDetails, *_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 SyntheticsTestDetails\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"SyntheticsApiService.GetBrowserTest\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/synthetics/tests/browser/{public_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"public_id\"+\"}\", _neturl.PathEscape(parameterToString(r.publicId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\n\t// Set Operation-ID header for telemetry\n\tlocalVarHeaderParams[\"DD-OPERATION-ID\"] = \"GetBrowserTest\"\n\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"apiKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-API-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"appKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-APPLICATION-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "eba8c3429d96852badf76fbe15d99e8e", "score": "0.6106647", "text": "func (apr *APResponse) Execute(w *http.ResponseWriter) error {\n\tvar err error\n\n\t//Pull in our template\n\tt := template.Must(template.New(\"response\").Parse(responseTemplate))\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//Execute the response template, and write to the response\n\terr = t.Execute(*w, *apr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//return nil; no news is good news.\n\treturn nil\n}", "title": "" }, { "docid": "6fa8f0f51d6e01f5a56f3d4c8c443f98", "score": "0.61022604", "text": "func (r *Response) Execute(w http.ResponseWriter) error {\n\tvar err error\n\n\t//Pull in our template\n\tt := template.Must(template.New(\"response\").Parse(responseTemplate))\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//Execute the response template, and write to the response\n\terr = t.Execute(w, *r)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//return nil; no news is good news.\n\treturn nil\n}", "title": "" }, { "docid": "497e314af8edc558247a714975a33430", "score": "0.60831755", "text": "func (g *Gateway) Execute(ctx *RequestContext, plans QueryPlanList) (map[string]interface{}, error) {\n\t// the plan we mean to execute\n\tvar plan *QueryPlan\n\n\t// if there is only one plan (one operation) then use it\n\tif len(plans) == 1 {\n\t\tplan = plans[0]\n\t} else {\n\t\t// if we weren't given an operation name then we don't know which one to send\n\t\tif ctx.OperationName == \"\" {\n\t\t\treturn nil, errors.New(\"please provide an operation name\")\n\t\t}\n\n\t\t// find the plan for the right operation\n\t\toperationPlan, err := plans.ForOperation(ctx.OperationName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// use the one for the operation\n\t\tplan = operationPlan\n\t}\n\n\t// build up the execution context\n\texecutionContext := &ExecutionContext{\n\t\tlogger: g.logger,\n\t\tRequestContext: ctx.Context,\n\t\tRequestMiddlewares: g.requestMiddlewares,\n\t\tPlan: plan,\n\t\tVariables: ctx.Variables,\n\t}\n\n\t// TODO: handle plans of more than one query\n\t// execute the plan and return the results\n\tresult, err := g.executor.Execute(executionContext)\n\tif err != nil {\n\t\tif len(result) == 0 {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, err\n\t}\n\n\t// now that we have our response, throw it through the list of middlewarse\n\tfor _, ware := range g.responseMiddlewares {\n\t\tif err := ware(executionContext, result); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// we're done here\n\treturn result, nil\n}", "title": "" }, { "docid": "51bbd9a47a65068f82248fdc2194369d", "score": "0.6080002", "text": "func (c *DefaultLWM2MClient) handleExecuteRequest(req canopus.Request) canopus.Response {\n\tlog.Println(\"Execute Request\")\n\tattrResource := req.GetAttribute(\"rsrc\")\n\tobjectID := req.GetAttributeAsInt(\"obj\")\n\tinstanceID := req.GetAttributeAsInt(\"inst\")\n\n\tvar resourceID = -1\n\n\tif attrResource != \"\" {\n\t\tresourceID = req.GetAttributeAsInt(\"rsrc\")\n\t}\n\n\tt := LWM2MObjectType(objectID)\n\tobj := c.GetObject(t)\n\tenabler := obj.GetEnabler()\n\n\tmsg := canopus.NewMessageOfType(canopus.MessageAcknowledgment, req.GetMessage().GetMessageId(), canopus.NewEmptyPayload()).(*canopus.CoapMessage)\n\tmsg.Token = req.GetMessage().GetToken()\n\n\tif enabler != nil {\n\t\tmodel := obj.GetDefinition()\n\t\tresource := model.GetResource(LWM2MResourceType(resourceID))\n\t\tif resource == nil {\n\t\t\tmsg.Code = canopus.CoapCodeNotFound\n\t\t}\n\n\t\tif !IsExecutableResource(resource) {\n\t\t\tmsg.Code = canopus.CoapCodeMethodNotAllowed\n\t\t} else {\n\t\t\tlwReq := Default(req, OPERATIONTYPE_EXECUTE)\n\t\t\tresponse := enabler.OnExecute(instanceID, resourceID, lwReq)\n\t\t\tmsg.Code = response.GetResponseCode()\n\t\t}\n\t} else {\n\t\tmsg.Code = canopus.CoapCodeNotFound\n\t}\n\treturn canopus.NewResponseWithMessage(msg)\n}", "title": "" }, { "docid": "0fd7435b308e74866e4242582295bf26", "score": "0.60669225", "text": "func Do(command string) {\n\trequest.Method = command\n\trequest.verbose = verbLevel\n\n\tresp, err := request.Perform()\n\tif err != nil {\n\t\tlog.Println(\"error making request:\", err)\n\t\tif resp != nil {\n\t\t\tlog.Println(resp.Body)\n\t\t\tresp.Body.Close()\n\t\t}\n\t\tos.Exit(1)\n\t}\n\n\tresponse.verbose = verbLevel\n\tif err := response.Load(resp, request.Settings); err != nil {\n\t\tlog.Println(\"error displaying result:\", err)\n\t\tos.Exit(1)\n\t}\n\n\tfmt.Println(response)\n\n\tos.Exit(response.ExitCode())\n}", "title": "" }, { "docid": "d2aaa8c57c646e8c31b30dee40cfdb22", "score": "0.6062784", "text": "func (a *Application) Execute() {\n\thost := configuration.Instance.GetServiceHost()\n\twelcome := \"Starting to service \" + host + \" with root path as \" + configuration.Instance.Service.Path\n\tlog.Println(welcome)\n\n\tcrossKeyLength := len(configuration.Instance.Service.Cross.Key)\n\n\tif crossKeyLength > 0 {\n\t\tif crossKeyLength == 32 {\n\t\t\tlog.Println(\"Using Cross-site Request Authentication Key\")\n\t\t\tif len(configuration.Instance.Service.Cross.Trusted) > 0 {\n\t\t\t\tfor _, origin := range configuration.Instance.Service.Cross.Trusted {\n\t\t\t\t\tlog.Println(\"Adding '\" + origin + \"' as trusted origin\")\n\t\t\t\t}\n\t\t\t\ttrusted := csrf.TrustedOrigins(configuration.Instance.Service.Cross.Trusted)\n\t\t\t\tprotection := csrf.Protect([]byte(\"32-byte-long-auth-key\"), trusted)\n\t\t\t\tlog.Fatal(http.ListenAndServe(host, protection(a.Handler.Router)))\n\t\t\t} else {\n\t\t\t\tprotection := csrf.Protect([]byte(\"32-byte-long-auth-key\"), csrf.SameSite(csrf.SameSiteNoneMode))\n\t\t\t\tlog.Fatal(http.ListenAndServe(host, protection(a.Handler.Router)))\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Fatal(\"The Cross-site Request Authentication Key is not 32 byte long\")\n\t\t}\n\t} else {\n\t\tlog.Fatal(http.ListenAndServe(host, a.Handler.Router))\n\t}\n}", "title": "" }, { "docid": "6595adfd184470c08a1a902232dcdbf9", "score": "0.6060503", "text": "func (s *Service) Exec(ctx context.Context, r *criapi.ExecRequest) (*criapi.ExecResponse, error) {\n\tlog.Debugf(\"Exec for %v\", r)\n\treturn s.stockRuntimeClient.Exec(ctx, r)\n}", "title": "" }, { "docid": "793e318d4c9853c83ad29f56f85780e7", "score": "0.60507184", "text": "func (a *Agent) execHandler(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != http.MethodPut && r.Method != http.MethodPost {\n\t\thttp.Error(w, \"Only PUT or POST methods are supported\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\tvar cmd Command\n\tif err := json.NewDecoder(r.Body).Decode(&cmd); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tid := a.registerNewCmd()\n\tctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)\n\tgo a.execute(ctx, &cmd, id)\n\tif cmd.Sync {\n\t\tdefer cancel() // Can not cancel if the command is async\n\t\tvar completed bool\n\t\tvar res CommandExec\n\t\tfor !completed {\n\t\t\ta.mu.Lock()\n\t\t\tres = a.executions[id]\n\t\t\tcompleted = res.Status != inprogress\n\t\t\ta.mu.Unlock()\n\t\t\ttime.Sleep(1 * time.Second)\n\t\t}\n\t\tif err := json.NewEncoder(w).Encode(&res); err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\treturn\n\t}\n\tres := CommandID{ID: id}\n\tif err := json.NewEncoder(w).Encode(&res); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\tcancel()\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n}", "title": "" }, { "docid": "53d5fd8c23d718939388e59925c9ff94", "score": "0.6047678", "text": "func (r apiUpdateTestRequest) Execute() (SyntheticsTestDetails, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPut\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue SyntheticsTestDetails\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"SyntheticsApiService.UpdateTest\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/synthetics/tests/{public_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"public_id\"+\"}\", _neturl.PathEscape(parameterToString(r.publicId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif r.body == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"body is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\n\t// Set Operation-ID header for telemetry\n\tlocalVarHeaderParams[\"DD-OPERATION-ID\"] = \"UpdateTest\"\n\n\t// body params\n\tlocalVarPostBody = r.body\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"apiKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-API-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"appKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-APPLICATION-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "f7bdb6578ccd06edc464e2206c273406", "score": "0.60432184", "text": "func (a ApiCommand) Execute(args []string) error {\n\tlog.Info(\"Opening url store\")\n\tdb, err := api.OpenDB()\n\tif err != nil {\n\t\treturn err\n\t}\n\turlStore, err := api.NewUrlStore(db)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tlog.Info(\"Url store open. Initializing API\")\n\tr := mux.NewRouter()\n\tr.Handle(\"/add\", &add_url.Handler{Store: urlStore}).Methods(http.MethodPut)\n\tr.Handle(\"/favicon.ico\", http.NotFoundHandler())\n\tr.Handle(\"/{hash}\", &redirect.Handler{Store: urlStore}).Methods(http.MethodGet)\n\n\tlog.Info(\"API initialized. Waiting for requests...\")\n\treturn http.ListenAndServe(\":\"+os.Getenv(\"URLSHORTENER_PORT\"), r)\n}", "title": "" }, { "docid": "8516e483e97b50759d3ddfe762c9f86c", "score": "0.6025771", "text": "func (r *loadDataInteractor) Execute(ctx context.Context, req InportRequest) (*InportResponse, error) {\n\n\tres := &InportResponse{}\n\n\t// use transaction here\n\terr := service.ExecuteTransaction(ctx, r.outport, func(dbCtx context.Context) error {\n\n\t\t// read data from file\n\t\terr := r.outport.ReadJSONData(ctx, service.ReadJSONDataServiceRequest{\n\t\t\tFilename: req.Filename,\n\t\t\tReadDataPerline: func(data entity.RawData) error {\n\t\t\t\terr := r.outport.SaveData(ctx, &data)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "2456faf26a302929e7e9da3a0fea3b9c", "score": "0.60060835", "text": "func (b *sendFileBuilder) Execute() (*PNSendFileResponse, StatusResponse, error) {\n\trawJSON, status, err := executeRequest(b.opts)\n\tif err != nil {\n\t\treturn emptySendFileResponse, status, err\n\t}\n\n\treturn newPNSendFileResponse(rawJSON, b.opts, status)\n}", "title": "" }, { "docid": "812004ed31b4a30d9247330cbf84daf2", "score": "0.6000477", "text": "func (g *GRPC) Execute() (err error) {\n\n\tg.Response = GRPCResponse{}\n\n\topts := []grpc.DialOption{}\n\tlog.Debug(\"enableTLS: \", g.Request.EnableTLS)\n\tif strings.Compare(g.Request.EnableTLS, \"true\") == 0 {\n\t\tlog.Debug(\"ClientCert: \", g.Request.ClientCert)\n\t\tcreds, err := credentials.NewClientTLSFromFile(g.Request.ClientCert, \"\")\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t}\n\n\t\topts = []grpc.DialOption{grpc.WithTransportCredentials(creds)}\n\n\t} else {\n\t\topts = []grpc.DialOption{grpc.WithInsecure()}\n\t}\n\n\tconn, err := getConnection(g.Request.HostURL, opts)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer releaseConnection(g.Request.HostURL)\n\n\tlog.Debug(\"operating mode: \", g.Request.OperatingMode)\n\n\tswitch g.Request.OperatingMode {\n\tcase \"grpc-to-grpc\":\n\t\treturn gRPCTogRPCHandler(g, conn)\n\tcase \"rest-to-grpc\":\n\t\treturn restTogRPCHandler(g, conn)\n\t}\n\n\tlog.Error(\"Invalid use of service , OperatingMode not recognised\")\n\treturn errors.New(\"Invalid use of service , OperatingMode not recognised\")\n}", "title": "" }, { "docid": "9eaa606e1325539876f482fe5969ea9d", "score": "0.59976596", "text": "func (r apiGetAPITestLatestResultsRequest) Execute() (SyntheticsGetAPITestLatestResultsResponse, *_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 SyntheticsGetAPITestLatestResultsResponse\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"SyntheticsApiService.GetAPITestLatestResults\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/synthetics/tests/{public_id}/results\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"public_id\"+\"}\", _neturl.PathEscape(parameterToString(r.publicId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif r.fromTs != nil {\n\t\tlocalVarQueryParams.Add(\"from_ts\", parameterToString(*r.fromTs, \"\"))\n\t}\n\tif r.toTs != nil {\n\t\tlocalVarQueryParams.Add(\"to_ts\", parameterToString(*r.toTs, \"\"))\n\t}\n\tif r.probeDc != nil {\n\t\tt := *r.probeDc\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"probe_dc\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"probe_dc\", parameterToString(t, \"multi\"))\n\t\t}\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\n\t// Set Operation-ID header for telemetry\n\tlocalVarHeaderParams[\"DD-OPERATION-ID\"] = \"GetAPITestLatestResults\"\n\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"apiKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-API-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"appKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-APPLICATION-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "db1fc747cdb05efc793d98943ca20e63", "score": "0.5983998", "text": "func (p *Pool) Execute(query string, bindings, rebindings map[string]string) (resp []Response, err error) {\n\treturn p.ExecuteCtx(context.Background(), query, bindings, rebindings)\n}", "title": "" }, { "docid": "f882463706ba7d6e844c6fd41f20b015", "score": "0.5980442", "text": "func (r apiScanOriginRequest) Execute() (CdnScanOriginResponse, *_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 CdnScanOriginResponse\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"InfrastructureApiService.ScanOrigin\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/cdn/v1/origins/scan\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\t\n\tif r.cdnScanOriginRequest == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"cdnScanOriginRequest is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = r.cdnScanOriginRequest\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v ApiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v ApiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\t\tvar v ApiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "843a27920b010307d168246914ecf10f", "score": "0.59803593", "text": "func (r apiGetBrowserTestLatestResultsRequest) Execute() (SyntheticsGetBrowserTestLatestResultsResponse, *_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 SyntheticsGetBrowserTestLatestResultsResponse\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"SyntheticsApiService.GetBrowserTestLatestResults\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/synthetics/tests/browser/{public_id}/results\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"public_id\"+\"}\", _neturl.PathEscape(parameterToString(r.publicId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif r.fromTs != nil {\n\t\tlocalVarQueryParams.Add(\"from_ts\", parameterToString(*r.fromTs, \"\"))\n\t}\n\tif r.toTs != nil {\n\t\tlocalVarQueryParams.Add(\"to_ts\", parameterToString(*r.toTs, \"\"))\n\t}\n\tif r.probeDc != nil {\n\t\tt := *r.probeDc\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"probe_dc\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"probe_dc\", parameterToString(t, \"multi\"))\n\t\t}\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\n\t// Set Operation-ID header for telemetry\n\tlocalVarHeaderParams[\"DD-OPERATION-ID\"] = \"GetBrowserTestLatestResults\"\n\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"apiKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-API-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"appKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-APPLICATION-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "b467f37e01ef4926412fd36a246f8214", "score": "0.59795845", "text": "func (h *TargetHandler) Execute(ctxt context.Context, commandType cdp.MethodType, params easyjson.Marshaler, res easyjson.Unmarshaler) error {\n\tvar paramsBuf easyjson.RawMessage\n\tif params == nil {\n\t\tparamsBuf = emptyObj\n\t} else {\n\t\tvar err error\n\t\tparamsBuf, err = easyjson.Marshal(params)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tid := h.next()\n\n\t// save channel\n\tch := make(chan *cdp.Message, 1)\n\th.resrw.Lock()\n\th.res[id] = ch\n\th.resrw.Unlock()\n\n\t// queue message\n\th.qcmd <- &cdp.Message{\n\t\tID: id,\n\t\tMethod: commandType,\n\t\tParams: paramsBuf,\n\t}\n\n\terrch := make(chan error, 1)\n\tgo func() {\n\t\tdefer close(errch)\n\n\t\tselect {\n\t\tcase msg := <-ch:\n\t\t\tswitch {\n\t\t\tcase msg == nil:\n\t\t\t\terrch <- cdp.ErrChannelClosed\n\n\t\t\tcase msg.Error != nil:\n\t\t\t\terrch <- msg.Error\n\n\t\t\tcase res != nil:\n\t\t\t\terrch <- easyjson.Unmarshal(msg.Result, res)\n\t\t\t}\n\n\t\tcase <-ctxt.Done():\n\t\t\terrch <- ctxt.Err()\n\t\t}\n\n\t\th.resrw.Lock()\n\t\tdefer h.resrw.Unlock()\n\n\t\tdelete(h.res, id)\n\t}()\n\n\treturn <-errch\n}", "title": "" }, { "docid": "ecc85f88c9bad0630972d53aed6dd3e0", "score": "0.59674525", "text": "func (r apiGetBrowserTestResultRequest) Execute() (SyntheticsBrowserTestResultFull, *_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 SyntheticsBrowserTestResultFull\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"SyntheticsApiService.GetBrowserTestResult\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/synthetics/tests/browser/{public_id}/results/{result_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"public_id\"+\"}\", _neturl.PathEscape(parameterToString(r.publicId, \"\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"result_id\"+\"}\", _neturl.PathEscape(parameterToString(r.resultId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\n\t// Set Operation-ID header for telemetry\n\tlocalVarHeaderParams[\"DD-OPERATION-ID\"] = \"GetBrowserTestResult\"\n\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"apiKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-API-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"appKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-APPLICATION-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "4dd0683819de325966070a5356648343", "score": "0.596348", "text": "func (device *Device) Execute(cmds ...string) (*routeros.Reply, error) {\n\treturn device.Conn.RunArgs(cmds)\n}", "title": "" }, { "docid": "6eb79f1b9d3e111f8e7d8386d3806b80", "score": "0.59630144", "text": "func (b *grantBuilder) Execute() (*GrantResponse, StatusResponse, error) {\n\trawJSON, status, err := executeRequest(b.opts)\n\tif err != nil {\n\t\treturn emptyGrantResponse, status, err\n\t}\n\n\treturn newGrantResponse(rawJSON, status)\n}", "title": "" }, { "docid": "85456215df2b44b9eaecb88bc6b812c2", "score": "0.59455955", "text": "func performRequest(ctx context.Context, httpClient *http.Client, config *ClientConfig, method string, path string, queryParams interface{}, body interface{}, successV, failureV interface{}) (*http.Response, error) {\n\t// Marshal payload\n\tpayload, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Generate Request Url with query params\n\tqueryValues, err := goquery.Values(queryParams)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tqueryString := queryValues.Encode()\n\turl := fmt.Sprintf(\"%v/api/v2/%v\", config.Endpoint, path)\n\tif queryString != \"\" {\n\t\turl = strings.Join([]string{url, queryString}, \"?\")\n\t}\n\t// Create Request\n\treq, err := http.NewRequest(method, url, bytes.NewBuffer(payload))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\n\t// Set Headers\n\treq.Header.Add(\"Accept\", \"application/json; charset=utf-8\")\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"User-Agent\", userAgent)\n\treq.SetBasicAuth(config.UserName, config.Password)\n\t// Perform request\n\tresponse, err := httpClient.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// when err is nil, resp contains a non-nil resp.Body which must be closed\n\tdefer response.Body.Close()\n\tif successV != nil || failureV != nil {\n\t\terr = decodeResponseJSON(response, successV, failureV)\n\t}\n\treturn response, err\n}", "title": "" }, { "docid": "671d9fa9d3a8d8648da6b14aa481363f", "score": "0.5931284", "text": "func (c *Client) execute(call func() (*http.Response, error), target interface{}) (interface{}, error) {\n\tresp, err := call()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif resp.StatusCode > 299 {\n\t\tbody, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, fmt.Errorf(\"Server responded with status %v body %v\", resp.Status, string(body))\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = json.Unmarshal(body, target)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn target, nil\n}", "title": "" }, { "docid": "a7d31c5d8e242e3570c2d4339e7d07d8", "score": "0.5920427", "text": "func (r apiEnableRequest) Execute() (*_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\t\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"MonitorsApiService.Enable\")\n\tif err != nil {\n\t\treturn nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/monitoring/v2/stacks/{stack_id}/enable\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"stack_id\"+\"}\", _neturl.QueryEscape(parameterToString(r.stackId, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\t\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.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\tif err != nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v StackpathapiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v StackpathapiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\t\tvar v StackpathapiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "01c6ffc4dd5df18cb0ae0db65fc40e1c", "score": "0.58980083", "text": "func executeRequest(client *http.Client, url *url.URL, headers Headers) (*http.Response, error) {\n\tmirrors := FlibustaMirrors\n\tenvHost := getEnvHost()\n\tif envHost != \"\" {\n\t\tmirrors = append(mirrors, envHost)\n\t}\n\tresult := make(chan *ResponseResult)\n\tfor _, host := range mirrors {\n\t\treq, err := buildRequest(host, url, headers)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tgo func(r *http.Request, h string, out chan *ResponseResult) {\n\t\t\tresp, err := client.Do(r)\n\t\t\tout <- &ResponseResult{\n\t\t\t\tHost: h,\n\t\t\t\tResponse: resp,\n\t\t\t\tError: err,\n\t\t\t}\n\t\t}(req, host, result)\n\t}\n\tfor i := 0; i < len(mirrors); i++ {\n\t\trr := <-result\n\t\tif rr.Error != nil {\n\t\t\tlog.Println(rr.Error)\n\t\t} else if rr.Response.StatusCode != 200 {\n\t\t\t// TODO: should handle this?\n\t\t\tbodyBytes, _ := io.ReadAll(rr.Response.Body)\n\t\t\tbody := string(bodyBytes)\n\t\t\tlog.Println(body)\n\t\t\tdefer rr.Response.Body.Close()\n\t\t} else {\n\t\t\treturn rr.Response, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"All request attempts failed. Maybe you want to use some proxy? For example:\\n\\n\\t%s\", TorproxySuggest)\n}", "title": "" }, { "docid": "73e4ffd962fa9ede67c50d96cb52023d", "score": "0.58940613", "text": "func Execute(query string, schema graphql.Schema) *graphql.Result {\n\n\tresult := graphql.Do(graphql.Params{\n\t\tSchema: schema,\n\t\tRequestString: query,\n\t})\n\t//check errors associated with result\n\tif len(result.Errors)>0 {\n\t\tfmt.Printf(\"Unexpected errors inside Execute: %v\", result.Errors)\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "444e684a06b8e4c7018c00db2a48233b", "score": "0.58924377", "text": "func Execute() {\n\thub := internal.NewHub()\n\tgo hub.Run()\n\thttp.HandleFunc(\"/test\", func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Write([]byte(\"OK\"))\n\t})\n\n\thttp.HandleFunc(\"/\", serveHome)\n\thttp.HandleFunc(\"/ws\", func(w http.ResponseWriter, r *http.Request) {\n\t\tlog.Println(\">> New Connection from: \", GetIP(r))\n\t\tinternal.ServeWs(hub, w, r)\n\t})\n\tadd := fmt.Sprintf(\"%s:%s\", cfg.Cfg.Server.IP, cfg.Cfg.Server.Port)\n\tfmt.Println(\"Listening at: \", add)\n\terr := http.ListenAndServe(\":8000\", nil)\n\tif err != nil {\n\t\tlog.Fatal(\"ListenAndServe: \", err)\n\t}\n}", "title": "" }, { "docid": "8f6edbbcd8a56a1c79c57d1f90fe5ae9", "score": "0.58923906", "text": "func (c *Client) Execute(ctx context.Context, query string, opts ...grpc.CallOption) (*flight.FlightInfo, error) {\n\tcmd := pb.CommandStatementQuery{Query: query}\n\treturn flightInfoForCommand(ctx, c, &cmd, opts...)\n}", "title": "" }, { "docid": "5d263ff97617f47ebb73217e2967a8b8", "score": "0.5886807", "text": "func (a *Action) Run(ctx context.Context, input map[string]interface{}) (map[string]interface{}, error) {\n\tcode, mData, err := core.Execute(a.id, input, a.microgateway, a.IOMetadata(), a.logger)\n\toutput := make(map[string]interface{}, 8)\n\toutput[\"code\"] = code\n\toutput[\"data\"] = mData\n\n\treturn output, err\n}", "title": "" }, { "docid": "8e1dca09116d2e4840961e1da9cd01ae", "score": "0.5882895", "text": "func (r apiGetMetricsRequest) Execute() (CdnGetMetricsResponse, *_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 CdnGetMetricsResponse\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"MetricsApiService.GetMetrics\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/cdn/v1/stacks/{stack_id}/metrics\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"stack_id\"+\"}\", _neturl.QueryEscape(parameterToString(r.stackId, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\t\n\t\t\t\t\t\t\t\t\t\n\tif r.startDate != nil {\n\t\tlocalVarQueryParams.Add(\"start_date\", parameterToString(*r.startDate, \"\"))\n\t}\n\tif r.endDate != nil {\n\t\tlocalVarQueryParams.Add(\"end_date\", parameterToString(*r.endDate, \"\"))\n\t}\n\tif r.granularity != nil {\n\t\tlocalVarQueryParams.Add(\"granularity\", parameterToString(*r.granularity, \"\"))\n\t}\n\tif r.platforms != nil {\n\t\tlocalVarQueryParams.Add(\"platforms\", parameterToString(*r.platforms, \"\"))\n\t}\n\tif r.pops != nil {\n\t\tlocalVarQueryParams.Add(\"pops\", parameterToString(*r.pops, \"\"))\n\t}\n\tif r.billingRegions != nil {\n\t\tlocalVarQueryParams.Add(\"billing_regions\", parameterToString(*r.billingRegions, \"\"))\n\t}\n\tif r.sites != nil {\n\t\tlocalVarQueryParams.Add(\"sites\", parameterToString(*r.sites, \"\"))\n\t}\n\tif r.groupBy != nil {\n\t\tlocalVarQueryParams.Add(\"group_by\", parameterToString(*r.groupBy, \"\"))\n\t}\n\tif r.siteTypeFilter != nil {\n\t\tlocalVarQueryParams.Add(\"site_type_filter\", parameterToString(*r.siteTypeFilter, \"\"))\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\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v ApiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v ApiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\t\tvar v ApiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "d653aa8558b7d725ecdedd560b24b421", "score": "0.58724004", "text": "func (c *Client) Perform(req *http.Request) (*http.Response, error) {\n\treturn c.Transport.Perform(req)\n}", "title": "" }, { "docid": "be7b1d9e823238b7013cabdde2ec9ea5", "score": "0.5871379", "text": "func (p *Peer) Execute(req *installpb.ExecuteRequest, stream installpb.Agent_ExecuteServer) (err error) {\n\tp.WithField(\"req\", req).Info(\"Execute.\")\n\tif req.HasSpecificPhase() {\n\t\t// Execute the operation step with a new dispatcher\n\t\treturn p.executeConcurrentStep(req, stream)\n\t}\n\tp.submit(req)\n\tfor {\n\t\tselect {\n\t\tcase event := <-p.dispatcher.Chan():\n\t\t\terr := stream.Send(event)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase req := <-p.closeC:\n\t\t\terr := stream.Send(req.resp)\n\t\t\tclose(req.doneC)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase result := <-p.execDoneC:\n\t\t\tif result.Error != nil {\n\t\t\t\t// Phase finished with an error.\n\t\t\t\t// See https://github.com/grpc/grpc-go/blob/v1.22.0/codes/codes.go#L78\n\t\t\t\treturn status.Error(codes.Aborted, install.FormatAbortError(result.Error))\n\t\t\t}\n\t\t\tif result.CompletionEvent != nil {\n\t\t\t\terr := stream.Send(result.CompletionEvent.AsProgressResponse())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "78fccbe7004b8f460915f60d95a371e1", "score": "0.586678", "text": "func (r apiCreateTestRequest) Execute() (SyntheticsTestDetails, *_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 SyntheticsTestDetails\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"SyntheticsApiService.CreateTest\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/synthetics/tests\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif r.body == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"body is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\n\t// Set Operation-ID header for telemetry\n\tlocalVarHeaderParams[\"DD-OPERATION-ID\"] = \"CreateTest\"\n\n\t// body params\n\tlocalVarPostBody = r.body\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"apiKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-API-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"appKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-APPLICATION-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 402 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "f06b698ae62cd4fdcfdf8bfee737dd87", "score": "0.5858034", "text": "func (r apiListLocationsRequest) Execute() (SyntheticsLocations, *_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 SyntheticsLocations\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"SyntheticsApiService.ListLocations\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/synthetics/locations\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\n\t// Set Operation-ID header for telemetry\n\tlocalVarHeaderParams[\"DD-OPERATION-ID\"] = \"ListLocations\"\n\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"apiKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-API-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"appKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-APPLICATION-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "30d6c2e73f985b8fa8922c4d61639213", "score": "0.5847311", "text": "func (sq *SqlQuery) Execute(context Context, query *proto.Query, reply *mproto.QueryResult) (err error) {\n\tlogStats := newSqlQueryStats(\"Execute\", context, sq.config.SensitiveMode)\n\tallowShutdown := (query.TransactionId != 0)\n\tif err = sq.startRequest(query.SessionId, allowShutdown); err != nil {\n\t\treturn err\n\t}\n\tdefer sq.endRequest()\n\tdefer handleExecError(query, &err, logStats)\n\n\t*reply = *sq.qe.Execute(logStats, query)\n\treturn nil\n}", "title": "" }, { "docid": "608bd6727dfb9e814f2e6436f191ffa7", "score": "0.5846542", "text": "func (r apiAuthenticateUserRequest) Execute() (models.UserLoginResponse, *_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 models.UserLoginResponse\n\t)\n\n\tlocalBasePath, err := r.client.cfg.ServerURLWithContext(r.ctx, \"LoginApiService.AuthenticateUser\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/1/login/auth\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\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.customAllowedOriginHeader1 != nil {\n\t\tlocalVarHeaderParams[\"Custom-Allowed-Origin-Header-1\"] = parameterToString(*r.customAllowedOriginHeader1, \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = r.inlineObject6\n\treq, err := r.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.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 == 200 {\n\t\t\tvar v models.UserLoginResponse\n\t\t\terr = r.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 == 400 {\n\t\t\tvar v models.Status\n\t\t\terr = r.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 models.Status\n\t\t\terr = r.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.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": "10052781bf065dcb6466412cffc1f54d", "score": "0.5845631", "text": "func (r apiGetClosestPopsRequest) Execute() (CdnGetClosestPopsResponse, *_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 CdnGetClosestPopsResponse\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"InfrastructureApiService.GetClosestPops\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/cdn/v1/pops/closest\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\t\n\tif r.url != nil {\n\t\tlocalVarQueryParams.Add(\"url\", parameterToString(*r.url, \"\"))\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\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v ApiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v ApiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\t\tvar v ApiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "3b2918ff850488e0880dbe492fbb6905", "score": "0.58446985", "text": "func (c *Client) do(method string, urlpath string, query url.Values, body io.Reader, v interface{}) error {\n\t// add application id if defined:\n\tnewQuery := url.Values{}\n\tif c.appID != \"\" {\n\t\tif query == nil {\n\t\t\tquery = newQuery\n\t\t}\n\t\tquery.Set(\"app_id\", c.appID)\n\t}\n\n\tresp, err := c.raw(method, urlpath, query, body)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error making request: %s\", err)\n\t}\n\tdecode := json.NewDecoder(resp.Body)\n\tif err = decode.Decode(&v); err != nil {\n\t\treturn fmt.Errorf(\"cannot decode json: %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "15168a3f97f3e361f748dc66390cc637", "score": "0.58373076", "text": "func ExecutePostRequest() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// get the data in the request's body and creates a []byte called body\n\t\tbody, err := ioutil.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\tfmt.Println(w, \"Error reading request body\", err)\n\t\t\thttp.Error(w, \"Error reading request body\", http.StatusBadRequest)\n\t\t}\n\n\t\tvar t = &server.BodyRequest{}\n\t\terr = json.Unmarshal(body, t)\n\t\tif err != nil {\n\t\t\tfmt.Println(w, \"Error Unmarshall bodyRequest\", err)\n\t\t\thttp.Error(w, \"Error Unmarshall bodyRequest\", http.StatusInternalServerError)\n\t\t}\n\n\t\t// get domain field of request\n\t\tvar domainToAnalyze = t.DomainRequestParam\n\t\tdomainQuery, err := utils.ValidateQuery(domainToAnalyze)\n\n\t\t// handle if there is an error in domain typed by user\n\t\tif err != nil {\n\n\t\t\t// if the domain is not valid, stop and send StatusBadRequest\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// Analyze domain and creates a new Domain struct\n\t\tnewDomain, err := server.AnalyzeDomain(domainQuery)\n\n\t\t// handle if there is an error in domain typed by user\n\t\tif err != nil {\n\t\t\t// if the domain is not valid, stop and send StatusBadRequest\n\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tnewDomain, err = database.CheckDomain(newDomain)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\n\t\t}\n\n\t\tfmt.Println(\"\")\n\t\tfmt.Println(\"serversDescription >>>>\")\n\t\tfmt.Println(newDomain)\n\t\tjson.NewEncoder(w).Encode(newDomain)\n\t\tw.WriteHeader(http.StatusOK)\n\n\t}\n}", "title": "" }, { "docid": "dcec6c83e7130f7db115bca4672a64d1", "score": "0.5834628", "text": "func (s *EtcdServer) Do(ctx context.Context, r pb.Request) (Response, error) {\n\t// edit by puyangsky\n\tprintAccesssVector(r.Path, r.Method, getSubject(2, 30))\n\tr.ID = s.reqIDGen.Next()\n\tif r.Method == \"GET\" && r.Quorum {\n\t\tr.Method = \"QGET\"\n\t}\n\tv2api := (v2API)(&v2apiStore{s})\n\tswitch r.Method {\n\tcase \"POST\":\n\t\treturn v2api.Post(ctx, &r)\n\tcase \"PUT\":\n\t\treturn v2api.Put(ctx, &r)\n\tcase \"DELETE\":\n\t\treturn v2api.Delete(ctx, &r)\n\tcase \"QGET\":\n\t\treturn v2api.QGet(ctx, &r)\n\tcase \"GET\":\n\t\treturn v2api.Get(ctx, &r)\n\tcase \"HEAD\":\n\t\treturn v2api.Head(ctx, &r)\n\t}\n\treturn Response{}, ErrUnknownMethod\n}", "title": "" }, { "docid": "2dd5b1605c34a78c238721b55b262b6f", "score": "0.5819812", "text": "func (base *Base) Execute(action interface{}) {\n\tcontentType := render.Negotiate(base.Ctx, base.R)\n\n\tswitch contentType {\n\tcase render.MimeHal, render.MimeJSON:\n\t\taction, ok := action.(JSON)\n\n\t\tif !ok {\n\t\t\tgoto NotAcceptable\n\t\t}\n\n\t\taction.JSON()\n\n\t\tif base.Err != nil {\n\t\t\tproblem.Render(base.Ctx, base.W, base.Err)\n\t\t\treturn\n\t\t}\n\n\tcase render.MimeEventStream:\n\t\taction, ok := action.(SSE)\n\t\tif !ok {\n\t\t\tgoto NotAcceptable\n\t\t}\n\n\t\tstream := sse.NewStream(base.Ctx, base.W, base.R)\n\n\t\tfor {\n\t\t\taction.SSE(stream)\n\n\t\t\tif base.Err != nil {\n\t\t\t\t// in the case that we haven't yet sent an event, is also means we\n\t\t\t\t// havent sent the preamble, meaning we should simply return the normal\n\t\t\t\t// error.\n\t\t\t\tif stream.SentCount() == 0 {\n\t\t\t\t\tproblem.Render(base.Ctx, base.W, base.Err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tstream.Err(base.Err)\n\t\t\t}\n\n\t\t\tselect {\n\t\t\tcase <-base.Ctx.Done():\n\t\t\t\treturn\n\t\t\tcase <-sse.Pumped():\n\t\t\t\t//no-op, continue onto the next iteration\n\t\t\t}\n\t\t}\n\tcase render.MimeRaw:\n\t\taction, ok := action.(Raw)\n\n\t\tif !ok {\n\t\t\tgoto NotAcceptable\n\t\t}\n\n\t\taction.Raw()\n\n\t\tif base.Err != nil {\n\t\t\tproblem.Render(base.Ctx, base.W, base.Err)\n\t\t\treturn\n\t\t}\n\tdefault:\n\t\tgoto NotAcceptable\n\t}\n\treturn\n\nNotAcceptable:\n\tproblem.Render(base.Ctx, base.W, problem.NotAcceptable)\n\treturn\n}", "title": "" }, { "docid": "da8df21128b40384cc25be078eb65b79", "score": "0.58193934", "text": "func (r apiListTestsRequest) Execute() (SyntheticsListTestsResponse, *_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 SyntheticsListTestsResponse\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"SyntheticsApiService.ListTests\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/synthetics/tests\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif r.checkType != nil {\n\t\tlocalVarQueryParams.Add(\"check_type\", parameterToString(*r.checkType, \"\"))\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\n\t// Set Operation-ID header for telemetry\n\tlocalVarHeaderParams[\"DD-OPERATION-ID\"] = \"ListTests\"\n\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"apiKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-API-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"appKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-APPLICATION-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "4c1113a0c9e55802bcc74079c8bcdf24", "score": "0.5818994", "text": "func (c *Client) Execute(code string) (b []byte) {\n\tvar ner ErrorResponse\n\tvalues := url.Values{}\n\tvalues.Set(\"code\", code)\n\treq, _ := c.MakeRequest(\"execute\", values)\n\tres, doErr := c.Do(req)\n\tif doErr != nil {\n\t\treturn []byte{}\n\t}\n\tb, _ = ioutil.ReadAll(res.Body)\n\tif !res.Close {\n\t\tres.Body.Close()\n\t}\n\terr := json.Unmarshal(b, &ner)\n\tif ner.Err.Code == 6 {\n\t\treturn c.Execute(code)\n\t}\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn []byte{}\n\t}\n\treturn b\n}", "title": "" }, { "docid": "ccedf060fc8a4b91527507cd51dc5dbf", "score": "0.581565", "text": "func (o *JobGetIterRequest) ExecuteUsing(zr *ZapiRunner) (*JobGetIterResponse, error) {\n\treturn o.executeWithIteration(zr)\n}", "title": "" }, { "docid": "a9a239c3a8e79b3cdb807d3d740f92a0", "score": "0.58006924", "text": "func (w *worker) Execute(ctx context.Context, req *Request) <-chan Response {\n\tch := make(chan Response, 1)\n\tw.wg.Add(1)\n\tgo func() {\n\t\tdefer w.wg.Done()\n\t\tch <- w.workDoCmd(ctx, req)\n\t}()\n\treturn ch\n}", "title": "" }, { "docid": "58f27c32413ab2121b9139c2f414e43b", "score": "0.578302", "text": "func (ks3 *KS3) run(req *request, resp interface{}) (*http.Response, error) {\n\tif debug {\n\t\tlog.Printf(\"Running KS3 request: %#v\", req)\n\t}\n\n\threq, err := ks3.setupHttpRequest(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ks3.doHttpRequest(hreq, resp)\n}", "title": "" }, { "docid": "1b43899677d92a9c321e20b221a8cf15", "score": "0.5778874", "text": "func (c *ServeCmd) Execute(args []string) error {\n\tvar (\n\t\tmemStore = appdash.NewMemoryStore()\n\t\tStore = appdash.Store(memStore)\n\t\tQueryer = memStore\n\t)\n\n\tif c.StoreFile != \"\" {\n\t\tf, err := os.Open(c.StoreFile)\n\t\tif err != nil && !os.IsNotExist(err) {\n\t\t\treturn err\n\t\t}\n\t\tif f != nil {\n\t\t\tif n, err := memStore.ReadFrom(f); err == nil {\n\t\t\t\tlog.Printf(\"Read %d traces from file %s\", n, c.StoreFile)\n\t\t\t} else if err != nil {\n\t\t\t\tf.Close()\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := f.Close(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tif c.PersistInterval != 0 {\n\t\t\tgo func() {\n\t\t\t\tif err := appdash.PersistEvery(memStore, c.PersistInterval, c.StoreFile); err != nil {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\t\t\t}()\n\t\t}\n\t}\n\n\tif c.DeleteAfter > 0 {\n\t\tStore = &appdash.RecentStore{\n\t\t\tMinEvictAge: c.DeleteAfter,\n\t\t\tDeleteStore: memStore,\n\t\t\tDebug: true,\n\t\t}\n\t}\n\n\tapp := traceapp.New(nil)\n\tapp.Store = Store\n\tapp.Queryer = Queryer\n\n\tvar h http.Handler\n\tif c.BasicAuth != \"\" {\n\t\tparts := strings.SplitN(c.BasicAuth, \":\", 2)\n\t\tif len(parts) != 2 {\n\t\t\tlog.Fatalf(\"Basic auth must be specified as 'user:passwd'.\")\n\t\t}\n\t\tuser, passwd := parts[0], parts[1]\n\t\tif user == \"\" || passwd == \"\" {\n\t\t\tlog.Fatalf(\"Basic auth user and passwd must both be nonempty.\")\n\t\t}\n\t\tlog.Printf(\"Requiring HTTP Basic auth\")\n\t\th = newBasicAuthHandler(user, passwd, app)\n\t} else {\n\t\th = app\n\t}\n\n\tif c.SampleData {\n\t\tsampleData(Store)\n\t}\n\n\tvar l net.Listener\n\tvar proto string\n\tif c.TLSCert != \"\" || c.TLSKey != \"\" {\n\t\tcertBytes, err := ioutil.ReadFile(c.TLSCert)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tkeyBytes, err := ioutil.ReadFile(c.TLSKey)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tvar tc tls.Config\n\t\tcert, err := tls.X509KeyPair(certBytes, keyBytes)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\ttc.Certificates = []tls.Certificate{cert}\n\t\tl, err = tls.Listen(\"tcp\", c.CollectorAddr, &tc)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tproto = fmt.Sprintf(\"TLS cert %s, key %s\", c.TLSCert, c.TLSKey)\n\t} else {\n\t\tvar err error\n\t\tl, err = net.Listen(\"tcp\", c.CollectorAddr)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tproto = \"plaintext TCP (no security)\"\n\t}\n\tlog.Printf(\"appdash collector listening on %s (%s)\", c.CollectorAddr, proto)\n\tcs := appdash.NewServer(l, appdash.NewLocalCollector(Store))\n\tcs.Debug = c.Debug\n\tcs.Trace = c.Trace\n\tgo cs.Start()\n\n\tif c.TLSCert != \"\" || c.TLSKey != \"\" {\n\t\tlog.Printf(\"appdash HTTPS server listening on %s (TLS cert %s, key %s)\", c.HTTPAddr, c.TLSCert, c.TLSKey)\n\t\treturn http.ListenAndServeTLS(c.HTTPAddr, c.TLSCert, c.TLSKey, h)\n\t}\n\n\tlog.Printf(\"appdash HTTP server listening on %s\", c.HTTPAddr)\n\treturn http.ListenAndServe(c.HTTPAddr, h)\n}", "title": "" }, { "docid": "12bf7c6ec330f90b11cf19f81ab1b233", "score": "0.5778713", "text": "func (c *Client) Run(ctx context.Context, request *Request, response interface{}) error {\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tdefault:\n\t}\n\tvar requestBody bytes.Buffer\n\twriter := multipart.NewWriter(&requestBody)\n\tif err := writer.WriteField(\"query\", request.q); err != nil {\n\t\treturn errors.Wrap(err, \"write query field\")\n\t}\n\tif len(request.vars) > 0 {\n\t\tvariablesField, err := writer.CreateFormField(\"variables\")\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"create variables field\")\n\t\t}\n\t\tif err := json.NewEncoder(variablesField).Encode(request.vars); err != nil {\n\t\t\treturn errors.Wrap(err, \"encode variables\")\n\t\t}\n\t}\n\tfor i := range request.files {\n\t\tfilename := fmt.Sprintf(\"file-%d\", i+1)\n\t\tif i == 0 {\n\t\t\t// just use \"file\" for the first one\n\t\t\tfilename = \"file\"\n\t\t}\n\t\tpart, err := writer.CreateFormFile(filename, request.files[i].Name)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"create form file\")\n\t\t}\n\t\tif _, err := io.Copy(part, request.files[i].R); err != nil {\n\t\t\treturn errors.Wrap(err, \"preparing file\")\n\t\t}\n\t}\n\tif err := writer.Close(); err != nil {\n\t\treturn errors.Wrap(err, \"close writer\")\n\t}\n\tvar graphResponse = struct {\n\t\tData interface{}\n\t\tErrors []graphErr\n\t}{\n\t\tData: response,\n\t}\n\treq, err := http.NewRequest(http.MethodPost, c.endpoint, &requestBody)\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Header.Set(\"Content-Type\", writer.FormDataContentType())\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treq = req.WithContext(ctx)\n\tres, err := c.httpClient.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\tvar buf bytes.Buffer\n\tif _, err := io.Copy(&buf, res.Body); err != nil {\n\t\treturn errors.Wrap(err, \"reading body\")\n\t}\n\tif err := json.NewDecoder(&buf).Decode(&graphResponse); err != nil {\n\t\treturn errors.Wrap(err, \"decoding response\")\n\t}\n\tif len(graphResponse.Errors) > 0 {\n\t\t// return first error\n\t\treturn graphResponse.Errors[0]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "24895b2cf061ffa122b80b3e498ac073", "score": "0.5776786", "text": "func (g *GetItemOp) Execute(out interface{}) error {\n\tif g.err != nil {\n\t\treturn g.err\n\t}\n\treturn g.ExecuteWithCtx(g.client.Ctx(), out)\n}", "title": "" }, { "docid": "1f0286c1f8c3de87030d69a92918d837", "score": "0.5776757", "text": "func (tu *Utils) ExecuteRequestWithParameters(method, endpoint string, parameters interface{}) <-chan *httptest.ResponseRecorder {\n\tvar reader io.Reader\n\n\tif parameters != nil {\n\t\tpayload, _ := json.Marshal(parameters)\n\t\treader = bytes.NewReader(payload)\n\t}\n\n\treq, _ := http.NewRequest(method, endpoint, reader)\n\treq.Header.Add(\"Authorization\", getFakeToken())\n\treq.Header.Add(\"Accept\", \"application/json\")\n\n\tresponse := make(chan *httptest.ResponseRecorder)\n\tgo func() {\n\t\trr := httptest.NewRecorder()\n\t\trouter.NewServer(\"anyClusterName\", NewKubeUtilMock(tu.client, tu.radixclient, tu.secretproviderclient), tu.controllers...).ServeHTTP(rr, req)\n\t\tresponse <- rr\n\t\tclose(response)\n\t}()\n\n\treturn response\n\n}", "title": "" }, { "docid": "e3a64230437e3efd808f39f06e3d7ce5", "score": "0.57642376", "text": "func (s *SecurityRulesServerTransport) Do(req *http.Request) (*http.Response, error) {\n\trawMethod := req.Context().Value(runtime.CtxAPINameKey{})\n\tmethod, ok := rawMethod.(string)\n\tif !ok {\n\t\treturn nil, nonRetriableError{errors.New(\"unable to dispatch request, missing value for CtxAPINameKey\")}\n\t}\n\n\tvar resp *http.Response\n\tvar err error\n\n\tswitch method {\n\tcase \"SecurityRulesClient.BeginCreateOrUpdate\":\n\t\tresp, err = s.dispatchBeginCreateOrUpdate(req)\n\tcase \"SecurityRulesClient.BeginDelete\":\n\t\tresp, err = s.dispatchBeginDelete(req)\n\tcase \"SecurityRulesClient.Get\":\n\t\tresp, err = s.dispatchGet(req)\n\tcase \"SecurityRulesClient.NewListPager\":\n\t\tresp, err = s.dispatchNewListPager(req)\n\tdefault:\n\t\terr = fmt.Errorf(\"unhandled API %s\", method)\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "46da9cac193a8b9be6b5e32f040a4dc3", "score": "0.5760383", "text": "func (r apiGetUserRequest) Execute() (IdentityGetUserResponse, *_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 IdentityGetUserResponse\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"UsersApiService.GetUser\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/identity/v1/users/{user_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"user_id\"+\"}\", _neturl.QueryEscape(parameterToString(r.userId, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\t\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v StackpathapiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v StackpathapiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v StackpathapiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\t\tvar v StackpathapiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "4db2dba1038a045fc31454cf782b7c65", "score": "0.57599574", "text": "func (d *dropOffHandler) Execute(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"DropOffsHandler actived\")\n\tcontentType := r.Header.Get(\"Content-type\")\n\tif contentType != \"application/x-www-form-urlencoded\" {\n\t\tlog.Println(fmt.Errorf(\"Content Type is not valid\"))\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\terr := r.ParseForm()\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tvar input usecase.DropOffInput\n\n\terr = d.Schema.NewDecoder()\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\terr = d.Schema.Decode(&input, r.PostForm)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif err := d.validate(input); err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tstatusHTTP, err := d.DropOffUsecase.DropOff(input)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tlog.Println(fmt.Sprintf(\"DropOff created\"))\n\tw.WriteHeader(statusHTTP)\n\treturn\n}", "title": "" }, { "docid": "e5307e2fcde5ab38436efadffaf49a50", "score": "0.57449716", "text": "func (u *Task) Run(ctx context.Context, req *proto.RunRequest, rsp *proto.RunResponse) error {\n\tlog.Printf(\"Received Task.Run with method: %s\", req.Method)\n\n\tswitch req.Method {\n\tcase \"GET\":\n\t\trsp.StatusCode = proto.RunResponse_OK\n\tcase \"POST\":\n\t\trsp.StatusCode = proto.RunResponse_CREATED\n\tdefault:\n\t\trsp.StatusCode = proto.RunResponse_FAILED\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0970b6fdff7a828201073a0327998448", "score": "0.57378966", "text": "func performRequest(method string, URL string, values url.Values) (*http.Response, error) {\n\tvar response *http.Response\n\tvar err error\n\tswitch method {\n\tcase \"GET\":\n\t\tresponse, err = http.Get(URL + \"?\" + values.Encode())\n\tcase \"POST\":\n\t\tresponse, err = http.PostForm(URL, values)\n\tdefault:\n\t\t// Fail silently\n\t\treturn nil, nil\n\t}\n\treturn response, err\n}", "title": "" }, { "docid": "219e88cd38d3e8fc0e090dec30825c8d", "score": "0.57313704", "text": "func Do(url, method string, args *openstack.Args) error {\n\tmessage, err := json.EncodeClientRequest(method, args)\n\tcheckErr(err)\n\n\treq, err := http.NewRequest(\"POST\", url, bytes.NewBuffer(message))\n\tcheckErr(err)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := new(http.Client)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Printf(\"Error in sending request to %s. %s\", url, err)\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\terr = json.DecodeClientResponse(resp.Body, &result)\n\tif err != nil {\n\t\tlog.Printf(\"Couldn't decode response. %s\", err)\n\t\treturn err\n\t}\n\tlog.Printf(\"url: %s, method: %s, args: %s\", url, method, args)\n\n\treturn nil\n}", "title": "" }, { "docid": "680377ee5d60674ea9b679738c640af7", "score": "0.57293206", "text": "func (d Dispatch) Execute(ctx context.Context) error {\n\treturn d.Handler.Handle(ctx, d.EventType, d.DeliveryID, d.Payload)\n}", "title": "" } ]
bb5e71572546533eed01269b8574d24b
WithTimeout adds the timeout to the put client config v2 namespace changes params
[ { "docid": "60f9281512e8144bae7b0fc16c286263", "score": "0.6950197", "text": "func (o *PutClientConfigV2NamespaceChangesParams) WithTimeout(timeout time.Duration) *PutClientConfigV2NamespaceChangesParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" } ]
[ { "docid": "a272398858e9fecdb92da71aafbc87fc", "score": "0.70767254", "text": "func (o *PutClientConfigV2NamespaceChangesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "46bcfb682a9036453969c3b83bd355bc", "score": "0.67541194", "text": "func (o *PutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "bf83da50e51040b9daf69304e22275a1", "score": "0.673894", "text": "func (o *EditL3ServiceProfileUsingPUTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c18813d7433fc7d4b31b3cb49c19326c", "score": "0.6574308", "text": "func (o *SetCartDeliveryModeUsingPUTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e8ded29dee298e585bb1303e62999026", "score": "0.6556432", "text": "func (o *UpdateZoneProjectsUsingPUTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "ab77a224b9e4654627bdcf390b0c6463", "score": "0.65044636", "text": "func (o *PutParams) WithTimeout(timeout time.Duration) *PutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "936f2cd3eecfb0106473f43cc488219f", "score": "0.6417604", "text": "func (o *PcloudIkepoliciesPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b408dcd24aacf15289b4880f1a2f8114", "score": "0.6343889", "text": "func (o *CatalogTierPriceStorageV1ReplacePutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e8da18b8ecc4e8d411262f7ccaf40c1b", "score": "0.6322043", "text": "func NewPutClientConfigV2NamespaceChangesParamsWithTimeout(timeout time.Duration) *PutClientConfigV2NamespaceChangesParams {\n\tvar ()\n\treturn &PutClientConfigV2NamespaceChangesParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "221738c1d97668f2ae6f4419babf3a5a", "score": "0.6318306", "text": "func (o *PutZoneParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "34b5a36c31326652192928063eede78f", "score": "0.6295736", "text": "func (o *PutNmsUpdateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "fe27f84dbb45e9690647022f81f2c694", "score": "0.6285587", "text": "func (o *PutFlagSettingParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e9bbc6668d4fd2cc7fe98a5f4da22724", "score": "0.6280099", "text": "func (o *PortalsPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "72f3e70ef85175547ea2874a7b6ea341", "score": "0.61996686", "text": "func (o *CatalogProductRepositoryV1SavePutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "7975d31305696f51c6ac4e01d5e6a1fd", "score": "0.618278", "text": "func (o *LedgerVoucherPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d7afa0dda0246eac6f0e0feb8d979f10", "score": "0.615569", "text": "func (o *GetClientConfigV1ConfigByNameParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e6895f6cf704b0582469f678634c826a", "score": "0.61463624", "text": "func (o *PutNmsUpdateParams) WithTimeout(timeout time.Duration) *PutNmsUpdateParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "1decc7dbf9ea829ab062308e6e9bc521", "score": "0.6141581", "text": "func (o *PutCwfNetworkIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "ed5e305982fc5f990610cc45c7478164", "score": "0.61058295", "text": "func (o *SMSCampaignsCancelBySMSCampaignIDPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "4db5ce004e739f8c663c78e0d34082d7", "score": "0.60753226", "text": "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "9a09abd63ac7099a9b1a9f49cccf432f", "score": "0.59914637", "text": "func (o *AddOrUpdateNodePoolConfigItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "1301ebfc29e7385acc8f7e02671c7b9a", "score": "0.5933549", "text": "func (o *EmployeesByIDContractrulePutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c9bb02f14d79b7058923bdc714ecf4df", "score": "0.5926725", "text": "func WithTimeout(t time.Duration) apiOption {\n\treturn func(m *Management) {\n\t\tm.timeout = t\n\t}\n}", "title": "" }, { "docid": "cdc8a2fc2ed2577c340be89a8dbdbf67", "score": "0.59259", "text": "func (o *GetBundleByKeyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "86b6945275a384cdf8a926d17ad95014", "score": "0.5905111", "text": "func (o *EditL3ServiceProfileUsingPUTParams) WithTimeout(timeout time.Duration) *EditL3ServiceProfileUsingPUTParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "5fe53af3908ef59bf1f5f7d40c975b19", "score": "0.5883", "text": "func (o *PutMenuItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "19ca60b80e0a8670b794859d3356bf0d", "score": "0.58520955", "text": "func (o *PatchSepainstantIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "330a29703de86e37ad2d705e037280bf", "score": "0.58476204", "text": "func (o *UpdateSettingsAclsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "0df5657cb32ae892d8cb3c9b7bd241ac", "score": "0.58095324", "text": "func NewPutZoneParamsWithTimeout(timeout time.Duration) *PutZoneParams {\n\tvar ()\n\treturn &PutZoneParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "85fdd5d3ddb946699a7f9f667a9fe158", "score": "0.58042866", "text": "func (o *APIServiceAddressParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "604d669b8de79c45f2941400e27a10b0", "score": "0.5801657", "text": "func (o *ConfigGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f26c7319cf2d3ec73ba60e70f0f8695d", "score": "0.5801643", "text": "func (o *UpdateZoneProjectsUsingPUTParams) WithTimeout(timeout time.Duration) *UpdateZoneProjectsUsingPUTParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "7fc23810ce87bda3ad59184280037d44", "score": "0.5799351", "text": "func (o *UpdateSubnetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "afb6eed4d7ea5f818102f6fa252749a4", "score": "0.5795629", "text": "func (o *PutGatewaysIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "38bf197da0bbc58343b2a633ff4e55de", "score": "0.57916915", "text": "func (o *PutStackParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "66d3e6072de01a4caad314ce21071565", "score": "0.57844174", "text": "func WithTimeout(timeout time.Duration) configF {\n\treturn func(c *config) *config {\n\t\tc.defaultTimeout = timeout\n\t\treturn c\n\t}\n}", "title": "" }, { "docid": "d7382ad42f57b5157d0461c33d299eed", "score": "0.5774621", "text": "func (o *PatchAssetDeviceConfigurationsMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "749e9328459383e462d034f96bc2273d", "score": "0.57725495", "text": "func (o *PutClusterForAutoscaleParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "4868adc4203fd330c8352928b95fcd16", "score": "0.57717854", "text": "func (o *UpdateProjectTriggerSpacesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b2995ddba5a44ed02e883dbe963242eb", "score": "0.57627296", "text": "func (o *UpdateCustomIDPParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c03b46945e30a88c605531765ea4527c", "score": "0.5745435", "text": "func (c *CentralCacheTestImpl) SetWithTimeout(item Item, serialize bool, compress bool, ttl int32) error {\n\treturn nil\n}", "title": "" }, { "docid": "d54e8c2e2a436190897cc48f7cb40fb8", "score": "0.57385707", "text": "func (s *Store) SetWithTimeout(ctx context.Context, key interface{}, v json.Marshaler, timeout time.Duration) error {\n\treturn s.SetWithDeadline(ctx, key, v, time.Now().Add(timeout))\n}", "title": "" }, { "docid": "547d0735311a31e2ddf52f2219bb4f6a", "score": "0.5730862", "text": "func NewPutNmsUpdateParamsWithTimeout(timeout time.Duration) *PutNmsUpdateParams {\n\treturn &PutNmsUpdateParams{\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "d44362e605b97eb9a7ff7edac28a42f1", "score": "0.57219976", "text": "func (o *PutProductsNameParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "596b3281ad8eb36e1bc6597649482775", "score": "0.57177633", "text": "func (o *SwarmUpdateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "59e121b8f35530ad959499dbc7ebe87b", "score": "0.5717459", "text": "func (o *ContainerUpdateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "0752668489feddfbf6949f9d4dcdc9c7", "score": "0.5713694", "text": "func (o *UpdateOrganizationBillingAddressParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "4a9cc21edf6f185a41233625523b64ea", "score": "0.57069415", "text": "func WithTimeout(duration time.Duration) Option {\n\treturn wrappedOption{oconf.WithTimeout(duration)}\n}", "title": "" }, { "docid": "6351ac530494230836dd2280f18fadce", "score": "0.57017213", "text": "func (o *SyncStatusUsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "50a61e489836fe3d72834ccd687a61e9", "score": "0.5698375", "text": "func WithTimeout(t time.Duration) APIOption {\n\treturn newAPIOption(func(o *Options) {\n\t\to.Timeout = t\n\t})\n}", "title": "" }, { "docid": "05e6ac229c168e28b822b4592cb8892f", "score": "0.5685137", "text": "func (o *AuthorizeV3Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "05e6ac229c168e28b822b4592cb8892f", "score": "0.5685137", "text": "func (o *AuthorizeV3Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "ff5c0740e2ab9efd96f987d1474bf4a6", "score": "0.56841123", "text": "func WithTimeout(t time.Duration) Option {\n\treturn func(c *Client) { c.httpClient.Timeout = t }\n}", "title": "" }, { "docid": "20911dab2302e59dbcdc4178a8190ce1", "score": "0.56800944", "text": "func (o *UpdateDeploymentTargetSpacesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "0e7bff0fd521f908230b832aaf096b9c", "score": "0.5676443", "text": "func (o *DeleteNamespaceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "0fba9935a76f182a0a8138d281b6ecef", "score": "0.5676443", "text": "func (o *GetConfigsClusterParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "9f85fdb3807fe6ae4a92166a394891cc", "score": "0.5667643", "text": "func (o *UpdateIncidentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "aa406dd9b3e8023825f3a6d11b0d59f2", "score": "0.5665106", "text": "func (builder *TsListKeysCommandBuilder) WithTimeout(timeout time.Duration) *TsListKeysCommandBuilder {\n\ttimeoutMilliseconds := uint32(timeout / time.Millisecond)\n\tbuilder.timeout = timeout\n\tbuilder.protobuf.Timeout = &timeoutMilliseconds\n\treturn builder\n}", "title": "" }, { "docid": "eae78be4aec084b5cb4d72dd6f00317f", "score": "0.56592053", "text": "func WithTimeout(ctx context.Context, time time.Duration) (ret context.Context) {\n\tret = context.WithValue(ctx, liverpc.KeyTimeout, time)\n\treturn\n}", "title": "" }, { "docid": "14f953fd171c48ccfc9169a3c3213310", "score": "0.5657825", "text": "func (o *CreateCrossConnectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d9769a7267667bb638db8b809a7e1d97", "score": "0.5657313", "text": "func NewPutParamsWithTimeout(timeout time.Duration) *PutParams {\n\tvar ()\n\treturn &PutParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "15eb1a3a68e34ab3b4b321a1da4cdea1", "score": "0.5649341", "text": "func (o *ModifyProxyConfigInternalParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "a85b4886f221e044f8814c16927d31b0", "score": "0.5637445", "text": "func (o *PutZoneParams) WithTimeout(timeout time.Duration) *PutZoneParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "5e176adc27308296d8ce04e9b018d206", "score": "0.56371963", "text": "func (o *UpdateOrganizationTeamParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d6aa37c98b59786a425f6c654085660a", "score": "0.5629787", "text": "func (o *DeleteKeyPairsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "9b02193c370911491932a42102f5a34f", "score": "0.56142163", "text": "func (o *UpdateFeaturesConfigurationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "fa8009cfdd45f8dece55295a8fb00c74", "score": "0.56130767", "text": "func (o *RegenerateDeployKeyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d227070aeaf0a2c2600fae5171f81f39", "score": "0.56130004", "text": "func (o *ActionDeploymentRequestUsingPOST2Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "7bca543e5f6d5f3ead6eff79dc4b5861", "score": "0.560919", "text": "func WithTimeout(timeout time.Duration) Opt {\n\treturn func(c *Client) error {\n\t\tc.client.Timeout = timeout\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "a86b59610f789114da62a90abad3359b", "score": "0.560162", "text": "func (o *ListAllKeyspacesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "bfea163f7ebb26ea62f9f462e55cc296", "score": "0.5600275", "text": "func (o *PutRelationshipsIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "7ab15b68a9ce6548e8a3d110b01e5ee6", "score": "0.55922073", "text": "func (o *GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "69dd25f49eebf6c9691f45bac65a307b", "score": "0.5581341", "text": "func (o *SearchWorkspacesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f766fab3000dbbd3cb63f63e57d7e11f", "score": "0.5581173", "text": "func (o *CustomerGatewayUpdateOwnershipParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "8992e1949431283db0b8e2663fd762bf", "score": "0.55780214", "text": "func (o *PatchZoneParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "9899ebab1b6cd2a3bb592aa12ff87606", "score": "0.5572257", "text": "func (o *DeleteVersionControlRequestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "39661c738398667b1de9930c2c307d22", "score": "0.55664694", "text": "func (o *UpdateNetworkHTTPServerParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f3ea4a096dc4bf598e5b7d6641fa2493", "score": "0.55651706", "text": "func (o *UpdateAutoTagParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "dba1ed2ab396b74658d4aaebbfc08a67", "score": "0.5564054", "text": "func (o *MetroclusterInterconnectGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b9b3bf54ee497933cb3afa230caa39c8", "score": "0.5560184", "text": "func (o *GetOperatingSystemsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "4e9867ba404b16d50b988b4ed1f837c2", "score": "0.555536", "text": "func (o *ReplaceSubscriptionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "74b7ba48c759847e29213971e73a02ee", "score": "0.5552854", "text": "func WithTimeout(timeout time.Duration) Option {\n\treturn func(c *Client) {\n\t\tc.client.Timeout = timeout\n\t}\n}", "title": "" }, { "docid": "74b7ba48c759847e29213971e73a02ee", "score": "0.5552854", "text": "func WithTimeout(timeout time.Duration) Option {\n\treturn func(c *Client) {\n\t\tc.client.Timeout = timeout\n\t}\n}", "title": "" }, { "docid": "3225a8e6c25393018c167a0b2157cbfb", "score": "0.55528265", "text": "func (o *PcloudIkepoliciesPutParams) WithTimeout(timeout time.Duration) *PcloudIkepoliciesPutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "95d223d0e4eaa823e5ac883b1d247bf6", "score": "0.5551973", "text": "func (o *UpdateNetworkCellularGatewaySettingsSubnetPoolParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "8596873236b31c3d7c577b5af8b17d2e", "score": "0.5549594", "text": "func (o *IntegrationsManualHTTPSCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "29df73aa5620bcffb4b0f694627c1ff9", "score": "0.55462235", "text": "func (o *UpdateCredentialParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f871197ea22b2188378d93f1cb21b84a", "score": "0.554612", "text": "func (o *PutCwfNetworkIDParams) WithTimeout(timeout time.Duration) *PutCwfNetworkIDParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "21fc14d2a22e0b3af61af691e5fd7ed7", "score": "0.55458575", "text": "func NewPutCwfNetworkIDParamsWithTimeout(timeout time.Duration) *PutCwfNetworkIDParams {\n\tvar ()\n\treturn &PutCwfNetworkIDParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "886c1791222f5180f6c25803cd245d98", "score": "0.5541276", "text": "func (o *GetDeploymentByIDV3UsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "6d212a3a12fb2b7cb403dee4e07afa3a", "score": "0.5540263", "text": "func (o *GetScopeConfigurationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "5ef8d3ac6bc54b95e2f1978e0ae3ec2c", "score": "0.5530842", "text": "func (o *PutLTENetworkIDGatewaysGatewayIDConnectedENODEBSerialsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "ca61f5830d03ab9f699a549c37793aa6", "score": "0.55301774", "text": "func (o *UpdateRunbookParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "3a6feba37bbba85344938ab822c8833c", "score": "0.55292374", "text": "func (o *ProvisionNetworkClientsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "733354d3713b3cc7fff6609feca6ca79", "score": "0.55290747", "text": "func (o *PutFlagSettingParams) WithTimeout(timeout time.Duration) *PutFlagSettingParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "bb5f4909a207541af1e689b5c210a575", "score": "0.55287516", "text": "func (o *UpdateAccountStateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "22a48e04dc3ca739d8c4c964aa40433a", "score": "0.5524607", "text": "func (o *PutLolPerksV1CurrentpageParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "7f443fa2e4fe88d62567c481e371f8f6", "score": "0.5518774", "text": "func (o *UpdateBuildPropertiesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e66b98f55a4a3817e04f860151d8cf7a", "score": "0.5506848", "text": "func (o *OrgGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e911ae8e7f71a573e5c27b98db9a6582", "score": "0.54949206", "text": "func (o *UpdateWidgetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" } ]
72ca5148dbe530d61947f9a30e0548a6
Validate validates the provided args, using the provided context, setting attributes of OutputShowOptions as applicable
[ { "docid": "f6adf53595f2c66ae7876720922222de", "score": "0.7641559", "text": "func (o *OutputShowOptions) Validate(args []string, cxt *context.Context) error {\n\tswitch len(args) {\n\tcase 0:\n\t\treturn errors.New(\"an output name must be provided\")\n\tcase 1:\n\t\to.Output = args[0]\n\tdefault:\n\t\treturn errors.Errorf(\"only one positional argument may be specified, the output name, but multiple were received: %s\", args)\n\t}\n\n\t// If not provided, attempt to derive claim name from context\n\tif o.sharedOptions.Name == \"\" {\n\t\terr := o.sharedOptions.defaultBundleFiles(cxt)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"claim name must be provided via [--claim|-c CLAIM]\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "2e9b307ed7b9288d647cc4c31c323df3", "score": "0.7681985", "text": "func (o *OutputShowOptions) Validate(args []string, cxt *context.Context) error {\n\tswitch len(args) {\n\tcase 0:\n\t\treturn errors.New(\"an output name must be provided\")\n\tcase 1:\n\t\to.Output = args[0]\n\tdefault:\n\t\treturn errors.Errorf(\"only one positional argument may be specified, the output name, but multiple were received: %s\", args)\n\t}\n\n\t// If not provided, attempt to derive claim name from context\n\tif o.sharedOptions.Name == \"\" {\n\t\terr := o.sharedOptions.defaultBundleFiles(cxt)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"bundle instance name must be provided via [--instance|-i INSTANCE]\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9c4fd201d866075c8b35856b7a97eb48", "score": "0.7548261", "text": "func (o *OutputShowOptions) Validate(args []string, cxt *context.Context) error {\n\tswitch len(args) {\n\tcase 0:\n\t\treturn errors.New(\"an output name must be provided\")\n\tcase 1:\n\t\to.Output = args[0]\n\tdefault:\n\t\treturn errors.Errorf(\"only one positional argument may be specified, the output name, but multiple were received: %s\", args)\n\t}\n\n\t// If not provided, attempt to derive installation name from context\n\tif o.sharedOptions.Name == \"\" {\n\t\terr := o.sharedOptions.defaultBundleFiles(cxt)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"installation name must be provided via [--installation|-i INSTALLATION]\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b129875b0afff97dc0b79f630b222054", "score": "0.6641556", "text": "func (o *LogsShowOptions) Validate(cxt *context.Context) error {\n\tif o.Name != \"\" && o.ClaimID != \"\" {\n\t\treturn errors.New(\"either --installation or --run should be specified, not both\")\n\t}\n\n\t// Attempt to derive installation name from context\n\terr := o.sharedOptions.defaultBundleFiles(cxt)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif o.File == \"\" && o.Name == \"\" && o.ClaimID == \"\" {\n\t\treturn errors.New(\"either --installation or --run is required\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dc1e2729b0d26dccb2251e72bca67529", "score": "0.63915163", "text": "func (so *ShowOptions) Validate(args []string, cxt *portercontext.Context) error {\n\t// Ensure only one argument exists (installation name) if args length non-zero\n\terr := so.installationOptions.validateInstallationName(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = so.installationOptions.defaultBundleFiles(cxt)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn so.PrintOptions.Validate(ShowDefaultFormat, ShowAllowedFormats)\n}", "title": "" }, { "docid": "0335384b217c74332e3a72ff6cdac9c3", "score": "0.6254506", "text": "func ValidateOutputArgs(cmd *cobra.Command) error {\n\toutputMode := GetFlagString(cmd, \"output\")\n\tif outputMode != \"\" && outputMode != \"name\" {\n\t\treturn UsageError(cmd, \"Unexpected -o output mode: %v. We only support '-o name'.\", outputMode)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6d5cfaeb87101fa4b2d424dc916ac013", "score": "0.59837437", "text": "func (o *CmdOptions) Validate() error {\n\tif len(o.RequestRelease) == 0 {\n\t\treturn fmt.Errorf(\"release name must be specified\\nSee '%s -h' for help and examples\", cmdPath)\n\t}\n\n\tklog.V(4).Infof(\"Namespace: %s\", o.Namespace)\n\tklog.V(4).Infof(\"RequestRelease: %v\", o.RequestRelease)\n\tklog.V(4).Infof(\"Flags.AllNamespaces: %t\", *o.Flags.AllNamespaces)\n\tklog.V(4).Infof(\"Flags.Depth: %v\", *o.Flags.Depth)\n\tklog.V(4).Infof(\"Flags.Scopes: %v\", *o.Flags.Scopes)\n\tklog.V(4).Infof(\"ClientFlags.Context: %s\", *o.ClientFlags.Context)\n\tklog.V(4).Infof(\"ClientFlags.Namespace: %s\", *o.ClientFlags.Namespace)\n\tklog.V(4).Infof(\"PrintFlags.OutputFormat: %s\", *o.PrintFlags.OutputFormat)\n\tklog.V(4).Infof(\"PrintFlags.NoHeaders: %t\", *o.PrintFlags.HumanReadableFlags.NoHeaders)\n\tklog.V(4).Infof(\"PrintFlags.ShowGroup: %t\", *o.PrintFlags.HumanReadableFlags.ShowGroup)\n\tklog.V(4).Infof(\"PrintFlags.ShowLabels: %t\", *o.PrintFlags.HumanReadableFlags.ShowLabels)\n\tklog.V(4).Infof(\"PrintFlags.ShowNamespace: %t\", *o.PrintFlags.HumanReadableFlags.ShowNamespace)\n\n\treturn nil\n}", "title": "" }, { "docid": "c023e155350c4bb73a15f370b8b2c401", "score": "0.5935393", "text": "func (o *OutputListOptions) Validate(args []string, cxt *context.Context) error {\n\t// Ensure only one argument exists (claim name) if args length non-zero\n\terr := o.sharedOptions.validateInstanceName(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Attempt to derive claim name from context\n\terr = o.sharedOptions.defaultBundleFiles(cxt)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"bundle instance name must be provided\")\n\t}\n\n\treturn o.ParseFormat()\n}", "title": "" }, { "docid": "e4738721c78b73b647b2af7d2694272e", "score": "0.5927905", "text": "func (o *showPipelineOpts) Validate() error {\n\tif o.AppName() != \"\" {\n\t\tif _, err := o.store.GetApplication(o.AppName()); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif o.pipelineName != \"\" {\n\t\tif _, err := o.pipelineSvc.GetPipeline(o.pipelineName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5e244929c86614ac98e91f8ecebe628e", "score": "0.57198894", "text": "func (o *OutputListOptions) Validate(args []string, cxt *context.Context) error {\n\t// Ensure only one argument exists (installation name) if args length non-zero\n\terr := o.sharedOptions.validateInstallationName(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Attempt to derive installation name from context\n\terr = o.sharedOptions.defaultBundleFiles(cxt)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"installation name must be provided\")\n\t}\n\n\treturn o.ParseFormat()\n}", "title": "" }, { "docid": "6cb2ccf9e8a7d50f3c4cb62d2c9622ca", "score": "0.5685042", "text": "func TestRunClaimShow_InvalidFlags(t *testing.T) {\n\tcsc := claimsShowCmd{\n\t\tName: \"myclaim\",\n\t\tOutput: \"some-output\",\n\t\tOnlyBundle: true,\n\t\tStorage: mockClaimStore(),\n\t}\n\n\terr := csc.validateShowFlags()\n\tassert.EqualError(t, err, \"invalid flags: at most one of --bundle and --output can be specified\")\n}", "title": "" }, { "docid": "55c5161a52205cf9bf01ed7948eec317", "score": "0.5663776", "text": "func (o *OutputListOptions) Validate(args []string, cxt *context.Context) error {\n\t// Ensure only one argument exists (claim name) if args length non-zero\n\terr := o.sharedOptions.validateClaimName(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Attempt to derive claim name from context\n\terr = o.sharedOptions.defaultBundleFiles(cxt)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"claim name must be provided\")\n\t}\n\n\treturn o.ParseFormat()\n}", "title": "" }, { "docid": "fccf4aeb270c7a789dab7916b27f34ad", "score": "0.56202775", "text": "func (cli *CLI) validateArgs() {\n\t\tif len(os.Args) < 2 {\n\t\t\t\tcli.printHelp()\n\t\t\t\tos.Exit(1)\n\t\t}\n}", "title": "" }, { "docid": "132cfd63aafa415ed0661d04fb7ee0e3", "score": "0.56095386", "text": "func _validateFlagArgs() {\n\toutputFormat = outputFmt(outputFormatArg)\n\tvalidateOutputFormatExit(outputFormat)\n\tvalidateTreeFilterExit(treeFilterArg)\n}", "title": "" }, { "docid": "2d654f28f61e167f5cdad9cd0e8c796b", "score": "0.55570066", "text": "func validateArgs() {\n\tif *optionsEndpoint == \"\" {\n\t\tflag.Usage()\n\t\tos.Exit(1)\n\t}\n\tif *inputEndpoint == \"\" {\n\t\tflag.Usage()\n\t\tos.Exit(1)\n\t}\n\tif *outputEndpoint == \"\" {\n\t\tflag.Usage()\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "05fa56061a016610117d83248f7b43ab", "score": "0.55337", "text": "func (o *generateOptions) Validate() error {\n\n\tif len(o.args) > 1 {\n\t\treturn fmt.Errorf(\"either one or no arguments are allowed\")\n\t}\n\n\tif o.userDeploymentName == \"\" {\n\t\treturn fmt.Errorf(\"the deployment name is mandatory\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "11a457dd9e2499a9b69b16f77dc9ed50", "score": "0.55180717", "text": "func (o *Options) Validate(c *cobra.Command, args []string, f client.Factory) error {\n\tif err := output.ValidateFlags(c); err != nil {\n\t\treturn err\n\t}\n\n\tif err := uploader.ValidateUploaderType(o.UploaderType); err != nil {\n\t\treturn err\n\t}\n\n\t// If we're only installing CRDs, we can skip the rest of the validation.\n\tif o.CRDsOnly {\n\t\treturn nil\n\t}\n\n\t// Our main 3 providers don't support bucket names starting with a dash, and a bucket name starting with one\n\t// can indicate that an environment variable was left blank.\n\t// This case will help catch that error\n\tif strings.HasPrefix(o.BucketName, \"-\") {\n\t\treturn errors.Errorf(\"Bucket names cannot begin with a dash. Bucket name was: %s\", o.BucketName)\n\t}\n\n\tif o.NoDefaultBackupLocation {\n\t\tif o.BucketName != \"\" {\n\t\t\treturn errors.New(\"Cannot use both --bucket and --no-default-backup-location at the same time\")\n\t\t}\n\n\t\tif o.Prefix != \"\" {\n\t\t\treturn errors.New(\"Cannot use both --prefix and --no-default-backup-location at the same time\")\n\t\t}\n\n\t\tif o.BackupStorageConfig.String() != \"\" {\n\t\t\treturn errors.New(\"Cannot use both --backup-location-config and --no-default-backup-location at the same time\")\n\t\t}\n\t} else {\n\t\tif o.ProviderName == \"\" {\n\t\t\treturn errors.New(\"--provider is required\")\n\t\t}\n\n\t\tif o.BucketName == \"\" {\n\t\t\treturn errors.New(\"--bucket is required\")\n\t\t}\n\t}\n\n\tif o.UseVolumeSnapshots {\n\t\tif o.ProviderName == \"\" {\n\t\t\treturn errors.New(\"--provider is required when --use-volume-snapshots is set to true\")\n\t\t}\n\t} else {\n\t\tif o.VolumeSnapshotConfig.String() != \"\" {\n\t\t\treturn errors.New(\"--snapshot-location-config must be empty when --use-volume-snapshots=false\")\n\t\t}\n\t}\n\n\tif o.NoDefaultBackupLocation && !o.UseVolumeSnapshots {\n\t\tif o.ProviderName != \"\" {\n\t\t\treturn errors.New(\"--provider must be empty when using --no-default-backup-location and --use-volume-snapshots=false\")\n\t\t}\n\t} else {\n\t\tif len(o.Plugins) == 0 {\n\t\t\treturn errors.New(\"--plugins flag is required\")\n\t\t}\n\t}\n\n\tif o.DefaultVolumesToFsBackup && !o.UseNodeAgent {\n\t\treturn errors.New(\"--use-node-agent is required when using --default-volumes-to-fs-backup\")\n\t}\n\n\tswitch {\n\tcase o.SecretFile == \"\" && !o.NoSecret:\n\t\treturn errors.New(\"One of --secret-file or --no-secret is required\")\n\tcase o.SecretFile != \"\" && o.NoSecret:\n\t\treturn errors.New(\"Cannot use both --secret-file and --no-secret\")\n\t}\n\n\tif o.DefaultRepoMaintenanceFrequency < 0 {\n\t\treturn errors.New(\"--default-repo-maintain-frequency must be non-negative\")\n\t}\n\n\tif o.GarbageCollectionFrequency < 0 {\n\t\treturn errors.New(\"--garbage-collection-frequency must be non-negative\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a609d8e0daa7b250eb61e9f214cfe40e", "score": "0.55145025", "text": "func (cli *CLI) validateArgs() {\n\t// If there are less than two arguments, print usage and exit\n\tif len(os.Args) < 2 {\n\t\tcli.printUsage()\n\t\truntime.Goexit()\n\t}\n}", "title": "" }, { "docid": "0ef34f1227d5df350ea337f2f371ac02", "score": "0.5416797", "text": "func (o *GenericOptions) Validate() error {\n\tif len(o.AssetInputDir) == 0 {\n\t\treturn errors.New(\"missing required flag: --asset-input-dir\")\n\t}\n\tif len(o.AssetOutputDir) == 0 {\n\t\treturn errors.New(\"missing required flag: --asset-output-dir\")\n\t}\n\tif len(o.TemplatesDir) == 0 {\n\t\treturn errors.New(\"missing required flag: --templates-dir\")\n\t}\n\tif len(o.ConfigOutputFile) == 0 {\n\t\treturn errors.New(\"missing required flag: --config-output-file\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6f73f2b38b1c6aa68f8e418a84cabc1b", "score": "0.5339977", "text": "func validateArgs(cmd *cobra.Command, args []string) error {\n\tif args == nil || len(args) == 0 {\n\t\texit(\"not enough arguments\", fmt.Errorf(\"use --help for options\"))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8c262c9eb9fabcb986254a23ee4755ae", "score": "0.52968836", "text": "func (v *ViewerPodOptions) Validate() error {\n\tif len(v.args) == 0 {\n\t\treturn fmt.Errorf(\"at least one argument is required\")\n\t}\n\n\tif len(v.args) > 1 {\n\t\treturn fmt.Errorf(\"only one argument is allowed \")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "72ecd70788554d939307e339799e6923", "score": "0.52894545", "text": "func (o *NamespaceOptions) Validate() error {\n\tif len(o.rawConfig.CurrentContext) == 0 {\n\t\treturn errNoContext\n\t}\n\tif len(o.args) > 1 {\n\t\treturn fmt.Errorf(\"either one or no arguments are allowed\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2f84dfc93ea61b6dc8fca1c14af868d5", "score": "0.5287199", "text": "func (so *RunListOptions) Validate(args []string, cxt *portercontext.Context) error {\n\t// Ensure only one argument exists (installation name) if args length non-zero\n\terr := so.installationOptions.validateInstallationName(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = so.installationOptions.defaultBundleFiles(cxt)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn so.PrintOptions.Validate(ShowDefaultFormat, ShowAllowedFormats)\n}", "title": "" }, { "docid": "57cf03e16440d8e8b393c2ced6250b47", "score": "0.5270195", "text": "func (g *CommandGetOptions) Validate(cmd *cobra.Command) error {\n\tif cmdutil.GetFlagBool(cmd, \"show-labels\") {\n\t\toutputOption := cmd.Flags().Lookup(\"output\").Value.String()\n\t\tif outputOption != \"\" && outputOption != \"wide\" {\n\t\t\treturn fmt.Errorf(\"--show-labels option cannot be used with %s printer\", outputOption)\n\t\t}\n\t}\n\tif g.OutputWatchEvents && !(g.Watch || g.WatchOnly) {\n\t\treturn fmt.Errorf(\"--output-watch-events option can only be used with --watch or --watch-only\")\n\t}\n\n\tif len(g.Clusters) > 0 {\n\t\tclusters, err := g.karmadaClient.ClusterV1alpha1().Clusters().List(context.TODO(), metav1.ListOptions{})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tclusterSet := sets.NewString()\n\t\tfor _, cluster := range clusters.Items {\n\t\t\tclusterSet.Insert(cluster.Name)\n\t\t}\n\n\t\tvar noneExistClusters []string\n\t\tfor _, cluster := range g.Clusters {\n\t\t\tif !clusterSet.Has(cluster) {\n\t\t\t\tnoneExistClusters = append(noneExistClusters, cluster)\n\t\t\t}\n\t\t}\n\t\tif len(noneExistClusters) != 0 {\n\t\t\treturn fmt.Errorf(\"clusters don't exist: \" + strings.Join(noneExistClusters, \",\"))\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7fcdfb037ed6957f82d67b52494b8afe", "score": "0.5249831", "text": "func (opts *options) Validate() error {\n\t// TODO: Add an unit test for this\n\terrs := []error{}\n\terrs = append(errs, existingPathOrEmpty(opts.RootDrivePath, \"root-drive\"))\n\terrs = append(errs, requiredArg(opts.RootDrivePath, \"root-drive\"))\n\terrs = append(errs, existingPathOrEmpty(opts.KernelImage, \"kernel\"))\n\terrs = append(errs, requiredArg(opts.KernelImage, \"kernel\"))\n\terrs = append(errs, existingPathOrEmpty(opts.Binary, \"firecracker-binary\"))\n\terrs = append(errs, nonExistingPathOrEmpty(opts.SocketPath, \"socket-path\"))\n\terrs = append(errs, nonExistingPathOrEmpty(opts.FifoLogFile, \"firecracker-log\"))\n\terrs = append(errs, nonExistingPathOrEmpty(opts.MetricsFifo, \"metrics-fifo\"))\n\terrs = append(errs, nonExistingPathOrEmpty(opts.LogFifo, \"vmm-log-fifo\"))\n\terrs = append(errs, mustBePositiveInt(opts.CPUCount, \"cpus\"))\n\terrs = append(errs, mustBePositiveInt(opts.Memory, \"memory\"))\n\n\t// opts.FifoLogFile and opts.LogFifo are mutually exclusive, because LogFifo is ignored if FifoLogFile is set\n\t// But still both options need to be given internally to firecracker. So error if this was set incorrectly on the CLI\n\t// but allow our own defaults\n\tif len(opts.FifoLogFile) > 0 && len(opts.LogFifo) > 0 {\n\t\tif opts.FifoLogFile != opts.runtimeFilePath(\"vmm.log\") && opts.LogFifo != opts.runtimeFilePath(\"vmm.fifo\") {\n\t\t\terrs = append(errs, errConflictingLogOpts)\n\t\t}\n\t}\n\treturn aggregateErrs(errs)\n}", "title": "" }, { "docid": "ce330cc60803c449cd863c01ecb6101f", "score": "0.52136725", "text": "func validateReportArguments(cliCtx *cli.Context) error {\n\tif cliCtx.String(\"report\") == \"all\" &&\n\t\t!cliCtx.IsSet(\"report\") &&\n\t\tcliCtx.String(\"format\") == \"table\" {\n\n\t\tm := \"All the results in the table format can mess up your terminal. Use \\\"--report all\\\" to tell Trivy to output it to your terminal anyway, or consider \\\"--report summary\\\" to show the summary output.\"\n\n\t\treturn xerrors.New(m)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a2e7b598b86d054811218313c4fc8bfc", "score": "0.51640916", "text": "func (o *Options) validate(args []string) error {\n\tif len(args) != 0 {\n\t\treturn errors.New(\"no positional arguments are supported\")\n\t}\n\n\tif o.config.NodeIPAM.EnableNodeIPAM {\n\t\terr := o.validateNodeIPAMControllerOptions()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a6fe2cdb8e68a7bd9a5fd9cfe84a3015", "score": "0.51492625", "text": "func (eo *ExecOptions) Validate() (err error) {\n\treturn\n}", "title": "" }, { "docid": "ceb5985ba3985a60f3808abeba422936", "score": "0.5143775", "text": "func (o *Options) Validate(args []string) error {\n\tif len(args) > 1 {\n\t\treturn errors.New(\"specify one path to \" + constants.KustomizationFileNames[0])\n\t}\n\tif len(args) == 0 {\n\t\to.kustomizationPath = \"./\"\n\t} else {\n\t\to.kustomizationPath = args[0]\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6cd427b2a0ad7aac7b389b2aceb049cd", "score": "0.5138702", "text": "func CheckOpts(args []string, cmdDef CmdDef, xv reflect.Value, xt reflect.Type) int {\n\n\t//fs := flag.NewFlagSet(\"flags for foo\", flag.PanicOnError)\n\tfs := flag.NewFlagSet(\"flags for foo\", flag.ContinueOnError)\n\n\t//xv := reflect.ValueOf(&outOpts).Elem() // Dereference into addressable value\n\t//xt := xv.Type() // Now get the type of the value object\n\n\t//fmt.Println(\"options.go|CheckOpts|here\")\n\tfor i := 0; i < xt.NumField(); i++ {\n\t\tf := xt.Field(i) // get the field\n\n\t\t//fmt.Printf(\"%d: %s %s = %v\\n\", i, xt.Field(i).Name, f.Type(), f.Interface())\n\n\t\t//if f.Name == \"cmdDef\" { // skip the definition struct\n\t\t//\tcontinue\n\t\t//}\n\n\t\tname := strings.ToLower(f.Name) // get the name\n\t\tName := f.Name // get the exported name\n\t\taddr := xv.Field(i).Addr().Interface() //\n\t\t//desc := optdef.Desc\n\n\t\toptdef, ok := cmdDef.CmdOpts[Name]\n\t\tif !ok {\n\t\t\tlog.Fatal(\"Command \" + cmdDef.CmdName + \" missing definition for option: \" + Name)\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\tswitch ptr := addr.(type) {\n\t\tcase *int:\n\t\t\ti, err := strconv.Atoi(optdef.DefaultVal)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(\"Invalid integer default value for option\")\n\t\t\t}\n\t\t\tfs.IntVar(ptr, name, i, optdef.Help)\n\t\tcase *string:\n\t\t\tfs.StringVar(ptr, name, optdef.DefaultVal, optdef.Help)\n\t\tcase *bool:\n\t\t\tb, err := strconv.ParseBool(optdef.DefaultVal)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(\"Invalid bool default value for option\")\n\t\t\t}\n\t\t\tfs.BoolVar(ptr, name, b, optdef.Help)\n\t\t}\n\t}\n\terr := fs.Parse(args)\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t}\n\tprovidedArgs := fs.NArg() // number of args remaining\n\tif providedArgs != len(cmdDef.CmdArgs) {\n\t\tlog.Fatal(\"Error command \" + cmdDef.CmdName + \" expects \" + strconv.Itoa(len(cmdDef.CmdArgs)) + \" arguments, you provided \" + strconv.Itoa(providedArgs))\n\t}\n\treturn len(args) - fs.NArg()\n}", "title": "" }, { "docid": "39177d1a26c30ec60ff39a01211b7494", "score": "0.5128391", "text": "func (m *Option) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "93794b805a2aa8cdf314e15e121a2c45", "score": "0.50934297", "text": "func (opt *UpCommandOptions) Validate() error {\n\tif opt.AppName != \"\" && opt.File != \"\" {\n\t\treturn errors.Errorf(\"cannot use app name and file at the same time\")\n\t}\n\tif opt.AppName == \"\" && opt.File == \"\" {\n\t\treturn errors.Errorf(\"either app name or file should be set\")\n\t}\n\tif opt.AppName != \"\" && opt.PublishVersion == \"\" {\n\t\treturn errors.Errorf(\"publish-version must be set if you want to force existing application to re-run\")\n\t}\n\tif opt.AppName == \"\" && opt.RevisionName != \"\" {\n\t\treturn errors.Errorf(\"revision name must be used with application name\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1e04520e92d1dfcdeb74801fbb54b68d", "score": "0.50821555", "text": "func (m Context) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "853d4ce4aef918b753bfc0eadc3e6847", "score": "0.5071422", "text": "func (args *CmdArgs) DoCheckOptions() (bool, error) {\n\n\t// show command\n\tif args.verFlag {\n\t\tfmt.Println(CMD_VERSION)\n\t\t// exit command, no error\n\t\treturn true, nil\n\t}\n\n\t// set target range\n\tvar rangeErr error\n\tlineNums := strings.Split(args.lineStr, \":\")\n\tif len(lineNums) != 2 {\n\t\treturn true, errors.New(fmt.Sprintf(\"give bad range format: '%s', you must give format 'start:end'\", args.lineStr))\n\t}\n\targs.line.start, rangeErr = convertLineNumberToInt(lineNums[0], 0)\n\tif rangeErr != nil {\n\t\treturn true, rangeErr\n\t}\n\targs.line.end, rangeErr = convertLineNumberToInt(lineNums[1], 0)\n\tif rangeErr != nil {\n\t\treturn true, rangeErr\n\t}\n\tif args.line.end > 0 && args.line.start > args.line.end {\n\t\treturn true, errors.New(fmt.Sprintf(\"give bad range value: '%s', you must give value start < end\", args.lineStr))\n\t}\n\n\t// check enable source file path\n\tif args.srcPath != \"\" {\n\t\t// use -s option, read from file\n\t\targs.srcPath = filepath.Clean(args.srcPath)\n\t\t// '~' convert home directory\n\t\tif args.srcPath[0] == '~' {\n\t\t\tusr, errUsr := user.Current()\n\t\t\tif errUsr != nil {\n\t\t\t\treturn true, errors.New(fmt.Sprintf(\"error of get user info: %s\", errUsr.Error()))\n\t\t\t}\n\t\t\targs.srcPath = strings.Replace(args.srcPath, \"~\", usr.HomeDir, 1)\n\t\t}\n\t\t// wildcard analyze\n\t\tfiles, srcErr := filepath.Glob(args.srcPath)\n\t\tif srcErr != nil {\n\t\t\treturn true, errors.New(fmt.Sprintf(\"give bad source file path :%s\", args.srcPath))\n\t\t}\n\t\targs.srcFiles = make([]string, 0, 1)\n\t\tfor _, file := range files {\n\t\t\t// convert to absolute path\n\t\t\tabsPath, errPath := filepath.Abs(file)\n\t\t\tif errPath != nil {\n\t\t\t\treturn true, errors.New(fmt.Sprintf(\"'%s': error of abs path: %s\", file, errPath.Error()))\n\t\t\t}\n\t\t\targs.srcFiles = append(args.srcFiles, absPath)\n\t\t}\n\t} else {\n\t\t// not use -s, read from stdin\n\t\targs.srcFiles = []string{\"\"}\n\t}\n\n\t// check enable list file path\n\tif args.listPath != \"\" && !DoesExistPath(args.listPath) {\n\t\treturn true, errors.New(fmt.Sprintf(\"pick list file not found :%s\", args.listPath))\n\t}\n\n\t// command proc continue\n\treturn false, nil\n}", "title": "" }, { "docid": "8582249d0bf3d2e45dd12837f7737d0a", "score": "0.5071045", "text": "func checkArgs(cmd *cobra.Command, mode string, ts *templates.Set, args *Args) error {\n\t// check template is available for the mode\n\tif err := ts.For(mode); err != nil {\n\t\treturn err\n\t}\n\t// check --src and --template are exclusive\n\tif cmd.Flags().Lookup(\"src\").Changed && cmd.Flags().Lookup(\"template\").Changed {\n\t\treturn errors.New(\"--src and --template cannot be used together\")\n\t}\n\t// read query string from stdin if not provided via --query\n\tif mode == \"query\" && args.QueryParams.Query == \"\" {\n\t\tbuf, err := io.ReadAll(os.Stdin)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\targs.QueryParams.Query = string(bytes.TrimRight(buf, \"\\r\\n\"))\n\t}\n\t// check out path\n\tif args.OutParams.Out != \"\" {\n\t\tvar err error\n\t\tif args.OutParams.Out, err = realpath.Realpath(args.OutParams.Out); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := checkDir(args.OutParams.Out); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d006251129a82adc3cc266610a836780", "score": "0.50323874", "text": "func (o *showEnvOpts) Validate() error {\n\tif o.ProjectName() != \"\" {\n\t\tif _, err := o.storeSvc.GetProject(o.ProjectName()); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif o.envName != \"\" {\n\t\tif _, err := o.storeSvc.GetEnvironment(o.ProjectName(), o.envName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1eca53b9d675fffa288f28e315caf92d", "score": "0.50233305", "text": "func (o *RemoveAllNamespacesOptions) Validate() error {\n\tif len(o.args) != 2 {\n\t\treturn fmt.Errorf(\"exactly 2 arguments are needed\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "db84e0d869edb73aebfa8a2d827a5eff", "score": "0.5015987", "text": "func (o *CommandOptions) Validate() error {\n\treturn nil\n}", "title": "" }, { "docid": "0ad2d63cf8963f23e394272c24a961a3", "score": "0.4996896", "text": "func (opts GetOptions) Validate() error {\n\tcatcher := grip.NewBasicCatcher()\n\n\tcatcher.Add(opts.Cedar.Validate())\n\tcatcher.AddWhen(opts.ID == \"\" && opts.TaskID == \"\", errors.New(\"must provide an id or task id\"))\n\tcatcher.AddWhen(opts.ID != \"\" && opts.TaskID != \"\", errors.New(\"cannot provide both id and task id\"))\n\tcatcher.AddWhen(opts.TestName != \"\" && opts.TaskID == \"\", errors.New(\"must provide a task id when a test name is specified\"))\n\tcatcher.AddWhen(opts.GroupID != \"\" && opts.TaskID == \"\", errors.New(\"must provide a task id when a group id is specified\"))\n\tcatcher.AddWhen(opts.GroupID != \"\" && opts.Meta, errors.New(\"cannot specify a group id and set meta to true\"))\n\n\treturn catcher.Resolve()\n}", "title": "" }, { "docid": "e96fa6c79e08403e1150513db8f04d0e", "score": "0.49788108", "text": "func (m *ExecutionOutputDetailed) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\t// validation for a type composition with ExecutionOutput\n\tif err := m.ExecutionOutput.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": "3e4cd4ab2fa373a5b58cdeea7f956c9c", "score": "0.49718416", "text": "func (o *logOpts) Validate() error {\n\tif o.ProjectName() != \"\" {\n\t\t_, err := o.storeReader.GetProject(o.ProjectName())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif o.appName != \"\" {\n\t\t_, err := o.storeReader.GetApplication(o.ProjectName(), o.appName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif o.envName != \"\" {\n\t\tif err := o.validateEnvName(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "335e9063e8cb3514042e1c2c8bc10733", "score": "0.49688438", "text": "func ValidArgs(endpoint, token string, insecure bool, orgID, clusterID int32) error {\n\treturn validator.NotEmpty(map[string]interface{}{\n\t\tconstants.FlagPipelineAPIEndpoint: endpoint,\n\t\tconstants.FlagPipelineAPIToken: token,\n\t\tconstants.FlagPipelineOrganizationID: orgID,\n\t\tconstants.FlagPipelineClusterID: clusterID,\n\t})\n}", "title": "" }, { "docid": "c501040fbdfc55186f26a6b58d802f61", "score": "0.49507764", "text": "func (o *runTaskOpts) Validate() error {\n\tif o.count <= 0 {\n\t\treturn errNumNotPositive\n\t}\n\n\tif o.cpu <= 0 {\n\t\treturn errCpuNotPositive\n\t}\n\n\tif o.memory <= 0 {\n\t\treturn errMemNotPositive\n\t}\n\n\tif o.groupName != \"\" {\n\t\tif err := basicNameValidation(o.groupName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.image != \"\" && o.dockerfilePath != \"\" {\n\t\treturn errors.New(\"cannot specify both image and Dockerfile path\")\n\t}\n\n\tif o.dockerfilePath != \"\" {\n\t\tif _, err := o.fs.Stat(o.dockerfilePath); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.env != \"\" && (o.subnets != nil || o.securityGroups != nil) {\n\t\treturn errors.New(\"neither subnet nor security groups should be specified if environment is specified\")\n\t}\n\n\tif o.appName != \"\" {\n\t\tif err := o.validateAppName(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.env != \"\" {\n\t\tif err := o.validateEnvName(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "099995ebcb2e4f971eb4ac750468b8be", "score": "0.49469247", "text": "func main() {\n\tssmclicommands.ValidateInput(os.Args, os.Stdout)\n}", "title": "" }, { "docid": "1a48c426e90b2f6bbc4a97dad3306795", "score": "0.4920638", "text": "func (flags *Flags) Validate(args []string) error {\n\treturn nil\n}", "title": "" }, { "docid": "46f2193f9c0fe47dc9a38b3dec0297a3", "score": "0.49113664", "text": "func (m Pow) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "3b78ac27a419b1ec8af79d175109de50", "score": "0.4902802", "text": "func (m *WritableConsolePort) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateOccupied(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateCable(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateCablePeer(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateCablePeerType(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateConnectedEndpoint(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateConnectedEndpointReachable(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateConnectedEndpointType(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateCreated(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\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.contextValidateLastUpdated(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 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": "d67caf5015e4ac537a9541125135a3fb", "score": "0.490057", "text": "func (o *freezeOptions) validate() error {\n\tif len(o.args) < 1 {\n\t\treturn fmt.Errorf(\"the extendeddaemonset name is required\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e2f1d03b103dece1ecd3f843e756698d", "score": "0.48801938", "text": "func (o *CreateOptions) Validate() error {\n\tif len(o.Raw) > 0 {\n\t\tif o.EditBeforeCreate {\n\t\t\treturn fmt.Errorf(\"--raw and --edit are mutually exclusive\")\n\t\t}\n\t\tif len(o.FilenameOptions.Filenames) != 1 {\n\t\t\treturn fmt.Errorf(\"--raw can only use a single local file or stdin\")\n\t\t}\n\t\tif strings.Index(o.FilenameOptions.Filenames[0], \"http://\") == 0 || strings.Index(o.FilenameOptions.Filenames[0], \"https://\") == 0 {\n\t\t\treturn fmt.Errorf(\"--raw cannot read from a url\")\n\t\t}\n\t\tif o.FilenameOptions.Recursive {\n\t\t\treturn fmt.Errorf(\"--raw and --recursive are mutually exclusive\")\n\t\t}\n\t\tif len(o.Selector) > 0 {\n\t\t\treturn fmt.Errorf(\"--raw and --selector (-l) are mutually exclusive\")\n\t\t}\n\t\tif o.PrintFlags.OutputFormat != nil && len(*o.PrintFlags.OutputFormat) > 0 {\n\t\t\treturn fmt.Errorf(\"--raw and --output are mutually exclusive\")\n\t\t}\n\t\tif _, err := url.ParseRequestURI(o.Raw); err != nil {\n\t\t\treturn fmt.Errorf(\"--raw must be a valid URL path: %v\", err)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0eb832c694f26b23f7e26e87425de0c1", "score": "0.4858086", "text": "func (m *ServerLogVerbosityPayloadSchema) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "b3b7bca5e0359cabf799669526fb12ce", "score": "0.48456934", "text": "func (o options) validateOptions() error {\n\tafs := afero.Afero{Fs: fileSystem}\n\n\tif o.bundleImageRef == \"\" {\n\t\treturn fmt.Errorf(\"required parameter %s was not provided\", bundleImageRefOption)\n\t}\n\n\tif o.channel == \"\" {\n\t\treturn fmt.Errorf(\"required parameter %s was not provided\", channelOption)\n\t}\n\n\tif o.indexImageRef == \"\" {\n\t\treturn fmt.Errorf(\"required parameter %s was not provided\", indexImageRefOption)\n\t}\n\tif err := o.prowconfig.Validate(false); err != nil {\n\t\treturn err\n\t}\n\n\texists, _ := afs.Exists(o.prowconfig.JobConfigPath)\n\tif !exists {\n\t\treturn fmt.Errorf(\"validating job config path %s failed, does not exist\", o.prowconfig.JobConfigPath)\n\t}\n\n\tif o.jobName == \"\" {\n\t\treturn fmt.Errorf(\"required parameter %s was not provided\", jobNameOption)\n\t}\n\n\tif o.ocpVersion == \"\" {\n\t\treturn fmt.Errorf(\"required parameter %s was not provided\", ocpVersionOption)\n\t}\n\tif !strings.HasPrefix(o.ocpVersion, \"4\") {\n\t\treturn fmt.Errorf(\"ocp-version must be 4.x or higher\")\n\t}\n\n\tif o.operatorPackageName == \"\" {\n\t\treturn fmt.Errorf(\"required parameter %s was not provided\", operatorPackageNameOptions)\n\t}\n\n\texists, _ = afs.Exists(o.prowconfig.ConfigPath)\n\tif !exists {\n\t\treturn fmt.Errorf(\"validating prow config path %s failed, does not exist\", o.prowconfig.ConfigPath)\n\t}\n\n\tif !o.dryRun {\n\t\tif o.outputPath == \"\" {\n\t\t\treturn fmt.Errorf(\"required parameter %s was not provided\", outputFilePathOption)\n\t\t}\n\t\texists, _ = afs.Exists(filepath.Dir(o.outputPath))\n\t\tif !exists {\n\t\t\treturn fmt.Errorf(\"validating output file path %s failed, does not exist\", o.outputPath)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6b9a2b88dc26c78afcdbb8570a040677", "score": "0.48382822", "text": "func (m ApplicationVMSpecPlacementVerb) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "816b189489f94006b7378e2f8e599bbf", "score": "0.4834272", "text": "func (m *FCGILogStderrSample) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "5f87db851c9b6fea8f7b3c7492a67d6b", "score": "0.48044688", "text": "func (m *Arg) Validate() error {\n\tfor _, r := range m.Options {\n\t\tif err := r.Validate(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ea85fed3bd071b845a9beaf08f71224c", "score": "0.48041013", "text": "func (r *cmdRun) argErr(format string, a ...interface{}) int {\n\tif format != \"\" {\n\t\tfmt.Fprintf(os.Stderr, format+\"\\n\", a...)\n\t}\n\tfmt.Fprintln(os.Stderr, r.cmd.ShortDesc)\n\tfmt.Fprintln(os.Stderr, r.cmd.UsageLine)\n\tfmt.Fprintln(os.Stderr, \"\\nFlags:\")\n\tr.Flags.PrintDefaults()\n\treturn ecInvalidCommandLine\n}", "title": "" }, { "docid": "eaa46b4b4eb9841563f31d8d2ad93d94", "score": "0.4800216", "text": "func (m *pipelineSpec) 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.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": "fd236fd82c686c1da8b067a901cd562f", "score": "0.47961763", "text": "func (opt CreateReleaseOption) Validate() error {\n\tif len(strings.TrimSpace(opt.Title)) == 0 {\n\t\treturn fmt.Errorf(\"title is empty\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a592f6268ee48cd6b5b0d15e94d41aa9", "score": "0.47824767", "text": "func (wo *WatchOptions) Validate() (err error) {\n\n\t// Delay interval cannot be -ve\n\tif wo.delayFlag < 0 {\n\t\treturn fmt.Errorf(\"Delay cannot be lesser than 0 and delay=0 means changes will be pushed as soon as they are detected which can cause performance issues\")\n\t}\n\t// Print a debug message warning user if delay is set to 0\n\tif wo.delayFlag == 0 {\n\t\tklog.V(4).Infof(\"delay=0 means changes will be pushed as soon as they are detected which can cause performance issues\")\n\t}\n\n\tif wo.debugCommandFlag != \"\" && wo.EnvSpecificInfo != nil && wo.EnvSpecificInfo.GetRunMode() != envinfo.Debug {\n\t\treturn fmt.Errorf(\"please start the component in debug mode using `odo push --debug` to use the --debug-command flag\")\n\t}\n\texists, err := component.ComponentExists(wo.KClient, wo.EnvSpecificInfo.GetName(), wo.GetApplication())\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !exists {\n\t\treturn fmt.Errorf(\"component does not exist. Please use `odo push` to create your component\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f6fb2df211c2c4cf1ccde9778bd866eb", "score": "0.47763786", "text": "func checkArgsNotPrinted(dockerfile string, out []byte) error {\n\tfor _, arg := range argsMap[dockerfile] {\n\t\targSplitted := strings.Split(arg, \"=\")\n\t\tif len(argSplitted) == 2 {\n\t\t\tif idx := bytes.Index(out, []byte(argSplitted[1])); idx >= 0 {\n\t\t\t\treturn fmt.Errorf(\"Argument value %s for argument %s displayed in output\", argSplitted[1], argSplitted[0])\n\t\t\t}\n\t\t} else if len(argSplitted) == 1 {\n\t\t\tif envs, ok := envsMap[dockerfile]; ok {\n\t\t\t\tfor _, env := range envs {\n\t\t\t\t\tenvSplitted := strings.Split(env, \"=\")\n\t\t\t\t\tif len(envSplitted) == 2 {\n\t\t\t\t\t\tif idx := bytes.Index(out, []byte(envSplitted[1])); idx >= 0 {\n\t\t\t\t\t\t\treturn fmt.Errorf(\"Argument value %s for argument %s displayed in output\", envSplitted[1], argSplitted[0])\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fe2fa0feaa1724f179da0ade45ec2a3e", "score": "0.47759813", "text": "func DoValidation(cmd *cobra.Command) {\n\tValidateFlagCombinations(cmd.Flags())\n\tutils.ValidateFullPath(*backupDir)\n\tutils.ValidateFullPath(*pluginConfigFile)\n\tif !utils.IsValidTimestamp(*timestamp) {\n\t\tgplog.Fatal(errors.Errorf(\"Timestamp %s is invalid. Timestamps must be in the format YYYYMMDDHHMMSS.\", *timestamp), \"\")\n\t}\n}", "title": "" }, { "docid": "cd96554fe1becb58754cc3543e7e7183", "score": "0.47565386", "text": "func (s *InfoCollector) ExitArgs(ctx *parser.ArgsContext) {}", "title": "" }, { "docid": "33e34acb2df4f949f53ac386685a20e4", "score": "0.47542816", "text": "func (c *clusterOpts) Validate() error {\n\tif len(c.provider) == 0 {\n\t\treturn errors.New(\"missing required flag: --provider -p\")\n\t}\n\tif len(c.releaseImage) == 0 {\n\t\treturn errors.New(\"missing required flag: --release -r\")\n\t}\n\tif len(c.releaseImageType) == 0 {\n\t\treturn errors.New(\"missing required flag: --release-type -t\")\n\t}\n\tif c.releaseImageType == \"release\" && c.releaseImageType != \"nightly\" {\n\t\treturn errors.New(\"invalid combination: --release flag with release value must use --release-type: nightly\")\n\t}\n\n\tif len(c.sshKeyPath) == 0 {\n\t\treturn errors.New(\"missing required flag: --ssh-path -s\")\n\t}\n\tif c.releaseImage == \"latest\" && c.ocpVersion == \"\" {\n\t\treturn errors.New(\"`latest` release requires: --version\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "283111f93c2ca9499e9822563d63f030", "score": "0.47502518", "text": "func (m *InteractionResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "9e1ca79498bf88012dbbb3b168053b8a", "score": "0.47501922", "text": "func (m *GraphView) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "76308bb75e0c37f4816ceefeb10c32e4", "score": "0.4740331", "text": "func (m *ModelsAccessHealthDetails) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "5d452937dbcb52be7de2d458df06fbd2", "score": "0.47364253", "text": "func (m *NfsExport) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\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.contextValidateInodes(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateLabels(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": "318627aa71c27521744c2f385b86cbe3", "score": "0.47350085", "text": "func (m *InstallationParam) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "0aaac891bebc388a8006fcb1c1ab9c95", "score": "0.47321743", "text": "func (m *AssociateReportViolations) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "a3929617061ed34f1cf1f7ca1edfb0f2", "score": "0.4726243", "text": "func main() {\n\tvar args arguments.Args\n\n\topt1 := argumentOption.Option{\n\t\tLongKey: \"string\",\n\t\tShortKey: \"s\",\n\t\tValueType: \"string\",\n\t\tDescription: \"some option.\",\n\t\tRequired: true,\n\t\tValidator: validator.ValidateString,\n\t\tValidatorParam: validator.ParamString{Min: 3, Max: 5},\n\t}\n\topt2 := argumentOption.Option{\n\t\tLongKey: \"int\",\n\t\tShortKey: \"i\",\n\t\tValueType: \"int\",\n\t\tDescription: \"some option.\",\n\t\tDefaultValue: 80,\n\t\tValidator: validator.ValidateInt,\n\t\tValidatorParam: validator.ParamInt{Min: 10, Max: 100},\n\t}\n\topt3 := argumentOption.Option{\n\t\tLongKey: \"bool\",\n\t\tShortKey: \"b\",\n\t\tDescription: \"some option.\",\n\t}\n\n\tif err := args.AddOption(opt1); err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn\n\t}\n\tif err := args.AddOptions([]argumentOption.Option {opt2, opt3}); err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn\n\t}\n\n\tope1 := argumentOperand.Operand{\n\t\tKey: \"operand1\",\n\t\tValueType: \"string\",\n\t\tDescription: \"some operand\",\n\t\tRequired: true,\n\t}\n\tope2 := argumentOperand.Operand{\n\t\tKey: \"operand2\",\n\t\tValueType: \"int\",\n\t\tDescription: \"some operand\",\n\t}\n\tope3 := argumentOperand.Operand{\n\t\tKey: \"operand3\",\n\t\tValueType: \"int\",\n\t\tDescription: \"some operand\",\n\t}\n\n\tif err := args.AddOperand(ope1); err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn\n\t}\n\tif err := args.AddOperands([]argumentOperand.Operand {ope2, ope3}); err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn\n\t}\n\n\tif err := args.Parse(); err != nil {\n\t\tfmt.Println(err.Error())\n\t\tfmt.Println(args)\n\t\treturn\n\t}\n\n\tif str1, err := args.GetStringOpt(\"string\"); err != nil {\n\t\tfmt.Println(err.Error())\n\t\tfmt.Println(args)\n\t} else {\n\t\tfmt.Println(str1)\n\t}\n\n\tif integer1, err := args.GetIntOpt(\"int\"); err != nil {\n\t\tfmt.Println(err.Error())\n\t\tfmt.Println(args)\n\t} else {\n\t\tfmt.Println(integer1)\n\t}\n\n\tif args.OptIsSet(\"b\") {\n\t\tfmt.Println(\"--bool -b option is set.\")\n\t} else {\n\t\tfmt.Println(\"--bool -b option is not set.\")\n\t}\n\n\tif str2, err := args.GetStringOperand(\"operand1\"); err != nil {\n\t\tfmt.Println(err.Error())\n\t\tfmt.Println(args)\n\t\treturn\n\t} else {\n\t\tfmt.Println(str2)\n\t}\n\n\tif integer2, err := args.GetIntOperand(\"operand2\"); err != nil {\n\t\tfmt.Println(err.Error())\n\t} else {\n\t\tfmt.Println(integer2)\n\t}\n\n\tif integer3, err := args.GetIntOperand(\"operand3\"); err != nil {\n\t\tfmt.Println(err.Error())\n\t} else {\n\t\tfmt.Println(integer3)\n\t}\n}", "title": "" }, { "docid": "e7de87db9e53f31a82c6d7acec704c4b", "score": "0.47236222", "text": "func (m *PortInlineStatistics) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateDevice(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 len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ec5fa2931f6cb11ba441b96fcdafea09", "score": "0.47143245", "text": "func (m *WritableVirtualDeviceContext) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateCreated(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\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.contextValidateInterfaceCount(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateLastUpdated(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidatePrimaryIP(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 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": "c2db9cd7725bb6149940c6352cd27c2b", "score": "0.47083566", "text": "func validateArguments(\n\tp config.ShuttleProjectContext,\n\tcommand string,\n\tscriptArgs []config.ShuttleScriptArgs,\n\targs []string,\n\tvalidateArgs bool,\n) (map[string]string, error) {\n\tvar validationErrors []validationError\n\n\tnamedArgs, parsingErrors := validateArgFormat(args)\n\tvalidationErrors = append(validationErrors, parsingErrors...)\n\tif validateArgs {\n\t\tvalidationErrors = append(validationErrors, validateRequiredArgs(scriptArgs, namedArgs)...)\n\t\tvalidationErrors = append(validationErrors, validateUnknownArgs(scriptArgs, namedArgs)...)\n\t}\n\tif len(validationErrors) != 0 {\n\t\tsortValidationErrors(validationErrors)\n\t\tvar s strings.Builder\n\t\ts.WriteString(\"Arguments not valid:\\n\")\n\t\tfor _, e := range validationErrors {\n\t\t\tfmt.Fprintf(&s, \" %s\\n\", e)\n\t\t}\n\t\tfmt.Fprintf(&s, \"\\n%s\", expectedArgumentsHelp(command, scriptArgs))\n\t\treturn nil, errors.NewExitCode(2, s.String())\n\t}\n\treturn namedArgs, nil\n}", "title": "" }, { "docid": "c7b9d23d7fe6dd34db741700ea0995d1", "score": "0.4707892", "text": "func (opts *Options) Validate() error {\n\treturn nil\n}", "title": "" }, { "docid": "737763e31eb8783d13271025a0922375", "score": "0.47005954", "text": "func (m *Metadata) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "ae0f402d71c7bbcc9ce8b42f600482e7", "score": "0.46979803", "text": "func (o *BindContext) Validate() error {\n\tif o.Name == \"\" {\n\t\treturn fmt.Errorf(\"The name parameter is required\")\n\t}\n\n\tif o.Settings == \"\" {\n\t\treturn fmt.Errorf(\"The settings parameter is required\")\n\t}\n\n\tobjrefs, err := common.ValidateManyObjectArgs(o.Args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Validate types\n\tfor _, obj := range o.objects {\n\t\tswitch obj.Type {\n\t\tcase common.Profile:\n\t\t\tcontinue\n\t\tcase common.TailoredProfile:\n\t\t\tcontinue\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"Invalid type. Must be Profile or TailoredProfile.\")\n\t\t}\n\t}\n\n\t// TODO(jaosorior): Validate that objects actually exist\n\n\to.objects = objrefs\n\treturn nil\n}", "title": "" }, { "docid": "62d278345ed7da0368497222c964c6e2", "score": "0.4690369", "text": "func (dic *deleteIndicesCmd) Validate(cmd *cobra.Command, args []string) error {\n\tindices, _ := cmd.Flags().GetStringSlice(\"indices\")\n\n\tif len(indices) == 0 {\n\t\treturn errors.New(\"a list of indices is required to run this command\")\n\t}\n\n\tdic.context = new(contexts.DeleteIndicesContext)\n\tdic.context.SetList(indices...)\n\n\toptions := &options.DeleteIndicesOptions{}\n\toptions.BindFlags(cmd.Flags())\n\n\treturn dic.context.SetOptions(options)\n}", "title": "" }, { "docid": "960ee584df19e452cb39b89188b8051d", "score": "0.4685932", "text": "func (m *PipelineStarredProperty) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "ea44d66058ee61b2217963b2af86675d", "score": "0.4677743", "text": "func (m *EASIIntake) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "0b3fe2198d2ea40d3b31f4c99c581c3b", "score": "0.4676688", "text": "func (m *Label) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateClusters(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateConsistencyGroupSnapshots(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateConsistencyGroups(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateContentLibraryImages(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateContentLibraryVMTemplates(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateDatacenters(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateDisks(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateElfImages(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateHosts(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateIscsiLunSnapshots(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateIscsiLuns(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateIscsiTargets(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateIsolationPolicies(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateNamespaceGroups(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateNfsExports(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateNfsInodes(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateNics(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateNvmfNamespaceSnapshots(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateNvmfNamespaces(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateNvmfSubsystems(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateSecurityPolicies(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateVdses(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateVlans(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateVMSnapshots(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateVMTemplates(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateVMVolumes(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateVms(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": "991f5457c0f5c26d0e03352ba7b56cff", "score": "0.46766174", "text": "func (m DiskUsage) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "dbf9a16225d093f5b1a46cf458e791b4", "score": "0.46721107", "text": "func (m KlusterPhase) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "3a87f44a9fd74c2c6b03ec3496c8ab21", "score": "0.4665784", "text": "func (m ApplicationVMSpecPlacementSituation) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "48179ff68f5009a9a7950207f6a85594", "score": "0.46649265", "text": "func (m SearchView) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "02ef9626b85d140bd367720e818fae25", "score": "0.46644282", "text": "func (o *FilterOptions) Validate() error {\n\tpattern := o.FilterByOS\n\tif len(pattern) > 0 {\n\t\tre, err := regexp.Compile(pattern)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"--filter-by-os was not a valid regular expression: %v\", err)\n\t\t}\n\t\to.OSFilter = re\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c28041e0676cca0e753e3c8153037c0b", "score": "0.46638852", "text": "func (m *ApplicationVMSpecDefinition) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateInstances(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidatePlacement(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateTemplate(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateVMAffinity(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": "04b52b560ae3cb5a154f1b8cf9278db7", "score": "0.4660855", "text": "func (m *PlatformCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "c527e78099670b847c6450d27f898167", "score": "0.46564412", "text": "func (o SnapshotOption) Validate() error {\n\tif o.OverrideCompactionOverhead {\n\t\tif o.CompactionOverhead > 0 && o.CompactionIndex > 0 {\n\t\t\tplog.Errorf(\"both CompactionOverhead and CompactionIndex are set\")\n\t\t\treturn ErrInvalidOption\n\t\t}\n\t} else {\n\t\tif o.CompactionOverhead > 0 || o.CompactionIndex > 0 {\n\t\t\tplog.Warningf(\"CompactionOverhead and CompactionIndex will be ignored\")\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4a027fa4031f46bb71c884dc3f976319", "score": "0.4652268", "text": "func (m *IoArgoprojWorkflowV1alpha1Prometheus) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateCounter(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateGauge(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateHistogram(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateLabels(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": "b76fd91cb420dadf1b835b27d312dacf", "score": "0.46497628", "text": "func (m *Game) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "3e3bacb061ddd10be33cb627842a71a9", "score": "0.464629", "text": "func (m *FCGILogStderr) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateSample(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": "7055b85e6a29796b54c75b0a3bef246d", "score": "0.46371138", "text": "func (m *MountOverlay) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateLower(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateUpperdir(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateWorkdir(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": "092fbe7771d116eb7c347101ce8e9317", "score": "0.46354458", "text": "func (m *Volume) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "2247ede8330e82d7c220f1f6358d582a", "score": "0.46204764", "text": "func validateLogFlags(context *cli.Context) error {\n\tif taskID := context.String(flags.TaskIDFlag); taskID == \"\" {\n\t\treturn fmt.Errorf(\"TaskID must be specified with the --%s flag\", flags.TaskIDFlag)\n\t}\n\n\tstartTime := context.String(flags.StartTimeFlag)\n\tendTime := context.String(flags.EndTimeFlag)\n\tsince := context.Int(flags.SinceFlag)\n\n\tif since > 0 && startTime != \"\" {\n\t\treturn fmt.Errorf(\"--%s can not be used with --%s\", flags.SinceFlag, flags.StartTimeFlag)\n\t}\n\n\tif context.Bool(flags.FollowLogsFlag) && endTime != \"\" {\n\t\treturn fmt.Errorf(\"--%s can not be used with --%s\", flags.FollowLogsFlag, flags.EndTimeFlag)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6a5ec55d5730ba1df6d049c0eeec4061", "score": "0.46098563", "text": "func (m *ConsistencyGroupNasInlineExportPolicy) 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.contextValidateRules(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": "8f38eadf827d6c34da689348aa02d5aa", "score": "0.4608563", "text": "func (o *Options) Validate() error {\n\tvar errs []error\n\n\t// Validate exactly one of `--repo`, `--npm`, `--pypi`, `--rubygems`, `--nuget`, `--local` is enabled.\n\tif boolSum(o.Repo != \"\",\n\t\to.NPM != \"\",\n\t\to.PyPI != \"\",\n\t\to.RubyGems != \"\",\n\t\to.Nuget != \"\",\n\t\to.Local != \"\") != 1 {\n\t\terrs = append(\n\t\t\terrs,\n\t\t\terrRepoOptionMustBeSet,\n\t\t)\n\t}\n\n\t// Validate SARIF features are flag-guarded.\n\tif !o.isSarifEnabled() {\n\t\tif o.Format == FormatSarif {\n\t\t\terrs = append(\n\t\t\t\terrs,\n\t\t\t\terrSARIFNotSupported,\n\t\t\t)\n\t\t}\n\t\tif o.PolicyFile != \"\" {\n\t\t\terrs = append(\n\t\t\t\terrs,\n\t\t\t\terrPolicyFileNotSupported,\n\t\t\t)\n\t\t}\n\t}\n\n\t// Validate V6 features are flag-guarded.\n\tif !o.isV6Enabled() {\n\t\tif o.Format == FormatRaw {\n\t\t\terrs = append(\n\t\t\t\terrs,\n\t\t\t\terrRawOptionNotSupported,\n\t\t\t)\n\t\t}\n\t}\n\n\tif !o.isExperimentalEnabled() {\n\t\tif o.Format == FormatSJSON ||\n\t\t\to.Format == FormatFJSON ||\n\t\t\to.Format == FormatPJSON {\n\t\t\terrs = append(\n\t\t\t\terrs,\n\t\t\t\terrFormatSupportedWithExperimental,\n\t\t\t)\n\t\t}\n\t}\n\n\t// Validate format.\n\tif !validateFormat(o.Format) {\n\t\terrs = append(\n\t\t\terrs,\n\t\t\terrFormatNotSupported,\n\t\t)\n\t}\n\n\t// Validate `commit` is non-empty.\n\tif o.Commit == \"\" {\n\t\terrs = append(\n\t\t\terrs,\n\t\t\terrCommitIsEmpty,\n\t\t)\n\t}\n\n\tif len(errs) != 0 {\n\t\treturn fmt.Errorf(\n\t\t\t\"%w: %+v\",\n\t\t\terrValidate,\n\t\t\terrs,\n\t\t)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "10cb87251d92bf500b0556017bc75174", "score": "0.46074986", "text": "func (m *ZoneDatacenter) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "994b3db28198c9af33295dd908a82cca", "score": "0.46034092", "text": "func (oic *openIndicesCmd) Validate(cmd *cobra.Command, args []string) error {\n\tindices, _ := cmd.Flags().GetStringSlice(\"indices\")\n\n\tif len(indices) == 0 {\n\t\treturn errors.New(\"a list of indices is required to run this command\")\n\t}\n\n\toic.context = new(contexts.OpenIndicesContext)\n\toic.context.SetList(indices...)\n\n\toptions := &options.OpenIndicesOptions{}\n\toptions.BindFlags(cmd.Flags())\n\n\treturn oic.context.SetOptions(options)\n}", "title": "" }, { "docid": "b40ff166068b823e6705336885aa5c28", "score": "0.46016082", "text": "func (m *CPUGeneratorTargetStats) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "8a28e5f8628ba90b737b97f15bbddccd", "score": "0.46002272", "text": "func (o *ServerOptions) Validate() error {\n\tif len(o.rawConfig.CurrentContext) == 0 {\n\t\treturn errNoContext\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fd153db085249350738620516968d683", "score": "0.46000016", "text": "func ProcessArgs(cfg interface{}) Args {\n\tvar a Args\n\n\tf := flag.NewFlagSet(\"Discord Bot\", 1)\n\tf.StringVar(&a.ConfigPath, \"c\", \"config.yaml\", \"Path to configuration file\")\n\n\tfu := f.Usage\n\tf.Usage = func() {\n\t\tfu()\n\t\tenvHelp, _ := cleanenv.GetDescription(cfg, nil)\n\t\tfmt.Fprintln(f.Output())\n\t\tfmt.Fprintln(f.Output(), envHelp)\n\t}\n\n\terr := f.Parse(os.Args[1:])\n\tif err != nil {\n\t\tfmt.Println(\"[\"+time.Now().String()+\"] [ERROR] could not parse CLI arguments: \", err)\n\t\tos.Exit(2)\n\t}\n\treturn a\n}", "title": "" }, { "docid": "1111d9ffa6f2c187f071581cdb8c2e32", "score": "0.45992962", "text": "func (m *UniverseDefinitionTaskParams) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateClusters(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateCommunicationPorts(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateDeviceInfo(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateEncryptionAtRestConfig(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateExtraDependencies(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateNodeDetailsSet(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateSourceAsyncReplicationRelationships(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateTargetAsyncReplicationRelationships(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": "" } ]
9be4859be6d6096cec5b766a8880db1b
EmailGT applies the GT predicate on the "email" field.
[ { "docid": "972adce338c7a352786a253245bab881", "score": "0.8512513", "text": "func EmailGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldEmail), v))\n\t})\n}", "title": "" } ]
[ { "docid": "ec3d9141c9f9846ad28b78071b6b7827", "score": "0.8689827", "text": "func EmailGT(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "a9d48e303cbf9090a77949b767ea3377", "score": "0.8442717", "text": "func EmailGT(v string) predicate.User {\n\treturn predicate.User(sql.FieldGT(FieldEmail, v))\n}", "title": "" }, { "docid": "7ce28eb06d5a335303988efe873e4f1a", "score": "0.805561", "text": "func SocialEmailGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldSocialEmail), v))\n\t})\n}", "title": "" }, { "docid": "3d1f603d0965b2214edf1a7e98279223", "score": "0.694276", "text": "func EmailLTE(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "371e11c87bda14e5ed894bc85a04ae96", "score": "0.6921864", "text": "func AddressGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldAddress), v))\n\t})\n}", "title": "" }, { "docid": "7146b48ac4b377356efeb16432c4364c", "score": "0.6862344", "text": "func EmailGTE(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "62d549d983d71988dac6d3be34d7e1d3", "score": "0.6832189", "text": "func EmailLTE(v string) predicate.User {\n\treturn predicate.User(sql.FieldLTE(FieldEmail, v))\n}", "title": "" }, { "docid": "50c8eb8747f5d8fa7b1fdd920e2c2c44", "score": "0.68276614", "text": "func EmailGTE(v string) predicate.User {\n\treturn predicate.User(sql.FieldGTE(FieldEmail, v))\n}", "title": "" }, { "docid": "a4a865f656ec9ed0b1c18f52675c2c2e", "score": "0.68154985", "text": "func EmailGTE(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "a4a865f656ec9ed0b1c18f52675c2c2e", "score": "0.68154985", "text": "func EmailGTE(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "a4a865f656ec9ed0b1c18f52675c2c2e", "score": "0.68154985", "text": "func EmailGTE(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "a4a865f656ec9ed0b1c18f52675c2c2e", "score": "0.68154985", "text": "func EmailGTE(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "962cfb41c43c263f39e873bc90ec8433", "score": "0.6773718", "text": "func EmailLTE(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "962cfb41c43c263f39e873bc90ec8433", "score": "0.6773718", "text": "func EmailLTE(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "962cfb41c43c263f39e873bc90ec8433", "score": "0.6773718", "text": "func EmailLTE(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "962cfb41c43c263f39e873bc90ec8433", "score": "0.6773718", "text": "func EmailLTE(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "199ceaf960211eb2a06afe4885f0ddcf", "score": "0.6639003", "text": "func IPGT(v string) predicate.IP {\n\treturn predicate.IP(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldIP), v))\n\t})\n}", "title": "" }, { "docid": "001a221e431c0cf296a1fd45f6582f5c", "score": "0.6513086", "text": "func ZipcodeGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldZipcode), v))\n\t})\n}", "title": "" }, { "docid": "e57671bb5a9629aaebd19b1676b1208c", "score": "0.64635104", "text": "func StreetGT(v string) predicate.Delivery {\n\treturn predicate.Delivery(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldStreet), v))\n\t})\n}", "title": "" }, { "docid": "1bd95a13c56e60a06e98a0cf7ccb7ccb", "score": "0.637885", "text": "func SocialEmailGTE(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldSocialEmail), v))\n\t})\n}", "title": "" }, { "docid": "d9bc2ddc7d4ca6b7a9ead42db591150b", "score": "0.6375222", "text": "func NetGT(v string) predicate.IP {\n\treturn predicate.IP(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldNet), v))\n\t})\n}", "title": "" }, { "docid": "96ceb7f3bf60da3a741776d862776a96", "score": "0.6360377", "text": "func EmtellGT(v string) predicate.Repairinvoice {\n\treturn predicate.Repairinvoice(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldEmtell), v))\n\t})\n}", "title": "" }, { "docid": "d2e5bece8db457598e003dbfa2fb4ebc", "score": "0.62946343", "text": "func ZipcodeGT(v string) predicate.Delivery {\n\treturn predicate.Delivery(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldZipcode), v))\n\t})\n}", "title": "" }, { "docid": "61e04b873a508d9b8090370946ef6c97", "score": "0.62906706", "text": "func PhotoGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPhoto), v))\n\t})\n}", "title": "" }, { "docid": "ee26b7627a1317c49f57c8a9abcd3e9b", "score": "0.6278634", "text": "func EmailLT(v string) predicate.User {\n\treturn predicate.User(sql.FieldLT(FieldEmail, v))\n}", "title": "" }, { "docid": "f6e68cbca64a9dd7582920214ed7bb45", "score": "0.62541306", "text": "func StreetGT(v string) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldStreet), v))\n\t})\n}", "title": "" }, { "docid": "6b9c3808f5456e2fdf1c0bbb9bcb9270", "score": "0.6220477", "text": "func BioGT(v string) predicate.User {\n\treturn predicate.User(sql.FieldGT(FieldBio, v))\n}", "title": "" }, { "docid": "3e82fd88b144c7d57084ba02e241b047", "score": "0.62054914", "text": "func IPAddressGT(v string) predicate.OnlineSession {\n\treturn predicate.OnlineSession(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldIPAddress), v))\n\t})\n}", "title": "" }, { "docid": "c4ce8a62ea021bd76a05ba83e5ec9ccc", "score": "0.620036", "text": "func (r *RemoveRangeOp) Gt(fieldName string, value interface{}) *RemoveRangeOp {\n\tr.appendOp(Gt, fieldName, value)\n\treturn r\n}", "title": "" }, { "docid": "84e46942526f65048a4b8500b209794f", "score": "0.61687183", "text": "func WorkplaceGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldWorkplace), v))\n\t})\n}", "title": "" }, { "docid": "7e34fc455f89505809b0894041892330", "score": "0.61629057", "text": "func PostalcodeGT(v string) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPostalcode), v))\n\t})\n}", "title": "" }, { "docid": "556718caac6ecf8b874ae2574a229e8e", "score": "0.61588186", "text": "func TagsGT(v string) predicate.Project {\n\treturn predicate.Project(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldTags), v))\n\t})\n}", "title": "" }, { "docid": "2198f8756c6507a00ba9b3b08f6d55f3", "score": "0.6126605", "text": "func SocialEmailLTE(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldSocialEmail), v))\n\t})\n}", "title": "" }, { "docid": "aecadeeb98305a46a837e96e7362a313", "score": "0.6123799", "text": "func RemarkGT(v string) predicate.Order {\n\treturn predicate.Order(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldRemark), v))\n\t})\n}", "title": "" }, { "docid": "e62dc2655398556da42ba75b3c54d58c", "score": "0.61145365", "text": "func IPAddressGT(v string) predicate.GameServer {\n\treturn predicate.GameServer(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldIPAddress), v))\n\t})\n}", "title": "" }, { "docid": "4e68131879d35dd3452be555627f6c02", "score": "0.6077434", "text": "func PasswordGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPassword), v))\n\t})\n}", "title": "" }, { "docid": "21194e1c5752dc24415daec513ae91de", "score": "0.607264", "text": "func EmailLT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "21194e1c5752dc24415daec513ae91de", "score": "0.607264", "text": "func EmailLT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "21194e1c5752dc24415daec513ae91de", "score": "0.607264", "text": "func EmailLT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "21194e1c5752dc24415daec513ae91de", "score": "0.607264", "text": "func EmailLT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "07dd36215760417637acd6f7d9f2204e", "score": "0.6062633", "text": "func PhoneGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPhone), v))\n\t})\n}", "title": "" }, { "docid": "07dd36215760417637acd6f7d9f2204e", "score": "0.6062633", "text": "func PhoneGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPhone), v))\n\t})\n}", "title": "" }, { "docid": "07dd36215760417637acd6f7d9f2204e", "score": "0.6062633", "text": "func PhoneGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPhone), v))\n\t})\n}", "title": "" }, { "docid": "cfd8162c7239200e50bd4a9c0a15512a", "score": "0.6049313", "text": "func AvatarURLGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldAvatarURL), v))\n\t})\n}", "title": "" }, { "docid": "bb55049837498da05650f87eac700d62", "score": "0.6046328", "text": "func PasswordGT(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPassword), v))\n\t})\n}", "title": "" }, { "docid": "d5191e21098906371b85515951340305", "score": "0.60286766", "text": "func BodyGT(v string) predicate.Opt {\n\treturn predicate.Opt(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldBody), v))\n\t})\n}", "title": "" }, { "docid": "e7ff658d49b9b87c30c0f88f11e55cb7", "score": "0.60222286", "text": "func GroupGT(v string) predicate.Menugroup {\n\treturn predicate.Menugroup(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldGroup), v))\n\t})\n}", "title": "" }, { "docid": "a56604dcf7dcc8ed4a1d6a22ed880943", "score": "0.6011754", "text": "func LocationGT(v string) predicate.User {\n\treturn predicate.User(sql.FieldGT(FieldLocation, v))\n}", "title": "" }, { "docid": "5570271275d7df1ca23460deef7ea72b", "score": "0.60072654", "text": "func EmailLT(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "cf0eb1e0d90ee177819c22e2da469907", "score": "0.6006475", "text": "func PictureGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPicture), v))\n\t})\n}", "title": "" }, { "docid": "6dd245e6f070d7d9bd0f2fa9fa1b124d", "score": "0.6003547", "text": "func WorkplaceGT(v string) predicate.User {\n\treturn predicate.User(sql.FieldGT(FieldWorkplace, v))\n}", "title": "" }, { "docid": "e58f8f409ccfcb414c07163ee0cc10f2", "score": "0.6002514", "text": "func SubGT(v string) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldSub), v))\n\t})\n}", "title": "" }, { "docid": "4bdf4759889d654698dabb8c57bf9e98", "score": "0.59956205", "text": "func GenderGT(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldGender), v))\n\t})\n}", "title": "" }, { "docid": "33d0664f4565656c161fb9ac57074a2e", "score": "0.599423", "text": "func NameGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "33d0664f4565656c161fb9ac57074a2e", "score": "0.599423", "text": "func NameGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "33d0664f4565656c161fb9ac57074a2e", "score": "0.599423", "text": "func NameGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "1f5471ca347e32551cfe1258d1278ce5", "score": "0.59906733", "text": "func TenantGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldTenant), v))\n\t})\n}", "title": "" }, { "docid": "02db6b851ebeb16d280484e0f7352000", "score": "0.597517", "text": "func BequipmentGT(v string) predicate.Repairinvoice {\n\treturn predicate.Repairinvoice(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldBequipment), v))\n\t})\n}", "title": "" }, { "docid": "a73feba366b85c08fd641ea607e1af9c", "score": "0.5964495", "text": "func PhoneGT(v string) predicate.User {\n\treturn predicate.User(sql.FieldGT(FieldPhone, v))\n}", "title": "" }, { "docid": "9177e93d56d382e9ad2114969bfe5dc1", "score": "0.5947677", "text": "func SocialPayloadGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldSocialPayload), v))\n\t})\n}", "title": "" }, { "docid": "2024d5748656cb13bc0ee0c0b49e8aa6", "score": "0.5931841", "text": "func Ipv6GT(v string) predicate.Agent {\n\treturn predicate.Agent(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldIpv6), v))\n\t})\n}", "title": "" }, { "docid": "e8447ed0e143f1181a34bae3c7463d82", "score": "0.5929253", "text": "func ContentGT(v string) predicate.Post {\n\treturn predicate.Post(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldContent), v))\n\t})\n}", "title": "" }, { "docid": "beaa2c25299cb1e8856a840de5c641fa", "score": "0.59065086", "text": "func URLGT(v string) predicate.Token {\n\treturn predicate.Token(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldURL), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "ca6f179f04cfc9359d25dda630bad7c9", "score": "0.5905087", "text": "func BuyerGT(v string) predicate.Order {\n\treturn predicate.Order(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldBuyer), v))\n\t})\n}", "title": "" }, { "docid": "33f8da71b63fc1ec751fea0ac55618f3", "score": "0.58985776", "text": "func SocialTypeGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldSocialType), v))\n\t})\n}", "title": "" }, { "docid": "181c38ecc0f81d5e403eb70e9fd26198", "score": "0.58939564", "text": "func AgeGT(v int) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldAge), v))\n\t})\n}", "title": "" }, { "docid": "bedbb550a6971fcadb5eee2759c63895", "score": "0.5893696", "text": "func (b *Builder) Gt(rhs interface{}) *predicate.Predicate {\n\tb.p.RegisterPredicate(impl.Gt(rhs))\n\tif b.t != nil {\n\t\tb.t.Helper()\n\t\tEvaluate(b)\n\t}\n\treturn &b.p\n}", "title": "" }, { "docid": "367a24697b41e777005fdfdfe3d29a5f", "score": "0.5892871", "text": "func CountryGT(v string) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldCountry), v))\n\t})\n}", "title": "" }, { "docid": "1039d11f4f6b4f026ccced36054b3b7f", "score": "0.5887969", "text": "func LastContactGT(v time.Time) predicate.Agent {\n\treturn predicate.Agent(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldLastContact), v))\n\t})\n}", "title": "" }, { "docid": "f2aecb70ac00c622808174d1fa29f985", "score": "0.5880193", "text": "func AilmentGT(v string) predicate.Patientofphysician {\n\treturn predicate.Patientofphysician(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldAilment), v))\n\t})\n}", "title": "" }, { "docid": "5ba8d071abb20377085be6803ee64273", "score": "0.5879722", "text": "func SocialNameGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldSocialName), v))\n\t})\n}", "title": "" }, { "docid": "8aa94a78f4f66fc6a024d59d42c2af83", "score": "0.58727545", "text": "func CityGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldCity), v))\n\t})\n}", "title": "" }, { "docid": "8287b08e5ecbce4c7fa65ff8809174e3", "score": "0.5867226", "text": "func SocialAvatarURLGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldSocialAvatarURL), v))\n\t})\n}", "title": "" }, { "docid": "31f0e43cb63ad461d3e9183ac458fec7", "score": "0.58563393", "text": "func BodyGT(v string) predicate.Token {\n\treturn predicate.Token(sql.FieldGT(FieldBody, v))\n}", "title": "" }, { "docid": "d98861ccd20431c276c09dcd65e2374b", "score": "0.5851919", "text": "func NameGT(v string) predicate.User {\n\treturn predicate.User(sql.FieldGT(FieldName, v))\n}", "title": "" }, { "docid": "d98861ccd20431c276c09dcd65e2374b", "score": "0.5851919", "text": "func NameGT(v string) predicate.User {\n\treturn predicate.User(sql.FieldGT(FieldName, v))\n}", "title": "" }, { "docid": "2b143e40fc15b6190d26e2af9a0b549c", "score": "0.58356225", "text": "func HTMLURLGT(v string) predicate.User {\n\treturn predicate.User(sql.FieldGT(FieldHTMLURL, v))\n}", "title": "" }, { "docid": "5b791057a620957ce7f659011d2a7a02", "score": "0.58348966", "text": "func SocialUserIDGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldSocialUserID), v))\n\t})\n}", "title": "" }, { "docid": "6d4ca12487a7d35f91a38ab7b6340bfb", "score": "0.5833844", "text": "func TimeGT(v string) predicate.Announcement {\n\treturn predicate.Announcement(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldTime), v))\n\t})\n}", "title": "" }, { "docid": "64f1212cbd179ecd4d38748480527f6d", "score": "0.58178127", "text": "func DefaultExprGT(v string) predicate.User {\n\treturn predicate.User(sql.FieldGT(FieldDefaultExpr, v))\n}", "title": "" }, { "docid": "5bb98a87b4509d9d47140fa9506b93c6", "score": "0.58174187", "text": "func UpdatedWithGT(v string) predicate.Ethnicity {\n\treturn predicate.Ethnicity(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldUpdatedWith), v))\n\t})\n}", "title": "" }, { "docid": "365ce3ea5b500b1cbf99f301b7ece1ce", "score": "0.58163506", "text": "func KinTelGT(v string) predicate.Rent {\n\treturn predicate.Rent(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldKinTel), v))\n\t})\n}", "title": "" }, { "docid": "dccf0ae044174f41c7eb11b506344244", "score": "0.58146596", "text": "func NicknameGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldNickname), v))\n\t})\n}", "title": "" }, { "docid": "0b2ed9f2dd0cad06e894b67f2afecacb", "score": "0.58144146", "text": "func CityGT(v string) predicate.Delivery {\n\treturn predicate.Delivery(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldCity), v))\n\t})\n}", "title": "" }, { "docid": "e0845ce98548a4815ec2c837bfa4a0b5", "score": "0.5805848", "text": "func NameGT(v string) predicate.Book {\n\treturn predicate.Book(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "178961195272ff5dc8a23403fedd8bc1", "score": "0.5793371", "text": "func LocaleGT(v string) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldLocale), v))\n\t})\n}", "title": "" }, { "docid": "2c4a6196d7e394ebc1e2a80e055d2c0d", "score": "0.5792505", "text": "func NameGT(v string) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "ed69a7708844a308105865f50be06381", "score": "0.5788015", "text": "func PaperGT(v string) predicate.Order {\n\treturn predicate.Order(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPaper), v))\n\t})\n}", "title": "" }, { "docid": "edd0c64f47bfad5f8de47520240ade75", "score": "0.5787647", "text": "func LastNameGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldLastName), v))\n\t})\n}", "title": "" }, { "docid": "ba697a1949e11251636e7e314a8051ef", "score": "0.5782724", "text": "func AgeGT(v int) predicate.User {\n\treturn predicate.User(sql.FieldGT(FieldAge, v))\n}", "title": "" }, { "docid": "85f273f5fb4d0c013bb022705b1e010e", "score": "0.5775147", "text": "func NameGT(v string) predicate.ValidMessage {\n\treturn predicate.ValidMessage(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "c8a6234e1566cc341200b06861fa4f01", "score": "0.5774112", "text": "func TimezoneGT(v string) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldTimezone), v))\n\t})\n}", "title": "" }, { "docid": "1af113409da22c27ee502ef61fd3ae1e", "score": "0.5772226", "text": "func BunameGT(v string) predicate.Building {\n\treturn predicate.Building(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldBuname), v))\n\t})\n}", "title": "" }, { "docid": "4ff9b0ede871ebf2f143875b1718db06", "score": "0.5772197", "text": "func BenefitsGT(v string) predicate.Job {\n\treturn predicate.Job(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldBenefits), v))\n\t})\n}", "title": "" }, { "docid": "2d1f8dd26bb7b6f08f1e882181eab868", "score": "0.5766772", "text": "func SubtypeGT(v string) predicate.Block {\n\treturn predicate.Block(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldSubtype), v))\n\t})\n}", "title": "" }, { "docid": "5ebc80f49d172ae5be78f2b1e15086ba", "score": "0.5764498", "text": "func gt(lhs, rhs semantic.Expression) semantic.Expression {\n\treturn &semantic.BinaryOp{Type: semantic.BoolType, LHS: lhs, Operator: ast.OpGT, RHS: rhs}\n}", "title": "" }, { "docid": "7336071f812f21e32bd4621b4716d494", "score": "0.57621986", "text": "func UsernameGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldUsername), v))\n\t})\n}", "title": "" } ]
8c4dade16acb9e958b1ddb204fd8ef8c
listWorkUnits calls GetWorkUnits (as the similarlynamed Python function does) and validates that the response matches an expected set of work units.
[ { "docid": "2156a49cdf2f4132d5e17fb8cb4b8832", "score": "0.7858357", "text": "func listWorkUnits(t *testing.T, j *jobserver.JobServer, workSpecName string, options map[string]interface{}, expected map[string]map[string]interface{}) {\n\tgwu, msg, err := j.GetWorkUnits(workSpecName, options)\n\tif !assert.NoError(t, err) {\n\t\treturn\n\t}\n\tassert.Empty(t, msg)\n\tmissing := make(map[string]struct{})\n\tfor name := range expected {\n\t\tmissing[name] = struct{}{}\n\t}\n\tfor _, item := range gwu {\n\t\tif !assert.IsType(t, cborrpc.PythonTuple{}, item) {\n\t\t\tcontinue\n\t\t}\n\t\ttuple := item.(cborrpc.PythonTuple)\n\t\tif !assert.Len(t, tuple.Items, 2) {\n\t\t\tcontinue\n\t\t}\n\t\tif !assert.IsType(t, []byte{}, tuple.Items[0]) {\n\t\t\tcontinue\n\t\t}\n\t\tname := string(tuple.Items[0].([]byte))\n\t\tassert.IsType(t, map[string]interface{}{}, tuple.Items[1])\n\t\tif assert.Contains(t, expected, name, \"unexpected work unit\") {\n\t\t\tassert.Equal(t, expected[name], tuple.Items[1])\n\t\t}\n\t\tassert.Contains(t, missing, name, \"duplicate work unit\")\n\t\tdelete(missing, name)\n\t}\n}", "title": "" } ]
[ { "docid": "17c19a5dbbf3986b5e8855676e09cd0c", "score": "0.70212334", "text": "func TestListWorkUnits(t *testing.T) {\n\tj := setUpTest(t, \"TestListWorkUnits\")\n\tdefer tearDownTest(t, j)\n\n\tworkUnits := map[string]map[string]interface{}{\n\t\t\"foo\": {\"length\": 3},\n\t\t\"foobar\": {\"length\": 6},\n\t}\n\tworkSpecName := setWorkSpec(t, j, WorkSpecData)\n\taddWorkUnits(t, j, workSpecName, workUnits)\n\n\t// Initial check: both work units are there\n\tlistWorkUnits(t, j, workSpecName, gwuEverything, workUnits)\n\tlistWorkUnits(t, j, workSpecName, gwuDefault, workUnits)\n\tlistWorkUnits(t, j, workSpecName, gwuFinished, noWorkUnits)\n\n\t// Start one unit; should still be there\n\tok, spec, unit, data := getOneWork(t, j)\n\tif assert.True(t, ok) {\n\t\tassert.Equal(t, workSpecName, spec)\n\t\tif assert.Contains(t, workUnits, unit) {\n\t\t\tassert.Equal(t, workUnits[unit], data)\n\t\t}\n\t}\n\tlistWorkUnits(t, j, workSpecName, gwuEverything, workUnits)\n\tlistWorkUnits(t, j, workSpecName, gwuDefault, workUnits)\n\tlistWorkUnits(t, j, workSpecName, gwuFinished, noWorkUnits)\n\n\t// Finish that unit; should be gone, the other should be there\n\tfinishWorkUnit(t, j, workSpecName, unit, nil)\n\tavailable := map[string]map[string]interface{}{}\n\tfinished := map[string]map[string]interface{}{}\n\tif unit == \"foo\" {\n\t\tavailable[\"foobar\"] = workUnits[\"foobar\"]\n\t\tfinished[\"foo\"] = workUnits[\"foo\"]\n\t} else {\n\t\tavailable[\"foo\"] = workUnits[\"foo\"]\n\t\tfinished[\"foobar\"] = workUnits[\"foobar\"]\n\t}\n\tlistWorkUnits(t, j, workSpecName, gwuEverything, workUnits)\n\tlistWorkUnits(t, j, workSpecName, gwuDefault, available)\n\tlistWorkUnits(t, j, workSpecName, gwuFinished, finished)\n}", "title": "" }, { "docid": "dd3012c3ed3b075cd92850a97272a522", "score": "0.66957784", "text": "func TestListWorkSpecs(t *testing.T) {\n\tj := setUpTest(t, \"TestListWorkSpecs\")\n\tdefer tearDownTest(t, j)\n\n\t// Initial state is nothing\n\tspecs, next, err := j.ListWorkSpecs(map[string]interface{}{})\n\tif assert.NoError(t, err) {\n\t\tassert.Equal(t, []map[string]interface{}{}, specs)\n\t\tassert.Equal(t, \"\", next)\n\t}\n\n\tworkSpecName := setWorkSpec(t, j, WorkSpecData)\n\n\tspecs, next, err = j.ListWorkSpecs(map[string]interface{}{})\n\tif assert.NoError(t, err) {\n\t\tif assert.Len(t, specs, 1) {\n\t\t\tassert.Equal(t, workSpecName, specs[0][\"name\"])\n\t\t}\n\t\tassert.Equal(t, next, \"\")\n\t}\n}", "title": "" }, { "docid": "e31bc645b2d3c084199d2778189608b9", "score": "0.64860344", "text": "func (c *Client) ListUnits() *ListUnitsRequest {\n\tvar ()\n\treturn &ListUnitsRequest{\n\n\t\tFilterChildOrganisationID: c.Defaults.GetStrfmtUUIDPtr(\"ListUnits\", \"filter[child_organisation_id]\"),\n\n\t\tFilterOrganisationIds: make([]strfmt.UUID, 0),\n\n\t\ttimeout: cr.DefaultTimeout,\n\n\t\ttransport: c.transport,\n\t\tformats: c.formats,\n\t}\n}", "title": "" }, { "docid": "31a398d48e86df84ce64925c9a244447", "score": "0.6090162", "text": "func TestListWorkUnitsStartLimit(t *testing.T) {\n\tj := setUpTest(t, \"TestListWorkUnitsStartLimit\")\n\tdefer tearDownTest(t, j)\n\n\tworkUnits := map[string]map[string]interface{}{\n\t\t\"foo\": {\"length\": 3},\n\t\t\"bar\": {\"length\": 6},\n\t}\n\tworkSpecName := setWorkSpec(t, j, WorkSpecData)\n\taddWorkUnits(t, j, workSpecName, workUnits)\n\n\tlistWorkUnits(t, j, workSpecName, map[string]interface{}{\n\t\t\"limit\": 1,\n\t}, map[string]map[string]interface{}{\n\t\t\"bar\": {\"length\": 6},\n\t})\n\n\tlistWorkUnits(t, j, workSpecName, map[string]interface{}{\n\t\t\"start\": \"bar\",\n\t\t\"limit\": 1,\n\t}, map[string]map[string]interface{}{\n\t\t\"foo\": {\"length\": 3},\n\t})\n\n\tlistWorkUnits(t, j, workSpecName, map[string]interface{}{\n\t\t\"start\": \"foo\",\n\t\t\"limit\": 1,\n\t}, map[string]map[string]interface{}{})\n}", "title": "" }, { "docid": "973b5fb4dd387bd5e7714acf0dac005d", "score": "0.59524494", "text": "func (c *FleetClient) ListUnits() (err error) {\n\tvar sortable sort.StringSlice\n\tstates := make(map[string]*schema.UnitState, 0)\n\n\tunitStates, err := cAPI.UnitStates()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, us := range unitStates {\n\t\tif strings.HasPrefix(us.Name, \"deis-\") {\n\t\t\tstates[us.Name] = us\n\t\t\tsortable = append(sortable, us.Name)\n\t\t}\n\t}\n\tsortable.Sort()\n\tprintUnits(states, sortable)\n\treturn\n}", "title": "" }, { "docid": "229fc646c9367274038739dcc9c66e7a", "score": "0.59348655", "text": "func listUnitsWrapper(ctx context.Context, conn *dbus.Conn, states, patterns []string) ([]dbus.UnitStatus, error) {\n\tunits, err := conn.ListUnitsContext(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ListUnits error: %w\", err)\n\t}\n\tif len(patterns) > 0 {\n\t\tunits, err = MatchUnitPatterns(patterns, units)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"matching unit patterns error: %w\", err)\n\t\t}\n\t}\n\n\tif len(states) > 0 {\n\t\tvar finalUnits []dbus.UnitStatus\n\t\tfor _, unit := range units {\n\t\t\tfor _, state := range states {\n\t\t\t\tif unit.LoadState == state || unit.ActiveState == state || unit.SubState == state {\n\t\t\t\t\tfinalUnits = append(finalUnits, unit)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn finalUnits, nil\n\t}\n\n\treturn units, nil\n}", "title": "" }, { "docid": "92f1bcafb2bf6021949304f0a6aceaf5", "score": "0.583809", "text": "func (w *ServerInterfaceWrapper) WorkloadList(ctx echo.Context) error {\n\tvar err error\n\t// ------------- Path parameter \"namespace\" -------------\n\tvar namespace string\n\n\terr = runtime.BindStyledParameter(\"simple\", false, \"namespace\", ctx.Param(\"namespace\"), &namespace)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter namespace: %s\", err))\n\t}\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.WorkloadList(ctx, namespace)\n\treturn err\n}", "title": "" }, { "docid": "8531e9d55b335d470e9cac2c6bab3e80", "score": "0.5774022", "text": "func cmdListWorkloads(ccmd *cobra.Command, args []string) {\n\taplSvc := apl.NewClient()\n\toutput := runListCommand(&workloadParams, aplSvc.Workloads.List)\n\tif output != nil {\n\t\tfields := []string{\"ID\", \"WorkloadType\", \"LeaseType\", \"MaxLeasePeriodMins\", \"Priority\", \"QualityOfService\", \"CreatedTime\"}\n\t\tprintTableResultsCustom(output.([]apl.Workload), fields)\n\t}\n}", "title": "" }, { "docid": "e1a3ca8da8d98d1d71d5e3b85ac5f143", "score": "0.5758281", "text": "func listUnitsFilteredWrapper(ctx context.Context, conn *dbus.Conn, states, patterns []string) ([]dbus.UnitStatus, error) {\n\tunits, err := conn.ListUnitsFilteredContext(ctx, states)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ListUnitsFiltered error: %w\", err)\n\t}\n\n\treturn MatchUnitPatterns(patterns, units)\n}", "title": "" }, { "docid": "6c0e1193427c7b26f81c69661c80d280", "score": "0.56892806", "text": "func (client NetworkLoadBalancerClient) listWorkRequests(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/workRequests\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response ListWorkRequestsResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\tapiReferenceLink := \"https://docs.oracle.com/iaas/api/#/en/networkloadbalancer/20200501/WorkRequest/ListWorkRequests\"\n\t\terr = common.PostProcessServiceError(err, \"NetworkLoadBalancer\", \"ListWorkRequests\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "title": "" }, { "docid": "e5c768fd9b056d0a18d9107f3898e814", "score": "0.5670505", "text": "func (client NetworkLoadBalancerClient) ListWorkRequests(ctx context.Context, request ListWorkRequestsRequest) (response ListWorkRequestsResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.NoRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\tociResponse, err = common.Retry(ctx, request, client.listWorkRequests, policy)\n\tif err != nil {\n\t\tif ociResponse != nil {\n\t\t\tif httpResponse := ociResponse.HTTPResponse(); httpResponse != nil {\n\t\t\t\topcRequestId := httpResponse.Header.Get(\"opc-request-id\")\n\t\t\t\tresponse = ListWorkRequestsResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = ListWorkRequestsResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(ListWorkRequestsResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into ListWorkRequestsResponse\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "e58d66213a6c1aa4c4f26338c1536a60", "score": "0.5576954", "text": "func (client *PharosClient) WorkItemList(params url.Values) *PharosResponse {\n\t// Set up the response object\n\tresp := NewPharosResponse(PharosWorkItem)\n\tresp.workItems = make([]*models.WorkItem, 0)\n\n\t// Build the url and the request object\n\trelativeUrl := fmt.Sprintf(\"/api/%s/items/?%s\", client.apiVersion, encodeParams(params))\n\tabsoluteUrl := client.BuildUrl(relativeUrl)\n\n\t// Run the request\n\tclient.DoRequest(resp, \"GET\", absoluteUrl, nil)\n\tif resp.Error != nil {\n\t\treturn resp\n\t}\n\n\t// Parse the JSON from the response body.\n\t// If there's an error, it will be recorded in resp.Error\n\tresp.UnmarshalJsonList()\n\treturn resp\n}", "title": "" }, { "docid": "fb26ae181c5895003212325804df63ee", "score": "0.5508889", "text": "func (c *WorkloadService) List(params *WorkloadParams) ([]Workload, *http.Response, error) {\n\toutput := &struct {\n\t\tData []Workload `json:\"data\"`\n\t}{}\n\tresp, err := doList(c.sling, c.endpoint, params, output)\n\treturn output.Data, resp, err\n}", "title": "" }, { "docid": "4dcfef39b908311bfd49b575df9e9293", "score": "0.55057174", "text": "func ParseWorkloadListResponse(rsp *http.Response) (*workloadListResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer rsp.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &workloadListResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 200:\n\t\tvar dest WorkloadList\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON200 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 500:\n\t\tvar dest struct {\n\n\t\t\t// HTTP status code\n\t\t\tCode *int32 `json:\"code,omitempty\"`\n\t\t\tMessage *string `json:\"message,omitempty\"`\n\t\t}\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON500 = &dest\n\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "67b5c401e2370c2428851b49690606b0", "score": "0.54425925", "text": "func WorkersList(c Cmd) {\n\tr, err := HTTPClient.Get(RevealEndpoint(workersListEndpoint, c))\n\tif err != nil {\n\t\traven.CaptureError(err, nil)\n\t\tlog.Fatal(err)\n\t}\n\n\tif r.StatusCode != 200 {\n\t\tfmt.Println(\"No such command\")\n\t\treturn\n\t}\n\n\tdefer r.Body.Close()\n\n\tresp := &WorkersResponse{}\n\terr = json.NewDecoder(r.Body).Decode(resp)\n\tif err != nil {\n\t\traven.CaptureError(err, nil)\n\t\tlog.Fatal(err)\n\t}\n\n\tif resp.Message == \"\" {\n\t\ttable.SetHeader([]string{\"Name\", \"Started at\", \"Working on\"})\n\t\tfor _, w := range resp.List {\n\t\t\ttable.Append(w)\n\t\t}\n\t} else {\n\t\ttable.Append([]string{resp.Message})\n\t}\n\n\ttable.Render()\n}", "title": "" }, { "docid": "8e472053c0f37b8f09304b2ef9a8b90f", "score": "0.5425678", "text": "func (c *ClientWithResponses) WorkloadListWithResponse(ctx context.Context, namespace string) (*workloadListResponse, error) {\n\trsp, err := c.WorkloadList(ctx, namespace)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ParseWorkloadListResponse(rsp)\n}", "title": "" }, { "docid": "40850bd11e9e6222e868be8abe08b4ce", "score": "0.54170007", "text": "func (r *Client) ListWorkload() (objs []*workload.Workload, err error) {\n\n\topts := api.ListWatchOptions{ObjectMeta: api.ObjectMeta{Tenant: globals.DefaultTenant}}\n\n\tfor _, restcl := range r.restcls {\n\t\tobjs, err = restcl.WorkloadV1().Workload().List(r.ctx, &opts)\n\t\tif err == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn objs, err\n}", "title": "" }, { "docid": "bc312df38958305f70e31574003eac5e", "score": "0.5400846", "text": "func (vc *VcenterCfg) ListWorkload() (objs []*workload.Workload, err error) {\n\n\twloads := []*workload.Workload{}\n\tfor _, wl := range vc.Cfg.ConfigItems.Workloads {\n\t\twloads = append(wloads, wl)\n\t}\n\n\treturn wloads, nil\n}", "title": "" }, { "docid": "5bcadfb511bd0288d5583148e423827d", "score": "0.5400427", "text": "func (p *Provider) ListMachines(ctx context.Context, req *driver.ListMachinesRequest) (*driver.ListMachinesResponse, error) {\n\t// Log messages to track start and end of request\n\tklog.V(2).Infof(\"List machines request has been recieved for %q\", req.MachineClass.Name)\n\tdefer klog.V(2).Infof(\"List machines request has been recieved for %q\", req.MachineClass.Name)\n\n\tvar (\n\t\tmachineClass = req.MachineClass\n\t\tsecret = req.Secret\n\t\tfolderID = string(secret.Data[api.YandexFolderID])\n\t)\n\n\tctx, cancelFunc := context.WithTimeout(context.Background(), apiTimeout)\n\tdefer cancelFunc()\n\n\tySDK, err := p.YandexSDK.GetSession(ctx, secret)\n\tif err != nil {\n\t\treturn nil, mcmstatus.Error(mcmcodes.Internal, err.Error())\n\t}\n\n\tlistOfVMs := make(map[string]string)\n\n\tclusterName := \"\"\n\tnodeRole := \"\"\n\n\tfor key := range machineClass.Labels {\n\t\tif strings.Contains(key, \"kubernetes-io-cluster-\") {\n\t\t\tclusterName = key\n\t\t} else if strings.Contains(key, \"kubernetes-io-role-\") {\n\t\t\tnodeRole = key\n\t\t}\n\t}\n\n\tif clusterName == \"\" || nodeRole == \"\" {\n\t\treturn nil, mcmstatus.Error(mcmcodes.InvalidArgument, fmt.Sprintf(`no \"kubernetes-io-cluster\" or \"kubernetes-io-role-\" labels found in the MachineClass %s/%s`,\n\t\t\tmachineClass.Namespace, machineClass.Name))\n\t}\n\n\t// TODO: Replace this abomination with something more Go-like\n\tvar instances []*compute.Instance\n\tinstanceIterator := ySDK.Compute().Instance().InstanceIterator(ctx, folderID)\ninstanceIteration:\n\tfor {\n\t\tnext := instanceIterator.Next()\n\t\tswitch next {\n\t\tcase true:\n\t\t\tinstances = append(instances, instanceIterator.Value())\n\t\tcase false:\n\t\t\tbreak instanceIteration\n\t\t}\n\t}\n\tif instanceIterator.Error() != nil {\n\t\treturn nil, mcmstatus.Error(mcmcodes.Internal, fmt.Sprintf(\"could not list instances for FolderID %q: %s\", folderID, instanceIterator.Error()))\n\t}\n\n\tfor _, instance := range instances {\n\t\tmatchedCluster := false\n\t\tmatchedRole := false\n\t\tfor label := range instance.Labels {\n\t\t\tswitch label {\n\t\t\tcase clusterName:\n\t\t\t\tmatchedCluster = true\n\t\t\tcase nodeRole:\n\t\t\t\tmatchedRole = true\n\t\t\t}\n\t\t}\n\t\tif matchedCluster && matchedRole {\n\t\t\tlistOfVMs[encodeMachineID(instance.ZoneId, instance.Name)] = instance.Name\n\t\t}\n\t}\n\n\treturn &driver.ListMachinesResponse{MachineList: listOfVMs}, nil\n}", "title": "" }, { "docid": "f1a2d3abf2d3802d32aa25c5e2d4ece4", "score": "0.5358473", "text": "func ExampleServiceUnitsClient_List() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclient, err := armdeploymentmanager.NewServiceUnitsClient(\"caac1590-e859-444f-a9e0-62091c0f5929\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tres, err := client.List(ctx,\n\t\t\"myResourceGroup\",\n\t\t\"myTopology\",\n\t\t\"myService\",\n\t\tnil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t// TODO: use response item\n\t_ = res\n}", "title": "" }, { "docid": "bcace1a76b001db37ae6d5f891e4ed59", "score": "0.53581667", "text": "func (sp *spawn) GetUnits() (u *UnitList) {\n\tu = &UnitList{}\n\tt, err := sp.TargetGet(\"units\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\terr = json.Unmarshal(t, u)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "8034a7158909ecf73e552ab80f019cc3", "score": "0.5350203", "text": "func (r *UnitsService) List() *UnitsListCall {\n\tc := &UnitsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\treturn c\n}", "title": "" }, { "docid": "50713f6226437fcbee1193c259f72e02", "score": "0.5342432", "text": "func (b BackendLDAP) ListUnits() (unit.List, error) {\n\tsr, err := b.search(b.baseDN, \"(objectClass=organizationalUnit)\", \"ou\", \"description\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tunits := make([]unit.Unit, len(sr.Entries))\n\tfor idx, entry := range sr.Entries {\n\t\tunits[idx] = unit.NewUnit(\n\t\t\tentry.GetAttributeValue(\"ou\"),\n\t\t\tentry.GetAttributeValue(\"description\"),\n\t\t)\n\t}\n\n\treturn unit.NewList(units), nil\n}", "title": "" }, { "docid": "6b76531d7603609e0ed0f4d230577d13", "score": "0.5296262", "text": "func (m *Mockingbird) ListTests(pageToken string) (*mockingbird.TestResults, error) {\n\treturn m.worker.getTestResults(pageToken)\n}", "title": "" }, { "docid": "5009bcde8dfc1a7090f2d659d7239587", "score": "0.5268777", "text": "func listHandler(w http.ResponseWriter, r *http.Request) {\n\tunits, err := listUnits()\n\tif err != nil {\n\t\thttputils.ReportError(w, r, err, \"Failed to list units.\")\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tif err := json.NewEncoder(w).Encode(units); err != nil {\n\t\tsklog.Errorf(\"Failed to write or encode output: %s\", err)\n\t}\n}", "title": "" }, { "docid": "ef721170d0ce7033e88913f002a30821", "score": "0.5254823", "text": "func (m *MockApiServiceClient) GetWitnessList(ctx context.Context, in *pb.GetWitnessListRequest, opts ...grpc.CallOption) (*pb.GetWitnessListResponse, error) {\n\tvarargs := []interface{}{ctx, in}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"GetWitnessList\", varargs...)\n\tret0, _ := ret[0].(*pb.GetWitnessListResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "5d8210aa178ffd0ea16ffd1d1056d976", "score": "0.5221334", "text": "func (p *SchedulingPolicyUnitsService) List() *SchedulingPolicyUnitsServiceListRequest {\n\treturn &SchedulingPolicyUnitsServiceListRequest{SchedulingPolicyUnitsService: p}\n}", "title": "" }, { "docid": "2244f6fe289899280f7b0287dc6dc783", "score": "0.5192976", "text": "func listUnitsByPatternWrapper(ctx context.Context, conn *dbus.Conn, states, patterns []string) ([]dbus.UnitStatus, error) {\n\treturn conn.ListUnitsByPatternsContext(ctx, states, patterns)\n}", "title": "" }, { "docid": "c86e621c46546e90be872981aea062a7", "score": "0.5192699", "text": "func (m *MockMeshWorkloadSet) List() []*v1alpha1.MeshWorkload {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"List\")\n\tret0, _ := ret[0].([]*v1alpha1.MeshWorkload)\n\treturn ret0\n}", "title": "" }, { "docid": "6b81618446c78b58f76fe9173fb6365e", "score": "0.51628816", "text": "func TestDelWorkUnitsByState2(t *testing.T) {\n\tj := setUpTest(t, \"TestDelWorkUnitsByState2\")\n\tdefer tearDownTest(t, j)\n\n\tfor _, state := range allStates {\n\t\tworkSpecName, expected := prepareSomeOfEach(t, j, 2)\n\t\tdelete(expected, stateShortName[state])\n\t\tdelete(expected, stateShortName2[state])\n\n\t\tcount, msg, err := j.DelWorkUnits(workSpecName, map[string]interface{}{\"state\": state})\n\t\tif assert.NoError(t, err) {\n\t\t\tassert.Equal(t, 2, count)\n\t\t\tassert.Empty(t, msg)\n\t\t}\n\t\tlistWorkUnits(t, j, workSpecName, gwuEverything, expected)\n\n\t\t_, err = j.Clear()\n\t\tassert.NoError(t, err)\n\t}\n}", "title": "" }, { "docid": "46a5dd6ea252f9343baa2b0201ca7636", "score": "0.5160165", "text": "func (c *Client) ListWorkloads(projectID string) (output *v1payload.ListWorkloadsOutput, err error) {\n\toutput = &v1payload.ListWorkloadsOutput{}\n\tinput := &v1payload.ListWorkloadsInput{\n\t\tProjectID: projectID,\n\t}\n\n\treturn output, c.doRequest(http.MethodGet, createPath(projectID, workloadsEndpoint), input, output)\n}", "title": "" }, { "docid": "aae045da343f1dac91527f15d1315956", "score": "0.5157207", "text": "func ListUW(o *ListUWOptions) {\n\tconn, err := apiclient.Dial()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer conn.Close()\n\n\tstartTimeTimestamp, err := ptypes.TimestampProto(o.StartTime.UTC())\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tendTimeTimestamp, err := ptypes.TimestampProto(o.EndTime.UTC())\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tclient := groundstation.NewGroundStationServiceClient(conn)\n\trequest := &groundstation.ListUnavailabilityWindowsRequest{\n\t\tGroundStationId: o.ID,\n\t\tStartTime: startTimeTimestamp,\n\t\tEndTime: endTimeTimestamp,\n\t}\n\n\tresult, err := client.ListUnavailabilityWindows(context.Background(), request)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tdefer o.Printer.Flush()\n\to.Printer.Write(headers)\n\n\tfor _, window := range result.Window {\n\t\tstartTime, err := ptypes.Timestamp(window.StartTime)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tendTime, err := ptypes.Timestamp(window.EndTime)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\trecord := []interface{}{\n\t\t\twindow.WindowId,\n\t\t\tstartTime,\n\t\t\tendTime,\n\t\t}\n\n\t\to.Printer.Write(record)\n\t}\n}", "title": "" }, { "docid": "de00aeea23f73c828af6a438ef1607d4", "score": "0.5149641", "text": "func (m *MockConfigLister) ListWorkloads(appName string) ([]*config.Workload, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListWorkloads\", appName)\n\tret0, _ := ret[0].([]*config.Workload)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "677144d85d38eba529abac8e3ba83fb9", "score": "0.51475346", "text": "func (m *MockConfigWorkloadLister) ListWorkloads(appName string) ([]*config.Workload, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListWorkloads\", appName)\n\tret0, _ := ret[0].([]*config.Workload)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "33388cf9a1a1408109bc501dd319ee52", "score": "0.5146578", "text": "func checkWorkUnitStatus(t *testing.T, j *jobserver.JobServer, workSpecName, workUnitKey string, status jobserver.WorkUnitStatus) {\n\tdicts, msg, err := j.GetWorkUnitStatus(workSpecName, []string{workUnitKey})\n\tif assert.NoError(t, err) {\n\t\tassert.Empty(t, msg)\n\t\tif assert.Len(t, dicts, 1) {\n\t\t\tassert.Equal(t, status, dicts[0][\"status\"])\n\t\t}\n\t}\n}", "title": "" }, { "docid": "628b5b77888a1111a92e3edeaf7a9e60", "score": "0.51456565", "text": "func (e *API) ListSuiteCheckRuns(CheckSuiteID int, CheckName string, Status string, Filter string) (response.CheckRuns, error) {\n\n\tvar checkRuns response.CheckRuns\n\n\tclient := &http.Client{}\n\n\tu, err := url.Parse(fmt.Sprintf(\"%s/repos/%s/%s/check-suites/%d/check-runs\", GithubURL, e.Author, e.Repository, CheckSuiteID))\n\n\tif err != nil {\n\t\treturn checkRuns, err\n\t}\n\n\tq := u.Query()\n\tif CheckName != \"\" {\n\t\tq.Set(\"check_name\", CheckName)\n\t}\n\tif Status != \"\" {\n\t\tq.Set(\"status\", Status)\n\t}\n\tif Filter != \"\" {\n\t\tq.Set(\"filter\", Filter)\n\t}\n\tu.RawQuery = q.Encode()\n\n\treq, err := http.NewRequest(\n\t\t\"GET\",\n\t\tu.String(),\n\t\tnil,\n\t)\n\n\tif err != nil {\n\t\treturn checkRuns, err\n\t}\n\n\treq.Header.Add(\"Authorization\", fmt.Sprintf(\"token %s\", e.Token))\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Accept\", \"application/vnd.github.antiope-preview+json\")\n\n\tresp, err := client.Do(req)\n\n\tif err != nil {\n\t\treturn checkRuns, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tbodyByte, err := ioutil.ReadAll(resp.Body)\n\n\tif err != nil {\n\t\treturn checkRuns, err\n\t}\n\n\tif resp.StatusCode == 401 {\n\t\treturn checkRuns, fmt.Errorf(\"Oops: %s\", string(bodyByte))\n\t}\n\n\tok, _ := checkRuns.LoadFromJSON(bodyByte)\n\n\tif ok && resp.StatusCode == 200 {\n\t\treturn checkRuns, nil\n\t}\n\treturn checkRuns, fmt.Errorf(\"Error: %s\", string(bodyByte))\n}", "title": "" }, { "docid": "b2b84aad72f716eb362985d185d9e09f", "score": "0.51407653", "text": "func (_m *Store) ListWorkloads(ctx context.Context, appname string, entrypoint string, nodename string, limit int64, labels map[string]string) ([]*types.Workload, error) {\n\tret := _m.Called(ctx, appname, entrypoint, nodename, limit, labels)\n\n\tvar r0 []*types.Workload\n\tif rf, ok := ret.Get(0).(func(context.Context, string, string, string, int64, map[string]string) []*types.Workload); ok {\n\t\tr0 = rf(ctx, appname, entrypoint, nodename, limit, labels)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]*types.Workload)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, string, string, string, int64, map[string]string) error); ok {\n\t\tr1 = rf(ctx, appname, entrypoint, nodename, limit, labels)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "850b9d15853884adba9b5981eb09a4f6", "score": "0.51268816", "text": "func TestGetChildUnitsMulti(t *testing.T) {\n\tj := setUpTest(t, \"TestGetChildUnitsMulti\")\n\tdefer tearDownTest(t, j)\n\n\tworkSpecName := setWorkSpec(t, j, WorkSpecData)\n\taddWorkUnit(t, j, workSpecName, \"a\", map[string]interface{}{\"k\": \"v\"})\n\taddWorkUnit(t, j, workSpecName, \"b\", map[string]interface{}{\"k\": \"v\"})\n\n\t// register parent worker\n\tok, msg, err := j.WorkerHeartbeat(\"parent\", \"run\", 6000, nil, \"\")\n\tif assert.NoError(t, err) {\n\t\tassert.True(t, ok)\n\t\tassert.Empty(t, msg)\n\t}\n\n\t// register child worker\n\tok, msg, err = j.WorkerHeartbeat(\"child\", \"run\", 6000, nil, \"parent\")\n\tif assert.NoError(t, err) {\n\t\tassert.True(t, ok)\n\t\tassert.Empty(t, msg)\n\t}\n\n\t// right now there should be no child units\n\tcheckChildWorkUnits(t, j, \"parent\", \"child\", workSpecName, noWorkUnits)\n\n\t// get the work units\n\tanything, msg, err := j.GetWork(\"child\", map[string]interface{}{\"available_gb\": 1, \"max_jobs\": 10})\n\tif assert.NoError(t, err) {\n\t\tassert.Empty(t, msg)\n\t\tif assert.NotNil(t, anything) && assert.IsType(t, []cborrpc.PythonTuple{}, anything) {\n\t\t\tlist := anything.([]cborrpc.PythonTuple)\n\t\t\tassert.Len(t, list, 2)\n\t\t\tfor i, tuple := range list {\n\t\t\t\tif assert.Len(t, tuple.Items, 3) {\n\t\t\t\t\tassert.Equal(t, workSpecName, tuple.Items[0])\n\t\t\t\t\tif i == 0 {\n\t\t\t\t\t\tassert.Equal(t, []byte(\"a\"), tuple.Items[1])\n\t\t\t\t\t} else {\n\t\t\t\t\t\tassert.Equal(t, []byte(\"b\"), tuple.Items[1])\n\t\t\t\t\t}\n\t\t\t\t\tassert.Equal(t, map[string]interface{}{\"k\": \"v\"}, tuple.Items[2])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// both should be reported as child units\n\tcheckChildWorkUnits(t, j, \"parent\", \"child\", workSpecName, map[string]map[string]interface{}{\"a\": {\"k\": \"v\"}, \"b\": {\"k\": \"v\"}})\n\n\t// finish \"a\"\n\tfinishWorkUnit(t, j, workSpecName, \"a\", nil)\n\n\t// we should have \"b\" left\n\tcheckChildWorkUnits(t, j, \"parent\", \"child\", workSpecName, map[string]map[string]interface{}{\"b\": {\"k\": \"v\"}})\n\n\t// now finish b\n\tfinishWorkUnit(t, j, workSpecName, \"b\", nil)\n\n\t// there should be no work units left now\n\tcheckChildWorkUnits(t, j, \"parent\", \"child\", workSpecName, noWorkUnits)\n}", "title": "" }, { "docid": "37e7fe3a579d114e2571ccf459aeb39a", "score": "0.51172453", "text": "func (m *MockApiServiceServer) GetWitnessList(arg0 context.Context, arg1 *pb.GetWitnessListRequest) (*pb.GetWitnessListResponse, error) {\n\tret := m.ctrl.Call(m, \"GetWitnessList\", arg0, arg1)\n\tret0, _ := ret[0].(*pb.GetWitnessListResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "c7190432441fd4ec3d4131e2c1779f22", "score": "0.5093779", "text": "func TestList(t *testing.T) {\n\tregistry := generateTestRegistry(5, 5)\n\tfor i, service := range registry.Services {\n\t\tif i%5 == 0 {\n\t\t\tservice.Added = service.Added.Add(-13 * time.Hour)\n\t\t\tregistry.Services[i] = service\n\t\t}\n\t}\n\ttable := []struct {\n\t\tname string\n\t\texpectedLen int\n\t}{\n\t\t{name: \"service1\", expectedLen: 5},\n\t\t{name: \"invalid\", expectedLen: 0},\n\t\t{name: \"\", expectedLen: 25},\n\t}\n\tfor _, row := range table {\n\t\tservices := registry.List(row.name)\n\t\tif length := len(services); length != row.expectedLen {\n\t\t\tt.Fatalf(\"expected: %d, got: %d; %v\", row.expectedLen, length,\n\t\t\t\trow)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "dc9bf5a8bcc0033a83328c8774e586ee", "score": "0.5093246", "text": "func (c *Client) GetWorkouts(startdate, enddate string, lastupdate int, offset int, wtype ...WorkoutType) (*Workouts, error) {\n\tif len(wtype) == 0 {\n\t\treturn nil, errors.Errorf(\"Need least one param as WorkoutType.\")\n\t}\n\tworkouts := new(Workouts)\n\n\tdf, err := createDataFields(wtype)\n\n\tvar fp []FormParam = []FormParam{\n\t\t{PPaction, WorkoutsA},\n\t\t{PPoffset, fmt.Sprintf(\"%d\", offset)},\n\t\t{PPdataFields, df},\n\t}\n\n\tif startdate == \"\" || enddate == \"\" {\n\t\tfp = append(fp, FormParam{PPlastupdate, fmt.Sprintf(\"%d\", lastupdate)})\n\t} else {\n\t\tfp = append(fp, FormParam{PPstartdateymd, startdate}, FormParam{PPenddateymd, enddate})\n\t}\n\n\terr = reqAndParse(c, fp, c.MeasureURLv2, http.MethodPost, workouts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn workouts, nil\n}", "title": "" }, { "docid": "99605d2feabf09c88530f845e41e3aaa", "score": "0.5080612", "text": "func TestGetWorkloads(t *testing.T) {\n\tctx, cancelFunc := context.WithTimeout(context.Background(), standardTimeout)\n\t_, err := bat.GetAllWorkloads(ctx, \"\")\n\tcancelFunc()\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to retrieve workload list : %v\", err)\n\t}\n}", "title": "" }, { "docid": "6c852a0a12978ee64bf4349a866a10a4", "score": "0.5076864", "text": "func TestGetMany(t *testing.T) {\n\tj := setUpTest(t, \"TestGetMany\")\n\tdefer tearDownTest(t, j)\n\n\tworkSpecName := setWorkSpec(t, j, WorkSpecData)\n\taddPrefixedWorkUnits(t, j, workSpecName, \"u\", 100)\n\n\tanything, msg, err := j.GetWork(\"test\", map[string]interface{}{\"available_gb\": 1, \"lease_time\": 300, \"max_jobs\": 10})\n\tif assert.Nil(t, err) {\n\t\tassert.Empty(t, msg)\n\t\texpected := expectPrefixedWorkUnits(workSpecName, \"u\", 10)\n\t\tassert.Equal(t, expected, anything)\n\t}\n}", "title": "" }, { "docid": "669efda1385494ad0b7bfb95e2f6a484", "score": "0.5052754", "text": "func (m *MockLicense) ListMetricUCS(arg0 context.Context, arg1 ...string) ([]*v1.MetricUCS, 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, \"ListMetricUCS\", varargs...)\n\tret0, _ := ret[0].([]*v1.MetricUCS)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "2785ebde06c16e462fd153afca38961c", "score": "0.50525683", "text": "func (m *MockMachines) List(arg0 context.Context, arg1 maasclient.Params) ([]maasclient.Machine, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"List\", arg0, arg1)\n\tret0, _ := ret[0].([]maasclient.Machine)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "5f908ed99be60dc8c8995cdfba2dbb65", "score": "0.5043687", "text": "func (m *DeploymentsClientMock) List(ctx context.Context, resourceGroupName, filter string, top *int32) (result []resources.DeploymentExtended, err error) {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\n\tresult = make([]resources.DeploymentExtended, 0)\n\tfor i := range m.FakeStore {\n\t\tresult = append(result, m.FakeStore[i])\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "a683e263fe0faf1c8990f55e4dbbff07", "score": "0.50400406", "text": "func (s *k8sScheduler) List() ([]scheduler.Unit, error) {\n\tvar units []scheduler.Unit\n\tif list, err := s.listDeployments(); err != nil {\n\t\treturn nil, maskAny(err)\n\t} else {\n\t\tunits = append(units, list...)\n\t}\n\tif list, err := s.listDaemonSets(); err != nil {\n\t\treturn nil, maskAny(err)\n\t} else {\n\t\tunits = append(units, list...)\n\t}\n\tif list, err := s.listJobs(); err != nil {\n\t\treturn nil, maskAny(err)\n\t} else {\n\t\tunits = append(units, list...)\n\t}\n\tif list, err := s.listServices(); err != nil {\n\t\treturn nil, maskAny(err)\n\t} else {\n\t\tunits = append(units, list...)\n\t}\n\tif list, err := s.listSecrets(); err != nil {\n\t\treturn nil, maskAny(err)\n\t} else {\n\t\tunits = append(units, list...)\n\t}\n\tif list, err := s.listIngresses(); err != nil {\n\t\treturn nil, maskAny(err)\n\t} else {\n\t\tunits = append(units, list...)\n\t}\n\t// TODO load other resources\n\treturn units, nil\n}", "title": "" }, { "docid": "425b944d24bff37c1932aba7a920c5bc", "score": "0.5039133", "text": "func addWorkUnits(t *testing.T, j *jobserver.JobServer, workSpecName string, workUnits map[string]map[string]interface{}) {\n\t// Assemble the parameters to AddWorkUnits as one big list of\n\t// pairs of (key, data)\n\tvar awu []interface{}\n\tfor name, data := range workUnits {\n\t\tpair := []interface{}{name, data}\n\t\tawu = append(awu, pair)\n\t}\n\tok, msg, err := j.AddWorkUnits(workSpecName, awu)\n\tif assert.NoError(t, err) {\n\t\tassert.True(t, ok)\n\t\tassert.Empty(t, msg)\n\t}\n}", "title": "" }, { "docid": "90098db9ca28a8d7ee34c3b85e019200", "score": "0.502934", "text": "func verifyWorks(works []WorkInfo, d time.Duration) {\n\tif d <= time.Duration(0) {\n\t\tfor i := range works {\n\t\t\tif works[i].MaxOps <= 0 {\n\t\t\t\tlog.Fatal(\"Have a benchmark time <= 0, \", d, \", but work \", i, \" has MaxOps <= 0, \", works[i].MaxOps, \". It should be > 0\")\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor i := range works {\n\t\t\tif works[i].MaxOps > 0 {\n\t\t\t\tlog.Fatal(\"Have a benchmark time > 0, \", d, \", but work \", i, \" has MaxOps > 0, \", works[i].MaxOps, \". It should be <= 0\")\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a21f8b244bf00b5d0b75805b044a9d37", "score": "0.50153005", "text": "func ListWorkspace(ctx context.Context, TfeOrg string, Tfclient *tfe.Client) {\n\n\ttype saveWs struct {\n\t\tWsName string\n\t\tWsID string\n\t}\n\n\tWsList := make([]saveWs, 0)\n\n\twl, err := Tfclient.Workspaces.List(ctx, TfeOrg, tfe.WorkspaceListOptions{})\n\tif err != nil {\n\t\tklog.Fatal(err)\n\t}\n\n\tfor _, ws := range wl.Items {\n\t\tWsList = append(WsList, saveWs{WsName: ws.Name, WsID: ws.ID})\n\t}\n\n\ttable := uitable.New()\n\ttable.MaxColWidth = 80\n\ttable.Wrap = true\n\ttable.Separator = \"|\"\n\n\ttable.AddRow(\"\", \"---------------------\", \"----------------------\", \"\")\n\ttable.AddRow(\"\", \"Workspace Name\", \"Workspace ID\", \"\")\n\ttable.AddRow(\"\", \"---------------------\", \"----------------------\", \"\")\n\tfor _, WsList := range WsList {\n\t\ttable.AddRow(\"\", WsList.WsName, WsList.WsID, \"\")\n\t}\n\ttable.AddRow(\"\", \"---------------------\", \"----------------------\", \"\")\n\tfmt.Println(table)\n}", "title": "" }, { "docid": "d2593dfcff324c19c4ad6a986bd4b7da", "score": "0.50069743", "text": "func (s *SystemdUnits) GetUnits(tools dcos.Tooler) (allUnits []HealthResponseValues, err error) {\n\treturn nil, errors.New(\"does not work on darwin\")\n}", "title": "" }, { "docid": "3792ca93efdd4c74516a9da9c3cc9eb8", "score": "0.50036585", "text": "func getWorkloads(w http.ResponseWriter, r *http.Request) {\n\n\t// handle token\n\ttmp := r.Header.Get(\"Authorization\")\n\tif strings.Fields(tmp)[0] != \"Bearer\" {\n\t\tw.WriteHeader(400)\n\t\treturnMsg(w, \"bad request, check headers \"+\n\t\t\t\"you must send a Bearer token\")\n\t\treturn\n\t}\n\ttoken := strings.Fields(tmp)[1] // get the token from header\n\t_, _, exists := searchToken(token)\n\tif !exists {\n\t\tw.WriteHeader(400)\n\t\treturnMsg(w, \"token not found, \"+\n\t\t\t\"please provide a valid one\")\n\t\treturn\n\t}\n\n\t// read path params\n\tvars := mux.Vars(r)\n\tid := vars[\"workload_id\"]\n\tif id == \"\" {\n\t\tw.WriteHeader(400)\n\t\treturnMsg(w, \"id missing, \"+\n\t\t\t\"you should do smthg like workloads/{workload_id}\")\n\t\treturn\n\t}\n\tfmt.Println(\"[INFO]: GET /workloads/\" + id + \" requested\")\n\n\tintId, err := strconv.ParseUint(id, 10, 64)\n\tif err != nil {\n\t\tw.WriteHeader(400)\n\t\treturnMsg(w, \"you didnt send a valid number, \"+\n\t\t\t\"please check again\")\n\t\treturn\n\n\t}\n\n\tif intId >= workloadsIds || workloadsIds == 0 {\n\t\tw.WriteHeader(400)\n\t\treturnMsg(w, \"that id doesnt exists, \"+\n\t\t\t\"please check again\")\n\t\treturn\n\n\t}\n\n\tjson.NewEncoder(w).Encode(Workloads[intId])\n}", "title": "" }, { "docid": "c614525f8138f1b829e2b96dca18c3d9", "score": "0.4998457", "text": "func (m *MockAPI) ListCheckRuns(arg0, arg1 string, arg2 int64) ([]*github.CheckRun, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListCheckRuns\", arg0, arg1, arg2)\n\tret0, _ := ret[0].([]*github.CheckRun)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "033e41e5957f18d8008c136f3d4f1ad9", "score": "0.49637026", "text": "func (m *mockWalletController) ListUnspentWitness(minconfirms,\n\tmaxconfirms int32) ([]*lnwallet.Utxo, error) {\n\n\t// If the mock already has a list of utxos, return it.\n\tif m.utxos != nil {\n\t\treturn m.utxos, nil\n\t}\n\n\t// Otherwise create one to return.\n\tutxo := &lnwallet.Utxo{\n\t\tAddressType: lnwallet.WitnessPubKey,\n\t\tValue: btcutil.Amount(10 * btcutil.SatoshiPerBitcoin),\n\t\tPkScript: coinPkScript,\n\t\tOutPoint: wire.OutPoint{\n\t\t\tHash: chainhash.Hash{},\n\t\t\tIndex: m.index,\n\t\t},\n\t}\n\tatomic.AddUint32(&m.index, 1)\n\tvar ret []*lnwallet.Utxo\n\tret = append(ret, utxo)\n\treturn ret, nil\n}", "title": "" }, { "docid": "8809856cd456b878d67cefe8487fcc1f", "score": "0.49620894", "text": "func (m *MockClient) ListClosedWorkflowExecutions(\n\tctx context.Context,\n\t_ListRequest *shared.ListClosedWorkflowExecutionsRequest,\n\topts ...yarpc.CallOption,\n) (success *shared.ListClosedWorkflowExecutionsResponse, err error) {\n\n\targs := []interface{}{ctx, _ListRequest}\n\tfor _, o := range opts {\n\t\targs = append(args, o)\n\t}\n\ti := 0\n\tret := m.ctrl.Call(m, \"ListClosedWorkflowExecutions\", args...)\n\tsuccess, _ = ret[i].(*shared.ListClosedWorkflowExecutionsResponse)\n\ti++\n\terr, _ = ret[i].(error)\n\treturn\n}", "title": "" }, { "docid": "fd9f252c7c89ba6bbbf11ca1d5a4f356", "score": "0.49591836", "text": "func DecodeGrpcRespWorkloadList(ctx context.Context, response interface{}) (interface{}, error) {\n\treturn response, nil\n}", "title": "" }, { "docid": "218ae693c2e6af4a4761ed3769108ebb", "score": "0.49379927", "text": "func (client NetworkLoadBalancerClient) ListWorkRequestLogs(ctx context.Context, request ListWorkRequestLogsRequest) (response ListWorkRequestLogsResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.NoRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\tociResponse, err = common.Retry(ctx, request, client.listWorkRequestLogs, policy)\n\tif err != nil {\n\t\tif ociResponse != nil {\n\t\t\tif httpResponse := ociResponse.HTTPResponse(); httpResponse != nil {\n\t\t\t\topcRequestId := httpResponse.Header.Get(\"opc-request-id\")\n\t\t\t\tresponse = ListWorkRequestLogsResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = ListWorkRequestLogsResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(ListWorkRequestLogsResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into ListWorkRequestLogsResponse\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "46d2baa1c333a015b7897abeaf8d0f2a", "score": "0.49360934", "text": "func TestGetMatchList(t *testing.T) {\n\tvar mls [4]dto.MatchListDTO\n\tvar sis [3]dto.SummonerInput\n\n\tsis[0] = dto.SummonerInput{SummonerName: \"IAmTheWhite\"}\n\tsis[1] = dto.SummonerInput{SummonerID: 69658457}\n\tsis[2] = dto.SummonerInput{AccountID: 219406964}\n\n\twg.Add(4)\n\tfor i := range sis {\n\t\tgo func(i int) {\n\t\t\tdefer wg.Done()\n\t\t\tmls[i] = GetMatchList(wrapper, sis[i], false)\n\t\t}(i)\n\t}\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tmls[3] = GetMatchList(wrapper, sis[2], true)\n\t}()\n\twg.Wait()\n\n\tfor i, ml := range mls {\n\t\tif len(ml.Matches) < 0 {\n\t\t\tt.Errorf(\"Not the correct matchlist data received from matchlist %d\", i)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b36cbcbe71fce1d066e076c75acce3c0", "score": "0.49316898", "text": "func (m *MockClient) ListWorkflowExecutions(\n\tctx context.Context,\n\t_ListRequest *shared.ListWorkflowExecutionsRequest,\n\topts ...yarpc.CallOption,\n) (success *shared.ListWorkflowExecutionsResponse, err error) {\n\n\targs := []interface{}{ctx, _ListRequest}\n\tfor _, o := range opts {\n\t\targs = append(args, o)\n\t}\n\ti := 0\n\tret := m.ctrl.Call(m, \"ListWorkflowExecutions\", args...)\n\tsuccess, _ = ret[i].(*shared.ListWorkflowExecutionsResponse)\n\ti++\n\terr, _ = ret[i].(error)\n\treturn\n}", "title": "" }, { "docid": "28bd14b87ee8c375f567bddae8c49f9a", "score": "0.49234298", "text": "func TestDelWorkUnitsByState(t *testing.T) {\n\tj := setUpTest(t, \"TestDelWorkUnitsByState\")\n\tdefer tearDownTest(t, j)\n\n\toptions := func(state jobserver.WorkUnitStatus) map[string]interface{} {\n\t\treturn map[string]interface{}{\n\t\t\t\"state\": state,\n\t\t}\n\t}\n\tallDelWorkUnitsBy(t, j, 1, options)\n}", "title": "" }, { "docid": "b6d4eaa8fab7d84d14d6a3bb3ba8f9e8", "score": "0.4909035", "text": "func EncodeGrpcRespWorkloadList(ctx context.Context, response interface{}) (interface{}, error) {\n\treturn response, nil\n}", "title": "" }, { "docid": "7ea06d0010db2def14a66a56c73c6ee5", "score": "0.49011022", "text": "func delWorkUnitsBy(t *testing.T, j *jobserver.JobServer, n int, state jobserver.WorkUnitStatus, options func(jobserver.WorkUnitStatus) map[string]interface{}) {\n\tworkSpecName, expected := prepareSomeOfEach(t, j, n)\n\tdelete(expected, stateShortName[state])\n\n\tcount, msg, err := j.DelWorkUnits(workSpecName, options(state))\n\tif assert.NoError(t, err) {\n\t\tassert.Equal(t, 1, count)\n\t\tassert.Empty(t, msg)\n\t}\n\tlistWorkUnits(t, j, workSpecName, gwuEverything, expected)\n\n\t_, err = j.Clear()\n\tassert.NoError(t, err)\n}", "title": "" }, { "docid": "736dfeac9e909732166d406803553b70", "score": "0.4899318", "text": "func (n *TestNode) GetWorkloads(name string) []*iota.Workload {\n\tmsg := []*iota.Workload{}\n\tn.workloadMap.Range(func(key interface{}, item interface{}) bool {\n\t\twload, ok := item.(iotaWorkload)\n\t\tif ok && wload.workloadMsg != nil {\n\t\t\tmsg = append(msg, wload.workloadMsg)\n\t\t}\n\t\treturn true\n\t})\n\n\treturn msg\n}", "title": "" }, { "docid": "b411c7e80f12a390993e278bc2118e5b", "score": "0.48888862", "text": "func (t *SimpleChaincode) getworksByRange(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\n\tif len(args) < 2 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting 2\")\n\t}\n\n\tstartKey := args[0]\n\tendKey := args[1]\n\n\tresultsIterator, err := stub.GetStateByRange(startKey, endKey)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\tdefer resultsIterator.Close()\n\n\t// buffer is a JSON array containing QueryResults\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(\"[\")\n\n\tbArrayMemberAlreadyWritten := false\n\tfor resultsIterator.HasNext() {\n\t\tqueryResponse, err := resultsIterator.Next()\n\t\tif err != nil {\n\t\t\treturn shim.Error(err.Error())\n\t\t}\n\t\t// Add a comma before array members, suppress it for the first array member\n\t\tif bArrayMemberAlreadyWritten == true {\n\t\t\tbuffer.WriteString(\",\")\n\t\t}\n\t\tbuffer.WriteString(\"{\\\"Key\\\":\")\n\t\tbuffer.WriteString(\"\\\"\")\n\t\tbuffer.WriteString(queryResponse.Key)\n\t\tbuffer.WriteString(\"\\\"\")\n\n\t\tbuffer.WriteString(\", \\\"Record\\\":\")\n\t\t// Record is a JSON object, so we write as-is\n\t\tbuffer.WriteString(string(queryResponse.Value))\n\t\tbuffer.WriteString(\"}\")\n\t\tbArrayMemberAlreadyWritten = true\n\t}\n\tbuffer.WriteString(\"]\")\n\n\tfmt.Printf(\"- getworksByRange queryResult:\\n%s\\n\", buffer.String())\n\n\treturn shim.Success(buffer.Bytes())\n}", "title": "" }, { "docid": "64b3b995cc29a9da751538fb4d3577f8", "score": "0.48867485", "text": "func (bq *InMemoryBuildQueue) ListWorkers(ctx context.Context, request *buildqueuestate.ListWorkersRequest) (*buildqueuestate.ListWorkersResponse, error) {\n\tplatformKey, err := newPlatformKeyFromName(request.PlatformQueueName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar startAfterWorkerKey *string\n\tif startAfter := request.StartAfter; startAfter != nil {\n\t\tworkerKey := string(newWorkerKey(startAfter.WorkerId))\n\t\tstartAfterWorkerKey = &workerKey\n\t}\n\n\tbq.enter(bq.clock.Now())\n\tdefer bq.leave()\n\n\tpq, ok := bq.platformQueues[platformKey]\n\tif !ok {\n\t\treturn nil, status.Error(codes.NotFound, \"No workers for this instance name and platform exist\")\n\t}\n\n\t// Obtain IDs of all workers in sorted order.\n\tvar keyList []string\n\tfor workerKey, w := range pq.workers {\n\t\tif !request.JustExecutingWorkers || w.getCurrentTask() != nil {\n\t\t\tkeyList = append(keyList, string(workerKey))\n\t\t}\n\t}\n\tsort.Strings(keyList)\n\tpaginationInfo, endIndex := getPaginationInfo(len(keyList), request.PageSize, func(i int) bool {\n\t\treturn startAfterWorkerKey == nil || keyList[i] > *startAfterWorkerKey\n\t})\n\n\t// Extract status.\n\tkeyListRegion := keyList[paginationInfo.StartIndex:endIndex]\n\tworkers := make([]*buildqueuestate.WorkerState, 0, len(keyListRegion))\n\tfor _, key := range keyListRegion {\n\t\tworkerKey := workerKey(key)\n\t\tw := pq.workers[workerKey]\n\t\tvar currentOperation *buildqueuestate.OperationState\n\t\tif t := w.getCurrentTask(); t != nil {\n\t\t\t// A task may have more than one operation\n\t\t\t// associated with it, in case deduplication of\n\t\t\t// in-flight requests occurred. For the time\n\t\t\t// being, let's not expose the concept of tasks\n\t\t\t// through the web UI yet. Just show one of the\n\t\t\t// operations.\n\t\t\t//\n\t\t\t// Do make this deterministic by picking the\n\t\t\t// operation with the lowest name,\n\t\t\t// alphabetically.\n\t\t\tvar o *operation\n\t\t\tfor _, oCheck := range t.operations {\n\t\t\t\tif o == nil || o.name > oCheck.name {\n\t\t\t\t\to = oCheck\n\t\t\t\t}\n\t\t\t}\n\t\t\tcurrentOperation = o.getOperationState(bq)\n\t\t\tcurrentOperation.PlatformQueueName = nil\n\t\t}\n\t\tworkerID := workerKey.getWorkerID()\n\t\tworkers = append(workers, &buildqueuestate.WorkerState{\n\t\t\tId: workerID,\n\t\t\tTimeout: bq.cleanupQueue.getTimestamp(w.cleanupKey),\n\t\t\tCurrentOperation: currentOperation,\n\t\t\tDrained: w.isDrained(pq, workerID),\n\t\t})\n\t}\n\treturn &buildqueuestate.ListWorkersResponse{\n\t\tWorkers: workers,\n\t\tPaginationInfo: paginationInfo,\n\t}, nil\n}", "title": "" }, { "docid": "1150924b6768b7003d525a5c9d250d91", "score": "0.48702434", "text": "func (m *MockWasmDeploymentClient) ListWasmDeployment(ctx context.Context, opts ...client.ListOption) (*v1beta1.WasmDeploymentList, 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, \"ListWasmDeployment\", varargs...)\n\tret0, _ := ret[0].(*v1beta1.WasmDeploymentList)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "1150924b6768b7003d525a5c9d250d91", "score": "0.48702434", "text": "func (m *MockWasmDeploymentClient) ListWasmDeployment(ctx context.Context, opts ...client.ListOption) (*v1beta1.WasmDeploymentList, 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, \"ListWasmDeployment\", varargs...)\n\tret0, _ := ret[0].(*v1beta1.WasmDeploymentList)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "7647e82e6112ffbc5b0e06d4b4820fc1", "score": "0.4868666", "text": "func (client NetworkLoadBalancerClient) listWorkRequestLogs(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/workRequests/{workRequestId}/logs\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response ListWorkRequestLogsResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\tapiReferenceLink := \"https://docs.oracle.com/iaas/api/#/en/networkloadbalancer/20200501/WorkRequestLogEntry/ListWorkRequestLogs\"\n\t\terr = common.PostProcessServiceError(err, \"NetworkLoadBalancer\", \"ListWorkRequestLogs\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "title": "" }, { "docid": "e2e5b4daccb3543a3a847e5cff061390", "score": "0.48574364", "text": "func (c *Client) ListMaintenanceWindows(o ListMaintenanceWindowsOptions) (*ListMaintenanceWindowsResponse, error) {\n\tv, err := query.Values(o)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := c.get(\"/maintenance_windows?\" + v.Encode())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar result ListMaintenanceWindowsResponse\n\treturn &result, c.decodeJSON(resp, &result)\n}", "title": "" }, { "docid": "4e3687e25f931e024d751eb2ac9ce62b", "score": "0.4850784", "text": "func TestWorkUnitValue(t *testing.T) {\n\tj := setUpTest(t, \"TestWorkUnitValue\")\n\tdefer tearDownTest(t, j)\n\n\taUUID, err := uuid.FromString(\"01234567-89ab-4def-8123-456789abcdef\")\n\tif !assert.NoError(t, err) {\n\t\treturn\n\t}\n\tworkUnits := map[string]map[string]interface{}{\n\t\t\"k\": {\n\t\t\t\"list\": []interface{}{1, 2, 3},\n\t\t\t\"tuple\": cborrpc.PythonTuple{Items: []interface{}{4, 5, 6}},\n\t\t\t\"mixed\": []interface{}{1, cborrpc.PythonTuple{Items: []interface{}{2, []interface{}{3, 4}}}},\n\t\t\t\"uuid\": aUUID,\n\t\t\t\"str\": []byte(\"foo\"),\n\t\t\t\"unicode\": \"foo\",\n\t\t\t\"unicode2\": \"fü\",\n\t\t},\n\t}\n\tworkSpecName := setWorkSpec(t, j, WorkSpecData)\n\taddWorkUnits(t, j, workSpecName, workUnits)\n\tlistWorkUnits(t, j, workSpecName, gwuEverything, workUnits)\n}", "title": "" }, { "docid": "431e8cc490e0804639b42beb2bb42bee", "score": "0.48484212", "text": "func (c *WorkitemtypeController) List(ctx *app.ListWorkitemtypeContext) error {\n\tstart, limit, err := parseLimit(ctx.Page)\n\tif err != nil {\n\t\treturn goa.ErrBadRequest(fmt.Sprintf(\"could not parse paging: %s\", err.Error()))\n\t}\n\treturn transaction.Do(c.ts, func() error {\n\t\tresult, err := c.witRepository.List(ctx.Context, start, &limit)\n\t\tif err != nil {\n\t\t\treturn goa.ErrInternal(fmt.Sprintf(\"Error listing work item types: %s\", err.Error()))\n\t\t}\n\t\treturn ctx.OK(result)\n\t})\n}", "title": "" }, { "docid": "9ac09487e081ef6d0a77bfa8f382295d", "score": "0.48475337", "text": "func TestDelWorkUnitsByName2(t *testing.T) {\n\tj := setUpTest(t, \"TestDelWorkUnitsByName2\")\n\tdefer tearDownTest(t, j)\n\n\toptions := func(state jobserver.WorkUnitStatus) map[string]interface{} {\n\t\treturn map[string]interface{}{\n\t\t\t\"work_unit_keys\": []interface{}{stateShortName[state]},\n\t\t}\n\t}\n\tallDelWorkUnitsBy(t, j, 2, options)\n}", "title": "" }, { "docid": "b79f1d890042869a5c9f6f87ebb841f6", "score": "0.4840166", "text": "func (m *MockMeshWorkloadClient) ListMeshWorkload(ctx context.Context, opts ...client.ListOption) (*v1alpha1.MeshWorkloadList, 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, \"ListMeshWorkload\", varargs...)\n\tret0, _ := ret[0].(*v1alpha1.MeshWorkloadList)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "463918c92edffc42d20fe8eb66705ff7", "score": "0.4834495", "text": "func TestDelWorkUnitsByNameAndState(t *testing.T) {\n\tj := setUpTest(t, \"TestDelWorkUnitsByNameAndState\")\n\tdefer tearDownTest(t, j)\n\n\toptions := func(state jobserver.WorkUnitStatus) map[string]interface{} {\n\t\treturn map[string]interface{}{\n\t\t\t\"work_unit_keys\": []interface{}{stateShortName[state]},\n\t\t\t\"state\": state,\n\t\t}\n\t}\n\tallDelWorkUnitsBy(t, j, 1, options)\n}", "title": "" }, { "docid": "2a37febf145d984851e22954a4afc411", "score": "0.48305225", "text": "func (c *Client) ListWorkGroups(ctx context.Context, params *ListWorkGroupsInput, optFns ...func(*Options)) (*ListWorkGroupsOutput, error) {\n\tif params == nil {\n\t\tparams = &ListWorkGroupsInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"ListWorkGroups\", params, optFns, addOperationListWorkGroupsMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*ListWorkGroupsOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "title": "" }, { "docid": "46eb645819d26764922a8456c266d90a", "score": "0.48225436", "text": "func (a *SyntheticsApiService) ListTests(ctx _context.Context) (SyntheticsListTestsResponse, *_nethttp.Response, error) {\n\treq, err := a.buildListTestsRequest(ctx)\n\tif err != nil {\n\t\tvar localVarReturnValue SyntheticsListTestsResponse\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\treturn req.ApiService.listTestsExecute(req)\n}", "title": "" }, { "docid": "9d46585c03874a89c406dd1a587f52a0", "score": "0.48109797", "text": "func (client *ServiceUnitsClient) listCreateRequest(ctx context.Context, resourceGroupName string, serviceTopologyName string, serviceName string, options *ServiceUnitsClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits\"\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 serviceTopologyName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceTopologyName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceTopologyName}\", url.PathEscape(serviceTopologyName))\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\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2019-11-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "6e6a98ab4069534f636f86004e079ffd", "score": "0.48087838", "text": "func expectPrefixedWorkUnits(workSpecName, prefix string, count int) interface{} {\n\tresult := make([]cborrpc.PythonTuple, count)\n\tfor i := range result {\n\t\tkey := fmt.Sprintf(\"%s%03d\", prefix, i+1)\n\t\tdata := map[string]interface{}{\"k\": fmt.Sprintf(\"v%v\", i+1)}\n\t\titems := []interface{}{workSpecName, []byte(key), data}\n\t\tresult[i] = cborrpc.PythonTuple{Items: items}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "645f2f84be051673ca136047498b175f", "score": "0.47996634", "text": "func (s *Store) ListWorkloads(appName string) ([]*Workload, error) {\n\twklds, err := s.listWorkloads(appName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"read workload configuration for application %s: %w\", appName, err)\n\t}\n\n\treturn wklds, nil\n}", "title": "" }, { "docid": "d3407df300264cf6011157ed06851b67", "score": "0.47979006", "text": "func (wh *WorkflowHandler) ListClosedWorkflowExecutions(ctx context.Context, request *workflowservice.ListClosedWorkflowExecutionsRequest) (_ *workflowservice.ListClosedWorkflowExecutionsResponse, retError error) {\n\tdefer log.CapturePanic(wh.GetLogger(), &retError)\n\n\tscope, sw := wh.startRequestProfileWithNamespace(metrics.FrontendListClosedWorkflowExecutionsScope, request.GetNamespace())\n\tdefer sw.Stop()\n\n\tif wh.isStopped() {\n\t\treturn nil, errShuttingDown\n\t}\n\n\tif err := wh.versionChecker.ClientSupported(ctx, wh.config.EnableClientVersionCheck()); err != nil {\n\t\treturn nil, wh.error(err, scope)\n\t}\n\n\tif request == nil {\n\t\treturn nil, wh.error(errRequestNotSet, scope)\n\t}\n\n\tif ok := wh.allow(request.GetNamespace()); !ok {\n\t\treturn nil, wh.error(errServiceBusy, scope)\n\t}\n\n\tif request.GetNamespace() == \"\" {\n\t\treturn nil, wh.error(errNamespaceNotSet, scope)\n\t}\n\n\tif request.StartTimeFilter == nil {\n\t\trequest.StartTimeFilter = &filterpb.StartTimeFilter{}\n\t}\n\n\tif timestamp.TimeValue(request.GetStartTimeFilter().GetLatestTime()).IsZero() {\n\t\trequest.GetStartTimeFilter().LatestTime = &maxTime\n\t}\n\n\tif timestamp.TimeValue(request.StartTimeFilter.GetEarliestTime()).After(timestamp.TimeValue(request.StartTimeFilter.GetLatestTime())) {\n\t\treturn nil, wh.error(errEarliestTimeIsGreaterThanLatestTime, scope)\n\t}\n\n\tif request.GetMaximumPageSize() <= 0 {\n\t\trequest.MaximumPageSize = int32(wh.config.VisibilityMaxPageSize(request.GetNamespace()))\n\t}\n\n\tif wh.isListRequestPageSizeTooLarge(request.GetMaximumPageSize(), request.GetNamespace()) {\n\t\treturn nil, wh.error(errPageSizeTooBig.MessageArgs(wh.config.ESIndexMaxResultWindow()), scope)\n\t}\n\n\tnamespace := request.GetNamespace()\n\tnamespaceID, err := wh.GetNamespaceCache().GetNamespaceID(namespace)\n\tif err != nil {\n\t\treturn nil, wh.error(err, scope)\n\t}\n\n\tbaseReq := persistence.ListWorkflowExecutionsRequest{\n\t\tNamespaceID: namespaceID,\n\t\tNamespace: namespace,\n\t\tPageSize: int(request.GetMaximumPageSize()),\n\t\tNextPageToken: request.NextPageToken,\n\t\tEarliestStartTime: timestamp.TimeValue(request.StartTimeFilter.GetEarliestTime()).UnixNano(),\n\t\tLatestStartTime: timestamp.TimeValue(request.StartTimeFilter.GetLatestTime()).UnixNano(),\n\t}\n\n\tvar persistenceResp *persistence.ListWorkflowExecutionsResponse\n\tif request.GetExecutionFilter() != nil {\n\t\tif wh.config.DisableListVisibilityByFilter(namespace) {\n\t\t\terr = errNoPermission\n\t\t} else {\n\t\t\tpersistenceResp, err = wh.GetVisibilityManager().ListClosedWorkflowExecutionsByWorkflowID(\n\t\t\t\t&persistence.ListWorkflowExecutionsByWorkflowIDRequest{\n\t\t\t\t\tListWorkflowExecutionsRequest: baseReq,\n\t\t\t\t\tWorkflowID: request.GetExecutionFilter().GetWorkflowId(),\n\t\t\t\t})\n\t\t}\n\t\twh.GetLogger().Debug(\"List closed workflow with filter\",\n\t\t\ttag.WorkflowNamespace(request.GetNamespace()), tag.WorkflowListWorkflowFilterByID)\n\t} else if request.GetTypeFilter() != nil {\n\t\tif wh.config.DisableListVisibilityByFilter(namespace) {\n\t\t\terr = errNoPermission\n\t\t} else {\n\t\t\tpersistenceResp, err = wh.GetVisibilityManager().ListClosedWorkflowExecutionsByType(&persistence.ListWorkflowExecutionsByTypeRequest{\n\t\t\t\tListWorkflowExecutionsRequest: baseReq,\n\t\t\t\tWorkflowTypeName: request.GetTypeFilter().GetName(),\n\t\t\t})\n\t\t}\n\t\twh.GetLogger().Debug(\"List closed workflow with filter\",\n\t\t\ttag.WorkflowNamespace(request.GetNamespace()), tag.WorkflowListWorkflowFilterByType)\n\t} else if request.GetStatusFilter() != nil {\n\t\tif wh.config.DisableListVisibilityByFilter(namespace) {\n\t\t\terr = errNoPermission\n\t\t} else {\n\t\t\tif request.GetStatusFilter().GetStatus() == enumspb.WORKFLOW_EXECUTION_STATUS_UNSPECIFIED || request.GetStatusFilter().GetStatus() == enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING {\n\t\t\t\terr = errStatusFilterMustBeNotRunning\n\t\t\t} else {\n\t\t\t\tpersistenceResp, err = wh.GetVisibilityManager().ListClosedWorkflowExecutionsByStatus(&persistence.ListClosedWorkflowExecutionsByStatusRequest{\n\t\t\t\t\tListWorkflowExecutionsRequest: baseReq,\n\t\t\t\t\tStatus: request.GetStatusFilter().GetStatus(),\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\twh.GetLogger().Debug(\"List closed workflow with filter\",\n\t\t\ttag.WorkflowNamespace(request.GetNamespace()), tag.WorkflowListWorkflowFilterByStatus)\n\t} else {\n\t\tpersistenceResp, err = wh.GetVisibilityManager().ListClosedWorkflowExecutions(&baseReq)\n\t}\n\n\tif err != nil {\n\t\treturn nil, wh.error(err, scope)\n\t}\n\n\treturn &workflowservice.ListClosedWorkflowExecutionsResponse{\n\t\tExecutions: persistenceResp.Executions,\n\t\tNextPageToken: persistenceResp.NextPageToken,\n\t}, nil\n}", "title": "" }, { "docid": "837e4a3c1296ccf3329be5c4e3e9cd75", "score": "0.47941956", "text": "func cmdGetWorkloads(ccmd *cobra.Command, args []string) {\n\taplSvc := apl.NewClient()\n\toutput := runGetCommand(args, aplSvc.Workloads.Get)\n\tif output != nil {\n\t\tfields := []string{\"ID\", \"WorkloadType\", \"LeaseType\", \"MaxLeasePeriodMins\", \"Priority\", \"QualityOfService\", \"CreatedTime\"}\n\t\tprintTableResultsCustom(output.(apl.Workload), fields)\n\t}\n}", "title": "" }, { "docid": "1988e2de90c417e753ae937bed782f35", "score": "0.47915998", "text": "func TestDelWorkUnitsByName(t *testing.T) {\n\tj := setUpTest(t, \"TestDelWorkUnitsByName\")\n\tdefer tearDownTest(t, j)\n\n\toptions := func(state jobserver.WorkUnitStatus) map[string]interface{} {\n\t\treturn map[string]interface{}{\n\t\t\t\"work_unit_keys\": []interface{}{stateShortName[state]},\n\t\t}\n\t}\n\tallDelWorkUnitsBy(t, j, 1, options)\n}", "title": "" }, { "docid": "72abe14382f2b8f54f3f9ec973659ed1", "score": "0.47852975", "text": "func GetWorkOrders(operatingUnit string) []structs.WorkOrder {\n\tvar WSO2Response []structs.WorkOrder\n\n\tlog.P.Debug(fmt.Sprintf(\"Getting work orders for operating unit %v\", operatingUnit))\n\n\terr := wso2requests.MakeWSO2RequestWithHeaders(\"GET\",\n\t\t\"https://api.byu.edu:443/domains/erp/hr/work_orders_by_operating_unit/v1/\"+operatingUnit, \"\", &WSO2Response, map[string]string{\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\"Accept\": \"application/json\",\n\t\t})\n\n\tif err != nil {\n\t\tlog.P.Error(fmt.Sprintf(\"Error when retrieving possible work orders for operating unit %v\", err.Error()))\n\t}\n\n\treturn WSO2Response\n}", "title": "" }, { "docid": "9dd516d6994e53a5516e86ad4f13ef0c", "score": "0.47789878", "text": "func (spec *workSpec) expireUnits() {\n\tnow := spec.Coordinate().clock.Now()\n\tfor _, unit := range spec.workUnits {\n\t\tif unit.activeAttempt != nil &&\n\t\t\tunit.activeAttempt.status == coordinate.Pending &&\n\t\t\tunit.activeAttempt.expirationTime.Before(now) {\n\t\t\tunit.activeAttempt.finish(coordinate.Expired, nil)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f20527fcf4cb70fe5d5e3fab26a026d3", "score": "0.4774676", "text": "func (s *WorkspaceService) List(ctx context.Context,\n\topt *ListOpt) ([]*Workspace, *ListOpt, error) {\n\n\tdata, next, err := s.client.list(ctx, \"/workspaces/\", opt)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tvar workspaces []*Workspace\n\tfor _, object := range data {\n\t\tb, err := object.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tvar workspace Workspace\n\t\terr = json.Unmarshal(b, &workspace)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tworkspaces = append(workspaces, &workspace)\n\t}\n\n\treturn workspaces, next, nil\n}", "title": "" }, { "docid": "285bf055a58ed28c8f8cecf78a674fcd", "score": "0.476912", "text": "func (c *Client) JSOperationList(dataStartTime string,dataEndTime string,dataLayout string,branch string,dataTime string,beforeCount *int,afterCount *int) ([]*JSOperationStruct, error) {\nvar err error\nvar result []*JSOperationStruct\nreturn result, err\n}", "title": "" }, { "docid": "9e21083c2734aaecb6e291a1feb501be", "score": "0.47685948", "text": "func (client *ServiceUnitsClient) listHandleResponse(resp *http.Response) (ServiceUnitsClientListResponse, error) {\n\tresult := ServiceUnitsClientListResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ServiceUnitResourceArray); err != nil {\n\t\treturn ServiceUnitsClientListResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "c8b2cbe23ee179909ecefea971fa239e", "score": "0.47665584", "text": "func (g *GuideCreditChainCode) queryGuideWorkList(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tguideAddress := strings.TrimSpace(strings.ToLower(args[0]))\n\tif len(guideAddress) <= 0 {\n\t\treturn shim.Error(\"1st arg must be non-empty string\")\n\t}\n\t//get blackList\n\tresultsIterator, err := stub.GetStateByPartialCompositeKey(WORK_LOG, []string{guideAddress})\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\tdefer resultsIterator.Close()\n\tresultList := make([]WorkLog, 0)\n\tfor i := 0; resultsIterator.HasNext(); i++ {\n\t\tresponseRange, err := resultsIterator.Next()\n\t\tif err != nil {\n\t\t\treturn shim.Error(err.Error())\n\t\t}\n\t\tvalue := responseRange.Value\n\t\ttmp := WorkLog{}\n\t\terr = json.Unmarshal(value, &tmp)\n\t\tif err == nil {\n\t\t\tresultList = append(resultList, tmp)\n\t\t}\n\t}\n\tresJson, err := json.Marshal(resultList)\n\tif err != nil {\n\t\treturn shim.Error(\"Failed to marshal result to json : \" + err.Error())\n\t}\n\treturn shim.Success(resJson)\n}", "title": "" }, { "docid": "e0bdb65a79513d42e6562a3e9bdeecf5", "score": "0.4766438", "text": "func (c *Client) ReplicationSpecList() ([]*ReplicationSpecStruct, error) {\nvar err error\nvar result []*ReplicationSpecStruct\nreturn result, err\n}", "title": "" }, { "docid": "8f74c0d5dc5b4592b6a9c9879252b550", "score": "0.47656587", "text": "func (m *MockX) TimeListList() [][]time.Time {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"TimeListList\")\n\tret0, _ := ret[0].([][]time.Time)\n\treturn ret0\n}", "title": "" }, { "docid": "d82d9f58817e84ae282d982c58e2b594", "score": "0.47599202", "text": "func TestWsGetOrderList(t *testing.T) {\n\tsetupWsTests(t)\n\tresp, err := h.wsGetOrdersList(1, currency.NewPairFromString(\"ethbtc\"))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif resp.ErrorCode > 0 {\n\t\tt.Error(resp.ErrorMessage)\n\t}\n}", "title": "" }, { "docid": "e57cfd45e8fe5d667e2e9f00ec07f895", "score": "0.47582623", "text": "func (m *MockWsWorkloadLister) WorkloadNames() ([]string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"WorkloadNames\")\n\tret0, _ := ret[0].([]string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "6a6ab8640545e68f696612dd09126383", "score": "0.47513068", "text": "func (m *MockLicense) ListMetricUNS(arg0 context.Context, arg1 ...string) ([]*v1.MetricUNS, 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, \"ListMetricUNS\", varargs...)\n\tret0, _ := ret[0].([]*v1.MetricUNS)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "46fb5aa6dc3675c32ef3a4c7cae6b3ff", "score": "0.47478127", "text": "func (m *MockWasmDeploymentReader) ListWasmDeployment(ctx context.Context, opts ...client.ListOption) (*v1beta1.WasmDeploymentList, 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, \"ListWasmDeployment\", varargs...)\n\tret0, _ := ret[0].(*v1beta1.WasmDeploymentList)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "46fb5aa6dc3675c32ef3a4c7cae6b3ff", "score": "0.47478127", "text": "func (m *MockWasmDeploymentReader) ListWasmDeployment(ctx context.Context, opts ...client.ListOption) (*v1beta1.WasmDeploymentList, 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, \"ListWasmDeployment\", varargs...)\n\tret0, _ := ret[0].(*v1beta1.WasmDeploymentList)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "447a229afe098d37a942e90a87840cb3", "score": "0.47452614", "text": "func (m *MockCodeShipAPI) ListBuilds(ctx context.Context, projectUUID string, opts ...codeship_go.PaginationOption) (codeship_go.BuildList, codeship_go.Response, error) {\n\tvarargs := []interface{}{ctx, projectUUID}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ListBuilds\", varargs...)\n\tret0, _ := ret[0].(codeship_go.BuildList)\n\tret1, _ := ret[1].(codeship_go.Response)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}", "title": "" }, { "docid": "bf1d41b2ea771c0ec5a8e7cc8d490000", "score": "0.47389153", "text": "func (m *MockWorkspaceRetriever) WorkloadNames() ([]string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"WorkloadNames\")\n\tret0, _ := ret[0].([]string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "48c3faa16dd65be83d14c1545e78f982", "score": "0.473175", "text": "func (s *MachinesService) List() ([]*Machines, *Response, error) {\n\tapiEndpoint := \"machines/getMachines\"\n\n\treq, err := s.client.NewRequest(http.MethodGet, apiEndpoint, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar machines []*Machines\n\tresp, err := s.client.Do(req, &machines)\n\tif err != nil {\n\t\tfmt.Print(err)\n\t\treturn nil, resp, err\n\t}\n\n\treturn machines, resp, nil\n}", "title": "" }, { "docid": "52e26a1194daa425a3f3a19c609a7232", "score": "0.47295976", "text": "func (client TilesetClient) List(ctx context.Context) (result TilesetListResponsePage, err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/TilesetClient.List\")\n defer func() {\n sc := -1\n if result.tlr.Response.Response != nil {\n sc = result.tlr.Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n result.fn = client.listNextResults\n req, err := client.ListPreparer(ctx)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"creator.TilesetClient\", \"List\", nil , \"Failure preparing request\")\n return\n }\n\n resp, err := client.ListSender(req)\n if err != nil {\n result.tlr.Response = autorest.Response{Response: resp}\n err = autorest.NewErrorWithError(err, \"creator.TilesetClient\", \"List\", resp, \"Failure sending request\")\n return\n }\n\n result.tlr, err = client.ListResponder(resp)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"creator.TilesetClient\", \"List\", resp, \"Failure responding to request\")\n return\n }\n if result.tlr.hasNextLink() && result.tlr.IsEmpty() {\n err = result.NextWithContext(ctx)\n return\n }\n\n return\n}", "title": "" }, { "docid": "97e436fd0eec860f722e8240511ac801", "score": "0.47292504", "text": "func TestWsGetAccountsList(t *testing.T) {\n\tsetupWsTests(t)\n\tresp, err := h.wsGetAccountsList(currency.NewPairFromString(\"ethbtc\"))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif resp.ErrorCode > 0 {\n\t\tt.Error(resp.ErrorMessage)\n\t}\n}", "title": "" } ]
a27a96793baa4aec497224903c28d0a7
check that gox is installed
[ { "docid": "906ccef373a75d35341ece15a4da6703", "score": "0.8750402", "text": "func checkGox() error {\n\tverboseLog(\"checking that gox is installed\")\n\treturn sh.Run(\"bash\", \"-c\", `command -v gox`)\n}", "title": "" } ]
[ { "docid": "98efdc497f72167f76d1569cfbeffb8f", "score": "0.6212715", "text": "func checkTGEnvExist() bool {\n\treturn os.Getenv(\"TG_VERSION\") != \"\"\n}", "title": "" }, { "docid": "58d2b5af36b2c699c09ffef7595ed802", "score": "0.6081653", "text": "func (e *Elder) Gox(appName string, opts ...taskGox.Option) error {\n\tac, acErr := e.GetAppConfig(appName)\n\tif acErr != nil {\n\t\treturn fmt.Errorf(\"get %q application configuration: %w\", appName, acErr)\n\t}\n\n\tt, tErr := taskGox.New(ac, opts...)\n\tif tErr != nil {\n\t\treturn fmt.Errorf(`create \"gox\" task: %w`, tErr)\n\t}\n\n\treturn e.goToolRunner.Run(t)\n}", "title": "" }, { "docid": "cd7b593d8f0379c560cd0e05ab07f411", "score": "0.6018389", "text": "func checkGopath() {\n\tif len(GOPATH) == 0 {\n\t\tlog.Fatal(\"GOPATH is empty. Please fix this\")\n\t}\n}", "title": "" }, { "docid": "256fdd13585ae583779349ff40711991", "score": "0.5872914", "text": "func CheckGEXSFTP(v *viper.Viper) error {\n\tif err := ValidatePort(v, GEXSFTPPortFlag); err != nil {\n\t\treturn err\n\t}\n\n\tif err := ValidateHost(v, GEXSFTPIPAddressFlag); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "76a54fde2e3960cf6665863fdd12db96", "score": "0.5834077", "text": "func checkPostgresInstallation() bool {\n\tcmd := exec.Command(\"postgres\", \"--help\")\n\n\tif err := cmd.Run(); err != nil {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "622b6f09731fb7d44bff8b361351b44e", "score": "0.5815268", "text": "func checkOpenvpnBinary() {\n\tcmd := exec.Command(\n\t\t\"command\", \"-v\", \"openvpn\",\n\t)\n\n\tvar stdout, stderr bytes.Buffer\n\tcmd.Stdout = &stdout\n\tcmd.Stderr = &stderr\n\n\terr := cmd.Run()\n\tif err != nil {\n\t\treporter.Error(\n\t\t\t\"OpenVPN package is not installed or openvpn binary is not in standard PATH\",\n\t\t)\n\t}\n\n\tif stderr.String() != \"\" {\n\t\treporter.Error(stderr.String())\n\t}\n}", "title": "" }, { "docid": "0b72cca8b15e2e11c18766dacb55b93d", "score": "0.57105803", "text": "func isGoroot(goroot string) bool {\n\t_, err := os.Stat(filepath.Join(goroot, \"src\", \"runtime\", \"internal\", \"sys\", \"zversion.go\"))\n\treturn err == nil\n}", "title": "" }, { "docid": "8889500c5e136f4590bef42622b313cd", "score": "0.544379", "text": "func GLAPICheck(ctx context.Context, s *testing.State) {\n\t// query the supported graphics APIs.\n\tglMajor, glMinor, err := graphics.GLESVersion(ctx)\n\tif err != nil {\n\t\ts.Fatal(\"Could not obtain the OpenGL version: \", err)\n\t}\n\ts.Logf(\"Found GLES%d.%d\", glMajor, glMinor)\n\t// Make sure the GLES version >= 3.1\n\tif glMajor < 3 || (glMajor == 3 && glMinor < 1) {\n\t\ts.Fatal(\"GLES version is older than 3.1\")\n\t}\n\t//TODO(syedfaaiz): GPU user space drivers MUST support EGL 1.3\n\t// verify the our devices are 1.3 and above and support the following\n\t// extensions:\n\t//EGL_EXT_image_dma_buf_import, EGL_EXT_image_dma_buf_import_modifiers,\n\t//EGL_KHR_surfaceless_context, EGL_KHR_fence_sync, OES_EGL_image_external\n\n\tstdout, _, err := testexec.CommandContext(ctx, \"eglinfo\").SeparatedOutput(testexec.DumpLogOnError)\n\tif err != nil {\n\t\ts.Fatal(\"eglinfo command failed to run: \", err)\n\t}\n\t// Use regexp to find first occurrence of version for EGL.\n\tmatched := eglInfoRe.FindAllStringSubmatch(string(stdout), -1)\n\tif len(matched) == 0 {\n\t\ts.Fatal(\"regex could not detect eglinfo version: \", err)\n\t}\n\teglMajor, eglMinor, err := extractEGLVersion(s, matched)\n\tif err != nil {\n\t\ts.Fatal(\"An error occured while extracting egl version data: \", err)\n\t}\n\ts.Logf(\"Found EGL%v.%v\", eglMajor, eglMinor)\n\t//Make sure the EGL version >= 1.3\n\tif eglMajor < 1 || (eglMajor == 1 && eglMinor < 3) {\n\t\ts.Fatalf(\"eglversion 1.3 or greater required, current version %d.%d\", eglMajor, eglMinor)\n\t}\n\treturn\n}", "title": "" }, { "docid": "8fd2ccf2c86523355e8668cf2adc00c4", "score": "0.54019445", "text": "func checkGoPath() error {\n\tgopath := os.Getenv(\"GOPATH\")\n\tif gopath == \"\" {\n\t\tlog.Fatal(red(\"$GOPATH isn't set up properly...\"))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "01987895506681417c182c9275d468c4", "score": "0.53582543", "text": "func (s *Chain) checkSystem() error {\n\t// check if Go has installed.\n\tif !xexec.IsCommandAvailable(\"go\") {\n\t\treturn errors.New(\"Please, check that Go language is installed correctly in $PATH. See https://golang.org/doc/install\")\n\t}\n\t// check if Go's bin added to System's path.\n\tgobinpath := path.Join(build.Default.GOPATH, \"bin\")\n\tif err := xos.IsInPath(gobinpath); err != nil {\n\t\treturn errors.New(\"$(go env GOPATH)/bin must be added to your $PATH. See https://golang.org/doc/gopath_code.html#GOPATH\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "859e3214bbacec7d9e5b74872b9586a5", "score": "0.53394866", "text": "func (n *Node) IsExistGopath() bool {\n\treturn base.IsExist(n.InstallGopath)\n}", "title": "" }, { "docid": "c6b0d0a66fdb733866b1b5c5b3a05705", "score": "0.53084606", "text": "func (c *GitCommand) usingGpg() bool {\n\tgpgsign, _ := c.getLocalGitConfig(\"commit.gpgsign\")\n\tif gpgsign == \"\" {\n\t\tgpgsign, _ = c.getGlobalGitConfig(\"commit.gpgsign\")\n\t}\n\tvalue := strings.ToLower(gpgsign)\n\n\treturn value == \"true\" || value == \"1\" || value == \"yes\" || value == \"on\"\n}", "title": "" }, { "docid": "50bfa1d40d3b00609c8efab6d41a8309", "score": "0.53049976", "text": "func checkLibvirtInstalled() bool {\n\tpath, err := exec.LookPath(\"virsh\")\n\tif err != nil {\n\t\treturn false\n\t}\n\tfi, _ := os.Stat(path)\n\tif fi.Mode()&os.ModeSymlink != 0 {\n\t\tpath, err = os.Readlink(path)\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "f1d50276bd450d3fb3646d0347a42229", "score": "0.52636576", "text": "func checkOsEnv(envName string) error {\n\tvar ok bool\n\n\t// check for empty environment\n\tif _, ok = os.LookupEnv(envName); !ok {\n\t\treturn fmt.Errorf(\"Please specify %s in environment\", envName)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9517298f21de59d1f27b1488b85d5ffe", "score": "0.52502304", "text": "func check_on_os (path string) bool {\n\t_, err := os.Stat(path)\n\tif err == nil { return true }\n\tif os.IsNotExist(err) { return false }\n\treturn false\n}", "title": "" }, { "docid": "9e278a347706fdfc06220483103a88ed", "score": "0.5237339", "text": "func (s Checker) isOSS() bool {\n\treturn !s.Enterprise\n}", "title": "" }, { "docid": "f71a2a57b3da0393a2bf3a2ae89de364", "score": "0.5214365", "text": "func (r *PdfPageResources) HasExtGState(keyName core.PdfObjectName) bool {\n\t_, has := r.GetFontByName(keyName)\n\treturn has\n}", "title": "" }, { "docid": "3ba1877352969c390455fda0422de2f8", "score": "0.52036357", "text": "func (q adminUnauthorizedTrustlineQuery) ExistsG() (bool, error) {\n\treturn q.Exists(boil.GetDB())\n}", "title": "" }, { "docid": "e7062e48ae5f32c9ffead50724641d25", "score": "0.51997095", "text": "func CheckInstall() bool {\n\t// logic to check if asw cli is already installed\n\tversion := commander.CmdRunOutSilentNoErr(\"aws --version\")\n\tv := strings.Split(version, \" \")\n\tif v[0] == \"aws-cli/2.0.0\" {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "f6b21c8d7536e105b59544fdc1807266", "score": "0.51857656", "text": "func ContentUnitExistsGP(id int64) bool {\n\te, err := ContentUnitExists(boil.GetDB(), id)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn e\n}", "title": "" }, { "docid": "0f85620af55998dd7ae363006624e73c", "score": "0.51820785", "text": "func checkGopacfileExists(packages_data *Packages) bool {\n file_path := getRelativePath()\n file_path = file_path + \"/gopac.json\"\n if _, err := os.Stat(file_path); err == nil {\n packages_data.file_path = file_path\n return true\n }\n fmt.Printf(\"error: gopac.json not found.\")\n\n return false\n}", "title": "" }, { "docid": "708fcf14fc6f7838a6a89c2ef3bee8e6", "score": "0.51619446", "text": "func ensureGopath() (string, error) {\n\tgopath := os.Getenv(\"GOPATH\")\n\tif gopath == \"\" {\n\t\treturn \"\", errors.New(\"$GOPATH is not set\")\n\t}\n\n\tif ex, err := exists(gopath); err != nil {\n\t\treturn \"\", err\n\t} else if !ex {\n\t\treturn \"\", fmt.Errorf(\"GOPATH does not exist at: %s\", gopath)\n\t}\n\n\tfmt.Printf(\"GOPATH is: %s\\n\", gopath)\n\treturn gopath, nil\n}", "title": "" }, { "docid": "f2c75881cd1ec08d7f507d7f02e4e9ee", "score": "0.5161101", "text": "func ContentUnitExistsG(id int64) (bool, error) {\n\treturn ContentUnitExists(boil.GetDB(), id)\n}", "title": "" }, { "docid": "daeee659fb59e1e69d93d5cdfff6480e", "score": "0.51568705", "text": "func checkSystemRequirements() error {\n\tbinaries := []string{\"mocha\", \"node\", \"npm\"}\n\tfor _, b := range binaries {\n\t\tif _, err := exec.LookPath(b); err != nil {\n\t\t\treturn fmt.Errorf(\"Required dependency %q not present\", b)\n\t\t}\n\t}\n\n\tcheckModules := func(globally bool) error {\n\t\targs := []string{\"list\", \"--depth=0\"}\n\t\tif globally {\n\t\t\targs = append([]string{\"-g\"}, args...)\n\t\t}\n\t\tc := exec.Command(\"npm\", args...)\n\t\tb, _ := c.Output()\n\t\ts := string(b)\n\t\tmodules := []string{\"mocha\", \"assert\"}\n\t\tfor _, m := range modules {\n\t\t\tif !strings.Contains(s, fmt.Sprintf(\" %s@\", m)) {\n\t\t\t\treturn fmt.Errorf(\"Required npm module %v not present\", m)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\tif err := checkModules(true); err != nil {\n\t\tif err := checkModules(false); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c9ea28e7216c756fc65bce4cce10a7d0", "score": "0.51562005", "text": "func Check() {\n\tmg.Deps(CheckGoImports, CheckGoLint, CheckGoVet, CheckCopyright)\n}", "title": "" }, { "docid": "3e84db908e7501fcebd83f681e284e6f", "score": "0.5147375", "text": "func IsGb(dir string) (string, bool) {\n\troot, err := FindGbProjectRoot(dir)\n\tif err != nil {\n\t\treturn \"\", false\n\t}\n\n\t// Check root directory whether \"vendor\", and overwrite root path to parent of vendor directory.\n\tif filepath.Base(root) == \"vendor\" {\n\t\troot = filepath.Dir(root)\n\t}\n\t// FindGbProjectRoot gets the GOPATH root if go directory structure.\n\t// Recheck use vendor directory.\n\tvendor := filepath.Join(root, \"vendor\")\n\tif IsNotExist(vendor) {\n\t\treturn \"\", false\n\t}\n\treturn root, true\n}", "title": "" }, { "docid": "d70041acba444c618f6ef0afad076dc5", "score": "0.5132879", "text": "func checkVersions(conn *pgx.Conn) error {\n\tif err := checkPgVersion(conn); err != nil {\n\t\treturn fmt.Errorf(\"Problem checking PostgreSQL version: %w\", err)\n\t}\n\tif err := checkExtensionsVersion(conn); err != nil {\n\t\treturn fmt.Errorf(\"Problem checking Promescale extension version: %w\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e548af55d2896f6e0134b7ed3a55a64d", "score": "0.5132069", "text": "func btrfsCmdIsInstalled() error {\n\n\tout, err := exec.LookPath(\"btrfs\")\n\tif err != nil || len(out) == 0 {\n\t\tshared.Debugf(\"The 'btrfs' tool isn't available\")\n\t\treturn fmt.Errorf(\"The 'btrfs' tool isn't available\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d82a01f29ea655a314aea43cd18579e0", "score": "0.5124684", "text": "func GoauthExistsGP(username string) bool {\n\te, err := GoauthExists(boil.GetDB(), username)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn e\n}", "title": "" }, { "docid": "31164ce8b373823e59fa1315c6d39d1c", "score": "0.51243365", "text": "func TestSGX(t *testing.T) {\n\tgot := CPU.SGX.Available\n\texpected := CPU.Features&SGX == SGX\n\tif got != expected {\n\t\tt.Fatalf(\"SGX: expected %v, got %v\", expected, got)\n\t}\n\tt.Log(\"SGX Support:\", got)\n}", "title": "" }, { "docid": "10378e0b41f308cbc1f1aefcb7d1a13c", "score": "0.51172286", "text": "func checkCertDeps() bool {\n\toutput, err := exec.Command(\"which\", \"keytool\").Output()\n\tif err != nil {\n\t\tlog.Fatal(\"Problem checking installation of: keytool\")\n\t}\n\tif len(output) < 4 {\n\t\treturn false\n\t}\n\toutput, err = exec.Command(\"which\", \"openssl\").Output()\n\tif err != nil {\n\t\tlog.Fatal(\"Problem checking installation of: openssl\")\n\t}\n\tif len(output) < 4 {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "5d7c31cc8d9eb294ab1c09682f35b9ca", "score": "0.51156354", "text": "func checkPrivileges() bool {\n\n\tif user, err := user.Current(); err == nil && user.Gid == \"0\" {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "55b1d688ef5db03e3031db5609b68335", "score": "0.5111112", "text": "func (w *PrDiscovery) checkForTools() {\n\t_, err := exec.LookPath(\"git-flow\")\n\tif nil != err {\n\t\tw.hasGitFlow = false\n\t} else {\n\t\tw.hasGitFlow = true\n\t}\n}", "title": "" }, { "docid": "4b9c747ce11768a31eed35151e14b0eb", "score": "0.50929916", "text": "func IsChocolateyInstalled() bool {\n\n // Check if chocolatey is installed by trying to run the executable\n _, err := exec.LookPath(\"choco.exe\")\n\n // If there was no error, chocolatey is installed\n return err == nil\n}", "title": "" }, { "docid": "332fb73e30da1fcdb76f2a37c8ebde83", "score": "0.50901675", "text": "func isGccgoTool(tool string) bool {\n\tswitch tool {\n\tcase \"cgo\", \"fix\", \"cover\", \"godoc\", \"vet\":\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d0d51c2b13816cd68651771747851374", "score": "0.5045538", "text": "func isXfs(dir string) bool {\n\tmountpoint := detectMountpoint(mount.New(\"\"), dir)\n\tif mountpoint == \"\" {\n\t\treturn false\n\t}\n\tvar buf syscall.Statfs_t\n\terr := syscall.Statfs(mountpoint, &buf)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn buf.Type == xfsMagic\n}", "title": "" }, { "docid": "d816601f903b7446163fb0c5f886d9d7", "score": "0.504463", "text": "func (g *Gossip) Check() error {\n\terr := g.RegisterToKnownServices()\n\tif err != nil {\n\t\tlog.Printf(\"error: %v\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b69b62491075adbf08f2a121b0e3591d", "score": "0.5029946", "text": "func checkPythonInstalled() {\n\n\tcommand := \"bash\"\n\targs := []string{\"-c\", \"command -v python3\"}\n\toutput, _ := ExecuteBashCommand(command, args)\n\n\toutputTrimmed := strings.Replace(output, \"\\r\\n\", \"\", -1)\n\n\tif outputTrimmed == \"\" {\n\n\t\tLogError(\"Python 3 not installed on the system, \" +\n\t\t\t\"please install Python 3 before continuing. As an example, \" +\n\t\t\t\"CentOS users can invoke the command \\\"sudo yum install -y \" +\n\t\t\t\"python3\\\"\" + \" in order to do so.\")\n\n\t}\n\n}", "title": "" }, { "docid": "cc71750e6646c39609b0622dbf511b86", "score": "0.502103", "text": "func CheckToolInstalled(cliName string) bool {\n\t_, err := exec.LookPath(cliName)\n\tif err != nil {\n\t\tfmt.Println(cliName + \" is not installed on your system\")\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "e2d8ebf927a578a38e88b8d127e31f61", "score": "0.5008921", "text": "func HasGoDevEnv() bool {\n\tvar cmdout, cmderr string\n\tvar err error\n\n\tif len(gopaths) > 0 && GoVersion != \"\" {\n\t\treturn true\n\t}\n\n\t// GoVersion\n\t// if cmdout, cmderr, err = urun.CmdExec(\"go\", \"tool\", \"dist\", \"version\"); err == nil && cmderr == \"\" && cmdout != \"\" {\n\t// \tGoVersion = ustr.Trim(cmdout)\n\t// }\n\tif GoVersion == \"\" {\n\t\tif cmdout, cmderr, err = urun.CmdExec(\"go\", \"version\"); err == nil && cmderr == \"\" && cmdout != \"\" {\n\t\t\tif GoVersion = ustr.TrimPref(ustr.Trim(cmdout), \"go version \"); GoVersion != \"\" {\n\t\t\t\tGoVersion, _ = ustr.BreakOnFirstOrSuff(GoVersion, \" \")\n\t\t\t}\n\t\t}\n\t}\n\tif GoVersion = ustr.TrimPref(GoVersion, \"go\"); GoVersion == \"\" {\n\t\treturn false\n\t}\n\n\t// GOPATHs\n\tif cmdout, cmderr, err = urun.CmdExec(\"go\", \"env\", \"GOPATH\"); err != nil || cmderr != \"\" {\n\t\tGoVersion = \"\"\n\t\tgopaths = nil\n\t\treturn false\n\t}\n\tgopaths = filepath.SplitList(ustr.Trim(cmdout))\n\tfor i, gopath := range gopaths {\n\t\tif !ufs.IsDir(gopath) {\n\t\t\tgopaths[i] = \"\"\n\t\t}\n\t}\n\tif gopaths = ustr.Sans(gopaths, \"\"); len(gopaths) == 0 {\n\t\tGoVersion = \"\"\n\t\tgopaths = nil\n\t\treturn false\n\t} else if cmdout, cmderr, err = urun.CmdExec(\"go\", \"env\", \"GOROOT\"); err == nil && cmderr == \"\" && cmdout != \"\" {\n\t\tif gorootdirpath := ustr.Trim(cmdout); gorootdirpath != \"\" && ufs.IsDir(gorootdirpath) && !ustr.In(gorootdirpath, gopaths...) {\n\t\t\tgopaths = append(gopaths, gorootdirpath)\n\t\t}\n\t}\n\n\ti, l := ustr.IdxB(GoVersion, '.'), ustr.LastB(GoVersion, '.')\n\tfor GoVersionShort = GoVersion; l > i; l = ustr.LastB(GoVersionShort, '.') {\n\t\tGoVersionShort = GoVersionShort[:l]\n\t}\n\n\t// OKAY! we ran go command and have 1-or-more GOPATHs, the rest is optional\n\tstdargs := []string{\"-help\"}\n\turun.CmdsTryStart(map[string]*urun.CmdTry{\n\t\t\"gofmt\": {Ran: &Has_gofmt, Args: stdargs},\n\t\t\"goimports\": {Ran: &Has_goimports, Args: stdargs},\n\t\t\"goreturns\": {Ran: &Has_goreturns, Args: stdargs},\n\n\t\t\"golint\": {Ran: &Has_golint, Args: stdargs},\n\t\t\"ineffassign\": {Ran: &Has_ineffassign, Args: stdargs},\n\t\t\"errcheck\": {Ran: &Has_errcheck, Args: stdargs},\n\t\t\"aligncheck\": {Ran: &Has_checkalign, Args: stdargs},\n\t\t\"structcheck\": {Ran: &Has_checkstruct, Args: stdargs},\n\t\t\"varcheck\": {Ran: &Has_checkvar, Args: stdargs},\n\t\t\"interfacer\": {Ran: &Has_interfacer, Args: stdargs},\n\t\t\"unparam\": {Ran: &Has_unparam, Args: stdargs},\n\t\t\"unindent\": {Ran: &Has_unindent, Args: stdargs},\n\t\t\"unconvert\": {Ran: &Has_unconvert, Args: stdargs},\n\t\t\"maligned\": {Ran: &Has_maligned, Args: stdargs},\n\t\t\"gosimple\": {Ran: &Has_gosimple, Args: stdargs},\n\t\t\"staticcheck\": {Ran: &Has_staticcheck, Args: stdargs},\n\t\t\"unused\": {Ran: &Has_unused, Args: stdargs},\n\t\t\"deadcode\": {Ran: &Has_deadcode, Args: stdargs},\n\n\t\t\"structlayout\": {Ran: &Has_structlayout, Args: stdargs},\n\t\t\"gorename\": {Ran: &Has_gorename, Args: stdargs},\n\t\t\"godef\": {Ran: &Has_godef, Args: stdargs},\n\t\t\"gocode\": {Ran: &Has_gocode, Args: stdargs},\n\t\t\"guru\": {Ran: &Has_guru, Args: stdargs},\n\t\t\"gogetdoc\": {Ran: &Has_gogetdoc, Args: stdargs},\n\t\t\"godocdown\": {Ran: &Has_godocdown, Args: stdargs},\n\t\t\"godoc\": {Ran: &Has_godoc, Args: stdargs},\n\t\t\"goconst\": {Ran: &Has_goconst, Args: stdargs},\n\t})\n\treturn true\n}", "title": "" }, { "docid": "d51a5fb078adf5dae27fada0601f372e", "score": "0.49988842", "text": "func sanityCheck() error {\n\t_, err := exec.LookPath(\"git\")\n\tif err != nil {\n\t\tlog.Println(\"Sanity Check Failure: Couldn't find 'git'.\")\n\t}\n\treturn err\n}", "title": "" }, { "docid": "cd0a2c8bb29fb65dfb1581ab86f08472", "score": "0.49984363", "text": "func CvtermpropExistsG(cvtermpropID int) (bool, error) {\n\treturn CvtermpropExists(boil.GetDB(), cvtermpropID)\n}", "title": "" }, { "docid": "323e9848ef4b5de966bd84d99c996842", "score": "0.49919224", "text": "func (c *cli) isPurgeable(status releaseStatus) bool {\n\treturn status != releaseCheckFailed && status != releaseUnknown && status != releaseDeployed\n}", "title": "" }, { "docid": "e61e0f74eef9aacc6de77e090cebcd96", "score": "0.49894294", "text": "func isLibPkgConfigValid(lib string) bool {\n\treturn exec.Command(\"pkg-config\", \"--exists\", lib).Run() == nil\n}", "title": "" }, { "docid": "42512db8b27a0a0d60e018a22a4b9424", "score": "0.4972029", "text": "func Setup(geodb_path string) bool {\n\telip = Ellipsoid{\n\t\tellipse{6378137.0, 298.257223563}, // WGS84, because why not\n\t\tkilometer,\n\t\t1000.0,\n\t}\n\tif _, err := os.Stat(geodb_path); err != nil {\n\t\tif !DownloadDB(geodb_path) {\n\t\t\treturn false\n\t\t}\n\t}\n\tgeo, err := geoip.Open(geodb_path)\n\tif err != nil {\n\t\tlog.Println(\"Could not open GeoIP database\")\n\t} else {\n\t\tlog.Println(\"Loaded GeoIP database succesfully\")\n\t}\n\tgi = geo\n\treturn true\n}", "title": "" }, { "docid": "0403223fe1d0bb9de379b34a2a1d942e", "score": "0.49709225", "text": "func Check() {\n\tmg.Deps(TestRace, Test386, Fmt, Vet)\n}", "title": "" }, { "docid": "432b80cab56f6208ac4fbad82edefa8e", "score": "0.49602157", "text": "func(v *Venv) hasPackage(wantPackageName , wantPackgeVersion string) bool{\n\trequirements := v.listRequirements()\n\tscanner := bufio.NewScanner(strings.NewReader(requirements))\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tl:= strings.Split(line,\"==\")\n\t\thasName := l[0]\n\t\thasVersion := l[1]\n\n\t\tif hasName == wantPackageName{\n\t\t\t\n\t\t\tif hasVersion != wantPackgeVersion{\n\t\t\t\tlog.Fatalf(\"ERROR - package %s is in venv %s but version %s is different than %s \",\n\t\t\t\t\t\t\twantPackageName, v.dir.Path , wantPackgeVersion, hasVersion)\n\t\t\t}else{\n\t\t\t\tlog.Printf(\"OK - Package %s with version %s in %s vitualenv\", wantPackageName, wantPackgeVersion, v.dir.Path)\n\t\t\t\treturn true\n\t\t\t}\t\n\t\t}\n\t}\n\tlog.Fatalf(\"ERROR - package %s is not in venv %s \", wantPackageName, v.dir.Path)\n\treturn false\n}", "title": "" }, { "docid": "34f94163ff15386da7f2655dd1949e83", "score": "0.49527815", "text": "func checkSoftwareDeps(ctx context.Context) error {\n\tdeps, ok := testing.ContextSoftwareDeps(ctx)\n\tif !ok {\n\t\t// Test info can be unavailable in unit tests.\n\t\treturn nil\n\t}\n\n\tconst needed = \"chrome\"\n\tfor _, dep := range deps {\n\t\tif dep == needed {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn errors.Errorf(\"test must declare %q software dependency\", needed)\n}", "title": "" }, { "docid": "d91251ecc2458b2dfa0183ed19706994", "score": "0.49518567", "text": "func (h *SoloTestHelper) UninstallGloo() error {\n\treturn h.uninstallGloo(false)\n}", "title": "" }, { "docid": "f6df9e6b699a9ff7a94ae1ad3aee8fa4", "score": "0.49485955", "text": "func checkTools() []error {\n\tvar required = []string{\n\t\t\"losetup\",\n\t\t\"mkfs.ext3\",\n\t\t\"dmsetup\",\n\t\t\"verity\",\n\t\t\"dd\",\n\t\t\"dumpe2fs\",\n\t}\n\n\tvar missing []error\n\tfor _, tool := range required {\n\t\tif _, err := exec.LookPath(tool); err != nil {\n\t\t\tmissing = append(missing, err)\n\t\t}\n\t}\n\treturn missing\n}", "title": "" }, { "docid": "2bfc8807f8140b7f3964317f53898d22", "score": "0.49458614", "text": "func (e *env) checkFlags() error {\n\tif e.sdk == \"\" {\n\t\treturn errors.New(\"-sdk was not set\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5d77e2ce2ec7f3d3472680c0de63d988", "score": "0.49429157", "text": "func checkGit() error {\n\t_, err := exec.Command(\"git\", \"--version\").Output()\n\tif err != nil {\n\t\treturn noGitErr\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1cac6d4c41e165bd9432667a72d4634c", "score": "0.49370143", "text": "func CheckGoVet() error {\n\treturn commands.GoVet(\"./...\")\n}", "title": "" }, { "docid": "45698f7a17695c2e4134cd05fb3cd16a", "score": "0.49367833", "text": "func StockpropPubExistsGP(stockpropPubID int) bool {\n\te, err := StockpropPubExists(boil.GetDB(), stockpropPubID)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn e\n}", "title": "" }, { "docid": "46631670dac9f67f24b8e328fc78ba19", "score": "0.49350926", "text": "func CheckSystem() error {\n\treturn nil\n}", "title": "" }, { "docid": "b602713fb5ca7577bfd6a77ee4a4f4c8", "score": "0.49273884", "text": "func getInstalledGopls() string {\n\tif *goplsCommit == \"\" {\n\t\tpanic(\"must provide -gopls_commit\")\n\t}\n\ttoolsDir := filepath.Join(getTempDir(), \"tools\")\n\tgoplsPath := filepath.Join(toolsDir, \"gopls\", \"gopls\")\n\n\tinstallGoplsOnce.Do(func() {\n\t\tlog.Printf(\"installing gopls: checking out x/tools@%s\\n\", *goplsCommit)\n\t\tif err := shallowClone(toolsDir, \"https://go.googlesource.com/tools\", *goplsCommit); err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tlog.Println(\"installing gopls: building...\")\n\t\tbld := exec.Command(\"go\", \"build\", \".\")\n\t\tbld.Dir = filepath.Join(getTempDir(), \"tools\", \"gopls\")\n\t\tif output, err := bld.CombinedOutput(); err != nil {\n\t\t\tlog.Fatalf(\"building gopls: %v\\n%s\", err, output)\n\t\t}\n\n\t\t// Confirm that the resulting path now exists.\n\t\tif _, err := os.Stat(goplsPath); err != nil {\n\t\t\tlog.Fatalf(\"os.Stat(%s): %v\", goplsPath, err)\n\t\t}\n\t})\n\treturn goplsPath\n}", "title": "" }, { "docid": "6964f010a375712e63616f9c9901b055", "score": "0.49249715", "text": "func cgoCheckResult(val any) {\n\tif debug.cgocheck == 0 {\n\t\treturn\n\t}\n\n\tep := efaceOf(&val)\n\tt := ep._type\n\tcgoCheckArg(t, ep.data, t.kind&kindDirectIface == 0, false, cgoResultFail)\n}", "title": "" }, { "docid": "89f4d4e95245367899abbcc9e5a81bdd", "score": "0.4917511", "text": "func (c *Chain) Gentx(ctx context.Context, v Validator) (gentxPath string, err error) {\n\tchainID, err := c.ID()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tgentxPathMessage := &bytes.Buffer{}\n\tif err := cmdrunner.\n\t\tNew(c.cmdOptions()...).\n\t\tRun(ctx, step.New(\n\t\t\tc.plugin.GentxCommand(chainID, v),\n\t\t\tstep.Stderr(io.MultiWriter(gentxPathMessage, c.stdLog(logAppd).err)),\n\t\t\tstep.Stdout(io.MultiWriter(gentxPathMessage, c.stdLog(logAppd).out)),\n\t\t)); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn gentxRe.FindStringSubmatch(gentxPathMessage.String())[1], nil\n}", "title": "" }, { "docid": "03027d62adbb85c47b9d35cb8aebcbba", "score": "0.4914755", "text": "func (q orderItemOptionQuery) ExistsG(ctx context.Context) (bool, error) {\n\treturn q.Exists(ctx, boil.GetContextDB())\n}", "title": "" }, { "docid": "403cf4813d2d5454bd956b7eacca497a", "score": "0.49127153", "text": "func (p *Provider) NeedGC() bool {\n\treturn true\n}", "title": "" }, { "docid": "4e0af54e85514a65893a814a86287df9", "score": "0.49101353", "text": "func checkPrivileges() (bool, error) {\n\tif output, err := exec.Command(\"id\", \"-g\").Output(); err == nil {\n\t\tif gid, parseErr := strconv.ParseUint(strings.TrimSpace(string(output)), 10, 32); parseErr == nil {\n\t\t\tif gid == 0 {\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t\treturn false, ErrRootPriveleges\n\t\t}\n\t}\n\treturn false, ErrUnsupportedSystem\n}", "title": "" }, { "docid": "d40abd456878c998ac9298075b78ef62", "score": "0.49090996", "text": "func checkIfLegacyProject(pkgs map[string]*cover.Package) bool {\n\tfor _, v := range pkgs {\n\t\tif v.Module == nil {\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\tlog.Fatalln(\"Should never be reached....\")\n\treturn false\n}", "title": "" }, { "docid": "258ef3a4b3900da4badb26a8ade8cb60", "score": "0.4902057", "text": "func StockpropPubExistsG(stockpropPubID int) (bool, error) {\n\treturn StockpropPubExists(boil.GetDB(), stockpropPubID)\n}", "title": "" }, { "docid": "4531257c143a62a7b1832dbbddf109ff", "score": "0.48996422", "text": "func (g *Guestfs) Feature_available (groups []string) (bool, *GuestfsError) {\n if g.g == nil {\n return false, closed_handle_error (\"feature_available\")\n }\n\n c_groups := arg_string_list (groups)\n defer free_string_list (c_groups)\n\n r := C.guestfs_feature_available (g.g, c_groups)\n\n if r == -1 {\n return false, get_error_from_handle (g, \"feature_available\")\n }\n return r != 0, nil\n}", "title": "" }, { "docid": "0b5c2894315e18ec6a33c59ae08fbdc1", "score": "0.48985794", "text": "func getInstalledGopls() string {\n\tif *goplsCommit == \"\" {\n\t\tpanic(\"must provide -gopls_commit\")\n\t}\n\ttoolsDir := filepath.Join(getTempDir(), \"gopls_build\")\n\tgoplsPath := filepath.Join(toolsDir, \"gopls\", \"gopls\")\n\n\tinstallGoplsOnce.Do(func() {\n\t\tlog.Printf(\"installing gopls: checking out x/tools@%s into %s\\n\", *goplsCommit, toolsDir)\n\t\tif err := shallowClone(toolsDir, \"https://go.googlesource.com/tools\", *goplsCommit); err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tlog.Println(\"installing gopls: building...\")\n\t\tbld := exec.Command(\"go\", \"build\", \".\")\n\t\tbld.Dir = filepath.Join(toolsDir, \"gopls\")\n\t\tif output, err := bld.CombinedOutput(); err != nil {\n\t\t\tlog.Fatalf(\"building gopls: %v\\n%s\", err, output)\n\t\t}\n\n\t\t// Confirm that the resulting path now exists.\n\t\tif _, err := os.Stat(goplsPath); err != nil {\n\t\t\tlog.Fatalf(\"os.Stat(%s): %v\", goplsPath, err)\n\t\t}\n\t})\n\treturn goplsPath\n}", "title": "" }, { "docid": "ba2db9e52a76708418c594a96112f9f0", "score": "0.489823", "text": "func (service *HealthService) GTG() gtg.Status {\n\tfor _, check := range service.Checks {\n\t\tif _, err := check.Checker(); err != nil {\n\t\t\treturn gtg.Status{GoodToGo: false, Message: err.Error()}\n\t\t}\n\t}\n\treturn gtg.Status{GoodToGo: true}\n}", "title": "" }, { "docid": "40fc9b9491a08dfb015b2735d366e663", "score": "0.48969886", "text": "func (xdg *XDemoGroup) Exists() bool {\n\treturn xdg._exists\n}", "title": "" }, { "docid": "ffa1060737295d02b288ef543de7dc59", "score": "0.48934618", "text": "func check() {\n\tconn, client := gnoiAuthenticated(*targetCN)\n\tdefer conn.Close()\n\n\tresp, err := client.CanGenerateCSR(ctx)\n\tif err != nil {\n\t\tlog.Exit(\"Failed CanGenerateCSR:\", err)\n\t}\n\tlog.Info(\"CanGenerateCSR:\\n\", pretty.Sprint(resp))\n}", "title": "" }, { "docid": "d3b1e3663e657366e3519bd40f2a6091", "score": "0.48840588", "text": "func checkDocker() error {\n\tfmt.Println(\"Checking docker installation...\")\n\tif err := run(exec.Command(\"docker\", \"version\")); err != nil {\n\t\treturn err\n\t}\n\tfmt.Println()\n\treturn nil\n}", "title": "" }, { "docid": "37e2440b689f17a483ba623b99da8f0f", "score": "0.48732442", "text": "func checkHypervDriverInstalled() bool {\n\tposh := powershell.New()\n\n\t// check to see if a hypervisor is present. if hyper-v is installed and enabled,\n\tcheckHypervisorPresent := `@(Get-Wmiobject Win32_ComputerSystem).HypervisorPresent`\n\tstdOut, _, _ := posh.Execute(checkHypervisorPresent)\n\tif !strings.Contains(stdOut, \"True\") {\n\t\treturn false\n\t}\n\n\t// Check if Hyper-V's Virtual Machine Management Service is running\n\tcheckVmmsRunning := `@(Get-Service vmms).Status`\n\tstdOut, _, _ = posh.Execute(checkVmmsRunning)\n\tif strings.TrimSpace(stdOut) != \"Running\" {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "5eee4bf2a9eb816a5f7280784b64ce95", "score": "0.48718035", "text": "func (v Version) GTE(o Version) bool {\n\treturn (v.Compare(o) >= 0)\n}", "title": "" }, { "docid": "acf965c501bbf2210508225c21de4ca1", "score": "0.4860417", "text": "func checkPrivileges() bool {\n\tcmd := exec.Command(\"id\", \"-g\")\n\tif output, err := cmd.Output(); err == nil {\n\t\tgid := strings.TrimSpace(string(output))\n\t\treturn gid == \"0\"\n\t} else {\n\t\tlog.Println(err)\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2f17adbf246bb90e1d22f1647a972be7", "score": "0.48592085", "text": "func GofnEnvNotSet() (string, error) {\n\tif u, err := user.Current(); err == nil && len(u.HomeDir) > 0 {\n\t\treturn fmt.Sprintf(\"%s/.local/share/gofn\", u.HomeDir), nil\n\t}\n\treturn defaultPathToBinary()\n}", "title": "" }, { "docid": "7e1d310eee7df6d47cc1b7a3ec36af5c", "score": "0.48430803", "text": "func PhenotypeComparisonExistsG(phenotypeComparisonID int) (bool, error) {\n\treturn PhenotypeComparisonExists(boil.GetDB(), phenotypeComparisonID)\n}", "title": "" }, { "docid": "13db418e7eab4a653b53d95ed342ac5a", "score": "0.48408017", "text": "func checkProject(GOPATH string) bool {\n\t//if _, os.Stat(GOPATH+\"/src/\")\n\treturn true\n}", "title": "" }, { "docid": "e22ea408b0d73b498837e813eb737ca7", "score": "0.48405206", "text": "func (cmd TargetCommand) GuardHasGUN() error {\n\tif cmd.SanitizedGUN() == \"\" {\n\t\treturn ErrGunMandatory\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e5eeb7ef4f5bf9f17a20ba5f74f45065", "score": "0.48359948", "text": "func checkSystem(broot bool) error {\n\n\treturn nil\n\t// Validate the OS version. Note that docker.exe must be manifested for this\n\t// call to return the correct version.\n\tosv := system.GetOSVersion()\n\tif osv.MajorVersion < 10 {\n\t\treturn fmt.Errorf(\"This version of Windows does not support the agent daemon\")\n\t}\n\tif osv.Build < 14300 {\n\t\treturn fmt.Errorf(\"The Windows daemon requires Windows Server 2016 Technical Preview 5 build 14300 or later\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "41a6553d0600c968f9ed57ab29b17f2b", "score": "0.48359257", "text": "func isXGBoostModule(module string) bool {\n\treturn strings.HasPrefix(module, \"xgboost\")\n}", "title": "" }, { "docid": "32b826eea3dcc21d34b0e99baa4b17c6", "score": "0.48327968", "text": "func CvtermpropExistsGP(cvtermpropID int) bool {\n\te, err := CvtermpropExists(boil.GetDB(), cvtermpropID)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn e\n}", "title": "" }, { "docid": "3f6391e1968352cee0eab6c3c9ff2ba9", "score": "0.48321778", "text": "func IsFirefoxInstalled(logger *zap.Logger) bool {\n\tvar hasCertutil bool\n\tvar certutilPath string\n\n\tswitch runtime.GOOS {\n\tcase \"windows\":\n\t\tswitch {\n\t\tcase binaryExists(\"mcertutil.exe\"):\n\t\t\tcertutilPath, _ = exec.LookPath(\"mcertutil\")\n\t\t\tlogger.Sugar().Debugw(\"Certutil found\",\n\t\t\t\t\"path\", certutilPath,\n\t\t\t)\n\t\t\thasCertutil = true\n\t\tcase binaryExists(\"C:\\\\Program Files (x86)\\\\NSS\\\\NSS3\\\\mcertutil.exe\"):\n\t\t\tcertutilPath = \"C:\\\\Program Files (x86)\\\\NSS\\\\NSS3\\\\mcertutil.exe\"\n\t\t\tlogger.Sugar().Debugw(\"Certutil found\",\n\t\t\t\t\"path\", certutilPath,\n\t\t\t)\n\t\t\thasCertutil = true\n\t\tdefault:\n\t\t\tlogger.Sugar().Debugw(\"Certutil not found, please install the msi from URL\",\n\t\t\t\t\"url\", nssToolURL,\n\t\t\t)\n\t\t}\n\t\tif !hasCertutil {\n\t\t\treturn false\n\t\t}\n\n\tdefault:\n\t\tlogger.Sugar().Debugw(\"OS not supported\",\n\t\t\t\"OS\", runtime.GOOS,\n\t\t)\n\t\treturn false\n\n\t}\n\treturn true\n}", "title": "" }, { "docid": "7b7c7ee954534679ec21097b18b16f7c", "score": "0.48304144", "text": "func checkForMoodbar() {\n\tcmd := exec.Command(\"moodbar\", \"--help\")\n\tif err := cmd.Run(); err != nil {\n\t\tlog.Printf(\"Could not execute `moodbar --help` - is it installed?\")\n\t\tlog.Printf(\"Error was: %v\", err)\n\t\tos.Exit(-1)\n\t}\n}", "title": "" }, { "docid": "2670f63f8896c4ddbe2d4b8043003efc", "score": "0.4823592", "text": "func checkGmsCoreVersion(ctx context.Context, a *arc.ARC, systemSdkVersion int) error {\n\t// Regexp for matching a GMSCore version string in logcat.\n\t// e.g. \"com.google.android.gms@212013032@21.20.13 (100800-374639054)\"\n\tgmscoreVersionRegexp := regexp.MustCompile(\n\t\t`com\\.google\\.android\\.gms@\\d+@\\d+\\.\\d+\\.\\d+ \\((\\d{6})-\\d+\\)`)\n\n\tout, err := a.Command(ctx, \"logcat\", \"-d\").Output(testexec.DumpLogOnError)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to run logcat\")\n\t}\n\n\tvar fullVersionString string\n\tvar versionCode int\n\tfor _, line := range strings.Split(string(out), \"\\n\") {\n\t\tm := gmscoreVersionRegexp.FindStringSubmatch(line)\n\t\tif len(m) == 2 {\n\t\t\tfullVersionString = m[0]\n\t\t\tversionCode, _ = strconv.Atoi(m[1])\n\t\t\tbreak\n\t\t}\n\t}\n\tif len(fullVersionString) == 0 {\n\t\treturn errors.New(\"failed to find GMSCore version string in logcat\")\n\t}\n\ttesting.ContextLogf(ctx, \"ARC is using GMSCore of version %q\", fullVersionString)\n\n\t// Checks \"variant\" in GMSCore version string. Reference: go/gmscore-decoder-ring\n\tvar expectedVariant int\n\tswitch systemSdkVersion {\n\tcase 28:\n\t\t// Skip checking variant for ARC P.\n\t\treturn nil\n\tcase 30:\n\t\texpectedVariant = 15 // PROD_RVC\n\tcase 31:\n\t\texpectedVariant = 19 // PROD_SC\n\tdefault:\n\t\treturn errors.Errorf(\"unexpected system SDK version: %d\", systemSdkVersion)\n\t}\n\tvariant := versionCode / 10000\n\tif variant != expectedVariant {\n\t\treturn errors.Errorf(\"ARC is using GMSCore of unexpected variant: got %d; want %d. Found GMSCore version: %q\",\n\t\t\tvariant, expectedVariant, fullVersionString)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "83e48c93182b541f548c51926bddb3e5", "score": "0.48171994", "text": "func CheckOrgExternalServices(ctx context.Context, db database.DB, orgID int32) error {\n\tenabled, err := db.FeatureFlags().GetOrgFeatureFlag(ctx, orgID, \"org-code\")\n\tif err != nil {\n\t\treturn err\n\t} else if enabled {\n\t\treturn nil\n\t}\n\n\treturn errors.New(\"organization code host connections are not enabled\")\n}", "title": "" }, { "docid": "fc43b633af52ec33f6233877001b2eef", "score": "0.48096767", "text": "func checkKmod() error {\n\n\tkmods := []string{\n\t\t\"nf_conntrack_ipv4\",\n\t\t\"nf_conntrack_ipv6\",\n\t}\n\n\tfor _, km := range kmods {\n\t\tif _, err := os.Stat(fmt.Sprintf(\"/sys/module/%s\", km)); os.IsNotExist(err) {\n\t\t\treturn fmt.Errorf(\"required kernel module not loaded: %s\", km)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6491ed05543e18cafd027bedeb87c515", "score": "0.48092264", "text": "func testGouging(t *testing.T) {\n\t// Create some defaults to get some intuitive ideas for gouging.\n\t//\n\t// 100 workers and 1e9 expected download means ~2e6 HasSector queries will\n\t// be performed.\n\tpt := modules.RPCPriceTable{\n\t\tInitBaseCost: types.NewCurrency64(1e3),\n\t\tDownloadBandwidthCost: types.NewCurrency64(1e3),\n\t\tUploadBandwidthCost: types.NewCurrency64(1e3),\n\t\tHasSectorBaseCost: types.NewCurrency64(1e6),\n\t}\n\tallowance := modules.Allowance{\n\t\tMaxDownloadBandwidthPrice: types.NewCurrency64(2e3),\n\t\tMaxUploadBandwidthPrice: types.NewCurrency64(2e3),\n\n\t\tFunds: types.NewCurrency64(1e18),\n\n\t\tExpectedDownload: 1e9, // 1 GiB\n\t}\n\tnumWorkers := 100\n\tnumRoots := 30\n\n\t// Check that the gouging passes for normal values.\n\terr := checkPCWSGouging(pt, allowance, numWorkers, numRoots)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\t// Check with high init base cost.\n\tpt.InitBaseCost = types.NewCurrency64(1e12)\n\terr = checkPCWSGouging(pt, allowance, numWorkers, numRoots)\n\tif err == nil {\n\t\tt.Error(\"bad\")\n\t}\n\tpt.InitBaseCost = types.NewCurrency64(1e3)\n\n\t// Check with high upload bandwidth cost.\n\tpt.UploadBandwidthCost = types.NewCurrency64(1e12)\n\terr = checkPCWSGouging(pt, allowance, numWorkers, numRoots)\n\tif err == nil {\n\t\tt.Error(\"bad\")\n\t}\n\tpt.UploadBandwidthCost = types.NewCurrency64(1e3)\n\n\t// Check with high download bandwidth cost.\n\tpt.DownloadBandwidthCost = types.NewCurrency64(1e12)\n\terr = checkPCWSGouging(pt, allowance, numWorkers, numRoots)\n\tif err == nil {\n\t\tt.Error(\"bad\")\n\t}\n\tpt.DownloadBandwidthCost = types.NewCurrency64(1e3)\n\n\t// Check with high HasSector cost.\n\tpt.HasSectorBaseCost = types.NewCurrency64(1e12)\n\terr = checkPCWSGouging(pt, allowance, numWorkers, numRoots)\n\tif err == nil {\n\t\tt.Error(\"bad\")\n\t}\n\tpt.HasSectorBaseCost = types.NewCurrency64(1e6)\n\n\t// Check with low MaxDownloadBandwidthPrice.\n\tallowance.MaxDownloadBandwidthPrice = types.NewCurrency64(100)\n\terr = checkPCWSGouging(pt, allowance, numWorkers, numRoots)\n\tif err == nil {\n\t\tt.Error(\"bad\")\n\t}\n\tallowance.MaxDownloadBandwidthPrice = types.NewCurrency64(2e3)\n\n\t// Check with low MaxUploadBandwidthPrice.\n\tallowance.MaxUploadBandwidthPrice = types.NewCurrency64(100)\n\terr = checkPCWSGouging(pt, allowance, numWorkers, numRoots)\n\tif err == nil {\n\t\tt.Error(\"bad\")\n\t}\n\tallowance.MaxUploadBandwidthPrice = types.NewCurrency64(2e3)\n\n\t// Check with reduced funds.\n\tallowance.Funds = types.NewCurrency64(1e15)\n\terr = checkPCWSGouging(pt, allowance, numWorkers, numRoots)\n\tif err == nil {\n\t\tt.Error(\"bad\")\n\t}\n\tallowance.Funds = types.NewCurrency64(1e18)\n\n\t// Check with increased expected download.\n\tallowance.ExpectedDownload = 1e12\n\terr = checkPCWSGouging(pt, allowance, numWorkers, numRoots)\n\tif err == nil {\n\t\tt.Error(\"bad\")\n\t}\n\tallowance.ExpectedDownload = 1e9\n\n\t// Check that the base allowanace still passes. (ensures values have been\n\t// reset correctly)\n\terr = checkPCWSGouging(pt, allowance, numWorkers, numRoots)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n}", "title": "" }, { "docid": "6b9003541fd702e58b472d025e969fd6", "score": "0.48091254", "text": "func Available() bool {\n\terr := dll.Load()\n\treturn err == nil && dll.VJoyEnabled()\n}", "title": "" }, { "docid": "2d9b0cf7604eb7a0525225e0a4962e5d", "score": "0.48061964", "text": "func CheckPackageInstalled(system string) ([]byte, error) {\n\tvar cmd *exec.Cmd\n\tswitch system {\n\tcase \"alpine\":\n\t\tcmd = exec.Command(\"apk info\")\n\t// case \"osx\":\n\t// \tcmd = exec.Command(\"pkgutil --pkgs\")\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"system not supported.\")\n\t}\n\tvar out bytes.Buffer\n\tcmd.Stdout = &out\n\terr := cmd.Run()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata := sha256.New().Sum(out.Bytes())\n\treturn data, nil\n}", "title": "" }, { "docid": "18325373bc52d13af3b5b3ed10b65098", "score": "0.48030123", "text": "func (g *git) check() error {\n\t_, err := exec.LookPath(\"git\")\n\tif err != nil {\n\t\treturn ErrNoGit\n\t}\n\terr = g.Command(\"git\", \"status\").Run()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"bumpversion: git: not a repository: %s\", g.C)\n\t}\n\terr = g.Command(\"git\", \"remote\", \"get-url\", g.Remote).Run()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"bumpversion: git: no such remote: %s\", g.Remote)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9fe4179c02e76b42f0687289d2c13c1d", "score": "0.48013154", "text": "func (d Dependency) hasVendors() bool { return d.Vendors != nil }", "title": "" }, { "docid": "838bcc90f29f2c996539b15b5b3a5821", "score": "0.47996855", "text": "func (grq *GithubReleaseQuery) ExistX(ctx context.Context) bool {\n\texist, err := grq.Exist(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn exist\n}", "title": "" }, { "docid": "84a9772df96b8d463e8d78f86ceb9616", "score": "0.4797335", "text": "func (exp *AppExpectation) checkBaseOS(baseOS *config.BaseOS) bool {\n\tif baseOS == nil {\n\t\treturn false\n\t}\n\treturn baseOS.BaseOsVersion == exp.getBaseOSVersion()\n}", "title": "" }, { "docid": "d7ad9d547bade5ef880c1e344a2978d4", "score": "0.4796573", "text": "func sanityCheck() error {\n\tswitch {\n\t// Check if we are running Linux.\n\tcase runtime.GOOS != \"linux\":\n\t\treturn fmt.Errorf(\"this program can only run under Linux\")\n\t// Check if we are running on an AMD processor.\n\tcase cpuid.CPU.VendorID != cpuid.AMD:\n\t\treturn fmt.Errorf(\"this is not an AMD processor\")\n\t// Check if it is the right family, 17h (Zen).\n\tcase cpuid.CPU.Family != amdZenFamily:\n\t\treturn fmt.Errorf(\"wrong family of AMD processors; expected 23 (17h), got %d\", cpuid.CPU.Family)\n\t// Check if we are running as root.\n\tcase os.Geteuid() != 0:\n\t\treturn fmt.Errorf(\"you need to be root to use this program\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d0705afea2e906ac9250e094542b5a45", "score": "0.47946292", "text": "func (q userKycDocumentQuery) ExistsG() (bool, error) {\n\treturn q.Exists(boil.GetDB())\n}", "title": "" }, { "docid": "0a21e37d74d7d5d9173d1a2b44b0d4a6", "score": "0.47922948", "text": "func PanicIfMissingEnv() {\n\tif os.Getenv(\"PINGDOM_EMAIL_ADDRESS\") == \"\" || os.Getenv(\"PINGDOM_PASSWORD\") == \"\" || os.Getenv(\"PINGDOM_APP_KEY\") == \"\" {\n\t\tpanic(\"Please ensure the environment variables PINGDOM_EMAIL_ADDRESS, PINGDOM_PASSWORD, and PINGDOM_APP_KEY are set for acceptance tests\")\n\t}\n}", "title": "" }, { "docid": "d69b7bad8966ea2dd4282a0eb5506863", "score": "0.47814798", "text": "func ClientExistsGP(id int) bool {\n\te, err := ClientExists(boil.GetDB(), id)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn e\n}", "title": "" }, { "docid": "94acc7c74e8cadec1de8e1e6b53218b6", "score": "0.47810146", "text": "func main() {\n\te := gexe.New()\n\te.Conf.SetPanicOnErr(false)\n\te.Vars(\"MYUSERNAME=$USER\")\n\tif e.Eval(\"$MYUSERNAME\") == \"\" {\n\t\tfmt.Println(\"You were not found\")\n\t\tos.Exit(1)\n\t}\n\n\tfmt.Printf(\"Hello %s !!! \\n\", e.Eval(\"$MYUSERNAME\"))\n}", "title": "" }, { "docid": "81008f4db54b629a5360dd7bde8dd03a", "score": "0.47738114", "text": "func GoauthExistsG(username string) (bool, error) {\n\treturn GoauthExists(boil.GetDB(), username)\n}", "title": "" }, { "docid": "825a587e167a9acb3c6739131c352c1b", "score": "0.47691268", "text": "func (g *Guestfs) Is_ready () (bool, *GuestfsError) {\n if g.g == nil {\n return false, closed_handle_error (\"is_ready\")\n }\n\n r := C.guestfs_is_ready (g.g)\n\n if r == -1 {\n return false, get_error_from_handle (g, \"is_ready\")\n }\n return r != 0, nil\n}", "title": "" }, { "docid": "3cedbb681dab6298dad6f4480abdee27", "score": "0.47689113", "text": "func checkInitialized(t *testing.T) {\n\t_, err := os.Stat(goblog.Src)\n\tif err != nil {\n\t\tt.Fatalf(\"src directory not found: %v\", err)\n\t}\n\t_, err = os.Stat(path.Join(goblog.Src, \".git\"))\n\tif err != nil {\n\t\tt.Fatalf(\"src directory is not a git repository: %v\", err)\n\t}\n\t_, err = os.Stat(path.Join(goblog.Home, \"bin\"))\n\tif err != nil {\n\t\tt.Fatalf(\"bin directory not found: %v\", err)\n\t}\n\t_, err = os.Stat(path.Join(goblog.Home, \"bin/goblog\"))\n\tif err != nil {\n\t\tt.Fatalf(\"goblog binary not found: %v\", err)\n\t}\n}", "title": "" }, { "docid": "c3a3f1c43f7f8a0bbdb5ee768f681a5c", "score": "0.4768356", "text": "func ProductVersionExistsGP(productVersionID int) bool {\n\te, err := ProductVersionExists(boil.GetDB(), productVersionID)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn e\n}", "title": "" } ]
88ceb249c08eb2ba78ade5a149538597
Position2Decimal convert position "DD MM.SS S" to decimal position
[ { "docid": "2a074f5a4e5da86297f50e8f86dce92b", "score": "0.7903606", "text": "func Position2Decimal(pos string) (float64, error) {\n\n\tvar multiplier float64 = 1\n\tvar value float64\n\n\tvar regNmeaPos = regexp.MustCompile(`(\\d+)\\s+(\\d+.\\d+)\\s+(\\w)`)\n\n\tif strings.Contains(pos, \"S\") || strings.Contains(pos, \"W\") {\n\t\tmultiplier = -1.0\n\t}\n\tmatch := regNmeaPos.MatchString(pos)\n\tif match {\n\t\tres := regNmeaPos.FindStringSubmatch(pos)\n\t\tdeg, _ := strconv.ParseFloat(res[1], 64)\n\t\tmin, _ := strconv.ParseFloat(res[2], 64)\n\t\ttmp := math.Abs(min)\n\t\tsec := (tmp - min) * 100.0\n\t\tvalue = (deg + (min+sec/100.0)/60.0) * multiplier\n\t\tfmt.Fprintln(debug, \"positionDeci:\", pos, \" -> \", value)\n\t} else {\n\t\treturn 1e36, errors.New(\"positionDeci: failed to decode position\")\n\t}\n\treturn value, nil\n}", "title": "" } ]
[ { "docid": "bbae4ecccf56cbb9de2191ec0d630254", "score": "0.6832533", "text": "func DecimalPosition2String(position float64, hemi string) string {\n\tvar neg, pos, geo rune\n\tvar str string\n\n\tif strings.Contains(hemi, \"EW\") {\n\t\tneg = 'W'\n\t\tpos = 'E'\n\t} else {\n\t\tneg = 'S'\n\t\tpos = 'N'\n\t}\n\tif position < 0 {\n\t\tgeo = neg\n\t} else {\n\t\tgeo = pos\n\t}\n\ttmp := math.Abs(position)\n\tdeg := int(tmp)\n\ttmp = (tmp - float64(deg)) * 60\n\tmin := tmp\n\n\tif strings.Contains(hemi, \"EW\") {\n\t\tstr = fmt.Sprintf(\"%03d%s%06.3f %c\", deg, \"\\u00B0\", min, geo)\n\t} else {\n\t\tstr = fmt.Sprintf(\"%02d%s%06.3f %c\", deg, \"\\u00B0\", min, geo)\n\t}\n\treturn str\n}", "title": "" }, { "docid": "0a1f83154d093411597cf8176b780d9e", "score": "0.62810165", "text": "func (c coordinate) decimal() float64 {\n\tsign := 1.0\n\tswitch c.h {\n\tcase 'S', 'W', 's', 'w':\n\t\tsign = -1\n\t}\n\treturn sign * (c.d + c.m/60 + c.s/3600)\n}", "title": "" }, { "docid": "0a1f83154d093411597cf8176b780d9e", "score": "0.62810165", "text": "func (c coordinate) decimal() float64 {\n\tsign := 1.0\n\tswitch c.h {\n\tcase 'S', 'W', 's', 'w':\n\t\tsign = -1\n\t}\n\treturn sign * (c.d + c.m/60 + c.s/3600)\n}", "title": "" }, { "docid": "aae2e4ae282c06b6b04e5e8a7f45a995", "score": "0.5928937", "text": "func (c coordinate) decimal() float64 {\n\tsign := 1.0\n\n\t//changing sign depending on hemisphere\n\tswitch c.h {\n\tcase 'S', 's', 'W', 'w':\n\t\tsign = -1\n\t}\n\treturn sign * (c.d + c.m/60 + c.s/3600)\n}", "title": "" }, { "docid": "ac869b665fa29a9ed6313ab9c3ffc0b7", "score": "0.5337902", "text": "func ParseDecimal(text *string) int {\n\t// TODO: implement\n}", "title": "" }, { "docid": "8d90348cd59c5d0babd878e0a95ff05f", "score": "0.524186", "text": "func StringToSaldoWithDecimal(stringSaldoBody, stringSaldoDecimal string) (Resultado float64) {\n\n\tResultado, errs := strconv.ParseFloat(stringSaldoBody+\".\"+stringSaldoDecimal, 64)\n\n\tif errs != nil {\n\n\t\tlog.Println(errs)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "a5ef00866eca91385407b3b0d311091b", "score": "0.5224619", "text": "func convertToPenceFromDecimal(decimalPayment string) (int, error) {\n\tpencePayment := strings.Replace(decimalPayment, \".\", \"\", 1)\n\treturn strconv.Atoi(pencePayment)\n}", "title": "" }, { "docid": "0504d2fa46a2359c9346b1da0d1a9e36", "score": "0.5181729", "text": "func ConvertStringToAmount(s string, decimalSep string, thousandSep string) (int64, error) {\n\ts = strings.ReplaceAll(s, \" \", \"\")\n\tif thousandSep != \"\" {\n\t\ts = strings.ReplaceAll(s, thousandSep, \"\")\n\t}\n\tl := len(s)\n\tsepPos := strings.LastIndex(s, decimalSep)\n\tif sepPos != -1 {\n\t\ts = strings.ReplaceAll(s, decimalSep, \"\")\n\t}\n\tswitch sepPos {\n\tcase -1: //int number\n\t\ts += \"00\"\n\tcase l - 1: //decimal separator was on last char\n\t\ts += \"00\" //x100\n\tcase l - 2: //one digit only for the decimal part\n\t\ts += \"0\"\n\tcase l - 3: //2digits:\n\t\t//nothing to do\n\tdefault:\n\t\t//more than 2 digits after the decimal point. Weird, let's cut the decimal part after 2 digits\n\t\ts = s[0 : sepPos+2]\n\t\tfmt.Printf(\"Apres %s\\n\", s)\n\t}\n\n\t//still here ? we now have a string without spaces and separators.\n\treturn strconv.ParseInt(s, 10, 64)\n}", "title": "" }, { "docid": "1cbbc38a963830470a1f41b6a09919e4", "score": "0.5148726", "text": "func (f *FormatterBase) IndexOfDecimalPoint(s string) int {\n\ti := strings.LastIndex(s, \".\")\n\tif i < 0 {\n\t\ti = strings.LastIndex(s, \"e\")\n\t}\n\tif i < 0 {\n\t\ti = strings.LastIndex(s, \"E\")\n\t}\n\tif i < 0 {\n\t\ti = len(s)\n\t}\n\treturn i\n}", "title": "" }, { "docid": "44ae3f6b34bc4a6fefe3a077039a36ea", "score": "0.50715905", "text": "func convert(s string) float64 {\n\tvar x float64\n\tx, _ = strconv.ParseFloat(s, 64)\n\treturn x\n}", "title": "" }, { "docid": "170a7ad2287ed3a6ef6ecd15bdebf5a0", "score": "0.50207657", "text": "func getDecimalFromFraction(slice []string) string {\n\tif len(slice) == 0 {\n\t\treturn \"\"\n\t}\n\n\tfractionSlice := strings.Split(slice[0], \"/\")\n\n\texpectedLength := 2\n\tif len(fractionSlice) != expectedLength {\n\t\treturn \"\"\n\t}\n\n\tnumerator, err := strconv.Atoi(fractionSlice[0])\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\n\tdenominator, err := strconv.Atoi(fractionSlice[1])\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\n\tv := float64(numerator) / float64(denominator)\n\n\tbitSize := 64\n\n\treturn strconv.FormatFloat(v, 'f', -1, bitSize)\n}", "title": "" }, { "docid": "b5b199b46f4b62a3764e53cc8586e66c", "score": "0.5018383", "text": "func secsToMs(secs, remainder string) (int64, error) {\n\tparsed, err := strconv.ParseInt(secs, 10, 64)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tms, err := bugreportutils.SecFractionAsMs(remainder)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn (parsed * 1000) + ms, nil\n}", "title": "" }, { "docid": "2dead78335e1ffac6faf60c5b66116c2", "score": "0.5005336", "text": "func StatToSeconds(stat string) (float64, error) {\n\n\t// First parse out the ms, s, us, and the amount\n\tr := regexp.MustCompile(\"([0-9]+[.]?[0-9]*)([a-z]{1,2})\")\n\n\tresults := r.FindStringSubmatch(stat)\n\n\tif len(results) > 1 {\n\t\tvalueStr := results[1]\n\t\tvalue, err := strconv.ParseFloat(valueStr, 10)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\ttime := results[2]\n\n\t\tswitch time {\n\t\tcase \"us\":\n\t\t\t// microseconds to seconds\n\t\t\tconvValue := value / 1000000\n\t\t\treturn convValue, nil\n\t\tcase \"ms\":\n\t\t\t// milliseconds to seconds\n\t\t\tconvValue := value / 1000\n\t\t\treturn convValue, nil\n\t\tcase \"s\":\n\t\t\treturn value, nil\n\t\tcase \"m\":\n\t\t\t// minutes to seconds\n\t\t\tconvValue := value * 60\n\t\t\treturn convValue, nil\n\t\tcase \"h\":\n\t\t\t// hours to seconds\n\t\t\tconvValue := value * 3600\n\t\t\treturn convValue, nil\n\t\t}\n\t}\n\n\treturn 0, errors.New(\"Failed to parse time string from beego\")\n\n}", "title": "" }, { "docid": "fbb0dd17cb2864c629ccd30f5316aac9", "score": "0.49347156", "text": "func ParseDecimalVersion(s string) (dv DecimalVersion, err error) {\n\n\tvar val uint32\n\ts = strings.TrimSpace(s)\n\tparts := strings.Split(s, `.`)\n\tif len(parts) > 4 {\n\t\terr = TooManyPartsInVersion\n\t}\n\tif err == nil {\n\t\tfor i := uint(0); i < uint(len(parts)); i++ {\n\t\t\tvar n uint64\n\t\t\tn, err = strconv.ParseUint(parts[i], 10, 8)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tval += uint32(n) << (i * 8)\n\t\t}\n\t\tdv = DecimalVersion(val)\n\t}\n\treturn\n}", "title": "" }, { "docid": "c38c2401a3fc422376ce7d27c2ec0542", "score": "0.4919755", "text": "func extractNum(s string) float64 {\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\n\tnumMap := initNumMap()\n\tnumFound := false\n\tresult := float64(1)\n\tdecimalBit := 0\n\tfor i := 0; i < len(s); i++ {\n\t\tcurrent := s[i : i+1]\n\t\tif current == \" \" && !numFound {\n\t\t\tcontinue\n\t\t} else if current == \"-\" && !numFound {\n\t\t\tif i+1 < len(s) {\n\t\t\t\tif _, ok := numMap[s[i+1:i+2]]; ok {\n\t\t\t\t\tresult = float64(-1)\n\t\t\t\t}\n\t\t\t}\n\t\t} else if v, ok := numMap[current]; ok {\n\t\t\tif numFound {\n\t\t\t\tif s[i-1:i] == \".\" || decimalBit != 0 {\n\t\t\t\t\tdecimalBit++\n\t\t\t\t}\n\n\t\t\t\tif decimalBit == 0 {\n\t\t\t\t\tif result < 0 {\n\t\t\t\t\t\tresult = result*float64(10) - float64(v)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult = result*float64(10) + float64(v)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif result < 0 {\n\t\t\t\t\t\tresult -= float64(v) / math.Pow(float64(10), float64(decimalBit))\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult += float64(v) / math.Pow(float64(10), float64(decimalBit))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnumFound = true\n\t\t\t\tresult = result * float64(v)\n\t\t\t}\n\t\t}\n\t}\n\n\tif !numFound {\n\t\treturn 0\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "c0c1fdc293fae70383c62ece6b64f558", "score": "0.48948595", "text": "func DecimalValueFromString(numStr string, fracDigRequired int) (n Number, err error) {\n\tif fracDigRequired > int(MaxFractionDigits) {\n\t\treturn n, fmt.Errorf(\"too many fraction digits %d > max of %d\", fracDigRequired, MaxFractionDigits)\n\t}\n\n\ts := numStr\n\tdx := strings.Index(s, \".\")\n\tfracDig := 0\n\tif dx >= 0 {\n\t\tfracDig = len(s) - 1 - dx\n\t\t// remove first decimal, if dx > 1, will fail ParseInt below\n\t\ts = s[:dx] + s[dx+1:]\n\t}\n\tif fracDigRequired < 0 {\n\t\tfracDigRequired = fracDig\n\t}\n\tif fracDig > fracDigRequired {\n\t\treturn n, fmt.Errorf(\"%s has too much precision, expect <= %d fractional digits\", s, fracDigRequired)\n\t}\n\n\ts += space18[:fracDigRequired-fracDig]\n\n\tv, err := strconv.ParseInt(s, 10, 64)\n\tif err != nil {\n\t\treturn n, fmt.Errorf(\"%s is not a valid decimal number: %s\", numStr, err)\n\t}\n\n\tkind := Positive\n\tif v < 0 {\n\t\tkind = Negative\n\t\tv = -v\n\t}\n\n\treturn Number{Kind: kind, Value: uint64(v), FractionDigits: uint8(fracDig)}, nil\n}", "title": "" }, { "docid": "c22c44f0f1c7f4bbfb2790458c6e4b91", "score": "0.4876819", "text": "func DecimalFormat(d decimal.Decimal, opts *Options) (formatted string) {\n\tdefer func() {\n\t\tformatted = removeNonBreakingSpace(formatted)\n\t}()\n\n\tbuf := &bytes.Buffer{}\n\ts := d.String()\n\tparts := strings.Split(s, \".\")\n\tif opts.decimalPlaces != nil && len(parts) > 1 && *opts.decimalPlaces < uint(len(parts[1])) {\n\t\ts = d.StringFixed(int32(*opts.decimalPlaces))\n\t}\n\n\tif d.Sign() < 0 {\n\t\ts = s[1:]\n\t\tbuf.WriteByte('-')\n\t\td.Abs()\n\t}\n\n\tparts = strings.Split(s, \".\")\n\tbuf.WriteString(formatGroup(parts[0], opts.groupSize, opts.secondaryGroupSize, opts.groupSeparator))\n\tif len(parts) == 1 && (opts.decimalPlaces == nil || *opts.decimalPlaces == 0) {\n\t\treturn buf.String()\n\t}\n\n\tif opts.decimalPlaces != nil {\n\t\tif len(parts) == 1 {\n\t\t\tparts = append(parts, \"\")\n\t\t}\n\n\t\tif size := *opts.decimalPlaces - uint(len(parts[1])); size > 0 {\n\t\t\tparts[1] += fmt.Sprintf(\"%0*d\", size, 0)\n\t\t}\n\n\t\tparts[1] = parts[1][:*opts.decimalPlaces]\n\t}\n\n\tbuf.WriteByte(opts.decimalSeparator)\n\tbuf.WriteString(formatFraction(parts[1], opts.fractionGroupSize, opts.fractionGroupSeparator))\n\n\treturn strings.TrimRight(buf.String(), string(opts.fractionGroupSeparator))\n}", "title": "" }, { "docid": "cfe79998ad4a2304b222d6d64f67b2a1", "score": "0.4837872", "text": "func toInt(s string) int64 {\n\tsl := strings.Split(s, \".\")\n\ts = sl[0]\n\tnum, err := strconv.ParseInt(s, 10, 64)\n\tif err != nil {\n\t\tfmt.Println(\"error converting string to int\", err)\n\t\treturn 0\n\t}\n\treturn num\n}", "title": "" }, { "docid": "1899b9b8694d7bd894854908558641e3", "score": "0.47958666", "text": "func ParseDDecimal(s string) (*DDecimal, error) {\n\tdd := &DDecimal{}\n\terr := dd.SetString(s)\n\treturn dd, err\n}", "title": "" }, { "docid": "ab2376a2cc8df2b195db6cf2c2647e1f", "score": "0.47902095", "text": "func deg2dec(lat, long string) (lt, lg float64) {\n\tlatd, err := strconv.ParseFloat(lat[:2], 64)\n\tlatm, err := strconv.ParseFloat(lat[3:5], 64)\n\tlongd, err := strconv.ParseFloat(long[:3], 64)\n\tlongm, err := strconv.ParseFloat(long[4:6], 64)\n\tif err != nil {\n\t\treturn 999.0, 999.0\n\t}\n\n\tlt = latd + latm/60\n\tlg = longd + longm/60\n\n\tif string(lat[5]) == \"S\" {\n\t\tlt *= -1\n\t}\n\tif string(long[6]) == \"W\" {\n\t\tlg *= -1\n\t}\n\treturn lt, lg\n}", "title": "" }, { "docid": "175bb0074c6f01a64ca30ad8ceb80355", "score": "0.47292376", "text": "func readFloat(s string) (mantissa uint64, exp int, neg, trunc, ok bool) {\n\tconst uint64digits = 19\n\ti := 0\n\n\t// optional sign\n\tif i >= len(s) {\n\t\treturn\n\t}\n\tswitch {\n\tcase s[i] == '+':\n\t\ti++\n\tcase s[i] == '-':\n\t\tneg = true\n\t\ti++\n\t}\n\n\t// digits\n\tsawdot := false\n\tsawdigits := false\n\tnd := 0\n\tndMant := 0\n\tdp := 0\n\tfor ; i < len(s); i++ {\n\t\tswitch c := s[i]; true {\n\t\tcase c == '.':\n\t\t\tif sawdot {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsawdot = true\n\t\t\tdp = nd\n\t\t\tcontinue\n\n\t\tcase '0' <= c && c <= '9':\n\t\t\tsawdigits = true\n\t\t\tif c == '0' && nd == 0 { // ignore leading zeros\n\t\t\t\tdp--\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tnd++\n\t\t\tif ndMant < uint64digits {\n\t\t\t\tmantissa *= 10\n\t\t\t\tmantissa += uint64(c - '0')\n\t\t\t\tndMant++\n\t\t\t} else if s[i] != '0' {\n\t\t\t\ttrunc = true\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tbreak\n\t}\n\tif !sawdigits {\n\t\treturn\n\t}\n\tif !sawdot {\n\t\tdp = nd\n\t}\n\n\t// optional exponent moves decimal point.\n\t// if we read a very large, very long number,\n\t// just be sure to move the decimal point by\n\t// a lot (say, 100000). it doesn't matter if it's\n\t// not the exact number.\n\tif i < len(s) && (s[i] == 'e' || s[i] == 'E') {\n\t\ti++\n\t\tif i >= len(s) {\n\t\t\treturn\n\t\t}\n\t\tesign := 1\n\t\tif s[i] == '+' {\n\t\t\ti++\n\t\t} else if s[i] == '-' {\n\t\t\ti++\n\t\t\tesign = -1\n\t\t}\n\t\tif i >= len(s) || s[i] < '0' || s[i] > '9' {\n\t\t\treturn\n\t\t}\n\t\te := 0\n\t\tfor ; i < len(s) && '0' <= s[i] && s[i] <= '9'; i++ {\n\t\t\tif e < 10000 {\n\t\t\t\te = e*10 + int(s[i]) - '0'\n\t\t\t}\n\t\t}\n\t\tdp += e * esign\n\t}\n\n\tif i != len(s) {\n\t\treturn\n\t}\n\n\texp = dp - ndMant\n\tok = true\n\treturn\n\n}", "title": "" }, { "docid": "fd130fd196236842cec8396fac323473", "score": "0.4712543", "text": "func StringToDecimal(s string) decimal.Decimal {\n\td, err := decimal.NewFromString(s)\n\tif err != nil {\n\t\tpanic(errors.Wrapf(err, \"error parsing %[1]s to decimal.Decimal\", s))\n\t}\n\n\treturn d\n}", "title": "" }, { "docid": "a092cbb97e39006ad340e93329934964", "score": "0.46874398", "text": "func transSGFToPoint03(sgfPt string) sgfPointStrct01 {\n\tsgfPtX := string(sgfPt[0])\n\tsgfPtY := sgfPt[1]\n\treturn sgfPointStrct01{\n\t\tx: sgfPtX,\n\t\ty: int(sgfPtY) - 97,\n\t}\n}", "title": "" }, { "docid": "f1d5d5c1318869edd5f9e679b813a25e", "score": "0.46633926", "text": "func StringToAmount(s string) (massutil.Amount, error) {\n\ts1 := strings.Split(s, \".\")\n\tif len(s1) > 2 {\n\t\treturn massutil.ZeroAmount(), fmt.Errorf(\"illegal number format\")\n\t}\n\tvar sInt, sFrac string\n\t// preproccess integral part\n\tsInt = strings.TrimLeft(s1[0], \"0\")\n\tif len(sInt) == 0 {\n\t\tsInt = \"0\"\n\t}\n\t// preproccess fractional part\n\tif len(s1) == 2 {\n\t\tsFrac = strings.TrimRight(s1[1], \"0\")\n\t\tif len(sFrac) > 8 {\n\t\t\treturn massutil.ZeroAmount(), fmt.Errorf(\"precision is too high\")\n\t\t}\n\t}\n\tsFrac += strings.Repeat(\"0\", 8-len(sFrac))\n\n\t// convert\n\ti, err := strconv.ParseInt(sInt, 10, 64)\n\tif err != nil {\n\t\treturn massutil.ZeroAmount(), err\n\t}\n\tif i < 0 || uint64(i) > consensus.MaxMass {\n\t\treturn massutil.ZeroAmount(), fmt.Errorf(\"integral part is out of range\")\n\t}\n\n\tf, err := strconv.ParseInt(sFrac, 10, 64)\n\tif err != nil {\n\t\treturn massutil.ZeroAmount(), err\n\t}\n\tif f < 0 {\n\t\treturn massutil.ZeroAmount(), fmt.Errorf(\"illegal number format\")\n\t}\n\n\tu := safetype.NewUint128FromUint(consensus.MaxwellPerMass)\n\tu, err = u.MulInt(i)\n\tif err != nil {\n\t\treturn massutil.ZeroAmount(), err\n\t}\n\tu, err = u.AddInt(f)\n\tif err != nil {\n\t\treturn massutil.ZeroAmount(), err\n\t}\n\ttotal, err := massutil.NewAmount(u)\n\tif err != nil {\n\t\treturn massutil.ZeroAmount(), err\n\t}\n\treturn total, nil\n}", "title": "" }, { "docid": "7c518430d46849763aae16342efafcb7", "score": "0.4660173", "text": "func DecimalToPrecision(f float64, roundingMode int, numPrecisionDigits int, countingMode int, paddingMode int) (string, error) {\n\tif numPrecisionDigits < 0 {\n\t\treturn \"\", fmt.Errorf(\"negative precision not supported\")\n\t}\n\n\tvar str = NumberToString(f)\n\tvar isNegative = str[0] == '-'\n\tvar strStart, strEnd = 0, len(str)\n\tif isNegative {\n\t\tstrStart = 1\n\t}\n\n\tvar hasDot bool\n\tfor i := 0; i < strEnd; i++ {\n\t\tif str[i] == '.' {\n\t\t\thasDot = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\tvar sz = strEnd - strStart + 1\n\tif hasDot {\n\t\tsz--\n\t}\n\tvar chars = make([]byte, sz)\n\tchars[0] = '0'\n\n\tvar afterDot, digitsStart, digitsEnd = len(chars), -1, -1\n\n\tfor i, j := 1, strStart; j < strEnd; i, j = i+1, j+1 {\n\t\tc := str[j]\n\t\tif c == '.' {\n\t\t\tafterDot = i\n\t\t\ti--\n\t\t} else if c < '0' || c > '9' {\n\t\t\treturn \"\", fmt.Errorf(\"bad input: %d\", c)\n\t\t} else {\n\t\t\tchars[i] = c\n\t\t\tif c != '0' && digitsStart < 0 {\n\t\t\t\tdigitsStart = i\n\t\t\t}\n\t\t}\n\t}\n\n\tif digitsStart < 0 {\n\t\tdigitsStart = 1\n\t}\n\n\tvar precisionStart = digitsStart\n\tif countingMode == DecimalPlaces {\n\t\tprecisionStart = afterDot\n\t}\n\tvar precisionEnd = precisionStart + numPrecisionDigits\n\tdigitsEnd = -1\n\n\tfor i, memo := len(chars)-1, false; i >= 0; i-- {\n\t\tc := chars[i]\n\t\tif i != 0 {\n\t\t\tif memo {\n\t\t\t\tc++\n\t\t\t}\n\t\t\tif i >= precisionStart+numPrecisionDigits {\n\t\t\t\tif roundingMode == Round && c >= '5' && !(c == '5' && memo) {\n\t\t\t\t\tc = '9' + 1\n\t\t\t\t} else {\n\t\t\t\t\tc = '0'\n\t\t\t\t}\n\t\t\t}\n\t\t\tif c > '9' {\n\t\t\t\tc = '0'\n\t\t\t\tmemo = true\n\t\t\t} else {\n\t\t\t\tmemo = false\n\t\t\t}\n\t\t} else if memo {\n\t\t\tc = '1'\n\t\t}\n\t\tchars[i] = c\n\n\t\tif c != '0' {\n\t\t\tdigitsStart = i\n\t\t\tif digitsEnd < 0 {\n\t\t\t\tdigitsEnd = i + 1\n\t\t\t}\n\t\t}\n\t}\n\n\tif countingMode == SignificantDigits {\n\t\tprecisionStart = digitsStart\n\t\tprecisionEnd = precisionStart + numPrecisionDigits\n\t}\n\n\tvar readStart = digitsStart\n\tif digitsStart >= afterDot {\n\t\treadStart = afterDot - 1\n\t}\n\tvar readEnd = digitsEnd\n\tif digitsEnd < afterDot {\n\t\treadEnd = afterDot\n\t}\n\n\tvar nSign = 0\n\tif f < 0 {\n\t\tnSign = 1\n\t}\n\tvar nBeforeDot = nSign + afterDot - readStart\n\tvar nAfterDot = readEnd - afterDot\n\tif nAfterDot < 0 {\n\t\tnAfterDot = 0\n\t}\n\tvar actualLength = readEnd - readStart\n\tvar desiredLength = precisionEnd - readStart\n\tif paddingMode == NoPadding {\n\t\tdesiredLength = actualLength\n\t}\n\tvar pad = desiredLength - actualLength\n\tif pad < 0 {\n\t\tpad = 0\n\t}\n\tvar padStart = nBeforeDot + 1 + nAfterDot\n\tvar padEnd = padStart + pad\n\tvar isInteger = (nAfterDot + pad) == 0\n\n\tsz = nBeforeDot + nAfterDot + pad\n\tif !isInteger {\n\t\tsz++\n\t}\n\n\tvar out = make([]byte, sz)\n\tif f < 0 {\n\t\tout[0] = '-'\n\t}\n\tfor i, j := nSign, readStart; i < nBeforeDot; i, j = i+1, j+1 {\n\t\tout[i] = chars[j]\n\t}\n\tif !isInteger {\n\t\tout[nBeforeDot] = '.'\n\t}\n\tfor i, j := nBeforeDot+1, afterDot; i < padStart; i, j = i+1, j+1 {\n\t\tout[i] = chars[j]\n\t}\n\tfor i := padStart; i < padEnd; i++ {\n\t\tout[i] = '0'\n\t}\n\n\treturn string(bytes.Trim(out, \"\\x00\")), nil\n}", "title": "" }, { "docid": "801d88d17d432aae51386d24adcf6c2f", "score": "0.4637012", "text": "func ExampleDecimal() {\n\tfmt.Println(Decimal(\"$ 99.99!\"))\n\t// Output: 99.99\n}", "title": "" }, { "docid": "6b0b7b8d540aa91159d749df3ee396e0", "score": "0.46187276", "text": "func parsePrice(valueStr string) (string, error) {\n\treplacer := strings.NewReplacer(\"R$ \", \"\", \",\", \"\", \".\", \"\")\n\tprice, error := strconv.Atoi(replacer.Replace(valueStr))\n\tprice = price / 100\n\tif error != nil {\n\t\tlog.Print(error)\n\t}\n\treturn valueStr, error\n}", "title": "" }, { "docid": "b3570be8fba2c354f07e3e5ea261eb90", "score": "0.4616116", "text": "func Decimal2Hexadecimal(s string) string {\n\ti, err := utils.Parse(s, utils.DECIMAL_BASE)\n\tutils.CheckError(err, utils.STRING, utils.DECIMAL)\n\ts = strconv.FormatInt(int64(i), utils.HEXADECIMAL_BASE)\n\treturn s\n}", "title": "" }, { "docid": "54d7bac2efd6a8b1cf5a7741167c8430", "score": "0.46027017", "text": "func findLatitude(ggaFields []string) float32 {\n\tif len(ggaFields) > 2 && len(ggaFields[2]) > 8 {\n\t\tvar dd = ggaFields[2][0:2]\n\t\tvar mm = ggaFields[2][2:]\n\t\tvar d, _ = strconv.ParseFloat(dd, 32)\n\t\tvar m, _ = strconv.ParseFloat(mm, 32)\n\t\tvar v = float32(d + (m / 60))\n\t\tif ggaFields[3] == \"S\" {\n\t\t\tv *= -1\n\t\t}\n\t\treturn v\n\t}\n\treturn 0.0\n}", "title": "" }, { "docid": "e5d3b500ccc052454324eef477dc69e1", "score": "0.45853823", "text": "func to2Decimal(v int64, basis Basis) string {\n\t// Largest representation is 32 bytes.\n\tvar buf [32]byte\n\tw := len(buf)\n\n\tu := uint64(v)\n\tneg := v < 0\n\tif neg {\n\t\tu = -u\n\t}\n\n\tbase, sign := getBaseAndSign(u, basis)\n\tfrac := u % base\n\tu /= base\n\n\tw = fmtSign(buf[:w], sign)\n\tw = fmtFrac(buf[:w], frac, base)\n\tw = fmtInt(buf[:w], u)\n\n\tif neg {\n\t\tw--\n\t\tbuf[w] = '-'\n\t}\n\n\treturn string(buf[w:])\n}", "title": "" }, { "docid": "c6833ad22fdd8b0930afe03adf7b51b4", "score": "0.45780042", "text": "func transPointToSGF03(ptIN sgfPointStrct01) string {\n\tsgfPtY := string(rune((ptIN.y) + 97))\n\t// SGF format of column x string then row y string\n\treturn ptIN.x + sgfPtY\n}", "title": "" }, { "docid": "26c6df8de5cd4290853ba8f9fba0a7bc", "score": "0.45635724", "text": "func ConvertTimeToZone(timeFromGitlab string, strZone string) (string, error) {\n\t// Parse an unknown date format, detect the layout.\n\tdateTime, err := dateparse.ParseAny(timeFromGitlab)\n\tif err != nil {\n\t\treturn timeFromGitlab, err\n\t}\n\n\t// validate time zone\n\tlocation, err := time.LoadLocation(strZone)\n\tif err != nil {\n\t\t// if strZone invalid than return back formated origin time with error msg\n\t\treturn dateTime.Format(\"02 Jan 06 15:04\"), err\n\t}\n\n\tlocal := dateTime.In(location)\n\treturn local.Format(\"02 Jan 06 15:04\"), nil\n\n}", "title": "" }, { "docid": "a98000186482936cf8e0c2692f3fa707", "score": "0.45618954", "text": "func convert(str string) uint64 {\n\tvar res uint64 = 0\n\tif len(str) > 0 {\n\t\tstr = strings.ToLower(str)\n\t\tif strings.LastIndexAny(str, \"kmg\") != -1 {\n\t\t\ttmp, err := strconv.Atoi(str[:len(str)-1])\n\t\t\tcheckErr(err)\n\t\t\tres = uint64(tmp)\n\t\t\tswitch str[len(str)-1] {\n\t\t\tcase 'k':\n\t\t\t\tres *= 1000\n\t\t\tcase 'm':\n\t\t\t\tres *= 1000 * 1000\n\t\t\tcase 'g':\n\t\t\t\tres *= 1000 * 1000 * 1000\n\t\t\t}\n\t\t} else {\n\t\t\ttmp, err := strconv.Atoi(str)\n\t\t\tcheckErr(err)\n\t\t\tres = uint64(tmp)\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "83c627dd62125dce694c1c78cba94f1c", "score": "0.4545046", "text": "func Convert(fs string) (f float64, err error) {\n\t// if a decimal point comes before the comma then its US/Britain\n\trev := reverse([]byte(fs))\n\tpoint := strings.Index(rev, \".\")\n\tcomma := strings.Index(rev, \",\")\n\n\t// no commas so need to normalize\n\tif comma == -1 {\n\t\tf, err = strconv.ParseFloat(fs, 64)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\tif point < comma {\n\t\tf, err = strconv.ParseFloat(normalizeAmericanBritain(fs), 64)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tf, err = strconv.ParseFloat(normalizeEurope(fs), 64)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "e08df45c1b1b9f095a75a894e7fc8e20", "score": "0.4531399", "text": "func DurationToSeconds(duration string) float64 {\n\tsplitDuration := strings.Split(duration, \":\")\n\tfor i, v := range splitDuration {\n\t\tswitch i {\n\t\tcase 0:\n\t\t\tsplitDuration[i] = fmt.Sprintf(\"%sh\", v)\n\t\tcase 1:\n\t\t\tsplitDuration[i] = fmt.Sprintf(\"%sm\", v)\n\t\tcase 2:\n\t\t\tsplitDuration[i] = fmt.Sprintf(\"%sms\", strings.Replace(v, \".\", \"s\", 1))\n\t\t}\n\t}\n\n\tduration = strings.Join(splitDuration, \"\")\n\tparsedDuration, _ := time.ParseDuration(duration)\n\n\treturn parsedDuration.Seconds()\n}", "title": "" }, { "docid": "d0a285c704a2928c00a973b61c96fd28", "score": "0.452689", "text": "func (s *TextValue) Position() Pos { return s.Start }", "title": "" }, { "docid": "ee058b9701eaacafe36557cad8f4214b", "score": "0.45241347", "text": "func MakeDecimalFromString(src string) (Decimal, error) {\n\tresult := Decimal{}\n\tdec, err := decimal.NewFromString(src)\n\tif err != nil {\n\t\treturn result, err\n\t}\n\tresult = MakeDecimal(dec)\n\treturn result, nil\n}", "title": "" }, { "docid": "a248c228819a0259963941366b8a7ac8", "score": "0.45221415", "text": "func parseTransform(s string) (position int, jsonQuery string) {\n\tparts := strings.SplitN(s, \".\", 2)\n\n\tif len(parts) == 1 {\n\t\t// Either the whole thing is a positional arg or the query.\n\t\tpos, err := strconv.Atoi(s)\n\t\tif err != nil {\n\t\t\treturn 1, s\n\t\t}\n\t\treturn pos, \"\"\n\t}\n\n\t// Check if it starts with a position, otherwise it is all the query\n\tpos, err := strconv.Atoi(parts[0])\n\tif err != nil {\n\t\treturn 1, s\n\t}\n\n\treturn pos, parts[1]\n}", "title": "" }, { "docid": "62d1ebe1dd186b5dc89241de37a3d846", "score": "0.4513103", "text": "func strHexToDecimal(hex string) int {\n\tportInt, err := strconv.ParseInt(hex, 16, 64)\n\tif err != nil {\n\t\tlog.Fatal(\"Couldn't parse hex number \" + hex + \":\\n\\t\" + err.Error())\n\t}\n\treturn int(portInt)\n}", "title": "" }, { "docid": "0007bbfec87b721024e1643c2b37e773", "score": "0.451091", "text": "func ParseCoordinates(s string) (int, int, error) {\n\t// split NXX move into X,Y\n\t// e.g. a1 = 1,1\n\tsx := s[:1]\n\tx := strings.Index(xletters, sx)\n\ty, yerr := strconv.Atoi(s[1:])\n\tif yerr != nil {\n\t\treturn 0, 0, yerr\n\t}\n\tif (x < 0) || (x > 19) {\n\t\treturn 0, 0, fmt.Errorf(\"X is not a possible coordinate: %d\", x)\n\t}\n\tif (y < 0) || (y > 19) {\n\t\treturn 0, 0, fmt.Errorf(\"Y is not a possible coordinate: %d\", y)\n\t}\n\treturn x, y, nil\n}", "title": "" }, { "docid": "cf77e5f98583d2b206e3d771153e6e83", "score": "0.45058846", "text": "func ConvertToSeconds(s string) (seconds float64, err error) {\n\ts = strings.TrimSpace(s)\n\tparts := strings.Split(s, \":\")\n\tmultipliers := []float64{60 * 60, 60, 1}\n\tif len(parts) == 2 {\n\t\tmultipliers = []float64{60, 1, 1}\n\t} else if len(parts) == 1 {\n\t\tmultipliers = []float64{1, 1, 1}\n\t}\n\tfor i, part := range parts {\n\t\tvar partf float64\n\t\tpartf, err = strconv.ParseFloat(part, 64)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tseconds += partf * multipliers[i]\n\t}\n\treturn\n}", "title": "" }, { "docid": "891661487507161d59a15342e0d17499", "score": "0.45007217", "text": "func Decimal(num []byte, prec int) []byte {\n\tif len(num) <= 1 {\n\t\treturn num\n\t}\n\n\t// omit first + and register mantissa start and end, whether it's negative and the exponent\n\tneg := false\n\tstart := 0\n\tdot := -1\n\tend := len(num)\n\tif 0 < end && (num[0] == '+' || num[0] == '-') {\n\t\tif num[0] == '-' {\n\t\t\tneg = true\n\t\t}\n\t\tstart++\n\t}\n\tfor i, c := range num[start:] {\n\t\tif c == '.' {\n\t\t\tdot = start + i\n\t\t\tbreak\n\t\t}\n\t}\n\tif dot == -1 {\n\t\tdot = end\n\t}\n\n\t// trim leading zeros but leave at least one digit\n\tfor start < end-1 && num[start] == '0' {\n\t\tstart++\n\t}\n\t// trim trailing zeros\n\ti := end - 1\n\tfor ; dot < i; i-- {\n\t\tif num[i] != '0' {\n\t\t\tend = i + 1\n\t\t\tbreak\n\t\t}\n\t}\n\tif i == dot {\n\t\tend = dot\n\t\tif start == end {\n\t\t\tnum[start] = '0'\n\t\t\treturn num[start : start+1]\n\t\t}\n\t} else if start == end-1 && num[start] == '0' {\n\t\treturn num[start:end]\n\t}\n\n\t// apply precision\n\tif 0 < prec && dot <= start+prec {\n\t\tprecEnd := start + prec + 1 // include dot\n\t\tif dot == start { // for numbers like .012\n\t\t\tdigit := start + 1\n\t\t\tfor digit < end && num[digit] == '0' {\n\t\t\t\tdigit++\n\t\t\t}\n\t\t\tprecEnd = digit + prec\n\t\t}\n\t\tif precEnd < end {\n\t\t\tend = precEnd\n\n\t\t\t// process either an increase from a lesser significant decimal (>= 5)\n\t\t\t// or remove trailing zeros after the dot, or both\n\t\t\ti := end - 1\n\t\t\tinc := '5' <= num[end]\n\t\t\tfor ; start < i; i-- {\n\t\t\t\tif i == dot {\n\t\t\t\t\t// no-op\n\t\t\t\t} else if inc && num[i] != '9' {\n\t\t\t\t\tnum[i]++\n\t\t\t\t\tinc = false\n\t\t\t\t\tbreak\n\t\t\t\t} else if inc && i < dot { // end inc for integer\n\t\t\t\t\tnum[i] = '0'\n\t\t\t\t} else if !inc && (i < dot || num[i] != '0') {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif i < dot {\n\t\t\t\tend = dot\n\t\t\t} else {\n\t\t\t\tend = i + 1\n\t\t\t}\n\n\t\t\tif inc {\n\t\t\t\tif dot == start && end == start+1 {\n\t\t\t\t\tnum[start] = '1'\n\t\t\t\t} else if num[start] == '9' {\n\t\t\t\t\tnum[start] = '1'\n\t\t\t\t\tnum[start+1] = '0'\n\t\t\t\t\tend++\n\t\t\t\t} else {\n\t\t\t\t\tnum[start]++\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif neg {\n\t\tstart--\n\t\tnum[start] = '-'\n\t}\n\treturn num[start:end]\n}", "title": "" }, { "docid": "e95f547b7b6c614dbbdf4e48eb8cb87d", "score": "0.44921467", "text": "func Parse(s string) (Money, error) {\n\tif len(s) == 0 {\n\t\treturn Money(0), nil\n\t}\n\n\ts = strings.Replace(s, \",\", \".\", -1)\n\n\tvar amount int32\n\tswitch parts := strings.Split(s, \".\"); len(parts) {\n\tcase 1:\n\t\tvar err error\n\t\tunits, err := strconv.ParseInt(parts[0], 10, 64)\n\t\tif err != nil {\n\t\t\treturn Money(0), errors.Trace(err)\n\t\t}\n\t\tamount = int32(units) * 100\n\n\tcase 2:\n\t\tunits, err := strconv.ParseInt(parts[0], 10, 64)\n\t\tif err != nil {\n\t\t\treturn Money(0), errors.Trace(err)\n\t\t}\n\t\tif len(parts[1]) > 2 {\n\t\t\tparts[1] = parts[1][:2]\n\t\t}\n\t\tdecimals, err := strconv.ParseInt(parts[1], 10, 64)\n\t\tif err != nil {\n\t\t\treturn Money(0), errors.Trace(err)\n\t\t}\n\t\tif len(parts[1]) == 1 {\n\t\t\tamount = int32(units)*100 + int32(decimals)*10\n\t\t} else {\n\t\t\tamount = int32(units)*100 + int32(decimals)\n\t\t}\n\n\tdefault:\n\t\treturn Money(0), errors.Errorf(\"cannot parse money value: %v\", s)\n\t}\n\n\treturn Money(amount), nil\n}", "title": "" }, { "docid": "37cdf528449edbab23bd2ab3143e070f", "score": "0.44917813", "text": "func strToInt(str string) (int, error) {\n\tdecimalSplit := strings.Split(str, \".\")\n\treturn strconv.Atoi(decimalSplit[0])\n}", "title": "" }, { "docid": "28b1f6bda99b3f3c1aae8efe253446b6", "score": "0.44809595", "text": "func ToDur(s string) (time.Duration, error) { return ToDuration(s) }", "title": "" }, { "docid": "266ad076992d1ada1146c16ed52d99fe", "score": "0.447332", "text": "func Decimal(num []byte, prec int) []byte {\n\t// omit first + and register mantissa start and end, whether it's negative and the exponent\n\tneg := false\n\tstart := 0\n\tdot := -1\n\tend := len(num)\n\tif 0 < end && (num[0] == '+' || num[0] == '-') {\n\t\tif num[0] == '-' {\n\t\t\tneg = true\n\t\t}\n\t\tstart++\n\t}\n\tfor i, c := range num[start:] {\n\t\tif c == '.' {\n\t\t\tdot = start + i\n\t\t\tbreak\n\t\t}\n\t}\n\tif dot == -1 {\n\t\tdot = end\n\t}\n\n\t// trim leading zeros but leave at least one digit\n\tfor start < end-1 && num[start] == '0' {\n\t\tstart++\n\t}\n\t// trim trailing zeros\n\ti := end - 1\n\tfor ; i > dot; i-- {\n\t\tif num[i] != '0' {\n\t\t\tend = i + 1\n\t\t\tbreak\n\t\t}\n\t}\n\tif i == dot {\n\t\tend = dot\n\t\tif start == end {\n\t\t\tnum[start] = '0'\n\t\t\treturn num[start : start+1]\n\t\t}\n\t} else if start == end-1 && num[start] == '0' {\n\t\treturn num[start:end]\n\t}\n\n\t// apply precision\n\tif prec > -1 && dot+1+prec < end {\n\t\tend = dot + 1 + prec\n\t\tinc := num[end] >= '5'\n\t\tif inc || num[end-1] == '0' {\n\t\t\tfor i := end - 1; i > start; i-- {\n\t\t\t\tif i == dot {\n\t\t\t\t\tend--\n\t\t\t\t} else if inc {\n\t\t\t\t\tif num[i] == '9' {\n\t\t\t\t\t\tif i > dot {\n\t\t\t\t\t\t\tend--\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnum[i] = '0'\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnum[i]++\n\t\t\t\t\t\tinc = false\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t} else if i > dot && num[i] == '0' {\n\t\t\t\t\tend--\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif dot == start && end == start+1 {\n\t\t\tif inc {\n\t\t\t\tnum[start] = '1'\n\t\t\t} else {\n\t\t\t\tnum[start] = '0'\n\t\t\t}\n\t\t} else {\n\t\t\tif dot+1 == end {\n\t\t\t\tend--\n\t\t\t}\n\t\t\tif inc {\n\t\t\t\tif num[start] == '9' {\n\t\t\t\t\tnum[start] = '0'\n\t\t\t\t\tcopy(num[start+1:], num[start:end])\n\t\t\t\t\tend++\n\t\t\t\t\tnum[start] = '1'\n\t\t\t\t} else {\n\t\t\t\t\tnum[start]++\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif neg {\n\t\tstart--\n\t\tnum[start] = '-'\n\t}\n\treturn num[start:end]\n}", "title": "" }, { "docid": "877b8d6c133535c16b0995fd04be2eda", "score": "0.4469168", "text": "func parseWithK(s string) float64 {\n\tfv, err := strconv.ParseFloat(s, 64)\n\tif err != nil &&\n\t\tstrings.Contains(s, \".\") &&\n\t\tstrings.HasSuffix(s, \"k\") {\n\t\tpv, _ := strconv.ParseFloat(strings.Replace(s, \"k\", \"\", -1), 64)\n\t\treturn pv * 1000\n\t}\n\treturn fv\n}", "title": "" }, { "docid": "ef641c0f6dac5949c68ba8889ecf9c7f", "score": "0.44650844", "text": "func parseFloat(s []byte) (float32, error) {\n\tif len(s) == 0 {\n\t\terr := fmt.Errorf(\"invalid float: empty string\")\n\t\treturn 0, err\n\t}\n\tvar a int64\n\tvar b int64\n\tvar denominator []byte\n\tvar d = int64(1)\n\tfor i, c := range s {\n\t\tif c == '.' {\n\t\t\tdenominator = s[i+1:]\n\t\t\tbreak\n\t\t}\n\t\tif !('0' <= c && c <= '9') {\n\t\t\terr := fmt.Errorf(\"invalid float: invalid digit %c in %q\", c, string(s))\n\t\t\treturn 0, err\n\t\t}\n\t\ta *= 10\n\t\ta += int64(c - '0')\n\t}\n\tfor _, c := range denominator {\n\t\tif !('0' <= c && c <= '9') {\n\t\t\terr := fmt.Errorf(\"invalid float: invalid digit %c in %q\", c, string(s))\n\t\t\treturn 0, err\n\t\t}\n\t\tb *= 10\n\t\tb += int64(c - '0')\n\t\td *= 10\n\t}\n\tfinal := float64(a) + (float64(b) / float64(d))\n\treturn float32(final), nil\n}", "title": "" }, { "docid": "b5f624e32c363b0308cb07e06c0aa5e8", "score": "0.4464721", "text": "func getFloatFromString(str string) (float64, error) {\n\tdur, err := strconv.ParseFloat(str, 64)\n\tif err != nil {\n\t\tdur, err := time.ParseDuration(str)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\treturn dur.Seconds(), nil\n\t}\n\treturn dur, nil\n}", "title": "" }, { "docid": "3ceaf367222b4f4ff381654e7fbba93d", "score": "0.4452023", "text": "func (s *StringValue) Position() Pos { return s.Start }", "title": "" }, { "docid": "3b46d959b8f0cd2cd3014c6f0ff427c9", "score": "0.44471923", "text": "func ToPosition(pos token.Position) *Position {\n\treturn &Position{\n\t\tFilename: pos.Filename,\n\t\tOffset: pos.Offset,\n\t\tLine: pos.Line,\n\t\tColumn: pos.Column,\n\t}\n}", "title": "" }, { "docid": "3cabfab403eb11284f7fda6cdcf3fe3e", "score": "0.44463792", "text": "func PositionString(s string) (Position, error) {\n\tif val, ok := _PositionNameToValueMap[s]; ok {\n\t\treturn val, nil\n\t}\n\treturn 0, fmt.Errorf(\"%s does not belong to Position values\", s)\n}", "title": "" }, { "docid": "018c9a0053ce75ea41c06646d73ed95d", "score": "0.4442112", "text": "func convertWindVelocity(MpS float64) (converted WindVelocity) {\n\tconverted.KpH = MpS * 3600 / 1000\n\tconverted.MpH = converted.KpH * .621371\n\treturn\n}", "title": "" }, { "docid": "00e2f7554f353ce53ca417d3b0b2be14", "score": "0.4440238", "text": "func toProtocolPosition(f *token.File, pos token.Pos) lsp.Position {\n\tif !pos.IsValid() {\n\t\treturn lsp.Position{Line: -1.0, Character: -1.0}\n\t}\n\tp := f.Position(pos)\n\treturn lsp.Position{\n\t\tLine: p.Line - 1,\n\t\tCharacter: p.Column - 1,\n\t}\n}", "title": "" }, { "docid": "b61ab38026a75b995740f486824ca53b", "score": "0.44382465", "text": "func toFloat(rawFloat string) float64 {\n\tparsed, _ := strconv.ParseFloat(strings.Replace(strings.Replace(strings.Replace(rawFloat, \"$\", \"\", -1), \",\", \"\", -1), \"%\", \"\", -1), 64)\n\treturn parsed\n}", "title": "" }, { "docid": "f7b4cbe478b595da416a91580beb989a", "score": "0.44096264", "text": "func timeConversion(s string) string {\n // 12p > 12, 1p > 13, 2p > 14, 11a > 11\n // if am and hour is 12, use 0\n // if pm and hour is 12, don't add 12\n bs := []byte(s)\n am := s[len(s)-2] == 'A'\n if am && bs[0] == '1' && bs[1] == '2' {\n bs[0] = '0'\n bs[1] = '0'\n } else if !am && (bs[0] != '1' || bs[1] != '2') {\n bs[0]++\n if x := bs[1] + 2; x <= '9' {\n bs[1] = x\n } else {\n bs[1] = x - 10\n bs[0]++\n }\n }\n return string(bs[:len(bs)-2])\n}", "title": "" }, { "docid": "210a9e562ede62c40497f6fc452b6876", "score": "0.44006056", "text": "func getDecimal(b string) int {\r\n\tdecimal := 0\r\n\r\n\tfor i, v := range b {\r\n\t\tbit := v - '0'\r\n\t\texp := len(b) - i - 1\r\n\t\tif bit == 1 {\r\n\t\t\tdecimal += power(2, exp)\r\n\t\t}\r\n\t}\r\n\r\n\treturn decimal\r\n}", "title": "" }, { "docid": "0afe976dbb70231c42c6396e561ab774", "score": "0.43972588", "text": "func TestNumStrUtility_DlimDecStr(t *testing.T) {\n\n\tns := NumStrUtility{}\n\tn := \"1234567890\"\n\texpected := \"1,234,567,890\"\n\n\tresult := ns.DlimDecCurrStr(n, ',', '.', '$')\n\n\tif result != expected {\n\t\tt.Errorf(\"Expected result = %v; instead got: %v\", expected, result)\n\t}\n\n}", "title": "" }, { "docid": "692ab27c0dfb8c48b0952713bf363ba4", "score": "0.439282", "text": "func ConvertFromDecimal(nbr int, base string) string {\n\tresult := \"\"\n\n\tfor nbr >= StrLen(base) {\n\t\tresult += string(base[nbr%StrLen(base)])\n\t\tnbr /= StrLen(base)\n\t}\n\tresult += string(base[nbr])\n\n\treturn StrRev(result)\n}", "title": "" }, { "docid": "384b9f77faf70f4b2ed7b098615869d5", "score": "0.43916827", "text": "func decodeStringFromBCD(bcdBuf []byte) (string, int, error) {\n\t// Read scale.\n\tbuf := bytes.NewBuffer(bcdBuf)\n\tdec := msgpack.NewDecoder(buf)\n\tscale, err := dec.DecodeInt()\n\tif err != nil {\n\t\treturn \"\", 0, fmt.Errorf(\"unable to decode the decimal scale: %w\", err)\n\t}\n\n\t// Get the data without the scale.\n\tbcdBuf = buf.Bytes()\n\tbufLen := len(bcdBuf)\n\n\t// Every nibble contains a digit, and the last low nibble contains a\n\t// sign.\n\tndigits := bufLen*2 - 1\n\n\t// The first nibble contains 0 if the decimal number has an even number of\n\t// digits. Decrease a number of digits if so.\n\tif bcdBuf[0]&0xf0 == 0 {\n\t\tndigits -= 1\n\t}\n\n\t// Reserve bytes for dot and sign.\n\tnumLen := ndigits + 2\n\n\tvar bld strings.Builder\n\tbld.Grow(numLen)\n\n\t// Add a sign, it is encoded in a low nibble of a last byte.\n\tlastByte := bcdBuf[bufLen-1]\n\tsign := lastByte & 0x0f\n\tif isNegative[sign] {\n\t\tbld.WriteByte('-')\n\t}\n\n\tconst MaxDigit = 0x09\n\t// Builds a buffer with symbols of decimal number (digits, dot and sign).\n\tprocessNibble := func(nibble byte) {\n\t\tif nibble <= MaxDigit {\n\t\t\tbld.WriteByte(nibble + '0')\n\t\t\tndigits--\n\t\t}\n\t}\n\n\tfor i, bcdByte := range bcdBuf {\n\t\thighNibble := bcdByte >> 4\n\t\tlowNibble := bcdByte & 0x0f\n\t\t// Skip a first high nibble as no digit there.\n\t\tif i != 0 || highNibble != 0 {\n\t\t\tprocessNibble(highNibble)\n\t\t}\n\t\tprocessNibble(lowNibble)\n\t}\n\n\tif bld.Len() == 0 || isNegative[sign] && bld.Len() == 1 {\n\t\tbld.WriteByte('0')\n\t}\n\treturn bld.String(), -1 * scale, nil\n}", "title": "" }, { "docid": "0a3e1babc984a850db6a57db854dbe28", "score": "0.43903786", "text": "func parseOperationPriceString(price string) float64 {\n\tprice = strings.Replace(price, \",\", \".\", 1)\n\n\tp, _ := strconv.ParseFloat(price, 64)\n\n\treturn p\n}", "title": "" }, { "docid": "08996a17f73fe8f65f471357a3f148cc", "score": "0.43857744", "text": "func (s VerbatimString) ToFloat64() (float64, error) { return _verbatimString(s).ToFloat64() }", "title": "" }, { "docid": "1af9d91ea33b9cc4aa2b368e46bebe39", "score": "0.43840128", "text": "func parseTransferPriceString(price string) (float64, error) {\n\tprice = strings.Replace(price, \".\", \"\", 1)\n\tprice = strings.Replace(price, \",\", \".\", 1)\n\n\treturn strconv.ParseFloat(price, 64)\n}", "title": "" }, { "docid": "faa910712bd2dd993a1136ff3abe30a3", "score": "0.43790746", "text": "func GetPrecison(str string) int {\n\tswitch str {\n\tcase \"1.00000000\":\n\t\treturn 0\n\tcase \"0.10000000\":\n\t\treturn 1\n\tcase \"0.01000000\":\n\t\treturn 2\n\tcase \"0.00100000\":\n\t\treturn 3\n\tcase \"0.00010000\":\n\t\treturn 4\n\tcase \"0.00001000\":\n\t\treturn 5\n\tcase \"0.00000100\":\n\t\treturn 6\n\tcase \"0.00000010\":\n\t\treturn 7\n\tcase \"0.00000001\":\n\t\treturn 8\n\tdefault:\n\t\treturn 8\n\t}\n}", "title": "" }, { "docid": "df4feea7c62bb2dfbf702f6d8798af28", "score": "0.43747097", "text": "func (s *Sensor) Decimals() int {\n\treturn s.decimals\n}", "title": "" }, { "docid": "5b443d8bec8b27abb9e3efbb2df1e5b6", "score": "0.43428978", "text": "func parseMpstatToCPUUsage(s string) float64 {\n\ts = strings.TrimSpace(s)\n\tlines := strings.Split(s, \"\\n\")\n\tif len(lines) < 1 {\n\t\treturn 0\n\t}\n\tlastLine := strings.TrimSpace(lines[len(lines)-1])\n\tfields := strings.Split(lastLine, \" \")\n\tif len(fields) < 1 {\n\t\treturn 0\n\t}\n\tidleField := strings.ReplaceAll(fields[len(fields)-1], \",\", \".\")\n\tidle, err := strconv.ParseFloat(idleField, 64)\n\tif err != nil {\n\t\treturn 0\n\t}\n\treturn 100 - idle\n}", "title": "" }, { "docid": "1606d3ab020ca1bd8c649fc4655f1e98", "score": "0.4342723", "text": "func durationFromBytesOfFloat64(s string) (time.Duration, error) {\n\tsecondsFloat,err := strconv.ParseFloat(strings.TrimSpace(s), 64)\n\tif err != nil{\n\t\treturn 0, err\n\t}\n\tsecondsString := strconv.Itoa(int(math.Ceil(secondsFloat)))+\"s\"\n\n\tlogrus.WithFields(logrus.Fields{\n\t\t\"duration\": secondsString,\n\t}).Infoln(\"Calculated duration of track...\")\n\treturn time.ParseDuration(secondsString)\n}", "title": "" }, { "docid": "d0f71214edfc1947bf373d4a4831207b", "score": "0.43343917", "text": "func findLongitude(ggaFields []string) float32 {\n\tif len(ggaFields) > 4 && len(ggaFields[4]) > 8 {\n\t\tvar ddd = ggaFields[4][0:3]\n\t\tvar mm = ggaFields[4][3:]\n\t\tvar d, _ = strconv.ParseFloat(ddd, 32)\n\t\tvar m, _ = strconv.ParseFloat(mm, 32)\n\t\tvar v = float32(d + (m / 60))\n\t\tif ggaFields[5] == \"W\" {\n\t\t\tv *= -1\n\t\t}\n\t\treturn v\n\t}\n\treturn 0.0\n}", "title": "" }, { "docid": "15ba7783252b806cbc55cf1290bbeca6", "score": "0.43317395", "text": "func ToFloat(s string) float64 {\n\tf, err := strconv.ParseFloat(s, 64)\n\tif err != nil {\n\t\treturn 0.0\n\t}\n\treturn f\n}", "title": "" }, { "docid": "2734494a1c68449519439db55a87b1cd", "score": "0.4325282", "text": "func coordToPos(c MinCoordinate) uint {\n\treturn (3 - c.column) + (4 * (3 - c.row))\n}", "title": "" }, { "docid": "e3fadcfa91d944b3f54e253721466347", "score": "0.43122816", "text": "func (d Decimal64p2) DecimalPart() int64 {\n\tresult := int64(d - d/pointPart2*pointPart2)\n\tif result < 0 {\n\t\tresult *= -1\n\t}\n\treturn result\n}", "title": "" }, { "docid": "36051ea9e9abd591afd1e29c22d56fab", "score": "0.43108863", "text": "func Decimals() int {\n\treturn ctoken.Decimals\n}", "title": "" }, { "docid": "6155b46b6c036a93d3c783bc738d6d76", "score": "0.43044102", "text": "func ToDecimal(octal string) (decimal int64) {\n\texponent := 0\n\tfor i := len(octal) - 1; i >= 0; i-- {\n\t\tnum := octal[i] - 48\n\t\tif num > 9 {\n\t\t\treturn 0\n\t\t}\n\t\tdecimal += int64(num) * int64(math.Pow(2, float64(exponent)))\n\t\texponent += 3\n\t}\n\treturn\n}", "title": "" }, { "docid": "cda41f10a6240045c37b92307c4f6b6e", "score": "0.4286924", "text": "func to_ms(nano int64) float64 {\n\treturn float64(nano) / float64(time.Millisecond)\n}", "title": "" }, { "docid": "5b7378bdd228d6e1ea59e270ec9013a5", "score": "0.42865396", "text": "func transSGFToPoint04(sgfPt string) intPointStrct01 {\n\tsgfPtX := sgfPt[0]\n\tsgfPtY := sgfPt[1]\n\treturn intPointStrct01{\n\t\tx: int(sgfPtX) - 97,\n\t\ty: int(sgfPtY) - 97,\n\t}\n}", "title": "" }, { "docid": "7b129307afa73684223d19657772183b", "score": "0.42824933", "text": "func ParseSize(sizeStr string) (int64, error) {\n\tsep := strings.LastIndexAny(sizeStr, \"01234567890. \")\n\tif sep == -1 {\n\t\treturn -1, fmt.Errorf(\"invalid size: '%s'\", sizeStr)\n\t}\n\tvar num, sfx string\n\tif sizeStr[sep] != ' ' {\n\t\tnum = sizeStr[:sep+1]\n\t\tsfx = sizeStr[sep+1:]\n\t} else {\n\t\tnum = sizeStr[:sep]\n\t\tsfx = sizeStr[sep+1:]\n\t}\n\tvalue, err := strconv.ParseFloat(num, 64)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tif value < 0 {\n\t\treturn -1, fmt.Errorf(\"invalid size: '%s'\", sizeStr)\n\t}\n\n\tif len(sfx) == 0 {\n\t\treturn int64(value), nil\n\t}\n\tsfx = strings.ToUpper(sfx)\n\tunit, ok := units[sfx]\n\tif !ok {\n\t\treturn -1, fmt.Errorf(\"invalid size: '%s'\", sizeStr)\n\t}\n\treturn int64(value * float64(unit)), nil\n}", "title": "" }, { "docid": "dd38a938c549371ee488bf0646f1be32", "score": "0.42575023", "text": "func parseFloat(s string) (float64, error) {\n\tif s == \"\" {\n\t\treturn 0.0, nil\n\t}\n\n\tresult, err := strconv.ParseFloat(s, 10)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"parseFloat\")\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "61911eedbbe8467edaebcd58460d8a54", "score": "0.42496595", "text": "func ConvertAmountToString(a int64, decimalSep string) string {\n\tf := float64(a) / 100\n\tresult := fmt.Sprintf(\"%.2f\", f)\n\tif decimalSep != \".\" {\n\t\tresult = strings.ReplaceAll(result, \".\", decimalSep)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "b2fa5ac86177a0aafb2db2ddbb3af1e9", "score": "0.42382324", "text": "func transPointToSGF04(ptIN intPointStrct01) string {\n\tsgfPtX := string(rune((ptIN.x) + 97))\n\tsgfPtY := string(rune((ptIN.y) + 97))\n\treturn sgfPtX + sgfPtY\n}", "title": "" }, { "docid": "95bd57cfa2981533e08acf388eb38e19", "score": "0.42306834", "text": "func fmtDecStr(nb string, limit int) string {\n\tlog.Printf(\"format.go > fmtDecStr [ %v / %v ]\", nb, limit)\n\treturn nb[:strings.Index(nb, \".\")] + \",\" + nb[strings.Index(nb, \".\")+1:strings.Index(nb, \".\")+limit+1]\n}", "title": "" }, { "docid": "a10431f8ec59a0a5d989c01a33864466", "score": "0.42270854", "text": "func ParseDistanceUnit(u string) (float64, error) {\n\tfor _, unit := range distanceUnits {\n\t\tfor _, unitSuffix := range unit.suffixes {\n\t\t\tif u == unitSuffix {\n\t\t\t\treturn unit.conv, nil\n\t\t\t}\n\t\t}\n\t}\n\treturn 0, fmt.Errorf(\"unknown distance unit: %s\", u)\n}", "title": "" }, { "docid": "31c86142c2853658c572374af05315d9", "score": "0.42176184", "text": "func parseSize(sizeStr string) (int64, error) {\n\tmatches := sizeRegex.FindStringSubmatch(sizeStr)\n\tif len(matches) != 4 {\n\t\treturn -1, fmt.Errorf(\"invalid size: %s\", sizeStr)\n\t}\n\n\tsize, err := strconv.ParseFloat(matches[1], 64)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\n\tuMap := map[string]int64{\"k\": KB, \"m\": MB, \"g\": GB, \"t\": TB, \"p\": PB}\n\tunitPrefix := strings.ToLower(matches[3])\n\tif mul, ok := uMap[unitPrefix]; ok {\n\t\tsize *= float64(mul)\n\t}\n\n\treturn int64(size), nil\n}", "title": "" }, { "docid": "15f4a3a85adb6f562b13b41dcf0d6002", "score": "0.4216641", "text": "func (r Range) Position(p int) int {\n\tif r > 0 {\n\t\treturn int(float64(p) / 100 * float64(r))\n\t}\n\treturn p\n}", "title": "" }, { "docid": "e13e0201d2c6fa1686ed3bd3ecc3a793", "score": "0.4211649", "text": "func (d *MyDecimal) FromString(str []byte) error {\n\tfor i := 0; i < len(str); i++ {\n\t\tif !isSpace(str[i]) {\n\t\t\tstr = str[i:]\n\t\t\tbreak\n\t\t}\n\t}\n\tif len(str) == 0 {\n\t\tpanic(panicInfo)\n\t}\n\tswitch str[0] {\n\tcase '-':\n\t\td.negative = true\n\t\tfallthrough\n\tcase '+':\n\t\tstr = str[1:]\n\t}\n\tvar strIdx int\n\tfor strIdx < len(str) && isDigit(str[strIdx]) {\n\t\tstrIdx++\n\t}\n\tdigitsInt := strIdx\n\tvar digitsFrac int\n\tvar endIdx int\n\tif strIdx < len(str) && str[strIdx] == '.' {\n\t\tendIdx = strIdx + 1\n\t\tfor endIdx < len(str) && isDigit(str[endIdx]) {\n\t\t\tendIdx++\n\t\t}\n\t\tdigitsFrac = endIdx - strIdx - 1\n\t} else {\n\t\tdigitsFrac = 0\n\t\tendIdx = strIdx\n\t}\n\tif digitsInt+digitsFrac == 0 {\n\t\tpanic(panicInfo)\n\t}\n\twordsInt := digitsToWords(digitsInt)\n\twordsFrac := digitsToWords(digitsFrac)\n\twordsInt, _, err := fixWordCntError(wordsInt, wordsFrac)\n\tif err != nil {\n\t\tpanic(panicInfo)\n\t}\n\td.digitsInt = int8(digitsInt)\n\td.digitsFrac = int8(digitsFrac)\n\twordIdx := wordsInt\n\tstrIdxTmp := strIdx\n\tvar word int32\n\tvar innerIdx int\n\tfor digitsInt > 0 {\n\t\tdigitsInt--\n\t\tstrIdx--\n\t\tword += int32(str[strIdx]-'0') * pow10(innerIdx)\n\t\tinnerIdx++\n\t\tif innerIdx == digitsPerWord {\n\t\t\twordIdx--\n\t\t\td.wordBuf[wordIdx] = word\n\t\t\tword = 0\n\t\t\tinnerIdx = 0\n\t\t}\n\t}\n\tif innerIdx != 0 {\n\t\twordIdx--\n\t\td.wordBuf[wordIdx] = word\n\t}\n\n\twordIdx = wordsInt\n\tstrIdx = strIdxTmp\n\tword = 0\n\tinnerIdx = 0\n\tfor digitsFrac > 0 {\n\t\tdigitsFrac--\n\t\tstrIdx++\n\t\tword = int32(str[strIdx]-'0') + word*10\n\t\tinnerIdx++\n\t\tif innerIdx == digitsPerWord {\n\t\t\td.wordBuf[wordIdx] = word\n\t\t\twordIdx++\n\t\t\tword = 0\n\t\t\tinnerIdx = 0\n\t\t}\n\t}\n\tif innerIdx != 0 {\n\t\td.wordBuf[wordIdx] = word * pow10(digitsPerWord-innerIdx)\n\t}\n\tif endIdx+1 <= len(str) && (str[endIdx] == 'e' || str[endIdx] == 'E') {\n\t\tpanic(panicInfo)\n\t}\n\tallZero := true\n\tfor i := 0; i < wordBufLen; i++ {\n\t\tif d.wordBuf[i] != 0 {\n\t\t\tallZero = false\n\t\t\tbreak\n\t\t}\n\t}\n\tif allZero {\n\t\td.negative = false\n\t}\n\td.resultFrac = d.digitsFrac\n\treturn err\n}", "title": "" }, { "docid": "89fed4794a5b90d51bbeba430c7bf6e7", "score": "0.4207012", "text": "func String2Float(data string, reData float64) float64 {\n\ti, err := strconv.ParseFloat(data, 64)\n\tif err != nil {\n\t\treturn reData\n\t}\n\treturn i\n}", "title": "" }, { "docid": "0a342583b36ef8b2458b38dfd1f6ceda", "score": "0.42065448", "text": "func ParseDistance(d string) (float64, error) {\n\tfor _, unit := range distanceUnits {\n\t\tfor _, unitSuffix := range unit.suffixes {\n\t\t\tif strings.HasSuffix(d, unitSuffix) {\n\t\t\t\tparsedNum, err := strconv.ParseFloat(d[0:len(d)-len(unitSuffix)], 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn 0, err\n\t\t\t\t}\n\t\t\t\treturn parsedNum * unit.conv, nil\n\t\t\t}\n\t\t}\n\t}\n\t// no unit matched, try assuming meters?\n\tparsedNum, err := strconv.ParseFloat(d, 64)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn parsedNum, nil\n}", "title": "" }, { "docid": "0a342583b36ef8b2458b38dfd1f6ceda", "score": "0.42065448", "text": "func ParseDistance(d string) (float64, error) {\n\tfor _, unit := range distanceUnits {\n\t\tfor _, unitSuffix := range unit.suffixes {\n\t\t\tif strings.HasSuffix(d, unitSuffix) {\n\t\t\t\tparsedNum, err := strconv.ParseFloat(d[0:len(d)-len(unitSuffix)], 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn 0, err\n\t\t\t\t}\n\t\t\t\treturn parsedNum * unit.conv, nil\n\t\t\t}\n\t\t}\n\t}\n\t// no unit matched, try assuming meters?\n\tparsedNum, err := strconv.ParseFloat(d, 64)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn parsedNum, nil\n}", "title": "" }, { "docid": "7491febe165b947f915f692476a4237f", "score": "0.42030722", "text": "func convertToFloat(in string) float64 {\n\tfloatValue, err := strconv.ParseFloat(in, 64)\n\tif err != nil {\n\t\tlog.Fatalln(\"Error while converting to float64: \", err)\n\t}\n\treturn floatValue\n}", "title": "" }, { "docid": "fce0d76bf1430ad2f504ac1ce66b041c", "score": "0.4198128", "text": "func KnottoFeetS(knot float64) float64 {\n\treturn knot * 1.688\n}", "title": "" }, { "docid": "c9c0ace9de017e4f767e22c194be8f44", "score": "0.41974834", "text": "func strToDoublePoint(s string) (*metricspb.Point, error) {\n\tf, err := strconv.ParseFloat(s, 64)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &metricspb.Point{Value: &metricspb.Point_DoubleValue{DoubleValue: f}}, nil\n}", "title": "" }, { "docid": "63737ad190e80db45bac5af91fd03c07", "score": "0.41953704", "text": "func ToInt64(s string) int64 {\n\tif strings.Contains(s, \".\") {\n\t\ts = strings.Split(s, \".\")[0]\n\t}\n\n\tv, err := strconv.ParseInt(s, 10, 64)\n\tif err != nil {\n\t\treturn 0\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "48c0a043213f50adb40666594624860f", "score": "0.41938722", "text": "func (v *Value) ToDots(uc *Context) float32 {\n\tif v.DotsFunc != nil {\n\t\tv.Dots = v.DotsFunc(uc)\n\t} else {\n\t\tv.Dots = uc.ToDots(v.Val, v.Un)\n\t}\n\treturn v.Dots\n}", "title": "" }, { "docid": "0b71c6dbcf7f6dfda3ea5beeeb64a946", "score": "0.41869593", "text": "func (n *CastExpression) Position() (r token.Position) {\n\tif n == nil {\n\t\treturn r\n\t}\n\n\tswitch n.Case {\n\tcase 1:\n\t\tif p := n.Token.Position(); p.IsValid() {\n\t\t\treturn p\n\t\t}\n\n\t\tif p := n.TypeName.Position(); p.IsValid() {\n\t\t\treturn p\n\t\t}\n\n\t\tif p := n.Token2.Position(); p.IsValid() {\n\t\t\treturn p\n\t\t}\n\n\t\treturn n.CastExpression.Position()\n\tcase 0:\n\t\treturn n.UnaryExpression.Position()\n\tdefault:\n\t\tpanic(\"internal error\")\n\t}\n}", "title": "" }, { "docid": "8674a57ee59978a0887a6c894048359f", "score": "0.41860613", "text": "func FormatPos(pos lexer.Position) string {\n\treturn fmt.Sprintf(\"%s:%d:%d:\", pos.Filename, pos.Line, pos.Column)\n}", "title": "" }, { "docid": "7c9df16c7e9d9258fd45291ca825f7cf", "score": "0.4181192", "text": "func IntervalToSeconds(interval string) int {\n\tperiod_letter := string(interval[len(interval)-1])\n\tintr := string(interval[:len(interval)-1])\n\ti, _ := strconv.Atoi(intr)\n\n\tswitch period_letter {\n\tcase \"s\":\n\t\treturn i\n\tcase \"m\":\n\t\treturn i * 60\n\tcase \"h\":\n\t\treturn i * 3600\n\tcase \"d\":\n\t\treturn i * 24 * 3600\n\t}\n\treturn i\n}", "title": "" }, { "docid": "5df3968e3f2da4a6b6b6efe95ecc6f64", "score": "0.41721424", "text": "func getFloatString(str string) string {\n\tstr = strings.Replace(str, \",\", \"\", -1)\n\tstr = strings.Replace(str, \" \", \"\", -1)\n\treturn float.FindString(str)\n}", "title": "" }, { "docid": "948652059035313b31aa79fc0376917b", "score": "0.41685665", "text": "func convert(n string) int64 {\n\tnum, err := strconv.ParseInt(n[len(n)-10:len(n)], 10, 64)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn num\n}", "title": "" }, { "docid": "b7ff4cd6ce412030cd48adb306ec053b", "score": "0.4165769", "text": "func ToInt(s string) int {\n\tif strings.Contains(s, \".\") {\n\t\ts = strings.Split(s, \".\")[0]\n\t}\n\n\tv, err := strconv.Atoi(s)\n\tif err != nil {\n\t\treturn 0\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "54881f675273bf0fe9dd9ba7e423b3e5", "score": "0.4164724", "text": "func FloatCasasDecimais(input_num float64, casaDecimal int) float64 {\n\n\t// converte numero para string, manter duas casas decimais\n\tstrFloat := strconv.FormatFloat(input_num, 'f', casaDecimal, 64)\n\n\treturn StringToFloat(strFloat)\n}", "title": "" }, { "docid": "cdfdd39300ff4443409ba354e2b88e53", "score": "0.41586035", "text": "func (_ABCtoken *ABCtokenCaller) Decimals(opts *bind.CallOpts) (uint8, error) {\n\tvar (\n\t\tret0 = new(uint8)\n\t)\n\tout := ret0\n\terr := _ABCtoken.contract.Call(opts, out, \"decimals\")\n\treturn *ret0, err\n}", "title": "" } ]
3f543dffc9d82ce26d82792024443fb2
isMounted checks if target is mounted. It does NOT return an error if target doesn't exist.
[ { "docid": "896857b5aa124f2bf9d972936af702be", "score": "0.7590429", "text": "func (d *nodeService) isMounted(_ string, target string) (bool, error) {\n\t/*\n\t\tChecking if it's a mount point using IsLikelyNotMountPoint. There are three different return values,\n\t\t1. true, err when the directory does not exist or corrupted.\n\t\t2. false, nil when the path is already mounted with a device.\n\t\t3. true, nil when the path is not mounted with any device.\n\t*/\n\tnotMnt, err := d.mounter.IsLikelyNotMountPoint(target)\n\tif err != nil && !os.IsNotExist(err) {\n\t\t//Checking if the path exists and error is related to Corrupted Mount, in that case, the system could unmount and mount.\n\t\t_, pathErr := d.mounter.PathExists(target)\n\t\tif pathErr != nil && d.mounter.IsCorruptedMnt(pathErr) {\n\t\t\tklog.V(4).InfoS(\"NodePublishVolume: Target path is a corrupted mount. Trying to unmount.\", \"target\", target)\n\t\t\tif mntErr := d.mounter.Unpublish(target); mntErr != nil {\n\t\t\t\treturn false, status.Errorf(codes.Internal, \"Unable to unmount the target %q : %v\", target, mntErr)\n\t\t\t}\n\t\t\t//After successful unmount, the device is ready to be mounted.\n\t\t\treturn false, nil\n\t\t}\n\t\treturn false, status.Errorf(codes.Internal, \"Could not check if %q is a mount point: %v, %v\", target, err, pathErr)\n\t}\n\n\t// Do not return os.IsNotExist error. Other errors were handled above. The\n\t// Existence of the target should be checked by the caller explicitly and\n\t// independently because sometimes prior to mount it is expected not to exist\n\t// (in Windows, the target must NOT exist before a symlink is created at it)\n\t// and in others it is an error (in Linux, the target mount directory must\n\t// exist before mount is called on it)\n\tif err != nil && os.IsNotExist(err) {\n\t\tklog.V(5).InfoS(\"[Debug] NodePublishVolume: Target path does not exist\", \"target\", target)\n\t\treturn false, nil\n\t}\n\n\tif !notMnt {\n\t\tklog.V(4).InfoS(\"NodePublishVolume: Target path is already mounted\", \"target\", target)\n\t}\n\n\treturn !notMnt, nil\n}", "title": "" } ]
[ { "docid": "24e21c19f928b98928a89483d1c7133a", "score": "0.75390697", "text": "func (d *Device) IsMounted() bool {\n\treturn d.isMounted\n}", "title": "" }, { "docid": "f7ea664f152edd4e2fddf09bda729c95", "score": "0.7153774", "text": "func IsMounted() (bool, error) {\n\treturn IsMountedAt(BPFFSPath)\n}", "title": "" }, { "docid": "77a2811868e33044c9626032004c64ca", "score": "0.6909656", "text": "func (volume *sharedVolume) isMounted() (bool, error) {\n\tlocksDir := volume.GetLocksDir()\n\n\tfiles, err := ioutil.ReadDir(locksDir)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tfor _, file := range files {\n\t\tif !file.IsDir() && filepath.Ext(file.Name()) == \".mount\" {\n\t\t\t// We are only interested if such a file exists\n\t\t\treturn true, nil\n\t\t}\n\t}\n\n\treturn false, nil\n}", "title": "" }, { "docid": "26c8d11820ff1bc2d34d1f613b9623f4", "score": "0.68333757", "text": "func (d *Dataset) IsMounted() (mounted bool, where string) {\n\tvar cw *C.char\n\tif d.list == nil {\n\t\treturn false, \"\"\n\t}\n\tm := C.zfs_is_mounted(d.list.zh, &cw)\n\tdefer C.free_cstring(cw)\n\tif m != 0 {\n\t\treturn true, C.GoString(cw)\n\t}\n\treturn false, \"\"\n}", "title": "" }, { "docid": "bc4aa7738755cb0774945d24a1117799", "score": "0.6515204", "text": "func IsMounted() (bool, error) {\n\tvar data syscall.Statfs_t\n\tif err := syscall.Statfs(BPFFSPath, &data); err != nil {\n\t\treturn false, fmt.Errorf(\"cannot statfs %q: %v\", BPFFSPath, err)\n\t}\n\treturn data.Type == FsMagicBPFFS, nil\n}", "title": "" }, { "docid": "9bc2c2e8bb210aa20922e9754557b8bc", "score": "0.6361153", "text": "func isMounted(mountpoint string) (bool, error) {\n\tf, err := os.Open(\"/proc/self/mountinfo\")\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"cannot read mountinfo: %v\", err)\n\t}\n\tdefer f.Close()\n\n\t// format of mountinfo:\n\t// 38 23 0:30 / /sys/fs/cgroup/devices rw,relatime - cgroup cgroup rw,devices\n\t// 39 23 0:31 / /sys/fs/cgroup/freezer rw,relatime - cgroup cgroup rw,freezer\n\t// 33 22 8:17 / /mnt rw,relatime - ext4 /dev/sdb1 rw,data=ordered\n\t// so we split the lines into the specified format and match the mountpoint\n\t// at 5th field.\n\t//\n\t// This code is adopted from https://github.com/docker/docker/blob/master/pkg/mount/mountinfo_linux.go\n\n\toldFi, err := os.Stat(mountpoint)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn false, fmt.Errorf(\"cannot stat mountpoint: %v\", err)\n\t}\n\n\ts := bufio.NewScanner(f)\n\tfor s.Scan() {\n\t\tt := s.Text()\n\t\tf := strings.Fields(t)\n\t\tif len(f) < 5 {\n\t\t\treturn false, fmt.Errorf(\"mountinfo line %q has less than 5 fields, cannot parse mountpoint\", t)\n\t\t}\n\t\tmp := f[4] // ID, Parent, Major, Minor, Root, *Mountpoint*, Opts, OptionalFields\n\t\tfi, err := os.Stat(mp)\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"cannot stat %s: %v\", mp, err)\n\t\t}\n\t\tsame := os.SameFile(oldFi, fi)\n\t\tif same {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\tlog.Debug(\"mountpoint not found\")\n\treturn false, nil\n}", "title": "" }, { "docid": "c0e49842bbf9156393afef4dcd91a74c", "score": "0.6214286", "text": "func (b *storageosMounter) CanMount() error {\n\treturn nil\n}", "title": "" }, { "docid": "9b45b3d6e28b3708fd65b5b1019e1f3f", "score": "0.6162452", "text": "func (snap *Snapshot) IsMountedAt(mountPoint string) (bool, error) {\n\treturn devIsMountedAt(snap, mountPoint)\n}", "title": "" }, { "docid": "9deb577c5707626a8c24b97da24b58c4", "score": "0.5953864", "text": "func IsMountedAt(mountpoint string) (bool, error) {\n\tvar data syscall.Statfs_t\n\tif err := syscall.Statfs(mountpoint, &data); err != nil {\n\t\treturn false, fmt.Errorf(\"cannot statfs %q: %v\", mountpoint, err)\n\t}\n\treturn int32(data.Type) == FsMagicBPFFS, nil\n}", "title": "" }, { "docid": "ec33575e63dc0d58c35e9021d6a9f230", "score": "0.59096444", "text": "func detectSafeNotMountedBehavior() bool {\n\treturn detectSafeNotMountedBehaviorWithExec(utilexec.New())\n}", "title": "" }, { "docid": "f91878e38f3a7aaa194b3309297fa030", "score": "0.59070104", "text": "func IsUnmountRequired(volumeID, targetPath string) (bool, error) {\n\tvar (\n\t\tcurrentMounts []string\n\t\terr error\n\t)\n\tcurrentMounts, err = utils.GetMounts(volumeID)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif len(currentMounts) > 1 {\n\t\tlogrus.Fatalf(\n\t\t\t\"More than one mounts for volume:%s mounts: %v\",\n\t\t\tvolumeID, currentMounts,\n\t\t)\n\t}\n\tif len(currentMounts) == 0 {\n\t\treturn false, nil\n\t}\n\tif currentMounts[0] != targetPath {\n\t\treturn false, err\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "73e195afae20f68e566da12f6bdea482", "score": "0.5792019", "text": "func cgroupsMounted(node *structs.Node) bool {\n\t_, ok := node.Attributes[\"unique.cgroup.mountpoint\"]\n\treturn ok\n}", "title": "" }, { "docid": "10194115ba25454455fcf5b1916f778f", "score": "0.57755727", "text": "func IsMutagenVolumeMounted(app *DdevApp) (bool, error) {\n\tclient := dockerutil.GetDockerClient()\n\tcontainer, err := dockerutil.FindContainerByName(\"ddev-\" + app.Name + \"-web\")\n\t// If there is no web container found, the volume is not mounted\n\tif err != nil || container == nil {\n\t\treturn false, nil\n\t}\n\tinspect, err := client.InspectContainerWithOptions(docker.InspectContainerOptions{\n\t\tID: container.ID,\n\t})\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tfor _, m := range inspect.Mounts {\n\t\tif m.Name == app.Name+\"_project_mutagen\" {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "a21287f4d4ecdc92f7083760e616a8b2", "score": "0.57332766", "text": "func Mounted(mountpoint string) (bool, error) {\n\tentries, err := parseMountTable()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\t// Search the table for the mountpoint\n\tfor _, e := range entries {\n\t\tif e.Mountpoint == mountpoint {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "fa9d624197fd82901ecae42935f1e112", "score": "0.56307656", "text": "func (mounter *Mounter) CanSafelySkipMountPointCheck() bool {\n\treturn mounter.withSafeNotMountedBehavior\n}", "title": "" }, { "docid": "5098a12cabdb3a966809802220e80f52", "score": "0.56075454", "text": "func Mounted(path string) (bool, error) {\n\t// root is always mounted\n\tif path == string(os.PathSeparator) {\n\t\treturn true, nil\n\t}\n\treturn mounted(path)\n}", "title": "" }, { "docid": "d3c360bcdb924a4a0aeedcfd2eec6bc7", "score": "0.5590537", "text": "func (d *cephRBDVolumeDriver) isMountpoint(path string) (error, bool) {\n\t// check if dir exist\n\tfInfo, e := os.Stat(path)\n\tlog.Printf(\"INFO: Stat, %s\\n\", e)\n\tif e != nil {\n\t\t// dir not exist\n\t\tif strings.Contains(e.Error(), \"no such file or directory\") {\n\t\t\treturn nil, false\n\t\t} else { // when the dest dir has an IO error, Stat will return \"\"input/output error\n\t\t\treturn e, false\n\t\t}\n\t} else {\n\t\tif !fInfo.IsDir() {\n\t\t\temsg := fmt.Sprintf(\"path(%s) invalid\", path)\n\t\t\treturn errors.New(emsg), false\n\t\t}\n\t}\n\n\tout, err := shWithDefaultTimeout(\"mountpoint\", path)\n\tif err != nil {\n\t\treturn nil, false\n\t}\n\tif strings.Contains(out, \"is a mountpoint\") {\n\t\treturn nil, true\n\t}\n\treturn nil, false\n}", "title": "" }, { "docid": "333d6a6d3388daf2f1cc554d66090afa", "score": "0.5564748", "text": "func isDebugFsMounted() bool {\n\tmounts, err := os.ReadFile(\"/proc/mounts\")\n\tif err != nil {\n\t\tlog.Warningf(\"Failed to read /proc/mounts: %v\", err)\n\t\treturn false\n\t}\n\n\tfor _, line := range strings.Split(string(mounts), \"\\n\") {\n\t\ttokens := strings.Fields(line)\n\t\tif len(tokens) == 6 && tokens[0] == \"debugfs\" && tokens[1] == debugFsPath {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6d9d1a272c8be70124758cf17cbed369", "score": "0.5514", "text": "func IsMountHelper() bool {\n\tif runtime.GOOS == \"windows\" {\n\t\treturn false\n\t}\n\tme := filepath.Base(os.Args[0])\n\treturn me == \"mount.rclone\" || me == \"rclonefs\"\n}", "title": "" }, { "docid": "44dd3bb121d27b6e8c5bcb7c72af27d7", "score": "0.55118054", "text": "func VerifyIfMountRequired(volumeID, targetPath string) (bool, error) {\n\tvar (\n\t\tcurrentMounts []string\n\t\terr error\n\t)\n\tcurrentMounts, err = utils.GetMounts(volumeID)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif len(currentMounts) > 1 {\n\t\tlogrus.Fatalf(\n\t\t\t\"More than one mounts for volume:%s mounts: %v\",\n\t\t\tvolumeID, currentMounts,\n\t\t)\n\t}\n\tif len(currentMounts) == 1 {\n\t\tif currentMounts[0] == targetPath {\n\t\t\treturn false, nil\n\t\t}\n\t\tif err = iscsi.Unmount(currentMounts[0]); err != nil {\n\t\t\treturn false, err\n\t\t}\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "80f8c1017926a86f4bd8bb85da173b4a", "score": "0.5511395", "text": "func (vol *Volume) checkMountpoint() error {\n\tpath := vol.mnt.MountPoint\n\tif runtime.GOOS == \"windows\" {\n\t\tpath = filepath.Dir(path)\n\t}\n\t_, err := os.Lstat(path)\n\tif os.IsNotExist(err) {\n\t\tif err = file.MkdirAll(path, 0700); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create mountpoint: %s: %w\", path, err)\n\t\t}\n\t} else if err != nil {\n\t\treturn err\n\t}\n\tif runtime.GOOS != \"windows\" {\n\t\tif err := mountlib.CheckMountEmpty(path); err != nil {\n\t\t\treturn ErrMountpointExists\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "53b66517c8fd94263bcf5e84c07cd4b4", "score": "0.545712", "text": "func Mounted(fsType FsMagic, mountPath string) (bool, error) {\n\tvar buf unix.Statfs_t\n\n\tif err := unix.Statfs(mountPath, &buf); err != nil {\n\t\treturn false, err\n\t}\n\tif FsMagic(buf.Type) != fsType {\n\t\treturn false, nil\n\t}\n\treturn isMountPoint(mountPath)\n}", "title": "" }, { "docid": "5aae3ba7874d06fb7059b81514772030", "score": "0.54274565", "text": "func (d *disk) CanHotPlug() bool {\n\treturn !(d.sourceIsDir() || d.sourceIsCephFs()) || d.inst.Type() == instancetype.Container\n}", "title": "" }, { "docid": "08a105aab0a32e6712158cc4b69c1f84", "score": "0.5389506", "text": "func (d *cephRBDVolumeDriver) verifyDeviceFilesystem(device, mount, fstype string) error {\n\t// for now we only handle XFS\n\t// TODO: use fsck for ext4?\n\tif fstype != \"xfs\" {\n\t\treturn nil\n\t}\n\n\t// check XFS volume\n\terr := d.xfsRepairDryRun(device)\n\tif err != nil {\n\t\tswitch err.(type) {\n\t\tcase ShTimeoutError:\n\t\t\t// propagate timeout errors - can't recover? system error? don't try to mount at that point\n\t\t\treturn err\n\t\tdefault:\n\t\t\t// assume any other error is xfs error and attempt limited repair\n\t\t\treturn d.attemptLimitedXFSRepair(fstype, device, mount)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "08a105aab0a32e6712158cc4b69c1f84", "score": "0.5389506", "text": "func (d *cephRBDVolumeDriver) verifyDeviceFilesystem(device, mount, fstype string) error {\n\t// for now we only handle XFS\n\t// TODO: use fsck for ext4?\n\tif fstype != \"xfs\" {\n\t\treturn nil\n\t}\n\n\t// check XFS volume\n\terr := d.xfsRepairDryRun(device)\n\tif err != nil {\n\t\tswitch err.(type) {\n\t\tcase ShTimeoutError:\n\t\t\t// propagate timeout errors - can't recover? system error? don't try to mount at that point\n\t\t\treturn err\n\t\tdefault:\n\t\t\t// assume any other error is xfs error and attempt limited repair\n\t\t\treturn d.attemptLimitedXFSRepair(fstype, device, mount)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dfe128434589424c9d3f8fee3d835a60", "score": "0.5360525", "text": "func CheckMountReady(mountpoint string) error {\n\treturn nil\n}", "title": "" }, { "docid": "c0201fd674d017a8e3fa76cc099b4170", "score": "0.5335818", "text": "func isMountPoint(mountPath string) (bool, error) {\n\t// it is already the root\n\tif mountPath == \"/\" {\n\t\treturn true, nil\n\t}\n\n\tvar s1, s2 unix.Stat_t\n\tif err := unix.Stat(mountPath, &s1); err != nil {\n\t\treturn true, err\n\t}\n\tif err := unix.Stat(filepath.Dir(mountPath), &s2); err != nil {\n\t\treturn true, err\n\t}\n\treturn s1.Dev != s2.Dev, nil\n}", "title": "" }, { "docid": "1d1212acef9a26d058e156e0b68f5d47", "score": "0.5309119", "text": "func (mounter *csiProxyMounter) IsLikelyNotMountPoint(path string) (bool, error) {\n\tisExists, err := mounter.ExistsPath(mounter.Ctx, path)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif !isExists {\n\t\treturn true, os.ErrNotExist\n\t}\n\n\tresponse, err := mounter.FsClient.IsSymlink(mounter.Ctx,\n\t\t&fs.IsSymlinkRequest{\n\t\t\tPath: normalizeWindowsPath(path),\n\t\t})\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn !response.IsSymlink, nil\n\t//TODO check if formatted else error out\n}", "title": "" }, { "docid": "bf94b45ff430a204fc91592d67f96554", "score": "0.52678764", "text": "func IsInUse(mountDir string, log Log) bool {\n\tlog.Debug(\"Mount dir: %s\", mountDir)\n\tif mountDir == \"\" {\n\t\treturn false\n\t}\n\tif _, serr := os.Stat(mountDir); os.IsNotExist(serr) {\n\t\tlog.Debug(\"%s doesn't exist\", mountDir)\n\t\treturn false\n\t}\n\n\tlog.Debug(\"Checking mount (lsof)\")\n\tprocesses, err := lsof.MountPoint(mountDir)\n\tif err != nil {\n\t\t// If there is an error in lsof it's ok to continue\n\t\t// An exit status of 1 means that the mount is not in use, and is\n\t\t// not really an error.\n\t\t// TODO: Remove this when we fix lsof\n\t\tlog.Warning(\"Continuing despite error in lsof: %s\", err)\n\t}\n\tif len(processes) != 0 {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4620ade40248c34432663aa5356b558e", "score": "0.5252163", "text": "func (app *DdevApp) IsNFSMountEnabled() bool {\n\treturn !app.IsMutagenEnabled() && app.GetPerformanceMode() == types.PerformanceModeNFS\n}", "title": "" }, { "docid": "0fe997c7e7e50d38b689aa6a5e23dee4", "score": "0.5234158", "text": "func (mounter *Mounter) IsLikelyNotMountPoint(file string) (bool, error) {\n\tstat, err := os.Stat(file)\n\tif err != nil {\n\t\treturn true, err\n\t}\n\trootStat, err := os.Stat(filepath.Dir(strings.TrimSuffix(file, \"/\")))\n\tif err != nil {\n\t\treturn true, err\n\t}\n\t// If the directory has a different device as parent, then it is a mountpoint.\n\tif stat.Sys().(*syscall.Stat_t).Dev != rootStat.Sys().(*syscall.Stat_t).Dev {\n\t\treturn false, nil\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "6922716160931c8772622413de590340", "score": "0.5233819", "text": "func (mounter *CSIProxyMounter) IsLikelyNotMountPoint(path string) (bool, error) {\n\tisExists, err := mounter.ExistsPath(path)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif !isExists {\n\t\treturn true, os.ErrNotExist\n\t}\n\n\tresponse, err := mounter.FsClient.IsMountPoint(context.Background(),\n\t\t&fsv1alpha1.IsMountPointRequest{\n\t\t\tPath: normalizeWindowsPath(path),\n\t\t})\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn !response.IsMountPoint, nil\n}", "title": "" }, { "docid": "beb8856b84251b76ced2469519ff2384", "score": "0.52248776", "text": "func (mounter *Mounter) IsLikelyNotMountPoint(file string) (bool, error) {\n\tstat, err := os.Stat(file)\n\tif err != nil {\n\t\treturn true, err\n\t}\n\trootStat, err := os.Lstat(filepath.Dir(strings.TrimSuffix(file, \"/\")))\n\tif err != nil {\n\t\treturn true, err\n\t}\n\t// If the directory has a different device as parent, then it is a mountpoint.\n\tif stat.Sys().(*syscall.Stat_t).Dev != rootStat.Sys().(*syscall.Stat_t).Dev {\n\t\treturn false, nil\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "1cd33a313da395134921af5bfd54a268", "score": "0.5157974", "text": "func testMount(mounts []mountV, err error) int {\n\tif mounts != nil && len(mounts) > 0 {\n\t\treturn 1\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "8deb379fb2fd4ac86edad6f8ac142b7f", "score": "0.5141472", "text": "func (config *Config) UseMount(path string) (bool, error) {\n\tif exists, err := testDir(path); err != nil {\n\t\treturn exists, err\n\t} else if exists {\n\t\tconfig.mount = path\n\n\t\treturn true, nil\n\t} else {\n\t\treturn false, nil\n\t}\n}", "title": "" }, { "docid": "9783e6fb315ae5566c48f6c8dc2d0652", "score": "0.51327914", "text": "func tryUnmount(target string, withSafeNotMountedBehavior bool, unmountTimeout time.Duration) error {\n\tklog.V(4).Infof(\"Unmounting %s\", target)\n\tctx, cancel := context.WithTimeout(context.Background(), unmountTimeout)\n\tdefer cancel()\n\n\tcommand := exec.CommandContext(ctx, \"umount\", target)\n\toutput, err := command.CombinedOutput()\n\n\t// CombinedOutput() does not return DeadlineExceeded, make sure it's\n\t// propagated on timeout.\n\tif ctx.Err() != nil {\n\t\treturn ctx.Err()\n\t}\n\n\tif err != nil {\n\t\treturn checkUmountError(target, command, output, err, withSafeNotMountedBehavior)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "07c835aba94845b04d3878c920ac8087", "score": "0.5085378", "text": "func detectSafeNotMountedBehaviorWithExec(exec utilexec.Interface) bool {\n\t// create a temp dir and try to umount it\n\tpath, err := os.MkdirTemp(\"\", \"kubelet-detect-safe-umount\")\n\tif err != nil {\n\t\tklog.V(4).Infof(\"Cannot create temp dir to detect safe 'not mounted' behavior: %v\", err)\n\t\treturn false\n\t}\n\tdefer os.RemoveAll(path)\n\tcmd := exec.Command(\"umount\", path)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\tif strings.Contains(string(output), errNotMounted) {\n\t\t\tklog.V(4).Infof(\"Detected umount with safe 'not mounted' behavior\")\n\t\t\treturn true\n\t\t}\n\t\tklog.V(4).Infof(\"'umount %s' failed with: %v, output: %s\", path, err, string(output))\n\t}\n\tklog.V(4).Infof(\"Detected umount with unsafe 'not mounted' behavior\")\n\treturn false\n}", "title": "" }, { "docid": "e90dc0bed77b6c88ba45e4f38f158e51", "score": "0.5060735", "text": "func (mounter *Mounter) Mount(source string, target string, fstype string, options []string) error {\n\t// Path to mounter binary if containerized mounter is needed. Otherwise, it is set to empty.\n\t// All Linux distros are expected to be shipped with a mount utility that a support bind mounts.\n\tmounterPath := \"\"\n\tbind, bindRemountOpts := isBind(options)\n\tif bind {\n\t\terr := mounter.doMount(mounterPath, defaultMountCommand, source, target, fstype, []string{\"bind\"})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn mounter.doMount(mounterPath, defaultMountCommand, source, target, fstype, bindRemountOpts)\n\t}\n\t// The list of filesystems that require containerized mounter on GCI image cluster\n\t// fsTypesNeedMounter := sets.NewString(\"nfs\", \"glusterfs\", \"ceph\", \"cifs\")\n\t// if fsTypesNeedMounter.Has(fstype) {\n\t// \tmounterPath = mounter.mounterPath\n\t// }\n\treturn mounter.doMount(mounterPath, defaultMountCommand, source, target, fstype, options)\n}", "title": "" }, { "docid": "f5890530e8d16dd9d3d292b03506c223", "score": "0.5056211", "text": "func checkCrossDeviceMounts(endpoints EndpointList) (err error) {\n\tvar absPaths []string\n\tfor _, endpoint := range endpoints {\n\t\tif endpoint.IsLocal {\n\t\t\tvar absPath string\n\t\t\tabsPath, err = filepath.Abs(endpoint.Path)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tabsPaths = append(absPaths, absPath)\n\t\t}\n\t}\n\treturn mountinfo.CheckCrossDevice(absPaths)\n}", "title": "" }, { "docid": "fb431129d4cd5faedfa7d9a57e39ece0", "score": "0.50202304", "text": "func (d *disk) CanMigrate() bool {\n\t// Root disk is always migratable.\n\tif d.config[\"path\"] == \"/\" {\n\t\treturn true\n\t}\n\n\t// Remote disks are migratable.\n\tif d.pool.Driver().Info().Remote {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b409f28429b0fa2a34bdb254b7943967", "score": "0.5007347", "text": "func (mounter *Mounter) Mount(source string, target string, fstype string, options []string) error {\n\t// Path to mounter binary if containerized mounter is needed. Otherwise, it is set to empty.\n\t// All Linux distros are expected to be shipped with a mount utility that an support bind mounts.\n\tmounterPath := \"\"\n\tbind, bindRemountOpts := isBind(options)\n\tif bind {\n\t\terr := doMount(mounterPath, defaultMountCommand, source, target, fstype, []string{\"bind\"})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn doMount(mounterPath, defaultMountCommand, source, target, fstype, bindRemountOpts)\n\t}\n\t// The list of filesystems that require containerized mounter on GCI image cluster\n\tfsTypesNeedMounter := sets.NewString(\"nfs\", \"glusterfs\", \"ceph\", \"cifs\")\n\tif fsTypesNeedMounter.Has(fstype) {\n\t\tmounterPath = mounter.mounterPath\n\t}\n\treturn doMount(mounterPath, defaultMountCommand, source, target, fstype, options)\n}", "title": "" }, { "docid": "323bbeb7f7ccd4e5f4d7d03b520696b3", "score": "0.500563", "text": "func IsLikelyNotMountPoint(file string) (bool, error) {\n\tstat, err := os.Stat(file)\n\tif err != nil {\n\t\treturn true, err\n\t}\n\trootStat, err := os.Lstat(filepath.Dir(strings.TrimSuffix(file, \"/\")))\n\tif err != nil {\n\t\treturn true, err\n\t}\n\t// If the directory has a different device as parent, then it is a mountpoint.\n\tif stat.Sys().(*syscall.Stat_t).Dev != rootStat.Sys().(*syscall.Stat_t).Dev {\n\t\treturn false, nil\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "71d09d58bf3b403bb893ed68dadd187c", "score": "0.50052094", "text": "func (mounter *Mounter) IsMountPoint(file string) (bool, error) {\n\tisMnt, sure, isMntErr := mountinfo.MountedFast(file)\n\tif sure && isMntErr == nil {\n\t\treturn isMnt, nil\n\t}\n\tif isMntErr != nil {\n\t\tif errors.Is(isMntErr, fs.ErrNotExist) {\n\t\t\treturn false, fs.ErrNotExist\n\t\t}\n\t\t// We were not allowed to do the simple stat() check, e.g. on NFS with\n\t\t// root_squash. Fall back to /proc/mounts check below when\n\t\t// fs.ErrPermission is returned.\n\t\tif !errors.Is(isMntErr, fs.ErrPermission) {\n\t\t\treturn false, isMntErr\n\t\t}\n\t}\n\t// Resolve any symlinks in file, kernel would do the same and use the resolved path in /proc/mounts.\n\tresolvedFile, err := filepath.EvalSymlinks(file)\n\tif err != nil {\n\t\tif errors.Is(err, fs.ErrNotExist) {\n\t\t\treturn false, fs.ErrNotExist\n\t\t}\n\t\treturn false, err\n\t}\n\n\t// check all mountpoints since MountedFast is not sure.\n\t// is not reliable for some mountpoint types.\n\tmountPoints, mountPointsErr := mounter.List()\n\tif mountPointsErr != nil {\n\t\treturn false, mountPointsErr\n\t}\n\tfor _, mp := range mountPoints {\n\t\tif isMountPointMatch(mp, resolvedFile) {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "5a246017b658df0fc2e5ace6a99383e8", "score": "0.49891075", "text": "func (mounter *Mounter) PathIsDevice(pathname string) (bool, error) {\n\treturn pathIsDevice(pathname)\n}", "title": "" }, { "docid": "cff00a5e620eb818ce48ffbc27408faf", "score": "0.4981667", "text": "func (dm dummyFuseManager) MountInfo() []modules.MountInfo { return nil }", "title": "" }, { "docid": "25fe2312d50127bc9a76f37546311ae4", "score": "0.49457854", "text": "func mountPoint(rt *api.ServingRuntime) (bool, string, error) {\n\tfindParentPath := func(str string) (bool, string, error) {\n\t\te, err := ParseEndpoint(str)\n\t\tif err != nil {\n\t\t\treturn false, \"\", err\n\t\t}\n\t\tif _, ok := e.(TCPEndpoint); ok {\n\t\t\treturn false, \"\", nil\n\t\t}\n\t\tif udsE, ok := e.(UnixEndpoint); ok {\n\t\t\treturn true, udsE.ParentPath, nil\n\t\t}\n\t\treturn false, \"\", errors.New(\"Cannot find the mount point for input \" + str)\n\t}\n\n\t//if rt.Spec.HTTPDataEndpoint != nil {\n\t//\tisUnix, path, err := findParentPath(*rt.Spec.HTTPDataEndpoint)\n\t//\treturn isUnix, path, err\n\t//}\n\tif rt.Spec.GrpcDataEndpoint != nil {\n\t\tisUnix, path, err := findParentPath(*rt.Spec.GrpcDataEndpoint)\n\t\treturn isUnix, path, err\n\t}\n\tif rt.Spec.GrpcMultiModelManagementEndpoint != nil {\n\t\tisUnix, path, err := findParentPath(*rt.Spec.GrpcMultiModelManagementEndpoint)\n\t\treturn isUnix, path, err\n\t}\n\n\treturn false, \"\", nil\n}", "title": "" }, { "docid": "241ec2b6aee82a7bf0596a17b8800651", "score": "0.49134693", "text": "func (c *GlobalConfig) IsNFSMountEnabled() bool {\n\treturn c.GetPerformanceMode() == types.PerformanceModeNFS\n}", "title": "" }, { "docid": "940c4439999a5f3fc8ae85c87f2960a6", "score": "0.48918235", "text": "func isDevice(f *os.File) bool {\n\tst, err := f.Stat()\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn st.Mode()&os.ModeDevice != 0\n}", "title": "" }, { "docid": "f35cc283da3727365b575b8538d37373", "score": "0.48837438", "text": "func IsExists(targetDev string) bool {\n\tdevPath := devPath(targetDev)\n\n\tif _, err := cmd.ExecutionCMD(\"lsblk \" + devPath); err != nil {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "0d866e75d62ac30a07a7b8ae80535f96", "score": "0.48509517", "text": "func (d *vtkData) verifyVaultMount() error {\n\tmountNotExists := true\n\tvaultMount := strings.SplitN(vaultSecretsPath, \"/\", 2)[0] + \"/\"\n\tvaultMountsIn, err := d.vaultClient.Sys().ListMounts()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Failed to get list Vault mounts\")\n\t}\n\tfor k, m := range vaultMountsIn {\n\t\tif !strings.HasPrefix(vaultMount, k) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif m.Type != \"kv\" {\n\t\t\treturn fmt.Errorf(\"Matching mount '%s' for path '%s' is not of type kv\", k, vaultMount)\n\t\t}\n\n\t\tkvVersion, _ := strconv.Atoi(m.Options[\"version\"])\n\t\tif kvVersion != 2 {\n\t\t\treturn fmt.Errorf(\"Vault mount '%s' and defined path '%s' matched but Vault mount version is not '2'\", k, vaultMount)\n\t\t}\n\t\tmountNotExists = false\n\t}\n\tif mountNotExists {\n\t\treturn fmt.Errorf(\"Mount path: '%s' doesn't exists in Vault\", vaultMount)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1278dac3cd2f0ee4bb1536ae8ae9b4c9", "score": "0.48445866", "text": "func (p *Path) IsDevice() bool {\n\treturn p.PathLen == 2\n}", "title": "" }, { "docid": "c3b8c87134990d2175798963a8d46e7a", "score": "0.48380834", "text": "func mount(f fs.Fs, mountpoint string) (*mountlib.FS, <-chan error, func() error, error) {\n\tfs.Debugf(f, \"Mounting on %q\", mountpoint)\n\n\t// Check the mountpoint - in Windows the mountpoint musn't exist before the mount\n\tif runtime.GOOS != \"windows\" {\n\t\tfi, err := os.Stat(mountpoint)\n\t\tif err != nil {\n\t\t\treturn nil, nil, nil, errors.Wrap(err, \"mountpoint\")\n\t\t}\n\t\tif !fi.IsDir() {\n\t\t\treturn nil, nil, nil, errors.New(\"mountpoint is not a directory\")\n\t\t}\n\t}\n\n\t// Create underlying FS\n\tfsys := NewFS(f)\n\thost := fuse.NewFileSystemHost(fsys)\n\n\t// Create options\n\toptions := mountOptions(f.Name()+\":\"+f.Root(), mountpoint)\n\tfs.Debugf(f, \"Mounting with options: %q\", options)\n\n\t// Serve the mount point in the background returning error to errChan\n\terrChan := make(chan error, 1)\n\tgo func() {\n\t\tvar err error\n\t\tok := host.Mount(mountpoint, options)\n\t\tif !ok {\n\t\t\terr = errors.New(\"mount failed\")\n\t\t\tfs.Errorf(f, \"Mount failed\")\n\t\t}\n\t\terrChan <- err\n\t}()\n\n\t// unmount\n\tunmount := func() error {\n\t\tfs.Debugf(nil, \"Calling host.Unmount\")\n\t\tif host.Unmount() {\n\t\t\tfs.Debugf(nil, \"host.Unmount succeeded\")\n\t\t\treturn nil\n\t\t}\n\t\tfs.Debugf(nil, \"host.Unmount failed\")\n\t\treturn errors.New(\"host unmount failed\")\n\t}\n\n\t// Wait for the filesystem to become ready, checking the file\n\t// system didn't blow up before starting\n\tselect {\n\tcase err := <-errChan:\n\t\terr = errors.Wrap(err, \"mount stopped before calling Init\")\n\t\treturn nil, nil, nil, err\n\tcase <-fsys.ready:\n\t}\n\n\t// Wait for the mount point to be available on Windows\n\t// On Windows the Init signal comes slightly before the mount is ready\n\tif runtime.GOOS == \"windows\" {\n\t\tconst totalWait = 10 * time.Second\n\t\tconst individualWait = 10 * time.Millisecond\n\t\tfor i := 0; i < int(totalWait/individualWait); i++ {\n\t\t\t_, err := os.Stat(mountpoint)\n\t\t\tif err == nil {\n\t\t\t\tgoto found\n\t\t\t}\n\t\t\ttime.Sleep(10 * time.Millisecond)\n\t\t}\n\t\tfs.Errorf(nil, \"mountpoint %q didn't became available after %v - continuing anyway\", mountpoint, totalWait)\n\tfound:\n\t}\n\n\treturn fsys.FS, errChan, unmount, nil\n}", "title": "" }, { "docid": "47e8b35c12605f37fa5d12948e31cc7c", "score": "0.4826491", "text": "func (p *Partition) IsDir() bool { return false }", "title": "" }, { "docid": "b11a4d72013b5b10b3a25d06a6bdccb2", "score": "0.4809124", "text": "func Supported() bool {\n\t// This code follows the same strategy as hanwen/go-fuse.\n\t// See https://github.com/hanwen/go-fuse/blob/0f728ba15b38579efefc3dc47821882ca18ffea7/fuse/mount_darwin.go#L121-L124.\n\n\t// check for macfuse first (newer version of osxfuse)\n\tif _, err := os.Stat(macfusePath); err != nil {\n\t\t// if that fails, check for osxfuse next\n\t\tif _, err := os.Stat(osxfusePath); err != nil {\n\t\t\tlogging.Errorf(\"Failed to find osxfuse or macfuse. Verify FUSE installation and try again (see https://osxfuse.github.io).\")\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "66a2ae816796f191e2af0a160632ae5a", "score": "0.47984084", "text": "func (mounter *Mounter) Mount(source string, target string, fstype string, options []string) error {\n\treturn mounter.MountSensitive(source, target, fstype, options, nil)\n}", "title": "" }, { "docid": "03c17bae76bd43c24562e2be6de7ca5c", "score": "0.4797318", "text": "func Supported() bool {\n\t// This code follows the same strategy found in hanwen/go-fuse.\n\t// See https://github.com/hanwen/go-fuse/blob/0f728ba15b38579efefc3dc47821882ca18ffea7/fuse/mount_linux.go#L184-L198.\n\tif _, err := exec.LookPath(\"fusermount\"); err != nil {\n\t\tif _, err := exec.LookPath(\"/bin/fusermount\"); err != nil {\n\t\t\tlogging.Errorf(\"Failed to find fusermount binary in PATH or /bin. Verify FUSE installation and try again.\")\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "77aafb989d240d874de6b6e965d93a4e", "score": "0.47912142", "text": "func mount(devname string) error {\n\treturn exec.Command(mountBin, \"-r\", devname, mountPath).Run()\n}", "title": "" }, { "docid": "0c36a4ed7bb1379a6e8de9dfb0902895", "score": "0.47847703", "text": "func (o *Image) HasRootDeviceName() bool {\n\tif o != nil && o.RootDeviceName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0c849b9930e8f150e21087b52c4aa1f9", "score": "0.47742617", "text": "func (vd VirtualDentry) Ok() bool {\n\treturn vd.mount != nil\n}", "title": "" }, { "docid": "83ae6de0dd45b904de3e366acedf1a0b", "score": "0.47605506", "text": "func (mounter *csiProxyMounter) Unmount(target string) error {\n\t// unmount internally calls WriteVolumeCache so no need to WriteVolumeCache\n\t// normalize target path\n\ttarget = normalizeWindowsPath(target)\n\tif exists, err := mounter.ExistsPath(mounter.Ctx, target); !exists {\n\t\treturn err\n\t}\n\t// get volume id\n\tidRequest := &volume.GetVolumeIDFromTargetPathRequest{\n\t\tTargetPath: target,\n\t}\n\tidResponse, err := mounter.VolumeClient.GetVolumeIDFromTargetPath(mounter.Ctx, idRequest)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvolumeId := idResponse.GetVolumeId()\n\n\t// unmount volume\n\tunmountRequest := &volume.UnmountVolumeRequest{\n\t\tTargetPath: target,\n\t\tVolumeId: volumeId,\n\t}\n\t_, err = mounter.VolumeClient.UnmountVolume(mounter.Ctx, unmountRequest)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// remove the target directory\n\terr = mounter.Rmdir(mounter.Ctx, target)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Set disk to offline mode to have a clean state\n\tgetDiskNumberRequest := &volume.GetDiskNumberFromVolumeIDRequest{\n\t\tVolumeId: volumeId,\n\t}\n\tgetDiskNumberResponse, err := mounter.VolumeClient.GetDiskNumberFromVolumeID(mounter.Ctx, getDiskNumberRequest)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdiskNumber := getDiskNumberResponse.GetDiskNumber()\n\tsetDiskStateRequest := &disk.SetDiskStateRequest{\n\t\tDiskNumber: diskNumber,\n\t\tIsOnline: false,\n\t}\n\tif _, err = mounter.DiskClient.SetDiskState(mounter.Ctx, setDiskStateRequest); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1412622e5cdd6d18edaa4af72526205e", "score": "0.47591636", "text": "func Mount(device, target, mType, options string) error {\n\tflag, _ := parseOptions(options)\n\tif flag&REMOUNT != REMOUNT {\n\t\tif mounted, err := Mounted(target); err != nil || mounted {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn ForceMount(device, target, mType, options)\n}", "title": "" }, { "docid": "f0d301571f034bae552be3f44937cbb5", "score": "0.47502857", "text": "func mount(ctxt context.Context, source, dest string, options []string, fs string) error {\n\tco.Debugf(ctxt, \"Mount called. source: %s, dest: %s, options: %s, fs: %s\", source, dest, options, fs)\n\n\t// Create destination directory if it doesn't exist\n\tif _, err := os.Stat(dest); os.IsNotExist(err) {\n\t\terr = os.MkdirAll(dest, os.ModePerm)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// Get the original device if this is a mount\n\tdev, err := deviceFromMount(ctxt, source)\n\n\t// If we couldn't resolve, then we're probably working with the device already\n\tcmd := []string{}\n\tbind := false\n\n\tif err != nil {\n\t\tdev = source\n\t\tfor _, opt := range options {\n\t\t\tif opt == \"--bind\" {\n\t\t\t\tbind = true\n\t\t\t}\n\t\t}\n\t\tif bind {\n\t\t\tcmd = append([]string{\"mount\", dev, dest}, options...)\n\t\t} else {\n\t\t\tcmd = append([]string{\"mount\", \"-t\", fs, dev, dest}, options...)\n\t\t}\n\t} else {\n\t\t// Remove the --bind option from options array\n\t\tfor idx, opt := range options {\n\t\t\tif opt == \"--bind\" {\n\t\t\t\tcopy(options[idx:], options[idx+1:])\n\t\t\t\toptions[len(options)-1] = \"\"\n\t\t\t\toptions = options[:len(options)-1]\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tcmd = append([]string{\"mount\", dev, dest}, options...)\n\t}\n\n\t_, err = co.RunCmd(ctxt, cmd...)\n\treturn err\n}", "title": "" }, { "docid": "91f741a678b703f43a67c044af6979dd", "score": "0.47380129", "text": "func IsDeviceOpen(device string) (bool, error) {\n\t_, mappedFile, err := DeviceEncryptionStatus(device)\n\treturn mappedFile != \"\", err\n}", "title": "" }, { "docid": "d36f40efc20b3474e50066adf7027010", "score": "0.47289196", "text": "func (o *Image) HasRootDeviceType() bool {\n\tif o != nil && o.RootDeviceType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b47c80bcb59db718ae70cdfab41e0d3d", "score": "0.47215486", "text": "func (c *Client) isDevice() bool {\n\t_, ok := c.info.(*DeviceInfo)\n\treturn ok\n}", "title": "" }, { "docid": "1f1b745bc7198dfe93f1727d099ead71", "score": "0.47204727", "text": "func (m *mount) GetTargetMount(ctx context.Context, target string) (gofsutil.Info, bool, error) {\n\treturn m.getMountIMPLGetMounts().getTargetMount(ctx, target)\n}", "title": "" }, { "docid": "9d78554021095af08dfe0825efe2ea4c", "score": "0.46794605", "text": "func (m *mount) IsReadyToPublishNFS(ctx context.Context, device string) (bool, error) {\n\treturn m.getPublishCheckIMPL().isReadyToPublishNFS(ctx, device)\n}", "title": "" }, { "docid": "ccc71639fdf70d1f82b1ad6c7c534fd3", "score": "0.46625018", "text": "func (dm dummyFuseManager) Unmount(mountPoint string) error { return errNoFuseOnWindows }", "title": "" }, { "docid": "23b09db1b8166b05a8b89a25d0d3258d", "score": "0.46503466", "text": "func (instance *Host) UnsafeGetMounts() (mounts *propertiesv1.HostMounts, xerr fail.Error) {\n\txerr = instance.Inspect(func(_ data.Clonable, props *serialize.JSONProperties) fail.Error {\n\t\treturn props.Inspect(hostproperty.MountsV1, func(clonable data.Clonable) fail.Error {\n\t\t\thostMountsV1, ok := clonable.(*propertiesv1.HostMounts)\n\t\t\tif !ok {\n\t\t\t\treturn fail.InconsistentError(\"'*propertiesv1.HostMounts' expected, '%s' provided\", reflect.TypeOf(clonable).String())\n\t\t\t}\n\n\t\t\tmounts = hostMountsV1.Clone().(*propertiesv1.HostMounts)\n\t\t\treturn nil\n\t\t})\n\t})\n\txerr = debug.InjectPlannedFail(xerr)\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\treturn mounts, nil\n}", "title": "" }, { "docid": "86e0ecc5117ac8fd8466fa148eae3b45", "score": "0.46351838", "text": "func (de Dirent) IsDevice() bool { return de.modeType&os.ModeDevice != 0 }", "title": "" }, { "docid": "7a9cb10c59f772bdcc7c4d0dd83fe306", "score": "0.46340156", "text": "func (m *MountHelper) Validate() error {\n\trequiredFields := []string{}\n\tif m.Device == \"\" {\n\t\trequiredFields = append(requiredFields, \"device\")\n\t}\n\tif m.Target == \"\" {\n\t\trequiredFields = append(requiredFields, \"target\")\n\t}\n\tif len(requiredFields) > 0 {\n\t\treturn fmt.Errorf(\"missing required fields: [%s]\", strings.Join(requiredFields, \",\"))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8813d358e6109738d238e5c09dd0a900", "score": "0.46326038", "text": "func (mounter *Mounter) hasSystemd() bool {\n\tif !mounter.trySystemd {\n\t\tmounter.withSystemd = &mounter.trySystemd\n\t}\n\n\tif mounter.withSystemd == nil {\n\t\twithSystemd := detectSystemd()\n\t\tmounter.withSystemd = &withSystemd\n\t}\n\n\treturn *mounter.withSystemd\n}", "title": "" }, { "docid": "2babdb23a3d556244b4e3e53aceaf82a", "score": "0.46290284", "text": "func (m mounts) Len() int {\n\treturn len(m)\n}", "title": "" }, { "docid": "26d0d5b1afa06e9e4ddf7865d4516fcf", "score": "0.46242565", "text": "func (m *Mount) Mount(target string) error {\n\treturn ErrNotImplementOnUnix\n}", "title": "" }, { "docid": "0d9827d953e1a8cb8fed5a6441582b75", "score": "0.46132103", "text": "func (sw Switch) IsMountAtPark() bool {\n\tif has(sw.value, mountParked) {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "1478f87f0082e482cfb7c6b740b567f5", "score": "0.46129787", "text": "func mount(source, target, procfd, fstype string, flags uintptr, data string) error {\n\tdst := target\n\tif procfd != \"\" {\n\t\tdst = procfd\n\t}\n\tif err := unix.Mount(source, dst, fstype, flags, data); err != nil {\n\t\treturn &mountError{\n\t\t\top: \"mount\",\n\t\t\tsource: source,\n\t\t\ttarget: target,\n\t\t\tprocfd: procfd,\n\t\t\tflags: flags,\n\t\t\tdata: data,\n\t\t\terr: err,\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c399f11af2c3eea09559296fc98abc8a", "score": "0.46117702", "text": "func (m *MountHelper) Mount() error {\n\targs := []string{}\n\tif m.MountType != \"\" {\n\t\targs = append(args, \"-t\", m.MountType)\n\t}\n\tif m.Options != \"\" {\n\t\targs = append(args, \"-o\", m.Options)\n\t}\n\targs = append(args, m.Device, m.Target)\n\tif err := m.Validate(); err != nil {\n\t\treturn err\n\t}\n\treturn runMount(args)\n}", "title": "" }, { "docid": "bd167a39bacc794497c9691cc4889853", "score": "0.46019927", "text": "func (o *Host) HasUsedStorage() bool {\n\tif o != nil && o.UsedStorage != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d92abc49ffdb817d5da9021e44e3fe2c", "score": "0.45975247", "text": "func (r *Root) IsDir() bool { return true }", "title": "" }, { "docid": "092958496d1710fe4a4536260e935358", "score": "0.45916408", "text": "func NFSActiveOnHost(ctx context.Context) (bool, error) {\n\tLogc(ctx).Debug(\">>>> osutils_darwin.NFSActiveOnHost\")\n\tdefer Logc(ctx).Debug(\"<<<< osutils_darwin.NFSActiveOnHost\")\n\treturn false, errors.UnsupportedError(\"NFSActiveOnHost is not supported for darwin\")\n}", "title": "" }, { "docid": "e6c22aa775349e45d1fa3a315a071b51", "score": "0.45799115", "text": "func (vd VirtualDentry) Mount() *Mount {\n\treturn vd.mount\n}", "title": "" }, { "docid": "148424323f39f4f3d7de9dc92f1ab8ef", "score": "0.4568303", "text": "func (dm dummyFuseManager) Mount(mountPoint string, sp modules.SiaPath, opts modules.MountOptions) (err error) {\n\treturn errNoFuseOnWindows\n}", "title": "" }, { "docid": "bcccb30227eb43baa5b1bfdfec46258b", "score": "0.45658293", "text": "func (mounter *SafeFormatAndMount) formatAndMount(source string, target string, fstype string, options []string) error {\n\toptions = append(options, \"defaults\")\n\n\t// Run fsck on the disk to fix repairable issues\n\tglog.V(4).Infof(\"Checking for issues with fsck on disk: %s\", source)\n\targs := []string{\"-a\", source}\n\tcmd := mounter.Runner.Command(\"fsck\", args...)\n\tout, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\tee, isExitError := err.(utilexec.ExitError)\n\t\tswitch {\n\t\tcase err == utilexec.ErrExecutableNotFound:\n\t\t\tglog.Warningf(\"'fsck' not found on system; continuing mount without running 'fsck'.\")\n\t\tcase isExitError && ee.ExitStatus() == fsckErrorsCorrected:\n\t\t\tglog.Infof(\"Device %s has errors which were corrected by fsck.\", source)\n\t\tcase isExitError && ee.ExitStatus() == fsckErrorsUncorrected:\n\t\t\treturn fmt.Errorf(\"'fsck' found errors on device %s but could not correct them: %s.\", source, string(out))\n\t\tcase isExitError && ee.ExitStatus() > fsckErrorsUncorrected:\n\t\t\tglog.Infof(\"`fsck` error %s\", string(out))\n\t\t}\n\t}\n\n\t// Try to mount the disk\n\tglog.V(4).Infof(\"Attempting to mount disk: %s %s %s\", fstype, source, target)\n\tmountErr := mounter.Interface.Mount(source, target, fstype, options)\n\tif mountErr != nil {\n\t\t// Mount failed. This indicates either that the disk is unformatted or\n\t\t// it contains an unexpected filesystem.\n\t\texistingFormat, err := mounter.getDiskFormat(source)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif existingFormat == \"\" {\n\t\t\t// Disk is unformatted so format it.\n\t\t\targs = []string{source}\n\t\t\t// Use 'ext4' as the default\n\t\t\tif len(fstype) == 0 {\n\t\t\t\tfstype = \"ext4\"\n\t\t\t}\n\n\t\t\tif fstype == \"ext4\" || fstype == \"ext3\" {\n\t\t\t\targs = []string{\"-F\", source}\n\t\t\t}\n\t\t\tglog.Infof(\"Disk %q appears to be unformatted, attempting to format as type: %q with options: %v\", source, fstype, args)\n\t\t\tcmd := mounter.Runner.Command(\"mkfs.\"+fstype, args...)\n\t\t\t_, err := cmd.CombinedOutput()\n\t\t\tif err == nil {\n\t\t\t\t// the disk has been formatted successfully try to mount it again.\n\t\t\t\tglog.Infof(\"Disk successfully formatted (mkfs): %s - %s %s\", fstype, source, target)\n\t\t\t\treturn mounter.Interface.Mount(source, target, fstype, options)\n\t\t\t}\n\t\t\tglog.Errorf(\"format of disk %q failed: type:(%q) target:(%q) options:(%q)error:(%v)\", source, fstype, target, options, err)\n\t\t\treturn err\n\t\t} else {\n\t\t\t// Disk is already formatted and failed to mount\n\t\t\tif len(fstype) == 0 || fstype == existingFormat {\n\t\t\t\t// This is mount error\n\t\t\t\treturn mountErr\n\t\t\t} else {\n\t\t\t\t// Block device is formatted with unexpected filesystem, let the user know\n\t\t\t\treturn fmt.Errorf(\"failed to mount the volume as %q, it already contains %s. Mount error: %v\", fstype, existingFormat, mountErr)\n\t\t\t}\n\t\t}\n\t}\n\treturn mountErr\n}", "title": "" }, { "docid": "40753bce3ea31f1a5c138b73187e4cf4", "score": "0.45642966", "text": "func (m *Mounter) doMount(mounterPath string, mountCmd string, source string, target string, fstype string, options []string) error {\n\tmountArgs := makeMountArgs(source, target, fstype, options)\n\tif len(mounterPath) > 0 {\n\t\tmountArgs = append([]string{mountCmd}, mountArgs...)\n\t\tmountCmd = mounterPath\n\t}\n\n\tif m.withSystemd {\n\t\t// Try to run mount via systemd-run --scope. This will escape the\n\t\t// service where kubelet runs and any fuse daemons will be started in a\n\t\t// specific scope. kubelet service than can be restarted without killing\n\t\t// these fuse daemons.\n\t\t//\n\t\t// Complete command line (when mounterPath is not used):\n\t\t// systemd-run --description=... --scope -- mount -t <type> <what> <where>\n\t\t//\n\t\t// Expected flow:\n\t\t// * systemd-run creates a transient scope (=~ cgroup) and executes its\n\t\t// argument (/bin/mount) there.\n\t\t// * mount does its job, forks a fuse daemon if necessary and finishes.\n\t\t// (systemd-run --scope finishes at this point, returning mount's exit\n\t\t// code and stdout/stderr - thats one of --scope benefits).\n\t\t// * systemd keeps the fuse daemon running in the scope (i.e. in its own\n\t\t// cgroup) until the fuse daemon dies (another --scope benefit).\n\t\t// Kubelet service can be restarted and the fuse daemon survives.\n\t\t// * When the fuse daemon dies (e.g. during unmount) systemd removes the\n\t\t// scope automatically.\n\t\t//\n\t\t// systemd-mount is not used because it's too new for older distros\n\t\t// (CentOS 7, Debian Jessie).\n\t\tmountCmd, mountArgs = addSystemdScope(\"systemd-run\", target, mountCmd, mountArgs)\n\t} else {\n\t\t// No systemd-run on the host (or we failed to check it), assume kubelet\n\t\t// does not run as a systemd service.\n\t\t// No code here, mountCmd and mountArgs are already populated.\n\t}\n\n\tglog.V(4).Infof(\"Mounting cmd (%s) with arguments (%s)\", mountCmd, mountArgs)\n\tcommand := exec.Command(mountCmd, mountArgs...)\n\toutput, err := command.CombinedOutput()\n\tif err != nil {\n\t\targs := strings.Join(mountArgs, \" \")\n\t\tglog.Errorf(\"Mount failed: %v\\nMounting command: %s\\nMounting arguments: %s\\nOutput: %s\\n\", err, mountCmd, args, string(output))\n\t\treturn fmt.Errorf(\"mount failed: %v\\nMounting command: %s\\nMounting arguments: %s\\nOutput: %s\\n\",\n\t\t\terr, mountCmd, args, string(output))\n\t}\n\treturn err\n}", "title": "" }, { "docid": "b3ae290eab3c98046cd9b7e8f31d594f", "score": "0.4554211", "text": "func (d *cephRBDVolumeDriver) mountDevice(fstype, device, mountdir string) error {\n\t_, err := shWithDefaultTimeout(\"mount\", \"-t\", fstype, device, mountdir)\n\treturn err\n}", "title": "" }, { "docid": "9f7222c3719ebda32685f2ade408f40c", "score": "0.45525694", "text": "func (f InternalFileSystem) IsInternal() bool {\n\treturn true\n}", "title": "" }, { "docid": "affb992e1bbc0e7292f7559590abc4f3", "score": "0.45507008", "text": "func TestFindMountPointValid(t *testing.T) {\n\tLinuxMountsPath = \"testdata/mounts\"\n\tmountpoint, err := GetMountpointByDevice(\"/dev/mapper/sys-old\")\n\trequire.NoError(t, err)\n\trequire.Equal(t, *mountpoint, \"/media/usb\")\n}", "title": "" }, { "docid": "08d842341b3c384683eeeb345cab3a7e", "score": "0.45373282", "text": "func (fs *Diskfs) Stat() (stat bool) {\n\t_, err := os.Stat(fs.base)\n\tif err != nil {\n\t\tlogger.Error(\"FS stat %s\", err)\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "26fe0544e89c32256e4c9245c68a025a", "score": "0.45370224", "text": "func (rmbp *RunmountBuildpack) Detect(ctx *sous.BuildContext) (*sous.DetectResult, error) {\n\tdfPath := filepath.Join(ctx.Source.OffsetDir, \"Dockerfile\")\n\tif !ctx.Sh.Exists(dfPath) {\n\t\treturn nil, errors.Errorf(\"%s does not exist\", dfPath)\n\t}\n\tmessages.ReportLogFieldsMessage(\"Runmount dockerfile detection\", logging.DebugLevel, rmbp.log, dfPath)\n\n\tdetector, err := inspectDockerfile(ctx.Sh.Abs(dfPath), ctx.Source.DevBuild, ctx.Sh, dfPath, rmbp.registry, rmbp.log)\n\n\trmbp.detected = &sous.DetectResult{\n\t\tCompatible: false,\n\t}\n\tif err == nil {\n\t\tspecPath, hasRunspec := detector.envValue(SOUS_RUN_IMAGE_SPEC)\n\t\tbuildOut, hasOut := detector.envValue(BuildOutEnv)\n\t\tbuildCache, hasCache := detector.envValue(BuildCacheEnv)\n\t\tif hasRunspec && hasOut {\n\t\t\tdata := detectData{\n\t\t\t\tRunImageSpecPath: specPath,\n\t\t\t\tBuildOutPath: buildOut,\n\t\t\t\tHasAppVersionArg: detector.versionArg,\n\t\t\t\tHasAppRevisionArg: detector.revisionArg,\n\t\t\t}\n\n\t\t\tif hasCache {\n\t\t\t\tdata.BuildCachePath = buildCache\n\t\t\t}\n\n\t\t\trmbp.detected = &sous.DetectResult{Compatible: true, Data: data}\n\t\t}\n\t}\n\n\treturn rmbp.detected, err\n}", "title": "" }, { "docid": "4b6f7da86b3a1dde4776cd03d2a1e372", "score": "0.45355436", "text": "func mountAndCheck(partName, wantLine string, t *testing.T, size int) {\n\tt.Helper()\n\tif err := exec.Command(\"sudo\", \"mount\", partName, \"mt\").Run(); err != nil {\n\t\tt.Fatalf(\"error mounting %q, error msg: (%v)\", partName, err)\n\t}\n\tdefer exec.Command(\"sudo\", \"umount\", \"mt\").Run()\n\tcmdD := \"df -h | grep mt\"\n\tout, err := exec.Command(\"bash\", \"-c\", cmdD).Output()\n\tif err != nil {\n\t\tt.Fatalf(\"error reading df -h of %q, error msg: (%v)\", partName, err)\n\t}\n\tif len(out) <= 0 {\n\t\tt.Fatalf(\"cannot find partition %q\", partName)\n\t}\n\toldSize, err := readSize(string(out))\n\tif err != nil {\n\t\tt.Fatalf(\"cannot read fs size, the line in df -h: %q, error msg: (%v)\", string(out), err)\n\t}\n\tif oldSize <= size {\n\t\tt.Fatalf(\"wrong file system size of partition, fs info: %q, expected: %d\", string(out), size)\n\t}\n\n\tf, err := os.Open(\"mt/content\")\n\tif err != nil {\n\t\tt.Fatalf(\"cannot open content file in %q, error msg: (%v)\", partName, err)\n\t}\n\tdefer f.Close()\n\trd := bufio.NewReader(f)\n\tline, _, err := rd.ReadLine()\n\tif err != nil {\n\t\tt.Fatalf(\"cannot ReadLine in %q, error msg: (%v)\", partName, err)\n\t}\n\tif string(line) != wantLine {\n\t\tt.Fatalf(\"content in %q is corrupted, actual line: %q, wanted line: %q\", partName, string(line), wantLine)\n\t}\n}", "title": "" }, { "docid": "aa7ad5d600712d115071a581ad52f6f7", "score": "0.4523139", "text": "func mountAndVerifyFilePersistence(ctx context.Context, client *hwsec.CryptohomeClient, username, authSessionID string) error {\n\t// Write a test file to verify persistence.\n\tif err := client.PreparePersistentVault(ctx, authSessionID, false /*=ecryptfs*/); err != nil {\n\t\treturn errors.Wrap(err, \"failed to prepare persistent vault with given credential\")\n\t}\n\n\t// Verify that file is still there.\n\tif err := cryptohome.VerifyFileForPersistence(ctx, username); err != nil {\n\t\treturn errors.Wrap(err, \"failed to verify file persistence\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "83447eed46c7f743d82de8c0f9eeedbe", "score": "0.4515914", "text": "func (RealOS) Mount(source string, target string, fstype string, flags uintptr, data string) error {\n\treturn unix.Mount(source, target, fstype, flags, data)\n}", "title": "" }, { "docid": "88db818373821b986bfd21d4c2dfbc29", "score": "0.45128435", "text": "func checkMountEmpty(mountpoint string) error {\n\tfp, err := os.Open(mountpoint)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot open: %s: %w\", mountpoint, err)\n\t}\n\tdefer fs.CheckClose(fp, &err)\n\n\t_, err = fp.Readdirnames(1)\n\tif err == io.EOF {\n\t\treturn nil\n\t}\n\n\tconst msg = \"%q is not empty, use --allow-non-empty to mount anyway\"\n\tif err == nil {\n\t\treturn fmt.Errorf(msg, mountpoint)\n\t}\n\treturn fmt.Errorf(msg+\": %w\", mountpoint, err)\n}", "title": "" }, { "docid": "54374131433c8f32171d0afecc1e9266", "score": "0.4512333", "text": "func (fs *mockfs) Unmount(ctx context.Context, target string) error {\n\treturn fs.unmount(ctx, target)\n}", "title": "" }, { "docid": "c828b05474f269bbb5ce3aae76d9ebef", "score": "0.45121956", "text": "func mountOptionsIsValidField(s string) bool {\n\tswitch s {\n\tcase\n\t\t\"shared\",\n\t\t\"master\",\n\t\t\"propagate_from\",\n\t\t\"unbindable\":\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d8672966801f5ed75848c41be7a83c24", "score": "0.45107841", "text": "func (f *FakeOS) Mount(source string, target string, fstype string, flags uintptr, data string) error {\n\tf.appendCalls(\"Mount\", source, target, fstype, flags, data)\n\tif err := f.getError(\"Mount\"); err != nil {\n\t\treturn err\n\t}\n\n\tif f.MountFn != nil {\n\t\treturn f.MountFn(source, target, fstype, flags, data)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d2ed461398c0e247dbbb952051cc4005", "score": "0.45034024", "text": "func ensureUnmount(t *testing.T, mnt string) {\n\tif err := Unmount(mnt); err != nil {\n\t\tt.Error(err)\n\t}\n}", "title": "" }, { "docid": "c5cf00bca14ff16d05b5d106ad4e0841", "score": "0.4501759", "text": "func (mounter *csiProxyMounter) FormatAndMount(ctx context.Context, source string, target string, fstype string, options []string) error {\n\tlog := logger.GetLogger(ctx)\n\tdiskNum, err := strconv.Atoi(source)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parse %s failed with error: %v\", source, err)\n\t}\n\tlog.Infof(\"Disk Number: %d\", diskNum)\n\t// Call PartitionDisk CSI proxy call to partition the disk and return the volume id\n\tpartionDiskRequest := &disk.PartitionDiskRequest{\n\t\tDiskNumber: uint32(diskNum),\n\t}\n\tif _, err = mounter.DiskClient.PartitionDisk(ctx, partionDiskRequest); err != nil {\n\t\tlog.Errorf(\"partition disk failed for disk number: %d, err: %v\", partionDiskRequest.DiskNumber, err)\n\t\treturn err\n\t}\n\n\t// ensure disk is online\n\tlog.Infof(\"setting disk %d to online\", diskNum)\n\tattachRequest := &disk.SetDiskStateRequest{\n\t\tDiskNumber: uint32(diskNum),\n\t\tIsOnline: true,\n\t}\n\t_, err = mounter.DiskClient.SetDiskState(ctx, attachRequest)\n\tif err != nil {\n\t\tlog.Errorf(\"failed to set disk state as online for disk: %d, err: %v\", attachRequest.DiskNumber, err)\n\t\treturn err\n\t}\n\n\t// List the volumes on the given disk.\n\tvolumeIDsRequest := &volume.ListVolumesOnDiskRequest{\n\t\tDiskNumber: uint32(diskNum),\n\t}\n\tvolumeIdResponse, err := mounter.VolumeClient.ListVolumesOnDisk(ctx, volumeIDsRequest)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO: consider partitions and choose the right partition.\n\t// For now just choose the first volume.\n\tvolumeID := volumeIdResponse.VolumeIds[0]\n\tlog.Infof(\"volumeIdResponse : %v\", volumeIdResponse)\n\tlog.Infof(\"volumeID : %s\", volumeID)\n\t// Check if the volume is formatted.\n\tisVolumeFormattedRequest := &volume.IsVolumeFormattedRequest{\n\t\tVolumeId: volumeID,\n\t}\n\tisVolumeFormattedResponse, err := mounter.VolumeClient.IsVolumeFormatted(ctx, isVolumeFormattedRequest)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// If the volume is not formatted, then format it, else proceed to mount.\n\tif !isVolumeFormattedResponse.Formatted {\n\t\tlog.Infof(\"volumeID is not formatted : %s\", volumeID)\n\t\tformatVolumeRequest := &volume.FormatVolumeRequest{\n\t\t\tVolumeId: volumeID,\n\t\t\t// TODO: Accept the filesystem and other options\n\t\t}\n\t\t_, err = mounter.VolumeClient.FormatVolume(ctx, formatVolumeRequest)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Mount the volume by calling the CSI proxy call.\n\tmountVolumeRequest := &volume.MountVolumeRequest{\n\t\tVolumeId: volumeID,\n\t\tTargetPath: normalizeWindowsPath(target),\n\t}\n\t_, err = mounter.VolumeClient.MountVolume(ctx, mountVolumeRequest)\n\tlog.Debug(\"Volume mounted\")\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c1a04fa519ae53099d64de29b71146d7", "score": "0.44915852", "text": "func Unmount(target string) error {\n\tif mounted, err := Mounted(target); err != nil || !mounted {\n\t\treturn err\n\t}\n\treturn ForceUnmount(target)\n}", "title": "" }, { "docid": "53c43bcfed8b06e004e1322bdc18c394", "score": "0.44889075", "text": "func (mounter *Mounter) doMount(mounterPath string, mountCmd string, source string, target string, fstype string, options []string, sensitiveOptions []string, mountFlags []string, systemdMountRequired bool) error {\n\tmountArgs, mountArgsLogStr := MakeMountArgsSensitiveWithMountFlags(source, target, fstype, options, sensitiveOptions, mountFlags)\n\tif len(mounterPath) > 0 {\n\t\tmountArgs = append([]string{mountCmd}, mountArgs...)\n\t\tmountArgsLogStr = mountCmd + \" \" + mountArgsLogStr\n\t\tmountCmd = mounterPath\n\t}\n\n\tif systemdMountRequired && mounter.hasSystemd() {\n\t\t// Try to run mount via systemd-run --scope. This will escape the\n\t\t// service where kubelet runs and any fuse daemons will be started in a\n\t\t// specific scope. kubelet service than can be restarted without killing\n\t\t// these fuse daemons.\n\t\t//\n\t\t// Complete command line (when mounterPath is not used):\n\t\t// systemd-run --description=... --scope -- mount -t <type> <what> <where>\n\t\t//\n\t\t// Expected flow:\n\t\t// * systemd-run creates a transient scope (=~ cgroup) and executes its\n\t\t// argument (/bin/mount) there.\n\t\t// * mount does its job, forks a fuse daemon if necessary and finishes.\n\t\t// (systemd-run --scope finishes at this point, returning mount's exit\n\t\t// code and stdout/stderr - thats one of --scope benefits).\n\t\t// * systemd keeps the fuse daemon running in the scope (i.e. in its own\n\t\t// cgroup) until the fuse daemon dies (another --scope benefit).\n\t\t// Kubelet service can be restarted and the fuse daemon survives.\n\t\t// * When the fuse daemon dies (e.g. during unmount) systemd removes the\n\t\t// scope automatically.\n\t\t//\n\t\t// systemd-mount is not used because it's too new for older distros\n\t\t// (CentOS 7, Debian Jessie).\n\t\tmountCmd, mountArgs, mountArgsLogStr = AddSystemdScopeSensitive(\"systemd-run\", target, mountCmd, mountArgs, mountArgsLogStr)\n\t\t// } else {\n\t\t// No systemd-run on the host (or we failed to check it), assume kubelet\n\t\t// does not run as a systemd service.\n\t\t// No code here, mountCmd and mountArgs are already populated.\n\t}\n\n\t// Logging with sensitive mount options removed.\n\tklog.V(4).Infof(\"Mounting cmd (%s) with arguments (%s)\", mountCmd, mountArgsLogStr)\n\tcommand := exec.Command(mountCmd, mountArgs...)\n\toutput, err := command.CombinedOutput()\n\tif err != nil {\n\t\tif err.Error() == errNoChildProcesses {\n\t\t\tif command.ProcessState.Success() {\n\t\t\t\t// We don't consider errNoChildProcesses an error if the process itself succeeded (see - k/k issue #103753).\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\t// Rewrite err with the actual exit error of the process.\n\t\t\terr = &exec.ExitError{ProcessState: command.ProcessState}\n\t\t}\n\t\tklog.Errorf(\"Mount failed: %v\\nMounting command: %s\\nMounting arguments: %s\\nOutput: %s\\n\", err, mountCmd, mountArgsLogStr, string(output))\n\t\treturn fmt.Errorf(\"mount failed: %v\\nMounting command: %s\\nMounting arguments: %s\\nOutput: %s\",\n\t\t\terr, mountCmd, mountArgsLogStr, string(output))\n\t}\n\treturn err\n}", "title": "" } ]
5b9d7aad16f0167d591c540a27f6177d
Create points where x == y
[ { "docid": "7d3c978119a0843de88c46611b2a8748", "score": "0.0", "text": "func Newi(x int) *Point {\n\treturn NewPointFromInt(x, x)\n}", "title": "" } ]
[ { "docid": "b515900392731e5d40b2eaa4eb69ae83", "score": "0.649884", "text": "func newPoints(xs, ys []float64) plotter.XYs {\n\n\t// inputs : xs, ys = slices containing the x and y values respectively\n\n\tpts := make(plotter.XYs, len(xs))\n\tfor i := range pts {\n\t\tpts[i].X = xs[i]\n\t\tpts[i].Y = ys[i]\n\t}\n\n\treturn pts\n}", "title": "" }, { "docid": "4da149dbec721274f484c0404a95e058", "score": "0.5938293", "text": "func New(x, y int) Point {\n\treturn Point{x, y}\n}", "title": "" }, { "docid": "672924897d5a1beef7ccfd9fd9b3218b", "score": "0.5884708", "text": "func NewPoint(x, y int) Point {\n\treturn Point{X: x, Y: y}\n}", "title": "" }, { "docid": "0044fe06e50c7c32e2779ac6c0558ebd", "score": "0.5610321", "text": "func NewPoints(ps ...intgeom.Point2) Shape {\n\tpoints := make(map[intgeom.Point2]struct{}, len(ps))\n\tfor _, p := range ps {\n\t\tpoints[p] = struct{}{}\n\t}\n\treturn Points(points)\n}", "title": "" }, { "docid": "29588d72adb9ababb96dd3c6aeac4491", "score": "0.5574662", "text": "func NewPoint(x, y float64) *Point {\n\treturn &Point{\n\t\tx: x,\n\t\ty: y,\n\t\tdist2: math.Inf(1),\n\t}\n}", "title": "" }, { "docid": "b321ba4805c4d7440f7ec2a22fe0b006", "score": "0.55543077", "text": "func (p point) equal(other point) bool {\n\treturn p.y == other.y && p.x == other.x\n}", "title": "" }, { "docid": "f54cd9e680837ba0f0bf33be25b3137b", "score": "0.5535227", "text": "func NewPoint(x, y float64) Point {\n\treturn Point{X: x, Y: y}\n}", "title": "" }, { "docid": "b902f4b80b787bf44842ffe68c66a930", "score": "0.55251837", "text": "func NewPoint(x, y float64) Point {\n\treturn Point{x, y}\n}", "title": "" }, { "docid": "d45523a01bd38692fda8a4e67e69a980", "score": "0.54606897", "text": "func CartesianNeighbor(x, y int) [][]int {\n\tvar coordinates [][]int\n\tmovingX := x - 1\n\tfor horizontal := 0; horizontal < 3; horizontal++ {\n\t\tmovingY := y - 1\n\t\tfor vertical := 0; vertical < 3; vertical++ {\n\t\t\tif movingX != x || movingY != y {\n\t\t\t\tcoordinate := []int{movingX, movingY}\n\t\t\t\tcoordinates = append(coordinates, coordinate)\n\t\t\t}\n\t\t\tmovingY++\n\t\t}\n\t\tmovingX++\n\t}\n\treturn coordinates\n\n}", "title": "" }, { "docid": "8eeb749898babca2ff86480593fbeccf", "score": "0.5456704", "text": "func NewPoint(x, y int) *Point {\r\n\tpoint := new(Point)\r\n\tpoint.x = x\r\n\tpoint.y = y\r\n\treturn point\r\n}", "title": "" }, { "docid": "71c96e4b21fdc0ace90bd749398cb1f7", "score": "0.54514164", "text": "func PointNew(x float64, y float64) Point {\n\tvar p Point\n\tp.X = x\n\tp.Y = y\n\treturn p\n}", "title": "" }, { "docid": "31605667862365fd5972cf9750f72114", "score": "0.5440324", "text": "func (p *Point) Dup() Point {\n\treturn Point{X: p.X, Y: p.Y}\n}", "title": "" }, { "docid": "c30a4bb8cd4723cbb64a0ec2c34eb2b6", "score": "0.540753", "text": "func PointIsIn(p image.Point, points []image.Point) bool {\n\tmaxX := p.X\n\tset := map[image.Point]struct{}{}\n\tfor _, sp := range points {\n\t\tset[sp] = struct{}{}\n\t\tif sp.X > maxX {\n\t\t\tmaxX = sp.X\n\t\t}\n\t}\n\n\tif _, ok := set[p]; ok {\n\t\t// Not inside if it is on the shape.\n\t\treturn false\n\t}\n\n\tbyY := map[int][]int{} // maps y->x\n\tfor p := range set {\n\t\tbyY[p.Y] = append(byY[p.Y], p.X)\n\t}\n\tfor y := range byY {\n\t\tsort.Ints(byY[y])\n\t}\n\n\tset = map[image.Point]struct{}{}\n\tfor y, xses := range byY {\n\t\tset[image.Point{xses[0], y}] = struct{}{}\n\t\tif len(xses) == 1 {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor i := 1; i < len(xses); i++ {\n\t\t\tif xses[i] != xses[i-1]+1 {\n\t\t\t\tset[image.Point{xses[i], y}] = struct{}{}\n\t\t\t}\n\t\t}\n\t}\n\n\tcrosses := 0\n\tfor x := p.X; x <= maxX; x++ {\n\t\tif _, ok := set[image.Point{x, p.Y}]; ok {\n\t\t\tcrosses++\n\t\t}\n\t}\n\treturn crosses%2 != 0\n}", "title": "" }, { "docid": "662b9d3d0e46b05814998f7cee9ec268", "score": "0.53708297", "text": "func (p Point) PointsBetween(p2 Point) []Point {\n\n\tout := make([]Point, 0)\n\n\tx1 := p.X\n\ty1 := p.Y\n\tx2 := p2.X\n\ty2 := p2.Y\n\n\txDelta := math.Abs(float64(x2 - x1))\n\tyDelta := math.Abs(float64(y2 - y1))\n\n\txSlope := -1\n\tif x2 < x1 {\n\t\txSlope = 1\n\t}\n\tySlope := -1\n\tif y2 < y1 {\n\t\tySlope = 1\n\t}\n\n\terr := xDelta - yDelta\n\tvar err2 float64\n\tfor i := 0; true; i++ {\n\t\tout = append(out, Point{x2, y2})\n\t\tif x2 == x1 && y2 == y1 {\n\t\t\tbreak\n\t\t}\n\t\terr2 = 2 * err\n\t\tif err2 > -1*yDelta {\n\t\t\terr -= yDelta\n\t\t\tx2 += xSlope\n\t\t}\n\t\tif err2 < xDelta {\n\t\t\terr += xDelta\n\t\t\ty2 += ySlope\n\t\t}\n\t}\n\treturn out\n}", "title": "" }, { "docid": "1872c9b19ae6f9006df8979d887e71c9", "score": "0.5349932", "text": "func Test_PointContains(t *testing.T) {\n\tif !g.Contains(p) {\n\t\tt.Errorf(\"Contains check failed for a point inside the grid\")\n\t}\n\n\tfor _, out := range outs {\n\t\tif g.Contains(out) {\n\t\t\tt.Errorf(\"Contains check failed to detect that an Point is outside the grid\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "447af6ce90c75931390c3432d0156e93", "score": "0.5335475", "text": "func getPointsWithDistance(points []*Point, target *Point) []*PointWithDistance {\n\tpwds := make([]*PointWithDistance, len(points))\n\tfor i, point := range points {\n\t\tpwds[i] = createNode(point, target)\n\t}\n\n\treturn pwds\n}", "title": "" }, { "docid": "e67f5dea21b76dde5de825917a910c75", "score": "0.53352696", "text": "func reachingPoints(sx int, sy int, tx int, ty int) bool {\n\tfor sx < tx && sy < ty {\n\t\tif tx < ty {\n\t\t\tty %= tx\n\t\t} else {\n\t\t\ttx %= ty\n\t\t}\n\t}\n\n\treturn sx == tx && (ty-sy)%sx == 0 || sy == ty && (tx-sx)%sy == 0\n\t// if sx == tx && sy == ty {\n\t// \treturn true\n\t// }\n\t// a1 := strconv.Itoa(sx)\n\t// a2 := strconv.Itoa(sy)\n\t// b1 := strconv.Itoa(tx)\n\t// b2 := strconv.Itoa(ty)\n\t// sutiation := a1 + \",\" + a2 + \",\" + b1 + \",\" + b2\n\t// fmt.Println(\"situation:\", sutiation)\n\t// if v, ok := dp[sutiation]; ok {\n\t// \treturn v\n\t// }\n\t// r1 := []int{sx + sy, sy}\n\t// r2 := []int{sx, sx + sy}\n\t// var r1dead, r2dead bool\n\t// var d1, d2, d3, d4 float64\n\t// d1 = (float64)(sx - tx)\n\t// d2 = (float64)(r1[0] - tx)\n\t// d3 = (float64)(sy - ty)\n\t// d4 = (float64)(r2[1] - ty)\n\t// fmt.Println(\"distance:\", math.Abs(d1) < math.Abs(d2), math.Abs(d3) < math.Abs(d4))\n\t// if math.Abs(d1) < math.Abs(d2) {\n\t// \tr1dead = true\n\t// }\n\t// if math.Abs(d3) < math.Abs(d4) {\n\t// \tr2dead = true\n\t// }\n\t// if r1dead && r2dead {\n\t// \tdp[sutiation] = false\n\n\t// \treturn false\n\t// }\n\t// if r1dead != true && r1[0] == tx && r1[1] == ty {\n\t// \tdp[sutiation] = true\n\n\t// \treturn true\n\t// } else if r2dead != true && r2[0] == tx && r2[1] == ty {\n\t// \tdp[sutiation] = true\n\n\t// \treturn true\n\t// } else if r1dead == true && r2dead != true {\n\t// \t//speed up\n\t// \tif (ty-r2[1])/r2[0] > THREADHOLD {\n\t// \t\tr2[1] = ty - (ty-r2[1])%r2[0]\n\t// \t}\n\t// \treturn reachingPoints(r2[0], r2[1], tx, ty)\n\t// } else if r1dead != true && r2dead == true {\n\t// \t//speed up\n\t// \tif (tx-r1[0])/r1[1] > THREADHOLD {\n\t// \t\tr1[0] = tx - (tx-r1[0])%r1[1]\n\t// \t}\n\t// \treturn reachingPoints(r1[0], r1[1], tx, ty)\n\t// }\n\t// //speed up\n\t// if (ty-r2[1])/r2[0] > THREADHOLD {\n\t// \tr2[1] = (ty - (ty-r2[1])%r2[0]) / 1\n\t// \tif (tx-r2[0])/r2[1] > THREADHOLD {\n\t// \t\tr2[0] = (tx - (tx-r2[0])%r2[1]) / 1\n\t// \t}\n\t// }\n\t// //speed up\n\t// if (tx-r1[0])/r1[1] > THREADHOLD {\n\t// \tr1[0] = (tx - (tx-r1[0])%r1[1]) / 1\n\t// \tif (ty-r1[1])/r1[0] > THREADHOLD {\n\t// \t\tr1[1] = (ty - (ty-r1[1])%r1[0]) / 1\n\t// \t}\n\t// }\n\n\t// return reachingPoints(r1[0], r1[1], tx, ty) || reachingPoints(r2[0], r2[1], tx, ty)\n}", "title": "" }, { "docid": "666fb87bb207aa84cb8e81b5a30cf267", "score": "0.53070927", "text": "func NewPoint(x, y float64) *Point {\n\treturn &Point{x: x, y: y}\n}", "title": "" }, { "docid": "06923137b6dca6596d9a6e6c0b6677dd", "score": "0.52991897", "text": "func NewPoint(x float64, y float64) *Point {\n\treturn &Point{X: x, Y: y}\n}", "title": "" }, { "docid": "3ca1c6d60e01691a5537b728dfff9477", "score": "0.52652687", "text": "func FindPoint(px int32, py int32, qx int32, qy int32) []int32 {\n\trx := (2 * qx) - px\n\try := (2 * qy) - py\n\treturn []int32{rx, ry}\n}", "title": "" }, { "docid": "69a58b5d3db0bafcad64ac63e2251c20", "score": "0.52070314", "text": "func PointEquals(a, b Point) bool {\n\treturn a.X == b.X && a.Y == b.Y\n}", "title": "" }, { "docid": "d4a7571b7ae3b47d3f41c84d9d9b7a48", "score": "0.515847", "text": "func dig(startpt, endpt math.Point) []math.Point {\n\tvar start, end, incr int\n\tpath := make([]math.Point, 0)\n\n\tif Coinflip() {\n\t\tstart, end, incr = drange(startpt.X, endpt.X, true)\n\t\tfor z := start; z != end; z += incr {\n\t\t\tpt := math.Pt(z, startpt.Y)\n\t\t\tpath = append(path, pt)\n\t\t}\n\t\tstart, end, incr = drange(startpt.Y, endpt.Y, true)\n\t\tfor z := start; z != end; z += incr {\n\t\t\tpt := math.Pt(endpt.X, z)\n\t\t\tpath = append(path, pt)\n\t\t}\n\t} else {\n\t\tstart, end, incr = drange(startpt.Y, endpt.Y, true)\n\t\tfor z := start; z != end; z += incr {\n\t\t\tpt := math.Pt(startpt.X, z)\n\t\t\tpath = append(path, pt)\n\t\t}\n\t\tstart, end, incr = drange(startpt.X, endpt.X, true)\n\t\tfor z := start; z != end; z += incr {\n\t\t\tpt := math.Pt(z, endpt.Y)\n\t\t\tpath = append(path, pt)\n\t\t}\n\t}\n\n\treturn path\n}", "title": "" }, { "docid": "4203abe4e41a4d34a465bbf1c6a8b686", "score": "0.5120349", "text": "func Point(x, y float64) {\n\tv := joinFloat64(x, y)\n\t_, err := sketchDraw.WriteString(\n\t\tfmt.Sprintf(\"point(%s);\", v),\n\t)\n\tErrorContainer.add(err)\n}", "title": "" }, { "docid": "1abc6471026549d3b238a185eebfcbb2", "score": "0.5112402", "text": "func (p Point) Equal(p1 Point) bool {\n\treturn p.X == p1.X && p.Y == p1.Y\n}", "title": "" }, { "docid": "ba93cdcc23101ee5200eb7afb74b6c46", "score": "0.5104156", "text": "func (p *curvePoint) genPoint(x *big.Int, rand cipher.Stream) bool {\n\n\t// Compute the corresponding Y coordinate, if any\n\ty2 := new(big.Int).Mul(x, x)\n\ty2.Mul(y2, x)\n\tthreeX := new(big.Int).Lsh(x, 1)\n\tthreeX.Add(threeX, x)\n\ty2.Sub(y2, threeX)\n\ty2.Add(y2, p.c.p.B)\n\ty2.Mod(y2, p.c.p.P)\n\ty := p.c.sqrt(y2)\n\n\t// Pick a random sign for the y coordinate\n\tb := make([]byte, 1)\n\trand.XORKeyStream(b, b)\n\tif (b[0] & 0x80) != 0 {\n\t\ty.Sub(p.c.p.P, y)\n\t}\n\n\t// Check that it's a valid point\n\ty2t := new(big.Int).Mul(y, y)\n\ty2t.Mod(y2t, p.c.p.P)\n\tif y2t.Cmp(y2) != 0 {\n\t\treturn false // Doesn't yield a valid point!\n\t}\n\n\tp.x = x\n\tp.y = y\n\treturn true\n}", "title": "" }, { "docid": "bda3f24e3bd904f2e99775d42c234986", "score": "0.50938845", "text": "func ToPoints(Xs, Ys []float64) ([]Point, error) {\n\tvar n int\n\tvar err error\n\tif len(Xs)*len(Ys) == 0 {\n\t\treturn nil, fmt.Errorf(\"Contained an empty array\")\n\t}\n\tif len(Xs) != len(Ys) {\n\t\tn = len(Xs)\n\t\tif len(Ys) < n {\n\t\t\tn = len(Ys)\n\t\t}\n\t\terr = fmt.Errorf(\"Arrays of different size. Decided to take the first %d elements\", n)\n\t} else {\n\t\tn = len(Xs)\n\t}\n\tarr := make([]Point, 0, n)\n\tfor i := 0; i < n; i++ {\n\t\tarr = append(arr, Point{x: Xs[i],\n\t\t\ty: Ys[i]})\n\t}\n\treturn arr, err\n}", "title": "" }, { "docid": "e0a662d023079dcd643171230b52f52d", "score": "0.50723565", "text": "func ToPixelsPoint(x, y float32) (float32, float32) {\n\tscale := GetPixelScale()\n\treturn x * scale, y * scale\n}", "title": "" }, { "docid": "19e755ca0924a514def82d0bc769c2c7", "score": "0.5027977", "text": "func (v *Vector) Set(x float64, y float64) *Vector {\n v.X = x\n v.Y = y\n return v\n}", "title": "" }, { "docid": "2b53bc2cb803a1576b45bd00bb7f4cac", "score": "0.50270617", "text": "func linePointsGen(p1, p2 Point) (gen func() (x, y int), vertDirection int) {\n\t// Set up math\n\tslopeT, slope, intercept := getLineParams(p1, p2)\n\n\tx := float64(p1.X)\n\txPrev := int(x)\n\ty := p1.Y\n\tyThresh := 0\n\n\t// Every slope type has a different iterator, since they change the\n\t// x and y values in different combinations, as well as do different\n\t// comparisons on the values.\n\tswitch slopeT {\n\tcase POSRIGHT:\n\t\tif slope == 0 {\n\t\t\tvertDirection = 0\n\t\t} else {\n\t\t\tvertDirection = 1\n\t\t}\n\n\t\treturn func() (int, int) {\n\t\t\tif y < yThresh {\n\t\t\t\tif y > p2.Y {\n\t\t\t\t\treturn -1, -1\n\t\t\t\t}\n\n\t\t\t\ty++\n\t\t\t\treturn xPrev, y\n\t\t\t} else {\n\t\t\t\tif int(x) > p2.X {\n\t\t\t\t\treturn -1, -1\n\t\t\t\t}\n\n\t\t\t\tyThresh = int(slope*x + intercept + 0.5)\n\t\t\t\txPrev = int(x)\n\t\t\t\tx++\n\n\t\t\t\tif y != yThresh {\n\t\t\t\t\ty++\n\t\t\t\t}\n\n\t\t\t\treturn xPrev, y\n\t\t\t}\n\t\t}, vertDirection\n\tcase NEGRIGHT:\n\t\tvertDirection = -1\n\t\tyThresh = int(slope*x + intercept + 0.5)\n\n\t\treturn func() (int, int) {\n\t\t\tif y > yThresh {\n\t\t\t\tif y < p2.Y {\n\t\t\t\t\treturn -1, -1\n\t\t\t\t}\n\n\t\t\t\ty--\n\t\t\t\treturn xPrev, y\n\t\t\t} else {\n\t\t\t\tif int(x) > p2.X {\n\t\t\t\t\treturn -1, -1\n\t\t\t\t}\n\n\t\t\t\tyThresh = int(slope*x + intercept + 0.5)\n\t\t\t\txPrev = int(x)\n\t\t\t\tx++\n\n\t\t\t\tif y != yThresh {\n\t\t\t\t\ty--\n\t\t\t\t}\n\n\t\t\t\treturn xPrev, y\n\t\t\t}\n\t\t}, vertDirection\n\tcase POSLEFT:\n\t\tif slope == 0 {\n\t\t\tvertDirection = 0\n\t\t} else {\n\t\t\tvertDirection = -1\n\t\t}\n\n\t\tyThresh = int(slope*x + intercept + 0.5)\n\n\t\treturn func() (int, int) {\n\t\t\tif y > yThresh {\n\t\t\t\tif y < p2.Y {\n\t\t\t\t\treturn -1, -1\n\t\t\t\t}\n\n\t\t\t\ty--\n\t\t\t\treturn xPrev, y\n\t\t\t} else {\n\t\t\t\tif int(x) < p2.X {\n\t\t\t\t\treturn -1, -1\n\t\t\t\t}\n\n\t\t\t\tyThresh = int(slope*x + intercept + 0.5)\n\t\t\t\txPrev = int(x)\n\t\t\t\tx--\n\n\t\t\t\tif y != yThresh {\n\t\t\t\t\ty--\n\t\t\t\t}\n\n\t\t\t\treturn xPrev, y\n\t\t\t}\n\t\t}, vertDirection\n\tcase NEGLEFT:\n\t\tvertDirection = 1\n\n\t\treturn func() (int, int) {\n\t\t\tif y < yThresh {\n\t\t\t\tif y > p2.Y {\n\t\t\t\t\treturn -1, -1\n\t\t\t\t}\n\n\t\t\t\ty++\n\t\t\t\treturn xPrev, y\n\t\t\t} else {\n\t\t\t\tif int(x) < p2.X {\n\t\t\t\t\treturn -1, -1\n\t\t\t\t}\n\n\t\t\t\tyThresh = int(slope*x + intercept + 0.5)\n\t\t\t\txPrev = int(x)\n\t\t\t\tx--\n\n\t\t\t\tif y != yThresh {\n\t\t\t\t\ty++\n\t\t\t\t}\n\n\t\t\t\treturn xPrev, y\n\t\t\t}\n\t\t}, vertDirection\n\tcase INFUP:\n\t\tvertDirection = 1\n\n\t\treturn func() (int, int) {\n\t\t\tif y > p2.Y {\n\t\t\t\treturn -1, -1\n\t\t\t}\n\n\t\t\tyPrev := y\n\t\t\ty++\n\t\t\treturn int(x), yPrev\n\t\t}, vertDirection\n\tcase INFDOWN:\n\t\tvertDirection = -1\n\n\t\treturn func() (int, int) {\n\t\t\tif y < p2.Y {\n\t\t\t\treturn -1, -1\n\t\t\t}\n\n\t\t\tyPrev := y\n\t\t\ty--\n\t\t\treturn int(x), yPrev\n\t\t}, vertDirection\n\t}\n\n\treturn nil, -1\n}", "title": "" }, { "docid": "ef56a61860350e6eb1b54f5bac700293", "score": "0.5017145", "text": "func Intersection(firstPoints []*math.Point, secondPoints []*math.Point) []*math.Point {\n\tvar points []*math.Point\n\n\tfor _, firstPoint := range firstPoints {\n\t\tfor _, secondPoint := range secondPoints {\n\t\t\tisEqual := firstPoint.IsEqual(secondPoint)\n\n\t\t\tif isEqual {\n\t\t\t\tpoints = append(points, firstPoint)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn points\n}", "title": "" }, { "docid": "945f8a83885e7d001610b9c845d9078a", "score": "0.5009593", "text": "func randomPoints(n int) plotter.XYs {\n\tpts := make(plotter.XYs, n)\n\tfor i := range pts {\n\t\tif i == 0 {\n\t\t\tpts[i].X = rand.Float64()\n\t\t} else {\n\t\t\tpts[i].X = pts[i-1].X + rand.Float64()\n\t\t}\n\t\tpts[i].Y = pts[i].X + 10*rand.Float64()\n\t}\n\treturn pts\n}", "title": "" }, { "docid": "0281cba0f27bc1f84ea6796433add63a", "score": "0.5008918", "text": "func GetPoints(strings [2]string) [][2]int {\n\tlines := [2]Lines{}\n\tfor i := 0; i < 2; i++ {\n\t\tlines[i] = InitLines(strings[i])\n\t}\n\tn_points1 := len(lines[0].x) // assume it will be the same for both lines\n\tn_points2 := len(lines[1].x) // assume it will be the same for both lines\n\tpoints := [][2]int{}\n\t// increment by 2 because the end of the line segment\n\t// has to become the beginning of the next\n\tfor i := 0; i < n_points1-1; i++ {\n\t\tfor j := 0; j < n_points2-1; j++ {\n\t\t\tif !(lines[0].x[i] == 0 && lines[0].y[i] == 0 &&\n\t\t\t\tlines[1].y[j] == 0 && lines[1].y[j] == 0) {\n\t\t\t\tif res, found := Intersect(&lines[0], i, &lines[1], j); found {\n\t\t\t\t\tpoints = append(points, res)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn points\n}", "title": "" }, { "docid": "73dc1d92f8e7a3db5d2f09cf0de40b85", "score": "0.5003341", "text": "func NewPoint(X, Y, Z float64) *Tuple {\n\tpoint := &Tuple{\n\t\tX: X,\n\t\tY: Y,\n\t\tZ: Z,\n\t\tW: 1.0,\n\t}\n\n\treturn point\n}", "title": "" }, { "docid": "33e1615538c6c470813d0921ccd7cd27", "score": "0.5003137", "text": "func SlicesToCoordinatePairs(x, y []float64) []CoordinatePair {\n\tcp := make([]CoordinatePair, len(x))\n\tfor i := 0; i < len(x); i++ {\n\t\tcp[i] = CoordinatePair{X: x[i], Y: y[i]}\n\t}\n\treturn cp\n}", "title": "" }, { "docid": "0a7b0ea91a6b01a922626fe99d892735", "score": "0.49941507", "text": "func (a Point) Equals(b Point) bool {\n\tif a.X == b.X && a.Y == b.Y {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a4a3bc3b2f0f88242d5be7ed1b9b40b2", "score": "0.49920133", "text": "func MidPointXY(p1, p2 Point) Point {\n\treturn Point{\n\t\tX: 0.5 * (p1.X + p2.X),\n\t\tY: 0.5 * (p1.Y + p2.Y),\n\t}\n}", "title": "" }, { "docid": "c6352dd2be61cac89871faf3fcd6adcd", "score": "0.49889335", "text": "func findPairs(board [][]rune, x, y int) [][2]int {\n\tvar pairs [][2]int\n\tvar pair [2]int\n\n\t// x-1, y\n\tpair[0], pair[1] = x-1, y\n\tif x-1 >= 0 {\n\t\tpairs = append(pairs, pair)\n\t}\n\n\t// x, y-1\n\tpair[0], pair[1] = x, y-1\n\tif y-1 >= 0 {\n\t\tpairs = append(pairs, pair)\n\t}\n\n\t// x, y+1\n\tpair[0], pair[1] = x, y+1\n\tif y+1 < len(board[x]) {\n\t\tpairs = append(pairs, pair)\n\t}\n\n\t// x+1, y\n\tpair[0], pair[1] = x+1, y\n\tif x+1 < len(board) {\n\t\tpairs = append(pairs, pair)\n\t}\n\n\treturn pairs\n}", "title": "" }, { "docid": "1358077a0011404739a14c135f783abe", "score": "0.4982156", "text": "func pointBetween(p1, p2 point, f float64) point {\n\treturn point{p1.X*(1-f) + p2.X*f, p1.Y*(1-f) + p2.Y*f}\n}", "title": "" }, { "docid": "1fa35d75ccdd16a6881eea4373b19ea9", "score": "0.49777254", "text": "func pointInPolygon(x, y float64, polyX, polyY []float64) bool {\n\tj := len(polyX) - 1\n\toddNodes := false\n\n\tfor i := 0; i < len(polyX); i++ {\n\t\tif (polyY[i] < y && polyY[j] >= y) || (polyY[j] < y && polyY[i] >= y) {\n\t\t\tif (polyX[i] + (y-polyY[i])/(polyY[j]-polyY[i])*(polyX[j]-polyX[i])) < x {\n\t\t\t\toddNodes = !oddNodes\n\t\t\t}\n\t\t}\n\t\tj = i\n\t}\n\n\treturn oddNodes\n}", "title": "" }, { "docid": "9872a16d3b2e98f6c9a0ad463704513a", "score": "0.49663904", "text": "func drawPoints(n int, c chan<- int) {\n\trnd := rand.New(rand.NewSource(time.Now().UnixNano()))\n\tinside := 0\n\tfor i := 0; i < n; i++ {\n\t\tx, y := rnd.Float64(), rnd.Float64()\n\t\tif x*x+y*y <= 1 {\n\t\t\tinside++\n\t\t}\n\t}\n\tc <- inside\n}", "title": "" }, { "docid": "96ea177830c0a4955d51853148e1142e", "score": "0.4953576", "text": "func min_dist(x, y int, xs, ys []float64) (int, float64){\n min := math.MaxFloat64\n idx := 0\n eq := false\n for id := range xs {\n dist := dist(float64(x), float64(y), xs[id], ys[id])\n if dist < min {\n min = dist\n idx = id\n eq = false\n /* If there is an equidistant point, ignore it */ \n } else if dist == min {\n idx = -1\n }\n }\n if eq {\n return idx, float64(-1)\n }\n return idx, min\n}", "title": "" }, { "docid": "2dd6b8c3fdbd0fee14f6145532edfac8", "score": "0.49462542", "text": "func GeneratePoints(origin *math.Point, directionLine string) ([]*math.Point, error) {\n\tvectors := strings.Split(directionLine, \",\")\n\n\tvar pointList []*math.Point\n\n\t// Start the location at the origin\n\tcurrentLocation := math.NewPoint(origin.X, origin.Y)\n\n\tfor _, vector := range vectors {\n\t\tdirection := string(vector[0])\n\t\tdistance, err := strconv.Atoi(vector[1:])\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"vector is not parsable: \" + vector)\n\t\t}\n\n\t\tswitch direction {\n\t\tcase \"U\":\n\t\t\tpointList = addYPoints(pointList, currentLocation.X, currentLocation.Y, currentLocation.Y+distance)\n\t\t\tcurrentLocation.Y = currentLocation.Y + distance\n\t\tcase \"D\":\n\t\t\tpointList = addYPoints(pointList, currentLocation.X, currentLocation.Y-distance, currentLocation.Y)\n\t\t\tcurrentLocation.Y = currentLocation.Y - distance\n\t\tcase \"L\":\n\t\t\tpointList = addXPoints(pointList, currentLocation.Y, currentLocation.X-distance, currentLocation.X)\n\t\t\tcurrentLocation.X = currentLocation.X - distance\n\t\tcase \"R\":\n\t\t\tpointList = addXPoints(pointList, currentLocation.Y, currentLocation.X, currentLocation.X+distance)\n\t\t\tcurrentLocation.X = currentLocation.X + distance\n\t\tdefault:\n\t\t\treturn nil, errors.New(\"vector is not parsable: \" + vector)\n\t\t}\n\t}\n\n\treturn pointList, nil\n}", "title": "" }, { "docid": "13b3f2f38ee69bdee32f69a6d37ff61b", "score": "0.49121314", "text": "func GenerateRandomPoints(height int, width int, number int) []Point {\n\tvar points []Point\n\tvar point Point\n\n\tfor n := 0; n < number; n++ {\n\t\tpoint = RandomPoint(height, width)\n\t\tpoints = append(points, point)\n\t}\n\n\tpoints = GetUniquePoints(points)\n\n\treturn points\n}", "title": "" }, { "docid": "a639eb3da2a4cf07d5a45aaae0d94342", "score": "0.4911582", "text": "func createBatchPoints(measurementName string, metrics []Metric) ([]*influxdb.Point, error) {\n\tvar result []*influxdb.Point\n\tmeasurement := measurementName\n\ttimestamp := time.Now()\n\tfor _, metric := range metrics {\n\t\tpoint, err := influxdb.NewPoint(measurement, metric.Tags, metric.Fields, timestamp)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresult = append(result, point)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "8f7d3beca276790bbf8a06cce2b735ab", "score": "0.49083656", "text": "func newLocationData(x, y int) locationData {\n\treturn locationData{\n\t\tx: x, y: y,\n\t}\n}", "title": "" }, { "docid": "e07d59a17c2543da8946810a5e6e9c33", "score": "0.4889063", "text": "func (h *HexMap) getPositionsInRange(x, y, r int) (pos []client.Position) {\n\tfor dx := -r; dx < r+1; dx++ {\n\t\tfor dy := max(-r, -dx-r); dy < min(r, -dx+r)+1; dy++ {\n\t\t\tif _, ok := h.points[dx+x][dy+y]; ok {\n\t\t\t\tpos = append(pos, client.Position{dx + x, dy + y})\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "99d0d4f0844fab3cd333f89b89b699bc", "score": "0.4887841", "text": "func (cs CoordinateSystem) Point(X, Y int, r image.Rectangle) (x, y float64) {\n\tx = xmath.Scale(float64(X), float64(r.Min.X)-0.5, float64(r.Max.X)-0.5, cs.X0, cs.X1)\n\ty = xmath.Scale(float64(Y), float64(r.Min.Y)-0.5, float64(r.Max.Y)-0.5, cs.Y0, cs.Y1)\n\treturn\n}", "title": "" }, { "docid": "a6d745fca4671d66830a9049de9c8a5a", "score": "0.48780692", "text": "func freeSpot(x1, y1, x2, y2 int, second [][]int16) bool {\n\treturn second[x1][y1] == -1 && second[x2][y2] == -1\n}", "title": "" }, { "docid": "9819e2abbdcafe1d0c9081507dc654d8", "score": "0.48739982", "text": "func NewPt(x, y float64) *Point {\n\treturn &Point{\n\t\tX: x,\n\t\tY: y,\n\t}\n}", "title": "" }, { "docid": "6209555c51e4397d497734395fc398a5", "score": "0.48719504", "text": "func PointsEQ(v uint) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldPoints), v))\n\t})\n}", "title": "" }, { "docid": "d4405c7c0a0cd7a952a4d22f93e81ec4", "score": "0.48709705", "text": "func (r *tankGame) generateCoords() []float64 {\n\tvar x = rand.Float64()*float64(r.canvas.Width()-80) + 80\n\tfor int(x)+120 > r.canvas.Width() {\n\t\tx = rand.Float64()*float64(r.canvas.Width()-80) + 80\n\t}\n\n\ty := rand.Float64()*float64(-260-60) - 60\n\n\treturn []float64{x, y}\n}", "title": "" }, { "docid": "004a49412fab728de21a7f27798dbd06", "score": "0.4865933", "text": "func generateAreaCandidates(v, p, newP *data.Vertex) []data.Vertex {\n\tres := make(map[data.Vertex]struct{})\n\n\tradius := math.Sqrt(data.Edge{A: p, B: v}.SqLength())\n\tstep := math.Pi / 8\n\tfor a := 0.0; a < 2 * math.Pi; a += step {\n\t\tpoint := data.Vertex{X: newP.X + math.Cos(a)*radius, Y: newP.Y + math.Sin(a)*radius}\n\t\tfor i := -1.0; i <= 1.0; i++ {\n\t\t\tfor j := -1.0; j <= 1.0; j++ {\n\t\t\t\tres[data.Vertex{\n\t\t\t\t\tX: math.Round(point.X + i),\n\t\t\t\t\tY: math.Round(point.Y + j),\n\t\t\t\t}] = struct{}{}\n\t\t\t}\n\t\t}\n\t}\n\n\tlist := make([]data.Vertex, len(res))\n\ti := 0\n\tfor v := range res {\n\t\tlist[i] = v\n\t\ti++\n\t}\n\treturn list\n}", "title": "" }, { "docid": "2eed8117f3209f93450d26a7d62397bd", "score": "0.48644683", "text": "func generateLatLng(y0,x0 float64, radius int) s2.LatLng {\n\tradiusInDegrees := float64(radius) / 111000.0\n\n\tu := rand.Float64()\n\tv := rand.Float64()\n\tw := radiusInDegrees * math.Sqrt(u)\n\tt := 2 * math.Pi * v\n\tx := w * math.Cos(t)\n\ty := w * math.Sin(t)\n\n\tnewX := x / math.Cos(y0)\n\n\tfoundLng := newX + x0\n\tfoundLat := y + y0\n\n\tvar latlng = s2.LatLngFromDegrees(foundLat, foundLng)\n\tvar cellId = s2.CellIDFromLatLng(latlng)\n\tvar s2_token = cellId.ToToken()\n\tfmt.Println(s2_token)\n\tvar s2_pos = cellId.Pos()\n\tfmt.Println(s2_pos)\n\n\tvar s2_level = cellId.Level()\n\tfmt.Println(s2_level)\n\n\treturn latlng\n}", "title": "" }, { "docid": "a53911c1a0544b57fc4b16ee16fff03b", "score": "0.4861297", "text": "func (x *Point2) Equal(y *Point2) bool {\n\treturn math.Abs(x.X-y.X) < eps && math.Abs(x.Y-y.Y) < eps\n}", "title": "" }, { "docid": "409ac210ce01d26e37500750c12fcfb4", "score": "0.48566294", "text": "func cycloidCurvePoints(\n\tstartTime int,\n\tmidTime int,\n\tendTime int,\n\tstartIntensity int,\n\tmidIntensity int,\n\tendIntensity int,\n\tresolution int) ([]models.Point, error) {\n\n\t// sanity checks\n\n\tif resolution <= 0 {\n\t\treturn nil, errors.New(\"resolution must be greater than zero\")\n\t}\n\tif startIntensity > midIntensity {\n\t\treturn nil, errors.New(\"midIntensity must be larger than startIntensity\")\n\t}\n\tif endIntensity > midIntensity {\n\t\treturn nil, errors.New(\"midIntensity must be larger than endIntensity\")\n\t}\n\tif startTime >= midTime {\n\t\treturn nil, errors.New(\"midTime must be after startTime\")\n\t}\n\tif midTime >= endTime {\n\t\treturn nil, errors.New(\"midTime must be before endTime\")\n\t}\n\n\t// increment resolution by two to exclude start/end points\n\tresolution += 2\n\tif int(math.Mod(float64(resolution), 2)) > 0 {\n\t\t// decrement resolution by one to remove midpoint\n\t\tresolution -= 1\n\t}\n\tmedian := float64(resolution) / 2\n\n\taX := float64(endTime - startTime)\n\n\tvar t, x, y, aY float64\n\tvar time, intensity int\n\tvar points []models.Point\n\tvar prevPoint *models.Point\n\tfor i := 0; i <= resolution; i++ {\n\n\t\tt = 2 * math.Pi * float64(i) / float64(resolution)\n\t\tx = t - math.Sin(t)\n\t\ty = 1 - math.Cos(t)\n\n\t\ttime = startTime + int(math.Round(aX*x/(2*math.Pi)))\n\n\t\tif float64(i) <= median {\n\t\t\taY = float64(midIntensity - startIntensity)\n\t\t\tintensity = startIntensity + int(math.Round(aY*y/2))\n\t\t} else {\n\t\t\taY = float64(midIntensity - endIntensity)\n\t\t\tintensity = endIntensity + int(math.Round(aY*y/2))\n\t\t}\n\n\t\t// check for duplicate time\n\t\tif prevPoint != nil && prevPoint.Time == time {\n\t\t\t// approximate...\n\t\t\tprevPoint.Intensity = (prevPoint.Intensity + intensity) / 2\n\t\t\tcontinue\n\t\t}\n\n\t\tpoint := models.Point{\n\t\t\tTime: time,\n\t\t\tIntensity: intensity,\n\t\t}\n\t\tpoints = append(points, point)\n\t\tprevPoint = &point\n\t}\n\n\treturn points, nil\n}", "title": "" }, { "docid": "aa1a06961365979c1dfa8effde2c9e7a", "score": "0.48480642", "text": "func threateningPawnCoordinates(coord Coordinate, board *ChessBoard, pieceSide Side) []Coordinate {\n\tvar threateningCoordinates []Coordinate\n\tfirstPawnCol := coord.Column + 1\n\tsecondPawnCol := coord.Column - 1\n\tthreateningRow := coord.Row + 1\n\tif pieceSide == BLACK {\n\t\tthreateningRow = coord.Row - 1\n\t}\n\tfirstPawnCoord := Coordinate{Row: threateningRow, Column: firstPawnCol}\n\tsecondPawnCoord := Coordinate{Row: threateningRow, Column: secondPawnCol}\n\tif canCoordinateThreaten(board, firstPawnCoord, pieceSide, PAWN) {\n\t\tthreateningCoordinates = append(threateningCoordinates, firstPawnCoord)\n\t}\n\tif canCoordinateThreaten(board, secondPawnCoord, pieceSide, PAWN) {\n\t\tthreateningCoordinates = append(threateningCoordinates, secondPawnCoord)\n\t}\n\treturn threateningCoordinates\n}", "title": "" }, { "docid": "6153e8c0abdbd0cfb5b359db26a1cb22", "score": "0.4848046", "text": "func NewPoint2(x, y float64) *Point2 {\n\treturn &Point2{x, y}\n}", "title": "" }, { "docid": "194ae0506b5cd53b6706d1c8c1419e2d", "score": "0.48382193", "text": "func Point(children ...Element) *PointElement {\n\treturn &PointElement{\n\t\tChildren: children,\n\t}\n}", "title": "" }, { "docid": "03bebff5b07a894e0b2f1f04f000880c", "score": "0.48377377", "text": "func (p *Point) Equals(other Point) bool {\n\treturn p.X == other.X && p.Y == other.Y\n}", "title": "" }, { "docid": "134285f3ef2bb13d87796c2086ef48c1", "score": "0.4826359", "text": "func newGeoPoint(lon, lat float64, srid int) *GeoPoint {\n\tswitch srid {\n\tcase 4326:\n\t\treturn &GeoPoint{\n\t\t\tsrid: srid,\n\t\t\tPoint: s2.PointFromLatLng(s2.LatLngFromDegrees(lat, lon)),\n\t\t}\n\tdefault:\n\t\treturn &GeoPoint{\n\t\t\tsrid: srid,\n\t\t\tPoint: s2.Point{Vector: r3.Vector{X: lon, Y: lat, Z: 0}},\n\t\t}\n\t}\n}", "title": "" }, { "docid": "03bf103db791a954713eaf6cc217c8c0", "score": "0.4817987", "text": "func relPoint(p1 point, p2 point) point {\n\tretPoint := point{\n\t\tx: p2.x - p1.x,\n\t\ty: p2.y - p1.y,\n\t}\n\n\treturn retPoint\n}", "title": "" }, { "docid": "2ebb8cf437f4f1f96cb43999b1ae2502", "score": "0.48164046", "text": "func GeneratePointsSlice(rand *rand.Rand) PointsSlice {\n\tvar pointsSlice PointsSlice\n\tfor i, pointsN := 0, rand.Intn(100); i < pointsN; i++ {\n\t\tvar points Points\n\t\tfor j, pointN := 0, rand.Intn(1000); j < pointN; j++ {\n\t\t\tpoints = append(points, Point{\n\t\t\t\tName: strconv.Itoa(rand.Intn(10)),\n\t\t\t\tFields: models.Fields{\"value\": rand.Int63n(100000)},\n\t\t\t\tTime: time.Unix(0, rand.Int63n(int64(24*time.Hour))).UTC(),\n\t\t\t})\n\t\t}\n\t\tpointsSlice = append(pointsSlice, points)\n\t}\n\treturn pointsSlice\n}", "title": "" }, { "docid": "050342cc83e0b8aadf4d7338521228d1", "score": "0.4816389", "text": "func SubPoints(a, b rtree.Point) rtree.Point {\n\tnewPoint := rtree.Point{0.0, 0.0, 0.0}\n\n\tfor i := 0; i < 3; i++ {\n\t\tnewPoint[i] = a[i] - b[i]\n\t}\n\treturn newPoint\n}", "title": "" }, { "docid": "8631f4f91b3bded16f401185f5b9cf49", "score": "0.480632", "text": "func TangentsPoints(c1 *CircleId, c2 *CircleId, add float64) []RelatedPoint {\n\tif AnyIn(c1, c2) {\n\t\treturn []RelatedPoint{}\n\t}\n\talpha := math.Atan2(math.Abs(c1.R()-c2.R()), Dist(c1, c2))\n\tbeta := math.Atan2(c2.Y()-c1.Y(), c2.X()-c1.X())\n\tres := make([]RelatedPoint, 0, 4)\n\tres = append(res, c1.GetPoint(math.Pi/2+alpha+beta, add))\n\tres = append(res, c2.GetPoint(math.Pi/2+alpha+beta, add))\n\tres = append(res, c1.GetPoint(-math.Pi/2-alpha+beta, add))\n\tres = append(res, c2.GetPoint(-math.Pi/2-alpha+beta, add))\n\tif !Intersect(c1, c2) {\n\t\tgamma := math.Acos((c1.R() + c2.R()) / Dist(c1, c2))\n\t\t//fmt.Println(\"gamma: \", gamma/math.Pi*180)\n\t\tres = append(res, c1.GetPoint(math.Pi/2-gamma+beta, add))\n\t\tres = append(res, c2.GetPoint(math.Pi/2-gamma+beta, add))\n\t\tres = append(res, c1.GetPoint(-math.Pi/2+gamma+beta, add))\n\t\tres = append(res, c2.GetPoint(-math.Pi/2+gamma+beta, add))\n\t}\n\treturn res\n}", "title": "" }, { "docid": "e9ee300dff7afc1b4bd3346c53ef9a74", "score": "0.4795945", "text": "func SpaceFromxy(rx, ry, gx, gy, bx, by float64, White XYZ, g CurveProvider) Space {\n return Space{Yxy{1, rx, ry}.ToXYZ(), Yxy{1, gx, gy}.ToXYZ(), Yxy{1, bx, by}.ToXYZ(), White, g}\n}", "title": "" }, { "docid": "7dbbf4e4a9855eef4d8d0ab94fa58fd7", "score": "0.47937495", "text": "func drawPoint(x, y int, c toolbox.Colour) {\n\tplot[x][y].R = c.R\n\tplot[x][y].G = c.G\n\tplot[x][y].B = c.B\n\tplot[x][y].A = c.A\n}", "title": "" }, { "docid": "31bc938be98047f97533fdcb43a1afbc", "score": "0.4783339", "text": "func getShipVertex(field [][]string) map[string]int {\n\trand.Seed(time.Now().UnixNano())\n\tfieldLength := len(field)\n\n\treturn map[string]int {\n\t\t\"x\": rand.Intn(fieldLength),\n\t\t\"y\": rand.Intn(fieldLength),\n\t}\n}", "title": "" }, { "docid": "62430256a6dec5d9fa3871d7b59c50a7", "score": "0.47817317", "text": "func Test_point_basic(t *testing.T) {\n\tif p.X != px {\n\t\tt.Errorf(\"Bad Point X, got: %d, want: %d.\", p.X, px)\n\t}\n\tif p.Y != py {\n\t\tt.Errorf(\"Bad Point Y, got: %d, want: %d.\", p.Y, py)\n\t}\n}", "title": "" }, { "docid": "ee813d16bdfbb52a54112ad8da9f32d4", "score": "0.47775874", "text": "func ContactPoints(e1, e2 Edge, points ClosestPoints, info *CollisionInfo) {\n\tmindist := e1.r + e2.r\n\n\tif points.d > mindist {\n\t\treturn\n\t}\n\n\tn := points.n\n\tinfo.n = points.n\n\n\tdE1A := e1.a.p.Cross(n)\n\tdE1B := e1.b.p.Cross(n)\n\tdE2A := e2.a.p.Cross(n)\n\tdE2B := e2.b.p.Cross(n)\n\n\t// TODO + min isn't a complete fix\n\te1Denom := 1 / (dE1B - dE1A + math.SmallestNonzeroFloat64)\n\te2Denom := 1 / (dE2B - dE2A + math.SmallestNonzeroFloat64)\n\n\t// Project the endpoints of the two edges onto the opposing edge, clamping them as necessary.\n\t// Compare the projected points to the collision normal to see if the shapes overlap there.\n\t{\n\t\tp1 := n.Mult(e1.r).Add(e1.a.p.Lerp(e1.b.p, Clamp01((dE2B-dE1A)*e1Denom)))\n\t\tp2 := n.Mult(-e2.r).Add(e2.a.p.Lerp(e2.b.p, Clamp01((dE1A-dE2A)*e2Denom)))\n\t\tdist := p2.Sub(p1).Dot(n)\n\t\tif dist <= 0 {\n\t\t\thash1a2b := HashPair(e1.a.hash, e2.b.hash)\n\t\t\tinfo.PushContact(p1, p2, hash1a2b)\n\t\t}\n\t}\n\t{\n\t\tp1 := n.Mult(e1.r).Add(e1.a.p.Lerp(e1.b.p, Clamp01((dE2A-dE1A)*e1Denom)))\n\t\tp2 := n.Mult(-e2.r).Add(e2.a.p.Lerp(e2.b.p, Clamp01((dE1B-dE2A)*e2Denom)))\n\t\tdist := p2.Sub(p1).Dot(n)\n\t\tif dist <= 0 {\n\t\t\thash1b2a := HashPair(e1.b.hash, e2.a.hash)\n\t\t\tinfo.PushContact(p1, p2, hash1b2a)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3ed9f45bc8e9bab798a9a84054177faf", "score": "0.4767389", "text": "func bresenham(start, end image.Point, points []image.Point) []image.Point {\n\tvar cx = start.X\n\tvar cy = start.Y\n\n\tvar dx = end.X - cx\n\tvar dy = end.Y - cy\n\tif dx < 0 {\n\t\tdx = 0 - dx\n\t}\n\tif dy < 0 {\n\t\tdy = 0 - dy\n\t}\n\n\tvar sx int\n\tvar sy int\n\tif cx < end.X {\n\t\tsx = 1\n\t} else {\n\t\tsx = -1\n\t}\n\tif cy < end.Y {\n\t\tsy = 1\n\t} else {\n\t\tsy = -1\n\t}\n\tvar err = dx - dy\n\n\tvar n int\n\tfor n = 0; n < cap(points); n++ {\n\t\tpoints = append(points, image.Point{cx, cy})\n\t\tif cx == end.X && cy == end.Y {\n\t\t\treturn points\n\t\t}\n\t\tvar e2 = 2 * err\n\t\tif e2 > (0 - dy) {\n\t\t\terr = err - dy\n\t\t\tcx = cx + sx\n\t\t}\n\t\tif e2 < dx {\n\t\t\terr = err + dx\n\t\t\tcy = cy + sy\n\t\t}\n\t}\n\treturn points\n}", "title": "" }, { "docid": "58b05df1f37262e2b314a7cc364cf836", "score": "0.4756277", "text": "func (pv PointVector) ToPoints() []image.Point {\n\tpoints := make([]image.Point, pv.Size())\n\n\tfor j := 0; j < pv.Size(); j++ {\n\t\tpoints[j] = pv.At(j)\n\t}\n\treturn points\n}", "title": "" }, { "docid": "1b90637aac8caf689598a6bd69c0c637", "score": "0.4754914", "text": "func shiftPoints(points []*point) ([]point, int, int) {\n\tminX, maxX, minY, maxY := 0, 0, 0, 0\n\n\tfor _, p := range points {\n\t\tif p.x < minX {\n\t\t\tminX = p.x\n\t\t}\n\t\tif p.x > maxX {\n\t\t\tmaxX = p.x\n\t\t}\n\t\tif p.y < minY {\n\t\t\tminY = p.y\n\t\t}\n\t\tif p.y > maxY {\n\t\t\tmaxY = p.y\n\t\t}\n\t}\n\n\t// move 0-punt to left-top\n\tnewPoints := make([]point, 0, len(points))\n\n\tfor _, p := range points {\n\t\tnewP := point{\n\t\t\tp.x - minX,\n\t\t\tp.y - minY,\n\t\t\tp.vx,\n\t\t\tp.vy,\n\t\t}\n\t\tnewPoints = append(newPoints, newP)\n\t}\n\n\treturn newPoints, maxX - minX, maxY - minY\n}", "title": "" }, { "docid": "f265b2d28fa023525f6423ca80293869", "score": "0.47507375", "text": "func Points(v uint) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldPoints), v))\n\t})\n}", "title": "" }, { "docid": "11571a2767b61bd56d749235514d417b", "score": "0.47472465", "text": "func mandel_range(scale, x0, y0, x1, y1 int) [][]int {\n\titers := make([][]int, x1-x0+1)\n\tvar wg sync.WaitGroup\n\n\tfor x := x0; x <= x1; x++ {\n\t\twg.Add(1)\n\t\tgo func(x int) {\n\t\t\titers[x-x0] = make([]int, y1-y0+1)\n\t\t\tfor y := y0; y <= y1; y++ {\n\t\t\t\titers[x-x0][y-y0] = mandel_point(complex(float64(x)/float64(scale), float64(y)/float64(scale)))\n\t\t\t}\n\t\t\twg.Done()\n\t\t}(x)\n\t\tif x % 12 == 0 { //prevent too many goroutines\n\t\t\twg.Wait()\n\t\t}\n\t}\n\twg.Wait()\n\treturn iters\n}", "title": "" }, { "docid": "aebf11f6a2e903d96cf5a1c38becc91a", "score": "0.47463748", "text": "func GeneratePos(lp, rp []Pos, site uint8) ([]Pos, bool) {\n\tif ComparePos(lp, rp) != -1 {\n\t\treturn nil, false\n\t}\n\tp := []Pos{}\n\tfor i := 0; i < len(lp); i++ {\n\t\tl := lp[i]\n\t\tr := rp[i]\n\t\tif l.Ident == r.Ident && l.Site == r.Site {\n\t\t\tp = append(p, Pos{l.Ident, l.Site})\n\t\t\tcontinue\n\t\t}\n\t\tif d := r.Ident - l.Ident; d > 1 {\n\t\t\tr := random(l.Ident, r.Ident)\n\t\t\tp = append(p, Pos{r, site})\n\t\t} else if d == 1 {\n\t\t\tif site > l.Site {\n\t\t\t\tp = append(p, Pos{l.Ident, site})\n\t\t\t} else if site < r.Site {\n\t\t\t\tp = append(p, Pos{r.Ident, site})\n\t\t\t} else {\n\t\t\t\tmin := uint16(0)\n\t\t\t\tif len(lp) > len(rp) {\n\t\t\t\t\tmin = lp[len(rp)].Ident\n\t\t\t\t\t// Super edge case\n\t\t\t\t\t// left => {3 1} {65534 1}\n\t\t\t\t\t// right => {4 1}\n\t\t\t\t\t// In this case, 65534 can't be min, because no number is in between\n\t\t\t\t\t// it and MAX. So need to extend the positions further.\n\t\t\t\t\tif min == ^uint16(0)-1 {\n\t\t\t\t\t\tr := random(0, ^uint16(0))\n\t\t\t\t\t\tp = append(p, Pos{l.Ident, l.Site})\n\t\t\t\t\t\tp = append(p, lp[len(rp):]...)\n\t\t\t\t\t\tp = append(p, Pos{r, site})\n\t\t\t\t\t\treturn p, true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tr := random(min, ^uint16(0))\n\t\t\t\tp = append(p, Pos{l.Ident, l.Site}, Pos{r, site})\n\t\t\t}\n\t\t} else {\n\t\t\tif site > l.Site && site < r.Site {\n\t\t\t\tp = append(p, Pos{l.Ident, site})\n\t\t\t} else {\n\t\t\t\tr := random(0, ^uint16(0))\n\t\t\t\tp = append(p, Pos{l.Ident, l.Site}, Pos{r, site})\n\t\t\t}\n\t\t}\n\t\treturn p, true\n\t}\n\tif len(rp) > len(lp) {\n\t\tr := random(0, rp[len(lp)].Ident)\n\t\tp = append(p, Pos{r, site})\n\t}\n\treturn p, true\n}", "title": "" }, { "docid": "06cb06240eb9c3b9989692c315687dab", "score": "0.47421867", "text": "func (p *Point) Set(x, y float64) {\n\tp.X, p.Y = x, y\n}", "title": "" }, { "docid": "3d8308ad234e53b95f0371557010da7d", "score": "0.47373444", "text": "func InsertPoint(i int, points []Point,point Point) []Point{\n\tif (i > len(points)+1){\n\t\tfmt.Printf(\"InsertPoint: bad index %d size is %d\",i,len(points)+1)\n\t}\n\tt := make([]Point, len(points)+1) \t\t\n\tfor j:= 0; j < i; j++ {\n\t\tt[j] = points[j]\n\t}\n\tt[i] = point\n\tfor k:= i+1; k < len(t); k++ {\n\t\tt[k] = points[k-1]\n\t}\n\treturn t\n}", "title": "" }, { "docid": "f4172b38a6cec715e8e34af27dfba9cd", "score": "0.47276002", "text": "func (p Point) Equal(p2 Point) bool {\n\treturn p.Lon() == p2.Lon() && p.Lat() == p2.Lat()\n}", "title": "" }, { "docid": "4b20578b18193ee992e26ce5d6c6c7c8", "score": "0.4727347", "text": "func newExtensible(px, py *bigNumber) *extensibleCoordinates {\n\tx := px.copy()\n\ty := py.copy()\n\tz := &bigNumber{1}\n\tt := x.copy()\n\tu := y.copy()\n\n\treturn &extensibleCoordinates{\n\t\tx: x,\n\t\ty: y,\n\t\tz: z,\n\t\tt: t,\n\t\tu: u,\n\t}\n}", "title": "" }, { "docid": "a7350a3af8511e216fe15279e75a4c5e", "score": "0.4715314", "text": "func PointsGTE(v uint) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldPoints), v))\n\t})\n}", "title": "" }, { "docid": "54a463d01af9a78bb1de6d3bfa121a4d", "score": "0.4714092", "text": "func (p *Point) Equals(v *Point) bool {\n\treturn p == v || (p.x == v.x && p.y == v.y)\n}", "title": "" }, { "docid": "38ec58fbdb703806396ec1d9f6cb4968", "score": "0.47090346", "text": "func CheckPoint(x, y float64) (numOfIterations int, isInSet bool) {\n\tz := complex(0, 0)\n\tc := complex(x, y)\n\n\tfor {\n\t\tnumOfIterations++\n\t\tif numOfIterations == maxNumOfIterations {\n\t\t\tbreak\n\t\t}\n\n\t\tz = z*z + c\n\n\t\tif cmplx.Abs(z) >= 2 {\n\t\t\treturn numOfIterations, false\n\t\t}\n\t}\n\n\treturn numOfIterations, true\n}", "title": "" }, { "docid": "8b8cb447f5a9f29b77ba4c2c59cb1c29", "score": "0.4707843", "text": "func NewSeriesPoint(name string, points DataPoints, step int) *SeriesPoint {\n\tpoints = points.AlignTimestamp(step).Sort().Deduplicate()\n\treturn &SeriesPoint{\n\t\tname: name,\n\t\tpoints: points,\n\t\tstep: step,\n\t}\n}", "title": "" }, { "docid": "6f45c9152be06fc3848bfef657e73a93", "score": "0.47050875", "text": "func getNeighborhood(\n\tw worldgen.World, pick worldgen.Coordinate, mooreNeighborhood bool) []worldgen.Coordinate {\n\tvar neighborhood []worldgen.Coordinate\n\n\tif pick.Y < w.Ysize-1 && w.GetBox(pick.X, pick.Y+1) == worldgen.Empty {\n\t\tneighborhood = append(\n\t\t\tneighborhood, worldgen.Coordinate{X: pick.X, Y: pick.Y + 1},\n\t\t)\n\t}\n\tif mooreNeighborhood && pick.X < w.Xsize-1 && pick.Y < w.Ysize-1 &&\n\t\tw.GetBox(pick.X+1, pick.Y+1) == worldgen.Empty {\n\t\tneighborhood = append(neighborhood, worldgen.Coordinate{X: pick.X + 1, Y: pick.Y + 1})\n\t}\n\tif pick.X < w.Xsize-1 && w.GetBox(pick.X+1, pick.Y) == worldgen.Empty {\n\t\tneighborhood = append(neighborhood, worldgen.Coordinate{X: pick.X + 1, Y: pick.Y})\n\t}\n\n\tif mooreNeighborhood && pick.X < w.Xsize-1 && pick.Y > 0 && w.GetBox(pick.X+1, pick.Y-1) == worldgen.Empty {\n\t\tneighborhood = append(neighborhood, worldgen.Coordinate{X: pick.X + 1, Y: pick.Y - 1})\n\t}\n\tif pick.Y > 0 && w.GetBox(pick.X, pick.Y-1) == worldgen.Empty {\n\t\tneighborhood = append(neighborhood, worldgen.Coordinate{X: pick.X, Y: pick.Y - 1})\n\t}\n\tif mooreNeighborhood && pick.X > 0 && pick.Y > 0 && w.GetBox(pick.X-1, pick.Y-1) == worldgen.Empty {\n\t\tneighborhood = append(neighborhood, worldgen.Coordinate{X: pick.X - 1, Y: pick.Y - 1})\n\t}\n\tif pick.X > 0 && w.GetBox(pick.X-1, pick.Y) == worldgen.Empty {\n\t\tneighborhood = append(neighborhood, worldgen.Coordinate{X: pick.X - 1, Y: pick.Y})\n\t}\n\tif mooreNeighborhood && pick.X > 0 && pick.Y < w.Ysize-1 && w.GetBox(pick.X-1, pick.Y+1) == worldgen.Empty {\n\t\tneighborhood = append(neighborhood, worldgen.Coordinate{X: pick.X - 1, Y: pick.Y + 1})\n\t}\n\n\treturn neighborhood\n}", "title": "" }, { "docid": "4ab1ec23e535ef4374c6b33821c53472", "score": "0.46927553", "text": "func NewS2DFrom(x, y []float64) *S2D {\n\tif len(x) != len(y) {\n\t\tpanic(\"hbook: len differ\")\n\t}\n\n\ts := &S2D{\n\t\tpts: make([]Point2D, len(x)),\n\t\tann: make(Annotation),\n\t}\n\tfor i := range s.pts {\n\t\tpt := &s.pts[i]\n\t\tpt.X = x[i]\n\t\tpt.Y = y[i]\n\t}\n\treturn s\n}", "title": "" }, { "docid": "1863f5cf90926eeec2003edbfed7e9d2", "score": "0.4690079", "text": "func (point *EllipticPoint) Set(x, y *big.Int) {\n\tif point.x == nil {\n\t\tpoint.x = new(big.Int)\n\t}\n\tif point.y == nil {\n\t\tpoint.y = new(big.Int)\n\t}\n\n\tpoint.x.Set(x)\n\tpoint.y.Set(y)\n}", "title": "" }, { "docid": "b8c8103cfc9cdd163702d6c799162694", "score": "0.46890008", "text": "func testEqualIntersection01() {\n fmt.Printf(\"=============================\\n\")\n fmt.Printf(\"=== test_intersection_01\\n\")\n fmt.Printf(\"=============================\\n\")\n var pointList PointList\n\n pointList = append(pointList, Vector{28, 30, 0})\n pointList = append(pointList, Vector{30, 20, 0})\n pointList = append(pointList, Vector{30, 40, 0})\n\n pointList = append(pointList, Vector{40, 20, 0})\n pointList = append(pointList, Vector{40, 40, 0})\n pointList = append(pointList, Vector{42, 30, 0})\n\n v := CreateVoronoi(pointList)\n v.pprint()\n\n ch := v.ConvexHull(0)\n fmt.Println(ch)\n\n v.createImage(\"test_equal_intersection_01\", true)\n}", "title": "" }, { "docid": "de4832a909a010042b89fff7241b0444", "score": "0.46885896", "text": "func primitiveNew(points []Point) Primitive {\n\tvar prim Primitive\n\n\tprim.Points = make([]Point, len(points))\n\n\tfor i, pt := range points {\n\t\tprim.Points[i] = pt\n\t}\n\treturn prim\n}", "title": "" }, { "docid": "08bb018a769751c2eb38f28d48738e83", "score": "0.46622422", "text": "func ClonePointSlice(dst, src []Point) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}", "title": "" }, { "docid": "ad1876c335a1548cbd7ec07c8a753362", "score": "0.46614447", "text": "func points2NewRanges(sc *stmtctx.StatementContext, rangePoints []point, tp *types.FieldType) ([]*NewRange, error) {\n\tindexRanges := make([]*NewRange, 0, len(rangePoints)/2)\n\tfor i := 0; i < len(rangePoints); i += 2 {\n\t\tstartPoint, err := convertPoint(sc, rangePoints[i], tp)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Trace(err)\n\t\t}\n\t\tendPoint, err := convertPoint(sc, rangePoints[i+1], tp)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Trace(err)\n\t\t}\n\t\tless, err := rangePointLess(sc, startPoint, endPoint)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Trace(err)\n\t\t}\n\t\tif !less {\n\t\t\tcontinue\n\t\t}\n\t\tir := &NewRange{\n\t\t\tLowVal: []types.Datum{startPoint.value},\n\t\t\tLowExclude: startPoint.excl,\n\t\t\tHighVal: []types.Datum{endPoint.value},\n\t\t\tHighExclude: endPoint.excl,\n\t\t}\n\t\tindexRanges = append(indexRanges, ir)\n\t}\n\treturn indexRanges, nil\n}", "title": "" }, { "docid": "f1876c65578ab76ba37ab7c2b7123b41", "score": "0.46558207", "text": "func normalizeCoords(coords []string) ([]point, bounds) {\n\tresult := make([]point, len(coords))\n\tminX, minY, maxX, maxY := math.MaxInt64, math.MaxInt64, 0, 0\n\tfor index, currentPoint := range coords {\n\t\tsplitted := strings.Split(currentPoint, \", \")\n\t\tx, _ := strconv.Atoi(splitted[0])\n\t\ty, _ := strconv.Atoi(splitted[1])\n\t\tif x < minX {\n\t\t\tminX = x\n\t\t}\n\t\tif x > maxX {\n\t\t\tmaxX = x\n\t\t}\n\t\tif y < minY {\n\t\t\tminY = y\n\t\t}\n\t\tif y > maxY {\n\t\t\tmaxY = y\n\t\t}\n\t\tresult[index].x = x\n\t\tresult[index].y = y\n\t\tresult[index].id = index\n\t}\n\t// Translate the coords to start at (0, 0)\n\tfor index, value := range result {\n\t\tvalue.x -= minX\n\t\tvalue.y -= minY\n\t\tresult[index] = value\n\t}\n\treturn result, bounds{minx: 0, miny: 0, maxx: maxX - minX + 1, maxy: maxY - minX + 1}\n}", "title": "" }, { "docid": "a19d80a5eca790217e2b004bf54d5a66", "score": "0.46539465", "text": "func (l *Line) Points() (points []image.Point) {\n\taccumulator := func(x, y int) bool {\n\t\tpoints = append(points, image.Point{x, y})\n\t\treturn true\n\t}\n\tline(l.From.X, l.From.Y, l.To.X, l.To.Y, accumulator)\n\treturn points\n}", "title": "" }, { "docid": "8da40fa0a644e18c9fecc6d9a2b75b95", "score": "0.4652624", "text": "func randpoint(r math.Rectangle) math.Point {\n\treturn math.Pt(\n\t\tRandInt(r.Min.X, r.Max.X),\n\t\tRandInt(r.Min.Y, r.Max.Y),\n\t)\n}", "title": "" }, { "docid": "af5debc742acfd048e2648a9a3cdad0d", "score": "0.46444887", "text": "func (point *Point2D) Clone() *Point2D {\n\treturn &Point2D{\n\t\tX: point.X,\n\t\tY: point.Y,\n\t}\n}", "title": "" }, { "docid": "f1bf39295e40d52b5b03986cbf0f258e", "score": "0.4643085", "text": "func BenchmarkPoint(b *testing.B) {\n\tp := At(10, 20)\n\tb.Run(\"within\", func(b *testing.B) {\n\t\tb.ReportAllocs()\n\t\tb.ResetTimer()\n\t\tfor n := 0; n < b.N; n++ {\n\t\t\tp.Within(At(0, 0), At(100, 100))\n\t\t}\n\t})\n\n\tb.Run(\"within-rect\", func(b *testing.B) {\n\t\tb.ReportAllocs()\n\t\tb.ResetTimer()\n\t\tfor n := 0; n < b.N; n++ {\n\t\t\tp.WithinRect(NewRect(0, 0, 100, 100))\n\t\t}\n\t})\n\n\tb.Run(\"interleave\", func(b *testing.B) {\n\t\tout := int32(0)\n\t\tp := At(8191, 8191)\n\t\tb.ReportAllocs()\n\t\tb.ResetTimer()\n\t\tfor n := 0; n < b.N; n++ {\n\t\t\tout = p.Interleave()\n\t\t}\n\t\tassert.NotZero(b, out)\n\t})\n}", "title": "" }, { "docid": "2f70748eb246f6978b4b2013e8033561", "score": "0.46407866", "text": "func (p Points) In(x, y int, sizes ...int) bool {\n\t_, ok := p[intgeom.Point2{x, y}]\n\treturn ok\n}", "title": "" }, { "docid": "c11441f88e7884e376f30e1029aed917", "score": "0.4637744", "text": "func ComparePoints(p1 EllipticPoint, p2 EllipticPoint) bool {\n\tif p1.x.Cmp(p2.x) != 0 || p1.y.Cmp(p2.y) != 0 {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "3c4b3adc6b9829dda47a4f9db4345f22", "score": "0.4629458", "text": "func distant(point1 []int, point2 []int) int {\n\txDistinct := math.Pow(float64(point1[0]-point2[0]), float64(2))\n\tyDistinct := math.Pow(float64(point1[1]-point2[1]), float64(2))\n\treturn int(xDistinct + yDistinct)\n}", "title": "" }, { "docid": "eb352f97b259746e5cdb1368111a430d", "score": "0.4624093", "text": "func hashToPoint(data ...[]byte) *Point {\n\n\tif len(data) < 2 {\n\t\tpanic(data)\n\t}\n\n\thash := make([]byte, 32)\n\tsha3.TupleHash256(data[:len(data)-1], data[len(data)-1], hash)\n\tx, y := swu.HashToPoint(hash)\n\treturn &Point{x, y}\n}", "title": "" }, { "docid": "7aff464e9ac7e588214c53010d93711c", "score": "0.46168274", "text": "func FromPixelsPoint(x, y float32) (float32, float32) {\n\tscale := GetPixelScale()\n\treturn x / scale, y / scale\n}", "title": "" }, { "docid": "14ae4b5d5c636651838a758331ef10d3", "score": "0.46166378", "text": "func (a *AI) findAdjacentShot(x, y int) (int, int, bool) {\n\t//up\n\tif y+1 < boardSize && !a.board.PlayerHasShot(x, y+1) {\n\t\treturn x, y + 1, true\n\t}\n\t// down\n\tif y-1 >= 0 && !a.board.PlayerHasShot(x, y-1) {\n\t\treturn x, y - 1, true\n\t}\n\t// left\n\tif x-1 >= 0 && !a.board.PlayerHasShot(x-1, y) {\n\t\treturn x - 1, y, true\n\t}\n\t// right\n\tif x+1 < boardSize && !a.board.PlayerHasShot(x+1, y) {\n\t\treturn x + 1, y, true\n\t}\n\n\t// all adjacent points are already hit\n\treturn 0, 0, false\n}", "title": "" } ]
7d7d6ceea2bc29d26b4e026a33dc0c35
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComputeImageSpec.
[ { "docid": "875ead1612b325bc3e41ac450d8f59d1", "score": "0.8691765", "text": "func (in *ComputeImageSpec) DeepCopy() *ComputeImageSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeImageSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" } ]
[ { "docid": "90cd0ee74fffb620e337a88555b2769b", "score": "0.7458267", "text": "func (in *ImageSpec) DeepCopy() *ImageSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImageSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "90cd0ee74fffb620e337a88555b2769b", "score": "0.7458267", "text": "func (in *ImageSpec) DeepCopy() *ImageSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImageSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "90cd0ee74fffb620e337a88555b2769b", "score": "0.7458267", "text": "func (in *ImageSpec) DeepCopy() *ImageSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImageSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "90cd0ee74fffb620e337a88555b2769b", "score": "0.7458267", "text": "func (in *ImageSpec) DeepCopy() *ImageSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImageSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "90cd0ee74fffb620e337a88555b2769b", "score": "0.7458267", "text": "func (in *ImageSpec) DeepCopy() *ImageSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImageSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "bf7e17241ccda022d021af1dcf250fbc", "score": "0.7442001", "text": "func (in *ComputeInstanceSpec) DeepCopy() *ComputeInstanceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeInstanceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "bf7e17241ccda022d021af1dcf250fbc", "score": "0.7442001", "text": "func (in *ComputeInstanceSpec) DeepCopy() *ComputeInstanceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeInstanceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0bfc809fc9df9e59b38385ab99ce095e", "score": "0.71743315", "text": "func (in *ComputeNetworkSpec) DeepCopy() *ComputeNetworkSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeNetworkSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0bfc809fc9df9e59b38385ab99ce095e", "score": "0.71743315", "text": "func (in *ComputeNetworkSpec) DeepCopy() *ComputeNetworkSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeNetworkSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "db06860de3f6aabb92f443d1a676af71", "score": "0.7082609", "text": "func (in *ImageBuildSpec) DeepCopy() *ImageBuildSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImageBuildSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d979ac813a8602aac6e6175df88fdc9e", "score": "0.6791692", "text": "func (in *ComputeInstanceTemplateSpec) DeepCopy() *ComputeInstanceTemplateSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeInstanceTemplateSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d979ac813a8602aac6e6175df88fdc9e", "score": "0.6791692", "text": "func (in *ComputeInstanceTemplateSpec) DeepCopy() *ComputeInstanceTemplateSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeInstanceTemplateSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0aaad3db590011623210278cdc39b3a5", "score": "0.6726652", "text": "func (in *BookkeeperImageSpec) DeepCopy() *BookkeeperImageSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BookkeeperImageSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ddd99af69758da1f320ce70c2eed3fc0", "score": "0.6662557", "text": "func (in *ComputeInstanceGroupSpec) DeepCopy() *ComputeInstanceGroupSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeInstanceGroupSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ddd99af69758da1f320ce70c2eed3fc0", "score": "0.6662557", "text": "func (in *ComputeInstanceGroupSpec) DeepCopy() *ComputeInstanceGroupSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeInstanceGroupSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cac420ea1bf96e99640c879f99e88271", "score": "0.6587677", "text": "func (in *ComputeTargetInstanceSpec) DeepCopy() *ComputeTargetInstanceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeTargetInstanceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cac420ea1bf96e99640c879f99e88271", "score": "0.6587677", "text": "func (in *ComputeTargetInstanceSpec) DeepCopy() *ComputeTargetInstanceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeTargetInstanceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "317bcd603314c22c963d8900fbc6873d", "score": "0.6555286", "text": "func (in *ComputeDiskSpec) DeepCopy() *ComputeDiskSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeDiskSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "317bcd603314c22c963d8900fbc6873d", "score": "0.6555286", "text": "func (in *ComputeDiskSpec) DeepCopy() *ComputeDiskSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeDiskSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "da07a96357e0cddc044cce87f9b14a56", "score": "0.65227145", "text": "func (in *ComputeSubnetworkSpec) DeepCopy() *ComputeSubnetworkSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeSubnetworkSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "da07a96357e0cddc044cce87f9b14a56", "score": "0.65227145", "text": "func (in *ComputeSubnetworkSpec) DeepCopy() *ComputeSubnetworkSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeSubnetworkSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "704e380536b606577124c16ea05f85fd", "score": "0.65085095", "text": "func (in *ComputeSnapshotSpec) DeepCopy() *ComputeSnapshotSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeSnapshotSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "704e380536b606577124c16ea05f85fd", "score": "0.65085095", "text": "func (in *ComputeSnapshotSpec) DeepCopy() *ComputeSnapshotSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeSnapshotSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a23d637a00bfc86c6c4ee6af82ca0f1c", "score": "0.6458434", "text": "func (in *ImageSetSpec) DeepCopy() *ImageSetSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImageSetSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7617ec69e0741e18fcd4e5cccc69e13b", "score": "0.64488214", "text": "func (in *ImageMapSpec) DeepCopy() *ImageMapSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImageMapSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "9741c099e9d4168ebfe6adb49fbbd03b", "score": "0.6402861", "text": "func (in *ComputeSecurityPolicySpec) DeepCopy() *ComputeSecurityPolicySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeSecurityPolicySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "9741c099e9d4168ebfe6adb49fbbd03b", "score": "0.6402861", "text": "func (in *ComputeSecurityPolicySpec) DeepCopy() *ComputeSecurityPolicySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeSecurityPolicySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7f0c3b0c12afd4dd162ee0d1196a9260", "score": "0.635926", "text": "func (in *VirtualNetwork_Spec) DeepCopy() *VirtualNetwork_Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualNetwork_Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "8ad6d894c6ce5083fe120bfa33101de5", "score": "0.6350001", "text": "func (in *ImageBindingSpec) DeepCopy() *ImageBindingSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImageBindingSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3436697520c9a0add3cfe9197a046686", "score": "0.63482416", "text": "func (in *ComputeNetworkEndpointGroupSpec) DeepCopy() *ComputeNetworkEndpointGroupSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeNetworkEndpointGroupSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3436697520c9a0add3cfe9197a046686", "score": "0.63482416", "text": "func (in *ComputeNetworkEndpointGroupSpec) DeepCopy() *ComputeNetworkEndpointGroupSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeNetworkEndpointGroupSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0fada36695ba1ffb63af0c7d4fb1359b", "score": "0.63412255", "text": "func (in *VirtualMachineSpec) DeepCopy() *VirtualMachineSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualMachineSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0fada36695ba1ffb63af0c7d4fb1359b", "score": "0.63412255", "text": "func (in *VirtualMachineSpec) DeepCopy() *VirtualMachineSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualMachineSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "46c9c5982596447e572ed808fb309149", "score": "0.6332541", "text": "func (in *ComputeNodeTemplateSpec) DeepCopy() *ComputeNodeTemplateSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeNodeTemplateSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "46c9c5982596447e572ed808fb309149", "score": "0.6332541", "text": "func (in *ComputeNodeTemplateSpec) DeepCopy() *ComputeNodeTemplateSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeNodeTemplateSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6d5258aa6f93d240eeb240ac8c2345cc", "score": "0.6317441", "text": "func (in *ComputeReservationSpec) DeepCopy() *ComputeReservationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeReservationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6d5258aa6f93d240eeb240ac8c2345cc", "score": "0.6317441", "text": "func (in *ComputeReservationSpec) DeepCopy() *ComputeReservationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeReservationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "2f6bf9e123cf3b5e770cef8e85442f86", "score": "0.62951094", "text": "func (in *ComputeServiceAttachmentSpec) DeepCopy() *ComputeServiceAttachmentSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeServiceAttachmentSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "32f2bf7826f4ac7aefab9cdbd19a9d55", "score": "0.6292603", "text": "func (in *NetworkInterface_Spec) DeepCopy() *NetworkInterface_Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkInterface_Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7b7f1c57b5bd556d35273679b6c4c021", "score": "0.6291733", "text": "func (in *VirtualMachineScaleSetSpec) DeepCopy() *VirtualMachineScaleSetSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualMachineScaleSetSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "501feb5c3506dbf451f390393e0abd1f", "score": "0.62731206", "text": "func (in *ComputeFirewallSpec) DeepCopy() *ComputeFirewallSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeFirewallSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "501feb5c3506dbf451f390393e0abd1f", "score": "0.62731206", "text": "func (in *ComputeFirewallSpec) DeepCopy() *ComputeFirewallSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeFirewallSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0734b32d38175d42c243fef767e073ae", "score": "0.6240846", "text": "func (in *ComputeHealthCheckSpec) DeepCopy() *ComputeHealthCheckSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeHealthCheckSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0734b32d38175d42c243fef767e073ae", "score": "0.6240846", "text": "func (in *ComputeHealthCheckSpec) DeepCopy() *ComputeHealthCheckSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeHealthCheckSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "897f2087957297504eccd0772f5f7719", "score": "0.6223466", "text": "func (in *ImagePolicyArgoCDUpdateSpec) DeepCopy() *ImagePolicyArgoCDUpdateSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImagePolicyArgoCDUpdateSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "fb37dc1ff2b5ceb3dd907eff34d7ec60", "score": "0.6203703", "text": "func (in *ComputeNodeGroupSpec) DeepCopy() *ComputeNodeGroupSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeNodeGroupSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "fb37dc1ff2b5ceb3dd907eff34d7ec60", "score": "0.6203703", "text": "func (in *ComputeNodeGroupSpec) DeepCopy() *ComputeNodeGroupSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeNodeGroupSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "fd5d50bc5535e843d66ba36c30d06866", "score": "0.6199534", "text": "func (in *ComputeInterconnectAttachmentSpec) DeepCopy() *ComputeInterconnectAttachmentSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeInterconnectAttachmentSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "fd5d50bc5535e843d66ba36c30d06866", "score": "0.6199534", "text": "func (in *ComputeInterconnectAttachmentSpec) DeepCopy() *ComputeInterconnectAttachmentSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeInterconnectAttachmentSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "344a4ce9849271d37d315e911947fc8f", "score": "0.6188588", "text": "func (in *ComputeAddressSpec) DeepCopy() *ComputeAddressSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeAddressSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "344a4ce9849271d37d315e911947fc8f", "score": "0.6188588", "text": "func (in *ComputeAddressSpec) DeepCopy() *ComputeAddressSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeAddressSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "01ae26a3d9693f4a0f0364860ce8ffbe", "score": "0.6187451", "text": "func (in *RunnerImageSpec) DeepCopy() *RunnerImageSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RunnerImageSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "131e441ea3891256c685315e328dec7d", "score": "0.61596924", "text": "func (in *ComputeRegionNetworkEndpointGroupSpec) DeepCopy() *ComputeRegionNetworkEndpointGroupSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeRegionNetworkEndpointGroupSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a00eef7dc5db61181d8334b4d6f6fe34", "score": "0.61428505", "text": "func (in *NetworkInterfaceSpec) DeepCopy() *NetworkInterfaceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkInterfaceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a00eef7dc5db61181d8334b4d6f6fe34", "score": "0.61428505", "text": "func (in *NetworkInterfaceSpec) DeepCopy() *NetworkInterfaceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkInterfaceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a00eef7dc5db61181d8334b4d6f6fe34", "score": "0.61428505", "text": "func (in *NetworkInterfaceSpec) DeepCopy() *NetworkInterfaceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkInterfaceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "2b08b10f0ff9838fb848abf8ccd575c5", "score": "0.6142743", "text": "func (in *ComputeNetworkPeeringSpec) DeepCopy() *ComputeNetworkPeeringSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeNetworkPeeringSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "2b08b10f0ff9838fb848abf8ccd575c5", "score": "0.6142743", "text": "func (in *ComputeNetworkPeeringSpec) DeepCopy() *ComputeNetworkPeeringSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeNetworkPeeringSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "9e2ae538a7bb990ac2498683f451ce58", "score": "0.6095533", "text": "func (in *WasmExtensionSpecImage) DeepCopy() *WasmExtensionSpecImage {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WasmExtensionSpecImage)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e68de14419f32311a7556cce22ab5eb6", "score": "0.6093078", "text": "func (in *ComputeImage) DeepCopy() *ComputeImage {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeImage)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e68de14419f32311a7556cce22ab5eb6", "score": "0.6093078", "text": "func (in *ComputeImage) DeepCopy() *ComputeImage {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeImage)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "9dea5dc1b5c1370da76b86ce91575da5", "score": "0.60664326", "text": "func (in *NetworkTemplateSpec) DeepCopy() *NetworkTemplateSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkTemplateSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e825cdfd5e182e61d7e32f58c530dfb7", "score": "0.60569227", "text": "func (in *ApicurioRegistrySpecImage) DeepCopy() *ApicurioRegistrySpecImage {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApicurioRegistrySpecImage)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f3fbda9d740b4397fe09d20f0e24aea5", "score": "0.6056288", "text": "func (in *VirtualNetworkSpec) DeepCopy() *VirtualNetworkSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualNetworkSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f3f944769813b699f0194a2c2804bd57", "score": "0.60364676", "text": "func (in *ResourceContainerSpec) DeepCopy() *ResourceContainerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceContainerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "634e083352273f98e9971dfa0c805215", "score": "0.6005065", "text": "func (in *ContainerGroup_Spec) DeepCopy() *ContainerGroup_Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ContainerGroup_Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d80ead0aa4e058cd8db2d6b4b30bcc4b", "score": "0.5968449", "text": "func (in *NetworkSecurityGroup_Spec) DeepCopy() *NetworkSecurityGroup_Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkSecurityGroup_Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "1702519f1553940e6b6b325cad027cb0", "score": "0.59535134", "text": "func (in *NetworkInterfaceSpecProperties) DeepCopy() *NetworkInterfaceSpecProperties {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkInterfaceSpecProperties)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cad25939c22015ccaac72ecf8bfe0869", "score": "0.5947454", "text": "func (in *VirtualNetworkGateway_Spec) DeepCopy() *VirtualNetworkGateway_Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualNetworkGateway_Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a46104a80f5542b9f277c0936612c714", "score": "0.5917231", "text": "func (in *AWSCloudSpec) DeepCopy() *AWSCloudSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AWSCloudSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a965517df276e6fdf719858986ffe9e6", "score": "0.59147066", "text": "func (in *ContainerSpec) DeepCopy() *ContainerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ContainerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "47db0f7d7d5cfdba6249dc273199516c", "score": "0.59131366", "text": "func (in *CloudPrivateIPConfigSpec) DeepCopy() *CloudPrivateIPConfigSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CloudPrivateIPConfigSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f7c58a8bae39f5cb2423a732d0af25ac", "score": "0.5909615", "text": "func (in *YBImageSpec) DeepCopy() *YBImageSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(YBImageSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "09fdd9dcf4404345c207b4cc83c5c67e", "score": "0.5904127", "text": "func (in *ComputeTargetPoolSpec) DeepCopy() *ComputeTargetPoolSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeTargetPoolSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "09fdd9dcf4404345c207b4cc83c5c67e", "score": "0.5904127", "text": "func (in *ComputeTargetPoolSpec) DeepCopy() *ComputeTargetPoolSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeTargetPoolSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f4f5ebf153f801ed86717bbbcc123bea", "score": "0.5895956", "text": "func (in *ComputeURLMapSpec) DeepCopy() *ComputeURLMapSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeURLMapSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f4f5ebf153f801ed86717bbbcc123bea", "score": "0.5895956", "text": "func (in *ComputeURLMapSpec) DeepCopy() *ComputeURLMapSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeURLMapSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d5176ec34e949d3f420175f1dc612c70", "score": "0.5885226", "text": "func (in *ImagePullSecretSpec) DeepCopy() *ImagePullSecretSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImagePullSecretSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "eb18dd2e48082088ee75a4df4f0354f1", "score": "0.5868701", "text": "func (in *ComputePacketMirroringSpec) DeepCopy() *ComputePacketMirroringSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputePacketMirroringSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "fde9e029992ffb044a64379ae7fe5b7c", "score": "0.5851839", "text": "func (in *NetworkInterfaceIPConfigurationSpec) DeepCopy() *NetworkInterfaceIPConfigurationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkInterfaceIPConfigurationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6b45ee371f3054d997f6fe681a70a66f", "score": "0.5850473", "text": "func (in *ComputeResourcePolicySpec) DeepCopy() *ComputeResourcePolicySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeResourcePolicySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6b45ee371f3054d997f6fe681a70a66f", "score": "0.5850473", "text": "func (in *ComputeResourcePolicySpec) DeepCopy() *ComputeResourcePolicySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeResourcePolicySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "881a61b1415acf5c8caa3f7d116f62de", "score": "0.5848181", "text": "func (in *MetricSpec) DeepCopy() *MetricSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MetricSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a781dde012455fe002f13e7cf845b242", "score": "0.58310306", "text": "func (in *NifcloudMachineSpec) DeepCopy() *NifcloudMachineSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NifcloudMachineSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "57253a5c689e1713f6662a7519e4195a", "score": "0.5826919", "text": "func (in *DatacenterSpec) DeepCopy() *DatacenterSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DatacenterSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "099777fba3b33913deafb23244df8316", "score": "0.58245087", "text": "func (in *NetworkSpec) DeepCopy() *NetworkSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "099777fba3b33913deafb23244df8316", "score": "0.58245087", "text": "func (in *NetworkSpec) DeepCopy() *NetworkSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "099777fba3b33913deafb23244df8316", "score": "0.58245087", "text": "func (in *NetworkSpec) DeepCopy() *NetworkSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "91bc3a85446987272f95db4cd467e25f", "score": "0.5819516", "text": "func (in *VirtualNetworks_VirtualNetworkPeering_Spec) DeepCopy() *VirtualNetworks_VirtualNetworkPeering_Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualNetworks_VirtualNetworkPeering_Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "dda272af9020265f32d3f82baf05bbf8", "score": "0.5812225", "text": "func (in *ComputeProjectMetadataSpec) DeepCopy() *ComputeProjectMetadataSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeProjectMetadataSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "dda272af9020265f32d3f82baf05bbf8", "score": "0.5812225", "text": "func (in *ComputeProjectMetadataSpec) DeepCopy() *ComputeProjectMetadataSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeProjectMetadataSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cb6162d4439b22a697fdd06745650b30", "score": "0.581202", "text": "func (in *Spec) DeepCopy() *Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cb6162d4439b22a697fdd06745650b30", "score": "0.581202", "text": "func (in *Spec) DeepCopy() *Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cb6162d4439b22a697fdd06745650b30", "score": "0.581202", "text": "func (in *Spec) DeepCopy() *Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "bc395015dd10e9afa24a8a2bf2801649", "score": "0.58086914", "text": "func (in *ComputeRouterInterfaceSpec) DeepCopy() *ComputeRouterInterfaceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeRouterInterfaceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "bc395015dd10e9afa24a8a2bf2801649", "score": "0.58086914", "text": "func (in *ComputeRouterInterfaceSpec) DeepCopy() *ComputeRouterInterfaceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeRouterInterfaceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "34a7cff302fca7ebf46ffcbce4fd03b4", "score": "0.57715076", "text": "func (in *ECPClusterSpec) DeepCopy() *ECPClusterSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ECPClusterSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "2cd6e43446d939757ed8522cdf2992e3", "score": "0.5770096", "text": "func (in *TemplateUpdateRequestSpec) DeepCopy() *TemplateUpdateRequestSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TemplateUpdateRequestSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6a6655510c3b2a720392997b1d49b968", "score": "0.5767268", "text": "func (in *KubernetesImageObjectDescriptor) DeepCopy() *KubernetesImageObjectDescriptor {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubernetesImageObjectDescriptor)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" } ]
8621d895ffffbe4e43e3d51c6ce2a3f3
Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.
[ { "docid": "d0c7a7e087f52198be4aa6e388ea25a3", "score": "0.0", "text": "func (c *UsersSettingsUpdatePopCall) Context(ctx context.Context) *UsersSettingsUpdatePopCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" } ]
[ { "docid": "68996f2a591646e4d38f4782258ccb61", "score": "0.6329869", "text": "func (c *PostsListCall) Context(ctx context.Context) *PostsListCall {\r\n\tc.ctx_ = ctx\r\n\treturn c\r\n}", "title": "" }, { "docid": "c4cfb20eba4624046c6d8e2c93f46f33", "score": "0.6314481", "text": "func (req TruncateRequest) Context(ctx context.Context) TruncateRequest {\n\treq.impl = req.impl.Context(ctx)\n\n\treturn req\n}", "title": "" }, { "docid": "54b9557a94c7f5f1c5026095a1bc4fd5", "score": "0.63023484", "text": "func (c *PostsDeleteCall) Context(ctx context.Context) *PostsDeleteCall {\r\n\tc.ctx_ = ctx\r\n\treturn c\r\n}", "title": "" }, { "docid": "4435e5be6708b5e73eb109ebe7d49876", "score": "0.6290772", "text": "func (c *MattersHoldsDeleteCall) Context(ctx context.Context) *MattersHoldsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "a2ec8bf96649df284b9142df252a6460", "score": "0.62613386", "text": "func (c *UpstreamDeleteCall) Context(ctx context.Context) *UpstreamDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "6032083fd6950e0450f21d70e3306e5b", "score": "0.6223531", "text": "func (r *StatsTransfersReq) Context(ctx context.Context) *StatsTransfersReq {\n\tr.req.ctx = ctx\n\treturn r\n}", "title": "" }, { "docid": "6fa4365fdd19689ebdd2300c33fbb7dc", "score": "0.6179576", "text": "func (c *PagesDeleteCall) Context(ctx context.Context) *PagesDeleteCall {\r\n\tc.ctx_ = ctx\r\n\treturn c\r\n}", "title": "" }, { "docid": "9387b0322f05543160050ba5fb705d3d", "score": "0.6179245", "text": "func (r *DeleteWebhookReq) Context(ctx context.Context) *DeleteWebhookReq {\n\tr.req.ctx = ctx\n\treturn r\n}", "title": "" }, { "docid": "b19ac0a84a97ed5b9d1fe863aef5eac5", "score": "0.6145128", "text": "func (c *MattersDeleteCall) Context(ctx context.Context) *MattersDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "86610a869960567c6dded69a13cd461b", "score": "0.6143646", "text": "func (c *OperationsDeleteCall) Context(ctx context.Context) *OperationsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "86610a869960567c6dded69a13cd461b", "score": "0.6143646", "text": "func (c *OperationsDeleteCall) Context(ctx context.Context) *OperationsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "2a4d19188a0d8405a46f2b2acda65c21", "score": "0.61192137", "text": "func (c *FlightobjectInsertCall) Context(ctx context.Context) *FlightobjectInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "00759e36c029b9a6eb376a7e4298af63", "score": "0.61152315", "text": "func (c *PostsInsertCall) Context(ctx context.Context) *PostsInsertCall {\r\n\tc.ctx_ = ctx\r\n\treturn c\r\n}", "title": "" }, { "docid": "bce58a21fd7115d211672c0cae9ae842", "score": "0.6113392", "text": "func (r *Request) Context(ctx context.Context) *Request {\n r.context = ctx\n return r\n}", "title": "" }, { "docid": "062164189e80d82f008cc36cc8d03ed1", "score": "0.61099017", "text": "func (c *BiddersFinalizedDealsListCall) Context(ctx context.Context) *BiddersFinalizedDealsListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "c71214a8bee4e82e9d125a1242009e80", "score": "0.6080824", "text": "func (c *UpstreamInsertCall) Context(ctx context.Context) *UpstreamInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "4111c415323bffdc90731a0f17bf7b63", "score": "0.60767317", "text": "func (c *ClientupdateListCall) Context(ctx context.Context) *ClientupdateListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "322745ab380654f4dee2a209a66e6785", "score": "0.6072409", "text": "func (c *EventticketobjectInsertCall) Context(ctx context.Context) *EventticketobjectInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "9e97020f57455222b84b335bd26c9801", "score": "0.60685843", "text": "func (c *LoyaltyobjectInsertCall) Context(ctx context.Context) *LoyaltyobjectInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "5963fde246b8118a6539cee07f4e149f", "score": "0.60613906", "text": "func (c *PostUserInfosListCall) Context(ctx context.Context) *PostUserInfosListCall {\r\n\tc.ctx_ = ctx\r\n\treturn c\r\n}", "title": "" }, { "docid": "b084c78ff2fd9d088c394609daa6fad0", "score": "0.6053621", "text": "func (req *BroadcastRequest) Context(ctx context.Context) *BroadcastRequest {\n\treq.call = req.call.Context(ctx)\n\treturn req\n}", "title": "" }, { "docid": "b7f89474ce00c346f6f6b6204d546b43", "score": "0.604409", "text": "func (c *TransitobjectAddmessageCall) Context(ctx context.Context) *TransitobjectAddmessageCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "58a3d9b1565fdd70f06eff588259f135", "score": "0.6043421", "text": "func (c *SmarttapInsertCall) Context(ctx context.Context) *SmarttapInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "1bcd3762b6115033fcb6256bdab9860e", "score": "0.6043186", "text": "func (c *UsersSettingsSendAsDeleteCall) Context(ctx context.Context) *UsersSettingsSendAsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "91e02a0a1fe85134698ac99af0b008ba", "score": "0.60379016", "text": "func (c *FlightclassInsertCall) Context(ctx context.Context) *FlightclassInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "35eb0505b66ad3d29bc1c5bb3ee2f152", "score": "0.603726", "text": "func (c *BuyersFinalizedDealsSetReadyToServeCall) Context(ctx context.Context) *BuyersFinalizedDealsSetReadyToServeCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "e6202d5c15c5eb38acaa5b092d372889", "score": "0.60301447", "text": "func (c *ServicesDeleteCall) Context(ctx context.Context) *ServicesDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "bbcd0bdd734451a1f7bfa3dc07406875", "score": "0.60289675", "text": "func (c *OfferobjectInsertCall) Context(ctx context.Context) *OfferobjectInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "b7d7534efbe877221661a752fb3ee7a5", "score": "0.6028648", "text": "func (c *MattersUndeleteCall) Context(ctx context.Context) *MattersUndeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "f2078b5e13ae5c6437c343c92e758ecf", "score": "0.60233015", "text": "func (c *TransitobjectInsertCall) Context(ctx context.Context) *TransitobjectInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "5bba541fd898e9b3fadd6215a9374efd", "score": "0.60204536", "text": "func (c *TransitobjectUpdateCall) Context(ctx context.Context) *TransitobjectUpdateCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "2a48fbfb1343b2c11fd4862951c87641", "score": "0.601575", "text": "func (c *GiftcardobjectInsertCall) Context(ctx context.Context) *GiftcardobjectInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "898c532c41a87ce6c2201ca622043425", "score": "0.6003041", "text": "func (c *ChannelInsertCall) Context(ctx context.Context) *ChannelInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "ffdeaa155519c73be85c667526113287", "score": "0.60012025", "text": "func (c *EventticketclassInsertCall) Context(ctx context.Context) *EventticketclassInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "38073f0f7fdf4c5202359cff8262632e", "score": "0.59976125", "text": "func (c *PagesInsertCall) Context(ctx context.Context) *PagesInsertCall {\r\n\tc.ctx_ = ctx\r\n\treturn c\r\n}", "title": "" }, { "docid": "fbc89a9af92a347373591ce63fd1b9a2", "score": "0.599209", "text": "func (c *GroupListCall) Context(ctx context.Context) *GroupListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "4f74c2c939702e32edd18a2dde0a8f24", "score": "0.598907", "text": "func (c *EventticketobjectAddmessageCall) Context(ctx context.Context) *EventticketobjectAddmessageCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "540cd315f8dae7d991934e762f6ba3df", "score": "0.59827703", "text": "func (c *PostsRevertCall) Context(ctx context.Context) *PostsRevertCall {\r\n\tc.ctx_ = ctx\r\n\treturn c\r\n}", "title": "" }, { "docid": "8cc91f9daa0a2ae438bb6ddd6a906a6d", "score": "0.59822804", "text": "func (c *ChannelDeleteCall) Context(ctx context.Context) *ChannelDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "af90b3d1673b4fcdc5e6e01be03dc034", "score": "0.5979399", "text": "func (c *PostsUpdateCall) Context(ctx context.Context) *PostsUpdateCall {\r\n\tc.ctx_ = ctx\r\n\treturn c\r\n}", "title": "" }, { "docid": "c3bb5b6d32a9201aca44ee8221d599e4", "score": "0.59792423", "text": "func (c *BuyersFinalizedDealsListCall) Context(ctx context.Context) *BuyersFinalizedDealsListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "0745041eb393864eb24980c483596cc0", "score": "0.5975713", "text": "func (c *GiftcardobjectUpdateCall) Context(ctx context.Context) *GiftcardobjectUpdateCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "b4b188398bf119a37a1688329e67e096", "score": "0.5973507", "text": "func (c *ClientHistoryCall) Context(ctx context.Context) *ClientHistoryCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "c211722e5ed7b05b740b65bd4f8452e4", "score": "0.59729195", "text": "func (c *EventticketobjectUpdateCall) Context(ctx context.Context) *EventticketobjectUpdateCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "0bd99514a54417b0f6ee7e39d767585d", "score": "0.5971295", "text": "func (c *LinksListCall) Context(ctx context.Context) *LinksListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "db2fb5aacaf1b784998ee8cd0a9977a8", "score": "0.59669274", "text": "func (c *UsersDraftsSendCall) Context(ctx context.Context) *UsersDraftsSendCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "80314dbf808783c9b5f9874fef0d6458", "score": "0.5965824", "text": "func (c *FlightobjectAddmessageCall) Context(ctx context.Context) *FlightobjectAddmessageCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "5bd0cca973e463abb5cb4776b32ac8fb", "score": "0.59657526", "text": "func (c *JwtInsertCall) Context(ctx context.Context) *JwtInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "1e382e9f5862dc8369bd1a65be52161c", "score": "0.5964593", "text": "func (c *LoyaltyclassInsertCall) Context(ctx context.Context) *LoyaltyclassInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "d7d5807f2f054ee2d58f23afedceac61", "score": "0.5962442", "text": "func (c *TransitclassUpdateCall) Context(ctx context.Context) *TransitclassUpdateCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "16f5279354f34e3416473ecd964b05fe", "score": "0.5961249", "text": "func (c *MattersHoldsUpdateCall) Context(ctx context.Context) *MattersHoldsUpdateCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "abc35591bc41c41c1bcd2b56579701f5", "score": "0.59491944", "text": "func (c *EventsListCall) Context(ctx context.Context) *EventsListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "fd3870ff85835f064d899adb6867d372", "score": "0.59468114", "text": "func (c *UpstreamSyncCall) Context(ctx context.Context) *UpstreamSyncCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "457d2209d44bc552c84319799716504f", "score": "0.59414065", "text": "func (c *TransitobjectListCall) Context(ctx context.Context) *TransitobjectListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "e6b043661b50ada3ce2ee3b972afa9e2", "score": "0.59404075", "text": "func (o *DownloadContentUsingGETParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "b023f3a14becb09983464ff520e33bb9", "score": "0.59313416", "text": "func (c *TimeseriesWriteCall) Context(ctx context.Context) *TimeseriesWriteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "2a245d4df1d8ec53c31d6b1bb9e36c2b", "score": "0.5930862", "text": "func (c *MattersHoldsGetCall) Context(ctx context.Context) *MattersHoldsGetCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "b789178e61d208331e15333c189b51ef", "score": "0.5930586", "text": "func (c *ServicesServiceLevelObjectivesDeleteCall) Context(ctx context.Context) *ServicesServiceLevelObjectivesDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "46ad8c05faa24ed609df6c35f823a488", "score": "0.5928433", "text": "func (c *UsersMessagesTrashCall) Context(ctx context.Context) *UsersMessagesTrashCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "c49a627b9529f8e2eb5db705bee67f1d", "score": "0.59255075", "text": "func (c *FlightobjectUpdateCall) Context(ctx context.Context) *FlightobjectUpdateCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "6e16c0912bf3f50c9f0163d1554f59ac", "score": "0.5924655", "text": "func (c *GiftcardclassInsertCall) Context(ctx context.Context) *GiftcardclassInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "774ac1af62f2d4e80fb0626d12836e7d", "score": "0.5924623", "text": "func (c *PagesListCall) Context(ctx context.Context) *PagesListCall {\r\n\tc.ctx_ = ctx\r\n\treturn c\r\n}", "title": "" }, { "docid": "828d5a2eb12e58367c5b1e6c3f526dc0", "score": "0.5923611", "text": "func (c *BuyersFinalizedDealsGetCall) Context(ctx context.Context) *BuyersFinalizedDealsGetCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "b4465908946b6afb42fec06423e80625", "score": "0.5923387", "text": "func (c *OfferclassInsertCall) Context(ctx context.Context) *OfferclassInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "c3d763d477ac952c901deac79e917d81", "score": "0.5915051", "text": "func (c *TablesRowsBatchDeleteCall) Context(ctx context.Context) *TablesRowsBatchDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "3717d12946fe871986efa2f7d3d2a3a3", "score": "0.5914754", "text": "func (c *TransitclassAddmessageCall) Context(ctx context.Context) *TransitclassAddmessageCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "a23b9fc175136853ca2139352b138c94", "score": "0.5910952", "text": "func (c *LoyaltyobjectAddmessageCall) Context(ctx context.Context) *LoyaltyobjectAddmessageCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "d7b913048cd3a3532036021561ba0cd1", "score": "0.5909827", "text": "func (c *EventticketobjectListCall) Context(ctx context.Context) *EventticketobjectListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "217616c34f6b813320d6fbae0a539272", "score": "0.5906502", "text": "func (c *GiftcardobjectListCall) Context(ctx context.Context) *GiftcardobjectListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "dae72c7ea46ff050bff3593879bd2b37", "score": "0.5903494", "text": "func (c *BuyersFinalizedDealsPauseCall) Context(ctx context.Context) *BuyersFinalizedDealsPauseCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "2868b729b9a54f6be8000025e462b5fc", "score": "0.59006447", "text": "func (c *ProjectsAttestorsDeleteCall) Context(ctx context.Context) *ProjectsAttestorsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "7598dc5a4c9d840c96c5ca5d37261ce5", "score": "0.5900244", "text": "func (c *MattersCloseCall) Context(ctx context.Context) *MattersCloseCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "376938829a99d069f5cfba26f527df3a", "score": "0.5899467", "text": "func (c *EventticketclassUpdateCall) Context(ctx context.Context) *EventticketclassUpdateCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "43c88e41d7d80be828637baecde5aa5e", "score": "0.589937", "text": "func (c *TransitclassInsertCall) Context(ctx context.Context) *TransitclassInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "3877343199898bfa3a90e75781bec9c3", "score": "0.5899064", "text": "func (c *PostsGetCall) Context(ctx context.Context) *PostsGetCall {\r\n\tc.ctx_ = ctx\r\n\treturn c\r\n}", "title": "" }, { "docid": "c6518f1771a09dcecb53353fb8a4d2c4", "score": "0.5897419", "text": "func (c *FlightclassUpdateCall) Context(ctx context.Context) *FlightclassUpdateCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "97c925e4b87941b97f00818fdf109696", "score": "0.5896242", "text": "func (c *GiftcardobjectAddmessageCall) Context(ctx context.Context) *GiftcardobjectAddmessageCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "ff3685e715055122c0a8dbfd5e1142ad", "score": "0.589038", "text": "func (c *LoyaltyobjectUpdateCall) Context(ctx context.Context) *LoyaltyobjectUpdateCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "942cf66d2ec6558952ee912f466b8370", "score": "0.5890055", "text": "func (c *GroupDeleteCall) Context(ctx context.Context) *GroupDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "954d5f21e13dd2d968d258dd3da7027f", "score": "0.5889441", "text": "func (c *MattersSavedQueriesDeleteCall) Context(ctx context.Context) *MattersSavedQueriesDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "8bef226a6d3356355ff1b26fb7d72db8", "score": "0.5888701", "text": "func (c *MattersHoldsAccountsListCall) Context(ctx context.Context) *MattersHoldsAccountsListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "06040cc970e37043c400674341220c28", "score": "0.5888204", "text": "func (c *EventticketclassAddmessageCall) Context(ctx context.Context) *EventticketclassAddmessageCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "79e50001549506ae58502859c8e562a9", "score": "0.588715", "text": "func (c *AccountsListCall) Context(ctx context.Context) *AccountsListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "410a34e0f9243f8136f5022e25391cc1", "score": "0.58857495", "text": "func (c *ChannelPublicListCall) Context(ctx context.Context) *ChannelPublicListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "34518bef01ad8a75ddc747e77e7317e4", "score": "0.5883683", "text": "func (c *FlightclassAddmessageCall) Context(ctx context.Context) *FlightclassAddmessageCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "89a30f90667531f3af04a0f6b5527ade", "score": "0.5883392", "text": "func (c *OfferobjectAddmessageCall) Context(ctx context.Context) *OfferobjectAddmessageCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "b10473275ff2917097bcf0b9527d15a1", "score": "0.5882005", "text": "func (r *DeleteApplicationsReq) Context(ctx context.Context) *DeleteApplicationsReq {\n\tr.req.ctx = ctx\n\treturn r\n}", "title": "" }, { "docid": "c192dba9c2c5e4a05ed07a547164993c", "score": "0.5880621", "text": "func (req InsertObjectManyRequest) Context(ctx context.Context) InsertObjectManyRequest {\n\treq.impl = req.impl.Context(ctx)\n\n\treturn req\n}", "title": "" }, { "docid": "ba9443f6f7ef716c03a63cbfb9231ca9", "score": "0.58794886", "text": "func (c *AppDeleteCall) Context(ctx context.Context) *AppDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "81b02ceb954a9fab50462d11b73e0e1f", "score": "0.5878181", "text": "func (c *AccessPoliciesDeleteCall) Context(ctx context.Context) *AccessPoliciesDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "1c5eeda708172e5a26963e14ef15aace", "score": "0.5876273", "text": "func (c *UsersDraftsDeleteCall) Context(ctx context.Context) *UsersDraftsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "49ef1af65c8f777f844093ed758544d8", "score": "0.58752716", "text": "func (c *TransitobjectPatchCall) Context(ctx context.Context) *TransitobjectPatchCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "6ad28dc47869e949fc5e69de7c9decfe", "score": "0.58704734", "text": "func (c *OfferobjectListCall) Context(ctx context.Context) *OfferobjectListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "d80aedd9c81112b628cb519e999b740c", "score": "0.58702946", "text": "func (c *IssuerInsertCall) Context(ctx context.Context) *IssuerInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "568c7e5446b27104f85c8d4986b12474", "score": "0.5867321", "text": "func (c *MattersHoldsCreateCall) Context(ctx context.Context) *MattersHoldsCreateCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "6b3e1d4e4197eb26a7fd29a01e5aa7d5", "score": "0.5866072", "text": "func (c *MattersHoldsAccountsDeleteCall) Context(ctx context.Context) *MattersHoldsAccountsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "1e02aff56e653c7c8ad6d15fb2159634", "score": "0.586529", "text": "func (r *DeveloperDeleteReq) Context(ctx context.Context) *DeveloperDeleteReq {\n\tr.req.ctx = ctx\n\treturn r\n}", "title": "" }, { "docid": "880626addebea770fbeb89eb4ae5f1a9", "score": "0.5864055", "text": "func (c *ZoneOperationsDeleteCall) Context(ctx context.Context) *ZoneOperationsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "fd6a20deb9b316786f1024df4551a826", "score": "0.58623374", "text": "func (o *GetSubcriptionForMetroUsingGETParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "743760d11345cfecc41c26e2bf6cebd4", "score": "0.5856122", "text": "func (r *UpdateApplicationReq) Context(ctx context.Context) *UpdateApplicationReq {\n\tr.req.ctx = ctx\n\treturn r\n}", "title": "" }, { "docid": "1d3204aaa0fe9e1168ca5cf9427d21e2", "score": "0.5854988", "text": "func (c *LoyaltyobjectListCall) Context(ctx context.Context) *LoyaltyobjectListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" } ]
d47701c6cc7ddb0c4ea4574df7f2dcd2
Initialize initializes the global store It will skip initialization if the store has already been initialized once
[ { "docid": "efeceacd67cbed1a9c2c4349d69e12a8", "score": "0.75291", "text": "func Initialize() {\n\tif globalStore == nil {\n\t\tglobalStore = newThreadSafeStore()\n\t}\n}", "title": "" } ]
[ { "docid": "96c721a278b4bb87fd7dbfc38c7e1e78", "score": "0.8026826", "text": "func InitStore(s Store) {\n\tstore = s\n}", "title": "" }, { "docid": "96c721a278b4bb87fd7dbfc38c7e1e78", "score": "0.8026826", "text": "func InitStore(s Store) {\n\tstore = s\n}", "title": "" }, { "docid": "96c721a278b4bb87fd7dbfc38c7e1e78", "score": "0.8026826", "text": "func InitStore(s Store) {\n\tstore = s\n}", "title": "" }, { "docid": "d4e828d768b411e9d11069dca9a66425", "score": "0.73844", "text": "func InitStore(s KVStore) {\n\tdbConn = s\n\tscheduleCleanup(s)\n}", "title": "" }, { "docid": "b97bacf0a01da991c467cc7051ca8cbe", "score": "0.73481625", "text": "func Init(ctx context.Context, config *types.Config) {\n\tonce.Do(func() {\n\t\tvar err error\n\t\tcoreStore, err = New(ctx, config)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"[Init] failed to create core store, err: %v\", err)\n\t\t\treturn\n\t\t}\n\t})\n}", "title": "" }, { "docid": "b8012e193da4c37bc36d546345f3ec40", "score": "0.7275262", "text": "func InitStore() *Store {\n\tself := &Store{\n\t\tItems: make(map[string][][]byte),\n\t\tMarked: make(map[string]int64),\n\t}\n\tgo self.runGC(GC_RATE)\n\treturn self\n}", "title": "" }, { "docid": "c5f29288bc2c7d40373f470a3d7bacd8", "score": "0.72610223", "text": "func (sp *StoreProvider) Initialize() {\n\t// Noop by default\n}", "title": "" }, { "docid": "d6a96a87928b089a557230f56acc27a0", "score": "0.72298175", "text": "func InitStore() {\n\tdb, err := storm.Open(config.DatabaseFile)\n\tif err != nil {\n\t\tpanic(xerrors.Errorf(\"Cannot open database: %w\", err))\n\t}\n\tAuth = newAuthStore(db)\n\tComments = newCommentsStore(db)\n\tReviews = newReviewsStore(db)\n}", "title": "" }, { "docid": "08c43e45a470d4cc4cf4c553536391d1", "score": "0.6982602", "text": "func Init() error {\n\ts, err := newStore()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcached = s\n\treturn nil\n}", "title": "" }, { "docid": "688a0adf8af9ef01da322f1392ab59ca", "score": "0.6950857", "text": "func (s *MongoStore) Initialize() error {\n\treturn nil\n}", "title": "" }, { "docid": "11e078847103833682b4cd665cd3fa7d", "score": "0.69488406", "text": "func InitStore(s StoreInterface) {\n\tDocsStore = s\n}", "title": "" }, { "docid": "a7ac973a8b4656e41d47e8475c878c8d", "score": "0.6841676", "text": "func init() {\n\tstore = cache.NewMemoryCache()\n}", "title": "" }, { "docid": "e90866bbbc91ecb370e9ebb6a2f3ddba", "score": "0.6829855", "text": "func initStore(logger *logging.Logger, connectionString string) *db.Store {\n\tlogger.Debug(\"Initializing Store\")\n\t// establish a store and connection to the db\n\tstore, err := db.NewStore(connectionString)\n\tif err != nil {\n\t\tsentry.CaptureException(err)\n\t\tlogger.Fatal(\"Failed to initialize store:\" + err.Error())\n\t}\n\tlogger.Debug(\"Store established with database connection\")\n\treturn store\n}", "title": "" }, { "docid": "d6826129ad187ea9eaa3b314195092c4", "score": "0.679354", "text": "func initializeStore(fhandler *flowHandler) (stateSDefined bool, dataSOverride bool, err error) {\n\n\tstateSDefined = false\n\tdataSOverride = false\n\n\t// Initialize the stateS\n\tstateS, err := function.DefineStateStore()\n\tif err != nil {\n\t\treturn\n\t}\n\tif stateS != nil {\n\t\tfhandler.stateStore = stateS\n\t\tstateSDefined = true\n\t\tfhandler.stateStore.Configure(flowName, fhandler.id)\n\t\t// If request is not partial initialize the stateStore\n\t\tif !fhandler.partial {\n\t\t\terr = fhandler.stateStore.Init()\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\t// Initialize the dataS\n\tdataS, err := function.DefineDataStore()\n\tif err != nil {\n\t\treturn\n\t}\n\tif dataS != nil {\n\t\tfhandler.dataStore = dataS\n\t\tdataSOverride = true\n\t}\n\tfhandler.dataStore.Configure(flowName, fhandler.id)\n\t// If request is not partial initialize the dataStore\n\tif !fhandler.partial {\n\t\terr = fhandler.dataStore.Init()\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "2e499028fcf481eca80e03df0531d30b", "score": "0.67081493", "text": "func (engine *Engine) InitStore() {\n\tengine.storeIndexDocChans = make(\n\t\t[]chan storeIndexDocReq, engine.initOptions.StoreShards)\n\n\tfor shard := 0; shard < engine.initOptions.StoreShards; shard++ {\n\t\tengine.storeIndexDocChans[shard] = make(\n\t\t\tchan storeIndexDocReq)\n\t}\n\tengine.storeInitChan = make(\n\t\tchan bool, engine.initOptions.StoreShards)\n}", "title": "" }, { "docid": "2c458e87c0de013069c187b33f4dad79", "score": "0.6690711", "text": "func (backend *ESClient) InitializeStore(ctx context.Context) {\n\tlogrus.Info(\"Initialize elastic with mappings\")\n\tif !backend.initialized {\n\t\tfor _, esMap := range mappings.AllMappings {\n\t\t\tbackend.CreateTemplate(ctx, esMap.Index, esMap.Mapping)\n\t\t\tif !esMap.Timeseries {\n\t\t\t\tbackend.createStoreIfNotExists(ctx, esMap.Index, esMap.Mapping)\n\t\t\t\tbackend.createStoreAliasIfNotExists(ctx, esMap.Alias, esMap.Index)\n\t\t\t}\n\t\t}\n\t}\n\tbackend.initialized = true\n}", "title": "" }, { "docid": "dac607131888cf38fd6356b01019fb4a", "score": "0.65872675", "text": "func (ctx *Context) InitializeStores() error {\n\tvar err error\n\tctx.stores = make(map[string]*CoreStores)\n\tfor _, store := range ctx.config.Stores {\n\t\t// Initialize primary in memory store\n\t\tlog.Printf(\"Initializing Primary InMemoryStore %s\\n\", store.Name)\n\t\tnewstore := &CoreStores{}\n\t\tvar localerr error\n\t\tif newstore.primary, localerr = createStore(\"InMemory\", \"\"); localerr != nil {\n\t\t\terr = localerr\n\t\t}\n\t\t// Initialize backup store if defined\n\t\tif len(store.Backup) > 0 {\n\t\t\tlog.Printf(\"Initializing Backup Store %s of type %s, backup directory %s\\n\", store.Name, store.Backup, store.Backupdir)\n\t\t\tvar localerr error\n\t\t\tif newstore.backup, localerr = createStore(store.Backup, store.Backupdir); localerr != nil {\n\t\t\t\terr = localerr\n\t\t\t} else {\n\t\t\t\t// Once initialized we need to restore the primary store from backup store\n\t\t\t\tjsStore, serr := core.SerializeStore(newstore.backup)\n\t\t\t\tif serr != nil {\n\t\t\t\t\terr = serr\n\t\t\t\t} else {\n\t\t\t\t\tif dserr := core.DeSerializeStore(newstore.primary, jsStore); dserr != nil {\n\t\t\t\t\t\terr = dserr\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif len(store.AggregateURLs) > 0 {\n\t\t\tnewstore.shutdown = make(chan bool)\n\t\t\tgo ctx.SyncAggregateURLs(newstore, store.AggregateURLs, time.Duration(store.SyncIntervalSec)*time.Second)\n\t\t}\n\t\tctx.stores[store.Name] = newstore\n\t}\n\treturn err\n}", "title": "" }, { "docid": "af4f70035502336f5b2fccae7115b6f6", "score": "0.65332836", "text": "func InitOsStore() error {\n\tif err := context.InitKeyring(viper.GetString(\"openstack.user\"), viper.GetString(\"openstack.password\"), viper.GetString(\"openstack.tenant.name\"), viper.GetString(\"openstack.authurl\"), viper.GetString(\"openstack.tenant.id\"), viper.GetString(\"openstack.region\")); err != nil {\n\t\treturn err\n\t}\n\n\tif err := identity.DoAuth(); err != nil {\n\t\treturn err\n\t}\n\n\t// auto update Token each 30 minutes\n\tlogger := log.New(logger.Log.Writer(), \"osstore\", 0)\n\tStore = Storer(OsStore{})\n\t///store = &storee\n\tidentity.AutoUpdate(30, logger)\n\treturn nil\n}", "title": "" }, { "docid": "1d836a76e02d9b54fde0ecba73e2a32e", "score": "0.6527466", "text": "func Init(db *badger.DB) *Store {\n\treturn &Store{db: db}\n}", "title": "" }, { "docid": "beafc4c0e24409b3a68d5b135dc72d61", "score": "0.64492285", "text": "func (b *Broker) Init() error {\n\tif err := b.store.Init(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4403dc71576bce30398c4469d4dd88da", "score": "0.6392498", "text": "func (s *Store) Init(option Option) error {\n\treturn option.ApplyTo(s)\n}", "title": "" }, { "docid": "660f521647bf6bc7a7b0f61489cdad26", "score": "0.6364699", "text": "func Init(ctx context.Context, alias, path string) (*Store, error) {\n\tdebug.Log(\"Initializing %s at %s\", alias, path)\n\n\ts := &Store{\n\t\talias: alias,\n\t\tpath: path,\n\t}\n\n\tst, err := backend.InitStorage(ctx, backend.GetStorageBackend(ctx), path)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to initialize storage for %s at %s: %w\", alias, path, err)\n\t}\n\n\ts.storage = st\n\tdebug.Log(\"Storage for %s => %s initialized as %s\", alias, path, st.Name())\n\n\tcrypto, err := backend.NewCrypto(ctx, backend.GetCryptoBackend(ctx))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to initialize crypto for %s at %s: %w\", alias, path, err)\n\t}\n\n\ts.crypto = crypto\n\tdebug.Log(\"Crypto for %q => %q initialized as %s\", alias, path, crypto.Name())\n\n\treturn s, nil\n}", "title": "" }, { "docid": "9246659a3b933dcd7be5eacd87676aa4", "score": "0.63582164", "text": "func (b *BadgerStore) init(dir string) error {\n\n\topts := badger.DefaultOptions(dir)\n\tif dir == \"\" {\n\t\topts = opts.WithInMemory(true)\n\t}\n\topts.Logger = &common.NoopLogger{}\n\tdb, err := badger.Open(opts)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to open database\")\n\t}\n\n\t// Set the database\n\tb.db = db\n\n\t// Initialize the default transaction that auto commits\n\t// on success ops or discards on failure.\n\t// It also enables the renewal of the underlying transaction\n\t// after executing a read/write operation\n\tb.Tx = NewTx(db, true, true)\n\n\treturn nil\n}", "title": "" }, { "docid": "c7e22ef453f0cfc779b6574408247dd5", "score": "0.63369876", "text": "func (s *Store) Init(sessionID []byte, defaultExpiration time.Duration) {\n\ts.sessionID = sessionID\n\ts.defaultExpiration = defaultExpiration\n\n\tif s.data == nil { // Ensure the store always has a valid pointer of Dict\n\t\ts.data = new(Dict)\n\t}\n}", "title": "" }, { "docid": "2b76bf30bd54240d93231552cabae554", "score": "0.62810016", "text": "func (self *MessageStore) Init() {\n\tself.in = make(map[string]*MsgEntry)\n\tself.out = make(map[string]*MsgEntry)\n}", "title": "" }, { "docid": "fb9ec97cd12c6a0c07b7439925bb3e20", "score": "0.6269691", "text": "func initConfigStore(ctx context.Context, name string) error {\n\t//override default store name\n\tif name != \"\" {\n\t\tstoreName = name\n\t}\n\n\tlogger := logging.FromContext(ctx)\n\tlogger.Info(\"Initializing ConfigStore...\")\n\n\terr := loadConfigMapData(ctx)\n\tswitch {\n\tcase err == nil:\n\t\tlogger.Info(\"Config loaded succsesfully\")\n\tcase apierrors.IsNotFound(err):\n\t\tif err := createEmptyConfigMapData(ctx); err != nil {\n\t\t\tlogger.Error(\"Failed to create empty configmap\", zap.Error(err))\n\t\t\treturn err\n\t\t}\n\tdefault:\n\t\tlogger.Error(\"Failed to load configmap data:\", zap.Error(err))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9dbebb59435d54ca6c8d5fb1ada2325c", "score": "0.6263329", "text": "func Initialize() {\n\tinitializeOnce.Do(initialize)\n}", "title": "" }, { "docid": "1fbbfeef78110c50db8571bd64dafb74", "score": "0.62330025", "text": "func init() {\n\tMemory = &memoryStorage{\n\t\ttraces: make(map[string]tracer.Trace),\n\t\tservices: make(map[string]string),\n\t\tserviceDeps: make(map[string]*tracer.Dependencies),\n\t}\n}", "title": "" }, { "docid": "feaa22d60ec18d55b09a7fc35ceb201e", "score": "0.62320495", "text": "func (s *Store) Init(ctx context.Context, metadataRaw secretstores.Metadata) error {\n\tmetadata, err := s.parseSecretManagerMetadata(metadataRaw)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tclient, err := s.getClient(ctx, metadata)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to setup secretmanager client: %s\", err)\n\t}\n\n\ts.client = client\n\ts.ProjectID = metadata.ProjectID\n\n\treturn nil\n}", "title": "" }, { "docid": "de1413a01238173c3fe92a9577a52c1c", "score": "0.6165836", "text": "func (s *fsStore) Init(kinds []string) error {\n\tfor _, k := range kinds {\n\t\ts.kinds[k] = true\n\t}\n\ts.checkAndUpdate()\n\tgo func() {\n\t\ttick := time.NewTicker(s.checkDuration)\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-s.donec:\n\t\t\t\ttick.Stop()\n\t\t\t\treturn\n\t\t\tcase <-tick.C:\n\t\t\t\ts.checkAndUpdate()\n\t\t\t}\n\t\t}\n\t}()\n\treturn nil\n}", "title": "" }, { "docid": "b498f14b19f309c3a45c808b7a5f0466", "score": "0.6150039", "text": "func Initialize(cfg config.WebConfig, ds *data.DataStore) {\n\twebConfig = cfg\n\tsetupWebSocket(cfg, ds)\n\tsetupRoutes(cfg)\n\n\t// NewContext() will use this DataStore for the web handlers\n\tDataStore = ds\n\tsessionStore = sessions.NewCookieStore([]byte(cfg.CookieSecret))\n}", "title": "" }, { "docid": "8616aa13bc22e3b1b0d30562f221ac3c", "score": "0.6144572", "text": "func (rs *redisStore)InitStore(sc storeConfig) error{\n\n\tvar addr, password string\n\tvar poolsize, dbnum int\n\n\tconfigs := strings.Split(sc.extraConfig, \",\")\n\tif len(configs) > 0 {\n\t\taddr = configs[0]\n\t}\n\tif len(configs) > 1 {\n\t\tpoolsize, err := strconv.Atoi(configs[1])\n\t\tif err != nil || poolsize < 0 {\n\t\t\tpoolsize = MaxPoolSize\n\t\t}\n\t} else {\n\t\tpoolsize = MaxPoolSize\n\t}\n\tif len(configs) > 2 {\n\t\tpassword = configs[2]\n\t}\n\tif len(configs) > 3 {\n\t\tdbnum, err := strconv.Atoi(configs[3])\n\t\tif err != nil || dbnum < 0 {\n\t\t\tdbnum = 0\n\t\t}\n\t} else {\n\t\tdbnum = 0\n\t}\n\n\tpool := &redis.Pool{\n\t\tMaxIdle:poolsize,\n\t\tDial:func() (redis.Conn, error) {\n\t\t\tc, err := redis.Dial(\"tcp\", addr)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif password != \"\" {\n\t\t\t\tif _, err = c.Do(\"AUTH\", password); err != nil {\n\t\t\t\t\tc.Close()\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\t\t\t_, err = c.Do(\"SELECT\", dbnum)\n\t\t\tif err != nil {\n\t\t\t\tc.Close()\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn c, err\n\t\t},\n\t}\n\trs.p = pool\n\trs.expire = sc.expire\n\treturn rs.p.Get().Err()\n}", "title": "" }, { "docid": "94c70972376a015cbe13c637fb5a2e4d", "score": "0.6120877", "text": "func InitializeAll() {\n\tcs, err := framework.NewConfigStore(Constants.ComponentName)\n\tif err != nil {\n\t\tlog.Error(\"Panic while setting up config store: \" + err.Error())\n\t\tpanic(err)\n\t}\n\terr = cs.SetupEnvironmentFromSSM()\n\tif err != nil {\n\t\tlog.Error(\"Panic pulling from SSM: \" + err.Error())\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "390c9ae91eaa9db70c79fb0a7d8037fe", "score": "0.61198586", "text": "func (store *Store) SysInit(app *ecomapp.Application) {\n}", "title": "" }, { "docid": "b2e901fa3862fb0d0a287519d6fad174", "score": "0.6118817", "text": "func init() {\n\t// TODO: set logger\n\t// TODO: register storage plugin to plugin manager\n}", "title": "" }, { "docid": "ad5e12445dbba32460328d4bbb501392", "score": "0.6111653", "text": "func (store *Store) Init(app *ecomapp.Application) {\n\t// app.URIHandler.AddURI(\"/cart\", store.Cart)\n\tapp.URIHandler.AddURI(\"/__addtocart\", store.AddToCart)\n\tapp.URIHandler.AddURI(\"/__removefromcart\", store.RemoveFromCart)\n\tapp.URIHandler.AddURI(\"/__emptycart\", store.EmptyCart)\n\n\t// Add base data\n\tapp.ListenToHook(\"ROUTER_WILDCARD\", store.AddBaseData)\n\n\t// Load seourl's from product\n\tproductCollection := app.DB.Client.Database(\"shop\").Collection(\"product\")\n\tproductCursor, productErr := productCollection.Find(context.TODO(), bson.M{})\n\tif productErr == nil {\n\t\tfor productCursor.Next(context.TODO()) {\n\t\t\tvar seourl SEOURL\n\t\t\tproductCursor.Decode(&seourl)\n\t\t\tif len(seourl.SEOURL) > 0 {\n\t\t\t\tapp.URIHandler.AddURI(seourl.SEOURL, store.HandleProduct)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Load seourl's from category\n\tcategoryCollection := app.DB.Client.Database(\"shop\").Collection(\"category\")\n\tcategoryCursor, categoryErr := categoryCollection.Find(context.TODO(), bson.M{})\n\tif categoryErr == nil {\n\t\tfor categoryCursor.Next(context.TODO()) {\n\t\t\tvar seourl SEOURL\n\t\t\tcategoryCursor.Decode(&seourl)\n\t\t\tif len(seourl.SEOURL) > 0 {\n\t\t\t\tapp.URIHandler.AddURI(seourl.SEOURL, store.HandleCategory)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Load seourl's from brand\n\tbrandCollection := app.DB.Client.Database(\"shop\").Collection(\"brand\")\n\tbrandCursor, brandErr := brandCollection.Find(context.TODO(), bson.M{})\n\tif brandErr == nil {\n\t\tfor brandCursor.Next(context.TODO()) {\n\t\t\tvar seourl SEOURL\n\t\t\tbrandCursor.Decode(&seourl)\n\t\t\tif len(seourl.SEOURL) > 0 {\n\t\t\t\tapp.URIHandler.AddURI(seourl.SEOURL, store.HandleBrand)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "991dacb866a3c0ce1185d5965678cf31", "score": "0.6110036", "text": "func InitRedisStore(conf *viper.Viper) {\n\tpool := &redis.Pool{\n\t\tMaxIdle: 10,\n\t\tDial: func() (redis.Conn, error) {\n\t\t\treturn redis.Dial(\n\t\t\t\t\"tcp\",\n\t\t\t\tconf.GetString(\"redis.address\"),\n\t\t\t\tredis.DialPassword(conf.GetString(\"redis.password\")),\n\t\t\t)\n\t\t},\n\t}\n\tredisStore = &RedisStore{pool}\n}", "title": "" }, { "docid": "415e0c487febbcf8940267fee31bb6a5", "score": "0.6106019", "text": "func Init() error {\n\tmutex.Lock()\n\tdefer mutex.Unlock()\n\n\tif !isInitialized {\n\t\tvar e error\n\t\textDB = make(map[string]string)\n\n\t\tif !isInitialized {\n\t\t\te = loadDB()\n\t\t}\n\t\tisInitialized = true\n\t\treturn e\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "53200cee6a6dbd3e85d85493218e39cb", "score": "0.6105695", "text": "func (c *StateStore) Init(metadata state.Metadata) error {\n\tconnInfo := metadata.Properties\n\tb, err := json.Marshal(connInfo)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar creds credentials\n\terr = json.Unmarshal(b, &creds)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tclient := documentdb.New(creds.URL, &documentdb.Config{\n\t\tMasterKey: &documentdb.Key{\n\t\t\tKey: creds.MasterKey,\n\t\t},\n\t})\n\n\tdbs, err := client.QueryDatabases(&documentdb.Query{\n\t\tQuery: fmt.Sprintf(\"SELECT * FROM ROOT r WHERE r.id='%s'\", creds.Database),\n\t})\n\tif err != nil {\n\t\treturn err\n\t} else if len(dbs) == 0 {\n\t\treturn fmt.Errorf(\"Database %s for CosmosDB state store not found\", creds.Database)\n\t}\n\n\tc.db = &dbs[0]\n\tcolls, err := client.QueryCollections(c.db.Self, &documentdb.Query{\n\t\tQuery: fmt.Sprintf(\"SELECT * FROM ROOT r WHERE r.id='%s'\", creds.Collection),\n\t})\n\tif err != nil {\n\t\treturn err\n\t} else if len(colls) == 0 {\n\t\treturn fmt.Errorf(\"Collection %s for CosmosDB state store not found\", creds.Collection)\n\t}\n\n\tc.collection = &colls[0]\n\tc.client = client\n\n\treturn nil\n}", "title": "" }, { "docid": "4491ff4eb00ed4b4236c3c905a56ea21", "score": "0.61050874", "text": "func (a *App) initStore(host, port string) {}", "title": "" }, { "docid": "cd0556d683bc7bfa56c55fbd392fd1e2", "score": "0.61031497", "text": "func (c *pvtDataStore) Init(btlPolicy pvtdatapolicy.BTLPolicy) {\n\tc.cachePvtDataStore.Init(btlPolicy)\n\tc.pvtDataDBStore.Init(btlPolicy)\n}", "title": "" }, { "docid": "418956a6632c2b1c34f028969245f4f1", "score": "0.60827273", "text": "func Init() {\n\tonce.Do(initialize)\n}", "title": "" }, { "docid": "49218e3d2873323cdeb4a9d3ca1d1796", "score": "0.6079982", "text": "func (s *InMemoryHandler) Init() error {\n\ts.logger = log.WithFields(log.Fields{\"app\": \"inmemory-db\"})\n\ts.functions = make(map[string]model.FunctionConfig)\n\treturn nil\n}", "title": "" }, { "docid": "a7e7f4b69647ae7ad973752a0830694a", "score": "0.60249597", "text": "func (app *BaseApp) initFromStore() error {\n\tapp.setCheckState(abci.Header{})\n\tapp.Seal()\n\treturn nil\n}", "title": "" }, { "docid": "8809dfce51753abf5f8daa2671a113ae", "score": "0.60235155", "text": "func (e *ExternalServiceStore) ensureStore() {\n\te.mu.Lock()\n\tdefer e.mu.Unlock()\n\n\tif e.Store == nil {\n\t\te.Store = basestore.NewWithDB(dbconn.Global, sql.TxOptions{})\n\t}\n}", "title": "" }, { "docid": "c410b34ff6180525ef0fb8972c0cf019", "score": "0.60221", "text": "func (n *Node) InitStableStore() {\n\tn.StoreLog(&LogEntry{\n\t\tIndex: 0,\n\t\tTermId: 0,\n\t\tType: CommandType_NOOP,\n\t\tData: []byte{},\n\t})\n}", "title": "" }, { "docid": "4cb8602fe843acf248628ab22d79f214", "score": "0.60217154", "text": "func (store *DynamoDBFeatureStore) Init(allData map[ld.VersionedDataKind]map[string]ld.VersionedData) error {\n\t// FIXME: deleting all items before storing new ones is racy, or isn't it?\n\tif err := store.truncateTable(); err != nil {\n\t\tstore.Logger.Printf(\"ERROR: Failed to truncate table: %s\", err)\n\t\treturn err\n\t}\n\n\tvar requests []*dynamodb.WriteRequest\n\n\tfor kind, items := range allData {\n\t\tfor k, v := range items {\n\t\t\tav, err := marshalItem(kind, v)\n\t\t\tif err != nil {\n\t\t\t\tstore.Logger.Printf(\"ERROR: Failed to marshal item (key=%s): %s\", k, err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\trequests = append(requests, &dynamodb.WriteRequest{\n\t\t\t\tPutRequest: &dynamodb.PutRequest{Item: av},\n\t\t\t})\n\t\t}\n\t}\n\n\tif err := store.batchWriteRequests(requests); err != nil {\n\t\tstore.Logger.Printf(\"ERROR: Failed to write %d item(s) in batches: %s\", len(requests), err)\n\t\treturn err\n\t}\n\n\tstore.Logger.Printf(\"INFO: Initialized table %q with %d item(s)\", store.Table, len(requests))\n\n\tstore.initialized = true\n\n\treturn nil\n}", "title": "" }, { "docid": "6a009fe2b75d4dbe8462c3456563176f", "score": "0.5995397", "text": "func InitStore(username string, password string, migrationDir string) error{\r\n\t//Connect to database\r\n\tdbURL := fmt.Sprint(username, \":\", password, \"@tcp(localhost:3306)/indecision\")\r\n\tdb, err := sql.Open(\"mysql\", dbURL)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\terr = db.Ping()\r\n\tif err != nil {\r\n\t\treturn err\r\n\t} else {\r\n\t\tfmt.Println(\"Successfully connected\")\r\n\t}\r\n\t\t//database migrations\r\n\tdriver, err := mysql.WithInstance(db, &mysql.Config{})\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tm, err := migrate.NewWithDatabaseInstance(\r\n\t\tfmt.Sprintf(\"file://%s\", migrationDir), // file://path/to/directory\r\n\t\t\"mysql\", driver)\r\n\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tif err := m.Up(); err != nil && err != migrate.ErrNoChange {\r\n\t\treturn err\r\n\t}\r\n\r\n\tfmt.Println(\"Database migrated\")\r\n\tstore = &dbStore{db: db}\r\n\treturn nil\r\n}", "title": "" }, { "docid": "f81249e46353b07b772cd759596e85a7", "score": "0.599506", "text": "func (f *Factory) Initialize(metricsFactory metrics.Factory, logger *zap.Logger) error {\n\tf.metricsFactory, f.logger = metricsFactory, logger\n\tf.store = WithConfiguration(f.options.Configuration)\n\tlogger.Info(fmt.Sprintf(\"Connected to all the SQLite DBs in path %s\", f.store.db_path))\n\tlogger.Info(fmt.Sprintf(\"Using LRU cache of size: %d\", f.store.cache_size))\n\treturn nil\n}", "title": "" }, { "docid": "c24745292dacdcc271ec46b96fe2a0d4", "score": "0.5970583", "text": "func (app *App) Initialize() error {\n\tapp.store = db.StoreInstance\n\n\tif err := app.store.CreateTable(db.Things{}); err != nil {\n\t\treturn err\n\t}\n\tlog.Debugf(\"table %s has been created successfully\", db.Things{})\n\n\tif count, err := app.store.ThingsCount(); err == nil && count == 0 {\n\t\tapp.store.ThingsBulkInsert(generateData())\n\t}\n\n\tlog.Info(\"application is ready to run\")\n\treturn nil\n}", "title": "" }, { "docid": "27edbe0badf3611d7cfa75cc31e47f5c", "score": "0.59702754", "text": "func ListStoreInit(treeView *gtk.TreeView) *gtk.ListStore {\n\tlistStore, err := gtk.ListStoreNew(glib.TYPE_STRING, glib.TYPE_STRING, glib.TYPE_STRING)\n\tif err != nil {\n\t\tlog.Fatal(\"Unable to create list store:\", err)\n\t}\n\ttreeView.SetModel(listStore)\n\treturn listStore\n}", "title": "" }, { "docid": "8f8e8f7424246a928a3e26e8701cbd47", "score": "0.5966297", "text": "func InitKVStore(app *PersistentKVStoreApplication) {\n\tapp.InitChain(types.RequestInitChain{\n\t\tValidators: RandVals(1),\n\t})\n}", "title": "" }, { "docid": "95aa7e4ee9d76d49f893538e1fbbd115", "score": "0.5950457", "text": "func (e *SqliteEndorsementStore) Init(args common.EndorsementStoreParams) error {\n\tdbPath := retrieveDbPath(args)\n\tif dbPath == \"\" {\n\t\treturn fmt.Errorf(\"dbPath not specified inside FetcherParams\")\n\t}\n\tdbConfig := fmt.Sprintf(\"file:%s?cache=shared\", dbPath)\n\tdb, err := sql.Open(\"sqlite3\", dbConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te.db = db\n\te.path = dbPath\n\n\te.Queries = map[string]common.Query{\n\t\t\"hardware_id\": e.GetHardwareID,\n\t\t\"software_components\": e.GetSoftwareComponents,\n\t}\n\n\te.Adders = map[string]common.QueryAdder{\n\t\t\"hardware_id\": e.AddHardwareID,\n\t\t\"software_components\": e.AddSoftwareComponents,\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9a6c0b450243391ab60038cd29edd86b", "score": "0.5937101", "text": "func Initialize(cfg *Config) {\n\tinstMu.Lock()\n\tdefer instMu.Unlock()\n\tif initialized {\n\t\treturn\n\t}\n\tswitch cfg.Type {\n\t//case BadgerDB:\n\t//\tinst = badgerdb.New(cfg.BadgerDB)\n\tcase MySQL:\n\t\tinst = sql.New(cfg.MySQL)\n\t//case Memory:\n\t//\tinst = memstorage.New()\n\tdefault:\n\t\t// should not be reached\n\t\tbreak\n\t}\n\tinitialized = true\n}", "title": "" }, { "docid": "7ba6ba4e91fce12b13d56ec6504a4575", "score": "0.59353894", "text": "func (s *Service) Initialize(ctx context.Context) error {\n\treturn s.kv.Update(ctx, func(tx Tx) error {\n\t\tif err := s.initializeAuths(ctx, tx); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.initializeDocuments(ctx, tx); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.initializeBuckets(ctx, tx); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.initializeDashboards(ctx, tx); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.initializeKVLog(ctx, tx); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.initializeLabels(ctx, tx); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.initializeOnboarding(ctx, tx); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.initializeOrgs(ctx, tx); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.initializeTasks(ctx, tx); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.initializePasswords(ctx, tx); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.initializeScraperTargets(ctx, tx); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.initializeSecrets(ctx, tx); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.initializeSessions(ctx, tx); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.initializeSources(ctx, tx); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.initializeTelegraf(ctx, tx); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.initializeURMs(ctx, tx); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.initializeVariables(ctx, tx); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.initializeChecks(ctx, tx); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.initializeNotificationRule(ctx, tx); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.initializeNotificationEndpoint(ctx, tx); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn s.initializeUsers(ctx, tx)\n\t})\n}", "title": "" }, { "docid": "19415d7d2830c5207823c547ecf4bf83", "score": "0.5916331", "text": "func NewStore() *Store {\n\treturn &Store{\n\t\tls: make(map[string]InitFunc),\n\t}\n}", "title": "" }, { "docid": "ef9d656d5cf719823973e3928150cd3e", "score": "0.59019405", "text": "func initAll()", "title": "" }, { "docid": "a3dbfed9f392ca75f15f8e24bc0a924d", "score": "0.5893932", "text": "func (l *Loader) init() {\n\tif l.loading == nil {\n\t\tl.loading = stringset.New(1)\n\t\tl.sources = make(map[string]string, 1)\n\t\tl.symbols = make(map[string]*Struct, 1)\n\t}\n}", "title": "" }, { "docid": "e8f9cd1811535c7d5c41a4be1ff3d03f", "score": "0.58908147", "text": "func (engine *Engine) storeInitWorker(shard int) {\n\tengine.dbs[shard].ForEach(func(k, v []byte) error {\n\t\tkey, value := k, v\n\t\t// 得到 docID\n\t\tdocId, _ := binary.Uvarint(key)\n\n\t\t// 得到 data\n\t\tbuf := bytes.NewReader(value)\n\t\tdec := gob.NewDecoder(buf)\n\t\tvar data types.DocData\n\t\terr := dec.Decode(&data)\n\t\tif err == nil {\n\t\t\t// 添加索引\n\t\t\tengine.internalIndexDoc(docId, data, false)\n\t\t}\n\t\treturn nil\n\t})\n\tengine.storeInitChan <- true\n}", "title": "" }, { "docid": "2e2d551c8cd73935b1705576ca32e827", "score": "0.5888466", "text": "func (m *Mgr) Initialize(ledgerID string, qe ledger.SimpleQueryExecutor) error {\n\t// Noop\n\treturn nil\n}", "title": "" }, { "docid": "e51896a84b9a035cb1797b5ba28b4b37", "score": "0.5880494", "text": "func Initialize() {\n\tkvdbCfg := config.GetKVDB()\n\tif kvdbCfg.Type == \"\" {\n\t\treturn\n\t}\n\n\tgwlog.Infof(\"KVDB initializing, config:\\n%s\", config.DumpPretty(kvdbCfg))\n\tkvdbOpQueue = xnsyncutil.NewSyncQueue()\n\tkvdbTerminated = xnsyncutil.NewOneTimeCond()\n\n\tassureKVDBEngineReady()\n\n\tgo kvdbRoutine()\n}", "title": "" }, { "docid": "e973413e839b0fad65a92673bf3e1671", "score": "0.58791625", "text": "func InitializeStoreHydrate(ctx context.Context) {\n\n\twsDepthHandler := func(event *WsDepthEvent) {\n\t event.CreateImage()\n\t}\n\n\terrHandler := func(err error) {\n\t fmt.Println(err)\n\t}\n\tdoneC, stopC, err := WsDepthServe(\"BNBBTC\", wsDepthHandler, errHandler)\n\tif err != nil {\n\t fmt.Println(err)\n\t return\n\t}\n\n\t// use stopC to exit\n\tgo func() {\n\t time.Sleep(5 * time.Second)\n\t stopC <- struct{}{}\n\t}()\n\t\n\t_ = <-doneC\n\t\n}", "title": "" }, { "docid": "fca2b09455be255721b27ff7c6c7fcb9", "score": "0.5875498", "text": "func init() {\n\tstationsCache = make(map[string]Station)\n}", "title": "" }, { "docid": "171dced1bbb156f6cb5e912c29a66e5b", "score": "0.58565336", "text": "func NewStore(init StoreInit) (s *Store, err error) {\r\n\tvar initialCapacity int\r\n\tif utils.IsSet(init.InitCapacity) {\r\n\t\tinitialCapacity = init.InitCapacity\r\n\t} else {\r\n\t\tinitialCapacity = len(init.Args)\r\n\t}\r\n\r\n\tlocalStore := Store{\r\n\t\tstore: make(map[string]string, initialCapacity),\r\n\t\tparent: init.Parent,\r\n\t}\r\n\r\n\tfor _, arg := range init.Args {\r\n\t\tkey, value, err := splitArgument(arg)\r\n\t\tif err != nil {\r\n\t\t\treturn nil, err\r\n\t\t}\r\n\r\n\t\tif value, err = encode.ConvertStringToUtf8(value); err != nil {\r\n\t\t\treturn nil, fmt.Errorf(\"Error converting value for key '%v' to UTF-8: %v\", key, err)\r\n\t\t}\r\n\r\n\t\tif !localStore.hasKey(key) {\r\n\t\t\tlocalStore.Set(key, value)\r\n\t\t} else {\r\n\t\t\treturn nil, fmt.Errorf(\"Duplicate key '%v' found\", key)\r\n\t\t}\r\n\t}\r\n\r\n\treturn &localStore, nil\r\n}", "title": "" }, { "docid": "2e1a8e533974e42c7bd0c1eb6e33c1c4", "score": "0.5847477", "text": "func (ct *Chronicle) ensureStoresAreInitialized() {\n\tif ct.Parameters == nil {\n\t\tct.Parameters = param.NewStore()\n\t}\n\tif ct.Presets == nil {\n\t\tct.Presets = preset.NewStore()\n\t}\n\tif ct.Canvas == nil {\n\t\tct.Canvas = canvas.NewStore()\n\t}\n\tif ct.Content == nil {\n\t\tct.Content = content.NewListStore()\n\t}\n\tif ct.layoutChildren == nil {\n\t\tct.layoutChildren = make([]*Chronicle, 0)\n\t}\n\tif ct.displayChildren == nil {\n\t\tct.displayChildren = make([]*Chronicle, 0)\n\t}\n}", "title": "" }, { "docid": "869051a28bf4dffdcfe7e2ae413c4f59", "score": "0.5829538", "text": "func (rc *Store) connectInit() error {\n\trc.conn = memcache.New(rc.conninfo...)\n\treturn nil\n}", "title": "" }, { "docid": "4d6b9323af598bc7ecd5b6b8ece780f6", "score": "0.58226186", "text": "func SeedInitialData(store store.Store) (err error) {\n\tinitializer, _ := store.NewInitializer()\n\tlogger := logger.WithField(\"component\", \"backend.seeds\")\n\n\t// Lock initialization key to avoid competing installations\n\tif err := initializer.Lock(); err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\te := initializer.Close()\n\t\tif err == nil {\n\t\t\terr = e\n\t\t}\n\t}()\n\n\t// Initialize the JWT secret. This method is idempotent and needs to be ran\n\t// at every startup so the JWT signatures remain valid\n\tif err := jwt.InitSecret(store); err != nil {\n\t\treturn err\n\t}\n\n\t// Check that the store hasn't already been seeded\n\tif initialized, err := initializer.IsInitialized(); err != nil {\n\t\treturn err\n\t} else if initialized {\n\t\treturn nil\n\t}\n\tlogger.Info(\"seeding etcd store w/ intial data\")\n\n\t// Create the default namespace\n\tif err := setupDefaultNamespace(store); err != nil {\n\t\tlogger.WithError(err).Error(\"unable to setup 'default' namespace\")\n\t\treturn err\n\t}\n\n\t// Create the default users\n\tif err := setupUsers(store); err != nil {\n\t\tlogger.WithError(err).Error(\"could not initialize the default users\")\n\t\treturn err\n\t}\n\n\t// Create the default ClusterRoles\n\tif err := setupClusterRoles(store); err != nil {\n\t\tlogger.WithError(err).Error(\"could not initialize the default ClusterRoles and Roles\")\n\t\treturn err\n\t}\n\n\t// Create the default ClusterRoleBindings\n\tif err := setupClusterRoleBindings(store); err != nil {\n\t\tlogger.WithError(err).Error(\"could not initialize the default ClusterRoles and Roles\")\n\t\treturn err\n\t}\n\n\t// Set initialized flag\n\treturn initializer.FlagAsInitialized()\n}", "title": "" }, { "docid": "9cf1682f9e5ea528b066c9d2f5f35400", "score": "0.58135015", "text": "func init() {\n\tlog.DebugMode = cuxs.IsDebug()\n\tlog.Log = log.New()\n\n\tif e := cuxs.DbSetup(); e != nil {\n\t\tpanic(e)\n\t}\n}", "title": "" }, { "docid": "79283795b252fd7d8b5cf88a88675d96", "score": "0.5812857", "text": "func init() {\n\tInitSystemVariables()\n}", "title": "" }, { "docid": "284b6bd57367f0dd2af5e1f9fb92776a", "score": "0.5793889", "text": "func (engine *Engine) Store() {\n\t// if engine.initOptions.UseStore {\n\terr := os.MkdirAll(engine.initOptions.StoreFolder, 0700)\n\tif err != nil {\n\t\tlog.Fatalf(\"Can not create directory: %s ; %v\",\n\t\t\tengine.initOptions.StoreFolder, err)\n\t}\n\n\t// 打开或者创建数据库\n\tengine.dbs = make([]store.Store, engine.initOptions.StoreShards)\n\tfor shard := 0; shard < engine.initOptions.StoreShards; shard++ {\n\t\tdbPath := engine.initOptions.StoreFolder + \"/\" +\n\t\t\tStoreFilePrefix + \".\" + strconv.Itoa(shard)\n\n\t\tdb, err := store.OpenStore(dbPath, engine.initOptions.StoreEngine)\n\t\tif db == nil || err != nil {\n\t\t\tlog.Fatal(\"Unable to open database \", dbPath, \": \", err)\n\t\t}\n\t\tengine.dbs[shard] = db\n\t}\n\n\t// 从数据库中恢复\n\tfor shard := 0; shard < engine.initOptions.StoreShards; shard++ {\n\t\tgo engine.storeInitWorker(shard)\n\t}\n\n\t// 等待恢复完成\n\tfor shard := 0; shard < engine.initOptions.StoreShards; shard++ {\n\t\t<-engine.storeInitChan\n\t}\n\n\tfor {\n\t\truntime.Gosched()\n\n\t\tengine.loc.RLock()\n\t\tnumDoced := engine.numIndexingReqs == engine.numDocsIndexed\n\t\tengine.loc.RUnlock()\n\n\t\tif numDoced {\n\t\t\tbreak\n\t\t}\n\n\t}\n\n\t// 关闭并重新打开数据库\n\tfor shard := 0; shard < engine.initOptions.StoreShards; shard++ {\n\t\tengine.dbs[shard].Close()\n\t\tdbPath := engine.initOptions.StoreFolder + \"/\" +\n\t\t\tStoreFilePrefix + \".\" + strconv.Itoa(shard)\n\n\t\tdb, err := store.OpenStore(dbPath, engine.initOptions.StoreEngine)\n\t\tif db == nil || err != nil {\n\t\t\tlog.Fatal(\"Unable to open database \", dbPath, \": \", err)\n\t\t}\n\t\tengine.dbs[shard] = db\n\t}\n\n\tfor shard := 0; shard < engine.initOptions.StoreShards; shard++ {\n\t\tgo engine.storeIndexDocWorker(shard)\n\t}\n\t// }\n}", "title": "" }, { "docid": "58c3bf1e75b864fb277abfd9d469c511", "score": "0.5792436", "text": "func (m *Mixtape) init() {\n\tm.Users = []User{}\n\tm.Playlists = []Playlist{}\n\tm.Songs = []Song{}\n}", "title": "" }, { "docid": "632c9e3e0be759e157d2edb5fec61ed3", "score": "0.57735866", "text": "func Init(path string) {\n\tvar err error\n\tStore, err = badgerdb.Open(path, true)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "1e29cba2a06e119c3fe1c117961f71a4", "score": "0.57696474", "text": "func init() {\n\tdrmaa2os.RegisterJobTracker(drmaa2os.SingularitySession, NewAllocator())\n}", "title": "" }, { "docid": "796807b4c12ab485a228fa65681c2d52", "score": "0.57683396", "text": "func initializeGlobalState(c context.Context) {\n\tif info.IsDevAppServer(c) {\n\t\t// Dev app server doesn't preserve the state of task queues across restarts,\n\t\t// need to reset datastore state accordingly, otherwise everything gets stuck.\n\t\tif err := globalEngine.ResetAllJobsOnDevServer(c); err != nil {\n\t\t\tlogging.Errorf(c, \"Failed to reset jobs: %s\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6120e92529c908b3fdfbe589edfd9e0e", "score": "0.57545376", "text": "func (s *CSVStore) Init(config *viper.Viper) {\n\ts.BaseComponent.Init(config)\n\ts.config = &csvStoreConfig{Path: \".\"}\n\tconfig.Unmarshal(s.config)\n\ts.locks = make(map[string]*sync.RWMutex)\n\ts.limit = make(chan bool, runtime.NumCPU())\n\ts.config.Path = os.ExpandEnv(s.config.Path)\n\tos.MkdirAll(s.config.Path, os.ModePerm)\n}", "title": "" }, { "docid": "1ad9e2a1e54f5a5ea6a97060c6752226", "score": "0.5749944", "text": "func (xratesKit *XRatesKit) Init(dbPath string) {\n\n\txratesKit.conf = config.Load()\n\txratesKit.ipfsHandler = &handler.Ipfs{&(xratesKit.conf.Ipfs)}\n\txratesKit.coinPaprika = &handler.CoinPaprika{&xratesKit.conf.CoinPaprika}\n\n\txratesKit.cacheService = &cache.CacheService{DBPath: dbPath}\n\txratesKit.cacheService.Init()\n\n}", "title": "" }, { "docid": "04a79c347482dcddf69cf84ac65e123a", "score": "0.574763", "text": "func (gcm *GClientManager) Init() {\n\tgcm.smp = make(map[int32]int32, 128)\n\tgcm.HashTable.Init()\n}", "title": "" }, { "docid": "64cd77673b3898647100bf5097bfee9c", "score": "0.5745977", "text": "func (t *Telemetry) init(runTelemetryCheck bool) {\n\t// loading sensor into memory\n\tt.sensors = GetSensorsList(t.db)\n\tlog.Printf(\"[INFO] loading telemetry sensor list...\")\n\tif len(t.sensors) == 0 {\n\t\tlog.Printf(\"[WARNING] no sensors available in database\")\n\t}\n\n\t// loading dataset into memory\n\tt.datasets = GetDatasetsList(t.db)\n\tlog.Printf(\"[INFO] loading telemetry dataset list...\")\n\tif len(t.datasets) == 0 {\n\t\tlog.Printf(\"[WARNING] No datasets available in database\")\n\t}\n\n\t// loading controllers into memory\n\tt.controllers, _ = GetControllersListFromDB(t.db)\n\t// TODO handle error\n\tlog.Printf(\"[INFO] loading telemetry controllers list...\")\n\tif len(t.controllers) == 0 {\n\t\tlog.Printf(\"[WARNING] No active controllers\")\n\t}\n\n\tfor _, dset := range t.sensors {\n\t\tfmt.Printf(\"=> monitoring sensor telemetry for '%s'\\n\", dset.Title)\n\t}\n\n\tfor _, dset := range t.datasets {\n\t\tfmt.Printf(\"=> monitoring dataset telemetry for '%s'\\n\", dset.Title)\n\t}\n\n\tfor _, c := range t.controllers {\n\t\tfmt.Printf(\"=> monitoring controllers telemetry for '%v'\\n\", c.Title)\n\t}\n\n\tif runTelemetryCheck {\n\t\t// t.CheckSensorsTelemetry()\n\t\tt.CheckDatasetTelemetry()\n\t\tt.CheckControllersTelemetry()\n\t}\n}", "title": "" }, { "docid": "b277a8210f26fe5c6abeec34a76f566e", "score": "0.5735397", "text": "func Initialise(chainName string) error {\n\n\t// ensure start up in resynchronise mode\n\tglobalData.Lock()\n\tdefer globalData.Unlock()\n\n\t// no need to start if already started\n\tif globalData.initialised {\n\t\treturn fault.AlreadyInitialised\n\t}\n\n\tglobalData.log = logger.New(\"mode\")\n\tglobalData.log.Info(\"starting…\")\n\n\t// default settings\n\tglobalData.chain = chainName\n\tglobalData.testing = false\n\tglobalData.mode = Resynchronise\n\n\t// override for specific chain\n\tswitch chainName {\n\tcase chain.Bitmark:\n\t\t// no change\n\tcase chain.Testing, chain.Local:\n\t\tglobalData.testing = true\n\tdefault:\n\t\tglobalData.log.Criticalf(\"mode cannot handle chain: '%s'\", chainName)\n\t\treturn fault.InvalidChain\n\t}\n\n\t// all data initialised\n\tglobalData.initialised = true\n\n\treturn nil\n}", "title": "" }, { "docid": "b83a7a09cb7235a2319c793d0cde2ef8", "score": "0.5734774", "text": "func (x *SingleCollection) Initialize(_ context.Context) error {\n\treturn nil\n}", "title": "" }, { "docid": "4007829ec308eaea297d8dd2a6a07f6c", "score": "0.5734605", "text": "func (engine *Engine) Init(options types.EngineOpts) {\n\t// 将线程数设置为CPU数\n\t// runtime.GOMAXPROCS(runtime.NumCPU())\n\t// runtime.GOMAXPROCS(128)\n\n\t// 初始化初始参数\n\tif engine.initialized {\n\t\tlog.Fatal(\"Do not re-initialize the engine.\")\n\t}\n\n\tif options.GseDict == \"\" && !options.NotUseGse && !engine.loaded {\n\t\tlog.Printf(\"Dictionary file path is empty, load the default dictionary file.\")\n\t\toptions.GseDict = \"zh\"\n\t}\n\n\tif options.UseStore == true && options.StoreFolder == \"\" {\n\t\tlog.Printf(\"Store file path is empty, use default folder path.\")\n\t\toptions.StoreFolder = DefaultPath\n\t\t// os.MkdirAll(DefaultPath, 0777)\n\t}\n\n\toptions.Init()\n\tengine.initOptions = options\n\tengine.initialized = true\n\n\tif !options.NotUseGse {\n\t\tif !engine.loaded {\n\t\t\t// 载入分词器词典\n\t\t\tengine.segmenter.LoadDict(options.GseDict)\n\t\t\tengine.loaded = true\n\t\t}\n\n\t\t// 初始化停用词\n\t\tengine.stopTokens.Init(options.StopTokenFile)\n\t}\n\n\t// 初始化索引器和排序器\n\tfor shard := 0; shard < options.NumShards; shard++ {\n\t\tengine.indexers = append(engine.indexers, core.Indexer{})\n\t\tengine.indexers[shard].Init(*options.IndexerOpts)\n\n\t\tengine.rankers = append(engine.rankers, core.Ranker{})\n\t\tengine.rankers[shard].Init(options.IDOnly)\n\t}\n\n\t// 初始化分词器通道\n\tengine.segmenterChan = make(\n\t\tchan segmenterReq, options.NumGseThreads)\n\n\t// 初始化索引器通道\n\tengine.Indexer(options)\n\n\t// 初始化排序器通道\n\tengine.Ranker(options)\n\n\t// engine.CheckMem(engine.initOptions.UseStore)\n\tengine.CheckMem()\n\n\t// 初始化持久化存储通道\n\tif engine.initOptions.UseStore {\n\t\tengine.InitStore()\n\t}\n\n\t// 启动分词器\n\tfor iThread := 0; iThread < options.NumGseThreads; iThread++ {\n\t\tgo engine.segmenterWorker()\n\t}\n\n\t// 启动索引器和排序器\n\tfor shard := 0; shard < options.NumShards; shard++ {\n\t\tgo engine.indexerAddDocWorker(shard)\n\t\tgo engine.indexerRemoveDocWorker(shard)\n\t\tgo engine.rankerAddDocWorker(shard)\n\t\tgo engine.rankerRemoveDocWorker(shard)\n\n\t\tfor i := 0; i < options.NumIndexerThreadsPerShard; i++ {\n\t\t\tgo engine.indexerLookupWorker(shard)\n\t\t}\n\t\tfor i := 0; i < options.NumRankerThreadsPerShard; i++ {\n\t\t\tgo engine.rankerRankWorker(shard)\n\t\t}\n\t}\n\n\t// 启动持久化存储工作协程\n\tif engine.initOptions.UseStore {\n\t\tengine.Store()\n\t}\n\n\tatomic.AddUint64(&engine.numDocsStored, engine.numIndexingReqs)\n}", "title": "" }, { "docid": "25ba0c8cde50a966e192080f31f9f9b8", "score": "0.57226086", "text": "func (o *StorageAPI) Init() {\n\tif len(o.handlers) == 0 {\n\t\to.initHandlerCache()\n\t}\n}", "title": "" }, { "docid": "4021e77f6bcd6ce461a4d1b56dcd5e91", "score": "0.5721351", "text": "func init() {\n\tSetup()\n}", "title": "" }, { "docid": "b0ab1761b06e5ee6499cc80238a4da48", "score": "0.57185954", "text": "func Init() {\n\tif store != nil {\n\t\treturn\n\t}\n\n\tvar err error\n\tsystemDb := filepath.Join(cfg.DataDir(), \"system.db\")\n\tstore, err = bolt.Open(systemDb, 0666, nil)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\terr = store.Update(func(tx *bolt.Tx) error {\n\t\t// initialize db with all content type buckets & sorted bucket for type\n\t\tfor t := range item.Types {\n\t\t\t_, err := tx.CreateBucketIfNotExists([]byte(t))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t_, err = tx.CreateBucketIfNotExists([]byte(t + \"__sorted\"))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\t// init db with other buckets as needed\n\t\tbuckets = append(buckets, bucketsToAdd...)\n\n\t\tfor _, name := range buckets {\n\t\t\t_, err := tx.CreateBucketIfNotExists([]byte(name))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tlog.Fatalln(\"Coudn't initialize db with buckets.\", err)\n\t}\n\n\terr = LoadCacheConfig()\n\tif err != nil {\n\t\tlog.Fatalln(\"Failed to load config cache.\", err)\n\t}\n\n\tclientSecret := ConfigCache(\"client_secret\").(string)\n\n\tif clientSecret != \"\" {\n\t\tjwt.Secret([]byte(clientSecret))\n\t}\n\n\t// invalidate cache on system start\n\terr = InvalidateCache()\n\tif err != nil {\n\t\tlog.Fatalln(\"Failed to invalidate cache.\", err)\n\t}\n}", "title": "" }, { "docid": "369c34b2612caaee8837e6380c35f705", "score": "0.57042444", "text": "func (m *MixtapeIndex) init() {\n\tm.Users = make(map[string]*User)\n\tm.Playlists = make(map[string]*Playlist)\n\tm.Songs = make(map[string]*Song)\n\tm.PlaylistIdUpperBound = -1\n}", "title": "" }, { "docid": "ea943aa934757e5d522bab73dcab3298", "score": "0.5693074", "text": "func init() {\n\tstore = sessions.NewCookieStore([]byte(\"secret-key\"))\n}", "title": "" }, { "docid": "12ccf6d337bcd1506530501f837afa56", "score": "0.56723744", "text": "func InitDatastore() *datastore.Client {\n\tstore, err := datastore.NewClient(context.Background(), os.Getenv(envVarNames[evProjectID]))\n\tif err != nil {\n\t\tlog.Fatalf(\"Could not get datastore client: %v\\n\", err)\n\t}\n\treturn store\n}", "title": "" }, { "docid": "169ca74a7ac8f220ad9dc25c91cdd351", "score": "0.5671361", "text": "func InitDatastoreSubscription() error {\n\td, err := NewDatastoreSubscription(datastore.GlobalConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsetGlobalSubscription(d)\n\treturn nil\n}", "title": "" }, { "docid": "b083bdcf56a7a088971018915cc2f590", "score": "0.56632304", "text": "func (s *Storage) Init() error {\n\n\tvar err error\n\n\tif s.client, err = mongo.NewClient(options.Client().ApplyURI(s.URI)); err != nil {\n\n\t\treturn err\n\n\t}\n\tif err = s.client.Connect(context.Background()); err != nil {\n\n\t\treturn err\n\n\t}\n\n\ts.db = s.client.Database(s.Database)\n\n\ts.visited = s.db.Collection(\"colly_visited\")\n\n\ts.cookies = s.db.Collection(\"colly_cookies\")\n\n\treturn nil\n\n}", "title": "" }, { "docid": "215d1f79ecb65ef4afbe2c12eb8b7439", "score": "0.5660579", "text": "func init() {\n\t// Initialization goes here\n}", "title": "" }, { "docid": "91580a5e12afbc40a9351c93a956dabd", "score": "0.5658948", "text": "func Init(endpoint, region, secretKeySecretPath, accessKeySecretPath string, tlsEnabled bool) (faasflow.DataStore, error) {\n\tminioDataStore := &MinioDataStore{}\n\n\tminioDataStore.region = region\n\n\tminioClient, connectErr := connectToMinio(endpoint, secretKeySecretPath, accessKeySecretPath, tlsEnabled)\n\tif connectErr != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to initialize minio, error %s\", connectErr.Error())\n\t}\n\tminioDataStore.minioClient = minioClient\n\n\treturn minioDataStore, nil\n}", "title": "" }, { "docid": "82322b1a6f63f35c2c3f1b3974915208", "score": "0.5649988", "text": "func (m *Main) Init() error {\n\n\tlog.Printf(\"Loading GeoCode data ...\")\n\t//u.LoadGeoCodes()\n\n\tvar err error\n\tm.indexer, err = pdk.SetupPilosa(m.Hosts, m.IndexName, u.Frames, m.BufferSize)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error setting up Pilosa '%v'\", err)\n\t}\n\t//m.client = m.indexer.Client()\n\n\t// Initialize S3 client\n\tsess, err2 := session.NewSession(&aws.Config{\n\t\tRegion: aws.String(m.AWSRegion)},\n\t)\n\n\tif err2 != nil {\n\t\treturn fmt.Errorf(\"Creating S3 session: %v\", err2)\n\t}\n\n\t// Create S3 service client\n\tm.S3svc = s3.New(sess)\n\n\treturn nil\n}", "title": "" }, { "docid": "28bbcae907ce9d7500d4a73def93990e", "score": "0.56481296", "text": "func initStore(ctx context.Context, opts *Opts) (*sqlx.DB, scanner.Store, error) {\n\tvar store scanner.Store\n\tswitch opts.DataStore {\n\tcase Postgres:\n\t\t// we are going to use pgx for more control over connection pool and\n\t\t// and a cleaner api around bulk inserts\n\t\tcfg, err := pgxpool.ParseConfig(opts.ConnString)\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"failed to parse ConnString: %v\", err)\n\t\t}\n\t\tcfg.MaxConns = 30\n\t\tpool, err := pgxpool.ConnectConfig(ctx, cfg)\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"failed to create ConnPool: %v\", err)\n\t\t}\n\n\t\t// setup sqlx\n\t\tdb, err := sqlx.Open(\"pgx\", opts.ConnString)\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"failed to open db: %v\", err)\n\t\t}\n\n\t\tstore = postgres.NewStore(db, pool)\n\t\treturn db, store, nil\n\tdefault:\n\t\treturn nil, nil, fmt.Errorf(\"provided unknown DataStore\")\n\t}\n}", "title": "" }, { "docid": "475483b2cca6b1ea608733b68ee7afda", "score": "0.5646798", "text": "func (mongo *MongoDB) Initialize(ctx context.Context) error {\n\treturn nil\n}", "title": "" }, { "docid": "cc2d29f6648e3ab58c90303102ce9750", "score": "0.5642487", "text": "func Init() (s Storer, err error) {\n\turi := config.ReadEnvString(\"DB_URI\")\n\tname := config.ReadEnvString(\"DB_NAME\")\n\n\tclient, err := mongo.NewClient(options.Client().ApplyURI(uri))\n\tif err != nil {\n\t\tlogger.Error(\"Cannot initialize database\", err)\n\t\treturn\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)\n\tdefer cancel()\n\n\terr = client.Connect(ctx)\n\tif err != nil {\n\t\tlogger.Error(\"Cannot initialize database context\", err)\n\t\treturn\n\t}\n\n\terr = client.Ping(ctx, readpref.Primary())\n\n\tif err != nil {\n\t\tlogger.Error(\"Cannot connect to database\", err)\n\t\treturn\n\t}\n\n\tlogger.Info(\"Connected To MongoDB\")\n\tdb := client.Database(name)\n\n\treturn &mongoStore{db}, nil\n}", "title": "" }, { "docid": "e4785296ef05302c78311c54d1d55dc3", "score": "0.56412315", "text": "func (s *Session) Initialize(options options.Options) {\n\ts.Options = options\n\ts.InitStateStoreOrFail(\"\")\n\ts.InitLogger()\n\ts.InitStats()\n\ts.InitThreads()\n\ts.Signatures = signatures.LoadSignatures()\n}", "title": "" }, { "docid": "c24e0b69c6bc84afedde412b6ec8cd2d", "score": "0.5632588", "text": "func (gm GlobalManager) InitGlobalManager(ctx sdk.Context, totalLino types.Coin) sdk.Error {\n\treturn gm.storage.InitGlobalState(ctx, totalLino)\n}", "title": "" }, { "docid": "ebc19c4bc3b8bad50aa3afc059eb802a", "score": "0.5629864", "text": "func init(){\n\n\tcustomers = loadAllCustomers()\n\tBuildRank()\n\tBuildTable()\n\n}", "title": "" }, { "docid": "1e1fc2ec6f700623dae1f74dd1167aaa", "score": "0.5626111", "text": "func init() {\n\tcallbacks = make(map[ModuleType]*ConfigCallback, 8)\n\tmodules = make(map[string]ModuleType, 32)\n}", "title": "" }, { "docid": "f1b87e268295218424e51c1899b37fa5", "score": "0.5624987", "text": "func (kvstore *KVStore) init_db() {\n\t/*\n\t\tdifference between make and new?\n\t\t1. make(T) always return type T; new(T) returns type *T\n\t\t2. new works for all types,\n\tand dynamically allocates space for a variable of that type,\n\tinitialized to the zero value of that type, and returns a pointer to it;\n\t\t make works as a kind of \"constructor\" for certain bult-in types(\n\tslice, map, channel)\n\t*/\n\tfmt.Println(\"initializing kvstore\")\n\tkvstore.kvstore = make(map[string][]byte)\n}", "title": "" } ]
df6ae8bf7c4e359c8a2e50e52bcf00e3
Markdown returns the markdown representation of the badge
[ { "docid": "60f44f05a964a20e0da50976291a847c", "score": "0.7738407", "text": "func (b Badge) Markdown() string {\n\tvar queryParams []string\n\tif b.Style != \"\" {\n\t\tqueryParams = append(queryParams, \"style=\"+b.Style)\n\t}\n\tif b.Label != \"\" {\n\t\tqueryParams = append(queryParams, \"label=\"+b.Label)\n\t}\n\timageURL := b.ImageURL\n\tif len(queryParams) > 0 {\n\t\timageURL += \"?\" + strings.Join(queryParams, \"&\")\n\t}\n\treturn fmt.Sprintf(\"[![%s](%s)](%s)\", b.Name, imageURL, b.LinkURL)\n}", "title": "" } ]
[ { "docid": "e80d5ad72b6d5b483a14bed29e4394fd", "score": "0.7350812", "text": "func (c *ApiController) GetProjectBadgeMarkdown() {\n\tlog.Debug(\"Get project badge with markdown link\")\n\n\t// The link should look like \"[![ArchCI](http://127.0.0.1:10010/v1/badge/1)](http://127.0.0.1:10010/projects/1)\"\n\tprojectId, _ := c.GetInt64(\":projectId\")\n\tlink := fmt.Sprintf(\"[![ArchCI](http://127.0.0.1:10010/v1/badge/%d)](http://127.0.0.1:10010/projects/%d)\", projectId, projectId)\n\n\tc.Ctx.WriteString(link)\n}", "title": "" }, { "docid": "c44d54eb83fdea756292ae773a941aa0", "score": "0.6654154", "text": "func Markdown(text []byte) []byte {\n\thtml := blackfriday.Run(text)\n\t// Repeat to times to heal broken HTML\n\treturn HTML(html)\n}", "title": "" }, { "docid": "13823e9cc095b5168280b2dee6fb814e", "score": "0.6587339", "text": "func Markdown(text interface{}) string {\n\treturn string(blackfriday.MarkdownCommon([]byte(fmt.Sprint(text))))\n}", "title": "" }, { "docid": "98d8435f5faed726b24c924a4489efa8", "score": "0.6345268", "text": "func markdownRender(content []byte) []byte {\n htmlFlags := 0\n //htmlFlags |= blackfriday.HTML_SKIP_SCRIPT\n htmlFlags |= blackfriday.HTML_USE_XHTML\n htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS\n htmlFlags |= blackfriday.HTML_SMARTYPANTS_FRACTIONS\n htmlFlags |= blackfriday.HTML_SMARTYPANTS_LATEX_DASHES\n renderer := blackfriday.HtmlRenderer(htmlFlags, \"\", \"\")\n\n extensions := 0\n extensions |= blackfriday.EXTENSION_NO_INTRA_EMPHASIS\n extensions |= blackfriday.EXTENSION_TABLES\n extensions |= blackfriday.EXTENSION_FENCED_CODE\n extensions |= blackfriday.EXTENSION_AUTOLINK\n extensions |= blackfriday.EXTENSION_STRIKETHROUGH\n extensions |= blackfriday.EXTENSION_SPACE_HEADERS\n\n return blackfriday.Markdown(content, renderer, extensions)\n}", "title": "" }, { "docid": "44648ded00cd78a1ca30dc909712635b", "score": "0.62013954", "text": "func buildStatusToMarkdown(build *circleci.Build, p *Plugin) string {\n\tswitch build.Status {\n\tcase \"running\":\n\t\treturn \"Running\"\n\n\tcase \"not_run\":\n\t\treturn \"Not Run\"\n\n\tcase \"canceled\":\n\t\treturn \"Canceled\"\n\n\tcase \"failing\":\n\t\treturn \"Failing\"\n\n\tcase \"failed\":\n\t\treturn \"![Status image](\" + badgeFailedURL + \")\"\n\n\tcase \"success\":\n\t\treturn \"![Status image](\" + badgePassedURL + \")\"\n\n\tcase \"on_hold\":\n\t\treturn \"On Hold\"\n\n\tcase \"needs_setup\":\n\t\treturn \"Need Setup\"\n\n\tdefault:\n\t\treturn build.Status\n\t}\n}", "title": "" }, { "docid": "f4d1daacf1333aa83b3731e775d2501d", "score": "0.61847997", "text": "func MarkDown(raw string) (output template.HTML) {\r\n\tinput := []byte(raw)\r\n\tbOutput := blackfriday.MarkdownBasic(input)\r\n\toutput = template.HTML(string(bOutput))\r\n\treturn\r\n}", "title": "" }, { "docid": "f1bf43043b3bc98c7b4f92878f59bd72", "score": "0.61213017", "text": "func Markdown(version string, dataFilename string) (string, error) {\n\n\tif version == \"\" {\n\t\treturn \"\", errors.New(\"version string cannot be empty\")\n\t}\n\n\tdata, err := ioutil.ReadFile(dataFilename)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\ty, err := simpleyaml.NewYaml(data)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Problem reading data file: %s\", err.Error())\n\t}\n\n\tif !y.IsArray() {\n\t\treturn \"\", fmt.Errorf(\"input yaml has incorrect schema layout. Expected only an list of items\")\n\t}\n\n\ttext := fmt.Sprintf(\"## %s\\n\\n\", version)\n\ttotalElements, _ := y.GetArraySize()\n\tfor cl := 0; cl < totalElements; cl++ {\n\t\tfeatureTitle, _ := y.GetIndex(cl).Get(\"title\").String()\n\t\tfeatureType, _ := y.GetIndex(cl).Get(\"type\").String()\n\t\ttext = fmt.Sprintf(\"%s**%s** %s \\n\", text, strings.ToUpper(featureType), featureTitle)\n\t}\n\treturn text, nil\n}", "title": "" }, { "docid": "8c3928a533b0a3992c8f8b5e9db95ac0", "score": "0.61175007", "text": "func (j *JSONParser) Markdown() []byte {\n\treturn j.markdown.Bytes()\n}", "title": "" }, { "docid": "7ec1b8a1fba4e628e3e961b3ae22ffa0", "score": "0.6065874", "text": "func (memo *Memo) Markdown() template.HTML {\n\tmemo.mlock.Lock()\n\tdefer memo.mlock.Unlock()\n\n\tif memo.markdown == template.HTML(\"\") {\n\t\tmemo.markdown = template.HTML(string(blackfriday.MarkdownBasic([]byte(memo.Content))))\n\t}\n\treturn memo.markdown\n}", "title": "" }, { "docid": "3b5f30698ec83ea326eb34606aa139cd", "score": "0.59513795", "text": "func markdownTag(s string) string {\n\treturn fmt.Sprintf(\"[//]: <> (%s)\", s)\n}", "title": "" }, { "docid": "787c23afdf73060d8e1f392bfd50a9e6", "score": "0.5928433", "text": "func RenderMarkdown(markdownContent string) (string, error) {\n\thtmlContent := githubCSS + string(blackfriday.Run([]byte(markdownContent)))\n\tprem := premailer.NewPremailerFromString(htmlContent, premailer.NewOptions())\n\treturn prem.Transform()\n}", "title": "" }, { "docid": "44200dcd2ff47c855f7273b44086d77f", "score": "0.59098965", "text": "func renderMarkdown(ctx *context.Context, act *activities_model.Action, content string) string {\n\tmarkdownCtx := &markup.RenderContext{\n\t\tCtx: ctx,\n\t\tURLPrefix: act.GetRepoLink(),\n\t\tType: markdown.MarkupName,\n\t\tMetas: map[string]string{\n\t\t\t\"user\": act.GetRepoUserName(),\n\t\t\t\"repo\": act.GetRepoName(),\n\t\t},\n\t}\n\tmarkdown, err := markdown.RenderString(markdownCtx, content)\n\tif err != nil {\n\t\treturn content\n\t}\n\treturn markdown\n}", "title": "" }, { "docid": "8d1e0cf982e2ffc39cd145a8a6f978b5", "score": "0.5894893", "text": "func (d DependencyPath) Markdown() string {\n\tanswer := make([]string, 0)\n\tfor _, e := range d {\n\t\tcomponentStr := \"\"\n\t\tif e.Component != \"\" {\n\t\t\tcomponentStr = fmt.Sprintf(\":%s\", e.Component)\n\t\t}\n\t\tanswer = append(answer, fmt.Sprintf(\"[%s/%s/%s%s](%s)\", e.Host, e.Owner, e.Repo, componentStr, e.URL))\n\t}\n\treturn strings.Join(answer, \";\")\n}", "title": "" }, { "docid": "4231d7c37c12b8bed0d361c7ca9ec711", "score": "0.5826471", "text": "func (me Heading) Markdown() io.Reader {\n\tbuf := &bytes.Buffer{}\n\tfor i := 0; i < me.Level; i++ {\n\t\tbuf.Write([]byte(\"#\"))\n\t}\n\tbuf.WriteString(\" \" + me.Text + \"\\n\\n\")\n\treturn buf\n}", "title": "" }, { "docid": "cb11c2a94e13e92871e440ffa838a05d", "score": "0.57888645", "text": "func RenderMarkdown(m string) template.HTML {\n\tm = strings.Replace(m, \"\\r\\n\", \"\\n\", -1)\n\tunsafe := blackfriday.Run([]byte(m), blackfriday.WithExtensions(blackfriday.Autolink))\n\thtml := bluemonday.UGCPolicy().SanitizeBytes(unsafe)\n\treturn template.HTML(html)\n}", "title": "" }, { "docid": "f064e9fae746294f3b076937f7d96022", "score": "0.575192", "text": "func markDowner(args ...interface{}) template.HTML {\n\treturn template.HTML(blackfriday.MarkdownCommon([]byte(fmt.Sprintf(\"%s\", args...))))\n\t//return template.HTML(strings.ToLower(fmt.Sprintf(\"%s\", args...)))\n}", "title": "" }, { "docid": "aee9d35ec49bd3665812c793d492e041", "score": "0.5691266", "text": "func NewMarkdown() *Markdown {\n\tm := Markdown{\n\t\tinner: goldmark.New(\n\t\t\tgoldmark.WithExtensions(meta.Meta, highlighting.Highlighting),\n\t\t),\n\t}\n\treturn &m\n}", "title": "" }, { "docid": "6a776044fbcf30e0c5c48bb61e20895b", "score": "0.568637", "text": "func GetMarkdown(s string) string {\n p := bluemonday.NewPolicy()\n // Permits the \"dir\", \"id\", \"lang\", \"title\" attributes globally\n p.AllowStandardAttributes()\n\n // Permits the \"img\" element and it's standard attributes\n p.AllowImages()\n\n // Permits ordered and unordered lists, and also definition lists\n p.AllowLists()\n\n // Permits HTML tables and all applicable elements and non-styling attributes\n p.AllowTables()\n p.AllowStandardURLs()\n p.AddTargetBlankToFullyQualifiedLinks(true)\n p.AllowDataURIImages()\n p.RequireNoFollowOnLinks(true)\n p.AllowRelativeURLs(true)\n p.AllowAttrs(\"href\").OnElements(\"a\")\n p.AllowElements(\"pre\", \"blockquote\", \"p\", \"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\", \"hr\", \"strong\", \"em\", \"del\")\n p.AllowAttrs(\"class\").Matching(regexp.MustCompile(\"^language-[a-zA-Z0-9]+$\")).OnElements(\"code\")\n return p.Sanitize(string(blackfriday.MarkdownCommon([]byte(s))))\n}", "title": "" }, { "docid": "49d9ab56734b6e40004ef2b4c12251a7", "score": "0.5666747", "text": "func (t *templateFuncster) markdownify(in interface{}) (template.HTML, error) {\n\ttext, err := cast.ToStringE(in)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tm := t.ContentSpec.RenderBytes(&helpers.RenderingContext{\n\t\tCfg: t.Cfg,\n\t\tContent: []byte(text), PageFmt: \"markdown\"})\n\tm = bytes.TrimPrefix(m, markdownTrimPrefix)\n\tm = bytes.TrimSuffix(m, markdownTrimSuffix)\n\treturn template.HTML(m), nil\n}", "title": "" }, { "docid": "cc8f246097e05a859e48f9325273216d", "score": "0.5652867", "text": "func (c *TemplateContext) Markdown(body string) (string, error) {\n\trenderer := blackfriday.HtmlRenderer(0, \"\", \"\")\n\tvar extns int\n\textns |= blackfriday.EXTENSION_TABLES\n\textns |= blackfriday.EXTENSION_FENCED_CODE\n\textns |= blackfriday.EXTENSION_STRIKETHROUGH\n\textns |= blackfriday.EXTENSION_DEFINITION_LISTS\n\tmarkdown := blackfriday.Markdown([]byte(body), renderer, extns)\n\n\treturn string(markdown), nil\n}", "title": "" }, { "docid": "328839738bafe32601b0af17a0092433", "score": "0.56322676", "text": "func commandMarkdown(cmd string) string {\n\treturn ticksthree + newlineone +\n\t\tcmd + newlineone +\n\t\tticksthree\n}", "title": "" }, { "docid": "36c45a69942c7b9deba4ed147a45bd2b", "score": "0.56266063", "text": "func ParseMarkdown(text string) template.HTML {\n\tbs := blackfriday.Run([]byte(text))\n\tbs = bluemonday.UGCPolicy().SanitizeBytes(bs)\n\treturn template.HTML(string(bs))\n}", "title": "" }, { "docid": "11765211242f20fadac94ccb35081af7", "score": "0.5575367", "text": "func (g *GitlabClient) MarkdownPullLink(pull models.PullRequest) (string, error) {\n\treturn fmt.Sprintf(\"!%d\", pull.Num), nil\n}", "title": "" }, { "docid": "11765211242f20fadac94ccb35081af7", "score": "0.5575367", "text": "func (g *GitlabClient) MarkdownPullLink(pull models.PullRequest) (string, error) {\n\treturn fmt.Sprintf(\"!%d\", pull.Num), nil\n}", "title": "" }, { "docid": "5ec056c24b8eafe6b68bce120a20be9f", "score": "0.5555982", "text": "func (me Paragraph) Markdown() io.Reader {\n\tbuf := &bytes.Buffer{}\n\tchunked := strings.Fields(me.Text)\n\tthisLineLen := 0\n\tstartOfLine := true\n\n\tfor _, chunk := range chunked {\n\t\tchunkLen := len(chunk)\n\t\tif thisLineLen+chunkLen > MaxLineLength {\n\t\t\tbuf.WriteString(\"\\n\")\n\t\t\tthisLineLen = 0\n\t\t\tstartOfLine = true\n\t\t}\n\t\tif !startOfLine {\n\t\t\tbuf.WriteString(\" \")\n\t\t}\n\t\tstartOfLine = false\n\t\tbuf.WriteString(chunk)\n\t\tthisLineLen += chunkLen + 1\n\t}\n\tbuf.WriteString(\"\\n\\n\")\n\treturn buf\n}", "title": "" }, { "docid": "907c96b186d3613cce89908c135ec762", "score": "0.5551246", "text": "func (c Markdown) ToHTML() template.HTML {\n\treturn template.HTML(blackfriday.Run([]byte(string(c))))\n}", "title": "" }, { "docid": "ef30004cdcb7673982bdd8fec222a5e3", "score": "0.5546297", "text": "func (m Manifest) Markdown() string {\n\tvar sp, rq string\n\tps := m.Action.Parameters\n\tsort.Slice(ps, func(i, j int) bool { return ps[i].Name < ps[j].Name })\n\tfor _, p := range ps {\n\t\tsp += fmt.Sprintf(\"* **%s**: %s\\n\", p.Name, p.Description)\n\t}\n\tif sp == \"\" {\n\t\tsp = \"No Parameter\"\n\t}\n\n\trs := m.Action.Requirements\n\tsort.Slice(rs, func(i, j int) bool { return rs[i].Name < rs[j].Name })\n\tfor _, r := range rs {\n\t\trq += fmt.Sprintf(\"* **%s**: type: %s Value: %s\\n\", r.Name, r.Type, r.Value)\n\t}\n\n\tif rq == \"\" {\n\t\trq = \"No Requirement\"\n\t}\n\n\tex, _ := yaml.Marshal(m.Example)\n\n\tinfo := fmt.Sprintf(`---\ntitle: \"%s\"\ncard:\n name: builtin\n---\n\n**%s** is a builtin action, you can't modify it.\n\n%s\n\n## Parameters\n\n%s\n\n## Requirements\n\n%s\n\n## YAML example\n\nExample of a pipeline using %s action:\n%s\n`,\n\t\tm.Action.Name,\n\t\tm.Action.Name,\n\t\tm.Action.Description,\n\t\tsp,\n\t\trq,\n\t\tm.Action.Name,\n\t\tfmt.Sprintf(\"```yml\\n%s\\n```\", string(ex)))\n\n\treturn info\n}", "title": "" }, { "docid": "a7de35f1714628b14d321b202b5212c8", "score": "0.55336887", "text": "func (p *Post) HTML() template.HTML {\n\treturn Markdown(p.Content)\n}", "title": "" }, { "docid": "ca418227da9afe65a4c1284bc6873aca", "score": "0.5530079", "text": "func RenderMd() *string {\n\tmd := `\n[toc]\n### 云油四海 主工程\n##### 在线参考文档\n- [交互原型](http://devkits.changhong.io/axure/yysh/)\n- [APP API DOCS](./../../blob/master/docs/app-api.md)\n\n### 工程模块\n* yysh-portal: 云油四海企业门户web\n`\n\tunsafe := blackfriday.MarkdownCommon([]byte(md))\n\thtml := bluemonday.UGCPolicy().SanitizeBytes(unsafe)\n\thtmlStr := string(html)\n\tfmt.Println(htmlStr)\n\treturn &htmlStr\n}", "title": "" }, { "docid": "0d2a4e547f0a081765b436560dcf02e0", "score": "0.5524499", "text": "func (l Log) ProjectMarkdown(u url.URL) string {\n\tbasePath := u.Path\n\tcommitURL := u\n\tissuePath := fmt.Sprintf(\"%s/issues/%d\", basePath, l.Issue())\n\tu.Path = issuePath\n\tcommitURL.Path = fmt.Sprintf(\"%s/commit/%s\", basePath, l.Hash())\n\treturn fmt.Sprintf(\"[%s](%s) %s [%d](%s)\", l.hash, commitURL.String(), l.message, l.issue, u.String())\n}", "title": "" }, { "docid": "2c11e92c7ec919555f1e4ff5286ee1ef", "score": "0.5445129", "text": "func (g *GithubClient) MarkdownPullLink(pull models.PullRequest) (string, error) {\n\treturn fmt.Sprintf(\"#%d\", pull.Num), nil\n}", "title": "" }, { "docid": "d341629948d0e1f1930ea4d55a7d03cf", "score": "0.54291046", "text": "func (r EnvResult) Markdown() ([]byte, error) {\n\tlog.WithField(\"src\", \"env\").Debug(\"rendering to markdown\")\n\n\tif r.IsEmpty() {\n\t\treturn []byte{}, nil\n\t}\n\n\tmd := heredoc.Doc(`\n\t\t**Environment**\n\t\t{{ .CodeFence }}\n\t\t{{ range $k, $v := .Env }}{{ $k }}={{ $v }}\n\t\t{{ end }}{{ .CodeFence }}\n\t`)\n\tt := template.Must(template.New(\"env-md\").Parse(md))\n\n\tbuffer := bytes.Buffer{}\n\tif err := t.Execute(&buffer, r); err != nil {\n\t\treturn []byte{}, err\n\t}\n\treturn buffer.Bytes(), nil\n}", "title": "" }, { "docid": "d1c9c391f8dfe7e5fa8e4db57e8bbce3", "score": "0.5413186", "text": "func (av equalToSumOfValidator) MarkdownDescription(ctx context.Context) string {\n\treturn av.Description(ctx)\n}", "title": "" }, { "docid": "5125fcd9415176cce3142d5a0099b9e8", "score": "0.54007775", "text": "func GenerateMarkDown(res http.ResponseWriter, req *http.Request) {\n\tmarkdown := blackfriday.MarkdownCommon([]byte(req.FormValue(\"body\")))\n\tres.Write(markdown)\n}", "title": "" }, { "docid": "b306a18df13dfb07fbaa70f8452fe413", "score": "0.53710806", "text": "func markdownPage(title, htmlbody string) string {\n\th1title := \"\"\n\tif strings.HasPrefix(htmlbody, \"<p>#\") {\n\t\tfields := strings.Split(htmlbody, \"<\")\n\t\tif len(fields) > 2 {\n\t\t\th1title = fields[1][2:]\n\t\t\thtmlbody = htmlbody[len(\"<p>\"+h1title):]\n\t\t\tif strings.HasPrefix(h1title, \"#\") {\n\t\t\t\th1title = h1title[1:]\n\t\t\t}\n\t\t}\n\t}\n\treturn \"<!doctype html><html><head><title>\" + title + \"</title><style>\" + style + \"</style><head><body><h1>\" + h1title + \"</h1>\" + htmlbody + \"</body></html>\"\n}", "title": "" }, { "docid": "915c8fa4f4c9642ede51ce83c7f5fd1b", "score": "0.5368951", "text": "func GenerateChangelogMarkdown(changelog *Changelog) string {\n\toutput := changelog.Summary\n\tif output != \"\" {\n\t\toutput = output + \"\\n\\n\"\n\t}\n\n\tdependencyBumps := renderDependencyBumps(changelog)\n\tif dependencyBumps != \"\" {\n\t\toutput = output + \"**Dependency Bumps**\\n\\n\" + dependencyBumps + \"\\n\"\n\t}\n\n\tbreakingChanges := renderChangelogEntries(changelog, BREAKING_CHANGE)\n\tif breakingChanges != \"\" {\n\t\toutput = output + \"**Breaking Changes**\\n\\n\" + breakingChanges + \"\\n\"\n\t}\n\n\tnewFeatures := renderChangelogEntries(changelog, NEW_FEATURE)\n\tif newFeatures != \"\" {\n\t\toutput = output + \"**New Features**\\n\\n\" + newFeatures + \"\\n\"\n\t}\n\n\tfixes := renderChangelogEntries(changelog, FIX)\n\tif fixes != \"\" {\n\t\toutput = output + \"**Fixes**\\n\\n\" + fixes + \"\\n\"\n\t}\n\n\tif changelog.Closing != \"\" {\n\t\toutput = output + changelog.Closing + \"\\n\\n\"\n\t}\n\n\tif output == \"\" {\n\t\toutput = \"This release contained no user-facing changes.\\n\\n\"\n\t}\n\treturn output\n}", "title": "" }, { "docid": "75ee4cd592388f58db4bd2cdd49235d7", "score": "0.5344761", "text": "func NewMarkdown(settings *Settings, log logrus.FieldLogger) *Markdown {\n\treturn &Markdown{settings, log}\n}", "title": "" }, { "docid": "e6376eb71717996bf6808a5ab68f9e08", "score": "0.5336007", "text": "func (validator regexMatchesValidator) MarkdownDescription(ctx context.Context) string {\n\treturn validator.Description(ctx)\n}", "title": "" }, { "docid": "81ccf6cbf6dcdbaeb11e984ef3774b49", "score": "0.530598", "text": "func (m *markdownFormatter) Format(content string) string {\n\tlines := strings.Split(content, \"\\n\")\n\n\tfor idx := range lines {\n\t\tif len(strings.TrimSpace(lines[idx])) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, pair := range mdElements {\n\t\t\tregex, fn := pair.Regex, pair.Func\n\t\t\tfor regex.MatchString(lines[idx]) {\n\t\t\t\tlines[idx] = fn(regex, lines[idx])\n\t\t\t}\n\t\t}\n\t\tlines[idx] = trimEscape.ReplaceAllString(lines[idx], \"$1\")\n\t}\n\n\treturn strings.Join(lines, \"<br />\\n\")\n}", "title": "" }, { "docid": "afe9185e069cef4f126c580e241228df", "score": "0.52735937", "text": "func (v VersionValidator) MarkdownDescription(_ context.Context) string {\n\treturn fmt.Sprintf(\"Checks that version string is between %v..%v\", v.Min, v.Max)\n}", "title": "" }, { "docid": "ec02c9466954aed88a9429a631af1331", "score": "0.52673054", "text": "func badgeValueFmt(totalRefs int) string {\n\t// Format e.g. \"1,399\" as \"1.3k\".\n\tdesc := fmt.Sprintf(\"%d projects\", totalRefs)\n\tif totalRefs >= 1000 {\n\t\tdesc = fmt.Sprintf(\"%.1fk projects\", float64(totalRefs)/1000.0)\n\t}\n\n\t// Note: We're adding a prefixed space because otherwise the shields.io\n\t// badge will be formatted badly (looks like `used by |12k projects`\n\t// instead of `used by | 12k projects`).\n\treturn \" \" + desc\n}", "title": "" }, { "docid": "37c11f0b807fb7e2bd77ed8ba1900225", "score": "0.5244584", "text": "func renderHtml(md []byte) string {\n\treturn string(bf.Run(\n\t\tformat(md),\n\t\tbf.WithExtensions(bf.CommonExtensions|bf.NoEmptyLineBeforeBlock),\n\t\tbf.WithRenderer(\n\t\t\tbfchroma.NewRenderer(\n\t\t\t\tbfchroma.WithoutAutodetect(),\n\t\t\t\tbfchroma.ChromaOptions(html.WithLineNumbers(false)),\n\t\t\t\tbfchroma.Extend(\n\t\t\t\t\tbf.NewHTMLRenderer(bf.HTMLRendererParameters{Flags: flags}),\n\t\t\t\t),\n\t\t\t\tbfchroma.Style(\"solarized-light\"),\n\t\t\t),\n\t\t),\n\t\tbf.WithExtensions(exts),\n\t))\n}", "title": "" }, { "docid": "4e5058d60d073f3e24a641a1c700df28", "score": "0.5224029", "text": "func EscapeMarkdown(s string) string {\n\ts = strings.Replace(s, \"[\", \"\\\\[\", -1)\n\ts = strings.Replace(s, \"]\", \"\\\\]\", -1)\n\ts = strings.Replace(s, \"_\", \"\\\\_\", -1)\n\treturn s\n}", "title": "" }, { "docid": "9e4673551cb73fae0e38fc20ae1b8555", "score": "0.5207646", "text": "func (d NodeDoc) parseMarkdown(contents []byte) ([]byte, error) {\n\trenderer := blackfriday.NewHTMLRenderer(blackfriday.HTMLRendererParameters{\n\t\tFlags: blackfriday.CommonHTMLFlags &^ blackfriday.UseXHTML,\n\t})\n\textensions := blackfriday.CommonExtensions |\n\t\tblackfriday.Strikethrough | blackfriday.NoEmptyLineBeforeBlock&^\n\t\tblackfriday.HeadingIDs&^blackfriday.DefinitionLists\n\n\treturn blackfriday.Run(\n\t\tcontents,\n\t\tblackfriday.WithRenderer(renderer),\n\t\tblackfriday.WithExtensions(extensions),\n\t), nil\n}", "title": "" }, { "docid": "1b179a1e0a3bef16abad78e8591367e0", "score": "0.5201185", "text": "func ParseMarkdown2HTML(md []byte) (cnt string) {\n\thtmlFlags := html.CommonFlags | html.HrefTargetBlank\n\topts := html.RendererOptions{Flags: htmlFlags}\n\trenderer := html.NewRenderer(opts)\n\tcnt = string(markdown.ToHTML(md, nil, renderer))\n\tcnt = titleRegexp.ReplaceAllString(cnt, `<$1 id=\"$2\">$2</$1>`)\n\tcnt = strings.ReplaceAll(cnt, `class=\"codehilite\"`, `class=\"codehilite highlight\"`)\n\tvar (\n\t\ttl, tlev, tid, ttext string\n\t\tl2cnt, l3cnt int\n\t)\n\tfor _, ts := range titleMenuRegexp.FindAllStringSubmatch(cnt, -1) {\n\t\ttl = ts[0]\n\t\ttlev = strings.ToLower(ts[1])\n\t\ttid = ts[2]\n\t\tttext = ts[3]\n\t\tswitch tlev {\n\t\tcase \"h2\":\n\t\t\tl2cnt++\n\t\t\tl3cnt = 0\n\t\t\tttext = num2CN(l2cnt) + \"、\" + ttext\n\t\tcase \"h3\":\n\t\t\tl3cnt++\n\t\t\tttext = strconv.FormatInt(int64(l3cnt), 10) + \"、\" + ttext\n\t\tdefault:\n\t\t\tlog.Logger.Error(\"unknown title level\", zap.String(\"lev\", tlev))\n\t\t}\n\n\t\ttid = url.QueryEscape(tid)\n\t\tcnt = strings.ReplaceAll(cnt, tl, `<`+tlev+` id=\"`+tid+`\">`+ttext+`</`+tlev+`>`)\n\t}\n\treturn cnt\n}", "title": "" }, { "docid": "b72876982f6397ff35c97226f110c144", "score": "0.51887345", "text": "func New() *Markdown {\n\treturn &Markdown{}\n}", "title": "" }, { "docid": "901bc2643e7a1ff05f192b29b183a1d6", "score": "0.51864886", "text": "func Badge(badgeid string, text string, bagetype string, argc ...map[string]interface{}) map[string]interface{} {\n\tretsult := map[string]interface{}{}\n\tretsult[\"Id\"] = badgeid\n\tretsult[\"Text\"] = text\n\n\tswitch bagetype {\n\tcase \"span\":\n\t\tretsult[\"Type\"] = 2\n\t\tbreak\n\tcase \"link\":\n\t\tretsult[\"Type\"] = 3\n\t\tbreak\n\tcase \"button\":\n\t\tretsult[\"Type\"] = 1\n\t\tbreak\n\tdefault:\n\t\tretsult[\"Type\"] = 2\n\t}\n\n\toptions := map[string]interface{}{}\n\tif len(argc) > 0 {\n\t\toptions = argc[0]\n\t}\n\t//fmt.Println(options)\n\t//options\n\tretsult[\"BadgeClass\"] = \"badge-primary\"\n\tif badgeClass, _ := options[\"badgeClass\"]; badgeClass != nil {\n\t\tretsult[\"BadgeClass\"] = badgeClass\n\t}\n\n\tretsult[\"BadgePill\"] = \"\"\n\tif pillClass, _ := options[\"badgePill\"]; pillClass != nil {\n\t\tretsult[\"BadgePill\"] = \"badge-pill\"\n\t}\n\n\tretsult[\"BadgeNum\"] = 0\n\tif number, _ := options[\"number\"]; number != nil {\n\t\tretsult[\"BadgeNum\"] = number\n\t}\n\n\treturn retsult\n}", "title": "" }, { "docid": "2422046720a2f539111a942743a96b7d", "score": "0.5166946", "text": "func (c *Client) escapeMarkdown(s string) string {\n\ts = strings.Replace(s, \"[\", \"\\\\[\", -1)\n\ts = strings.Replace(s, \"]\", \"\\\\]\", -1)\n\ts = strings.Replace(s, \"_\", \"\\\\_\", -1)\n\treturn s\n}", "title": "" }, { "docid": "f271d7b731fc39184b88c0c264c6448b", "score": "0.5149812", "text": "func getCodeMarkdown(user, repo, repoPath, word, lines string, isTruncated bool) string {\n\tfinal := fmt.Sprintf(\"\\n[%s/%s/%s](%s)\\n\", user, repo, repoPath, word)\n\text := path.Ext(repoPath)\n\t// remove the preceding dot\n\tif len(ext) > 1 {\n\t\text = strings.TrimPrefix(ext, \".\")\n\t}\n\tfinal += \"```\" + ext + \"\\n\"\n\tfinal += lines\n\tif isTruncated { // add an ellipsis if lines were cut off\n\t\tfinal += \"...\\n\"\n\t}\n\tfinal += \"```\\n\"\n\treturn final\n}", "title": "" }, { "docid": "0b51af940426f5d8d209bf4a34029911", "score": "0.5129242", "text": "func (validator atLeastValidator) MarkdownDescription(ctx context.Context) string {\n\treturn validator.Description(ctx)\n}", "title": "" }, { "docid": "1c9b5ea19c5cc4dcb1781596eca9986c", "score": "0.50896204", "text": "func generateBadge(params *Params) (*badgeDimensions, error) {\n\tbadgeParams := params\n\tif badgeParams == nil {\n\t\tbadgeParams = &Params{}\n\t}\n\tbadgeColor := parseColor(badgeParams.Color)\n\tif badgeColor == \"\" {\n\t\tbadgeColor = DefaultColor\n\t}\n\tbadgeStyle := badgeParams.Style\n\tif badgeStyle == Style(\"\") {\n\t\tbadgeStyle = DefaultStyle\n\t}\n\n\tvar newBadge badgeDimensions\n\tswitch badgeStyle {\n\tcase FlatStyle:\n\t\tnewBadge = badgeDimensions{\n\t\t\tStyle: FlatStyle,\n\t\t\tTemplate: badgeTemplates[FlatStyle],\n\t\t\tColor: badgeColor,\n\t\t\tFontFamily: \"Verdana\",\n\t\t\tFontSize: 11,\n\t\t\tPaddingInner: 4,\n\t\t\tPaddingOuter: 6,\n\t\t\tStatus: badgeParams.Status,\n\t\t\tStatusFontColor: \"#fff\",\n\t\t\tSubject: badgeParams.Subject,\n\t\t\tSubjectFontColor: \"#fff\",\n\t\t}\n\tcase PlasticStyle:\n\t\tnewBadge = badgeDimensions{\n\t\t\tStyle: PlasticStyle,\n\t\t\tTemplate: badgeTemplates[PlasticStyle],\n\t\t\tColor: badgeColor,\n\t\t\tFontFamily: \"Verdana\",\n\t\t\tFontSize: 11,\n\t\t\tPaddingInner: 4,\n\t\t\tPaddingOuter: 6,\n\t\t\tStatus: badgeParams.Status,\n\t\t\tStatusFontColor: \"#fff\",\n\t\t\tSubject: badgeParams.Subject,\n\t\t\tSubjectFontColor: \"#fff\",\n\t\t}\n\tcase SemaphoreCIStyle:\n\t\tnewBadge = badgeDimensions{\n\t\t\tStyle: SemaphoreCIStyle,\n\t\t\tTemplate: badgeTemplates[SemaphoreCIStyle],\n\t\t\tColor: badgeColor,\n\t\t\tFontFamily: \"Verdana\",\n\t\t\tFontSize: 9,\n\t\t\tPaddingInner: 10,\n\t\t\tPaddingOuter: 10,\n\t\t\tStatus: strings.ToUpper(badgeParams.Status),\n\t\t\tStatusFontColor: \"#fff\",\n\t\t\tSubject: strings.ToUpper(badgeParams.Subject),\n\t\t\tSubjectFontColor: \"#888\",\n\t\t}\n\tcase ClassicStyle:\n\t\tfallthrough\n\tdefault:\n\t\tnewBadge = badgeDimensions{\n\t\t\tStyle: ClassicStyle,\n\t\t\tTemplate: badgeTemplates[ClassicStyle],\n\t\t\tColor: badgeColor,\n\t\t\tFontFamily: \"Verdana\",\n\t\t\tFontSize: 11,\n\t\t\tPaddingInner: 4,\n\t\t\tPaddingOuter: 6,\n\t\t\tStatus: badgeParams.Status,\n\t\t\tStatusFontColor: \"#fff\",\n\t\t\tSubject: badgeParams.Subject,\n\t\t\tSubjectFontColor: \"#fff\",\n\t\t}\n\t}\n\n\tsubjectTextWidth, err := computeTextWidth(newBadge.Subject, newBadge.FontSize,\n\t\tnewBadge.FontFamily)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstatusTextWidth, err := computeTextWidth(newBadge.Status, newBadge.FontSize,\n\t\tnewBadge.FontFamily)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif badgeParams.Icon != \"\" {\n\t\tsvgIcon, ok := fontAwesomeIcons[badgeParams.Icon]\n\t\tif ok {\n\t\t\t// Encode icon into a base64 string\n\t\t\tmodifiedSvgIcon := \"<svg fill=\\\"\" + newBadge.SubjectFontColor + \"\\\"\" + svgIcon[len(\"<svg\"):]\n\t\t\tnewBadge.IconLabel = badgeParams.Icon\n\t\t\tnewBadge.IconBase64Str = base64.StdEncoding.EncodeToString([]byte(modifiedSvgIcon))\n\t\t\tnewBadge.IconOffset = 3 + 13 // IconPadding + IconSize\n\t\t}\n\t}\n\n\tnewBadge.SubjectOffset = newBadge.PaddingOuter + newBadge.IconOffset\n\tnewBadge.SubjectTextWidth = subjectTextWidth\n\tnewBadge.SubjectWidth = newBadge.SubjectOffset + subjectTextWidth + newBadge.PaddingInner\n\n\tnewBadge.StatusOffset = newBadge.SubjectWidth + newBadge.PaddingInner\n\tnewBadge.StatusTextWidth = statusTextWidth\n\tnewBadge.StatusWidth = newBadge.PaddingInner + statusTextWidth + newBadge.PaddingOuter\n\n\tnewBadge.TotalWidth = newBadge.SubjectWidth + newBadge.StatusWidth\n\n\tif newBadge.Template == nil {\n\t\treturn nil, fmt.Errorf(\"Badge template does not exist: %s\", params.Style)\n\t}\n\n\treturn &newBadge, nil\n}", "title": "" }, { "docid": "122fda7d94dfdee5c60b009d7dc0f61e", "score": "0.5087669", "text": "func (post *Post) HTML() template.HTML {\n\tif post.htmlContent == \"\" {\n\t\tpost.htmlContent = markdown.ToHtml(post.Content)\n\t}\n\treturn post.htmlContent\n}", "title": "" }, { "docid": "37c975d4fb4298c93ac8a7ecf238fe08", "score": "0.50827837", "text": "func xmarkdown(s string) []byte {\n\thtmlFlags := 0\n\trenderer := mmark.HtmlRenderer(htmlFlags, \"\", \"\")\n\treturn mmark.Parse([]byte(s), renderer, extensions).Bytes()\n}", "title": "" }, { "docid": "8c9449a071f23c6550a53eeebcd0b93c", "score": "0.50751925", "text": "func showBadge(cfg config.SectionConfig) {\n\tcolor.Yellow(\"+ ---------------------------------+\")\n\tcolor.Yellow(\"+ Server %s [%s]\", cfg.Host, cfg.Section)\n\tcolor.Yellow(\"+ Branch [%s]\", cfg.Branch)\n\tcolor.Yellow(\"+ --------------------------------- +\\n\\n\")\n}", "title": "" }, { "docid": "706e88793ef2c71019330114219d1d13", "score": "0.50637025", "text": "func Render(markdown string) string {\n\temphasis := 0\n\theader := 0\n\tpos := 0\n\tlist := 0\n\thtml := \"\"\n\tfor {\n\t\tif pos >= len(markdown) {\n\t\t\tbreak\n\t\t}\n\t\tchar := markdown[pos]\n\t\tif char == '_' {\n\t\t\tif emphasis == 1 {\n\t\t\t\thtml += \"</em>\"\n\t\t\t\temphasis = 0\n\t\t\t\tpos++\n\t\t\t\tcontinue\n\t\t\t} else if emphasis == 2 {\n\t\t\t\thtml += \"</strong>\"\n\t\t\t\temphasis = 0\n\t\t\t\tpos += 2\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor char == '_' {\n\t\t\t\temphasis++\n\t\t\t\tpos++\n\t\t\t\tchar = markdown[pos]\n\t\t\t}\n\t\t\tif emphasis == 1 {\n\t\t\t\thtml += \"<em>\"\n\t\t\t} else if emphasis == 2 {\n\t\t\t\thtml += \"<strong>\"\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif char == '#' {\n\t\t\tfor char == '#' {\n\t\t\t\theader++\n\t\t\t\tpos++\n\t\t\t\tchar = markdown[pos]\n\t\t\t}\n\t\t\thtml += fmt.Sprintf(\"<h%d>\", header)\n\t\t\tpos++\n\t\t\tcontinue\n\t\t}\n\t\tif char == '*' {\n\t\t\tif list == 0 {\n\t\t\t\thtml += \"<ul>\"\n\t\t\t}\n\t\t\thtml += \"<li>\"\n\t\t\tlist++\n\t\t\tpos += 2\n\t\t\tcontinue\n\t\t}\n\t\tif char == '\\n' {\n\t\t\tif list > 0 {\n\t\t\t\thtml += \"</li>\"\n\t\t\t}\n\t\t\tif header > 0 {\n\t\t\t\thtml += fmt.Sprintf(\"</h%d>\", header)\n\t\t\t\theader = 0\n\t\t\t}\n\t\t\tpos++\n\t\t\tcontinue\n\t\t}\n\t\thtml += string(char)\n\t\tpos++\n\t}\n\tif header > 0 {\n\t\treturn html + fmt.Sprintf(\"</h%d>\", header)\n\t}\n\tif list > 0 {\n\t\treturn html + \"</li></ul>\"\n\t}\n\tif emphasis == 1 {\n\t\thtml += \"</em>\"\n\t}\n\tif emphasis == 2 {\n\t\thtml += \"</strong>\"\n\t}\n\treturn \"<p>\" + html + \"</p>\"\n\n}", "title": "" }, { "docid": "386594186024a05b27109e194f4c3ccb", "score": "0.50543475", "text": "func convertMarkdownToHTML(body string) string {\n\tunsafe := blackfriday.MarkdownCommon([]byte(body))\n\thtml := bluemonday.UGCPolicy().SanitizeBytes(unsafe)\n\treturn string(html)\n}", "title": "" }, { "docid": "dfd922967ec8aac2f895748e4a373068", "score": "0.5051652", "text": "func (c *Client) Markdown(ctx context.Context, text string, opt *MarkdownOptions) (string, *Response, error) {\n\trequest := &markdownRequest{Text: String(text)}\n\tif opt != nil {\n\t\tif opt.Mode != \"\" {\n\t\t\trequest.Mode = String(opt.Mode)\n\t\t}\n\t\tif opt.Context != \"\" {\n\t\t\trequest.Context = String(opt.Context)\n\t\t}\n\t}\n\n\treq, err := c.NewRequest(\"POST\", \"markdown\", request)\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\n\tbuf := new(bytes.Buffer)\n\tresp, err := c.Do(ctx, req, buf)\n\tif err != nil {\n\t\treturn \"\", resp, err\n\t}\n\n\treturn buf.String(), resp, nil\n}", "title": "" }, { "docid": "f35ceefe36a19282cd39b42d0d9487da", "score": "0.5046065", "text": "func addMarkdownTag(s string, tag string) string {\n\tcomment := s\n\n\tif tag != \"\" {\n\t\tcomment = fmt.Sprintf(\"%s\\n%s\", markdownTag(tag), comment)\n\t}\n\n\treturn comment\n}", "title": "" }, { "docid": "6ba24785b40427c638f4ae075fd590c5", "score": "0.5044063", "text": "func (ce *coverageExportUtil) exportMarkdown(outputDirectory string, fileName string) error {\n\n\t// The Coverage Tracker data structure is flattened down to the example level, and they all\n\t// get individually written to the file in order to not have the \"{ }\" brackets at the start and end\n\ttype FlattenedExample struct {\n\t\tExampleName string\n\t\tOriginalHCL string `json:\"OriginalHCL,omitempty\"`\n\t\tConversionResults map[string]*LanguageConversionResult\n\t}\n\n\t// All the examples in the tracker are iterated by page ID + index, and marshalled into one large byte\n\t// array separated by \\n, making the end result look like a bunch of Json files that got concatenated\n\tvar brokenExamples []FlattenedExample\n\n\tfor _, page := range ce.Tracker.EncounteredPages {\n\t\tfor index, example := range page.Examples {\n\t\t\tflattenedName := page.Name\n\t\t\tif len(page.Examples) > 1 {\n\t\t\t\tflattenedName += fmt.Sprintf(\"#%d\", index)\n\t\t\t}\n\n\t\t\tnoErrors := true\n\t\t\tfor _, result := range example.ConversionResults {\n\t\t\t\tif result.FailureSeverity == Success {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tnoErrors = false\n\t\t\t}\n\t\t\tif noErrors {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tbrokenExamples = append(brokenExamples, FlattenedExample{\n\t\t\t\tExampleName: flattenedName,\n\t\t\t\tOriginalHCL: example.OriginalHCL,\n\t\t\t\tConversionResults: example.ConversionResults,\n\t\t\t})\n\t\t}\n\t}\n\ttargetFile, err := createEmptyFile(outputDirectory, fileName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Make coverage output stable. For examples.\n\tsort.Slice(brokenExamples, func(i, j int) bool {\n\t\treturn brokenExamples[i].ExampleName < brokenExamples[j].ExampleName\n\t})\n\n\tout := \"\"\n\tfor _, example := range brokenExamples {\n\n\t\ttype exampleResult struct {\n\t\t\tlang string\n\t\t\tresult LanguageConversionResult\n\t\t}\n\n\t\tsuccesses := []exampleResult{}\n\t\tfailures := []exampleResult{}\n\n\t\tfor lang, result := range example.ConversionResults {\n\t\t\tif result.FailureSeverity == Success {\n\t\t\t\tsuccesses = append(successes, exampleResult{\n\t\t\t\t\tlang: lang,\n\t\t\t\t\tresult: *result,\n\t\t\t\t})\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfailures = append(failures, exampleResult{\n\t\t\t\tlang: lang,\n\t\t\t\tresult: *result,\n\t\t\t})\n\t\t}\n\n\t\t// Make coverage output stable. For language results.\n\t\tsort.Slice(successes, func(i, j int) bool {\n\t\t\treturn successes[i].lang < successes[j].lang\n\t\t})\n\t\tsort.Slice(failures, func(i, j int) bool {\n\t\t\treturn failures[i].lang < failures[j].lang\n\t\t})\n\n\t\tisCompleteFailure := len(successes) == 0\n\n\t\t// print example header\n\t\tsummaryText := \"*partial failure*\"\n\t\tif isCompleteFailure {\n\t\t\tsummaryText = \"**complete failure**\"\n\t\t}\n\n\t\tout += \"\\n---\\n\"\n\t\tout += fmt.Sprintf(\"\\n## [%s] %s\\n\", summaryText, example.ExampleName)\n\n\t\t// print original HCL\n\t\tout += \"\\n### HCL\\n\"\n\t\tout += \"\\n```terraform\\n\"\n\t\tout += example.OriginalHCL + \"\\n\"\n\t\tout += \"\\n```\\n\"\n\n\t\t// print failures\n\t\tout += \"\\n### Failed Languages\\n\"\n\t\tfor _, fail := range failures {\n\t\t\tout += fmt.Sprintf(\"\\n#### %s\\n\", fail.lang)\n\t\t\tout += \"\\n```text\\n\"\n\n\t\t\terrMsg := fail.result.FailureInfo\n\t\t\tif len(fail.result.FailureInfo) > 1000 {\n\t\t\t\t// truncate extremely long error messages\n\t\t\t\terrMsg = fail.result.FailureInfo[:1000]\n\t\t\t}\n\t\t\tout += errMsg\n\t\t\tout += \"\\n```\\n\"\n\t\t}\n\n\t\tif isCompleteFailure {\n\t\t\t// it's a complete failure, no successes to print\n\t\t\tcontinue\n\t\t}\n\n\t\t// print successes\n\t\tout += \"\\n### Successes\\n\"\n\t\tfor _, success := range successes {\n\t\t\tout += \"\\n<details>\\n\"\n\t\t\tout += fmt.Sprintf(\"\\n<summary>%s</summary>\\n\", success.lang)\n\t\t\tout += fmt.Sprintf(\"\\n```%s\\n\", success.lang)\n\t\t\tout += success.result.Program\n\t\t\tout += \"\\n```\\n\"\n\t\t\tout += \"\\n</details>\\n\"\n\t\t}\n\t}\n\n\treturn os.WriteFile(targetFile, []byte(out), 0600)\n}", "title": "" }, { "docid": "be599d58c94157b927b47e9dde3830d0", "score": "0.503826", "text": "func ReadMarkdown(r io.Reader) ([]byte, string, error) {\n\tbuf := &bytes.Buffer{}\n\ttitle := \"\"\n\tscanner := bufio.NewScanner(r)\n\tfor scanner.Scan() {\n\t\tstr := scanner.Text()\n\t\tbuf.WriteString(str)\n\t\tbuf.WriteString(\"\\n\")\n\t\tstr = strings.TrimLeft(str, \" \\t\")\n\t\tif strings.HasPrefix(str, \"# \") && len(title) == 0 {\n\t\t\ttitle = strings.Trim(str[2:], \" \\t\")\n\t\t}\n\t}\n\treturn buf.Bytes(), title, scanner.Err()\n}", "title": "" }, { "docid": "f3ecf6de9f4698108971143eef59c2e6", "score": "0.5018948", "text": "func StripMarkdown(rawBytes []byte) (string, []string) {\n\tstripper := &MarkdownStripper{\n\t\tlinks: make([]string, 0, 10),\n\t}\n\tbody := blackfriday.Markdown(rawBytes, stripper, blackfridayExtensions)\n\treturn string(body), stripper.GetLinks()\n}", "title": "" }, { "docid": "ecd9626ec3ad7a6ec9b412df99a9c8a8", "score": "0.5009903", "text": "func (r Package) ToMarkdown() string {\n\tif r.IsEmpty() {\n\t\treturn \"\"\n\t}\n\treturn formatAsMarkdown(r)\n}", "title": "" }, { "docid": "305d07f15f79d2a855d50d6c72de3250", "score": "0.50001514", "text": "func HTML2Markdown(s string) string {\n\ttags := []struct {\n\t\tfind, repl string\n\t}{\n\t\t{\"<p>\", \"\"},\n\t\t{\"</p>\", \"\\n\\n\"},\n\t\t{\"<br /><br />\", \"\\n\\n\"},\n\t\t{\"<br/><br/>\", \"\\n\\n\"},\n\t\t{\"<br />\", \" \\n\"},\n\t\t{\"<br/>\", \" \\n\"},\n\t\t{\"<i>\", \"*\"},\n\t\t{\"</i>\", \"*\"},\n\t\t{\"<em>\", \"*\"},\n\t\t{\"</em>\", \"*\"},\n\t\t{\"<strong>\", \"**\"},\n\t\t{\"</strong>\", \"**\"},\n\t\t{\"<b>\", \"**\"},\n\t\t{\"</b>\", \"**\"},\n\t}\n\ts = mdPolicy.Sanitize(s)\n\ts = decodeEntities(tidyText(s))\n\tfor _, t := range tags {\n\t\ts = strings.Replace(s, t.find, t.repl, -1)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "19f9546e516b421a14670489f7c022db", "score": "0.498343", "text": "func New(options ...goldmark.Option) ConverterFunc {\n\treturn Markdown(goldmark.New(options...))\n}", "title": "" }, { "docid": "431c5d1910c93716b4923fa51a52b6ad", "score": "0.49695405", "text": "func GetNewMarkdownMessage(title, content string, mobiles *list.List, isAtAll bool) *markdownMessage {\n\tif content == \"\" || title == \"\" {\n\t\treturn nil\n\t}\n\tmarkdown := &markdown{Title: title, Text: content}\n\n\tat := &at{IsAtAll: isAtAll}\n\tif nil != mobiles && mobiles.Len() > 0 {\n\t\tfor p := mobiles.Front(); p != nil; p = p.Next() {\n\t\t\tat.AtMobiles = append(at.AtMobiles, p.Value.(string))\n\t\t}\n\t}\n\treturn &markdownMessage{MsgType: MESSAGE_TYPE_MARKDOWN, Markdown: markdown, At: at}\n}", "title": "" }, { "docid": "bbdc669c8a9e352bde3aa5a59ee58673", "score": "0.49543756", "text": "func textToMarkdown(text string) string {\n\ttext = strings.Replace(text, \"\\n\", \" \\n\", -1)\n\treturn text\n}", "title": "" }, { "docid": "dd73d3dcba8ecbf6c08a18fd7e2bc266", "score": "0.49403188", "text": "func Markdown(m goldmark.Markdown) ConverterFunc {\n\tm.Parser().AddOptions(\n\t\tparser.WithAttribute(),\n\t\tparser.WithAutoHeadingID(),\n\t)\n\treturn func(source []byte, writer io.Writer) (toc []Header, err error) {\n\t\tdoc := m.Parser().Parse(text.NewReader(source), WithIDs())\n\t\ttoc = Headers(doc, source)\n\t\tif writer != nil {\n\t\t\terr = m.Renderer().Render(writer, source, doc)\n\t\t}\n\t\treturn toc, err\n\t}\n}", "title": "" }, { "docid": "8aed14b712bae8709919720b4620e725", "score": "0.49165156", "text": "func MarkdownToHTML(md []byte) []byte {\n\tmd = bytes.Replace(md, []byte(\"\\r\\n\"), []byte(\"\\n\"), -1)\n\tunsafe := bf.Run((md), bf.WithExtensions(ext))\n\n\treturn sanitize(unsafe)\n}", "title": "" }, { "docid": "20607c2ce022fcd6a25fdb589d1ce2c5", "score": "0.49052638", "text": "func (d *DDL) RenderMarkdown() ([]byte, error) {\n\treturn fs.ExecuteTemplate(\"ddl/markdown/agent.templ\", d, nil)\n}", "title": "" }, { "docid": "60d6a5be2b87ca5b898c32a01851e405", "score": "0.4901052", "text": "func NewMarkdownParser() *MarkdownParser {\n\tvar cssBuf bytes.Buffer\n\n\tfmt.Printf(cssBuf.String())\n\treturn &MarkdownParser{\n\t\tparser: goldmark.New(\n\t\t\tgoldmark.WithExtensions(\n\t\t\t\thighlighting.NewHighlighting(\n\t\t\t\t\thighlighting.WithStyle(\"emacs\"),\n\t\t\t\t\thighlighting.WithFormatOptions(\n\t\t\t\t\t\thtml.WithLineNumbers(true),\n\t\t\t\t\t\thtml.WithClasses(true),\n\t\t\t\t\t\thtml.LineNumbersInTable(true),\n\t\t\t\t\t\thtml.TabWidth(2),\n\t\t\t\t\t),\n\t\t\t\t\thighlighting.WithCSSWriter(&cssBuf),\n\t\t\t\t),\n\t\t\t\tmeta.Meta,\n\t\t\t),\n\t\t\tgoldmark.WithParserOptions(parser.WithAttribute()),\n\t\t),\n\t\tcssBuf: &cssBuf,\n\t}\n}", "title": "" }, { "docid": "044750ad1343e735b3c22fa8da820f14", "score": "0.4899238", "text": "func Render(raw []byte) []byte {\n htmlFlags := 0\n htmlFlags |= blackfriday.HTML_USE_XHTML\n htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS\n htmlFlags |= blackfriday.HTML_SMARTYPANTS_FRACTIONS\n htmlFlags |= blackfriday.HTML_SMARTYPANTS_LATEX_DASHES\n renderer := blackfriday.HtmlRenderer(htmlFlags, \"\", \"\")\n\n // set up the parser\n extensions := 0\n extensions |= blackfriday.EXTENSION_NO_INTRA_EMPHASIS\n extensions |= blackfriday.EXTENSION_TABLES\n extensions |= blackfriday.EXTENSION_FENCED_CODE\n extensions |= blackfriday.EXTENSION_STRIKETHROUGH\n extensions |= blackfriday.EXTENSION_SPACE_HEADERS\n\n escaped := new(bytes.Buffer)\n template.HTMLEscape(escaped, raw)\n rendered := blackfriday.Markdown(escaped.Bytes(), renderer, extensions)\n enabled := true\n fmt.Println(\"Raw message:\")\n fmt.Println(string(raw))\n if enabled {\n fmt.Println(\"Rendered message:\")\n fmt.Println(string(rendered))\n return rendered\n }\n return raw\n}", "title": "" }, { "docid": "ac89f736fa87abb11fd91a2e83d0778a", "score": "0.48965463", "text": "func ParseAndSaniziteMarkdown(input string) string {\n\tunsafe := blackfriday.Run([]byte(input))\n\thtml := bluemonday.UGCPolicy().SanitizeBytes(unsafe)\n\treturn string(html)\n}", "title": "" }, { "docid": "c0f8941f2abf687e6ef1608bda5b666d", "score": "0.4895135", "text": "func ToBreadcrumbMarkdown(names ...string) string {\n\tb := strings.Builder{}\n\tfor i, name := range names {\n\t\tif i > 0 {\n\t\t\tb.WriteString(` <clr-icon shape=\"angle right\"></clr-icon> `)\n\t\t}\n\t\tb.WriteString(name)\n\t}\n\treturn b.String()\n}", "title": "" }, { "docid": "54c113d20c2f974328939b3f4180ecc0", "score": "0.48910394", "text": "func FmtGoCodeInMarkdown(md []byte) ([]byte, error) {\n\tvar err error\n\tn := blackfriday.New(blackfriday.WithExtensions(blackfriday.FencedCode)).Parse(md)\n\tn.Walk(genFmtWalker(&md, &err))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"[gofmtmd] %w\", err)\n\t}\n\treturn md, nil\n}", "title": "" }, { "docid": "a07b166d58530235d8c2e06877f01564", "score": "0.48684925", "text": "func getBody(text string, isMarkdown bool) string {\n if(isMarkdown == true) {\n return text\n } \n \n //for makrdown needs\n converter := md.NewConverter(\"\", true, nil)\n markdown, err := converter.ConvertString(text)\n if err != nil {\n panic(err.Error()) \n }\n \n return markdown\n}", "title": "" }, { "docid": "454f9b4cf1e9dd08c600115feae23638", "score": "0.4850161", "text": "func RunMarkdown(filename string, bytes []byte, sess *ShellSession, hook RunnerHook) []CodeResult {\n\thook.onFileStart(filename)\n\n\tfileResults := []CodeResult{}\n\t_, modified := walkCodeBlocks(bytes, func(n ast.Node, lines []string) []string {\n\t\tname := getNearestHeading(bytes, n)\n\t\thook.onCodeBlockStart(name)\n\n\t\tcbResults := []CodeResult{}\n\t\twalkCodes(lines, sess, func(c Code) {\n\t\t\thook.onCodeStart(name, c)\n\t\t\tr := c.Run(sess)\n\t\t\thook.onCodeEnd(name, r)\n\t\t\tcbResults = append(cbResults, r)\n\t\t})\n\t\tfileResults = append(fileResults, cbResults...)\n\n\t\thook.onCodeBlockEnd(name)\n\t\treturn convertCommandStepResults(cbResults)\n\t})\n\n\thook.onFileEnd(filename, bytes, modified, fileResults)\n\n\treturn fileResults\n}", "title": "" }, { "docid": "53309d4f11cd9ce51b60b5db25cce1f9", "score": "0.48472998", "text": "func MdToWiki(markdown string) string {\n\tmarkdownLines := append(strings.Split(strings.NewReplacer(\"\\r\\n\", \"\\n\", \"\\r\", \"\\n\").Replace(markdown), \"\\n\"), \"\")\n\n\t// 2行以上の改行を削除\n\tflg := false\n\twikiLines := []string{\"[[FrontPage]]\", \"\", \"#setlinebreak(true)\", \"\"}\n\tfor i, v := range markdownLines {\n\t\tif !(flg && v == \"\") {\n\t\t\twikiLines = append(wikiLines, markdownLines[i])\n\t\t\tflg = v == \"\"\n\t\t}\n\t}\n\n\t// 各行を変換\n\tfor i := range wikiLines {\n\t\tl := wikiLines[i]\n\t\tl = regexp.MustCompile(`^#\\s`).ReplaceAllString(l, \"* \")\n\t\tl = regexp.MustCompile(`^##\\s`).ReplaceAllString(l, \"** \")\n\t\tl = regexp.MustCompile(`^###\\s`).ReplaceAllString(l, \"*** \")\n\t\tl = regexp.MustCompile(`^-\\s`).ReplaceAllString(l, \"- \")\n\t\tl = regexp.MustCompile(`^ -\\s`).ReplaceAllString(l, \"-- \")\n\t\tl = regexp.MustCompile(`^ -\\s`).ReplaceAllString(l, \"--- \")\n\t\tl = regexp.MustCompile(`\\*\\*(.*)\\*\\*`).ReplaceAllString(l, \"''$1''\")\n\t\tl = regexp.MustCompile(`~~(.*)~~`).ReplaceAllString(l, \"%%$1%%\")\n\t\tl = regexp.MustCompile(`\\[(.*)\\]\\((.*)\\)`).ReplaceAllString(l, \"[[$1:$2]]\")\n\t\twikiLines[i] = l\n\t}\n\n\t// 結合\n\treturn strings.Join(wikiLines, \"\\n\")\n}", "title": "" }, { "docid": "58e0c2b3b9e12bafacd8d60360aa57fb", "score": "0.48350424", "text": "func (s ProjectBadge) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "4f2bb4d5e4ad8c896d997cfe3271e687", "score": "0.48339304", "text": "func (f Custom) FormatHTML(n *sns.Notification) (msg string, err error) {\n\tmsg, err = f.Format(n)\n\tmsg = fmt.Sprintf(\"<pre>%s</pre>\", msg)\n\treturn\n}", "title": "" }, { "docid": "913460022b1204d491b7f980b4cfc21a", "score": "0.4819053", "text": "func (bbp *BBPakMarkdownFormat) Format() string {\n\tvar out strings.Builder\n\n\tout.WriteString(fmt.Sprintf(\"|%s|%s|%s|%s|%s|%s|\\n\", \"Num\", \"Name\", \"Version\", \"Licence\", \"Size\", \"Maintainer\"))\n\tout.WriteString(\"|-|-|-|-|-|-|\\n\")\n\tfor idx, pkgName := range bbp.pkgNameIndex {\n\t\tpkg := bbp.packages[pkgName]\n\t\tout.WriteString(fmt.Sprintf(\"|%d|%s|%s|%s|%s|%s|\\n\", idx+1,\n\t\t\tpkg.GetPackage().ControlFile().Package(),\n\t\t\tpkg.GetPackage().ControlFile().Version(),\n\t\t\tpkg.GetPackage().ControlFile().Licence(),\n\t\t\tbbp.ByteIEC(pkg.GetPackage().FileSize()),\n\t\t\tpkg.GetPackage().ControlFile().Maintainer()))\n\t}\n\treturn out.String()\n}", "title": "" }, { "docid": "1fc0c36f6e1ae313bffbee13533d773c", "score": "0.481861", "text": "func (r *Resolver) Badge() generated.BadgeResolver { return &badgeResolver{r} }", "title": "" }, { "docid": "1fc0c36f6e1ae313bffbee13533d773c", "score": "0.481861", "text": "func (r *Resolver) Badge() generated.BadgeResolver { return &badgeResolver{r} }", "title": "" }, { "docid": "2aae8012700a13afc5ede6362eee1792", "score": "0.476952", "text": "func (cmd MigrateCmd) CreateMarkdown(_ io.Writer, _ string) error {\n\treturn nil\n}", "title": "" }, { "docid": "75553161683ab401b5b07e82e35e2c61", "score": "0.47570145", "text": "func (markdown *Markdown) ProcessMarkdown(filepath string) string {\n\tfilePath := path.Join(markdown.settings.MarkdownsPath, filepath)\n\tinput, err := ioutil.ReadFile(filePath)\n\tif err != nil {\n\t\tmarkdown.log.Error(err)\n\t\treturn \"\"\n\t}\n\treturn string(blackfriday.Run(input))\n}", "title": "" }, { "docid": "d3cec86d63806640c2849e432215214b", "score": "0.4741589", "text": "func (m *Mdfile) md2html() error {\n\n\tbfr := BFRenderer()\n\tif bfr == nil {\n\t\treturn fmt.Errorf(\"failed to create our markdown renderer\")\n\t}\n\n\tm.mdhtml = blackfriday.Markdown([]byte(m.mdbody), bfr, bfrExtensions())\n\tif m.mdhtml == nil {\n\t\treturn fmt.Errorf(\"failed attempt to render HTML %s\", m.Filename)\n\t}\n\n\t//fmt.Printf(\"mdhtml: %s\", m.mdhtml)\n\tif options.SanitizeHTML {\n\t\t// mdf.Html = bluemonday.UGCPolicy().SanitizeBytes(mdf.Html)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0571ab7bc3ee4a09d9bfc7ea1c7d3272", "score": "0.47334507", "text": "func GenCheckDocsMarkdown() string {\n\treturn GenCheckDocs(CheckDocsMarkdownTpl)\n}", "title": "" }, { "docid": "1e45e4a0c5120c48d97a441b7ab4b3c5", "score": "0.47288468", "text": "func (p *printer) markup(n ast.Node) {\n\tswitch n := n.(type) {\n\tcase *ast.Annotation:\n\t\tp.inject(n, beforeSuffix, \"•\")\n\t\tif len(n.Arguments) > 0 {\n\t\t\tfor _, a := range n.Arguments[1:] {\n\t\t\t\tp.inject(a, beforePrefix, \"•\")\n\t\t\t}\n\t\t}\n\n\tcase *ast.API:\n\t\tp.align(n)\n\t\tif n.Index != nil {\n\t\t\tp.inject(n.Index, afterPrefix, \"•\")\n\t\t}\n\n\tcase *ast.Assign:\n\t\tp.inject(n.LHS, beforeSuffix, \"•\")\n\t\tp.inject(n.RHS, afterPrefix, \"•\")\n\n\tcase *ast.BinaryOp:\n\t\tif n.Operator != \":\" {\n\t\t\tp.inject(n.LHS, beforeSuffix, \"•\")\n\t\t\tp.inject(n.RHS, afterPrefix, \"•\")\n\t\t}\n\n\tcase *ast.Block:\n\t\tp.align(n)\n\n\t\t// •{}•\n\t\tp.inject(n, beforePrefix, \"•\")\n\t\tp.inject(n, afterSuffix, \"•\")\n\n\t\tcst := p.CST(n).(*cst.Branch)\n\t\tif c := len(cst.Children); c > 0 {\n\t\t\tif cst.Children[0].Tok().String() == ast.OpBlockStart {\n\t\t\t\t// {•» statements... «•}\n\t\t\t\tp.inject(cst.Children[0], beforeSuffix, \"•»\")\n\t\t\t\tp.inject(cst.Children[c-1], afterPrefix, \"«•\")\n\t\t\t} else {\n\t\t\t\t// »statement«\n\t\t\t\tp.inject(n, beforePrefix, \"»\")\n\t\t\t\tp.inject(n, afterSuffix, \"«\")\n\t\t\t}\n\t\t}\n\n\tcase *ast.Branch:\n\t\t// indent multi-line conditionals\n\t\tp.inject(n.Condition, beforePrefix, \"»»\")\n\t\tp.inject(n.Condition, afterSuffix, \"««\")\n\n\t\tp.inject(n.Condition, afterPrefix, \"•\")\n\n\tcase *ast.Call:\n\t\tp.align(n)\n\t\tif c := len(n.Arguments); c > 0 {\n\t\t\tfor i, v := range n.Arguments {\n\t\t\t\tif i == 0 {\n\t\t\t\t\tp.inject(v, afterPrefix, \"\\t\")\n\t\t\t\t} else {\n\t\t\t\t\tp.inject(v, afterPrefix, \"•\\t\")\n\t\t\t\t}\n\t\t\t}\n\t\t\tp.inject(n.Target, beforeSuffix, \"»\")\n\t\t\tp.inject(n.Arguments[c-1], beforeSuffix, \"«\")\n\t\t}\n\n\tcase *ast.Case:\n\t\tp.inject(n, afterPrefix, \"•\")\n\t\tif c := len(n.Conditions); c > 0 {\n\t\t\tfor _, c := range n.Conditions {\n\t\t\t\tp.inject(c, afterPrefix, \"•\")\n\t\t\t}\n\t\t\tp.inject(n.Conditions[0], afterPrefix, \"»»\")\n\t\t\tp.inject(n.Conditions[c-1], beforeSuffix, \"««\")\n\t\t}\n\t\tblockCST := p.CST(n.Block)\n\t\tif !isNewline(blockCST) {\n\t\t\t// align:\n\t\t\t// case Foo: |•{ ... }•\n\t\t\t// case Blah:|•{ ... }•\n\t\t\tp.inject(n.Block, afterPrefix, \"\\t\")\n\t\t}\n\n\tcase *ast.Class:\n\t\tp.align(n)\n\t\tp.inject(n.Name, afterPrefix, \"•\")\n\t\tp.inject(n.Name, beforeSuffix, \"•\")\n\t\tif c := len(n.Fields); c > 0 {\n\t\t\tp.inject(n.Fields[0], beforePrefix, \"•»\")\n\t\t\tp.inject(n.Fields[c-1], beforeSuffix, \"«•\")\n\t\t}\n\tcase *ast.Clear:\n\n\tcase *ast.Delete:\n\t\tp.inject(n.Key, beforePrefix, \"•\")\n\n\tcase *ast.Default:\n\t\tp.inject(n, afterPrefix, \"•\")\n\t\tblockCST := p.CST(n.Block)\n\t\tif !isNewline(blockCST) {\n\t\t\t// align:\n\t\t\t// case Foo: |•{ ... }•\n\t\t\t// case Blah:|•{ ... }•\n\t\t\tp.inject(n.Block, afterPrefix, \"\\t\")\n\t\t}\n\n\tcase *ast.Definition:\n\t\tp.inject(n.Name, beforePrefix, \"•\\t\")\n\t\tp.inject(n.Name, afterSuffix, \"•\\t\")\n\n\tcase *ast.DeclareLocal:\n\t\tp.inject(n.Name, beforeSuffix, \"•\")\n\t\tp.inject(n.RHS, afterPrefix, \"•\")\n\n\tcase *ast.Enum:\n\t\tp.align(n)\n\t\tp.inject(n.Name, afterPrefix, \"•\")\n\t\tp.inject(n.Name, beforeSuffix, \"•\")\n\t\tif c := len(n.Entries); c > 0 {\n\t\t\tp.inject(n.Name, beforeSuffix, \"»\")\n\t\t\tp.inject(n.Entries[c-1], beforeSuffix, \"«\")\n\t\t}\n\n\tcase *ast.EnumEntry:\n\t\t//name[A• ]=[B•]value[C ]•// comment\n\t\tp.inject(n.Name, beforeSuffix, \"\\t•\") // A\n\t\tp.inject(n.Value, afterPrefix, \"\\t•\") // B\n\t\tp.inject(n, beforeSuffix, \"\\t•\") // C\n\n\tcase *ast.Field:\n\t\t//•type[A• ]name[B• ]=[C•]default[D ]•// comment\n\t\tp.inject(n.Type, beforePrefix, \"•\")\n\t\tp.inject(n.Name, afterPrefix, \"\\t•\") // A\n\t\tif n.Default != nil {\n\t\t\tp.inject(n.Name, beforeSuffix, \"\\t•\") // B\n\t\t\tp.inject(n.Default, afterPrefix, \"•\") // C\n\t\t\tp.inject(n.Default, beforeSuffix, \"\\t\") // D\n\t\t} else {\n\t\t\tp.inject(n.Name, beforeSuffix, \"\\t\\t\")\n\t\t}\n\n\tcase *ast.Function:\n\t\tp.align(n)\n\t\tc := len(n.Parameters) - 1\n\t\tret := n.Parameters[c]\n\t\tp.inject(n.Generic, afterPrefix, \"•\")\n\t\tp.inject(ret, afterPrefix, \"•\")\n\t\tfor i, v := range n.Parameters[:c] {\n\t\t\tif i == 0 {\n\t\t\t\tp.inject(v.Type, afterPrefix, \"\\t\")\n\t\t\t} else {\n\t\t\t\tp.inject(v.Type, afterPrefix, \"•\\t\")\n\t\t\t}\n\t\t\tp.inject(v.Name, afterPrefix, \"•\\t\")\n\t\t}\n\t\tif c > 0 {\n\t\t\tp.inject(n.Generic, afterPrefix, \"»»\")\n\t\t\tp.inject(n.Parameters[c-1], afterSuffix, \"««\")\n\t\t}\n\n\tcase *ast.Generic:\n\t\tif len(n.Arguments) > 0 {\n\t\t\tfor _, a := range n.Arguments[1:] {\n\t\t\t\tp.inject(a, afterPrefix, \"•\")\n\t\t\t}\n\t\t}\n\n\tcase *ast.Iteration:\n\t\tp.inject(n.Variable, afterPrefix, \"•\")\n\t\tp.inject(n.Variable, beforeSuffix, \"•\")\n\t\tp.inject(n.Iterable, afterPrefix, \"•\")\n\n\tcase *ast.MapIteration:\n\t\tp.inject(n.IndexVariable, afterPrefix, \"•\")\n\t\tp.inject(n.IndexVariable, beforeSuffix, \"•\")\n\t\tp.inject(n.KeyVariable, afterPrefix, \"•\")\n\t\tp.inject(n.KeyVariable, beforeSuffix, \"•\")\n\t\tp.inject(n.ValueVariable, afterPrefix, \"•\")\n\t\tp.inject(n.ValueVariable, beforeSuffix, \"•\")\n\t\tp.inject(n.Map, afterPrefix, \"•\")\n\n\tcase *ast.Import:\n\t\tp.inject(n.Path, afterPrefix, \"•\")\n\n\tcase *ast.NamedArg:\n\t\tp.inject(n.Value, afterPrefix, \"•\\t\")\n\n\tcase *ast.PointerType:\n\t\tif n.Const {\n\t\t\tp.inject(n.To, beforeSuffix, \"•\")\n\t\t}\n\n\tcase *ast.PreConst:\n\t\tp.inject(n.Type, afterPrefix, \"•\")\n\n\tcase *ast.Pseudonym:\n\t\tp.inject(n.To, afterPrefix, \"•\")\n\t\tp.inject(n.Name, afterPrefix, \"\\t•\")\n\n\tcase *ast.Return:\n\t\tp.inject(n.Value, afterPrefix, \"•\")\n\n\tcase *ast.Switch:\n\t\tcst := p.CST(n).(*cst.Branch)\n\t\tp.align(n)\n\t\tp.inject(n.Value, afterPrefix, \"•\")\n\t\tp.inject(n.Value, beforeSuffix, \"•\")\n\t\tp.inject(n.Value, afterSuffix, \"»\")\n\t\tp.inject(cst.Children[len(cst.Children)-1], beforePrefix, \"«\")\n\t}\n\n\tast.Visit(n, p.markup)\n}", "title": "" }, { "docid": "25121752132d2630a7e235870d6e5718", "score": "0.47254688", "text": "func (cmd RevertCmd) CreateMarkdown(wr io.Writer, commandStr string) error {\n\tap := cli.CreateRevertArgParser()\n\treturn CreateMarkdown(wr, cli.GetCommandDocumentation(commandStr, revertDocs, ap))\n}", "title": "" }, { "docid": "68df7965042d255ef6edc6cae69ffefa", "score": "0.47215837", "text": "func parsePostMarkdown(mdContent []byte, mode renderMode) string {\n\topts := html.RendererOptions{Flags: html.CommonFlags}\n\trenderer := &postRenderer{\n\t\thtmlRenderer: html.NewRenderer(opts),\n\t\tmode: mode,\n\t}\n\n\treturn string(markdown.ToHTML(mdContent, nil, renderer))\n}", "title": "" }, { "docid": "cdfa41ae9da4bd6b968befe3e4b919b2", "score": "0.4719974", "text": "func (fm AllJSONFormatter) Format() string {\n\tvar badges []badgeJSON\n\n\tfor _, badge := range fm.Badges {\n\t\tb := badgeJSON{\n\t\t\tBadge: badge,\n\t\t\tMarkdownContent: badge.Markdown(),\n\t\t}\n\t\tbadges = append(badges, b)\n\t}\n\n\tresult, err := json.Marshal(badges)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\n\treturn string(result)\n}", "title": "" }, { "docid": "963967665819b6b6a95239a2662adcf7", "score": "0.4714863", "text": "func markdownTable(t *[][]string) string {\n\tmaxLengthMap := make(map[int]int)\n\n\t//1st pass: populate maxLengthMap\n\tfor rowIndex, row := range *t {\n\t\tfor cellIndex, cell := range row {\n\t\t\tlength := len(cell)\n\t\t\tif rowIndex == 0 {\n\t\t\t\tlength += 4\n\t\t\t}\n\t\t\tif length > maxLengthMap[cellIndex] {\n\t\t\t\tmaxLengthMap[cellIndex] = length\n\t\t\t}\n\t\t}\n\t}\n\n\tvar b bytes.Buffer\n\tfor rowIndex, row := range *t {\n\t\tfor cellIndex, cell := range row {\n\t\t\tif rowIndex == 0 {\n\t\t\t\tcell = \"**\" + cell + \"**\"\n\t\t\t}\n\t\t\tif cellIndex == 0 {\n\t\t\t\tb.WriteByte('|')\n\t\t\t}\n\t\t\tb.WriteString(fmt.Sprintf(\"%-\"+strconv.Itoa(maxLengthMap[cellIndex])+\"s\", cell))\n\t\t\tb.WriteByte('|')\n\t\t}\n\t\tb.WriteByte('\\n')\n\t\tif rowIndex == 0 {\n\t\t\tfor cellIndex := range row {\n\t\t\t\tif cellIndex == 0 {\n\t\t\t\t\tb.WriteByte('|')\n\t\t\t\t}\n\t\t\t\tb.WriteByte(':')\n\t\t\t\tfor i := 0; i < (maxLengthMap[cellIndex] - 1); i++ {\n\t\t\t\t\tb.WriteByte('-')\n\t\t\t\t}\n\t\t\t\tb.WriteByte('|')\n\t\t\t}\n\t\t\tb.WriteByte('\\n')\n\t\t}\n\t}\n\tb.WriteByte('\\n')\n\treturn b.String()\n}", "title": "" }, { "docid": "df3aa70a33fc523406e190071b349ca7", "score": "0.4704228", "text": "func markdownCompile(input []byte) Post {\n\t//various regexes to interpret the markup\n\theadingRegex := regexp.MustCompile(\"^# (.*)\")\n\tsubheadingRegex := regexp.MustCompile(\"^## (.*)\")\n\tboldRegex := regexp.MustCompile(`(\\*\\*|__)(.*?)(\\*\\*|__)`)\n\titalicRegex := regexp.MustCompile(`(\\*|_)(.*?)(\\*|_)`)\n\timgRegex := regexp.MustCompile(`\\!\\[Image\\]\\((.*?)\\)`)\n\tlinkRegex := regexp.MustCompile(`\\[(.*?)\\]\\((.*?)\\)`)\n\tquoteRegex := regexp.MustCompile(\"^> (.*)\")\n\tlineRegex := regexp.MustCompile(`^ *(-+|\\*+) *$`)\n\tinlineCodeRegex := regexp.MustCompile(\"`(.*?)`\")\n\tulListRegex := regexp.MustCompile(`^\\s*(\\*|\\+) +(.*)`)\n\tolListRegex := regexp.MustCompile(`^ *(\\d)\\. +(.*)`)\n\n\t//this is for the markdown parser, I just made it so that if the first line is similar to:\n\t//[date: 2020-08-07]\n\t//it interprets that and saves that information\n\tdateRegex := regexp.MustCompile(`\\[date: (\\d+)-(\\d+)-(\\d+)\\]`)\n\n\tvar endProduct strings.Builder\n\tlines := strings.Split(string(input), \"\\n\")\n\tlines = append(lines, \"\")\n\tdocumentTitle := \"\"\n\tdate := \"\"\n\n\tinMultiLnCode := false\n\tinList := false\n\tlistNesting := 0\n\tlistStack := make([]ListItemInfo, 0)\n\n\tfor i, line := range lines {\n\t\tif line == \"```\" {\n\t\t\tinMultiLnCode = !inMultiLnCode\n\t\t\tif inMultiLnCode {\n\t\t\t\tendProduct.WriteString(\"<pre>\\n\")\n\t\t\t} else {\n\t\t\t\tendProduct.WriteString(\"</pre>\\n\")\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\t//if we are in a code segment, copy the original text verbatim\n\t\tif inMultiLnCode {\n\t\t\tendProduct.WriteString(line)\n\t\t\tendProduct.WriteString(\"\\n\")\n\t\t\tcontinue\n\t\t}\n\t\tnewLine := line\n\n\t\t//lists\n\n\t\t//inList stores whether the previous line was a list element or not\n\t\t//since lists of different types can be nested, the way we keep track of where we are\n\t\t//is with sort of a \"stack\". Every type an element has more indentation before it than\n\t\t//the previous line, it means it starts a nested list, so we push to the listStack\n\t\t//the type of list it is (<ul> or <ol>) and how indented it is (number of\n\t\t//preceding whitespace characters). This way, when we can close two nested lists at the same time\n\t\t//sort of like:\n\t\t//* list 1\n\t\t// * sublist 1\n\t\t// * sublist 2\n\t\t// * subsublist 1\n\t\t//* list 2 <-- here we close both sublists at the same time\n\t\tisList := ulListRegex.MatchString(line) || olListRegex.MatchString(line)\n\t\tif isList {\n\t\t\tlineWhitespace := precedingWhitespace(line)\n\n\t\t\telementIsUl := ulListRegex.MatchString(line)\n\n\t\t\tif !inList || lineWhitespace > listNesting {\n\t\t\t\t//if it has more whitespace than previous (as in: it is nested inside the previous element)\n\t\t\t\tif elementIsUl {\n\t\t\t\t\tlistStack = append(listStack, ListItemInfo{ulType, lineWhitespace})\n\t\t\t\t\tnewLine = \"<ul>\\n\"\n\t\t\t\t} else {\n\t\t\t\t\tlistStack = append(listStack, ListItemInfo{olType, lineWhitespace})\n\t\t\t\t\tnewLine = \"<ol>\\n\"\n\t\t\t\t}\n\t\t\t\tlistNesting = precedingWhitespace(line)\n\n\t\t\t} else if lineWhitespace < listNesting {\n\t\t\t\t//if it has less whitespace than previous (closes previous nest)\n\t\t\t\t//the real hard part is when you have to close two or more nested lists at the same time\n\t\t\t\t//we solve that with listStack which basically stores for every level of nesting the\n\t\t\t\t//type of list (numbered or not) and how much indentation it has\n\t\t\t\t//(number of spaces or tabs in the markdown code)\n\t\t\t\tnewLine = \"\"\n\t\t\t\tfor i := len(listStack) - 1; i >= 0; i-- {\n\t\t\t\t\tif listStack[i].Indentation > lineWhitespace {\n\t\t\t\t\t\tif listStack[i].Type == ulType {\n\t\t\t\t\t\t\tnewLine += \"</ul>\\n\"\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnewLine += \"</ol>\\n\"\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlistStack = listStack[:i]\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlistNesting = lineWhitespace\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t//just vibing\n\t\t\t\tnewLine = \"\"\n\t\t\t}\n\n\t\t\t//actually generate the <li> element\n\t\t\tif elementIsUl {\n\t\t\t\tnewLine += ulListRegex.ReplaceAllString(line, \"<li>$2</li>\")\n\t\t\t} else {\n\t\t\t\tnewLine += olListRegex.ReplaceAllString(line, \"<li>$2</li>\")\n\t\t\t}\n\t\t\tinList = true\n\t\t}\n\n\t\tnewLine = headingRegex.ReplaceAllString(newLine, \"<h1>$1</h1>\")\n\t\tnewLine = subheadingRegex.ReplaceAllString(newLine, \"<h3>$1</h3>\")\n\t\tnewLine = boldRegex.ReplaceAllString(newLine, \"<strong>$2</strong>\")\n\t\tnewLine = italicRegex.ReplaceAllString(newLine, \"<em>$2</em>\")\n\t\tnewLine = imgRegex.ReplaceAllString(newLine, `<img src=\"$1\"></img>`)\n\t\tnewLine = linkRegex.ReplaceAllString(newLine, `<a href=\"$2\">$1</a>`)\n\t\tnewLine = quoteRegex.ReplaceAllString(newLine, `<blockquote>$1</blockquote>`)\n\t\tnewLine = inlineCodeRegex.ReplaceAllString(newLine, `<code>$1</code>`)\n\n\t\tif !(headingRegex.MatchString(line) || subheadingRegex.MatchString(line) || quoteRegex.MatchString(line) || lineRegex.MatchString(line) || imgRegex.MatchString(line) || isList) && line != \"\" {\n\t\t\tnewLine = \"<p>\" + newLine + \"</p>\"\n\t\t}\n\n\t\tif lineRegex.MatchString(line) {\n\t\t\tnewLine = \"<hr>\"\n\t\t}\n\n\t\tif headingRegex.MatchString(line) && documentTitle == \"\" {\n\t\t\tdocumentTitle = headingRegex.ReplaceAllString(line, \"$1\")\n\t\t\tnewLine = \"\"\n\t\t}\n\n\t\tif i == 0 && dateRegex.MatchString(line) {\n\t\t\tdate = dateRegex.ReplaceAllString(line, \"$3/$2/$1\")\n\t\t\tnewLine = \"\"\n\t\t} else if i == 0 {\n\t\t\tdate = \"unknown date\"\n\t\t}\n\n\t\t//closes the list from the previous line after having parsed the markdown for this one\n\t\tif !isList && inList {\n\t\t\t//if the previous line was a list element, but this one is not, close the list(s)\n\t\t\tfor i := 0; i < len(listStack); i++ {\n\t\t\t\tswitch listStack[i].Type {\n\t\t\t\tcase ulType:\n\t\t\t\t\tnewLine = \"</ul>\\n\" + newLine\n\t\t\t\tcase olType:\n\t\t\t\t\tnewLine = \"</ol>\\n\" + newLine\n\t\t\t\t}\n\t\t\t\tlistStack = listStack[i:]\n\t\t\t}\n\t\t\t//reinitialize listStack as an empty slice\n\t\t\t//probably not the way you should do it, but I can't think of anything else right now\n\t\t\tlistStack = make([]ListItemInfo, 0)\n\t\t\tinList = false\n\t\t}\n\n\t\tendProduct.WriteString(newLine)\n\t\tendProduct.WriteString(\"\\n\")\n\t}\n\n\treturn Post{Content: endProduct.String(), Title: documentTitle, PublicationDate: date}\n}", "title": "" }, { "docid": "3a242453e892bd4d32d2cc776d9e3eec", "score": "0.46969497", "text": "func GenMarkdown(cmd *cobra.Command, w io.Writer) error {\n\tcmd.InitDefaultHelpCmd()\n\tcmd.InitDefaultHelpFlag()\n\n\tname := cmd.CommandPath()\n\n\tshort := cmd.Short\n\tlong := cmd.Long\n\tif len(long) == 0 {\n\t\tlong = short\n\t}\n\n\t_, err := fmt.Fprintf(w, \"## %s\\n\\n\", name)\n\tif err == nil {\n\t\t_, err = fmt.Fprintf(w, \"%s\\n\\n\", short)\n\t}\n\tif err == nil {\n\t\t_, err = fmt.Fprintf(w, \"**Synopsis**\\n\\n%s\\n\\n\", long)\n\t}\n\n\tif err == nil && cmd.Runnable() {\n\t\t_, err = fmt.Fprintf(w, \"```\\n%s\\n```\\n\\n\", cmd.UseLine())\n\t}\n\n\tif err == nil && len(cmd.Example) > 0 {\n\t\t_, err = fmt.Fprintf(w, \"**Examples**\\n\\n```\\n%s\\n```\\n\\n\", cmd.Example)\n\t}\n\n\t// we want global options to be at the end of the document\n\tif err == nil && cmd.HasParent() {\n\t\terr = printOptions(w, cmd, name)\n\t}\n\n\tif err == nil {\n\t\terr = printSubcommands(w, cmd)\n\t}\n\n\tif err == nil && !cmd.HasParent() {\n\t\terr = printOptions(w, cmd, name)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "f64c2d4bca85b20b11fb45871374bf07", "score": "0.46826628", "text": "func item_mdTemplate() string {\n\tvar tmpl = \"{{- with .Data -}}\\n\" +\n\t\t\"# [{{ .Name }}]({{ .PublicUrl }})\\n\" +\n\t\t\"\\n\" +\n\t\t\"By: [{{ .Creator.Name }}]({{ .Creator.PublicUrl }}) {{ .Added }}\\n\" +\n\t\t\"\\n\" +\n\t\t\"## Summary: \\n\" +\n\t\t\"\\n\" +\n\t\t\"{{ .Description }}\\n\" +\n\t\t\"\\n\" +\n\t\t\"## Print Settings\\n\" +\n\t\t\"\\n\" +\n\t\t\"{{ with printSettings . }}\\n\" +\n\t\t\"\\n\" +\n\t\t\"### Printer Brand\\n\" +\n\t\t\"\\n\" +\n\t\t\"{{ .PrinterBrand }}\\n\" +\n\t\t\"\\n\" +\n\t\t\"### Printer\\n\" +\n\t\t\"\\n\" +\n\t\t\"{{ .Printer }}\\n\" +\n\t\t\"\\n\" +\n\t\t\"### Resolution\\n\" +\n\t\t\"\\n\" +\n\t\t\"{{ .Resolution }}\\n\" +\n\t\t\"\\n\" +\n\t\t\"### Infill\\n\" +\n\t\t\"\\n\" +\n\t\t\"{{ .Infill }}\\n\" +\n\t\t\"\\n\" +\n\t\t\"### Filament\\n\" +\n\t\t\"\\n\" +\n\t\t\"{{ .FilamentBrand }}\\n\" +\n\t\t\"{{ .FilamentColor }}\\n\" +\n\t\t\"{{ .FilamentMaterial }}\\n\" +\n\t\t\"\\n\" +\n\t\t\"### Notes\\n\" +\n\t\t\"\\n\" +\n\t\t\"{{ .Notes }}\\n\" +\n\t\t\"\\n\" +\n\t\t\"{{ end }}\\n\" +\n\t\t\"\\n\" +\n\t\t\"## Custom Section\\n\" +\n\t\t\"\\n\" +\n\t\t\"{{ range (customSections .) }}\\n\" +\n\t\t\"{{ .Video }}\\n\" +\n\t\t\"{{ end }}\\n\" +\n\t\t\"\\n\" +\n\t\t\"## Tags\\n\" +\n\t\t\"\\n\" +\n\t\t\"## Design Tools\\n\" +\n\t\t\"\\n\" +\n\t\t\"## License\\n\" +\n\t\t\"\\n\" +\n\t\t\"{{ .License }}\\n\" +\n\t\t\"\\n\" +\n\t\t\"## Thing Statistics\\n\" +\n\t\t\"\\n\" +\n\t\t\"{{ .ViewCount }} Views\\n\" +\n\t\t\"{{ .DownloadCount }} Downloads\\n\" +\n\t\t\"\\n\" +\n\t\t\"{{ end -}}\\n\" +\n\t\t\"\"\n\treturn tmpl\n}", "title": "" }, { "docid": "10609cb5c703b0c2c14d5a1123b7f246", "score": "0.46807826", "text": "func bfrRender(input []byte) (output []byte) {\n\tbfr := BFRenderer()\n\treturn blackfriday.Markdown(input, bfr, bfrExtensions())\n}", "title": "" }, { "docid": "309b8a5c51c3f7d68982bdf58405d30c", "score": "0.46758354", "text": "func NewMarkdown(w io.WriteCloser, options Options) *Markdown {\n\treturn &Markdown{w, options}\n}", "title": "" }, { "docid": "3579be43c20222632bb6af15ca5f3c27", "score": "0.46730748", "text": "func (s Schema) GetMarkdownDescription() string {\n\treturn \"\"\n}", "title": "" }, { "docid": "e6ac8ceb6d2a121f05913e3d44b4c96e", "score": "0.4672886", "text": "func FormatRepo(repo string) string {\n\treturn fmt.Sprintf(\"<font color=\\\"#FF00FF\\\">%s</font>\", html.EscapeString(repo))\n}", "title": "" }, { "docid": "81445cb81a3ca90a69b05437464782fe", "score": "0.46688312", "text": "func (MarkdownFormatter) Format(element Element) string {\n\tswitch el := element.(type) {\n\tcase *Document:\n\t\treturn html.EscapeString(el.Title) + \"\\n==========\\n\\n\" + Markdown.formatContent(el.Contents())\n\tcase *Italic:\n\t\treturn \"_\" + Markdown.formatContent(el.Contents()) + \"_\"\n\tcase *Bold:\n\t\treturn \"**\" + Markdown.formatContent(el.Contents()) + \"**\"\n\tcase *LineBreak:\n\t\treturn \" \\n\"\n\tcase *Paragraph:\n\t\treturn Markdown.formatContent(el.Contents()) + \"\\n\\n\"\n\tcase *Image:\n\t\treturn \"![\" + html.EscapeString(el.Description) + \"](\" + html.EscapeString(el.URL) + \")\"\n\tcase *Link:\n\t\treturn \"[\" + Markdown.formatContent(el.Contents()) + \"](\" + html.EscapeString(el.URL) + \")\"\n\tcase *LeafElement:\n\t\treturn html.EscapeString(el.Text)\n\tcase *Article:\n\t\treturn \"## \" + el.Title + \"\\n\\n\" + el.Timestamp.Format(\"15:04 2 Jan 2006\") + \"\\n\\n\" + Markdown.formatContent(el.Contents())\n\t}\n\treturn fmt.Sprintf(\"%#v\", element)\n}", "title": "" }, { "docid": "726fdb3afda4299262df08bb07c20ee2", "score": "0.4662712", "text": "func (wk *Worker) parseMarkdown(mdPath string) (meta model.Metadata, htmlContent template.HTML, err error) {\n\t// Open file\n\tf, err := os.Open(mdPath)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer f.Close()\n\n\t// Separate metadata and content of file\n\tseparatorCount := 0\n\tmetaBuffer := bytes.NewBuffer(nil)\n\tcontentBuffer := bytes.NewBuffer(nil)\n\n\tscanner := bufio.NewScanner(f)\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tif strings.TrimSpace(line) == \"+++\" {\n\t\t\tseparatorCount++\n\t\t\tcontinue\n\t\t}\n\n\t\tif separatorCount == 1 {\n\t\t\tmetaBuffer.WriteString(line)\n\t\t\tmetaBuffer.WriteString(\"\\n\")\n\t\t} else {\n\t\t\tcontentBuffer.WriteString(line)\n\t\t\tcontentBuffer.WriteString(\"\\n\")\n\t\t}\n\t}\n\n\t// Parse metadata\n\terr = toml.NewDecoder(metaBuffer).Decode(&meta)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Parse markdown\n\tbtHTML, err := convertMarkdownToHTML(contentBuffer.Bytes())\n\tif err != nil {\n\t\treturn\n\t}\n\n\thtmlContent = template.HTML(btHTML)\n\treturn\n}", "title": "" } ]
c0853a07ea8984d4877a2a1511d64209
SyncTimeout send data to CCStorage queue with timeout
[ { "docid": "7b1d11b2a916babb77a90a0c7a3684d4", "score": "0.7658273", "text": "func (cc *CCStorage) SyncTimeout(data *types.BcsSyncData, timeout time.Duration) error {\n\tif data == nil {\n\t\tblog.Error(\"SyncTimeout BcsSyncData data is nil\")\n\t\treturn nil\n\t}\n\n\tselect {\n\tcase cc.queue <- data:\n\t\tutil.ReportHandlerQueueLengthInc(cc.ClusterID, handlerCCStore)\n\tcase <-time.After(timeout):\n\t\tblog.Warn(\"CCStorage SyncTimeout handler data into queue timeout\")\n\t\tutil.ReportHandlerDiscardEvents(cc.ClusterID, handlerCCStore)\n\t}\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "ab4188a72de575424875e855e5595f98", "score": "0.63114136", "text": "func TimeoutSendStorageRequest(storageChannel chan *Request, request *Request, maxTime int) bool {\n\ttimeout := time.After(time.Duration(maxTime) * time.Second)\n\tselect {\n\tcase storageChannel <- request:\n\t\treturn true\n\tcase <-timeout:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "01185bc10074d8267d7bb7ffee966199", "score": "0.60078883", "text": "func (cc *CCStorage) Sync(data *types.BcsSyncData) error {\n\tif data == nil {\n\t\tblog.Error(\"CCWriter get nil BcsInstance pointer\")\n\t\treturn nil\n\t}\n\n\tcc.queue <- data\n\tutil.ReportHandlerQueueLengthInc(cc.ClusterID, handlerCCStore)\n\treturn nil\n}", "title": "" }, { "docid": "282bf80bed96068a276fa18176a5ce55", "score": "0.57119405", "text": "func (jss *JetstreamStore) Sync(timeout time.Duration) error {\n\t// To figure out when we've processed the backlog of messages we're going to publish a dummy \"sync\" message\n\t// and wait for it to come back to us\n\tsm := syncMessage{\n\t\tID: uuid.NewString(),\n\t}\n\tjss.syncMessageLock.Lock()\n\tjss.syncMessageChan = make(chan struct{})\n\tjss.syncMessageSeq = sm.ID\n\tjss.syncMessageLock.Unlock()\n\n\t_, err := jss.js.Publish(jss.syncEvent, util.MustJsonByteSlice(sm))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"publish sync\")\n\t}\n\n\t// And return when we got our \"sync\" message back\n\tselect {\n\tcase <-time.After(timeout):\n\t\treturn SyncTimeoutErr\n\tcase <-jss.syncMessageChan:\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "89a37f6f34b7bf29e9adb7a326c62eb4", "score": "0.5623216", "text": "func (this *sync_conn) WriteTimeout(delay time.Duration, body interface{}) (err error) {\n\tselect {\n\tcase <-this.Done():\n\t\terr = this.Err()\n\tcase <-time.After(delay):\n\t\terr = context.DeadlineExceeded\n\tcase this.blockCh <- body:\n\t\t//\tdefault:\n\t\t//\t\terr = fmt.Errorf(\"write error: blocking channel\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "eb8494eb5ec0278dd058031083d3382a", "score": "0.5508708", "text": "func (s Storage) PutWorkerTimeout(ctx context.Context, d time.Duration) error {\n\tdata := strconv.FormatInt(int64(d), 10)\n\treturn s.put(ctx, KeyWorkerTimeout, data)\n}", "title": "" }, { "docid": "8cc12c01fde2def98ebe0cdc07192e2a", "score": "0.5367476", "text": "func (o *WriteToMicrostorageParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "bfa5c91fcf9a565db1ae2a39e6c6b3ac", "score": "0.53628576", "text": "func (s *Store) sync(index uint64, timeout time.Duration) error {\n\tticker := time.NewTicker(100 * time.Millisecond)\n\tdefer ticker.Stop()\n\n\ttimer := time.NewTimer(timeout)\n\tdefer timer.Stop()\n\n\tfor {\n\t\t// Wait for next tick or timeout.\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\tcase <-timer.C:\n\t\t\treturn errors.New(\"timeout\")\n\t\t}\n\n\t\t// Compare index against current metadata.\n\t\ts.mu.Lock()\n\t\tok := (s.data.Index >= index)\n\t\ts.mu.Unlock()\n\n\t\t// Exit if we are at least at the given index.\n\t\tif ok {\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "19650e3f3b79051eff8d58b177ddc808", "score": "0.5249851", "text": "func (target *RedisTarget) send(eventData event.Event) error {\n\tconn := target.pool.Get()\n\tdefer func() {\n\t\tcErr := conn.Close()\n\t\tlogger.LogOnceIf(context.Background(), cErr, target.ID())\n\t}()\n\n\tif target.args.Format == event.NamespaceFormat {\n\t\tobjectName, err := url.QueryUnescape(eventData.S3.Object.Key)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tkey := eventData.S3.Bucket.Name + \"/\" + objectName\n\n\t\tif eventData.EventName == event.ObjectRemovedDelete {\n\t\t\t_, err = conn.Do(\"HDEL\", target.args.Key, key)\n\t\t} else {\n\t\t\tvar data []byte\n\t\t\tif data, err = json.Marshal(struct{ Records []event.Event }{[]event.Event{eventData}}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t_, err = conn.Do(\"HSET\", target.args.Key, key, data)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif target.args.Format == event.AccessFormat {\n\t\tdata, err := json.Marshal([]interface{}{eventData.EventTime, []event.Event{eventData}})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif _, err := conn.Do(\"RPUSH\", target.args.Key, data); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "70e8c313fb610965ce740991cef124ad", "score": "0.517917", "text": "func Send(fd int, packet []byte, timeout time.Duration) (err error) {\n\tvar (\n\t\tlogp = `Send`\n\t\ttimeval = unix.Timeval{}\n\n\t\terrno syscall.Errno\n\t\tmax int\n\t\tn int\n\t\tok bool\n\t)\n\n\terr = unix.SetNonblock(fd, false)\n\tif err != nil {\n\t\treturn fmt.Errorf(`%s: SetNonblock: %w`, logp, err)\n\t}\n\n\tif timeout > 0 {\n\t\ttimeval.Sec = int64(timeout.Seconds())\n\t\terr = unix.SetsockoptTimeval(fd, unix.SOL_SOCKET, unix.SO_SNDTIMEO, &timeval)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(`%s: SetsockoptTimeval: %w`, logp, err)\n\t\t}\n\t}\n\n\tfor len(packet) > 0 {\n\t\tif len(packet) < maxBuffer {\n\t\t\tmax = len(packet)\n\t\t} else {\n\t\t\tmax = maxBuffer\n\t\t}\n\n\t\tn, err = unix.Write(fd, packet[:max])\n\t\tif err != nil {\n\t\t\terrno, ok = err.(unix.Errno)\n\t\t\tif ok {\n\t\t\t\tif errno == unix.EINTR {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif errno == unix.EAGAIN || errno == unix.EWOULDBLOCK {\n\t\t\t\t\treturn fmt.Errorf(`%s: %w`, logp, os.ErrDeadlineExceeded)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn fmt.Errorf(`%s: Write: %w`, logp, err)\n\t\t}\n\n\t\tif n > 0 {\n\t\t\tpacket = packet[n:]\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "33f07cf0f182abaf9ff146c7f3977f40", "score": "0.5148461", "text": "func (mb *rtuTcpTransporter) flush(b []byte) (err error) {\n\tif err = mb.conn.SetReadDeadline(time.Now().Add(50 * time.Millisecond)); err != nil {\n\t\treturn\n\t}\n\t// Timeout setting will be reset when reading\n\tif _, err = mb.conn.Read(b); err != nil {\n\t\t// Ignore timeout error\n\t\tif netError, ok := err.(net.Error); ok && netError.Timeout() {\n\t\t\terr = nil\n\t\t}\n\t}\n\tmb.logf(\"modbus: flushed % x\\n\", b)\n\treturn\n}", "title": "" }, { "docid": "1fc2e3f536d39240867445f45fdef570", "score": "0.5147367", "text": "func (s *MemSink) Sync() error { return nil }", "title": "" }, { "docid": "cb5842ab7e973b828e436f9dce360346", "score": "0.5109965", "text": "func (s *shardCollection) sendSamples(client StorageClient, samples []*retrieval.MetricFamily) {\n\treq := s.translator.ToCreateTimeSeriesRequest(samples)\n\tbackoff := s.qm.cfg.MinBackoff\n\tfor retries := s.qm.cfg.MaxRetries; retries > 0; retries-- {\n\t\tbegin := time.Now()\n\t\terr := client.Store(req)\n\n\t\tsentBatchDuration.WithLabelValues(s.qm.queueName).Observe(time.Since(begin).Seconds())\n\t\tif err == nil {\n\t\t\tsucceededSamplesTotal.WithLabelValues(s.qm.queueName).Add(float64(len(samples)))\n\t\t\treturn\n\t\t}\n\n\t\tif _, ok := err.(recoverableError); !ok {\n\t\t\tlevel.Warn(s.qm.logger).Log(\"msg\", \"Unrecoverable error sending samples to remote storage\", \"err\", err)\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(backoff)\n\t\tbackoff = backoff * 2\n\t\tif backoff > s.qm.cfg.MaxBackoff {\n\t\t\tbackoff = s.qm.cfg.MaxBackoff\n\t\t}\n\t}\n\n\tfailedSamplesTotal.WithLabelValues(s.qm.queueName).Add(float64(len(samples)))\n}", "title": "" }, { "docid": "77f569fb1a1336e7f44dbc1e43142b78", "score": "0.5041793", "text": "func (c *connection) write(mt int, payload []byte) error {\n c.ws.SetWriteDeadline(time.Now().Add(time.Duration(Conf.Websocket.WriteWait) * time.Second))\n return c.ws.WriteMessage(mt, payload)\n}", "title": "" }, { "docid": "877d4e0d4e30a0e1497d52549a83cc66", "score": "0.5028034", "text": "func (c *s3Client) sendAsync(bw *bufferedEncoder, wg *sync.WaitGroup, ex *executor) {\n\tif bw.BytesLen() == 0 {\n\t\tc.errorf(\"empty buffer, send is not possible\")\n\t\treturn\n\t}\n\n\tmsgs := bw.TotalMsgs()\n\tbuf, err := bw.CommitBuffer()\n\tif err != nil {\n\t\tc.errorf(\"can't flush gzip, send is not possible\")\n\t\treturn\n\t}\n\n\twg.Add(1)\n\n\tif !ex.do(func() {\n\t\tdefer wg.Done()\n\t\tdefer func() {\n\t\t\t// In case a bug is introduced in the send function that triggers\n\t\t\t// a panic, we don't want this to ever crash the application so we\n\t\t\t// catch it here and log it instead.\n\t\t\tif err := recover(); err != nil {\n\t\t\t\tc.errorf(\"panic - %s\", err)\n\t\t\t}\n\t\t}()\n\t\tc.send(buf, msgs)\n\t}) {\n\t\twg.Done()\n\t\tc.errorf(\"sending messages failed - %s\", ErrTooManyRequests)\n\t\tc.notifyFailureMsg(&c.tagsOnlyMsg, ErrTooManyRequests, int64(bw.TotalMsgs()))\n\t}\n}", "title": "" }, { "docid": "2ec1d2ade88a7ce7fb8bd2627b3f032b", "score": "0.50236964", "text": "func (t *PodHandler) sendScheduleRequest(key string, timestamp time.Time, queueName string) bool{\r\n\r\n timeElapsed := time.Since(timestamp);\r\n\r\n respBytes, err := json.Marshal(communication.ScheduleRequest{Key:key,NextBackOffTime:2,ProcessedTime:timeElapsed,Message: \"\"})\r\n if err != nil {\r\n log.Fatalf(\"%s\", err)\r\n }\r\n\r\n err = t.comm.Send(respBytes,queueName)\r\n\r\n if err != nil{\r\n return false\r\n }\r\n\r\n return true\r\n}", "title": "" }, { "docid": "de57530c3532b675641ef5a38761ed7a", "score": "0.4996929", "text": "func (s *Server) Sync(msg *broker.Msg) {\n\n}", "title": "" }, { "docid": "0e08bb8113b4f1f19817f217f6ff9656", "score": "0.49699044", "text": "func sendSession(ctx context.Context, q *servicebus.Queue) error {\n\tsessionuuid, err := uuid.NewV4()\n\tif err != nil {\n\t\treturn err\n\t}\n\tsessionid := sessionuuid.String()\n\tlog := log.With().Str(\"SID\", sessionid).Logger()\n\tmsgcount := rand.Intn(msgCountUpperBound) + 1\n\n\td := time.Duration(math.Abs(rand.NormFloat64()*msgdelaystddev)) * time.Second\n\tfor i := 1; i <= msgcount; i++ {\n\n\t\tt := time.NewTimer(d)\n\t\tselect {\n\t\tcase <-t.C:\n\t\t\tvar msg *servicebus.Message\n\t\t\tif i < msgcount {\n\t\t\t\tmsg = servicebus.NewMessageFromString(fmt.Sprintf(\"Message %v/%v\", i, msgcount))\n\t\t\t} else {\n\t\t\t\tmsg = servicebus.NewMessageFromString(\"Shutdown\")\n\t\t\t}\n\t\t\tmsg.SessionID = &sessionid\n\t\t\tif err := q.Send(ctx, msg); err != nil {\n\t\t\t\tif !errors.Is(err, context.Canceled) {\n\t\t\t\t\tlog.Err(err).Msg(\"q.Send()\")\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase <-ctx.Done():\n\t\t\tif !t.Stop() {\n\t\t\t\tlog.Debug().Msg(\"Draining sendTimer\")\n\t\t\t\t<-t.C\n\t\t\t}\n\t\t\treturn ctx.Err()\n\t\t}\n\n\t}\n\tlog.Info().Msgf(\"Finished sending %v\", msgcount)\n\treturn nil\n}", "title": "" }, { "docid": "560f4a31ed7160212904751b3286ee61", "score": "0.49456957", "text": "func (tq TaskQueue) ExecuteTask(rc *recordcontrol.RecordControl) {\n for {\n cmd := <-tq.Queue\n cmdType := cmd.Command\n\n log.Printf(\"INFO: Executing task on taskqueue: %s\",cmdType)\n\n switch cmdType {\n case \"GetStatus\":\n cmd.FeedbackChannel <- rc.TaskGetStatus()\n case \"GetConfig\":\n cmd.FeedbackChannel <- rc.TaskGetConfig()\n case \"SetConfig\":\n // Convert cam and mic lists\n data := cmd.Data.(map[string]interface{})\n cams_cfg, cams_ok := data[\"Cameras\"].([]interface{})\n mics_cfg, mics_ok := data[\"Microphones\"].([]interface{})\n if !cams_ok || !mics_ok {\n log.Print(\"WARNING: Error running type assertion (TQ:SetConfig).\")\n cmd.FeedbackChannel <- []byte(\"\")\n } else {\n cams := make([]int, len(cams_cfg))\n mics := make([]int, len(mics_cfg))\n for i,cam := range cams_cfg {\n cam_float, cams_ok := cam.(float64)\n if cams_ok {\n cams[i] = int(cam_float)\n }\n }\n for j,mic := range mics_cfg {\n mic_float, mics_ok := mic.(float64)\n if mics_ok {\n mics[j] = int(mic_float)\n }\n }\n\n if !cams_ok || !mics_ok {\n log.Print(\"WARNING Error running type assertion (TQ:SetConfig).\")\n cmd.FeedbackChannel <- []byte(\"\")\n }\n\n // Force subject id to be a string \n sid, ok := data[\"Sid\"].(string)\n if !ok {\n log.Printf(\"WARNING: subject id is not a string.\")\n sid = \"None\"\n }\n\n // Force RecFolder to be a string \n recfolder, ok := data[\"RecFolder\"].(string)\n if !ok {\n log.Printf(\"WARNING: RecFolder id is not a string.\")\n recfolder = \"None\"\n }\n\n recConfig := recordcontrol.RecordConfig{Cameras: cams, Microphones: mics, Sid: sid, RecFolder: recfolder}\n cmd.FeedbackChannel <- rc.TaskSetConfig(recConfig)\n }\n case \"StartRecording\":\n cmd.FeedbackChannel <- rc.TaskStartRecording()\n case \"StopRecording\":\n cmd.FeedbackChannel <- rc.TaskStopRecording()\n case \"Data\":\n data, data_ok := cmd.Data.(map[string]interface{})\n\n if data_ok {\n trigger, trigger_ok := data[\"Trigger\"].(string)\n recvTime, recvTime_ok := data[\"recvTime\"].(time.Time)\n if !trigger_ok || !recvTime_ok {\n cmd.FeedbackChannel <- []byte(\"\")\n } else {\n cmd.FeedbackChannel <- rc.TaskSaveSubtitleEntry(trigger, recvTime)\n }\n } else {\n cmd.FeedbackChannel <- []byte(\"\")\n }\n case \"Shutdown\":\n _ = rc.TaskStopRecording()\n cmd.FeedbackChannel <- []byte(\"\")\n shutdown_cmd := exec.Command(\"shutdown\",\"-h\",\"now\")\n err := shutdown_cmd.Run()\n if err != nil {\n log.Printf(\"WARNING: Could not shutdown (%s)\",err)\n } else {\n log.Printf(\"INFO: Shutting down server.\")\n }\n case \"ReturnError\":\n cmd.FeedbackChannel <- []byte(\"\")\n default:\n cmd.FeedbackChannel <- []byte(\"\")\n }\n }\n}", "title": "" }, { "docid": "336f4c1b23781f589fa4bf2b52dc2183", "score": "0.4934878", "text": "func (c *DataVolumeController) enqueueDataVolume(obj interface{}) {\n\tvar key string\n\tvar err error\n\tif key, err = cache.MetaNamespaceKeyFunc(obj); err != nil {\n\t\truntime.HandleError(err)\n\t\treturn\n\t}\n\tc.workqueue.AddRateLimited(key)\n}", "title": "" }, { "docid": "65b3667b9fd259b5a91bf0550848f170", "score": "0.49321255", "text": "func (producer *putProducer) queueBlobForTransfer(blob *helperModels.BlobDescription, bucketName string, jobId string) (bool, error) {\n if producer.processedBlobTracker.IsProcessed(*blob) {\n return false, nil // this was already processed\n }\n\n curWriteObj, ok := producer.writeObjectMap[blob.Name()]\n if !ok {\n err := fmt.Errorf(\"failed to find object associated with blob in object map: %s offset=%d length=%d\", blob.Name(), blob.Offset(), blob.Length())\n producer.Errorf(\"unrecoverable error: %v\", err)\n producer.processedBlobTracker.MarkProcessed(*blob)\n return false, err // fatal error occurred\n }\n\n if curWriteObj.ChannelBuilder == nil {\n err := fmt.Errorf(\"failed to transfer object, it does not have a channel builder: %s\", curWriteObj.PutObject.Name)\n producer.Errorf(\"unrecoverable error: %v\", err)\n producer.processedBlobTracker.MarkProcessed(*blob)\n return false, err // fatal error occurred\n }\n\n if curWriteObj.ChannelBuilder.HasFatalError() {\n // a fatal error happened on a previous blob for this file, skip processing\n producer.Warningf(\"fatal error occurred while transferring previous blob on this file, skipping blob %s offset=%d length=%d\", blob.Name(), blob.Offset(), blob.Length())\n producer.processedBlobTracker.MarkProcessed(*blob)\n return false, nil // not actually transferring this blob\n }\n\n if !curWriteObj.ChannelBuilder.IsChannelAvailable(blob.Offset()) {\n producer.Debugf(\"channel is not currently available for blob %s offset=%d length=%d\", blob.Name(), blob.Offset(), blob.Length())\n // Not ready to be transferred\n producer.deferredBlobQueue.Push(blob)\n return false, nil // not ready to be sent\n }\n\n producer.Debugf(\"channel is available for blob %s offset=%d length=%d\", curWriteObj.PutObject.Name, blob.Offset(), blob.Length())\n // Blob ready to be transferred\n\n // Create transfer operation\n objInfo := putObjectInfo{\n blob: *blob,\n channelBuilder: curWriteObj.ChannelBuilder,\n bucketName: bucketName,\n jobId: jobId,\n }\n\n transfer := producer.transferOperationBuilder(objInfo)\n\n // Increment wait group, and enqueue transfer operation\n producer.waitGroup.Add(1)\n *producer.queue <- transfer\n\n // Mark blob as processed\n producer.processedBlobTracker.MarkProcessed(*blob)\n\n return true, nil\n}", "title": "" }, { "docid": "8c76fcb1b0d50078e1091ab0e9f3ca7e", "score": "0.4898766", "text": "func (core *SentryCore) Sync() error {\n\tflushed := core.hub.Flush(time.Second * 5)\n\tif !flushed {\n\t\treturn ErrFlushTimeout\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7903a2436b6e327ee84c351bb84358b1", "score": "0.4895672", "text": "func PutSendAndWaitACK(buf []byte, sdfsFilename string, timestamp time.Time) bool {\n\tfmt.Println(\"enter mp3 function\")\n\t// generate msg, hash, build tcp connection and write\n\tmyMsg := &fileTransfer.FileTransfer{} //membership\n\tmyMsg.Source = uint32(myID)\n\tmyMsg.SdfsFilename = sdfsFilename\n\tmyMsg.Command = PUT\n\tmyMsg.File = buf\n\tmsgTime, err := ptypes.TimestampProto(timestamp)\n\tif err != nil {\n\t\tfmt.Println(\"Error parsing time.\", err.Error())\n\t\treturn false\n\t}\n\tmyMsg.Timestamp = msgTime\n\n\ttargetIdx := util.HashToVMIdx(sdfsFilename)\n\tfor i := 0; i < replicaNum; i++ {\n\t\tfor !sMembershipList[targetIdx] {\n\t\t\ttargetIdx++\n\t\t\ttargetIdx = uint32(util.ModLength(int(targetIdx), listLength))\n\t\t}\n\t\tfmt.Printf(\"targetIdx: %d\\n\", targetIdx+1)\n\t\terr := util.SendWithMarshal(filePort, int(targetIdx), myMsg)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\ttargetIdx++\n\t\ttargetIdx = uint32(util.ModLength(int(targetIdx), listLength))\n\t}\n\n\t// wait for quorum ack\n\tackNum := 0\n\ttimer := time.NewTimer(10 * time.Second)\n\n\tfor ackNum < quorum {\n\t\tselect {\n\t\tcase <-timer.C:\n\t\t\tfmt.Println(\"Did not get enough ACKs before timeout.\")\n\t\t\treturn false\n\t\tcase newACK := <-ackPutChan:\n\t\t\tif newACK.GetSdfsFilename() == sdfsFilename {\n\t\t\t\tackNum++\n\t\t\t}\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "254247ae3677ba3d765db323c604a95a", "score": "0.48954275", "text": "func (c *Client) callTimeout(reqid uint64, method uint8, oid string, body []byte, timeout time.Duration) (resp xbytes.Buffer, err error) {\n\n\tif timeout == 0 {\n\t\ttimeout = c.RequestTimeout\n\t}\n\n\tvar ob [16]byte // Using byte array to save function stack space.\n\terr = xhex.Decode(ob[:16], xstrconv.ToBytes(oid))\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar ar *asyncResult\n\tif ar, err = c.callAsync(reqid, method, ob, body); err != nil {\n\t\treturn nil, err\n\t}\n\n\tt := acquireTimer(timeout)\n\n\tselect {\n\tcase <-ar.done:\n\t\tresp, err = ar.respBody, ar.err\n\t\tif err != nil {\n\t\t\tif resp != nil {\n\t\t\t\t_ = resp.Close() // In case of passing resp when there is an error.\n\t\t\t}\n\t\t\tresp = nil\n\t\t}\n\n\t\treleaseAsyncResult(ar)\n\tcase <-t.C:\n\t\t// Cancel will be captured in write preparation, asyncResult will be released there.\n\t\t// Or it has been sent, just waiting for the response.\n\t\t//\n\t\t// If write broken, ar may not be put back to the pool.\n\t\tar.cancel()\n\t\tresp = nil\n\t\terr = xrpc.ErrTimeout\n\t}\n\n\treleaseTimer(t)\n\treturn\n}", "title": "" }, { "docid": "7f9a59b7ab84da3ab713738922a8068a", "score": "0.4892213", "text": "func (b *AsyncWriter) sendData() error {\n\t// flush the result channel to collect eventual errors\n\thaveResults := true\n\tfor haveResults {\n\t\tselect {\n\t\tcase err := <-b.resultChan:\n\t\t\tb.countRcvd++\n\t\t\tif err != nil && b.err == nil {\n\t\t\t\tb.err = err\n\t\t\t}\n\t\tdefault:\n\t\t\thaveResults = false\n\t\t}\n\t}\n\tif b.err != nil {\n\t\treturn b.err\n\t}\n\n\t// send the buffer if we have anything to send\n\tif b.n != 0 {\n\t\tb.countSent++\n\t\tb.dataChan <- b.buf[0:b.n]\n\t\tb.buf = make([]byte, b.size)\n\t\tb.n = 0\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "400e38943af04950a51bde7279c389b3", "score": "0.48698783", "text": "func SendData(filepath, sdfsFileName, dstFileName, dstID string) {\n\tstartTime := time.Now()\n\tconn, err := net.Dial(\"tcp\", leader.IDtoIP(dstID))\n\tif err != nil {\n\t\tlog.Fatal(\"could not connect to server\", err)\n\t}\n\n\t// send a byte with the command\n\tconn.Write([]byte{SEND})\n\n\t//open file\n\tfile, err := os.Open(filepath)\n\tdefer file.Close()\n\tif err != nil {\n\t\tlog.Fatal(\"Could not open the file\", err)\n\t}\n\n\tfileInfo, err := file.Stat()\n\tif err != nil {\n\t\tlog.Fatal(\"Could not get file info\", err)\n\t}\n\n\tfileInfoBuffer := fileNameBuffer(sdfsFileName + \">>\" + dstFileName)\n\n\tfileSizeBuf := make([]byte, binary.MaxVarintLen64)\n\tbinary.PutVarint(fileSizeBuf, fileInfo.Size())\n\tcopy(fileInfoBuffer[1016:1024], fileSizeBuf)\n\n\tif len(fileInfoBuffer) != 1024 {\n\t\tlog.Fatal(\"File info buffer not 1024 bytes\")\n\t}\n\t_, err = conn.Write(fileInfoBuffer)\n\tif err != nil {\n\t\tlog.Fatal(\"Could not write fileinformation\", err)\n\t}\n\n\t//send the file in chunks of 65535 bytes\n\taccumulatedBytes := 0\n\tfileBuffer := make([]byte, 65535)\n\tfor {\n\n\t\tn, err := file.Read(fileBuffer)\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Something went wrong!\", err)\n\t\t}\n\t\ttransferChunk(fileBuffer[:n], conn)\n\t\taccumulatedBytes += n\n\t}\n\n\tlog.Println(\"Sent\", accumulatedBytes/1000000, \"MB. Transfer time\", time.Now().Sub(startTime))\n\tconn.Close()\n}", "title": "" }, { "docid": "c7fc3f3d0340dd6c6440af00e1ad19cd", "score": "0.4863279", "text": "func (as *AntriServer) taskTimeoutWatchdog() {\r\n\t// allocate once\r\n\titemArr := make([]*ds.PqItem, 0, 10)\r\n\r\n\t// cause we always append to back\r\n\t// we can be sure that this array is sorted on expireOn\r\n\tticker := time.NewTicker(500 * time.Millisecond)\r\n\tfor {\r\n\t\tselect {\r\n\t\tcase <-as.runningCtx.Done():\r\n\t\t\treturn\r\n\t\tcase <-ticker.C:\r\n\r\n\t\t\t// remove from inflight\r\n\t\t\tcurrentTime := time.Now().Unix()\r\n\t\t\tas.inflightMutex.Lock()\r\n\t\t\tfor as.inflightRecords.Length() > 0 &&\r\n\t\t\t\tas.inflightRecords.PeekExpire() < currentTime {\r\n\r\n\t\t\t\titem, ok := as.inflightRecords.Pop()\r\n\t\t\t\tif ok {\r\n\t\t\t\t\titemArr = append(itemArr, item)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tas.inflightMutex.Unlock()\r\n\r\n\t\t\tfor _, item := range itemArr {\r\n\t\t\t\titem.Retries++\r\n\t\t\t}\r\n\t\t\tas.writeRetryOccurenceToWal(itemArr)\r\n\t\t\tas.addNewMessageToInMemoryDS(itemArr)\r\n\r\n\t\t\t// reset, to reduce allocation\r\n\t\t\titemArr = itemArr[:0]\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "de538cc66ff0836c31c8b6df7f65b96b", "score": "0.48600614", "text": "func (c *connection) writeRTO() {\n\n\tping_ticker := time.NewTicker( time.Duration( max_ping_interval ) * time.Second )\n\trto_ticker := time.NewTicker(1 * time.Second)\n\n\tdefer func() {\n\t\tping_ticker.Stop()\n\t\trto_ticker.Stop()\n\t\tc.ws.Close()\n\t}()\n\n\tfor {\n\t\tselect {\n\n\t\tcase message, ok := <-c.send:\n\t\t\tif !ok {\n\t\t\t\tc.write(websocket.CloseMessage, []byte{})\n if enable_verbose_log > 0 {\n\t\t\t\t glog.Infof(\"sending CloseMessage to peer %s\", c.ws.RemoteAddr())\n }\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\twrite_seq := message.msg_id\n\n if message.is_br_all {\n\n if enable_verbose_log > 0 {\n glog.Infof(\"sending broadcast_all Message with ack_seq %d to peer %s\", write_seq, c.ws.RemoteAddr())\n }\n\n send_push_msg_to_peer( c, uint32(write_seq), message.msg_body, message.is_br_all )\n\n } else {\n\n if enable_verbose_log > 0 {\n glog.Infof(\"sending broadcast_peer Message with ack_seq %d to peer %s\", write_seq, c.ws.RemoteAddr())\n }\n\n\t\t\t next_write_msg := &write_msg_t{msg_body: message.msg_body, retry_times: max_retry_ttl, wait_ttl: max_wait_ttl}\n\t\t\t c.write_msg_Q[ write_seq ] = next_write_msg\n\t\t\t send_push_msg_to_peer( c, uint32(write_seq), message.msg_body, message.is_br_all )\n\n\t\t\t hrooms.send_msg_ch <- int(write_seq)\n }\n\n\t\tcase <-ping_ticker.C:\n\t\t\tif err := c.write(websocket.PingMessage, []byte{}); err != nil {\n\t\t\t\tglog.Infof(\"error: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\n if enable_verbose_log > 0 {\n\t\t\t glog.Infof(\"sending PingMessage to peer %s\", c.ws.RemoteAddr())\n }\n\n\t\tcase ack_seq := <-c.recv_ack_seq:\n\t\t\tif _, ok := c.write_msg_Q[ack_seq]; ok {\n\t\t\t\tdelete(c.write_msg_Q, ack_seq)\n\n if enable_verbose_log > 0 {\n\t\t\t\t glog.Infof(\"RECV ACK_SEQ OK from %s : DROP ACK_SEQ %d Message from write_msg_Q\", c.ws.RemoteAddr(), ack_seq)\n }\n\t\t\t}\n\n\t\tcase <-rto_ticker.C:\n\t\t\tfor ack_seq, msg := range c.write_msg_Q {\n\t\t\t\tmsg.wait_ttl--\n\t\t\t\tif msg.wait_ttl <= 0 {\n\t\t\t if _, ok := c.write_msg_Q[ack_seq]; ok {\n\t\t\t\t\t delete(c.write_msg_Q, ack_seq)\n\n if enable_verbose_log > 0 {\n\t\t\t\t\t glog.Infof(\"RECV ACK_SEQ TIMEOUT from %s: DROP ACK_SEQ %d Message from write_msg_Q\", c.ws.RemoteAddr(), ack_seq)\n }\n }\n\t\t\t\t}\n\n\t\t\t\tif msg.wait_ttl < (msg.retry_times - 1) * ( max_wait_ttl / max_retry_ttl ) {\n\n\t\t\t\t\t// retry send push_msg_t to peer\n if enable_verbose_log > 0 {\n\t\t\t\t\t glog.Infof(\"retry sending Message with ACK_SEQ %d to peer %s\", ack_seq, c.ws.RemoteAddr())\n }\n\n\t\t\t\t\tsend_push_msg_to_peer( c, uint32(ack_seq), msg.msg_body, false )\n\t\t\t \t\throoms.send_msg_ch <- ack_seq\n\n\t\t\t\t\tmsg.retry_times--\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4bd292b7f830c01facb9c3486ca25ea5", "score": "0.48383853", "text": "func (s *Session) queueOutBytes(data []byte) bool {\n\tif s == nil {\n\t\treturn true\n\t}\n\n\tselect {\n\tcase s.send <- data:\n\tcase <-time.After(time.Microsecond * 50):\n\t\ts.logger.Info(\"s.queueOutBytes: timeout\", s.sid)\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "946decffe4403cd7a98122278d90f811", "score": "0.48183158", "text": "func send(ch chan<- []byte, data []byte) {\n\tmessageSent := make(chan bool, 0)\n\n\tgo func(done chan bool) {\n\t\tch <- data\n\t\tclose(messageSent)\n\t}(messageSent)\n\n\tselect {\n\tcase <-messageSent:\n\t\tbreak\n\tcase <-time.After(timeout):\n\t\tbreak\n\t}\n}", "title": "" }, { "docid": "c12580d4e43202df0f4485c549eb6515", "score": "0.48161444", "text": "func (b *batch) send() error {\n\tfor _, fetchItem := range b.fetchList {\n\t\tb.fetchItemAndStoreResult(fetchItem)\n\t}\n\n\tdoneChan := make(chan bool, 1)\n\tgo utils.WaitForWaitGroup(&b.waitGroup, doneChan)\n\n\ttimer := time.NewTimer(time.Duration(b.dw.differ.timeout) * time.Second)\n\tdefer timer.Stop()\n\tfor {\n\t\tselect {\n\t\tcase <-doneChan:\n\t\t\treturn nil\n\t\tcase <-timer.C:\n\t\t\treturn fmt.Errorf(\"mutation differ batch timed out\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c1fbe6bc7340621a3a4f94077d4e8d21", "score": "0.48047662", "text": "func sendEstado(p1 paquete) {\n\tctx, cancel := context.WithTimeout(context.Background(), time.Second)\n\tdefer cancel()\n\tr, _ := cb.ActualizarEstado(ctx, &pb.EstadoPaquete{Id: p1.id, Estado: p1.estado})\n\tlog.Printf(\"M: %v\", r.GetMessage())\n}", "title": "" }, { "docid": "1d3a2c2c4a4f8f3e732e73ccb24f48bd", "score": "0.4799727", "text": "func (producer *putProducer) queueBlobsReadyForTransfer(totalBlobCount int64) (int, error) {\n // Attempt to transfer waiting blobs\n processedCount, err := producer.processWaitingBlobs(*producer.JobMasterObjectList.BucketName, producer.JobMasterObjectList.JobId)\n if err != nil {\n return 0, err\n }\n\n // Check if we need to query the BP for allocated blobs, or if we already know everything is allocated.\n if int64(producer.deferredBlobQueue.Size()) + producer.processedBlobTracker.NumberOfProcessedBlobs() >= totalBlobCount {\n // Everything is already allocated, no need to query BP for allocated chunks\n return processedCount, nil\n }\n\n // Get the list of available chunks that the server can receive. The server may\n // not be able to receive everything, so not all chunks will necessarily be\n // returned\n chunksReady := ds3Models.NewGetJobChunksReadyForClientProcessingSpectraS3Request(producer.JobMasterObjectList.JobId)\n chunksReadyResponse, err := producer.client.GetJobChunksReadyForClientProcessingSpectraS3(chunksReady)\n if err != nil {\n producer.Errorf(\"unrecoverable error: %v\", err)\n return processedCount, err\n }\n\n // Check to see if any chunks can be processed\n numberOfChunks := len(chunksReadyResponse.MasterObjectList.Objects)\n if numberOfChunks > 0 {\n // Loop through all the chunks that are available for processing, and send\n // the files that are contained within them.\n for _, curChunk := range chunksReadyResponse.MasterObjectList.Objects {\n justProcessedCount, err := producer.processChunk(&curChunk, *chunksReadyResponse.MasterObjectList.BucketName, chunksReadyResponse.MasterObjectList.JobId)\n if err != nil {\n return 0, err\n }\n processedCount += justProcessedCount\n }\n }\n return processedCount, nil\n}", "title": "" }, { "docid": "690e3a289313caa87f9688a0d8248870", "score": "0.47758064", "text": "func (t *PodHandler) ObjectSync(key string) error {\r\n\r\n timeStamp := time.Now();\r\n\r\n // Convert the namespace/name string into a distinct namespace and name\r\n\tnamespace, name, err := cache.SplitMetaNamespaceKey(key)\r\n\tif err != nil {\r\n\t\tutilruntime.HandleError(fmt.Errorf(\"invalid resource key: %s\", key))\r\n\t\treturn nil\r\n\t}\r\n\r\n\t// Get the pod resource with this namespace/name\r\n\tobj, err := t.lister.Pods(namespace).Get(name)\r\n\tif err != nil {\r\n\t\tif errors.IsNotFound(err) {\r\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"Pod '%s' in work queue no longer exists\", key))\r\n\t\t\treturn nil\r\n\t\t}\r\n\r\n\t\treturn err\r\n\t}\r\n\r\n var queueName string\r\n\r\n // Get queue information to calculate waiting time\r\n if len(obj.Labels[\"epsilon.queue\"]) != 0 {\r\n queueName = obj.Labels[\"epsilon.queue\"]\r\n }else{\r\n queueName = t.defaultQueue\r\n }\r\n\r\n\r\n // Keep trying if unable to send schedule request to the queued.\r\n // This happens when connection to the rabbitmq server might be down.\r\n // The pod coordinator will keep trying as if send to backoff the next pod requested\r\n // will also fail due to connection failure.\r\n for {\r\n if t.sendScheduleRequest(key,timeStamp,queueName) == false {\r\n\r\n for{\r\n err := t.comm.Connect()\r\n if err == nil{\r\n break\r\n }\r\n // Sleep for a random time before trying again\r\n time.Sleep(time.Duration(rand.Intn(10))*time.Second)\r\n }\r\n }else{\r\n break\r\n }\r\n }\r\n\r\n // Uncomment this if experiment service is up\r\n // for {\r\n // if t.sendExperimentPayload(obj, timeStamp, time.Now(), \"epsilon.experiment\", t.hostname) == false {\r\n //\r\n // for{\r\n // err = t.comm.Connect()\r\n // if err == nil{\r\n // break\r\n // }\r\n // // Sleep for a random time before trying again\r\n // time.Sleep(time.Duration(rand.Intn(10))*time.Second)\r\n // }\r\n // }else{\r\n // break\r\n // }\r\n // }\r\n\r\n return nil\r\n\r\n}", "title": "" }, { "docid": "ca3c350351a36c79134fc4ce803898d8", "score": "0.4761383", "text": "func (c *ClientConn) write(mt int, payload []byte) error {\n c.ws.SetWriteDeadline(time.Now().Add(writeWait))\n return c.ws.WriteMessage(mt, payload)\n}", "title": "" }, { "docid": "f3e298b59ef56de1e07e72a095a041a4", "score": "0.47599024", "text": "func (client StorageContainerClient) UpdateSender(req *http.Request) (future StorageContainerUpdateFuture, err error) {\n var resp *http.Response\n resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))\n if err != nil {\n return\n }\n future.Future, err = azure.NewFutureFromResponse(resp)\n return\n }", "title": "" }, { "docid": "4943e893b794fced4b2954dd77796124", "score": "0.47595093", "text": "func watchSend(req *sessionData, topic *string, slot *int, payload *string) {\n\tmsg := \"MQS5\" + strconv.Itoa(*slot) + len2(payload) + *payload + \"\\n\"\n\tlconns.RLock()\n\tdefer lconns.RUnlock()\n\troutines := conns[*topic]\n\tfor _, n := range routines {\n\t\tif req.conn == n {\n\t\t\tcontinue\n\t\t}\n\t\t(*n).SetDeadline(time.Now().Add(time.Duration(req.timeout) * time.Second))\n\t\t(*n).Write([]byte(msg))\n\t}\n}", "title": "" }, { "docid": "e90bca0c05e12471ab460d75a79c995e", "score": "0.475658", "text": "func (o *WriteToMicrostorageParams) WithTimeout(timeout time.Duration) *WriteToMicrostorageParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "0654db9566bce484b518c7a5c098ce57", "score": "0.47546685", "text": "func (c *Command) Send(cmdtrackURL string) error {\n\tvalues := c.toURLValues()\n\tretryCount := 10\n\tcount := 0\n\tfor count < retryCount {\n\t\tif resp, err := postForm(cmdtrackURL+\"command\", values); err == nil && resp.StatusCode >= 200 && resp.StatusCode < 300 {\n\t\t\treturn nil\n\t\t}\n\t\ttime.Sleep(1000 * time.Millisecond)\n\t\tcount = count + 1\n\t}\n\treturn errors.New(\"Failed to save\")\n}", "title": "" }, { "docid": "c00e83399f2ffda52f2b8de0a4901f44", "score": "0.4751939", "text": "func (q *Queue) CloseTimeout(timeout time.Duration) error {\n\tvar firstErr error\n\n\tif q.p != nil {\n\t\tif err := q.p.StopTimeout(timeout); err != nil && firstErr == nil {\n\t\t\tfirstErr = err\n\t\t}\n\t}\n\n\tq.addBatcher.SetSync(true)\n\tif err := q.addQueue.CloseTimeout(timeout); err != nil && firstErr == nil {\n\t\tfirstErr = err\n\t}\n\n\tq.delBatcher.SetSync(true)\n\tif err := q.delQueue.CloseTimeout(timeout); err != nil && firstErr == nil {\n\t\tfirstErr = err\n\t}\n\n\treturn firstErr\n}", "title": "" }, { "docid": "35ff561ed922ef10db94c3d44eba7b9a", "score": "0.47452694", "text": "func (gsec *client) send(dataid uint32, data []byte) error {\n\n\tif gsec.conn == nil {\n\t\tif err := gsec.connect(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t//glog.Info(string(data), len(data))\n\tdhead := dataHead{0xc01, dataid, 0, uint32(len(data)), [2]uint32{0, 0}}\n\n\tpackageData, err := dhead.packageData(data)\n\tif nil != err {\n\t\treturn err\n\t}\n\n\terr = gsec.conn.SetWriteDeadline(time.Now().Add(5 * time.Second))\n\n\tif err != nil {\n\t\tblog.Error(\" SET WRITE DEAD LINE FAILED: %v\", err)\n\t}\n\n\tif _, err = gsec.conn.Write(packageData); err != nil {\n\n\t\tblog.Error(\"SEND DATA TO DATA PIPE FAILED: %v\", err)\n\t\tgsec.conn.Close()\n\t\tgsec.conn = nil\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0bd08d82e183977c29068b17e53e753a", "score": "0.4742634", "text": "func (s *InMemorySender) Flush(_ context.Context) error { return nil }", "title": "" }, { "docid": "34807353a3d9764f7dfd1d79f19429c0", "score": "0.473169", "text": "func syncSlow(c echo.Context) error {\n\tmilliseconds, err := strconv.Atoi(c.Param(\"milliseconds\"))\n\tif c.Param(\"milliseconds\") == \"\" {\n\t\tmilliseconds = 1000\n\t} else if err != nil {\n\t\treturn c.String(500, \":<()\")\n\t}\n\tgo utils.HandleSyncSlow(milliseconds)\n\treturn c.String(200, \"syncing a service every \"+strconv.Itoa(milliseconds)+\" milliseconds\")\n}", "title": "" }, { "docid": "e36c0f7ecf72563d776282cb72042fe3", "score": "0.47203222", "text": "func (it interceptingTransport) Flush(time.Duration) bool { return true }", "title": "" }, { "docid": "09dfb570c772edb0778f48d32ac47843", "score": "0.4720298", "text": "func (b *bucket) sync() error {\n\n\tlog.Debugf(\"syncing quota %s\", b.request.Identifier)\n\n\tb.lock.Lock()\n\tr := *b.request // make copy\n\n\tif b.windowExpired() {\n\t\tr.Weight = 0 // if expired, don't send Weight\n\t}\n\tb.lock.Unlock()\n\n\tbody := new(bytes.Buffer)\n\tif err := json.NewEncoder(body).Encode(r); err != nil {\n\t\treturn errors.Wrap(err, \"encode\")\n\t}\n\n\treq, err := http.NewRequestWithContext(b.manager.runningContext, http.MethodPost, b.quotaURL, body)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"new request\")\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Accept\", \"application/json\")\n\n\tlog.Debugf(\"sending quota: %s\", body)\n\n\tresp, err := b.manager.client.Do(req)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"quota request: %s\", body)\n\t}\n\tdefer resp.Body.Close()\n\n\tbufLen := resp.ContentLength\n\tif bufLen < bytes.MinRead {\n\t\tbufLen = bytes.MinRead\n\t}\n\tbuf := bytes.NewBuffer(make([]byte, 0, bufLen))\n\tif _, err = buf.ReadFrom(resp.Body); err != nil {\n\t\treturn errors.Wrap(err, \"read body\")\n\t}\n\trespBody := buf.Bytes()\n\n\tswitch resp.StatusCode {\n\tcase 200:\n\t\tvar quotaResult Result\n\t\tif err = quotaResult.Unmarshal(respBody); err != nil {\n\t\t\treturn errors.Wrapf(err, \"unmarshal response: %s\", respBody)\n\t\t}\n\n\t\tb.lock.Lock()\n\t\tb.synced = b.now()\n\t\tif b.result != nil && b.result.ExpiryTime != quotaResult.ExpiryTime {\n\t\t\tb.request.Weight = 0\n\t\t} else {\n\t\t\tb.request.Weight -= r.Weight // same window, keep accumulated Weight\n\t\t}\n\t\tb.result = &quotaResult\n\t\tlog.Debugf(\"quota synced: %#v\", quotaResult)\n\t\tb.lock.Unlock()\n\n\t\tprometheusBucketSynced.With(b.prometheusLabels).SetToCurrentTime()\n\n\t\treturn nil\n\n\tdefault:\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"bad response (%d): %s\", resp.StatusCode, respBody)\n\t\t}\n\t\treturn fmt.Errorf(\"bad response (%d): %s\", resp.StatusCode, respBody)\n\t}\n}", "title": "" }, { "docid": "df18196c2d9ddbf2f2fea76da294f517", "score": "0.4719218", "text": "func subir_libro(conn *grpc.ClientConn,tipo int){\n mensajes := 0\n c:=comms.NewCommsClient(conn)\n ver_libros_para_subir()\n var libro int\n\n log.Printf(\"escoja el libro que quiere subir\")\n fmt.Scanln(&libro)\n start := time.Now()\n\n var archivo string\n archivo=find_book_index(libro)\n archivo=strings.Split(archivo,\"/\")[1]\n var chunks int\n chunks=splitter(archivo)\n for i:=1;i<=chunks;i++{\n mensajes += 1\n if(tipo==1){\n c.UploadBook(context.Background(),&comms.Request_UploadBook{\n Chunks:read_chunk(archivo,i),\n Nombre:archivo,\n Cantidad:int32(chunks),\n Id:int32(i),})\n }else{\n c.UploadBookD(context.Background(),&comms.Request_UploadBook{\n Chunks:read_chunk(archivo,i),\n Nombre:archivo,\n Cantidad:int32(chunks),\n Id:int32(i),})\n }\n }\n elapsed := time.Since(start)\n log.Printf(\"Upload took %s\", elapsed)\n log.Printf(\"Total messages between client and DataNode: %s\", mensajes)\n\n}", "title": "" }, { "docid": "5dca9b913c45a4b88819d6505067c0ed", "score": "0.47128522", "text": "func (i *InvSetTask) ClearTimeout() {}", "title": "" }, { "docid": "2a1f7db4117ca1ac3a6d0b64bea41769", "score": "0.4706003", "text": "func (c *Connection) Write(message []byte) {\n\tgo func(c *Connection) {\n\t\ttimeout := time.After(1 * time.Second)\n\t\tselect {\n\t\tcase c.ChanWrite <- message:\n\t\tcase <-timeout:\n\t\t\tfmt.Println(\"Write timeout\", time.Now(), string(message))\n\t\t}\n\t}(c)\n}", "title": "" }, { "docid": "7ca11e226f4c7ec43c540dc0def59938", "score": "0.47051892", "text": "func (c *ConnecterConfig) AsyncWritePacket(p Packet, timeout time.Duration) error {\n if c.IsClosed() {\n return ErrConnClosing\n }\n\n if timeout == 0 {\n select {\n case c.packetSendChan <- p:\n return nil\n\n default:\n return ErrWriteBlocking\n }\n\n } else {\n select {\n case c.packetSendChan <- p:\n return nil\n\n case <-c.closeChan:\n return ErrConnClosing\n\n case <-time.After(timeout):\n return ErrWriteBlocking\n }\n }\n}", "title": "" }, { "docid": "78cad3f2c67e2aa9206ba1d6a3902ddf", "score": "0.47009814", "text": "func (target *NSQTarget) Send(eventData event.Event) (err error) {\n\tobjectName, err := url.QueryUnescape(eventData.S3.Object.Key)\n\tif err != nil {\n\t\treturn err\n\t}\n\tkey := eventData.S3.Bucket.Name + \"/\" + objectName\n\n\tdata, err := json.Marshal(event.Log{EventName: eventData.EventName, Key: key, Records: []event.Event{eventData}})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = target.producer.Publish(target.args.Topic, data)\n\n\treturn err\n}", "title": "" }, { "docid": "7ac6f36dc4e5332e6e60d64f9aad473d", "score": "0.46967", "text": "func (s *sender) sendData() {\n\tlimit := s.MaxPayloadSize\n\tif s.gso {\n\t\tlimit = int(s.ep.gso.MaxSize - header.TCPHeaderMaximumSize)\n\t}\n\tend := s.SndUna.Add(s.SndWnd)\n\n\t// Reduce the congestion window to min(IW, cwnd) per RFC 5681, page 10.\n\t// \"A TCP SHOULD set cwnd to no more than RW before beginning\n\t// transmission if the TCP has not sent data in the interval exceeding\n\t// the retrasmission timeout.\"\n\tif !s.FastRecovery.Active && s.state != tcpip.RTORecovery && s.ep.stack.Clock().NowMonotonic().Sub(s.LastSendTime) > s.RTO {\n\t\tif s.SndCwnd > InitialCwnd {\n\t\t\ts.SndCwnd = InitialCwnd\n\t\t}\n\t}\n\n\tvar dataSent bool\n\tfor seg := s.writeNext; seg != nil && s.Outstanding < s.SndCwnd; seg = seg.Next() {\n\t\tcwndLimit := (s.SndCwnd - s.Outstanding) * s.MaxPayloadSize\n\t\tif cwndLimit < limit {\n\t\t\tlimit = cwndLimit\n\t\t}\n\t\tif s.isAssignedSequenceNumber(seg) && s.ep.SACKPermitted && s.ep.scoreboard.IsSACKED(seg.sackBlock()) {\n\t\t\t// Move writeNext along so that we don't try and scan data that\n\t\t\t// has already been SACKED.\n\t\t\ts.updateWriteNext(seg.Next())\n\t\t\tcontinue\n\t\t}\n\t\tif sent := s.maybeSendSegment(seg, limit, end); !sent {\n\t\t\tbreak\n\t\t}\n\t\tdataSent = true\n\t\ts.Outstanding += s.pCount(seg, s.MaxPayloadSize)\n\t\ts.updateWriteNext(seg.Next())\n\t}\n\n\ts.postXmit(dataSent, true /* shouldScheduleProbe */)\n}", "title": "" }, { "docid": "8332c53c0d048aa9e58b48813ea195e2", "score": "0.4694765", "text": "func (mm *onuMetricsManager) syncTime(ctx context.Context) error {\n\tif err := mm.pDeviceHandler.pOnuOmciDevice.PDevOmciCC.sendSyncTime(ctx, mm.pDeviceHandler.pOpenOnuAc.omciTimeout, true, mm.pAdaptFsm.commChan); err != nil {\n\t\tlogger.Errorw(ctx, \"cannot send sync time request\", log.Fields{\"device-id\": mm.pDeviceHandler.deviceID})\n\t\treturn err\n\t}\n\n\tselect {\n\tcase <-time.After(time.Duration(mm.pDeviceHandler.pOpenOnuAc.omciTimeout) * time.Second):\n\t\tlogger.Errorw(ctx, \"timed out waiting for sync time response from onu\", log.Fields{\"device-id\": mm.pDeviceHandler.deviceID})\n\t\treturn fmt.Errorf(\"timed-out-waiting-for-sync-time-response-%v\", mm.pDeviceHandler.deviceID)\n\tcase syncTimeRes := <-mm.syncTimeResponseChan:\n\t\tif !syncTimeRes {\n\t\t\treturn fmt.Errorf(\"failed-to-sync-time-%v\", mm.pDeviceHandler.deviceID)\n\t\t}\n\t\tlogger.Infow(ctx, \"sync time success\", log.Fields{\"device-id\": mm.pDeviceHandler.deviceID})\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "dfc1cc9d2fa3c8782c7225f8dc944414", "score": "0.4686752", "text": "func send_command_to_process_fasttimeout(name string, attrib string, param string) (string, error) {\n\tvar url string\n\tif len(param) > 0 {\n\t\turl = \"http://\" + get_ip_and_applport(name) + \"/\" + attrib + \"/\" + param\n\t} else {\n\t\turl = \"http://\" + get_ip_and_applport(name) + \"/\" + attrib\n\t}\n\n\t_, _ = http.Get(url)\n\n\treturn \" \", nil\n}", "title": "" }, { "docid": "a948c2ba9c3937a2e25778f52ac8ddb6", "score": "0.468668", "text": "func (m *StorageMock) MinimockWait(timeout mm_time.Duration) {\n\ttimeoutCh := mm_time.After(timeout)\n\tfor {\n\t\tif m.minimockDone() {\n\t\t\treturn\n\t\t}\n\t\tselect {\n\t\tcase <-timeoutCh:\n\t\t\tm.MinimockFinish()\n\t\t\treturn\n\t\tcase <-mm_time.After(10 * mm_time.Millisecond):\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a948c2ba9c3937a2e25778f52ac8ddb6", "score": "0.468668", "text": "func (m *StorageMock) MinimockWait(timeout mm_time.Duration) {\n\ttimeoutCh := mm_time.After(timeout)\n\tfor {\n\t\tif m.minimockDone() {\n\t\t\treturn\n\t\t}\n\t\tselect {\n\t\tcase <-timeoutCh:\n\t\t\tm.MinimockFinish()\n\t\t\treturn\n\t\tcase <-mm_time.After(10 * mm_time.Millisecond):\n\t\t}\n\t}\n}", "title": "" }, { "docid": "03ca9a4e86969ad392ff3c1d7b0b71c0", "score": "0.4680708", "text": "func (c *cubicSender) OnRetransmissionTimeout(packetsRetransmitted bool) {\n\tc.largestSentAtLastCutback = 0\n\tif !packetsRetransmitted {\n\t\treturn\n\t}\n\tc.hybridSlowStart.Restart()\n\tc.cubic.Reset()\n\tc.slowstartThreshold = c.congestionWindow / 2\n\tc.congestionWindow = c.minCongestionWindow\n}", "title": "" }, { "docid": "34ce8a4eb456c6427e80aca157a6d9ad", "score": "0.4677099", "text": "func uploadTicker() {\n\tfor {\n\t\tnextTime := time.Now().Truncate(time.Minute)\n\t\tnextTime = nextTime.Add(time.Minute)\n\t\ttime.Sleep(time.Until(nextTime))\n\t\tif lastLedState {\n\t\t\tcurrentOnTimeSec += int32(time.Now().Sub(lastTurnOnTime).Seconds())\n\t\t\tlastTurnOnTime = time.Now()\n\t\t}\n\t\tgo sendToServer()\n\t}\n}", "title": "" }, { "docid": "4075f6a7aee075c47a0eff96cb416565", "score": "0.46747324", "text": "func (c *Client) WriteTimeout(timeout time.Duration) {\n\tc.writeDeadline = time.Now().Add(timeout)\n}", "title": "" }, { "docid": "760ae319a97dc494c08680c134b6f4ff", "score": "0.46737546", "text": "func Transmit(card *smartcard.Card, data []byte, timeout time.Duration) ([]byte, error) {\n\tc1 := make(chan []byte)\n\tc2 := make(chan error)\n\tgo func(cmd []byte, card *smartcard.Card) {\n\t\tresponse, error := card.TransmitAPDU(cmd)\n\t\tif error != nil {\n\t\t\tc2 <- error\n\t\t} else {\n\t\t\tc1 <- response\n\t\t}\n\t}(data, card)\n\tselect {\n\tcase err := <-c2:\n\t\treturn nil, err\n\tcase ret := <-c1:\n\t\treturn ret, nil\n\tcase <-time.After(timeout):\n\t\treturn nil, fmt.Errorf(\"u2fnfc: transaction timeout\")\n\t}\n}", "title": "" }, { "docid": "81770022edf21c956256fdb0939667c6", "score": "0.46705315", "text": "func (q *Queue) PushBytes(name string, d []byte, expectAts ...time.Time) (uint64, error) {\n\tif q == nil || q.db == nil {\n\t\treturn 0, errors.Errorf(\"queue or db is nil: %v\", q)\n\t}\n\tjob := &Job{ // retry count is 0\n\t\tStatus: Uack,\n\t\tData: d,\n\t\tName: name,\n\t\tBackoff: q.backoff,\n\t}\n\tif q.timingSchedule {\n\t\tif len(expectAts) == 0 {\n\t\t\treturn 0, errors.New(\"expect time is required\")\n\t\t}\n\t\tjob.ExpectAt = getTimestamp(expectAts[0])\n\t} else {\n\t\tjob.ExpectAt = getTimestamp(time.Now()) // create time\n\t}\n\treturn q.pushJob(job)\n}", "title": "" }, { "docid": "172e8c2967449baa29e69c6fa6c6daf5", "score": "0.46702665", "text": "func (m *RecordStorageMock) Wait(timeout time.Duration) {\n\tm.MinimockWait(timeout)\n}", "title": "" }, { "docid": "25ba971bc11db07ec2a574cc050fc475", "score": "0.46600676", "text": "func (rs *remoteStorage) doSyncValue(encodedHashOfValue EncodedHash) error {\n value, err := rs.vm.ReadValue(encodedHashOfValue)\n if err != nil {\n return remoteStorageDebug.Error(errors.New(\"The specified value doesn't exist: \" + string(encodedHashOfValue)))\n }\n if err := rs.theAdaptor.PutBinary(string(encodedHashOfValue), value); err != nil {\n return remoteStorageDebug.Error(err)\n }\n if err := rs.js.Write(\"Sync:\" + string(encodedHashOfValue)); err != nil {\n return remoteStorageDebug.Error(err)\n }\n return nil\n}", "title": "" }, { "docid": "642140e7ebc20be7b980887575002944", "score": "0.46600312", "text": "func (r *gatewaySeven) sendata() {\n\tfrsize := int64(configNetwork.sizeFrame)\n\tfor _, tioparentint := range r.tios {\n\t\ttioparent := tioparentint.(*TioRr)\n\t\tmcastflow := tioparent.GetFlow().(*Flow)\n\t\tif mcastflow.timeTxDone.After(Now) {\n\t\t\tcontinue\n\t\t}\n\t\tif mcastflow.getoffset() >= r.chunk.sizeb {\n\t\t\tcontinue\n\t\t}\n\t\tassert(mcastflow.getbw() == configNetwork.linkbpsData)\n\n\t\tcomputedbid := mcastflow.extension.(*PutBid)\n\t\tif computedbid == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif Now.Before(computedbid.win.left) {\n\t\t\tcontinue\n\t\t}\n\t\tif mcastflow.getoffset()+frsize > r.chunk.sizeb {\n\t\t\tfrsize = r.chunk.sizeb - mcastflow.getoffset()\n\t\t}\n\n\t\tmcastflow.incoffset(int(frsize))\n\t\tnewbits := frsize * 8\n\n\t\ttargets := r.rzvgroup.getmembers()\n\n\t\t// multicast via SmethodDirectInsert\n\t\tatomic.StoreInt64(&r.NowMcasting, 1)\n\t\tfor _, srv := range targets {\n\t\t\ttio := tioparent.GetTioChild(srv)\n\t\t\tev := newMcastChunkDataEvent(r, r.rzvgroup, r.chunk, mcastflow, int(frsize), tio)\n\t\t\tsrv.Send(ev, SmethodDirectInsert)\n\t\t}\n\t\tatomic.StoreInt64(&r.NowMcasting, 0)\n\n\t\td := time.Duration(newbits) * time.Second / time.Duration(mcastflow.getbw())\n\t\tmcastflow.timeTxDone = Now.Add(d)\n\t\tatomic.AddInt64(&r.txbytestats, int64(frsize))\n\t}\n}", "title": "" }, { "docid": "fa0f250b756843b972064eaf6a6905a6", "score": "0.46577108", "text": "func (o *EtcdGateway) publish(consumerAddress string, prefix string, data []byte) error {\n\n\tvar remoteQueue = o.remoteQueues[consumerAddress]\n\tif remoteQueue == nil {\n\t\tvar ctx, cancel = context.WithCancel(context.TODO())\n\t\tremoteQueue = &Queue{\n\t\t\tctx: ctx,\n\t\t\tcancelFunc: cancel,\n\t\t\tclient: o.watcher.GetConn(),\n\t\t\tkeyPrefix: PathNodeQueue + \"/\" + consumerAddress,\n\t\t}\n\t\tfunc() {\n\t\t\to.Mutex.Lock()\n\t\t\tdefer o.Mutex.Unlock()\n\t\t\to.remoteQueues[consumerAddress] = remoteQueue\n\t\t}()\n\t}\n\n\treturn remoteQueue.Enqueue(string(data))\n}", "title": "" }, { "docid": "bb34b7df1b0c7901d6de4be3cf934282", "score": "0.46574596", "text": "func (s *ZStackGateway) SendAsyncCommand(request zStackGatewayCommand, response zStackGatewayCommand, timeout time.Duration) error {\n\tconfirmation := &gateway.GwZigbeeGenericCnf{}\n\n\t//\tspew.Dump(\"sending\", request)\n\n\terr := s.SendCommand(request, confirmation)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//spew.Dump(confirmation)\n\n\tif confirmation.Status.String() != \"STATUS_SUCCESS\" {\n\t\treturn fmt.Errorf(\"Invalid confirmation status: %s\", confirmation.Status.String())\n\t}\n\n\treturn s.waitForSequenceResponse(*confirmation.SequenceNumber, response, timeout)\n}", "title": "" }, { "docid": "cfd5c24679267bdf73ee1658a2d8125e", "score": "0.46534696", "text": "func (m *IndexStorageMock) Wait(timeout time.Duration) {\n\tm.MinimockWait(timeout)\n}", "title": "" }, { "docid": "6ca88fee81491a5e6ed2ee0b8e11a8c4", "score": "0.46473154", "text": "func (t *PodHandler) sendExperimentPayload(pod *corev1.Pod, in time.Time, out time.Time, queueName string, hostname string) bool{\r\n\r\n respBytes, err := json.Marshal(communication.ExperimentPayload{Type:\"Coordinator\",InTime:in,OutTime:out,Pod:pod,Hostname: hostname})\r\n if err != nil {\r\n log.Fatalf(\"%s\", err)\r\n }\r\n\r\n err = t.comm.Send(respBytes,queueName)\r\n\r\n if err != nil{\r\n return false\r\n }\r\n\r\n return true\r\n}", "title": "" }, { "docid": "618a7564871b9124d77956bd35fe59a2", "score": "0.46434832", "text": "func (client *RTMServerClient) sendQuest(quest *fpnn.Quest, timeout time.Duration, callback func(answer *fpnn.Answer, errorCode int)) (*fpnn.Answer, error) {\n\n\tif callback == nil {\n\t\tvar answer *fpnn.Answer\n\t\tvar err error\n\t\tif timeout == 0 {\n\t\t\tanswer, err = client.client.SendQuest(quest)\n\t\t} else {\n\t\t\tanswer, err = client.client.SendQuest(quest, timeout)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn answer, err\n\t\t} else if answer.IsException() {\n\t\t\tcode, _ := answer.GetInt(\"code\")\n\t\t\tif code == fpnn.FPNN_EC_CORE_CONNECTION_CLOSED || code == fpnn.FPNN_EC_CORE_INVALID_CONNECTION || code == (int)(RTM_EC_SAME_SIGN) {\n\t\t\t\tif code == (int)(RTM_EC_SAME_SIGN) {\n\t\t\t\t\tclient.resetQuestSign(quest)\n\t\t\t\t}\n\t\t\t\tif timeout == 0 {\n\t\t\t\t\treturn client.client.SendQuest(quest)\n\t\t\t\t} else {\n\t\t\t\t\treturn client.client.SendQuest(quest, timeout)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn answer, err\n\n\t} else {\n\t\tif timeout == 0 {\n\t\t\treturn nil, client.client.SendQuestWithLambda(quest, func(answer *fpnn.Answer, errorCode int) {\n\t\t\t\tif errorCode == fpnn.FPNN_EC_CORE_CONNECTION_CLOSED || errorCode == fpnn.FPNN_EC_CORE_INVALID_CONNECTION || errorCode == (int)(RTM_EC_SAME_SIGN) {\n\t\t\t\t\tif errorCode == (int)(RTM_EC_SAME_SIGN) {\n\t\t\t\t\t\tclient.resetQuestSign(quest)\n\t\t\t\t\t}\n\t\t\t\t\terr := client.client.SendQuestWithLambda(quest, callback)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tclient.logger.Println(\"[ERROR] send async quest failed, err: \", err)\n\t\t\t\t\t}\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tcallback(answer, errorCode)\n\t\t\t})\n\t\t} else {\n\t\t\treturn nil, client.client.SendQuestWithLambda(quest, func(answer *fpnn.Answer, errorCode int) {\n\t\t\t\tif errorCode == fpnn.FPNN_EC_CORE_CONNECTION_CLOSED || errorCode == fpnn.FPNN_EC_CORE_INVALID_CONNECTION || errorCode == (int)(RTM_EC_SAME_SIGN) {\n\t\t\t\t\tif errorCode == (int)(RTM_EC_SAME_SIGN) {\n\t\t\t\t\t\tclient.resetQuestSign(quest)\n\t\t\t\t\t}\n\t\t\t\t\terr := client.client.SendQuestWithLambda(quest, callback, timeout)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tclient.logger.Println(\"[ERROR] send async quest failed, err: \", err)\n\t\t\t\t\t}\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tcallback(answer, errorCode)\n\t\t\t}, timeout)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7b6e765e38d66070dd4d5d691c0ebaa0", "score": "0.4636245", "text": "func (e *elasticspray) sendToElasic() {\n\t// Stop ticker\n\te.timer.Stop()\n\n\tconn := <-e.pool\n\tdefer func() { e.pool <- conn }()\n\n\tr, err := http.Post(conn, \"text/plain\", e.buffer)\n\tif err != nil {\n\t\te.logger.Errorf(\"Fail to send bucket because '%s'\", err)\n\t\treturn\n\t}\n\tdefer e.buffer.Reset()\n\n\tbd, _ := ioutil.ReadAll(r.Body)\n\tdefer r.Body.Close()\n\tif r.StatusCode != http.StatusOK {\n\t\te.logger.Errorf(\"Not successful elastic operation. Code=%d. Response='%s'\", r.StatusCode, bd)\n\t}\n}", "title": "" }, { "docid": "d6579118521bfa93a9d5249144b87354", "score": "0.46344414", "text": "func TestConsumeTimeout(t *testing.T) {\n\tmq := setup()\n\terr := mq.Create()\n\tif err != nil {\n\t\tt.Fatalf(\"Could not create schema %s\", err)\n\t}\n\tdefer cleanup(mq)\n\n\tmessages := []*gq.Message{&gq.Message{Payload: []byte(\"test\")}}\n\terr = mq.Publish(messages)\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to publish %s\", err)\n\t}\n\tsize := len(messages)\n\trecipts := make([]*gq.Receipt, size)\n\ttimeouDuration := 1 * time.Millisecond\n\tmq.TTL = timeouDuration\n\n\tfirstBatch, err := mq.ConsumeBatch(size)\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to consumer first batch %s\", err)\n\t}\n\ttime.Sleep(10 * time.Millisecond)\n\tsecondBatch, err := mq.ConsumeBatch(size)\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to consumer second batch %s\", err)\n\t}\n\tif len(firstBatch) != len(secondBatch) {\n\t\tt.Fatalf(\"Expect first batch size %d to be same as second batch %d\", len(firstBatch), len(secondBatch))\n\t}\n\tfor j, m := range secondBatch {\n\t\trecipts[j] = &gq.Receipt{Id: m.Id, Success: true}\n\t}\n\terr = mq.Commit(recipts)\n\tif err != nil {\n\t\tt.Fatalf(\"Error committing the receipts %s\", err)\n\t}\n\n}", "title": "" }, { "docid": "099b721fab98ca91ffac6bd7f1c7b252", "score": "0.46312928", "text": "func (c *connection) write(mt int, payload []byte) error {\n\n // !!! don't touch these code\n if enable_ack_rto == 1 {\n <-c.notify_mu\n\t c.ws.SetWriteDeadline(time.Now().Add(writeWait))\n ret := c.ws.WriteMessage(mt, payload)\n c.notify_mu<-true\n return ret\n } else {\n\t c.ws.SetWriteDeadline(time.Now().Add(writeWait))\n \treturn c.ws.WriteMessage(mt, payload)\n }\n}", "title": "" }, { "docid": "f17377c4bc85bd52e11c373ba56aa82d", "score": "0.46311453", "text": "func sendData(ch chan <- int) {\n\tfor i:=0; true; i++ {\n\t\tch <- i\n\t\tdetik := time.Duration(rand.Int() % 10 + 1)\n\t\tfmt.Println(detik)\n\t\ttime.Sleep(detik * time.Second)\n\t}\n}", "title": "" }, { "docid": "e1dcef51b042f05fe79fba8c7b0468d9", "score": "0.46302918", "text": "func (a *Agent) ResyncStorage() {\r\n\tl := a.pbm.Logger().NewEvent(string(pbm.CmdResyncBackupList), \"\")\r\n\r\n\tnodeInfo, err := a.node.GetInfo()\r\n\tif err != nil {\r\n\t\tl.Error(\"get node info data: %v\", err)\r\n\t\treturn\r\n\t}\r\n\r\n\tif !nodeInfo.IsLeader() {\r\n\t\tl.Info(\"not a member of the leader rs\")\r\n\t\treturn\r\n\t}\r\n\r\n\tlock := a.pbm.NewLock(pbm.LockHeader{\r\n\t\tType: pbm.CmdResyncBackupList,\r\n\t\tReplset: nodeInfo.SetName,\r\n\t\tNode: nodeInfo.Me,\r\n\t})\r\n\r\n\tgot, err := lock.Acquire()\r\n\tif err != nil {\r\n\t\tswitch err.(type) {\r\n\t\tcase pbm.ErrConcurrentOp:\r\n\t\t\tl.Info(\"acquiring lock: %v\", err)\r\n\t\tdefault:\r\n\t\t\tl.Error(\"acquiring lock: %v\", err)\r\n\t\t}\r\n\t\treturn\r\n\t}\r\n\tif !got {\r\n\t\tl.Info(\"operation has been scheduled on another replset node\")\r\n\t\treturn\r\n\t}\r\n\r\n\ttstart := time.Now()\r\n\tl.Info(\"started\")\r\n\terr = a.pbm.ResyncStorage()\r\n\tif err != nil {\r\n\t\tl.Error(\"%v\", err)\r\n\t} else {\r\n\t\tl.Info(\"succeed\")\r\n\t}\r\n\r\n\tneedToWait := time.Second*1 - time.Since(tstart)\r\n\tif needToWait > 0 {\r\n\t\ttime.Sleep(needToWait)\r\n\t}\r\n\terr = lock.Release()\r\n\tif err != nil {\r\n\t\tl.Error(\"reslase lock %v: %v\", lock, err)\r\n\t}\r\n}", "title": "" }, { "docid": "001664675bb24806b4d4a6f15f05b500", "score": "0.46300083", "text": "func TestSendToCloud(t *testing.T) {\n\tinitMocks(t)\n\tmsg := model.NewMessage(\"\").BuildHeader(\"test_id\", \"\", 1)\n\tmsg.Header.Sync = true\n\ttests := []struct {\n\t\tname string\n\t\tcontroller *Controller\n\t\tmessage model.Message\n\t\texpectedError error\n\t\twaitError bool\n\t\tmockError error\n\t}{\n\t\t{\"send to cloud with proper input\", &Controller{\n\t\t\tcontext: context.GetContext(context.MsgCtxTypeChannel),\n\t\t\tchClient: mockAdapter,\n\t\t\tconfig: &config.ControllerConfig{\n\t\t\t\tProtocol: \"websocket\",\n\t\t\t\tHeartbeatPeriod: 6 * time.Second,\n\t\t\t},\n\t\t\tsyncKeeper: make(map[string]chan model.Message),\n\t\t}, *msg,\n\t\t\tnil,\n\t\t\tfalse,\n\t\t\tnil},\n\n\t\t{\"Wait Error in send to cloud\", &Controller{\n\t\t\tchClient: mockAdapter,\n\t\t\tconfig: &config.ControllerConfig{\n\t\t\t\tProtocol: \"websocket\",\n\t\t\t\tHeartbeatPeriod: 3 * time.Second,\n\t\t\t},\n\t\t\tsyncKeeper: make(map[string]chan model.Message),\n\t\t}, *msg,\n\t\t\tnil,\n\t\t\ttrue,\n\t\t\tnil},\n\n\t\t{\"Send Failure in send to cloud\", &Controller{\n\t\t\tchClient: mockAdapter,\n\t\t\tconfig: &config.ControllerConfig{\n\t\t\t\tHeartbeatPeriod: 3 * time.Second,\n\t\t\t},\n\t\t\tsyncKeeper: make(map[string]chan model.Message),\n\t\t}, model.Message{},\n\t\t\tfmt.Errorf(\"failed to send message, error: Connection Refused\"),\n\t\t\tfalse,\n\t\t\terrors.New(\"Connection Refused\")},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tmockAdapter.EXPECT().Send(gomock.Any()).Return(tt.mockError).Times(1)\n\t\t\tif !tt.waitError && tt.expectedError == nil {\n\t\t\t\tgo tt.controller.sendToCloud(tt.message)\n\t\t\t\ttime.Sleep(1 * time.Second)\n\t\t\t\ttempChannel := tt.controller.syncKeeper[\"test_id\"]\n\t\t\t\ttempChannel <- *model.NewMessage(\"test_id\")\n\t\t\t\ttime.Sleep(1 * time.Second)\n\t\t\t\tif _, exist := tt.controller.syncKeeper[\"test_id\"]; exist {\n\t\t\t\t\tt.Errorf(\"SendToCloud() error in receiving message\")\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t\terr := tt.controller.sendToCloud(tt.message)\n\t\t\tif !reflect.DeepEqual(err, tt.expectedError) {\n\t\t\t\tt.Errorf(\"SendToCloud() error = %v, wantErr %v\", err, tt.expectedError)\n\t\t\t}\n\t\t\ttime.Sleep(tt.controller.config.HeartbeatPeriod + 2*time.Second)\n\t\t\tif _, exist := tt.controller.syncKeeper[\"test_id\"]; exist {\n\t\t\t\tt.Errorf(\"SendToCloud() error in waiting for timeout\")\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "7a3ddc0ff2fb1d2e431a54a8fc171e3f", "score": "0.46278512", "text": "func (o *PutChannelsChannelIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f780a87a01675bd853a081234a14c8ae", "score": "0.46270055", "text": "func (w *Watcher) SendObject(evtType watch.EventType, obj runtime.Object, timeout time.Duration) error {\n\tevt := watch.Event{\n\t\tType: evtType,\n\t\tObject: obj,\n\t}\n\tselect {\n\tcase w.ch <- evt:\n\tcase <-time.After(timeout):\n\t\treturn fmt.Errorf(\"couldn't send after %s\", timeout)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ca0db51403c6f64eafd1be528ccac9d0", "score": "0.46215525", "text": "func (self *Video) SetTimeoutA(member int) {\n self.Object.Set(\"timeout\", member)\n}", "title": "" }, { "docid": "c58f71b3e2ca4b10fa63c1b8b5e6c33f", "score": "0.46186298", "text": "func formatStorageRequest(mc Control, parms interface{}, ch chan ClientResult) {\n\tsRes := StorageResult{}\n\n\t// Maximum time limit for format is 2hrs to account for lengthy low\n\t// level formatting of multiple devices sequentially.\n\tctx, cancel := context.WithTimeout(context.Background(), 120*time.Minute)\n\tdefer cancel()\n\n\tstream, err := mc.getCtlClient().FormatStorage(ctx, &pb.FormatStorageReq{})\n\tif err != nil {\n\t\tch <- ClientResult{mc.getAddress(), nil, err}\n\t\treturn // stream err\n\t}\n\n\tfor {\n\t\tresp, err := stream.Recv()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\terr := errors.Wrapf(err, msgStreamRecv, stream)\n\t\t\tlog.Errorf(err.Error())\n\t\t\tch <- ClientResult{mc.getAddress(), nil, err}\n\t\t\treturn // recv err\n\t\t}\n\n\t\tsRes.nvmeCtrlr.Responses = resp.Crets\n\t\tsRes.scmMount.Responses = resp.Mrets\n\n\t\tch <- ClientResult{mc.getAddress(), sRes, nil}\n\t}\n}", "title": "" }, { "docid": "8d9fc8ba630813cb47eec52aadebc39a", "score": "0.4613367", "text": "func (c *CVCController) enqueueCVC(obj interface{}) {\n\tvar key string\n\tvar err error\n\tif key, err = cache.MetaNamespaceKeyFunc(obj); err != nil {\n\t\truntime.HandleError(err)\n\t\treturn\n\t}\n\tc.workqueue.Add(key)\n\n\t/*\tif unknown, ok := obj.(cache.DeletedFinalStateUnknown); ok && unknown.Obj != nil {\n\t\t\tobj = unknown.Obj\n\t\t}\n\t\tif cvc, ok := obj.(*apis.CStorVolumeConfig); ok {\n\t\t\tobjName, err := cache.DeletionHandlingMetaNamespaceKeyFunc(cvc)\n\t\t\tif err != nil {\n\t\t\t\tklog.Errorf(\"failed to get key from object: %v, %v\", err, cvc)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tklog.V(5).Infof(\"enqueued %q for sync\", objName)\n\t\t\tc.workqueue.Add(objName)\n\t\t}\n\t*/\n}", "title": "" }, { "docid": "ae65328fff0f34053a330052f0698343", "score": "0.46119717", "text": "func TestSendIq(t *testing.T) {\n\tserverDone := make(chan struct{})\n\tclientDone := make(chan struct{})\n\th := func(t *testing.T, sc *ServerConn) {\n\t\thandlerForComponentIQSend(t, sc)\n\t\tserverDone <- struct{}{}\n\t}\n\n\t//Connecting to a mock server, initialized with given port and handler function\n\tc, m := mockComponentConnection(t, testSendIqPort, h)\n\n\tctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\n\tiqReq, err := stanza.NewIQ(stanza.Attrs{Type: stanza.IQTypeGet, From: \"test1@localhost/mremond-mbp\", To: defaultServerName, Id: defaultStreamID, Lang: \"en\"})\n\tif err != nil {\n\t\tt.Fatalf(\"failed to create IQ request: %v\", err)\n\t}\n\tdisco := iqReq.DiscoInfo()\n\tiqReq.Payload = disco\n\n\t// Handle a possible error\n\terrChan := make(chan error)\n\terrorHandler := func(err error) {\n\t\terrChan <- err\n\t}\n\tc.ErrorHandler = errorHandler\n\n\tgo func() {\n\t\tvar res chan stanza.IQ\n\t\tres, _ = c.SendIQ(ctx, iqReq)\n\n\t\tselect {\n\t\tcase <-res:\n\t\tcase err := <-errChan:\n\t\t\tt.Fatalf(err.Error())\n\t\t}\n\t\tclientDone <- struct{}{}\n\t}()\n\n\twaitForEntity(t, clientDone)\n\twaitForEntity(t, serverDone)\n\n\tcancel()\n\tm.Stop()\n}", "title": "" }, { "docid": "cfbfd20488026873832ce79a7f4946c4", "score": "0.46110556", "text": "func cacheData(tempid int, roomid, starttime, value string) { // 使用协程去写入redis,在读的情况下不能够写入。\n\tselect {\n\tcase RWChannel[tempid].Write <- struct{}{}:\n\t\tlog.Println(\"cacheData got write power!!!\")\n\t\tmu.Lock()\n\t\tRWChannel[tempid].isWriting = true\n\t\tmu.Unlock()\n\n\t\tfor {\n\t\t\tif RWChannel[tempid].isReading == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\ttime.Sleep(30 * time.Millisecond)\n\t\t\tlog.Println(\"i am waiting for isReading = 0\")\n\t\t}\n\n\t\tc := pool.Get()\n\t\tdefer func(temp int) {\n\t\t\terr := c.Close()\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"redis close error !\")\n\t\t\t}\n\t\t\tmu.Lock()\n\t\t\tRWChannel[temp].isWriting = false\n\t\t\tmu.Unlock()\n\t\t\t<-RWChannel[temp].Write\n\t\t}(tempid)\n\n\t\tif _, err := redis.Int(c.Do(\"set\", roomid+starttime, value)); err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\tdefault:\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "5c7db7b49d6958b9c5877bb9c60f9563", "score": "0.46104616", "text": "func (c *client) send(msg interface{}) (err error) {\n\tif err = c.conn.SetWriteDeadline(c.writeDeadline); err != nil {\n\t\treturn err\n\t}\n\tlog.Printf(\"send(%v) %T\", c.raddr(), msg)\n\terr = c.enc.Encode(msg)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"send(%v) %T: %w\", c.raddr(), msg, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "02a98e3081c658c3f1c4f2929940f77f", "score": "0.4600807", "text": "func (s *Session) wait(packetID string, addr string, payload []byte, retry int) {\n\t// Exceed limit retry then delete from ack list\n\tif retry == 0 {\n\t\tdelete(s.ack, packetID)\n\t\treturn\n\t}\n\tselect {\n\tcase <-s.ack[packetID]:\n\t\t// Successfully sent\n\t\tdelete(s.ack, packetID)\n\tcase <-time.After(time.Second):\n\t\t// Timeout and try to resend the package\n\t\ts.write(payload, addr)\n\t\ts.wait(packetID, addr, payload, retry-1)\n\t}\n}", "title": "" }, { "docid": "ca38d318adc9a112cb808c2458cba476", "score": "0.46005175", "text": "func (c *Config) SaveTimeout(timeout time.Duration) error {\n\tc.Cluster.Timeout = timeout\n\n\treturn write(c.Cluster, filepath.Join(c.path, clusterFilename))\n}", "title": "" }, { "docid": "3ab9a1602ae4c06ad268619849d4b465", "score": "0.4596182", "text": "func SendToRedis(redisAddress string, dataChan chan QueueMsg) {\n\tredisConnection, err := redis.Dial(\"tcp\", redisAddress)\n\tif err != nil {\n\t\tpanic(\"cant connect to redis server\")\n\t}\n\tfor {\n\t\tselect {\n\t\tcase msg := <-dataChan:\n\t\t\toldData, _ := redis.Bytes(redisConnection.Do(\"GET\", msg.RouterName))\n\t\t\tredisConnection.Do(\"SET\", strings.Join([]string{msg.RouterName, \"-old\"}, \"\"), oldData)\n\t\t\tredisConnection.Do(\"SET\", msg.RouterName, msg.Data)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "99b21f28a04454229258cd44c1e7cba1", "score": "0.45961213", "text": "func sendMsg(t *testing.T, i int, msg wtwire.Message,\n\tpeer *server.MockPeer, timeout time.Duration) {\n\n\tt.Helper()\n\n\tvar b bytes.Buffer\n\t_, err := wtwire.WriteMessage(&b, msg, 0)\n\tif err != nil {\n\t\tt.Fatalf(\"[test %d] unable to encode %T message: %v\",\n\t\t\ti, msg, err)\n\t}\n\n\tselect {\n\tcase peer.IncomingMsgs <- b.Bytes():\n\tcase <-time.After(2 * timeout):\n\t\tt.Fatalf(\"[test %d] unable to send %T message\", i, msg)\n\t}\n}", "title": "" }, { "docid": "b1cd1f4a0223719b37c5595d1d8790d4", "score": "0.4594857", "text": "func CommsSendTestNow() {\n\t// the UResp struct has what we need to send a command to Tgo\n\tUhura.LogString <- fmt.Sprintf((\"Comms: sending TESTNOW\\n\"))\n\t<-Uhura.LogStringAck\n\n\tcmd := UCommand{Command: \"TESTNOW\", CmdCode: cmdTESTNOW, Timestamp: time.Now().Format(time.RFC822)}\n\tvar reply UResp\n\n\t// Since we access memory, we'll save all the urls as we process the\n\t// shared memory and then invoke the sends afterward...\n\turls := make([]string, 0) // add a url for every tgo\n\tUhura.HReqMem <- 1 // ask to access the shared mem, blocks until granted\n\t<-Uhura.HReqMemAck // make sure we got it\n\tfor i := 0; i < len(UEnv.Instances); i++ {\n\t\tfor j := 0; j < len(UEnv.Instances[i].Apps); j++ {\n\t\t\tif UEnv.Instances[i].Apps[j].Name == \"tgo\" {\n\t\t\t\turls = append(urls, fmt.Sprintf(\"http://%s:%d/\", UEnv.Instances[i].HostName, UEnv.Instances[i].Apps[j].UPort))\n\t\t\t}\n\t\t}\n\t}\n\tUhura.HReqMemAck <- 1 // give it back\n\n\tfor i := 0; i < len(urls); i++ {\n\t\tUhura.LogString <- fmt.Sprintf(\"Comms: TESTNOW -> tgo @ %s\\n\", urls[i])\n\t\t<-Uhura.LogStringAck\n\t\tSendTgoCommand(urls[i], &cmd, &reply)\n\t}\n}", "title": "" }, { "docid": "803c8c30b255549f6afd2c3d373ef021", "score": "0.45870388", "text": "func (wi *watchInfo) sendErrorLocked(err error) {\n\tvar (\n\t\tu interface{}\n\t)\n\tswitch wi.rType {\n\tcase ListenerResource:\n\t\tu = ListenerUpdate{}\n\tcase RouteConfigResource:\n\t\tu = RouteConfigUpdate{}\n\tcase ClusterResource:\n\t\tu = ClusterUpdate{}\n\tcase EndpointsResource:\n\t\tu = EndpointsUpdate{}\n\t}\n\twi.c.scheduleCallback(wi, u, err)\n}", "title": "" }, { "docid": "da59eb3b8b126f33717dfb35a4868d47", "score": "0.45816496", "text": "func (c *connection) Send(message buffercache.Buffer) {\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\tif c.isClosed {\n\t\treturn\n\t}\n\t//fmt.Println(\"Outbound queue size\", c.Idx, len(c.queue))\n\tif c.queue.Len() >= maxQueueSize {\n\t\tlog.Println(\"Outbound queue overflow\", c.Idx, c.queue.Len())\n\t\treturn\n\t}\n\tmessage.Incref()\n\tc.queue.PushBack(message)\n\tc.condition.Signal()\n}", "title": "" }, { "docid": "d7757d613459c81225e61b05525ecc13", "score": "0.45777395", "text": "func (p redisSink) Sync() error {\n\treturn nil\n}", "title": "" }, { "docid": "b6cfba4ba37959818425902083a5d473", "score": "0.45770603", "text": "func sendItems(target Target, itemKeyCh <-chan string, doneCh <-chan struct{}, logger logger) {\n\tretryTicker := time.NewTicker(retryInterval)\n\tdefer retryTicker.Stop()\n\n\tsend := func(itemKey string) bool {\n\t\tfor {\n\t\t\terr := target.SendFromStore(itemKey)\n\t\t\tif err == nil {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif err != ErrNotConnected && !xnet.IsConnResetErr(err) {\n\t\t\t\tlogger(context.Background(),\n\t\t\t\t\tfmt.Errorf(\"target.SendFromStore() failed with '%w'\", err),\n\t\t\t\t\ttarget.Name())\n\t\t\t}\n\n\t\t\t// Retrying after 3secs back-off\n\n\t\t\tselect {\n\t\t\tcase <-retryTicker.C:\n\t\t\tcase <-doneCh:\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase itemKey, ok := <-itemKeyCh:\n\t\t\tif !ok {\n\t\t\t\t// closed channel.\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif !send(itemKey) {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-doneCh:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ea9e1b5ef71ab36babed7f1e2e4e3e04", "score": "0.45759398", "text": "func TestChanQueueSync(t *testing.T) {\n\truntime.GOMAXPROCS(runtime.NumCPU())\n\n\tq := queue.NewChanQueue(10)\n\n\twg := new(sync.WaitGroup)\n\n\tfor i := 0; i < 1000; i++ {\n\t\twg.Add(1)\n\t\tgo func(id int) {\n\t\t\tfor j := (id * 100) + 0; j < (id*100)+100; j++ {\n\t\t\t\tq.Push(j)\n\t\t\t}\n\t\t\twg.Done()\n\t\t}(i)\n\t}\n\n\tfor i := 0; i < 1000; i++ {\n\t\twg.Add(1)\n\t\tgo func(id int) {\n\t\t\tfor j := 0; j < 100; j++ {\n\t\t\t\tfor {\n\t\t\t\t\t_, ok := q.Pop()\n\t\t\t\t\tif ok {\n\t\t\t\t\t\t//fmt.Printf(\"%d : %v\\n\", id, v)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\twg.Done()\n\t\t}(i)\n\t}\n\n\twg.Wait()\n\n\tif q.Len() != 0 {\n\t\tt.Error(\"Queue size is : \", q.Len())\n\t}\n}", "title": "" }, { "docid": "c3b1467d0aafa1a2bed86af6435cb1af", "score": "0.45745674", "text": "func (t *Task) SendToQueueHost(args []interface{}, kwargs map[string]interface{}, hostname string) error {\n\tif args == nil {\n\t\targs = make([]interface{}, 0)\n\t}\n\tif kwargs == nil {\n\t\tkwargs = make(map[string]interface{})\n\t}\n\n\tcon, err := t.kuyruk.getConnectionWithTimeout()\n\tif err != nil {\n\t\treturn err\n\t}\n\tch, err := con.Channel()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer ch.Close()\n\n\tqueue := t.queue\n\tif hostname == \"localhost\" {\n\t\thostname = localhost\n\t}\n\tif hostname != \"\" {\n\t\tqueue += \".\" + hostname\n\t}\n\t_, err = ch.QueueDeclare(\n\t\tqueue,\n\t\ttrue, // durable\n\t\tfalse, // auto-delete\n\t\tfalse, // exclusive\n\t\tfalse, // no-wait\n\t\tnil, // args\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttask := map[string]interface{}{\n\t\t\"id\": uuid.NewV1().String(),\n\t\t\"module\": t.module,\n\t\t\"function\": t.function,\n\t\t\"args\": args,\n\t\t\"kwargs\": kwargs,\n\t\t\"queue\": queue,\n\t\t\"sender_hostname\": localhost,\n\t\t\"sender_pid\": os.Getpid(),\n\t\t\"sender_cmd\": strings.Join(os.Args, \" \"),\n\t\t\"sender_timestamp\": time.Now().UTC().Format(time.RFC3339),\n\t}\n\tbody, err := json.Marshal(task)\n\tif err != nil {\n\t\treturn err\n\t}\n\tp := amqp.Publishing{\n\t\tBody: body,\n\t}\n\treturn ch.Publish(\n\t\t\"\", // exchange\n\t\tqueue, // key\n\t\ttrue, // mandatory\n\t\tfalse, // immedeate\n\t\tp,\n\t)\n}", "title": "" }, { "docid": "966af2ddef129bf6ae36f6e4f6c29dae", "score": "0.45732847", "text": "func (o *ListsTransferContactPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "208963b472ed0114a0336152b8345ee7", "score": "0.4569145", "text": "func (t *Transport) Send(data []byte) error {\n\n // Add 4 bytes for the size of the header\n buf := make([]byte, 4+len(data))\n\n binary.BigEndian.PutUint32(buf[:4], uint32(len(data)))\n\n copy(buf[4:], data)\n\n _, err := t.conn.Write(buf)\n if err != nil {\n return err \n }\n\n return nil\n}", "title": "" }, { "docid": "4ec6f3f0513f756ebfe0b5ca68957054", "score": "0.45683998", "text": "func (task *Task) Submit(ctx context.Context, timeout time.Duration) {\n\tif timeout != 0 {\n\t\tctx = context.WithValue(ctx, contextTimeout, timeout)\n\t}\n\ttask.TaskQueue <- ctx\n\ttask.Total += 1\n}", "title": "" }, { "docid": "834e39d6166981905ff6f629418356c4", "score": "0.45655504", "text": "func TestQueue(t *testing.T) {\n\tvar NPAR = 5\n\tdb, err := NewQueue([]string{\"dev.subiz.net:9042\"}, \"smqtest\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tqueue := fmt.Sprintf(\"%d\", time.Now().UnixNano())\n\n\t// insert data into NPAR queues\n\twg := &sync.WaitGroup{}\n\tfor par := 0; par < NPAR; par++ {\n\t\twg.Add(1)\n\t\tgo func(par string) {\n\t\t\tdefer wg.Done()\n\t\t\tvar lastoffset int64\n\t\t\tfor j := 0; j < 1500; j++ {\n\t\t\t\tvar err error\n\t\t\t\tlastoffset, err = db.Enqueue(par+queue, []byte(fmt.Sprintf(\"%d\", j)))\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif lastoffset != 1499 {\n\t\t\t\tt.Errorf(\"%s: should be 1499, got %d\", par, lastoffset)\n\t\t\t}\n\t\t}(fmt.Sprintf(\"%d\", par))\n\t}\n\twg.Wait()\n\n\tfor i := 0; i < NPAR; i++ {\n\t\tpar := fmt.Sprintf(\"%d\", i)\n\t\tvalues, offset, err := db.Fetch(par+queue, -1)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\t// verify message's integrity\n\t\tfor i, v := range values {\n\t\t\tif string(v) != fmt.Sprintf(\"%d\", i) {\n\t\t\t\tt.Fatalf(\"expect %d, got %s\", i, v)\n\t\t\t}\n\t\t}\n\n\t\t// test commit\n\t\t_, offset, err = db.Fetch(par+queue, -1)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tif offset != SEGMENT_SIZE-1 {\n\t\t\tt.Fatalf(\"offset should be %d, got %d\", SEGMENT_SIZE-1, offset)\n\t\t}\n\t\tif err := db.Commit(par+queue, offset); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tlastlen := len(values)\n\t\t// without commit\n\t\tvalues, offset, err = db.Fetch(par+queue, -1)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tif offset != 1499 {\n\t\t\tt.Fatalf(\"expect 1499, got %d\", offset)\n\t\t}\n\t\tfor i, v := range values {\n\t\t\tif string(v) != fmt.Sprintf(\"%d\", i+lastlen) {\n\t\t\t\tt.Fatalf(\"expect %d, got %s\", i+lastlen, v)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "02a9e1d3130522fb8345c454710d202f", "score": "0.4565177", "text": "func (d *Dao) Send(c context.Context, username, msg string) (err error) {\n\tparams := url.Values{}\n\tnow := time.Now().Unix()\n\tparams.Set(\"username\", username)\n\tparams.Set(\"content\", msg)\n\tparams.Set(\"title\", \"test\")\n\tparams.Set(\"url\", \"\")\n\tparams.Set(\"type\", \"wechat\")\n\tparams.Set(\"token\", d.c.Monitor.AppToken)\n\tparams.Set(\"timestamp\", strconv.FormatInt(now, 10))\n\tbap := &model.BAP{\n\t\tUserName: params.Get(\"username\"),\n\t\tContent: params.Get(\"content\"),\n\t\tTitle: params.Get(\"title\"),\n\t\tURL: params.Get(\"url\"),\n\t\tTy: params.Get(\"type\"),\n\t\tToken: params.Get(\"token\"),\n\t\tTimeStamp: now,\n\t\tSignature: d.getSign(params),\n\t}\n\tjsonStr, err := json.Marshal(bap)\n\tif err != nil {\n\t\tlog.Error(\"monitor json.Marshal error (%v)\", err)\n\t\treturn\n\t}\n\treq, err := http.NewRequest(_method, d.url, bytes.NewBuffer(jsonStr))\n\tif err != nil {\n\t\tlog.Error(\"monitor http.NewRequest error (%v)\", err)\n\t\treturn\n\t}\n\treq.Header.Add(\"Content-Type\", _fileType)\n\t// timeout\n\tctx, cancel := context.WithTimeout(c, 800*time.Millisecond)\n\treq = req.WithContext(ctx)\n\tdefer cancel()\n\tresponse, err := d.client.Do(req)\n\tif err != nil {\n\t\tlog.Error(\"monitor d.client.Post error(%v)\", err)\n\t\treturn\n\t}\n\tdefer response.Body.Close()\n\tif response.StatusCode != http.StatusOK {\n\t\tlog.Error(\"monitor http.StatusCode nq http.StatusOK (%d) | url(%s)\", response.StatusCode, d.url)\n\t\treturn\n\t}\n\tbody, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\tlog.Error(\"monitor ioutil.ReadAll error(%v)\", err)\n\t\treturn\n\t}\n\tvar result struct {\n\t\tStatus int `json:\"status\"`\n\t\tMsg string `json:\"msg\"`\n\t}\n\tif err = json.Unmarshal(body, &result); err != nil {\n\t\tlog.Error(\"monitor json.Unmarshal error(%v)\", err)\n\t}\n\tif result.Status != 0 {\n\t\tlog.Error(\"monitor get status(%d) msg(%s)\", result.Status, result.Msg)\n\t}\n\treturn\n}", "title": "" }, { "docid": "5d6e7ca04a4f9da758aff4f8881d4952", "score": "0.45619118", "text": "func (ctrl *ConnectionController) sendToChan(d interface{}) {\r\n\tctrl.Lock()\r\n\tdefer ctrl.Unlock()\r\n\tif !ctrl.Done {\r\n\t\tctrl.SendChan <- d\r\n\t}\r\n}", "title": "" }, { "docid": "e28296993d4f855a6d82e50952a5a2ea", "score": "0.4549901", "text": "func handleTimeout(options *retryOptions, resultChannel chan *RetryResult, lastError error) {\n\tif options.AfterTimeout != nil {\n\t\toptions.AfterTimeout(lastError)\n\t}\n\tsendError(resultChannel, lastError, ErrTimeout)\n}", "title": "" }, { "docid": "b0e4d3ab72f55fc64d84356d220edaf9", "score": "0.4547657", "text": "func (conn *Conn) SendShellData(to string, toIdx uint32, id string, data []byte) {\n\tdup := func(data []byte) []byte {\n\t\tret := make([]byte, len(data))\n\t\tcopy(ret, data)\n\t\treturn ret\n\t}\n\tvar msg network.Msg\n\tmsg.To = to\n\tmsg.ToIdx = toIdx\n\tmsg.XType = network.Msg_shell_data\n\tmsg.LinkId = id\n\tmsg.Payload = &network.Msg_Sdata{\n\t\tSdata: &network.ShellData{\n\t\t\tData: dup(data),\n\t\t},\n\t}\n\tselect {\n\tcase conn.write <- &msg:\n\tcase <-time.After(conn.parent.cfg.WriteTimeout):\n\t}\n}", "title": "" } ]
9a996e18fbd17c160119a086c7334188
ListOfDepth returns slice of list which has nodes on each depth
[ { "docid": "355fd973af80dcd8c7a65d1e97c4bbd4", "score": "0.71793956", "text": "func ListOfDepth(root *BTNode) []*list.List {\n\tif root == nil {\n\t\treturn nil\n\t}\n\n\tvar res []*list.List\n\tqueue := list.New()\n\tqueue.PushFront(root)\n\tfor queue.Len() > 0 {\n\t\tres = append(res, cloneList(queue))\n\t\tnextQueue := list.New()\n\t\tfor queue.Len() > 0 {\n\t\t\telm := queue.Back()\n\t\t\tqueue.Remove(elm)\n\t\t\tbtNode := elm.Value.(*BTNode)\n\n\t\t\tif btNode.Left != nil {\n\t\t\t\tnextQueue.PushFront(btNode.Left)\n\t\t\t}\n\t\t\tif btNode.Right != nil {\n\t\t\t\tnextQueue.PushFront(btNode.Right)\n\t\t\t}\n\t\t}\n\n\t\tqueue = nextQueue\n\t}\n\n\treturn res\n}", "title": "" } ]
[ { "docid": "bb1fb6406bab2230a84ee4bc377bdd1a", "score": "0.7219648", "text": "func ListOfDepths(n *Node) []*Node {\n\n\tal := make([]*Node, 0)\n\tq := Queue{}\n\tq.Enqueue(n)\n\n\t// repeat until queue for a given level is not empty (reach bottom of the tree)\n\tfor !q.IsEmpty() {\n\n\t\t// All nodes of the current level of the tree.\n\t\tlevelNodes := len(q.Nodes)\n\n\t\t// head for a linked list that will hold all nodes of the current level\n\t\tvar head *Node\n\n\t\t// last node of a linked list for chaining new nodes\n\t\tvar tail *Node\n\n\t\t// go through all nodes\n\t\tfor levelNodes > 0 {\n\n\t\t\t// remove one\n\t\t\tn := q.Dequeue()\n\n\t\t\t// point head & tail to it if this is a first node on this level\n\t\t\tif head == nil {\n\t\t\t\thead = n\n\t\t\t\ttail = n\n\t\t\t} else {\n\t\t\t\t// chain to tail\n\t\t\t\ttail.Next = n\n\n\t\t\t\t// re-point to tail to the last node\n\t\t\t\ttail = tail.Next\n\t\t\t}\n\n\t\t\t// add children of current node for processing on the next level\n\t\t\tif n.Left != nil {\n\t\t\t\tq.Enqueue(n.Left)\n\t\t\t}\n\t\t\tif n.Right != nil {\n\t\t\t\tq.Enqueue(n.Right)\n\t\t\t}\n\n\t\t\tlevelNodes--\n\t\t}\n\n\t\t// add a head of the linked list for the current level to a slice of level linked lists\n\t\tal = append(al, head)\n\n\t}\n\treturn al\n}", "title": "" }, { "docid": "b9611421f9ba3727fbe1ecd822e546bd", "score": "0.5807617", "text": "func GetNodesByDepth(db *sql.DB, depth int32) ([]Node, error) {\n\tsql := bytes.NewBufferString(selectSQL)\n\tsql.WriteString(\"depth=?\")\n\n\trows, err := query(db, sql.String(), depth)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnodes := make([]Node, 0, len(rows))\n\tfor _, r := range rows {\n\t\tnodes = append(nodes, Node{\n\t\t\tID: atoi64(r[\"id\"]),\n\t\t\tNode: r[\"node\"],\n\t\t\tParentID: atoi64(r[\"pid\"]),\n\t\t\tDepth: atoi(r[\"depth\"]),\n\t\t\tNumChildren: (atoi(r[\"rgt\"]) - atoi(r[\"lft\"]) - 1) / 2,\n\t\t})\n\t}\n\treturn nodes, nil\n}", "title": "" }, { "docid": "b8e3f8f1752a93e723a0966c68dd4932", "score": "0.5620216", "text": "func (n Nodes) Slice() []*Node", "title": "" }, { "docid": "0e547c791a2d994cfaf04ccb88419b04", "score": "0.5510558", "text": "func _DepthTagList(db *sql.DB, udn_schema map[string]interface{}, source_array []string) []string {\n\t//UdnLog(udn_schema, \"\\nSplit: Lists: %v\\n\\n\", source_array)\n\n\treturn source_array\n}", "title": "" }, { "docid": "6707a69ea92c1c3a7517e322af22487e", "score": "0.53003544", "text": "func makeClosedList(m GridMap) []node {\n\tsz := m.Width() * m.Height()\n\tclosed := make([]node, sz)\n\tfor i := range closed {\n\t\tclosed[i].ind = i\n\t\tclosed[i].parent = -1\n\t\tclosed[i].g = -1\n\t\tclosed[i].pqindex = -1\n\t}\n\treturn closed\n}", "title": "" }, { "docid": "844ed139dd04c98cb37d2ffdcf28a6e2", "score": "0.51800936", "text": "func List(ctx context.Context, filters container.FilterBuilder) ([]*types.Node, error) {\n\tres := []*types.Node{}\n\tvisit := func(ctx context.Context, cluster string, node *types.Node) {\n\t\tres = append(res, node)\n\t}\n\treturn res, list(ctx, visit, filters)\n}", "title": "" }, { "docid": "8614bccf39e972ba5451552a52d3d214", "score": "0.5178612", "text": "func (n *Node) List() []string {\n\treturn n.environmentOffset(len(n.path()))\n}", "title": "" }, { "docid": "f95daa094d4a7ae327957572a062e30e", "score": "0.5172527", "text": "func (tree *Tree23) multipleNodesFromChildrenList(children *[]TreeNodeIndex, cLen int) *[]TreeNodeIndex {\n\n\t//cLen := len(*children)\n\tswitch {\n\tcase cLen <= 3:\n\t\ttree.oneElemTreeList[0] = tree.nodeFromChildrenList(children, 0, cLen)\n\t\treturn &tree.oneElemTreeList\n\tcase cLen <= 6:\n\t\ttree.twoElemTreeList[0] = tree.nodeFromChildrenList(children, 0, cLen/2)\n\t\ttree.twoElemTreeList[1] = tree.nodeFromChildrenList(children, cLen/2, cLen)\n\t\treturn &tree.twoElemTreeList\n\tcase cLen <= 9:\n\t\ttree.threeElemTreeList[0] = tree.nodeFromChildrenList(children, 0, cLen/3)\n\t\ttree.threeElemTreeList[1] = tree.nodeFromChildrenList(children, cLen/3, 2*cLen/3)\n\t\ttree.threeElemTreeList[2] = tree.nodeFromChildrenList(children, 2*cLen/3, cLen)\n\t\treturn &tree.threeElemTreeList\n\t}\n\t// Should never get here!\n\tfmt.Println(\"SHOULD NOT GET HERE\")\n\n\treturn nil\n}", "title": "" }, { "docid": "2dcc8b346adf98e32ad688bc3632802e", "score": "0.513115", "text": "func levels(objects []*inject.Object) ([][]*inject.Object, error) {\n\tlevelsMap := map[int][]*inject.Object{}\n\n\t// ensure no cycles exist for objects that need start/stop, and make a\n\t// flattened graph of all deps.\n\tfor _, o := range objects {\n\t\tif !isEligible(o) {\n\t\t\tcontinue\n\t\t}\n\n\t\tdeps := map[*inject.Object]bool{}\n\t\tpaths := allPaths(o, o, deps)\n\t\tfor _, p := range paths {\n\t\t\t// special case direct cycle to itself\n\t\t\tif len(p) == 1 {\n\t\t\t\treturn nil, cycleError(p)\n\t\t\t}\n\n\t\t\t// cycle is only relevant if more than one value in the path\n\t\t\t// isEligible. if there's just one, there isn't really a cycle from the\n\t\t\t// start/stop perspective.\n\t\t\tcount := 0\n\t\t\tfor _, s := range p {\n\t\t\t\tif isEligible(s.Object) {\n\t\t\t\t\tcount++\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif count > 1 {\n\t\t\t\treturn nil, cycleError(p)\n\t\t\t}\n\t\t}\n\n\t\tstartStopDeps := 0\n\t\tfor dep := range deps {\n\t\t\tif isEligible(dep) {\n\t\t\t\tstartStopDeps++\n\t\t\t}\n\t\t}\n\t\tlevelsMap[startStopDeps] = append(levelsMap[startStopDeps], o)\n\t}\n\n\tvar levelsMapKeys []int\n\tfor k := range levelsMap {\n\t\tlevelsMapKeys = append(levelsMapKeys, k)\n\t}\n\tsort.Sort(sort.Reverse(sort.IntSlice(levelsMapKeys)))\n\n\tlevels := make([][]*inject.Object, 0, len(levelsMapKeys))\n\tfor _, k := range levelsMapKeys {\n\t\tlevels = append(levels, levelsMap[k])\n\t}\n\treturn levels, nil\n}", "title": "" }, { "docid": "580489e9040925d6a03bac1862d50661", "score": "0.5107795", "text": "func DepthRange(n float64, f float64) {\n\tsyscall.Syscall(gpDepthRange, 2, uintptr(math.Float64bits(n)), uintptr(math.Float64bits(f)), 0)\n}", "title": "" }, { "docid": "1a4fc687609d4a668c951d8b09607af4", "score": "0.5066679", "text": "func DepthRangeIndexed(index uint32, n float64, f float64) {\n\tsyscall.Syscall(gpDepthRangeIndexed, 3, uintptr(index), uintptr(math.Float64bits(n)), uintptr(math.Float64bits(f)))\n}", "title": "" }, { "docid": "57dac43a2b5706814b070783f81c2b66", "score": "0.5023527", "text": "func Flatten(tree *Tree) Points {\n\tvar points Points = Points{tree.Value}\n\tif len(tree.Nodes) > 0 {\n\t\tfor i := 0; i < len(tree.Nodes); i++ {\n\t\t\tpoints = append(points, Flatten(tree.Nodes[i])...)\n\t\t}\n\t}\n\treturn points\n}", "title": "" }, { "docid": "bc2cbb056dbb36de2e0d9fb3512e1efa", "score": "0.49935594", "text": "func (n *Node) Flatten() []Node {\n\tvar stack = []Node{*n}\n\tvar out []Node\n\n\tfor len(stack) != 0 {\n\t\tvar node Node\n\t\tnode, stack = stack[len(stack)-1], stack[:len(stack)-1] // Pop.\n\n\t\tif !node.IsDir() {\n\t\t\tout = append(out, node)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Walk Children in reverse order, to preserve forward order on |stack|.\n\t\tfor i := len(node.Children) - 1; i != -1; i-- {\n\t\t\tvar child = node.Children[i]\n\n\t\t\tif node.Delete {\n\t\t\t\tchild.Delete = true\n\t\t\t}\n\t\t\tchild.JournalSpec = pb.UnionJournalSpecs(child.JournalSpec, node.JournalSpec)\n\n\t\t\tstack = append(stack, child)\n\t\t}\n\t}\n\treturn out\n}", "title": "" }, { "docid": "9582fffd00580ee1e3302b22ff887305", "score": "0.49809712", "text": "func (this NestedInteger) GetList() []*NestedInteger { panic(\"\") }", "title": "" }, { "docid": "cff1ce621629276fd705a35afde6dc80", "score": "0.4975002", "text": "func levelOrder(root *TreeNode) [][]int {\n\tvar (\n\t\tvalues *[]int\n\t)\n\tif root == nil {\n\t\treturn nil\n\t}\n\tret := make([][]int, 0)\n\tnext := []*TreeNode{root}\n\tfor {\n\t\tif len(next) != 0 {\n\t\t\tnext, values = children(next)\n\t\t\tret = append(ret, *values)\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "b21f55552dc5ad710ca4cc68a72912e5", "score": "0.49746996", "text": "func SolutionDFS(root *BinaryTreeNode) []*list.List {\n\tresult := []*list.List{}\n\n\tvar dfs func(*BinaryTreeNode, int)\n\n\tdfs = func(root *BinaryTreeNode, level int) {\n\t\tif root == nil {\n\t\t\treturn\n\t\t}\n\n\t\t// found new level\n\t\tif level == len(result) {\n\t\t\tresult = append(result, list.New())\n\t\t}\n\t\tresult[level].PushBack(root.Value)\n\t\tdfs(root.Left, level+1)\n\t\tdfs(root.Right, level+1)\n\n\t}\n\n\tdfs(root, 0)\n\n\treturn result\n}", "title": "" }, { "docid": "089feacd512e6fcc0b1f1d82c4770efa", "score": "0.49336496", "text": "func nodeList(n Node) []Node {\n\tvar list []Node\n\tInspect(n, func(n Node) bool {\n\t\t// don't collect comments\n\t\tswitch n.(type) {\n\t\tcase nil, *CommentGroup, *Comment:\n\t\t\treturn false\n\t\t}\n\t\tlist = append(list, n)\n\t\treturn true\n\t})\n\t// Note: The current implementation assumes that Inspect traverses the\n\t// AST in depth-first and thus _source_ order. If AST traversal\n\t// does not follow source order, the sorting call below will be\n\t// required.\n\t// sort.Sort(byInterval(list))\n\treturn list\n}", "title": "" }, { "docid": "c65e3244174193069f460c7fdd3ee320", "score": "0.4902908", "text": "func WalkedTreeToArray(ch chan int) []int {\n\tresult := make([]int, 10)\n\tfor index := 0; index < 10; index++ {\n\t\tresult[index] = <-ch\n\t}\n\treturn result\n}", "title": "" }, { "docid": "5dca3d46da789a4b6c0737a8888c91d2", "score": "0.48894548", "text": "func DepthRangeIndexed(index uint32, n float64, f float64) {\n C.glowDepthRangeIndexed(gpDepthRangeIndexed, (C.GLuint)(index), (C.GLdouble)(n), (C.GLdouble)(f))\n}", "title": "" }, { "docid": "72d7603c3d4f5718724fb5de491958cd", "score": "0.4887767", "text": "func (d *Graph) ListDeps() (nodes []string) {\n\tfor _, node := range d.Nodes {\n\t\tif node.IsDep {\n\t\t\tnodes = append(nodes, node.Path)\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "5b6d18b3d1d67b0f416f33a3bba23197", "score": "0.48818824", "text": "func (g LabeledAdjacencyList) DepthFirst(start NI, visit func(NI)) {\n\tv := bits.New(len(g))\n\tvar f func(NI)\n\tf = func(n NI) {\n\t\tvisit(n)\n\t\tv.SetBit(int(n), 1)\n\t\tfor _, to := range g[n] {\n\t\t\tif v.Bit(int(to.To)) == 0 {\n\t\t\t\tf(to.To)\n\t\t\t}\n\t\t}\n\t}\n\tf(start)\n}", "title": "" }, { "docid": "02213cdbcf1fe15b7add110fe33185a8", "score": "0.4873302", "text": "func (g AdjacencyList) DepthFirst(start NI, options ...TraverseOption) {\n\tcf := &config{start: start}\n\tfor _, o := range options {\n\t\to(cf)\n\t}\n\tb := cf.visBits\n\tif b == nil {\n\t\tn := bits.New(len(g))\n\t\tb = &n\n\t} else if b.Bit(int(cf.start)) != 0 {\n\t\treturn\n\t}\n\tif cf.pathBits != nil {\n\t\tcf.pathBits.ClearAll()\n\t}\n\tvar df func(NI) bool\n\tdf = func(n NI) bool {\n\t\tb.SetBit(int(n), 1)\n\t\tif cf.pathBits != nil {\n\t\t\tcf.pathBits.SetBit(int(n), 1)\n\t\t}\n\n\t\tif cf.nodeVisitor != nil {\n\t\t\tcf.nodeVisitor(n)\n\t\t}\n\t\tif cf.okNodeVisitor != nil {\n\t\t\tif !cf.okNodeVisitor(n) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\tif cf.rand == nil {\n\t\t\tfor x, to := range g[n] {\n\t\t\t\tif cf.arcVisitor != nil {\n\t\t\t\t\tcf.arcVisitor(n, x)\n\t\t\t\t}\n\t\t\t\tif cf.okArcVisitor != nil {\n\t\t\t\t\tif !cf.okArcVisitor(n, x) {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif b.Bit(int(to)) != 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif !df(to) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tto := g[n]\n\t\t\tfor _, x := range cf.rand.Perm(len(to)) {\n\t\t\t\tif cf.arcVisitor != nil {\n\t\t\t\t\tcf.arcVisitor(n, x)\n\t\t\t\t}\n\t\t\t\tif cf.okArcVisitor != nil {\n\t\t\t\t\tif !cf.okArcVisitor(n, x) {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif b.Bit(int(to[x])) != 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif !df(to[x]) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif cf.pathBits != nil {\n\t\t\tcf.pathBits.SetBit(int(n), 0)\n\t\t}\n\t\treturn true\n\t}\n\tdf(cf.start)\n}", "title": "" }, { "docid": "072f8a73bf9c142a6ae71a01f1604c60", "score": "0.48446748", "text": "func (g *Graph) GetTransactionsByDepth(start *uint64, end *uint64) []*Transaction {\n\tvar transactions []*Transaction\n\n\tg.RLock()\n\tfor depth, index := range g.depthIndex {\n\t\tif (start != nil && depth < *start) || (end != nil && depth > *end) {\n\t\t\tcontinue\n\t\t}\n\n\t\ttransactions = append(transactions, index...)\n\t}\n\tg.RUnlock()\n\n\treturn transactions\n}", "title": "" }, { "docid": "2e741a605c88634f5abf2f14af166268", "score": "0.48409206", "text": "func (z *ZfsH) Children(d *Dataset, depth uint64) ([]*Dataset, error) {\n\targs := []string{\"list\"}\n\tif depth > 0 {\n\t\targs = append(args, \"-d\")\n\t\targs = append(args, strconv.FormatUint(depth, 10))\n\t} else {\n\t\targs = append(args, \"-r\")\n\t}\n\targs = append(args, \"-t\", \"all\", \"-Hp\", \"-o\", strings.Join(DsPropList, \",\"))\n\targs = append(args, d.Name)\n\n\tout, err := z.zfs(args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar datasets []*Dataset\n\tname := \"\"\n\tvar ds *Dataset\n\tfor _, line := range out {\n\t\tif name != line[0] {\n\t\t\tname = line[0]\n\t\t\tds = &Dataset{Name: name}\n\t\t\tdatasets = append(datasets, ds)\n\t\t}\n\t\tif err := ds.parseLine(line); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn datasets[1:], nil\n}", "title": "" }, { "docid": "6357ab130078e98b60577913c67e3ec2", "score": "0.4832374", "text": "func (r *NodeRegistry) List() []ipfs.NodeInfo {\n\tvar (\n\t\tnodes = make([]ipfs.NodeInfo, len(r.nodes))\n\t\ti = 0\n\t)\n\n\tr.nm.RLock()\n\tfor _, n := range r.nodes {\n\t\tnodes[i] = *n\n\t\ti++\n\t}\n\tr.nm.RUnlock()\n\n\treturn nodes\n}", "title": "" }, { "docid": "1cfd42ceb20cea21030532ccd61cbcd1", "score": "0.4789142", "text": "func (tv *TypedLeafListBytes) List() [][]byte {\n\tbytes := make([][]byte, 0)\n\tbuf := make([]byte, 0)\n\tidx := 0\n\tstartAt := 0\n\tfor i, b := range tv.Bytes {\n\t\tvalueLen := tv.TypeOpts[idx]\n\t\tif i-startAt == int(valueLen) {\n\t\t\tbytes = append(bytes, buf)\n\t\t\tbuf = make([]byte, 0)\n\t\t\tidx = idx + 1\n\t\t\tstartAt = startAt + int(valueLen)\n\t\t}\n\t\tbuf = append(buf, b)\n\t}\n\tbytes = append(bytes, buf)\n\treturn bytes\n}", "title": "" }, { "docid": "e1623d72b2b54524c5c6d504ece37793", "score": "0.47831145", "text": "func (net *Network) Depth() int {\n\tmaxDepth := 0\n\tfor _, n := range net.All() {\n\t\tif n.distanceFromOutputNode > maxDepth {\n\t\t\tmaxDepth = n.distanceFromOutputNode\n\t\t}\n\t}\n\treturn maxDepth\n}", "title": "" }, { "docid": "8880e67c5920d858a804f61ed537722d", "score": "0.47737333", "text": "func sumOfDistancesInTree(N int, edges [][]int) []int {\n \n}", "title": "" }, { "docid": "127b4b7e1ce0c0031a6d9b3366bf561c", "score": "0.47530457", "text": "func (n *NodeServiceImpl) List(namespace string, listOptions *models.ListOptions) (*models.NodeList, error) {\n\tlist, err := n.Node.ListNode(nil, namespace, listOptions)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tshadowList, err := n.Shadow.List(namespace, list)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tshadowMap := toShadowMap(shadowList)\n\n\tfor idx := range list.Items {\n\t\tnode := &list.Items[idx]\n\t\tif shadow, ok := shadowMap[node.Name]; ok {\n\t\t\tnode.Desire = shadow.Desire\n\t\t\tnode.Report = shadow.Report\n\t\t}\n\t}\n\tif listOptions.NodeSelector != \"\" {\n\t\treturn filterNodeListByNodeSelector(list), nil\n\t}\n\treturn list, nil\n}", "title": "" }, { "docid": "4d4b44252391c804655b2141fbad7e62", "score": "0.47389275", "text": "func levelOrder(root *Node) [][]int {\n\tif root == nil {\n\t\treturn [][]int{}\n\t}\n\n\tvar s [][]int\n\tbfs(root, &s, 0)\n\treturn s\n}", "title": "" }, { "docid": "b547ff3698d4cfa43b84ac4389a7e867", "score": "0.47348595", "text": "func (t *layerTree) layersOf(image *Image) []*storage.Layer {\n\tvar layers []*storage.Layer\n\tnode := t.node(image.TopLayer())\n\tfor node != nil {\n\t\tlayers = append(layers, node.layer)\n\t\tnode = node.parent\n\t}\n\treturn layers\n}", "title": "" }, { "docid": "a1e397f626e5ee2610ee77ef07945192", "score": "0.47287214", "text": "func Depth(index uint) (depth uint) {\n\tindex++\n\tfor (index & 1) == 0 {\n\t\tdepth++\n\t\tindex = rightShift(index)\n\t}\n\treturn\n}", "title": "" }, { "docid": "12e707d675991f41233921c6ed2cf357", "score": "0.47287086", "text": "func (n *Node) Depth() int {\n\treturn n.depth\n}", "title": "" }, { "docid": "21d7cbe7f21cda8d7a602d0f72fcafcb", "score": "0.46990475", "text": "func levelOrder(root *TreeNode) [][]int {\n\tans := make([][]int, 0)\n\tif root == nil {\n\t\treturn ans\n\t}\n\tq := make([]*TreeNode, 0) // queue, use \"append\" to do enqueue.\n\tq = append(q, root)\n\tfor len(q) > 0 {\n\t\tlq := len(q)\n\t\tlevel := make([]int, 0)\n\t\tfor i := 0; i < lq; i++ {\n\t\t\tdeq := q[i]\n\t\t\tlevel = append(level, deq.Val)\n\t\t\tif deq.Left != nil {\n\t\t\t\tq = append(q, deq.Left)\n\t\t\t}\n\t\t\tif deq.Right != nil {\n\t\t\t\tq = append(q, deq.Right)\n\t\t\t}\n\t\t}\n\t\tq = q[lq:] // dequeue\n\t\tans = append(ans, level)\n\t}\n\treturn ans\n}", "title": "" }, { "docid": "2fdd213e7819f8d48802db3521ee356a", "score": "0.46966195", "text": "func (levels DepthOfMarketLevels) Clone() DepthOfMarketLevels {\n\tresult := make(DepthOfMarketLevels, len(levels))\n\tfor i, level := range levels {\n\t\tresult[i] = level.Clone()\n\t}\n\treturn result\n}", "title": "" }, { "docid": "ef82cc7081765162cd2b85b505b1ad49", "score": "0.46941045", "text": "func DepthFunc(xfunc uint32) {\n\tsyscall.Syscall(gpDepthFunc, 1, uintptr(xfunc), 0, 0)\n}", "title": "" }, { "docid": "e959aedd6003b02bd0a2982c3a67b53b", "score": "0.46858382", "text": "func (k Keeper) GetProductsFromDepthBookMap() []string {\n\treturn k.diskCache.getProductsFromDepthBookMap()\n}", "title": "" }, { "docid": "bd1899ce61e47017c078ba405fc7b24f", "score": "0.46747634", "text": "func (t *RoutingTable) GetLevel(level int) (nodes []Node) {\n\tt.mutex.Lock()\n\t// TODO: Students should implement this\n\t// Debug.Printf(\"start to get leve %v\\n\", level)\n\tfor i := 0; i < BASE; i++ {\n\t\tslot := t.rows[level][i]\n\t\tif len(*slot) != 0 && ((*slot)[0].Id.big()).Cmp(t.local.Id.big()) != 0 {\n\t\t\tnodes = append(nodes, (*slot)[0])\n\t\t}\t\t\t\t\n\t}\n\n\tt.mutex.Unlock()\n\treturn nodes\n}", "title": "" }, { "docid": "a56677e29f7193561b33b7c69e415ea1", "score": "0.46698588", "text": "func getNodes(path string) ([]string, error) {\n\tchildren, _, err := zk.Children(path)\n\tif err != nil {\n\t\tLog.Error(\"zk.Children(%s) error\", path)\n\t\treturn nil, err\n\t}\n\n\tif children == nil {\n\t\treturn nil, ErrNoNode\n\t}\n\n\treturn children, nil\n}", "title": "" }, { "docid": "f9d4375992036b992c775b96c284c4fa", "score": "0.46640936", "text": "func (r *PerformanceResults) findAllChildrenGraphLookup(parent string, maxDepth int, tags []string) error {\n\tconf, session, err := cedar.GetSessionWithConfig(r.env)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\tdefer session.Close()\n\n\tmatch := bson.M{\"$match\": bson.M{\"_id\": parent}}\n\tgraphLookup := bson.M{\n\t\t\"$graphLookup\": bson.M{\n\t\t\t\"from\": perfResultCollection,\n\t\t\t\"startWith\": \"$\" + \"_id\",\n\t\t\t\"connectFromField\": \"_id\",\n\t\t\t\"connectToField\": bsonutil.GetDottedKeyName(\"info\", \"parent\"),\n\t\t\t\"as\": \"children\",\n\t\t},\n\t}\n\tif maxDepth >= 0 {\n\t\tfields := graphLookup[\"$graphLookup\"].(bson.M)\n\t\tfields[\"maxDepth\"] = maxDepth\n\t}\n\tvar project bson.M\n\tif len(tags) > 0 {\n\t\tproject = bson.M{\n\t\t\t\"$project\": bson.M{\n\t\t\t\t\"_id\": 0,\n\t\t\t\t\"children\": bson.M{\n\t\t\t\t\t\"$filter\": bson.M{\n\t\t\t\t\t\t\"input\": \"$\" + \"children\",\n\t\t\t\t\t\t\"as\": \"child\",\n\t\t\t\t\t\t\"cond\": bson.M{\n\t\t\t\t\t\t\t\"$eq\": []interface{}{\n\t\t\t\t\t\t\t\ttags,\n\t\t\t\t\t\t\t\t\"$$\" + bsonutil.GetDottedKeyName(\"child\", \"info\", \"tags\"),\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} else {\n\t\tproject = bson.M{\"$project\": bson.M{\"_id\": 0, \"children\": 1}}\n\t}\n\tpipeline := []bson.M{\n\t\tmatch,\n\t\tgraphLookup,\n\t\tproject,\n\t}\n\tpipe := session.DB(conf.DatabaseName).C(perfResultCollection).Pipe(pipeline)\n\titer := pipe.Iter()\n\tdefer iter.Close()\n\n\tdoc := struct {\n\t\tChildren []PerformanceResult `bson:\"children,omitempty\"`\n\t}{}\n\tfor iter.Next(&doc) {\n\t\tr.Results = append(r.Results, doc.Children...)\n\t}\n\tif err = iter.Err(); err != nil {\n\t\treturn errors.Wrap(err, \"problem getting children\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bf5d5319e0fa885835bb64dbef65dab6", "score": "0.4647783", "text": "func (devices *DeviceSet) ListLayers() ([]string, error) {\n\tif err := devices.cleanupDeletedDevices(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tdevices.Lock()\n\tdefer devices.Unlock()\n\n\tids := make([]string, 0, len(devices.Devices))\n\tfor k, d := range devices.Devices {\n\t\tif k == \"\" || d.Deleted {\n\t\t\tcontinue\n\t\t}\n\t\tids = append(ids, k)\n\t}\n\treturn ids, nil\n}", "title": "" }, { "docid": "d5b61aba1dd98675f499b9690e3b3104", "score": "0.46415138", "text": "func (td *TreeDirectory) List() []TreeDirectoryEntry {\n\tvar o []TreeDirectoryEntry\n\tfor _, e := range td.flatDents {\n\t\to = append(o, *e)\n\t}\n\treturn o\n}", "title": "" }, { "docid": "bee7ee5831450a2df25d08e1fa3723ed", "score": "0.4625504", "text": "func DepthRangeIndexed(index uint32, n float64, f float64) {\n\tC.glowDepthRangeIndexed(gpDepthRangeIndexed, (C.GLuint)(index), (C.GLdouble)(n), (C.GLdouble)(f))\n}", "title": "" }, { "docid": "bee7ee5831450a2df25d08e1fa3723ed", "score": "0.4625504", "text": "func DepthRangeIndexed(index uint32, n float64, f float64) {\n\tC.glowDepthRangeIndexed(gpDepthRangeIndexed, (C.GLuint)(index), (C.GLdouble)(n), (C.GLdouble)(f))\n}", "title": "" }, { "docid": "132ce4c57ef40758efc7a1bf794c5e83", "score": "0.46248502", "text": "func SliceOfBFS(t Tree) []float64 {\n\tslice := []float64{}\n\n\tif t.root() == nil {\n\t\treturn slice\n\t}\n\n\tcurr := t.root()\n\tq := queue.New()\n\tq.Enqueue(curr)\n\n\tfor q.First() != nil {\n\t\tcurr := q.Dequeue().(*treeNode)\n\t\tv := curr.Value\n\t\tslice = append(slice, v)\n\t\tif curr.Left != nil {\n\t\t\tq.Enqueue(curr.Left)\n\t\t}\n\t\tif curr.Right != nil {\n\t\t\tq.Enqueue(curr.Right)\n\t\t}\n\t}\n\treturn slice\n}", "title": "" }, { "docid": "f11035bbb59fe5d5aed2a41068f15000", "score": "0.46245196", "text": "func zigzagLevelOrder_Using_Stack(root *TreeNode) [][]int {\n\tvar res [][]int\n\tif root == nil {\n\t\treturn res\n\t}\n\tvar stack1, stack2 Stack\n\tcur, another := &stack1, &stack2\n\tcur.push(root)\n\tfor !cur.isEmpty() {\n\t\tpath := make([]int, 0)\n\t\tfor !cur.isEmpty() {\n\t\t\tn := cur.pop()\n\t\t\tpath = append(path, n.Val)\n\t\t\tif cur == &stack1 {\n\t\t\t\tif n.Left != nil {\n\t\t\t\t\tanother.push(n.Left)\n\t\t\t\t}\n\t\t\t\tif n.Right != nil {\n\t\t\t\t\tanother.push(n.Right)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif n.Right != nil {\n\t\t\t\t\tanother.push(n.Right)\n\t\t\t\t}\n\t\t\t\tif n.Left != nil {\n\t\t\t\t\tanother.push(n.Left)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tres = append(res, path)\n\t\tcur, another = another, cur\n\t}\n\treturn res\n}", "title": "" }, { "docid": "191b9044c7555a66680043e1a76458a9", "score": "0.46105075", "text": "func (rootNode *Node) Children() []helpers.GraphNode {\n\tchildrenSlice := []helpers.GraphNode{}\n\n\t// Iterate through all size 2 groupings of adjacent elements\n\tfor subLen := len(rootNode.contents) - 1; subLen > 1; subLen-- {\n\t\tfor i := 0; i+subLen < len(rootNode.contents)+1; i++ {\n\t\t\tnewNode := &Node{}\n\t\t\tnewNode.parent = rootNode\n\t\t\tnewNode.lock = &sync.Mutex{}\n\n\t\t\t// Copy the array associated with rootNode so as not to modify the original\n\t\t\ttempContents := make([]int, len(rootNode.contents), (cap(rootNode.contents)))\n\t\t\tcopy(tempContents, rootNode.contents)\n\n\t\t\t// Do the rotation\n\t\t\tnewContents := append(tempContents[:i], reverse(tempContents[i:subLen+i])...)\n\t\t\tnewContents = append(newContents, tempContents[subLen+i:len(tempContents)]...)\n\t\t\t// Put the new node on the slice\n\t\t\tnewNode.contents = newContents\n\n\t\t\tchildrenSlice = append(childrenSlice, newNode)\n\t\t}\n\t}\n\n\treturn childrenSlice\n}", "title": "" }, { "docid": "c1a77d702811bba1d476c573ca70a222", "score": "0.4609823", "text": "func (g Undirect) Nodes() Nodes { return g.G.Nodes() }", "title": "" }, { "docid": "218e6f977276d059bd6b7200e31a8f55", "score": "0.46078065", "text": "func constructGraph(v int) *list.List {\n\tdegree = make([]int,v)\n\tMasterList := list.New()\n\tfor i := 0; i < v; i++ {\n\t\tvar l = list.New()\n\t\tl.PushBack(i)\n\t\tMasterList.PushBack(l)\n\t}\n\treturn MasterList\n}", "title": "" }, { "docid": "9f9c9e4130b66ef796620a0a8d89f2fd", "score": "0.4602874", "text": "func (c *Components) Walk() ([]*Vertex, error) {\n\tvar list []*Vertex\n\n\tch, _, err := c.graph.DescendantsWalker(c.root)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor v := range ch {\n\t\tlist = append(list, v.(*Vertex))\n\t}\n\n\treturn list, nil\n}", "title": "" }, { "docid": "41a3bf65cbb782b58f3e9323a1b19545", "score": "0.45947596", "text": "func (a *LocalActivations) Depth() int {\n\treturn len(a.activations)\n}", "title": "" }, { "docid": "cfb1b0fc1017745104c96215e9313225", "score": "0.45867217", "text": "func (o *AnimationTreePlayer) GetNodeList() gdnative.PoolStringArray {\n\t//log.Println(\"Calling AnimationTreePlayer.GetNodeList()\")\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(\"AnimationTreePlayer\", \"get_node_list\")\n\n\t// Call the parent method.\n\t// PoolStringArray\n\tretPtr := gdnative.NewEmptyPoolStringArray()\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.NewPoolStringArrayFromPointer(retPtr)\n\treturn ret\n}", "title": "" }, { "docid": "33d2c1bd4f3d2c4679ce8f4a35c00af9", "score": "0.4586196", "text": "func buildTree(parts []Hashable) []Hashable {\n\tvar nodes []Hashable\n\tvar i int\n\tfor i = 0; i < len(parts); i += 2 {\n\t\tif i + 1 < len(parts) {\n\t\t\tnodes = append(nodes, Node{left: parts[i], right: parts[i+1]})\n\t\t} else {\n\t\t\tnodes = append(nodes, Node{left: parts[i], right: EmptyBlock{}})\n\t\t}\n\t}\n\tif len(nodes) == 1 {\n\t\treturn nodes\n\t} else if len(nodes) > 1 {\n\t\treturn buildTree(nodes)\n\t} else {\n\t\tpanic(\"huh?!\")\n\t}\n}", "title": "" }, { "docid": "c3ba057e171e0135e63bdc36fa86641d", "score": "0.4585275", "text": "func (zk *dbZk) List(path string) ([]string, error) {\n\tb, _ := zk.ZkCli.Exist(path)\n\tif !b {\n\t\treturn nil, nil\n\t}\n\n\tvar failed bool\n\tstarted := time.Now()\n\n\tchilds, err := zk.ZkCli.GetChildren(path)\n\tif err != nil {\n\t\tfailed = true\n\t}\n\n\tstore.ReportStorageOperatorMetrics(store.StoreOperatorFetch, started, failed)\n\treturn childs, err\n}", "title": "" }, { "docid": "6a089b447cabc309494843bee0ea23ae", "score": "0.45805055", "text": "func newLevelSlice(iter iterator) LevelSlice {\n\ts := LevelSlice{iter: iter}\n\tif iter.r != nil {\n\t\ts.length = iter.r.subtreeCount\n\t}\n\ts.verifyInvariants()\n\treturn s\n}", "title": "" }, { "docid": "c0dc0dcd6a879f30ff67cb6ee3f86577", "score": "0.45792678", "text": "func (p *Bittrex) GetDepthValue(pair string) [][]DepthPrice {\n\n\tif err, response := p.marketRequest(\"/public/getorderbook\", map[string]string{\n\t\t\"market\": p.parsePair(pair),\n\t\t\"type\": \"both\",\n\t}, false); err != nil {\n\t\tlogger.Errorf(\"Fail to get Orderbook:%v\", err)\n\t\treturn nil\n\t} else {\n\t\tif response[\"success\"].(bool) {\n\t\t\tlist := make([][]DepthPrice, 2)\n\t\t\tdata := response[\"result\"].(map[string]interface{})\n\t\t\tif data[\"sell\"] == nil || data[\"buy\"] == nil {\n\t\t\t\tlogger.Error(\"Invlaid orderbook\")\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tasks := data[\"sell\"].([]interface{})\n\t\t\tbids := data[\"buy\"].([]interface{})\n\n\t\t\tif asks != nil && len(asks) > 0 {\n\t\t\t\taskList := make([]DepthPrice, len(asks))\n\t\t\t\tfor i, ask := range asks {\n\t\t\t\t\tvalues := ask.(map[string]interface{})\n\t\t\t\t\taskList[i].Price = values[\"Rate\"].(float64)\n\t\t\t\t\taskList[i].Quantity = values[\"Quantity\"].(float64)\n\t\t\t\t}\n\n\t\t\t\tlist[DepthTypeAsks] = askList\n\t\t\t}\n\n\t\t\tif bids != nil && len(bids) > 0 {\n\t\t\t\tbidList := make([]DepthPrice, len(bids))\n\t\t\t\tfor i, bid := range bids {\n\t\t\t\t\tvalues := bid.(map[string]interface{})\n\t\t\t\t\tbidList[i].Price = values[\"Rate\"].(float64)\n\t\t\t\t\tbidList[i].Quantity = values[\"Quantity\"].(float64)\n\t\t\t\t}\n\n\t\t\t\tlist[DepthTypeBids] = bidList\n\t\t\t}\n\n\t\t\treturn list\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "386c5e9eae88c3ef6a87a1e1c1fcb18e", "score": "0.45767298", "text": "func (msaNodes *msaNodes) getOrderedList() []int {\n\tlist := []int{}\n\tfor node := range msaNodes.nodeHolder {\n\t\tlist = append(list, node)\n\t}\n\tsort.Ints(list)\n\treturn list\n}", "title": "" }, { "docid": "a9d0ba1a1bf50e62e2bdd0ed2d34af6f", "score": "0.45745993", "text": "func parseRecurse(tree []node, l *lexer, end *token, depth int) ([]node, error) {\n\tdepth++\n\tif depth > depthLimit {\n\t\treturn nil, fmt.Errorf(\"depth limit %v\", depthLimit)\n\t}\n\tfor {\n\t\tt, err := l.Next()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif t == nil {\n\t\t\tif end != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"unclosed scope %v\", end)\n\t\t\t}\n\t\t\treturn tree, nil\n\t\t}\n\t\tswitch t.tt {\n\t\tcase ttArray:\n\t\t\tnodes, err := parseRecurse(make([]node, 0), l, t, depth)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\ttree = append(tree, &nodeArray{name: t.val, nodes: nodes})\n\t\tcase ttEnd:\n\t\t\tif end == nil {\n\t\t\t\treturn nil, fmt.Errorf(\"unopened scope %v\", t)\n\t\t\t}\n\t\t\tif t.val != end.val {\n\t\t\t\treturn nil, fmt.Errorf(\"unmatched tag %v\", t)\n\t\t\t}\n\t\t\treturn tree, nil\n\t\tcase ttIfdef:\n\t\t\tnodes, err := parseRecurse(make([]node, 0), l, t, depth)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\ttree = append(tree, &nodeIfdef{name: t.val, nodes: nodes})\n\t\tcase ttIfndef:\n\t\t\tnodes, err := parseRecurse(make([]node, 0), l, t, depth)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\ttree = append(tree, &nodeIfndef{name: t.val, nodes: nodes})\n\t\tcase ttInclude:\n\t\t\ttree = append(tree, &nodeInclude{name: t.val})\n\t\tcase ttObject:\n\t\t\tnodes, err := parseRecurse(make([]node, 0), l, t, depth)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\ttree = append(tree, &nodeObject{name: t.val, nodes: nodes})\n\t\tcase ttPrint:\n\t\t\ttree = append(tree, &nodePrint{name: t.val})\n\t\tcase ttString:\n\t\t\ttree = append(tree, &nodeString{val: t.val})\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"unknown type %q, programmer error\", t.tt))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9bc6b03f4aa8be368329b94ccd348a08", "score": "0.4571498", "text": "func levelOrderQueue(root *TreeNode) [][]int {\n\tres := [][]int{}\n\tif root == nil {\n\t\treturn res\n\t}\n\tnodeQueue := []*TreeNode{root}\n\tlevel := 0\n\n\tfor len(nodeQueue) > 0 {\n\t\tres = append(res, []int{})\n\t\tcounter := len(nodeQueue)\n\t\tfor counter > 0 {\n\t\t\tres[level] = append(res[level], nodeQueue[0].Val)\n\t\t\tif nodeQueue[0].Left != nil {\n\t\t\t\tnodeQueue = append(nodeQueue, nodeQueue[0].Left)\n\t\t\t}\n\t\t\tif nodeQueue[0].Right != nil {\n\t\t\t\tnodeQueue = append(nodeQueue, nodeQueue[0].Right)\n\t\t\t}\n\t\t\tnodeQueue = nodeQueue[1:]\n\t\t\tcounter--\n\t\t}\n\t\tlevel++\n\t}\n\treturn res\n}", "title": "" }, { "docid": "1ba2c7e0db04d7c0fe03bcfed9fc478d", "score": "0.45652717", "text": "func DepthMask(flag bool) {\n\tsyscall.Syscall(gpDepthMask, 1, boolToUintptr(flag), 0, 0)\n}", "title": "" }, { "docid": "79e93d1d98c4fd9e0d8054a2a2142dba", "score": "0.45581034", "text": "func (d *Graph) ListNodes() (nodes []string) {\n\tfor _, node := range d.Nodes {\n\t\tnodes = append(nodes, node.Path)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "d117d2a36c9a32826d51e4e0a92207dd", "score": "0.455604", "text": "func DFS(traversalType string) []int {\n\tvar data []int\n\tif traversalType == \"pre\" {\n\t\tdata = traversePre(data, 0)\n\t} else if traversalType == \"in\" {\n\t\tdata = traverseIn(data, 0)\n\t} else if traversalType == \"pos\" {\n\t\tdata = traversePos(data, 0)\n\t}\n\treturn data\n}", "title": "" }, { "docid": "cd86724178b8ab60a936380d6df47082", "score": "0.45553443", "text": "func (tv *TypedLeafListUint) List() ([]uint64, Width) {\n\tcount := len(tv.TypeOpts) - 1\n\n\tuintList := make([]uint64, 0)\n\twidth := tv.TypeOpts[0]\n\tvar byteCounter int32 = 0\n\tfor i := 0; i < count; i++ {\n\t\tv := tv.Bytes[byteCounter : byteCounter+tv.TypeOpts[1+i]]\n\t\tbyteCounter = byteCounter + tv.TypeOpts[1+i]\n\t\tvar bigInt big.Int\n\t\tbigInt.SetBytes(v)\n\t\tuintList = append(uintList, bigInt.Uint64())\n\t}\n\n\treturn uintList, Width(width)\n}", "title": "" }, { "docid": "955f69aeb7485a4e6ca8fd9e1eccd815", "score": "0.45535553", "text": "func levelOrder(root *TreeNode) [][]int {\n\treturn helper(root)\n}", "title": "" }, { "docid": "fe6d9713cfff62be66963ffa1c9aed1c", "score": "0.45466956", "text": "func zigzagLevelOrder(root *flatten.TreeNode) [][]int {\n\tvar (\n\t\tvalues *[]int\n\t)\n\tif root == nil {\n\t\treturn nil\n\t}\n\tret := make([][]int, 0)\n\tnext := []*flatten.TreeNode{root}\n\tfromLeft := true\n\tfor {\n\t\tif len(next) != 0 {\n\t\t\tnext, values = zigzag(next, fromLeft)\n\t\t\tfromLeft = !fromLeft\n\t\t\tret = append(ret, *values)\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "b0305bbcc3f157476e2d43d36a0186ef", "score": "0.4546073", "text": "func polyTreeToLayerParts(tree *clipper.PolyTree) []data.LayerPart {\n\tvar layerParts []data.LayerPart\n\n\tvar polysForNextRound []*clipper.PolyNode\n\n\tfor _, c := range tree.Childs() {\n\t\tpolysForNextRound = append(polysForNextRound, c)\n\t}\n\tfor {\n\t\tif polysForNextRound == nil {\n\t\t\tbreak\n\t\t}\n\t\tthisRound := polysForNextRound\n\t\tpolysForNextRound = nil\n\n\t\tfor _, p := range thisRound {\n\t\t\tvar holes data.Paths\n\n\t\t\tfor _, child := range p.Childs() {\n\t\t\t\t// TODO: simplify, yes / no ??\n\t\t\t\tholes = append(holes, microPath(child.Contour(), false))\n\t\t\t\tfor _, c := range child.Childs() {\n\t\t\t\t\tpolysForNextRound = append(polysForNextRound, c)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// TODO: simplify, yes / no ??\n\t\t\tlayerParts = append(layerParts, data.NewBasicLayerPart(microPath(p.Contour(), false), holes))\n\t\t}\n\t}\n\n\treturn layerParts\n}", "title": "" }, { "docid": "39bbe078d03ddadb7a27222241d0579a", "score": "0.45443234", "text": "func (c *ProjectsLogServicesIndexesListCall) Depth(depth int64) *ProjectsLogServicesIndexesListCall {\n\tc.params_.Set(\"depth\", fmt.Sprintf(\"%v\", depth))\n\treturn c\n}", "title": "" }, { "docid": "8750e226c34e360fbb5fff14f8116f7e", "score": "0.45416826", "text": "func CreateTree(parties []int, B int, lambda int) []Node {\n\tnodes := make([]Node, (2*B)-1) //create length based on B\n\tfor i := 0; i < len(nodes); i++ {\n\t\tpath, nonces := CreatePath(parties, int(math.Pow(math.Log2(float64(lambda)), 2))) //use path for each node\n\t\tnodes[i].Path = path\n\t\tnodes[i].Nonces = nonces\n\t\t//assigns nodes\n\t}\n\tfactor := 0 //this makes the right parent index\n\tpivotNode := CalculatePivotNode(B)\n\tfor i := 0; i < pivotNode; i++ {\n\t\tnodes[i].Parent = &nodes[B+factor] //so the parent is the right node, and last is null\n\t\tif i%2 == 1 {\n\t\t\tfactor += 1\n\t\t}\n\t}\n\treturn nodes\n\n}", "title": "" }, { "docid": "4ed130ef432662f304dc632bc539218a", "score": "0.45371655", "text": "func txNodeFindDescendents(tx *genji.Tx, id string, recursive bool, level int) ([]data.NodeEdge, error) {\n\tvar nodes []data.NodeEdge\n\n\tif level > 100 {\n\t\treturn nodes, errors.New(\"Error: txNodeFindDescendents, recursion limit reached\")\n\t}\n\n\tedges, err := txEdgeDown(tx, id)\n\tif err != nil {\n\t\treturn nodes, err\n\t}\n\n\tfor _, edge := range edges {\n\t\tnode, err := txNode(tx, edge.Down)\n\t\tif err != nil {\n\t\t\tif err != genjierrors.ErrDocumentNotFound {\n\t\t\t\t// something bad happened\n\t\t\t\treturn nodes, err\n\t\t\t}\n\t\t\t// else something is minorly wrong with db, print\n\t\t\t// error and return\n\t\t\tlog.Println(\"Error finding node: \", edge.Down)\n\t\t\tcontinue\n\t\t}\n\n\t\tn := node.ToNodeEdge(*edge)\n\n\t\tnodes = append(nodes, n)\n\n\t\ttombstone, _ := n.IsTombstone()\n\n\t\tif recursive && !tombstone {\n\t\t\tdownNodes, err := txNodeFindDescendents(tx, edge.Down, true, level+1)\n\t\t\tif err != nil {\n\t\t\t\treturn nodes, err\n\t\t\t}\n\n\t\t\tnodes = append(nodes, downNodes...)\n\t\t}\n\t}\n\n\treturn nodes, nil\n}", "title": "" }, { "docid": "2cecb1b913ea3089bb0f9cb80420cd7b", "score": "0.4535318", "text": "func (b *ListBuilder) List() *NodeList {\n\tif b.filters == nil && len(b.filters) == 0 {\n\t\treturn b.list\n\t}\n\tfiltered := &NodeList{}\n\tfor _, node := range b.list.items {\n\t\tnode := node // Pin it\n\t\tif b.filters.all(node) {\n\t\t\tfiltered.items = append(filtered.items, node)\n\t\t}\n\t}\n\treturn filtered\n}", "title": "" }, { "docid": "13a437d2ad70f66724a5ceff1c3366be", "score": "0.4491209", "text": "func (v *Vertex) flatten() []string {\n\n\tlineage := []string{}\n\n\tp := v\n\tfor p != nil {\n\t\t// Prepend the lineage\n\t\tlineage = append([]string{p.Identifier}, lineage...)\n\t\tp = p.Parent\n\t}\n\n\treturn lineage\n}", "title": "" }, { "docid": "794a63658023caddcaee153b6751666d", "score": "0.44891715", "text": "func (z *Skiplist) firstNodeInRange(spec RangeSpec) ([]*skiplistNode, []int) {\n\tif !z.isInRange(spec) {\n\t\treturn nil, nil\n\t}\n\n\tfirstNodePath := make([]*skiplistNode, z.level)\n\tfirstNodeRanks := make([]int, z.level)\n\tx := z.head\n\tfor i := z.level - 1; i >= 0; i-- {\n\t\trank := 0\n\t\tfor x.level[i].forward != nil && !spec.gteMin(x.level[i].forward.ordered) {\n\t\t\trank += x.level[i].span\n\t\t\tx = x.level[i].forward\n\t\t}\n\t\tfirstNodePath[i] = x\n\t\tfirstNodeRanks[i] = rank\n\t}\n\n\tif !spec.lteMax(x.level[0].forward.ordered) {\n\t\treturn nil, nil\n\t}\n\n\tfor i := z.level - 2; i >= 0; i-- {\n\t\tfirstNodeRanks[i] += firstNodeRanks[i+1]\n\t}\n\n\treturn firstNodePath, firstNodeRanks\n}", "title": "" }, { "docid": "db1b410f94d559df14c0914815240031", "score": "0.44882858", "text": "func main() {\n\tn12 := &Node{Val: 12}\n\tn11 := &Node{Val: 11, Next: n12}\n\tn12.Prev = n11\n\n\tn10 := &Node{Val: 10}\n\tn9 := &Node{Val: 9, Next: n10}\n\tn10.Prev = n9\n\tn8 := &Node{Val: 8, Next: n9}\n\tn9.Prev = n8\n\tn7 := &Node{Val: 7, Next: n8}\n\tn8.Prev = n7\n\tn8.Child = n11\n\n\tn6 := &Node{Val: 6}\n\tn5 := &Node{Val: 5, Next: n6}\n\tn6.Prev = n5\n\tn4 := &Node{Val: 4, Next: n5}\n\tn5.Prev = n4\n\tn3 := &Node{Val: 3, Next: n4}\n\tn4.Prev = n3\n\tn2 := &Node{Val: 2, Next: n3}\n\tn3.Prev = n2\n\tn1 := &Node{Val: 1, Next: n2}\n\tn3.Child = n7\n\n\t//flatten(n1)\n\tflattenNonRec(n1)\n\tprintList(n1)\n}", "title": "" }, { "docid": "b3d0763162624a083746495745ded8b2", "score": "0.44877282", "text": "func (tree *Tree23) Depths() (int, int) {\n\treturn tree.minmaxDepth(tree.root)\n}", "title": "" }, { "docid": "06eb35bb34c475366a9e9947e8aa25c9", "score": "0.4476886", "text": "func trickleDepthInfo(node *h.FSNodeOverDag, maxlinks int) (depth int, repeatNumber int) {\n\tn := node.NumChildren()\n\n\tif n < maxlinks {\n\t\t// We didn't even added the initial `maxlinks` leaf nodes (`FillNodeLayer`).\n\t\treturn 0, 0\n\t}\n\n\tnonLeafChildren := n - maxlinks\n\t// The number of non-leaf child nodes added in `fillTrickleRec` (after\n\t// the `FillNodeLayer` call).\n\n\tdepth = nonLeafChildren/depthRepeat + 1\n\t// \"Deduplicate\" the added `depthRepeat` sub-graphs at each depth\n\t// (rounding it up since we may be on an unfinished depth with less\n\t// than `depthRepeat` sub-graphs).\n\n\trepeatNumber = nonLeafChildren % depthRepeat\n\t// What's left after taking full depths of `depthRepeat` sub-graphs\n\t// is the current `repeatNumber` we're at (this fractional part is\n\t// what we rounded up before).\n\n\treturn\n}", "title": "" }, { "docid": "a8cc75038536bf52ba668421b67edada", "score": "0.44738734", "text": "func getNodeDepth(line string) int {\n\tdepth := 0\n\tfor {\n\t\tif isNode(line) {\n\t\t\tdepth++\n\t\t\tline = line[1 : len(line)-1]\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn depth\n}", "title": "" }, { "docid": "246b985d758a3770dada2df4b5bb66e1", "score": "0.44726914", "text": "func (g *Graph) DepthLen(start *uint64, end *uint64) int {\n\tcount := 0\n\n\tg.RLock()\n\tfor depth, index := range g.depthIndex {\n\t\tif (start != nil && depth < *start) || (end != nil && depth > *end) {\n\t\t\tcontinue\n\t\t}\n\n\t\tcount += len(index)\n\t}\n\tg.RUnlock()\n\n\treturn count\n}", "title": "" }, { "docid": "e7500763c28478a8ca105fe38b8ff38e", "score": "0.4469674", "text": "func (d *dir) list(path string, output []string) []string {\n\tdirPath := filepath.Join(path, d.name)\n\toutput = append(output, dirPath)\n\tfor _, subDir := range d.children {\n\t\toutput = subDir.list(dirPath, output)\n\t}\n\treturn output\n}", "title": "" }, { "docid": "0702d6e57352d9db85681dc94a754114", "score": "0.44688618", "text": "func DepthRange(n float64, f float64) {\n\tC.glowDepthRange(gpDepthRange, (C.GLdouble)(n), (C.GLdouble)(f))\n}", "title": "" }, { "docid": "0702d6e57352d9db85681dc94a754114", "score": "0.44688618", "text": "func DepthRange(n float64, f float64) {\n\tC.glowDepthRange(gpDepthRange, (C.GLdouble)(n), (C.GLdouble)(f))\n}", "title": "" }, { "docid": "010a47a6efb2c9a7327189a9e842d1e9", "score": "0.44573697", "text": "func (api *nodeAPI) List(ctx context.Context, opts *api.ListWatchOptions) ([]*Node, error) {\n\tvar objlist []*Node\n\tobjs, err := api.ct.List(\"Node\", ctx, opts)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, obj := range objs {\n\t\tswitch tp := obj.(type) {\n\t\tcase *Node:\n\t\t\teobj := obj.(*Node)\n\t\t\tobjlist = append(objlist, eobj)\n\t\tdefault:\n\t\t\tlog.Fatalf(\"Got invalid object type %v while looking for Node\", tp)\n\t\t}\n\t}\n\n\treturn objlist, nil\n}", "title": "" }, { "docid": "e934eace1fa6e1ab014738bc5f9f3b7b", "score": "0.4452327", "text": "func (w *ListWidget) GetNodes() []*expanders.TreeNode {\n\treturn w.items\n}", "title": "" }, { "docid": "580a5b62920a0fa45f9c4a300bb85e0f", "score": "0.44474438", "text": "func (s *CountMinSketch) Depth() uint {\n\treturn s.d\n}", "title": "" }, { "docid": "30cd007cf00904903e5a4e9d4177efd2", "score": "0.44473195", "text": "func createBoundsNodes(bounds *Bounds) [4]Node {\n\tnodes := [4]Node{createNewEmptyNode(), createNewEmptyNode(),\n\t\tcreateNewEmptyNode(), createNewEmptyNode()}\n\n\tnodes[0].Lat = bounds.MaxLat\n\tnodes[0].Lon = bounds.MinLon\n\tnodes[1].Lat = bounds.MaxLat\n\tnodes[1].Lon = bounds.MaxLon\n\tnodes[2].Lat = bounds.MinLat\n\tnodes[2].Lon = bounds.MaxLon\n\tnodes[3].Lat = bounds.MinLat\n\tnodes[3].Lon = bounds.MinLon\n\n\treturn nodes\n}", "title": "" }, { "docid": "e25a41256b98acd4c608c4aca0c9634d", "score": "0.4445245", "text": "func (c *Clac) Depth() error {\n\treturn c.Push(value.Int(len(c.Stack())))\n}", "title": "" }, { "docid": "138ecc3d9d92bbb566eaa3946add8f09", "score": "0.4432254", "text": "func list(ds *docState) nodes.Node {\n\ttyp := nodeAttr(ds.cur, \"type\")\n\tif ds.cur.DataAtom == atom.Ol && typ == \"\" {\n\t\ttyp = \"1\"\n\t}\n\tstart, _ := strconv.Atoi(nodeAttr(ds.cur, \"start\"))\n\tlist := nodes.NewItemsListNode(typ, start)\n\tfor hn := findAtom(ds.cur, atom.Li); hn != nil; hn = hn.NextSibling {\n\t\tif hn.DataAtom != atom.Li {\n\t\t\tcontinue\n\t\t}\n\t\tds.push(hn)\n\t\tnn := parseSubtree(ds)\n\t\tnn = parser.CompactNodes(nn)\n\t\tds.pop()\n\t\tif len(nn) > 0 {\n\t\t\tlist.NewItem(nn...)\n\t\t}\n\t}\n\tif len(list.Items) == 0 {\n\t\treturn nil\n\t}\n\tif ds.lastNode != nil {\n\t\tswitch ds.lastNode.Type() {\n\t\tcase nodes.NodeHeaderCheck:\n\t\t\tlist.MutateType(nodes.NodeItemsCheck)\n\t\tcase nodes.NodeHeaderFAQ:\n\t\t\tlist.MutateType(nodes.NodeItemsFAQ)\n\t\t}\n\t}\n\treturn list\n}", "title": "" }, { "docid": "27d9488baa084ed604037077a99c649d", "score": "0.44312572", "text": "func rangeList(N int16) []int16 {\n\tretVal := []int16{}\n\tfor i := int16(0); i < N; i++ {\n\t\tretVal = append(retVal, i)\n\t}\n\n\treturn retVal\n}", "title": "" }, { "docid": "d1a0b53befd1bbf535fd54f806762098", "score": "0.44205695", "text": "func DepthRange(near float64, far float64) {\n C.glowDepthRange(gpDepthRange, (C.GLdouble)(near), (C.GLdouble)(far))\n}", "title": "" }, { "docid": "1a365fc8dec9a4a36b8783bd71a54658", "score": "0.4413442", "text": "func (c *Cache) List(n int) []Value {\n\tvalues := make([]Value, 0, n)\n\tc.mu.RLock()\n\tdefer c.mu.RUnlock()\n\tfor el := c.values.Back(); el != nil; el = el.Prev() {\n\t\tif len(values) == n {\n\t\t\tbreak\n\t\t}\n\t\tv := el.Value.(Value)\n\t\tvalues = append(values, v)\n\t}\n\treturn values\n}", "title": "" }, { "docid": "1c65d8c9cc58e2b0a3b7eddb008f92cc", "score": "0.44116154", "text": "func getTargetNodes(count int, exclude ...*Node) []*Node {\n\trandomNodes := knownNodes.getRandomNodes(0, exclude...)\n\tfilteredNodes := make([]*Node, 0, count)\n\n\tfor _, n := range randomNodes {\n\t\tif len(filteredNodes) >= count {\n\t\t\tbreak\n\t\t}\n\n\t\tif n.status == StatusDead {\n\t\t\tcontinue\n\t\t}\n\n\t\tfilteredNodes = append(filteredNodes, n)\n\t}\n\n\treturn filteredNodes\n}", "title": "" }, { "docid": "f27ae081072009930cffaead083fdf3a", "score": "0.44073227", "text": "func rightSideView(root *TreeNode) []int {\n\tif root == nil {\n\t\treturn []int{}\n\t}\n\n\tqueue := make([]*TreeNode, 0)\n\tqueue = append(queue, root)\n\n\tres := make([]int, 0)\n\n\tfor len(queue) != 0 {\n\t\tsize := len(queue)\n\t\tfor i := 0; i < size; i++ {\n\t\t\tnode := queue[0]\n\t\t\tqueue = queue[1:]\n\t\t\t// 每一层只加第一个,因为后面是先加right,后加left,所以i = 0 的时候实际上是level的最右边元素\n\t\t\tif i == 0 {\n\t\t\t\tres = append(res, node.Val)\n\t\t\t}\n\t\t\tif node.Right != nil {\n\t\t\t\tqueue = append(queue, node.Right)\n\t\t\t}\n\t\t\tif node.Left != nil {\n\t\t\t\tqueue = append(queue, node.Left)\n\t\t\t}\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "340b636a01c9ffcc4afbbe40715b73cf", "score": "0.44042864", "text": "func (t *RoutingTable) GetLevel(level int) (nodes []RemoteNode) {\n\tt.mutex.Lock()\n\tdefer t.mutex.Unlock()\n\n\t// TODO: students should implement this\n\tfor i:=0; i<BASE; i++ {\n\t\tslot := t.rows[level][i]\n\t\tfor j:=0; j<len(slot); j++ {\n\t\t\tn := slot[j]\n\t\t\tif n != t.local {\n\t\t\t\tnodes = append(nodes, n)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "b8a79c7ddc7612b1ebe173a696d937e2", "score": "0.44018567", "text": "func (t *BinarySearch[T]) AccessNodesByLayer() [][]T {\n\treturn accessNodeByLayerHelper[T](t.Root, t._NIL)\n}", "title": "" }, { "docid": "edfc102d3f16334e66a9a462d0a252ab", "score": "0.44015583", "text": "func Children(n Node) []Node { return n.n().children }", "title": "" }, { "docid": "79a0fbb9ffa99af993203cfafb623528", "score": "0.43938935", "text": "func d2getBranches(node *d2nodeT, branch *d2branchT, parVars *d2partitionVarsT) {\n\t// Load the branch buffer\n\tfor index := 0; index < d2maxNodes; index++ {\n\t\tparVars.branchBuf[index] = node.branch[index]\n\t}\n\tparVars.branchBuf[d2maxNodes] = *branch\n\tparVars.branchCount = d2maxNodes + 1\n\n\t// Calculate rect containing all in the set\n\tparVars.coverSplit = parVars.branchBuf[0].rect\n\tfor index := 1; index < d2maxNodes+1; index++ {\n\t\tparVars.coverSplit = d2combineRect(&parVars.coverSplit, &parVars.branchBuf[index].rect)\n\t}\n\tparVars.coverSplitArea = d2calcRectVolume(&parVars.coverSplit)\n}", "title": "" }, { "docid": "7dbc37e55333878719da4be6666a1bee", "score": "0.4393548", "text": "func DepthRangef(n float32, f float32) {\n\tsyscall.Syscall(gpDepthRangef, 2, uintptr(math.Float32bits(n)), uintptr(math.Float32bits(f)), 0)\n}", "title": "" }, { "docid": "488759fb8daa35a21f3044a4a5a7d1b9", "score": "0.43928462", "text": "func (tv *TypedLeafListInt) List() ([]int64, Width) {\n\tcount := (len(tv.TypeOpts) - 1) / 2\n\n\tintList := make([]int64, 0)\n\twidth := tv.TypeOpts[0]\n\tvar byteCounter int32 = 0\n\tfor i := 0; i < count; i++ {\n\t\tv := tv.Bytes[byteCounter : byteCounter+tv.TypeOpts[1+i*2]]\n\t\tbyteCounter = byteCounter + tv.TypeOpts[1+i*2]\n\t\tvar bigInt big.Int\n\t\tbigInt.SetBytes(v)\n\t\tnegative := tv.TypeOpts[1+i*2+1]\n\t\tif negative != isPositiveTypeOpt {\n\t\t\tbigInt.Neg(&bigInt)\n\t\t}\n\t\tintList = append(intList, bigInt.Int64())\n\t}\n\n\treturn intList, Width(width)\n}", "title": "" }, { "docid": "37db632d40f1e03ee7e678cb8fcdee5d", "score": "0.4391896", "text": "func zigzagLevelOrder(root *types.TreeNode) [][]int {\n\tif root == nil {\n\t\treturn nil\n\t}\n\n\teles := list.New()\n\teles.PushBack(root)\n\tans := make([][]int, 0, 1)\n\tvar direction bool\n\tfor eles.Len() > 0 {\n\t\tlength := eles.Len()\n\t\tvalues := make([]int, length)\n\t\tfor i := 0; i < length; i++ {\n\t\t\ttop := eles.Front()\n\t\t\teles.Remove(top)\n\n\t\t\tnode := top.Value.(*types.TreeNode)\n\t\t\tif node.Left != nil {\n\t\t\t\teles.PushBack(node.Left)\n\t\t\t}\n\t\t\tif node.Right != nil {\n\t\t\t\teles.PushBack(node.Right)\n\t\t\t}\n\n\t\t\tif direction {\n\t\t\t\tvalues[length-i-1] = node.Val.(int)\n\t\t\t} else {\n\t\t\t\tvalues[i] = node.Val.(int)\n\t\t\t}\n\t\t}\n\n\t\tans = append(ans, values)\n\t\tdirection = !direction\n\t}\n\n\treturn ans\n}", "title": "" }, { "docid": "e1246a459e919a7d562094a494df1777", "score": "0.43897438", "text": "func zigZagTraversal(root *TreeNode) [][]int {\n\tlevelMapper := make(map[int][]int)\n\tcreateLevelMap(root, 0, levelMapper)\n\tans := make([][]int, 0)\n\tfor id := range levelMapper {\n\t\tif id%2 == 1 {\n\t\t\treverseArray(levelMapper[id])\n\t\t}\n\t\tans = append(ans, levelMapper[id])\n\t}\n\treturn ans\n}", "title": "" }, { "docid": "17bc35603d41c50b4423abc10fb8bff9", "score": "0.43885493", "text": "func createALinkedList(input []int) *Node {\n\thead := &Node{\n\t\tval: input[0],\n\t\tnext: nil,\n\t}\n\tcurrentNode := head\n\tfor i := 1; i < len(input); i++ {\n\t\tnextNode := &Node{\n\t\t\tval: input[i],\n\t\t\tnext: nil,\n\t\t}\n\t\tcurrentNode.next = nextNode\n\t\tcurrentNode = nextNode\n\t}\n\treturn head\n}", "title": "" } ]
4eb92dcc7a3e1031e857afb7bae438dd
============================================================================================================================ Smart contract for giving user double points ============================================================================================================================
[ { "docid": "b1f2618f5ac2111d3d4b79e87401c91b", "score": "0.5810647", "text": "func doubleContract(tx Transaction, stub shim.ChaincodeStubInterface) float64 {\r\n\r\n \tcontractAsBytes, err := stub.GetState(DOUBLE_CONTRACT)\r\n\tif err != nil {\r\n\t\treturn -99\r\n\t}\r\n\tvar contract Contract\r\n\tjson.Unmarshal(contractAsBytes, &contract)\r\n\t\r\n\tvar pointsToTransfer float64\r\n\tpointsToTransfer = tx.Amount\r\n\tif (tx.Date.After(contract.StartDate) && tx.Date.Before(contract.EndDate)) {\r\n\t pointsToTransfer = pointsToTransfer * 2\r\n\t}\r\n \r\n \r\n return pointsToTransfer\r\n \r\n \r\n}", "title": "" } ]
[ { "docid": "8929381b846360a682ebb769c0b623fd", "score": "0.6167522", "text": "func (p *Point) Double(p1 *Point, ecurve twistededwards.CurveParams) *Point {\n\tp.AddGeneric(p1, p1, ecurve)\n\treturn p\n}", "title": "" }, { "docid": "16b58d74d8c9bb315a90deb8fb8fa928", "score": "0.61399615", "text": "func (this *RangerAppValue) Get_double_value() int64 {\n return this.double_value\n}", "title": "" }, { "docid": "89409d9d30a87c830d5fb2a91d41a7bc", "score": "0.5728081", "text": "func (this *RangerAppValue) Set_double_value( value int64) {\n this.double_value = value \n}", "title": "" }, { "docid": "be5182a22a672d9e129f9497b584a7c1", "score": "0.5642426", "text": "func CreateUserPoints(userId, orId, points int64, dataType int8) {\n\t// Query points information\n\tgid := models.GaussUserIntegDetail{UserId: userId, OrId: orId, Type: dataType}\n\tgidErr := models.QueryGaussUserIntegDetail(&gid, \"UserId\", \"OrId\", \"Type\")\n\tif gid.Id > 0 {\n\t\tgid.IntegralValue += points\n\t\tgidErr = models.UpdateGaussUserIntegDetail(&gid, \"IntegralValue\")\n\t\tif gidErr != nil {\n\t\t\tlogs.Error(\"UpdateGaussUserIntegDetail, gidErr: \", gidErr)\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tgid = models.GaussUserIntegDetail{UserId: userId, OrId: orId, Type: dataType,\n\t\t\tIntegralValue: points, CreateTime: common.GetCurTime()}\n\t\tid, indErr := models.InsertGaussUserIntegDetail(&gid)\n\t\tif id == 0 {\n\t\t\tlogs.Error(\"InsertGaussUserIntegDetail, indErr:\", indErr, id)\n\t\t\treturn\n\t\t}\n\t}\n\tgic := models.GaussUserIntegCount{UserId: userId}\n\tgicErr := models.QueryGaussUserIntegCount(&gic, \"UserId\")\n\tif gic.Id == 0 {\n\t\tgic = models.GaussUserIntegCount{UserId: userId, IntegralValue: points, CreateTime: common.GetCurTime()}\n\t\tgicId, ingicErr := models.InsertGaussUserIntegCount(&gic)\n\t\tif gicId == 0 {\n\t\t\tlogs.Error(\"InsertGaussUserIntegCount, ingicErr: \", ingicErr, gicId)\n\t\t}\n\t} else {\n\t\tgic.IntegralValue += points\n\t\tgicErr = models.UpdateGaussUserIntegCount(&gic, \"IntegralValue\")\n\t\tif gicErr != nil {\n\t\t\tlogs.Error(\"UpdateEulerUserIntegCount, gicErr: \", gicErr)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9d4e919866d11337fae8437a4575cbfa", "score": "0.5516193", "text": "func my_pointsHandler(w http.ResponseWriter, r *http.Request) {\n\tuser := r.FormValue(\"uid\")\n\tentries, points := 0, 0\n\tfor _, s := range ProcessedSubs {\n\t\tif user == s.Uid {\n\t\t\tif s.Points > 0 {\n\t\t\t\tpoints += s.Points\n\t\t\t\tentries += 1\n\t\t\t}\n\t\t}\n\t}\n\tmesg := fmt.Sprintf(\"%s: %d entries, %d points.\\n\", user, entries, points)\n\tfmt.Fprintf(w, mesg)\n}", "title": "" }, { "docid": "8d3da4c4920f0c5dd0b266f0f4eff269", "score": "0.54982275", "text": "func (this *RangerNodeValue) Get_double_value() *GoNullable {\n return this.double_value\n}", "title": "" }, { "docid": "dbbe29339fcce53e6f64f7d0f52952c1", "score": "0.5496444", "text": "func adjustUserPoints(user *users.User, delta int64) error {\n\n\t// Update the user points\n\terr := user.Update(map[string]string{\"points\": fmt.Sprintf(\"%d\", user.Points+delta)})\n\tif err != nil {\n\t\treturn router.InternalError(err, \"Vote Failed\", \"Sorry could not adjust user points\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f03f6db3771baab151369219ca9de696", "score": "0.547217", "text": "func (this *CodeNode) Get_double_value() float64 {\n return this.double_value\n}", "title": "" }, { "docid": "d0836a578a4736d4ad8389cd32909c7f", "score": "0.5423819", "text": "func (this *DictNode) Get_double_value() float64 {\n return this.double_value\n}", "title": "" }, { "docid": "d0f5549b4ef4c9a98ca602c830b1384b", "score": "0.53892905", "text": "func doubleSalary(emp *employee) {\n\temp.salary = emp.salary * 2.0\n}", "title": "" }, { "docid": "f2794e47e666f83eff83f4f8d22d13bb", "score": "0.52781105", "text": "func (q *P256Point) Double(p *P256Point) *P256Point {\n\tvar double P256Point\n\tp256PointDoubleAsm(&double, p)\n\treturn q.Set(&double)\n}", "title": "" }, { "docid": "a8f745cb689e28f1a29b5109fbe47aba", "score": "0.52780193", "text": "func (curve *CurveParams) Double(p *CurvePoint) *CurvePoint {\n\tz := zForAffine(p)\n\treturn curve.affineFromJacobian(curve.doubleJacobian(p.X, p.Y, z))\n}", "title": "" }, { "docid": "771b59d7af4e5493f3ced12875333722", "score": "0.5246223", "text": "func BuyPoints(c *gin.Context) {\n\t// get user id\n\tsession := sessions.Default(c)\n\tuserID := session.Get(\"user\")\n\tif userID == nil {\n\t\tfmt.Println(\"Page not found\")\n\t\tc.JSON(http.StatusNotFound, gin.H{\"error\": \"Page not found\"})\n\t\treturn\n\t}\n\n\t// bind post data\n\tvar buyPointsInput requests.BuyPointsRequest\n\tif err := c.BindJSON(&buyPointsInput); err != nil {\n\t\tfmt.Println(err.Error())\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"msg\": \"Please check your data format\", \"error\": err.Error()})\n\t\treturn\n\t}\n\n\ttx, err := models.DB.Begin()\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"msg\": \"tx begin failed\", \"error\": err.Error()})\n\t\treturn\n\t}\n\tdefer tx.Rollback()\n\n\tcolumns := []string{\"*\"}\n\tuser, err := models.FindUserByID(userID.(int), columns, tx)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tc.JSON(http.StatusNotFound, gin.H{\"error\": \"Page not found\"})\n\t\treturn\n\t}\n\n\t// check if admin\n\tuserAdmin := user.IsAdmin\n\tif userAdmin != 0 {\n\t\tfmt.Println(\"Admin can not buy points\")\n\t\tc.JSON(http.StatusNotFound, gin.H{\"error\": \"Admin can not buy points\"})\n\t\treturn\n\t}\n\n\t// check user amount\n\tuserAmount, ok := common.ParseBig256(user.EthValue)\n\tif !ok {\n\t\tfmt.Println(\"database eth_value type error\")\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"msg\": \"database eth_value type error\", \"error\": \"database eth_value type error\"})\n\t\treturn\n\t}\n\t// Query eth rate\n\tethRate, err := models.FindEthrateBySymbol(buyPointsInput.Symbol, tx)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"msg\": \"Query symbol error\", \"error\": err.Error()})\n\t\treturn\n\t}\n\tif !ethRate.Price.Valid {\n\t\tfmt.Printf(\"symbol %s is nil\\n\", buyPointsInput.Symbol)\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"msg\": \"Query symbol error\", \"error\": fmt.Sprintf(\"symbol %s is nil\", buyPointsInput.Symbol)})\n\t\treturn\n\t}\n\n\t// count eth amount to minus\n\trate := big.NewFloat(ethRate.Price.Float64) // rate as big int\n\tamount := big.NewFloat(float64(buyPointsInput.Amount)) // amount as big int\n\tethAmount := new(big.Float).Quo(amount, rate) // eth = amount / rate\n\tweiAmount := new(big.Float).Mul(ethAmount, big.NewFloat(float64(eth))) // wei = eth * 10**18\n\ttoSubAmount := common.BigFloatToBigInt(weiAmount)\n\tfinalAmount := new(big.Int).Sub(userAmount, toSubAmount)\n\tif finalAmount.Cmp(big.NewInt(int64(0))) == -1 {\n\t\tfmt.Println(\"eth value not enough\")\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"msg\": \"eth value not enough\", \"error\": \"eth value not enough\"})\n\t\treturn\n\t}\n\n\t// update admin saga point\n\tif err := models.SelectAndUpdateAdminWithMinusSagaPoint(buyPointsInput.Amount, tx); err != nil {\n\t\tfmt.Println(err.Error())\n\t\tif err.Error() == models.ErrorMsgSagaPointNotEnough {\n\t\t\tc.JSON(http.StatusBadRequest, gin.H{\"msg\": err.Error(), \"error\": err.Error()})\n\t\t} else {\n\t\t\tc.JSON(http.StatusBadRequest, gin.H{\"msg\": \"Admin minus saga point error\", \"error\": err.Error()})\n\t\t}\n\t\treturn\n\t}\n\t// update user eth and saga point\n\tuser.SagaPoint += buyPointsInput.Amount\n\tuser.EthValue = common.BigIntToHex(finalAmount)\n\tif err := user.Update(tx); err != nil {\n\t\tfmt.Println(err.Error())\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"msg\": \"User save error\", \"error\": err.Error()})\n\t\treturn\n\t}\n\terr = tx.Commit()\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"msg\": \"tx commit failed\", \"error\": err.Error()})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\"msg\": \"Buy point successfully\"})\n\treturn\n}", "title": "" }, { "docid": "152153aed0ceb36c94e7273f64e3f5c7", "score": "0.5227617", "text": "func (c *HTTPClient) WriteDoublePoint(p *tspb.PointDoubleTagged) {\n\tc.trace.Points += 1\n\tc.trace.RawSize += p.RawSize()\n\tc.trace.RawMetaSize += p.RawMetaSize()\n\n\tc.totalDoublePointWritten += 1\n\tc.totalRawSize += p.RawSize()\n\tc.totalRawMetaSize += p.RawMetaSize()\n\n\tc.enc.WritePointDoubleTagged(p)\n}", "title": "" }, { "docid": "ff4890b6cfa767472c45a7da1ed7c1d4", "score": "0.5208471", "text": "func (this *RangerNodeValue) Set_double_value( value *GoNullable) {\n this.double_value = value \n}", "title": "" }, { "docid": "8d8e2ea6612748dd279bf749b84419d9", "score": "0.5156936", "text": "func (this *CodeNode) Set_double_value( value float64) {\n this.double_value = value \n}", "title": "" }, { "docid": "1b1724c9f79b99e67112e3001b714c17", "score": "0.5144584", "text": "func (g *gallon) double() {\n\tfmt.Println(\"In double\")\n\t*g = gallon(*g * 2)\n\tfmt.Println(\"Exit Half\")\n}", "title": "" }, { "docid": "ee2a2c1ee02048938db5841bf18b4b7c", "score": "0.51439047", "text": "func (p *printingHandler) TestDouble(ctx frugal.FContext, thing float64) (r float64, err error) {\n\treturn thing, nil\n}", "title": "" }, { "docid": "a1266fb730a54765b4e057f46bc751a8", "score": "0.514224", "text": "func (_DFedPair *DFedPairCaller) UserRewardDebtPerFEDlp(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _DFedPair.contract.Call(opts, out, \"userRewardDebtPerFEDlp\", arg0)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "43ecbcb0e875635e5879368d8af5743f", "score": "0.51286685", "text": "func Double(v float64) *float64 {\n\treturn &v\n}", "title": "" }, { "docid": "a17df366009f3753c8cec7698477dc1c", "score": "0.5103421", "text": "func (s *PointService) SpendPoints(userID string, points int) ([]model.Transaction, error) {\n\tif points <= 0 {\n\t\treturn []model.Transaction{}, errors.New(\"points must be a positive integer\")\n\t}\n\ttotalPoints := s.getTotalPointsForUser(userID)\n\tif points > totalPoints {\n\t\treturn []model.Transaction{}, notEnoughPointsErr\n\t}\n\n\ttransactions := s.DB.GetTransactions(userID)\n\n\tpointsRemaining := points\n\tnewTranMap := make(map[string]*model.Transaction)\n\tfor i := 0; i < len(transactions) && pointsRemaining > 0; i++ {\n\t\ttran := transactions[i]\n\n\t\tbalanceDiff := -tran.Points\n\t\tif tran.Points > pointsRemaining {\n\t\t\tbalanceDiff = -pointsRemaining\n\t\t}\n\n\t\tpointsRemaining -= tran.Points\n\t\tif _, ok := newTranMap[tran.Payer]; ok {\n\t\t\tt := newTranMap[tran.Payer]\n\t\t\tt.Points = t.Points + balanceDiff\n\t\t} else {\n\t\t\tnewTranMap[tran.Payer] = &model.Transaction{\n\t\t\t\tPayer: tran.Payer,\n\t\t\t\tPoints: balanceDiff,\n\t\t\t\tTimestamp: time.Now(),\n\t\t\t}\n\t\t}\n\t}\n\n\tvar newTransactions []model.Transaction\n\tfor _, val := range newTranMap {\n\t\tnewTransactions = append(newTransactions, *val)\n\t\ts.DB.AddTransaction(userID, *val)\n\t}\n\n\tsort.Slice(newTransactions, func(i, j int) bool {\n\t\treturn newTransactions[i].Timestamp.Before(newTransactions[j].Timestamp)\n\t})\n\n\treturn newTransactions, nil\n}", "title": "" }, { "docid": "7ae0569f2a0043bda0cea269c69548ed", "score": "0.5100237", "text": "func (c Controller) TakePointsHandler(w http.ResponseWriter, r *http.Request) {\n\tid, err := http_handlers.ScanID(http_handlers.UserPath, r)\n\tif err != nil {\n\t\terrors.HandleErr(err, w)\n\t\treturn\n\t}\n\n\tvar st struct{ Points int `json:\"points\"` }\n\n\terr = json.NewDecoder(r.Body).Decode(&st)\n\tif err != nil {\n\t\terrors.HandleJSONErr(err, w)\n\t\treturn\n\t}\n\n\terr = c.FundUser(id, -st.Points)\n\tif err != nil {\n\t\terrors.HandleErr(err, w)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\n}", "title": "" }, { "docid": "7c31d2b6f0b7491c4b7a79c9a31ed2e5", "score": "0.50885606", "text": "func (s *PointService) AddPoints(userID string, transaction model.Transaction) error {\n\tif transaction.Points > 0 {\n\t\ts.DB.AddTransaction(userID, transaction)\n\t\treturn nil\n\t} else {\n\t\ttotalPoints := s.getTotalPointsForPayer(userID, transaction.Payer)\n\n\t\tif totalPoints >= -transaction.Points {\n\t\t\ts.DB.AddTransaction(userID, transaction)\n\t\t\treturn nil\n\t\t} else {\n\t\t\treturn notEnoughPointsErr\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c5d5a3e0ed219754d1bcc8ba039c3920", "score": "0.5074282", "text": "func (this *DictNode) Set_double_value( value float64) {\n this.double_value = value \n}", "title": "" }, { "docid": "a146d204ffeb8b6d33d56e7f58cfbb33", "score": "0.50592816", "text": "func (c Controller) GivePointsHandler(w http.ResponseWriter, r *http.Request) {\n\tid, err := http_handlers.ScanID(http_handlers.UserPath, r)\n\tif err != nil {\n\t\terrors.HandleErr(err, w)\n\t\treturn\n\t}\n\n\tvar st struct{ Points int `json:\"points\"` }\n\n\terr = json.NewDecoder(r.Body).Decode(&st)\n\tif err != nil {\n\t\terrors.HandleJSONErr(err, w)\n\t\treturn\n\t}\n\n\terr = c.FundUser(id, st.Points)\n\tif err != nil {\n\t\terrors.HandleErr(err, w)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "0aed5292b57307465bbe208cfe9f4b04", "score": "0.50493634", "text": "func (g *Game) PrizeDoubled() {\n\tg.CurrentPrize *= 2\n\n\tevent := &Event{\n\t\tEType: EventPrizeDoubled,\n\t\tPayload: &PrizeDoubledPayload{NewPrize: g.CurrentPrize},\n\t}\n\n\tg.Events <- event\n}", "title": "" }, { "docid": "bbd6aea0b1ce8605dda6b0cd84b9ec34", "score": "0.50331384", "text": "func (client HeaderClient) ParamDouble(scenario string, value float64) (result autorest.Response, err error) {\n req, err := client.ParamDoublePreparer(scenario, value)\n if err != nil {\n return result, autorest.NewErrorWithError(err, \"headergroup.HeaderClient\", \"ParamDouble\", nil , \"Failure preparing request\")\n }\n\n resp, err := client.ParamDoubleSender(req)\n if err != nil {\n result.Response = resp\n return result, autorest.NewErrorWithError(err, \"headergroup.HeaderClient\", \"ParamDouble\", resp, \"Failure sending request\")\n }\n\n result, err = client.ParamDoubleResponder(resp)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"headergroup.HeaderClient\", \"ParamDouble\", resp, \"Failure responding to request\")\n }\n\n return\n}", "title": "" }, { "docid": "9652a39fd9d64fd3f5f76771d669e752", "score": "0.5005674", "text": "func (me *Value) Double() float64 {\n\treturn me.value.(float64)\n}", "title": "" }, { "docid": "b51fa80b803becd16ad9c29c0bdd06a4", "score": "0.5004844", "text": "func TestHandleDoubleSign(t *testing.T) {\n\n\t// initial setup\n\tctx, ck, sk, _, keeper := createTestInput(t, keeperTestParams())\n\t// validator added pre-genesis\n\tctx = ctx.WithBlockHeight(-1)\n\tamtInt := int64(100)\n\toperatorAddr, val, amt := addrs[0], pks[0], sdk.NewInt(amtInt)\n\tgot := stake.NewHandler(sk)(ctx, NewTestMsgCreateValidator(operatorAddr, val, amt))\n\trequire.True(t, got.IsOK())\n\tstake.EndBlocker(ctx, sk)\n\trequire.Equal(\n\t\tt, ck.GetCoins(ctx, sdk.AccAddress(operatorAddr)),\n\t\tsdk.Coins{sdk.NewCoin(sk.GetParams(ctx).BondDenom, initCoins.Sub(amt))},\n\t)\n\trequire.True(t, sdk.NewDecFromInt(amt).Equal(sk.Validator(ctx, operatorAddr).GetPower()))\n\n\t// handle a signature to set signing info\n\tkeeper.handleValidatorSignature(ctx, val.Address(), amtInt, true)\n\n\t// double sign less than max age\n\tkeeper.handleDoubleSign(ctx, val.Address(), 0, time.Unix(0, 0), amtInt)\n\n\t// should be jailed\n\trequire.True(t, sk.Validator(ctx, operatorAddr).GetJailed())\n\t// unjail to measure power\n\tsk.Unjail(ctx, sdk.ConsAddress(val.Address()))\n\t// power should be reduced\n\trequire.Equal(\n\t\tt, sdk.NewDecFromInt(amt).Mul(sdk.NewDec(19).Quo(sdk.NewDec(20))),\n\t\tsk.Validator(ctx, operatorAddr).GetPower(),\n\t)\n\tctx = ctx.WithBlockHeader(abci.Header{Time: time.Unix(1, 0).Add(keeper.MaxEvidenceAge(ctx))})\n\n\t// double sign past max age\n\tkeeper.handleDoubleSign(ctx, val.Address(), 0, time.Unix(0, 0), amtInt)\n\trequire.Equal(\n\t\tt, sdk.NewDecFromInt(amt).Mul(sdk.NewDec(19).Quo(sdk.NewDec(20))),\n\t\tsk.Validator(ctx, operatorAddr).GetPower(),\n\t)\n}", "title": "" }, { "docid": "4ace89730ea357838e908d55e765a108", "score": "0.5003624", "text": "func (s *SlasherV1) HandleDoubleSign(ctx cosmos.Context, addr crypto.Address, infractionHeight int64, constAccessor constants.ConstantValues) error {\n\t// check if we're recent enough to slash for this behavior\n\tmaxAge := constAccessor.GetInt64Value(constants.DoubleSignMaxAge)\n\tif (common.BlockHeight(ctx) - infractionHeight) > maxAge {\n\t\tctx.Logger().Info(\"double sign detected but too old to be slashed\", \"infraction height\", fmt.Sprintf(\"%d\", infractionHeight), \"address\", addr.String())\n\t\treturn nil\n\t}\n\n\tnas, err := s.keeper.ListActiveNodeAccounts(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, na := range nas {\n\t\tpk, err := cosmos.GetPubKeyFromBech32(cosmos.Bech32PubKeyTypeConsPub, na.ValidatorConsPubKey)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif addr.String() == pk.Address().String() {\n\t\t\tif na.Bond.IsZero() {\n\t\t\t\treturn fmt.Errorf(\"found account to slash for double signing, but did not have any bond to slash: %s\", addr)\n\t\t\t}\n\t\t\t// take 5% of the minimum bond, and put it into the reserve\n\t\t\tminBond, err := s.keeper.GetMimir(ctx, constants.MinimumBondInRune.String())\n\t\t\tif minBond < 0 || err != nil {\n\t\t\t\tminBond = constAccessor.GetInt64Value(constants.MinimumBondInRune)\n\t\t\t}\n\t\t\tslashAmount := cosmos.NewUint(uint64(minBond)).MulUint64(5).QuoUint64(100)\n\t\t\tif slashAmount.GT(na.Bond) {\n\t\t\t\tslashAmount = na.Bond\n\t\t\t}\n\t\t\tna.Bond = common.SafeSub(na.Bond, slashAmount)\n\n\t\t\tif common.RuneAsset().Chain.Equals(common.THORChain) {\n\t\t\t\tcoin := common.NewCoin(common.RuneNative, slashAmount)\n\t\t\t\tif err := s.keeper.SendFromModuleToModule(ctx, BondName, ReserveName, coin); err != nil {\n\t\t\t\t\tctx.Logger().Error(\"fail to transfer funds from bond to reserve\", \"error\", err)\n\t\t\t\t\treturn fmt.Errorf(\"fail to transfer funds from bond to reserve: %w\", err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tvaultData, err := s.keeper.GetVaultData(ctx)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"fail to get vault data: %w\", err)\n\t\t\t\t}\n\t\t\t\tvaultData.TotalReserve = vaultData.TotalReserve.Add(slashAmount)\n\t\t\t\tif err := s.keeper.SetVaultData(ctx, vaultData); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"fail to save vault data: %w\", err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn s.keeper.SetNodeAccount(ctx, na)\n\t\t}\n\t}\n\n\treturn fmt.Errorf(\"could not find node account with validator address: %s\", addr)\n}", "title": "" }, { "docid": "54975ccd2ac2945f20915e2ca4d17720", "score": "0.49852377", "text": "func (z *E4) Double(x *E4) *E4 {\n\tz.B0.Double(&x.B0)\n\tz.B1.Double(&x.B1)\n\treturn z\n}", "title": "" }, { "docid": "cebb8f2ba2b0eb7a25bdf0c0fff4a98f", "score": "0.4963873", "text": "func doubleInput() {\n\tfmt.Println(\"Please enter a number: \")\n\n\tvar inputNumber float64\n\n\tfmt.Scanf(\"%f\", &inputNumber)\n\n\tresult := inputNumber * 2\n\n\tfmt.Println(result)\n}", "title": "" }, { "docid": "c4faba25d6e7501872635f0c8d98300f", "score": "0.4961777", "text": "func (s *Slasher) HandleDoubleSign(ctx sdk.Context, addr crypto.Address, infractionHeight int64, constAccessor constants.ConstantValues) error {\n\t// check if we're recent enough to slash for this behavior\n\tmaxAge := constAccessor.GetInt64Value(constants.DoubleSignMaxAge)\n\tif (ctx.BlockHeight() - infractionHeight) > maxAge {\n\t\tctx.Logger().Info(\"double sign detected but too old to be slashed\", \"infraction height\", fmt.Sprintf(\"%d\", infractionHeight), \"address\", addr.String())\n\t\treturn nil\n\t}\n\n\tnas, err := s.keeper.ListActiveNodeAccounts(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, na := range nas {\n\t\tpk, err := sdk.GetConsPubKeyBech32(na.ValidatorConsPubKey)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif addr.String() == pk.Address().String() {\n\t\t\tif na.Bond.IsZero() {\n\t\t\t\treturn fmt.Errorf(\"found account to slash for double signing, but did not have any bond to slash: %s\", addr)\n\t\t\t}\n\t\t\t// take 5% of the minimum bond, and put it into the reserve\n\t\t\tminBond, err := s.keeper.GetMimir(ctx, constants.MinimumBondInRune.String())\n\t\t\tif minBond < 0 || err != nil {\n\t\t\t\tminBond = constAccessor.GetInt64Value(constants.MinimumBondInRune)\n\t\t\t}\n\t\t\tslashAmount := sdk.NewUint(uint64(minBond)).MulUint64(5).QuoUint64(100)\n\t\t\tna.Bond = common.SafeSub(na.Bond, slashAmount)\n\n\t\t\tif common.RuneAsset().Chain.Equals(common.THORChain) {\n\t\t\t\tcoin := common.NewCoin(common.RuneNative, slashAmount)\n\t\t\t\tif err := s.keeper.SendFromModuleToModule(ctx, BondName, ReserveName, coin); err != nil {\n\t\t\t\t\tctx.Logger().Error(\"fail to transfer funds from reserve to asgard\", \"error\", err)\n\t\t\t\t\treturn fmt.Errorf(\"fail to transfer funds from reserve to asgard: %w\", err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tvaultData, err := s.keeper.GetVaultData(ctx)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"fail to get vault data: %w\", err)\n\t\t\t\t}\n\t\t\t\tvaultData.TotalReserve = vaultData.TotalReserve.Add(slashAmount)\n\t\t\t\tif err := s.keeper.SetVaultData(ctx, vaultData); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"fail to save vault data: %w\", err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn s.keeper.SetNodeAccount(ctx, na)\n\t\t}\n\t}\n\n\treturn fmt.Errorf(\"could not find node account with validator address: %s\", addr)\n}", "title": "" }, { "docid": "faa54db93eb95894c7000ebd43cb22a8", "score": "0.49444634", "text": "func (m *UserMutation) AddPoints(u uint) {\n\tif m.addpoints != nil {\n\t\t*m.addpoints += u\n\t} else {\n\t\tm.addpoints = &u\n\t}\n}", "title": "" }, { "docid": "95bc3b001c349a9b784248f3f07e74a8", "score": "0.49316534", "text": "func gf2PointDouble(x *bitVector, y *bitVector) {\n\t/* iff P = O (zero or infinity): 2 * P = P */\n\tif bitVectorIsZero(x) {\n\t\tbitVectorSetZero(y)\n\t} else {\n\t\tvar l bitVector\n\n\t\tgf2FieldInvert(&l, x)\n\t\tgf2FieldMul(&l, &l, y)\n\t\tgf2FieldIsAdd(&l, &l, x)\n\t\tgf2FieldMul(y, x, x)\n\t\tgf2FieldMul(x, &l, &l)\n\t\tgf2FieldIsAdd(x, x, &l)\n\t\tgf2FieldMul(&l, &l, x)\n\t\tgf2FieldIsAdd(y, y, &l)\n\t}\n}", "title": "" }, { "docid": "0b2f715955d59871bb95281401135064", "score": "0.49290925", "text": "func (me Tangle180Type) ToXsdtDouble() xsdt.Double { return xsdt.Double(me) }", "title": "" }, { "docid": "8e4170a9d424e4ab67ef555ddbfb8d2f", "score": "0.4925282", "text": "func (me Tangle90Type) ToXsdtDouble() xsdt.Double { return xsdt.Double(me) }", "title": "" }, { "docid": "ead114676196b514159293b79fc6feac", "score": "0.49126762", "text": "func (p *TxPool) verifyDoubleSpend(tx *types.Transaction) error {\n\tinputs := make([]*types.Input, 0, len(tx.Inputs))\n\tfor _, input := range tx.Inputs {\n\t\tif txn := p.getInputUTXOList(input); txn != nil {\n\t\t\treturn errors.New(fmt.Sprintf(\"double spent UTXO inputs detected, \"+\n\t\t\t\t\"transaction hash: %x, input: %s, index: %d\",\n\t\t\t\ttxn.Hash(), input.Previous.TxID, input.Previous.Index))\n\t\t}\n\t\tinputs = append(inputs, input)\n\t}\n\n\tfor _, v := range inputs {\n\t\tp.addInputUTXOList(tx, v)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e5379b1319997f755bf939c997c028d8", "score": "0.48899817", "text": "func PointsTest() {\n\tsess, err := GetLastSession(\"4/agE8C2wUsc4ory3uHYdFyZC6JDc-owmwW9Ohjf8l65AaSKWBGLjFY2zaw4q0Y_Ural0kiD8fEkhdRV62CdcEoO8\", 1560634000000)\n\tlog.Println(sess, err)\n}", "title": "" }, { "docid": "1402367f4672ccf47f6d5f5a2e809b44", "score": "0.48875043", "text": "func (me Tangle360Type) ToXsdtDouble() xsdt.Double { return xsdt.Double(me) }", "title": "" }, { "docid": "43755b7c2ecf8250be4c4c91a9ec324c", "score": "0.4872864", "text": "func (f FQ2) Double() *FQ2 {\n\treturn &FQ2{\n\t\tc0: f.c0.Double(),\n\t\tc1: f.c1.Double(),\n\t}\n}", "title": "" }, { "docid": "04b37b0ebca117d248e15985b39da868", "score": "0.48634377", "text": "func (_DFedPair *DFedPairCallerSession) UserRewardDebtPerFEDlp(arg0 common.Address) (*big.Int, error) {\n\treturn _DFedPair.Contract.UserRewardDebtPerFEDlp(&_DFedPair.CallOpts, arg0)\n}", "title": "" }, { "docid": "e913b62fe47d275a117955bceb8cf095", "score": "0.4862379", "text": "func (me Tanglepos180Type) ToXsdtDouble() xsdt.Double { return xsdt.Double(me) }", "title": "" }, { "docid": "9c17fdb052426aa901a5802447a5487a", "score": "0.48569712", "text": "func (d *PriceVoteData) fee() fee {\n\treturn feePriceVote\n}", "title": "" }, { "docid": "e948afb96c87221c12f6e140711e1a5e", "score": "0.48356494", "text": "func Rate(votingPower *votepower.Roster, records Records) numeric.Dec {\n\trate := numeric.ZeroDec()\n\n\tfor i := range records {\n\t\tkey := records[i].Evidence.SecondVote.SignerPubKey\n\t\tif card, exists := votingPower.Voters[key]; exists {\n\t\t\trate = rate.Add(card.GroupPercent)\n\t\t} else {\n\t\t\tutils.Logger().Debug().\n\t\t\t\tRawJSON(\"roster\", []byte(votingPower.String())).\n\t\t\t\tRawJSON(\"double-sign-record\", []byte(records[i].String())).\n\t\t\t\tMsg(\"did not have offenders voter card in roster as expected\")\n\t\t}\n\t}\n\n\tif rate.LT(oneDoubleSignerRate) {\n\t\trate = oneDoubleSignerRate\n\t}\n\n\treturn rate\n}", "title": "" }, { "docid": "fd8430a59605100febf9d232f881a382", "score": "0.47836712", "text": "func computePoint(hiddingPoint *pt.ECPoint, secret *big.Int, salt *big.Int) (*pt.ECPoint, error) {\n\tcurve := hiddingPoint.GetCurve()\n\ttempPoint := pt.ScalarBaseMult(curve, secret)\n\tresult := hiddingPoint.ScalarMult(salt)\n\treturn tempPoint.Add(result)\n}", "title": "" }, { "docid": "aa74d3d6a877b151790e5e3c7a261b57", "score": "0.4779252", "text": "func (_DFedPair *DFedPairSession) UserRewardDebtPerFEDlp(arg0 common.Address) (*big.Int, error) {\n\treturn _DFedPair.Contract.UserRewardDebtPerFEDlp(&_DFedPair.CallOpts, arg0)\n}", "title": "" }, { "docid": "790495f61b5f1e68ab44b47bb31780ff", "score": "0.47718647", "text": "func (r Rect) Double() {\n\tr.Width *= 2\n\tr.Height *= 2\n\tfmt.Printf(\"Double() %v\\n\", r)\n}", "title": "" }, { "docid": "03ec7bc78854b905c81b4f3c856cbc5a", "score": "0.47665918", "text": "func (f *Fq) Double() *Fq {\n\tf.Add(f, f)\n\treturn f\n}", "title": "" }, { "docid": "fd5a6c81aa5a89d4fde40114b2d9b20c", "score": "0.4765658", "text": "func (double *Double) GetValue() float64 {\n\treturn double.trueValue\n}", "title": "" }, { "docid": "61984bfb32b5300a34feea9ab5230542", "score": "0.47640604", "text": "func getDataPoints(pmd *pdata.Metric, metadata CWMetricMetadata, logger *zap.Logger) (dps DataPoints) {\n\tif pmd == nil {\n\t\treturn\n\t}\n\n\trateKeys := rateKeyParams{\n\t\tnamespaceKey: metadata.Namespace,\n\t\tmetricNameKey: pmd.Name(),\n\t\tlogGroupKey: metadata.LogGroup,\n\t\tlogStreamKey: metadata.LogStream,\n\t}\n\n\tswitch pmd.DataType() {\n\tcase pdata.MetricDataTypeIntGauge:\n\t\tmetric := pmd.IntGauge()\n\t\tdps = IntDataPointSlice{\n\t\t\tmetadata.InstrumentationLibraryName,\n\t\t\trateCalculationMetadata{\n\t\t\t\tfalse,\n\t\t\t\trateKeys,\n\t\t\t\tmetadata.TimestampMs,\n\t\t\t},\n\t\t\tmetric.DataPoints(),\n\t\t}\n\tcase pdata.MetricDataTypeDoubleGauge:\n\t\tmetric := pmd.DoubleGauge()\n\t\tdps = DoubleDataPointSlice{\n\t\t\tmetadata.InstrumentationLibraryName,\n\t\t\trateCalculationMetadata{\n\t\t\t\tfalse,\n\t\t\t\trateKeys,\n\t\t\t\tmetadata.TimestampMs,\n\t\t\t},\n\t\t\tmetric.DataPoints(),\n\t\t}\n\tcase pdata.MetricDataTypeIntSum:\n\t\tmetric := pmd.IntSum()\n\t\tdps = IntDataPointSlice{\n\t\t\tmetadata.InstrumentationLibraryName,\n\t\t\trateCalculationMetadata{\n\t\t\t\tmetric.AggregationTemporality() == pdata.AggregationTemporalityCumulative,\n\t\t\t\trateKeys,\n\t\t\t\tmetadata.TimestampMs,\n\t\t\t},\n\t\t\tmetric.DataPoints(),\n\t\t}\n\tcase pdata.MetricDataTypeDoubleSum:\n\t\tmetric := pmd.DoubleSum()\n\t\tdps = DoubleDataPointSlice{\n\t\t\tmetadata.InstrumentationLibraryName,\n\t\t\trateCalculationMetadata{\n\t\t\t\tmetric.AggregationTemporality() == pdata.AggregationTemporalityCumulative,\n\t\t\t\trateKeys,\n\t\t\t\tmetadata.TimestampMs,\n\t\t\t},\n\t\t\tmetric.DataPoints(),\n\t\t}\n\tcase pdata.MetricDataTypeDoubleHistogram:\n\t\tmetric := pmd.DoubleHistogram()\n\t\tdps = DoubleHistogramDataPointSlice{\n\t\t\tmetadata.InstrumentationLibraryName,\n\t\t\tmetric.DataPoints(),\n\t\t}\n\tcase pdata.MetricDataTypeDoubleSummary:\n\t\tmetric := pmd.DoubleSummary()\n\t\tdps = DoubleSummaryDataPointSlice{\n\t\t\tmetadata.InstrumentationLibraryName,\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.DataType().String()),\n\t\t\tzap.String(\"Name\", pmd.Name()),\n\t\t\tzap.String(\"Unit\", pmd.Unit()),\n\t\t)\n\t}\n\treturn\n}", "title": "" }, { "docid": "2a2d249b41aa270ea6cc873d10cb3ee1", "score": "0.47590554", "text": "func TestAddPointsAgain(t *testing.T) {\n\tscorer := scorekeeper.NewScorer()\n\tscorer.Add(\"Sandy\", 10)\n\tscorer.Add(\"Sandy\", 10)\n\tassert.Equal(t, 20, scorer.Get(\"Sandy\"))\n}", "title": "" }, { "docid": "5ae979e8a1b885975edf1ccee6ae3b69", "score": "0.47511235", "text": "func NewDouble(t godouble.T, configurators ...func(*awsdouble.AWSTestDouble)) *PollyDouble {\n\tresult := &PollyDouble{}\n\n\tconfigurators = append([]func(configurator *awsdouble.AWSTestDouble){func(d *awsdouble.AWSTestDouble) {\n\t\td.SetDefaultCall(result.defaultMethodCall)\n\t\td.SetDefaultReturnValues(result.defaultReturnValues)\n\t}}, configurators...)\n\n\tresult.AWSTestDouble = awsdouble.NewDouble(t, (*pollyiface.PollyAPI)(nil), configurators...)\n\treturn result\n}", "title": "" }, { "docid": "ab94504b7984e4f0ebb60749792bf1c0", "score": "0.4749364", "text": "func (_MdexFarm *MdexFarmCaller) UserInfo(opts *bind.CallOpts, arg0 *big.Int, arg1 common.Address) (struct {\n\tAmount *big.Int\n\tRewardDebt *big.Int\n\tMultLpRewardDebt *big.Int\n}, error) {\n\tvar out []interface{}\n\terr := _MdexFarm.contract.Call(opts, &out, \"userInfo\", arg0, arg1)\n\n\toutstruct := new(struct {\n\t\tAmount *big.Int\n\t\tRewardDebt *big.Int\n\t\tMultLpRewardDebt *big.Int\n\t})\n\tif err != nil {\n\t\treturn *outstruct, err\n\t}\n\n\toutstruct.Amount = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\toutstruct.RewardDebt = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)\n\toutstruct.MultLpRewardDebt = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int)\n\n\treturn *outstruct, err\n\n}", "title": "" }, { "docid": "6808a9b06ef7c33a1a0b0e3734218f84", "score": "0.47361326", "text": "func DoubleValue(d float64) Value { return Value{kind: KindDouble, dbl: d} }", "title": "" }, { "docid": "383249665e45d54842d1712cc1c5d94e", "score": "0.4728366", "text": "func (self *PhysicsP2PointProxy) Y() int{\n return self.Object.Get(\"y\").Int()\n}", "title": "" }, { "docid": "8e4941842bd98e1ef232c3d5cc65167a", "score": "0.47173637", "text": "func main() {\n\ttwoints(10, 11)\n\n}", "title": "" }, { "docid": "c9b71b39d735b4fc7a41bc13d464bc8e", "score": "0.47085768", "text": "func main() {\n\tp1 := DoubleZero{\n\t\tPerson: Person{\n\t\t\tFirst: \"James\",\n\t\t\tLast: \"Bond\",\n\t\t\tAge: 20,\n\t\t},\n\t\tFirst: \"Double Zero Seven\",\n\t\tLicenceToKill: true,\n\t}\n\tfmt.Println(p1)\n\tfmt.Println(p1.Person.Age)\n}", "title": "" }, { "docid": "beeb6be2f2440f5f17db5626da530f68", "score": "0.47055444", "text": "func getDistance(firstPoint data.Point, secondPoint data.Point) float64 {\n\txd := secondPoint.X - firstPoint.X\n\tyd := secondPoint.Y - firstPoint.Y\n\treturn math.Sqrt(xd*xd + yd*yd)\n}", "title": "" }, { "docid": "19ad73261f4de5ffb86c26a9e7e67b2a", "score": "0.46934077", "text": "func expSpecial(clt *sxutil.SMServiceClient, dm *api.Demand) {\n\tvar rdSh rideshare.RideShare\n\trsInfo := dm.GetArg_RideShare()\n\tif rsInfo == nil {\n\t\tlog.Printf(\"Demand is not for RideShare! [%v]\", dm)\n\t\treturn\n\t}\n\n\tlog.Println(\"Start checking!\",rsInfo)\n\ttoStation, useTrain := checkTrainDest(rsInfo)\n\n\tvar fpt, tpt *common.Point\n\tvar brt ,trt *rideshare.Route\n\tvar subj int\n\tdptTime := rsInfo.DepartTime\n\tif toStation { // to Aimi\n\t\tfpt = \trsInfo.GetDepartPoint().GetCentralPoint()\n\t\tsubj = findCurrentPlace(fpt)\n\t}else{\n\t\ttpt = \trsInfo.GetArrivePoint().GetCentralPoint()\n\t\tsubj = findCurrentPlace(tpt)\n\t}\n\tif subj < 0 || subj >2 {\n\t\tlog.Printf(\"Not usual result!:\", subj)\n\t\treturn\n\t}\n\tlog.Println(\"We think this is person \",subj,\" toSta \", toStation )\n\tbrt = getBusRoute(toStation, subj)\n\ttrt = getTrainRouteFromTimeExp(toStation)\n\n\n\tif !toStation {\n\t\tfpt = brt.GetArrivePoint().GetCentralPoint()\n\t\tarTM := brt.ArriveTime\n\t\tarTS := arTM.GetTimestamp()\n\t\tarTime , _ := ptypes.Timestamp(arTS)\n\t\tarTime.Add(BusTrainsitTime) //\n\t\tarTimePro , _ := ptypes.TimestampProto(arTime)\n\t\tdptTime = common.NewTime().WithTimestamp(arTimePro)\n\t}else{\n\t\ttpt = brt.GetDepartPoint().GetCentralPoint()\n\t}\n\n\tch := make(chan *api.Supply)\n\trideShareMu.Lock()\n\tid := getOnemileRoute(clt, fpt, tpt, dptTime, nil)\n\trideShareMap[id]= ch\n\trideShareMu.Unlock()\n\n\tvar rs *rideshare.RideShare\n\tvar rssp *api.Supply\n\tselect {\n\tcase <-time.After(30 *time.Second ):\n\t\tlog.Printf(\"Timeout 30 seconds for getting OneMileRoute\")\n\t\treturn\n\tcase rssp = <-ch:\n\t\trs = rssp.GetArg_RideShare()\n\t\tlog.Printf(\"Get OnemileRoute for BSTR\")\n\t}\n\n\tif useTrain {\n\t\tif toStation {\n\t\t\trdSh = rideshare.RideShare{\n\t\t\t\tRoutes: []*rideshare.Route{rs.Routes[1],brt, trt },\n\t\t\t}\n\t\t}else{\n\t\t\trdSh = rideshare.RideShare{\n\t\t\t\tRoutes: []*rideshare.Route{ trt, brt, rs.Routes[1] },\n\t\t\t}\n\t\t}\n\t}else{\n\t\tif toStation {\n\t\t\trdSh = rideshare.RideShare{\n\t\t\t\tRoutes: []*rideshare.Route{rs.Routes[1],brt },\n\t\t\t}\n\t\t}else {\n\t\t\trdSh = rideshare.RideShare{\n\t\t\t\tRoutes: []*rideshare.Route{ brt, rs.Routes[1]},\n\t\t\t}\n\t\t}\n\t}\n\n\tspo := sxutil.SupplyOpts{\n\t\tTarget: dm.GetId(),\n\t\tJSON:\"{SPOPT0}\",\n\t\tRideShare: &rdSh,\n\t}\n\n\tspch := make(chan uint64)\n\tspid :=\tclt.ProposeSupply(&spo) // rideshare Demand\n\tsupplyMap[spid] = spch\n\tselect {\n\tcase <-time.After(300 * time.Second):\n\t\tlog.Printf(\"Timeout 300sec\")\n\t\treturn\n\tcase id:= <-spch: // receive SelectSupply!\n\t\t//\n\t\tlog.Printf(\"Select from Kota: %d\",id)\n\t\t// now we need to selectSupply for OneMile.\n\n\t\tmbusid, mberr := supplyClient.SelectSupply(rssp)\n\t\tlog.Printf(\"SelectSupply to %d\",mbusid)\n\t\tif mberr == nil {\n\t\t\tlog.Printf(\"SelectSupply Success! and MbusID=%d\", mbusid)\n\t\t\tclt.Confirm(sxutil.IDType(id))\n\t\t\tlog.Printf(\"Finally confirm %d \", id)\n\n\t\t}else{\n\t\t\tlog.Printf(\"%v error:\",mberr)\n\t\t}\n\n\t}\n\n\n\n}", "title": "" }, { "docid": "097606784ede42fdde40c4f0fbdaa09a", "score": "0.46797636", "text": "func (f *FQ2) DoubleAssign() {\n\tf.c0.DoubleAssign()\n\tf.c1.DoubleAssign()\n}", "title": "" }, { "docid": "f19597d082b0861fbf9d4d3b5ce8ba67", "score": "0.46750873", "text": "func (self *PhysicsP2PointProxy) X() int{\n return self.Object.Get(\"x\").Int()\n}", "title": "" }, { "docid": "1f0fcc96471abf65f4165d11457a260e", "score": "0.46571186", "text": "func (u *userInfo) updateUserRate(userRate float64) {\n\tu.userRate = userRate\n}", "title": "" }, { "docid": "9cd84f9aa9ff8c7ed38b5f0c0e187786", "score": "0.46425807", "text": "func getGCSafePoint(ctx context.Context, pdClient pd.Client) (uint64, error) {\n\tsafePoint, err := pdClient.UpdateGCSafePoint(ctx, 0)\n\tif err != nil {\n\t\treturn 0, errors.Trace(err)\n\t}\n\treturn safePoint, nil\n}", "title": "" }, { "docid": "22048fdc54fefe6006bdbbf33aaec491", "score": "0.4641932", "text": "func (dbc *DbClient) Points(nodeID string, points []data.Point) {\n\tdbc.newPoints <- NewPoints{nodeID, \"\", points}\n}", "title": "" }, { "docid": "299a9aadb59e87c50df277d0e815d9b2", "score": "0.4635631", "text": "func appendDouble(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {\n\tv := *p.Float64()\n\tb = wire.AppendVarint(b, wiretag)\n\tb = wire.AppendFixed64(b, math.Float64bits(v))\n\treturn b, nil\n}", "title": "" }, { "docid": "fd8c40dd37b20f4ac80f50339ca25bf3", "score": "0.4628859", "text": "func (it *BsonIterator) Double() float64 {\n return float64(C.bson_iterator_double(it.iterator))\n}", "title": "" }, { "docid": "d2ad320aec2cc246cf86443899c75c0e", "score": "0.46253094", "text": "func (_MasterChef *MasterChefCaller) UserInfo(opts *bind.CallOpts, arg0 *big.Int, arg1 common.Address) (struct {\n\tAmount *big.Int\n\tRewardDebt *big.Int\n}, error) {\n\tvar out []interface{}\n\terr := _MasterChef.contract.Call(opts, &out, \"userInfo\", arg0, arg1)\n\n\toutstruct := new(struct {\n\t\tAmount *big.Int\n\t\tRewardDebt *big.Int\n\t})\n\tif err != nil {\n\t\treturn *outstruct, err\n\t}\n\n\toutstruct.Amount = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\toutstruct.RewardDebt = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)\n\n\treturn *outstruct, err\n\n}", "title": "" }, { "docid": "55f030c4895a165a23b9d08f2adaf98f", "score": "0.462258", "text": "func printDouble(x int) {\n\tfmt.Printf(\"Double of %d = %d\\n\", x, 2*x)\n}", "title": "" }, { "docid": "26ecc28c06ae8bce7dbb4eb382942fce", "score": "0.46206662", "text": "func dustValue() types.Currency {\n\treturn types.SiacoinPrecision\n}", "title": "" }, { "docid": "2388cb49ea3996310def984075ca5f3e", "score": "0.4599468", "text": "func NewDouble(t godouble.T, configurators ...func(*awsdouble.AWSTestDouble)) *CodeGuruReviewerDouble {\n\tresult := &CodeGuruReviewerDouble{}\n\n\tconfigurators = append([]func(configurator *awsdouble.AWSTestDouble){func(d *awsdouble.AWSTestDouble) {\n\t\td.SetDefaultCall(result.defaultMethodCall)\n\t\td.SetDefaultReturnValues(result.defaultReturnValues)\n\t}}, configurators...)\n\n\tresult.AWSTestDouble = awsdouble.NewDouble(t, (*codegururevieweriface.CodeGuruReviewerAPI)(nil), configurators...)\n\treturn result\n}", "title": "" }, { "docid": "f183ee6982557e8502c28d858336f62a", "score": "0.45893183", "text": "func (_TetherToken *TetherTokenCaller) BasisPointsRate(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _TetherToken.contract.Call(opts, out, \"basisPointsRate\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "89d3aa2dbea57809b0daddf2c84cd97b", "score": "0.45670384", "text": "func (_TetherToken *TetherTokenCallerSession) BasisPointsRate() (*big.Int, error) {\n\treturn _TetherToken.Contract.BasisPointsRate(&_TetherToken.CallOpts)\n}", "title": "" }, { "docid": "21d46bd9910dc8196ee539051009df7a", "score": "0.4558719", "text": "func (obj *DoubleAttribute) GetValue() interface{} {\n\treturn obj.getValue()\n}", "title": "" }, { "docid": "8e150736403db5d9bc4713ffc1a0318a", "score": "0.4558438", "text": "func (api UserAPI) AddPD(context *gin.Context) /*(model.UserAuth, error) */ {\n\tvar user model.UserProvider\n\terr := context.ShouldBindJSON(&user)\n\tif err != nil {\n\t\tlog.Println(\"error AddUserHandeler\", err.Error())\n\t\tcontext.JSON(http.StatusInternalServerError, gin.H{\"msg\": err.Error()})\n\t\t//var acc model.UserAuth\n\t\treturn\n\t}\n\t// if api.UserRepository.CheckEmail(user.Email) {\n\t// \tif api.UserRepository.CheckProvider(user) {\n\t// \t\tcontext.Redirect(http.StatusTemporaryRedirect, \"/api/v1/user/loginPD\")\n\t// \t\treturn\n\t// \t}\n\t// \terr = api.UserRepository.UpdateProvider(user)\n\t// \tif err != nil {\n\t// \t\tcontext.JSON(http.StatusInternalServerError, gin.H{\"msg\": err.Error()})\n\t// \t\treturn\n\t// \t}\n\t// \tcontext.Redirect(http.StatusTemporaryRedirect, \"/api/v1/user/loginPD\")\n\t// \treturn\n\t// }\n\t// user.Address = []model.Address{}\n\t// err2 := api.UserRepository.AddUserPD(user)\n\t// if err2 != nil {\n\t// \tlog.Println(\"error AddUserHandeler\", err.Error())\n\t// \tcontext.JSON(http.StatusInternalServerError, gin.H{\"msg\": err.Error()})\n\t// \treturn\n\t// }\n\t// context.Redirect(http.StatusTemporaryRedirect, \"/api/v1/user/loginPD\")\n}", "title": "" }, { "docid": "66a5c87aa25845c3e88e2dbfca05a638", "score": "0.45539957", "text": "func (d Delaunay) NumPoints() int {\n\treturn d.numPoints\n}", "title": "" }, { "docid": "b94c6568f971ea424d3b163499b65251", "score": "0.45454383", "text": "func ApproxDistance(p1, p2 s2.LatLng) float64 {\n\tp1.Lng *= -1.0\n\tp2.Lng *= -1.0\n\n\tF := (p1.Lat.Degrees() + p2.Lat.Degrees()) / 2.0\n\tG := (p1.Lat.Degrees() - p2.Lat.Degrees()) / 2.0\n\tL := (p1.Lng.Degrees() - p2.Lng.Degrees()) / 2.0\n\n\tcosg := math.Cos(G * DE2RA)\n\tsing := math.Sin(G * DE2RA)\n\tcosl := math.Cos(L * DE2RA)\n\tsinl := math.Sin(L * DE2RA)\n\tcosf := math.Cos(F * DE2RA)\n\tsinf := math.Sin(F * DE2RA)\n\n\tS := sing*sing*cosl*cosl + cosf*cosf*sinl*sinl\n\tC := cosg*cosg*cosl*cosl + sinf*sinf*sinl*sinl\n\tW := math.Atan2(math.Sqrt(S), math.Sqrt(C))\n\tR := math.Sqrt((S * C)) / W\n\tH1 := (3*R - 1.0) / (2.0 * C)\n\tH2 := (3*R + 1.0) / (2.0 * S)\n\tD := 2 * W * ERAD // ERAD is in Km\n\treturn D * (1 + FLATTENING*H1*sinf*sinf*cosg*cosg - FLATTENING*H2*cosf*cosf*sing*sing)\n}", "title": "" }, { "docid": "baaaf890bf0afb4c9c22dfe1213acedc", "score": "0.4528272", "text": "func ManagePoints(ctrl datastore.Controller, tx datastore.Transact,\n\tid string, amount backer.Points) (backer.Points, error) {\n\tplayer, err := ctrl.FindPlayer(id, tx)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tif amount < 0 && player.Balance < backer.Points(math.Abs(float64(amount))) {\n\t\treturn 0, ErrInsufficientPoints\n\t}\n\n\tplayer.Balance = backer.Points(\n\t\thelper.RoundPrice(float32(player.Balance) + helper.TruncatePrice(float32(amount))))\n\terr = ctrl.SavePlayer(player, tx)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn player.Balance, nil\n}", "title": "" }, { "docid": "7e1f9723b5fbcb87570fa5513a656c22", "score": "0.452768", "text": "func ReceiveVoteAward(nonce uint64, toAddress string, privKeyFile, password, privKey string) (string, error) {\n\tvar privateKey, fromAddress string\n\tif privKey != \"\" {\n\t\tprivateKey = privKey\n\t\tfromAddress, _ = GetAddrByPrivKey(privKey)\n\t} else {\n\t\tprivateKey, fromAddress, _ = KeystoreToPrivateKey2(privKeyFile, password)\n\t}\n\tif nonce == 0 {\n\t\tnonce, _ = Client.NonceAt(context.Background(), common.HexToAddress(fromAddress), nil)\n\t}\n\tvalue := 0\n\tamount := big.NewInt(int64(value))\n\tchainID, err := Client.NetworkID(context.Background())\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn \"\", err\n\t}\n\ttxType = 9\n\tdata := \"\"\n\ttx, err := Client.NewTransaction(chainID, nonce, privateKey, toAddress, amount, data, txType)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn \"\", err\n\t}\n\ttxHash, err := Client.SdkSendTransaction(tx)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn txHash, nil\n}", "title": "" }, { "docid": "e102c1dd808d50c2d9af246bb5069fae", "score": "0.4523607", "text": "func (_TetherToken *TetherTokenSession) BasisPointsRate() (*big.Int, error) {\n\treturn _TetherToken.Contract.BasisPointsRate(&_TetherToken.CallOpts)\n}", "title": "" }, { "docid": "5b460940680370c696f20ea289393b67", "score": "0.45173955", "text": "func checkPrimeValidationsOnModel(planner route.Planner) validator {\n\treturn validatorFunc(func(appCtx appcontext.AppContext, newer *models.MTOShipment, older *models.MTOShipment) error {\n\t\tverrs := validate.NewErrors()\n\t\t// Prime cannot edit the customer's requestedPickupDate\n\t\tif newer.RequestedPickupDate != nil {\n\t\t\trequestedPickupDate := newer.RequestedPickupDate\n\t\t\t// if !requestedPickupDate.Equal(*older.RequestedPickupDate) {\n\t\t\t// \tverrs.Add(\"requestedPickupDate\", \"must match what customer has requested\")\n\t\t\t// }\n\t\t\tnewer.RequestedPickupDate = requestedPickupDate\n\t\t}\n\n\t\t// Get the latest scheduled pickup date as it's needed to calculate the update range for PrimeEstimatedWeight\n\t\t// And the RDD\n\t\tlatestSchedPickupDate := older.ScheduledPickupDate\n\t\tif newer.ScheduledPickupDate != nil {\n\t\t\tlatestSchedPickupDate = newer.ScheduledPickupDate\n\t\t}\n\n\t\t// Prime can update the estimated weight once within a set period of time\n\t\t// If it's expired, they can no longer update it.\n\t\tlatestEstimatedWeight := older.PrimeEstimatedWeight\n\t\tif newer.PrimeEstimatedWeight != nil {\n\t\t\tif older.PrimeEstimatedWeight != nil {\n\t\t\t\tverrs.Add(\"primeEstimatedWeight\", \"cannot be updated after initial estimation\")\n\t\t\t}\n\t\t\t// Validate if we are in the allowed period of time\n\t\t\tnow := time.Now()\n\t\t\tif latestSchedPickupDate != nil {\n\t\t\t\terr := validatePrimeEstimatedWeightRecordedDate(now, *latestSchedPickupDate)\n\t\t\t\tif err != nil {\n\t\t\t\t\tverrs.Add(\"primeEstimatedWeight\", \"the time period for updating the estimated weight for a shipment has expired, please contact the TOO directly to request updates to this shipment’s estimated weight\")\n\t\t\t\t\tverrs.Add(\"primeEstimatedWeight\", err.Error())\n\t\t\t\t}\n\t\t\t}\n\t\t\t// If they can update it, it will be the latestEstimatedWeight (needed for RDD calc)\n\t\t\t// And we also record the date at which it happened\n\t\t\tlatestEstimatedWeight = newer.PrimeEstimatedWeight\n\t\t\tnewer.PrimeEstimatedWeightRecordedDate = &now\n\t\t}\n\n\t\t// Prime cannot update or add agents with this endpoint, so this should always be empty\n\t\tif len(newer.MTOAgents) > 0 {\n\t\t\tif len(older.MTOAgents) < len(newer.MTOAgents) {\n\t\t\t\tverrs.Add(\"agents\", \"cannot add or update MTO agents to a shipment\")\n\t\t\t}\n\t\t}\n\n\t\t// Prime can create a new address, but cannot update it.\n\t\t// So if address exists, return an error. But also set the local pointer to nil, so we don't recalculate requiredDeliveryDate\n\t\tvar latestPickupAddress *models.Address\n\t\tvar latestDestinationAddress *models.Address\n\n\t\tswitch older.ShipmentType {\n\t\tcase models.MTOShipmentTypeHHGIntoNTSDom:\n\t\t\tif older.StorageFacility == nil {\n\t\t\t\t// latestDestinationAddress is only used for calculating RDD.\n\t\t\t\t// We don't want to block an update because we're missing info to calculate RDD\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tlatestPickupAddress = older.PickupAddress\n\t\t\tlatestDestinationAddress = &older.StorageFacility.Address\n\t\tcase models.MTOShipmentTypeHHGOutOfNTSDom:\n\t\t\tif older.StorageFacility == nil {\n\t\t\t\t// latestPickupAddress is only used for calculating RDD.\n\t\t\t\t// We don't want to block an update because we're missing info to calculate RDD\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tlatestPickupAddress = &older.StorageFacility.Address\n\t\t\tlatestDestinationAddress = older.DestinationAddress\n\t\tdefault:\n\t\t\tlatestPickupAddress = older.PickupAddress\n\t\t\tlatestDestinationAddress = older.DestinationAddress\n\t\t}\n\t\t// We also track the latestPickupAddress for the RDD calculation\n\t\tif older.PickupAddress != nil && newer.PickupAddress != nil { // If both are populated, return error\n\t\t\tverrs.Add(\"pickupAddress\", \"the pickup address already exists and cannot be updated with this endpoint\")\n\t\t} else if newer.PickupAddress != nil { // If only the update has an address, that's the latest address\n\t\t\tlatestPickupAddress = newer.PickupAddress\n\t\t}\n\t\tif older.DestinationAddress != nil && newer.DestinationAddress != nil {\n\t\t\tverrs.Add(\"destinationAddress\", \"the destination address already exists and cannot be updated with this endpoint\")\n\t\t} else if newer.DestinationAddress != nil {\n\t\t\tlatestDestinationAddress = newer.DestinationAddress\n\t\t}\n\n\t\t// For secondary addresses we do the same, but don't have to track the latest values for RDD\n\t\tif older.SecondaryPickupAddress != nil && newer.SecondaryPickupAddress != nil { // If both are populated, return error\n\t\t\tverrs.Add(\"secondaryPickupAddress\", \"the secondary pickup address already exists and cannot be updated with this endpoint\")\n\t\t}\n\t\tif older.SecondaryDeliveryAddress != nil && newer.SecondaryDeliveryAddress != nil {\n\t\t\tverrs.Add(\"secondaryDeliveryAddress\", \"the secondary delivery address already exists and cannot be updated with this endpoint\")\n\t\t}\n\n\t\t// If we have all the data, calculate RDD\n\t\tif latestSchedPickupDate != nil && (latestEstimatedWeight != nil || (older.ShipmentType == models.MTOShipmentTypeHHGOutOfNTSDom &&\n\t\t\tolder.NTSRecordedWeight != nil)) && latestPickupAddress != nil && latestDestinationAddress != nil {\n\t\t\tweight := latestEstimatedWeight\n\t\t\tif older.ShipmentType == models.MTOShipmentTypeHHGOutOfNTSDom && older.NTSRecordedWeight != nil {\n\t\t\t\tweight = older.NTSRecordedWeight\n\t\t\t}\n\t\t\trequiredDeliveryDate, err := CalculateRequiredDeliveryDate(appCtx, planner, *latestPickupAddress,\n\t\t\t\t*latestDestinationAddress, *latestSchedPickupDate, weight.Int())\n\t\t\tif err != nil {\n\t\t\t\tverrs.Add(\"requiredDeliveryDate\", err.Error())\n\t\t\t}\n\t\t\tnewer.RequiredDeliveryDate = requiredDeliveryDate\n\t\t}\n\t\treturn verrs\n\t})\n}", "title": "" }, { "docid": "c69445ae0eb1d83d088800826bbe3346", "score": "0.4516197", "text": "func newPoint(lat, long coordinate) point {\n\treturn point{lat.decimal(), long.decimal()}\n}", "title": "" }, { "docid": "95a5ac3cae2a5029d52d81c20cdd25e4", "score": "0.45124295", "text": "func TestPointFail(t *testing.T) {\n\tmockCtrl := gomock.NewController(t)\n\tdefer mockCtrl.Finish()\n\n\t// Create mocked points and BatchPoints\n\tmockedBP := NewMockbp(mockCtrl)\n\tmockedBP.EXPECT().AddPoint(gomock.Any()).Times(0)\n\n\t// Mocked Client that NewHTTPClient will return\n\tmockConnection := createWorkingConClient(mockCtrl, 1, 0)\n\n\t// Mocked influxInterface that will return the mocked Client\n\tmockinfluxInterface := createWorkinginfluxInterface(mockCtrl, mockConnection)\n\n\tmockinfluxInterface.EXPECT().NewBatchPoints(client.BatchPointsConfig{\n\t\tDatabase: dbConfig.DBName,\n\t\tPrecision: \"h\",\n\t}).\n\t\tTimes(1).\n\t\tDoAndReturn(func(conf client.BatchPointsConfig) (client.BatchPoints, error) {\n\t\t\treturn mockedBP, nil\n\t\t})\n\n\tmockinfluxInterface.EXPECT().NewPoint(\"cost\", gomock.Any(), gomock.Any(), gomock.Any()).\n\t\tTimes(1).\n\t\tDoAndReturn(func(name string, tags map[string]string, fields map[string]interface{}, t time.Time) (*client.Point, error) {\n\t\t\treturn nil, errors.New(\"testPointError\")\n\t\t})\n\n\tdbClient := NewDBClient(dbConfig)\n\tdbClient.influxInterface = mockinfluxInterface\n\n\tactual := dbClient.AddUsageData(usageDataArray)\n\texpected := \"testPointError\"\n\n\tif actual.Error() != expected {\n\t\tt.Errorf(\"Wanted: AddUsageData to return %v but got %v\", expected, actual)\n\t}\n}", "title": "" }, { "docid": "75385840e54893067ce137998059e744", "score": "0.45114216", "text": "func TestAddPoints(t *testing.T) {\n\tscorer := scorekeeper.NewScorer()\n\tscorer.Add(\"Sandy\", 10)\n\tassert.Equal(t, 10, scorer.Get(\"Sandy\"))\n}", "title": "" }, { "docid": "10f78ce4317eafcd53a421e60c6cd55f", "score": "0.45080617", "text": "func (m *SalesOrderLine) GetUnitPrice()(*float64) {\n val, err := m.GetBackingStore().Get(\"unitPrice\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*float64)\n }\n return nil\n}", "title": "" }, { "docid": "92d9e5345f76045df654ab94237a5061", "score": "0.45056704", "text": "func (t *SimpleChaincode) transferPoints(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {\r\n\r\n\tfmt.Println(\"Running transferPoints\")\r\n\tcurrentDateStr := time.Now().Format(time.RFC822)\r\n\tstartDate, _ := time.Parse(time.RFC822, currentDateStr)\r\n\r\n\t\r\n\tvar tx Transaction\r\n\ttx.Date \t\t= startDate\r\n\ttx.To \t\t\t= args[0]\r\n\ttx.From \t\t= args[1]\r\n\ttx.Type \t = args[2]\r\n\ttx.Description \t= args[3]\r\n\ttx.ContractId \t= args[4]\r\n\tactivities, _ := strconv.Atoi(args[5])\r\n\ttx.Activities = activities\r\n\ttx.StatusCode \t= 1\r\n\ttx.StatusMsg \t= \"Transaction Completed\"\r\n\t\r\n\t\r\n\tamountValue, err := strconv.ParseFloat(args[6], 64)\r\n\tif err != nil {\r\n\t\ttx.StatusCode = 0\r\n\t\ttx.StatusMsg = \"Invalid Amount\"\r\n\t}else{\r\n\t\ttx.Amount = amountValue\r\n\t}\r\n\t\r\n\tmoneyValue, err := strconv.ParseFloat(args[7], 64)\r\n\tif err != nil {\r\n\t\ttx.StatusCode = 0\r\n\t\ttx.StatusMsg = \"Invalid Amount\"\r\n\t}else{\r\n\t\ttx.Money = moneyValue\r\n\t}\r\n\t\r\n\t\r\n\t// Get the current reference number and update it\r\n\tvar refNumber int\r\n\trefNumberBytes, numErr := stub.GetState(\"refNumber\")\r\n\tif numErr != nil {\r\n\t\tfmt.Println(\"Error Getting ref number for transferring points\")\r\n\t\treturn nil, err\r\n\t}\r\n\t\r\n\tjson.Unmarshal(refNumberBytes, &refNumber)\r\n\ttx.RefNumber \t= strconv.Itoa(refNumber)\r\n\trefNumber = refNumber + 1;\r\n\trefNumberBytes, _ = json.Marshal(refNumber)\r\n\terr = stub.PutState(\"refNumber\", refNumberBytes)\t\t\t\t\t\t\t\t\r\n\tif err != nil {\r\n\t\tfmt.Println(\"Error Creating updating ref number\")\r\n\t\treturn nil, err\r\n\t}\r\n\t\r\n\t// Determine point amount to transfer based on contract type\r\n\tif (tx.ContractId == DOUBLE_CONTRACT) {\r\n\t\ttx.Amount = doubleContract(tx, stub)\r\n\t} else if (tx.ContractId == FEEDBACK_CONTRACT) {\r\n\t\ttx.Amount = feedbackContract(tx, stub)\r\n\t}\r\n\t\r\n\r\n\t// Get Receiver account from BC and update point balance\r\n\trfidBytes, err := stub.GetState(tx.To)\r\n\tif err != nil {\r\n\t\treturn nil, errors.New(\"transferPoints Failed to get Receiver from BC\")\r\n\t}\r\n\tvar receiver User\r\n\tfmt.Println(\"transferPoints Unmarshalling User Struct\");\r\n\terr = json.Unmarshal(rfidBytes, &receiver)\r\n\treceiver.Balance = receiver.Balance + tx.Amount\r\n\treceiver.Modified = currentDateStr\r\n\treceiver.NumTxs = receiver.NumTxs + 1\r\n\ttx.ToName = receiver.Name;\r\n\t\r\n\t\r\n\t//Commit Receiver to ledger\r\n\tfmt.Println(\"transferPoints Commit Updated receiver To Ledger\");\r\n\ttxsAsBytes, _ := json.Marshal(receiver)\r\n\terr = stub.PutState(tx.To, txsAsBytes)\t\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\t\r\n\t// Get Sender account from BC nd update point balance\r\n\trfidBytes, err = stub.GetState(tx.From)\r\n\tif err != nil {\r\n\t\treturn nil, errors.New(\"transferPoints Failed to get Financial Institution\")\r\n\t}\r\n\tvar sender User\r\n\tfmt.Println(\"transferPoints Unmarshalling Sender\");\r\n\terr = json.Unmarshal(rfidBytes, &sender)\r\n\tsender.Balance = sender.Balance - tx.Amount\r\n\tsender.Modified = currentDateStr\r\n\tsender.NumTxs = sender.NumTxs + 1\r\n\ttx.FromName = sender.Name;\r\n\t\r\n\t//Commit Sender to ledger\r\n\tfmt.Println(\"transferPoints Commit Updated Sender To Ledger\");\r\n\ttxsAsBytes, _ = json.Marshal(sender)\r\n\terr = stub.PutState(tx.From, txsAsBytes)\t\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\t\r\n\t\r\n\t//get the AllTransactions index\r\n\tallTxAsBytes, err := stub.GetState(\"allTx\")\r\n\tif err != nil {\r\n\t\treturn nil, errors.New(\"transferPoints: Failed to get all Transactions\")\r\n\t}\r\n\r\n\t//Update transactions arrary and commit to BC\r\n\tfmt.Println(\"SubmitTx Commit Transaction To Ledger\");\r\n\tvar txs AllTransactions\r\n\tjson.Unmarshal(allTxAsBytes, &txs)\r\n\ttxs.Transactions = append(txs.Transactions, tx)\r\n\ttxsAsBytes, _ = json.Marshal(txs)\r\n\terr = stub.PutState(\"allTx\", txsAsBytes)\t\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\t\r\n\t\r\n\treturn nil, nil\r\n\r\n}", "title": "" }, { "docid": "81ac6e2ef7868d73bdff7577721db8ed", "score": "0.449556", "text": "func DerivateValueCalculator(x float64, y float64) (float64, float64, float64, float64) {\n \n // Value of x^2+y^2 \n firstDerivate := math.Pow(x, 2)+math.Pow(y, 2);\n\n // value of 2x+2yy'\n secondDerivate := 2*x+2*y*firstDerivate;\n // value of 2+2(yy'' + y'y')\n thirdDerivate := 2 + 2*(y*secondDerivate + firstDerivate * firstDerivate);\n // value of 2(yy''' + 3y''y')\n fourthDerivate := 2*(y * thirdDerivate+ 3 * secondDerivate * firstDerivate)\n\n return firstDerivate, secondDerivate, thirdDerivate, fourthDerivate; \n}", "title": "" }, { "docid": "da01a3d7cc381feddf3a52a3f65ccdb0", "score": "0.4492917", "text": "func (m *Item) GetUnitPrice()(*float64) {\n val, err := m.GetBackingStore().Get(\"unitPrice\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*float64)\n }\n return nil\n}", "title": "" }, { "docid": "890f4fa20eca8f9c8d3e78ff472923c1", "score": "0.4490245", "text": "func (m *UserExperienceAnalyticsModelScores) GetEndpointAnalyticsScore()(*float64) {\n val, err := m.GetBackingStore().Get(\"endpointAnalyticsScore\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*float64)\n }\n return nil\n}", "title": "" }, { "docid": "5212ab9fb8854c9b7b2778f196c9d35a", "score": "0.4489904", "text": "func (s *RestServer) getDprdpr0intsramseccMetricsPoints() ([]*tsdb.Point, error) {\n\n\treturn nil, nil\n\n}", "title": "" }, { "docid": "0c494a8077dd9c2e1e51b8025ecdb075", "score": "0.4488928", "text": "func (d *Dao) DoubleCheck(c context.Context, mid int64) (err error) {\n\tparams := url.Values{}\n\tparams.Set(\"mids\", strconv.FormatInt(mid, 10))\n\tparams.Set(\"desc\", \"异地风险,系统导入\")\n\tparams.Set(\"operator\", \"异地系统判断\")\n\tvar res struct {\n\t\tCode int `json:\"code\"`\n\t}\n\tif err = d.httpClient.Post(c, _doubleCheckURL, \"\", params, &res); err != nil {\n\t\tlog.Error(\"d.Doublecheck err(%v)\", err)\n\t}\n\tlog.Info(\"d.DoubleCheck mid %d \", mid)\n\treturn\n}", "title": "" }, { "docid": "7101ef2ac75b589ed51219a6da61fa55", "score": "0.448704", "text": "func DistBtwnTwoPoints(dp PointStruct, cp PointStruct) float64 {\n\td := math.Sqrt(math.Pow(dp.Point.X-cp.Point.X, 2) + math.Pow(dp.Point.Y-cp.Point.Y, 2))\n\treturn d\n}", "title": "" }, { "docid": "d5b5f4a159c33714527b09944e87ef86", "score": "0.4484211", "text": "func RetrieveUsdPrice(coin string) (float64, error) {\n\tpricer.mux.RLock()\n\tif pricer.coins[coin].price != 0 {\n\t\tif time.Now().After(pricer.coins[coin].nextRefresh) {\n\t\t\tgoto REFRESH\n\t\t}\n\t\tcost := pricer.coins[coin].price\n\t\tpricer.mux.RUnlock()\n\t\treturn cost, nil\n\t}\nREFRESH:\n\tpricer.mux.RUnlock()\n\tpricer.mux.Lock()\n\tdefer pricer.mux.Unlock()\n\tif pricer.coins[coin].price != 0 && !time.Now().After(pricer.coins[coin].nextRefresh) {\n\t\treturn pricer.coins[coin].price, nil\n\t}\n\turl := fmt.Sprintf(\"%s/%s\", tickerURL, coin)\n\tresponse, err := http.Get(url)\n\tif err != nil {\n\t\treturn pricer.coins[coin].price, err\n\t}\n\n\tbody, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\treturn pricer.coins[coin].price, err\n\t}\n\tvar decode []Response\n\tif err = json.Unmarshal(body, &decode); err != nil {\n\t\treturn pricer.coins[coin].price, err\n\t}\n\tcost, err := strconv.ParseFloat(decode[0].PriceUsd, 64)\n\tif err != nil {\n\t\treturn pricer.coins[coin].price, err\n\t}\n\tpricer.coins[coin] = coinPrice{\n\t\tprice: cost,\n\t\tnextRefresh: time.Now().Add(time.Minute * 10),\n\t}\n\treturn cost, nil\n}", "title": "" }, { "docid": "e202f54e99bcf743ade6760a56d6a74c", "score": "0.4482544", "text": "func main() {\n\tfmt.Println(shopping.PriceCheck(4343))\n}", "title": "" }, { "docid": "5ffe6058ed3b20d2da8f6e3ed3688303", "score": "0.4472168", "text": "func (this *User) makeSharedSecret(other *User) ([]byte, error) {\n rawPubKey, err := base64.StdEncoding.DecodeString(other.PublicKey)\n if err != nil {\n return nil, NewError(err, this)\n }\n\n var pubKey ecdsa.PublicKey\n _, err = asn1.Unmarshal(rawPubKey, &pubKey)\n if err != nil {\n return nil, NewError(err, this)\n }\n\n x, y := this.keys.SigningKey.ScalarMult(pubKey.X, pubKey.Y, this.keys.SigningKey.D.Bytes())\n zero := big.NewInt(0)\n if zero.Cmp(x) == 0 && zero.Cmp(y) == 0 {\n return nil, NewError(\"Invalid point\", this)\n }\n\n secret := x.Bytes()\n for i := 0; i < 10000; i++ {\n hash := sha512.Sum512(secret)\n secret = hash[:]\n }\n return secret, nil\n}", "title": "" }, { "docid": "4900e69e27a11370ad6392a4c02342bd", "score": "0.44712883", "text": "func getPrice(plan int, unitPrice float32) float32 {\n\n\treturn float32(plan) * unitPrice\n\n}", "title": "" }, { "docid": "f1b5d657a0cfbac2707e875d63ed8e43", "score": "0.44685304", "text": "func deductAmountFromUser(tx *pg.Tx, amount float32, name string) (result orm.Result, err error) {\n\tamountString := fmt.Sprintf(\"%f\", amount)\n\tquery := \"update users set spent = spent + \" + amountString + \" where spent + \" + amountString + \" <= credit_limit and name = '\" + name + \"'\"\n\tresult, err = tx.Exec(query)\n\treturn\n}", "title": "" }, { "docid": "1f6645b36cb0b626ef492c44c8e94aa3", "score": "0.44681674", "text": "func (s *BasesimplelangListener) EnterReaddouble(ctx *ReaddoubleContext) {}", "title": "" }, { "docid": "d6932b00f30e62a6fa1f634bb450598b", "score": "0.44641018", "text": "func NewDoubleDataPoint() *DoubleDataPoint {\n\treturn &DoubleDataPoint{&otlpmetrics.DoubleDataPoint{}, &internalDoubleDataPoint{}}\n}", "title": "" }, { "docid": "838b67d4ca1b72acccc5e803ffdcbc3a", "score": "0.4460702", "text": "func (w *WriteShardRequest) Points() []models.Point { return w.unmarshalPoints() }", "title": "" } ]
632e887b2ca676501346907235d7bfc0
New returns an account from ID
[ { "docid": "a6e871da9c23443523bdebc30e7df448", "score": "0.64348245", "text": "func New(wd WriterDeleter, data model.Account) *Account {\n\tnow := time.Now().Unix()\n\taccount := &Account{\n\t\twriter: wd,\n\t\tdata: data,\n\t}\n\taccount.data.CreatedOn = &now\n\taccount.data.LastModifiedOn = &now\n\treturn account\n}", "title": "" } ]
[ { "docid": "274b24f083153aefa36a55159cd69c0d", "score": "0.68434614", "text": "func NewAccount()(*Account) {\n m := &Account{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "title": "" }, { "docid": "0e7b8540a902722bb000dfb6cb9008c1", "score": "0.674252", "text": "func (d *driver) newAccount() func() {\n\ta := account{driver: d}\n\n\ta.Respond(\"Your account ID can be anything you want: email address, book title, film title, a quote - anything that you can remember. You can use upper and lower case characters, numbers and symbols. The only restriction is it has to be [CYAN]%d[WHITE] characters or more in length. This is [CYAN]NOT[WHITE] your character's name.\\n\", config.AccountIdMin)\n\ta.needAccount()\n\treturn a.checkAccount\n}", "title": "" }, { "docid": "64d2921a5eb269656057800da6ece6eb", "score": "0.66329926", "text": "func (acc *RcAcc) New(ID string) {\n\th := sha256.New()\n\th.Write([]byte(ID))\n\tvar curve elliptic.Curve\n\tcurve = elliptic.P256()\n\tvar tmp *ecdsa.PrivateKey\n\ttmp, _ = ecdsa.GenerateKey(curve, rand.Reader)\n\tacc.Pri = *tmp\n\tacc.Puk = acc.Pri.PublicKey\n\tacc.AddrReal = cryptonew.AddressGenerate(&acc.Pri)\n\tacc.Addr = base58.Encode(acc.AddrReal[:])\n\t//acc.AccType = accType\n}", "title": "" }, { "docid": "ecd517e7abb29e2d76248182ff74d464", "score": "0.65695584", "text": "func (s *service) New(id ID, country Country, city City, currency Currency, balance decimal.Decimal) error {\n\tif currency == \"\" {\n\t\tcurrency = CurrencyUSD\n\t}\n\treturn s.accounts.Store(&Account{\n\t\tID: id,\n\t\tCountry: country,\n\t\tCity: city,\n\t\tBalance: balance,\n\t\tCurrency: currency,\n\t})\n}", "title": "" }, { "docid": "5f40289bb9599c0ca890cb3fb1ca0f4f", "score": "0.63611996", "text": "func NewAccount(id string) *Account {\n\ta := new(Account)\n\n\ta.ID = id\n\ta.Entries = Entries{}\n\ta.entryHandler = func(flag string, e *Entry) {}\n\n\treturn a\n}", "title": "" }, { "docid": "454bc95f8bd2e69e552ce60231d75e5f", "score": "0.6325732", "text": "func create_account() LocalConfig.New_account{\n\tvar account LocalConfig.New_account\n\n\turl := \"\"\n\tpassword := \"\"\n\n\tstr := fmt.Sprintf(\"{\\\"jsonrpc\\\":\\\"2.0\\\",\\\"method\\\":\\\"personal_newAccount\\\",\\\"params\\\":[\\\"%s\\\"],\\\"id\\\":1}\",password)\n\tvar jsonStr = []byte(str)\n\n\treq, err := http.NewRequest(\"POST\", url, bytes.NewBuffer(jsonStr))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\tresult := &LocalConfig.Account_result{}\n\terr = json.Unmarshal([]byte(body), result)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\taccount.Address = result.Result\n\n\treg_expr := regexp.MustCompile(\".+x\")\n\treg_result := reg_expr.ReplaceAllString(result.Result, \"\")\n\taccount.KeyPath = get_key_file(reg_result)\n\treturn account\n}", "title": "" }, { "docid": "449168c7dc6d7dd576132321bb387709", "score": "0.6303735", "text": "func NewAccount(ID, name, CPF string, balance float64, createdAt time.Time) Account {\n\treturn Account{\n\t\tID: ID,\n\t\tName: name,\n\t\tCPF: CPF,\n\t\tBalance: balance,\n\t\tCreatedAt: createdAt,\n\t}\n}", "title": "" }, { "docid": "b6ac1eada2cce9be2e3c89b54b59d9e8", "score": "0.63017505", "text": "func NewAccount(http webreq.HTTP) Account {\n\treturn Account{\n\t\thttp: http,\n\t}\n}", "title": "" }, { "docid": "d766ffbd63e6f2a0c4aad37f1cd138a6", "score": "0.6255506", "text": "func newAccount(name string, accountType AccountType) *account {\n\treturn &account{\n\t\tAccountType: accountType,\n\t\tEnvironmentIDs: []string{},\n\t\tName: name,\n\t\tTenantedDeploymentMode: TenantedDeploymentMode(\"Untenanted\"),\n\t\tTenantIDs: []string{},\n\t\tTenantTags: []string{},\n\t\tresource: *newResource(),\n\t}\n}", "title": "" }, { "docid": "474147dd66ba19db6d04ba48b7d24004", "score": "0.6246342", "text": "func NewAccount(db *sql.DB) *Account {\n\treturn &Account{\n\t\tSQL: tx.SQL{\n\t\t\tDB: db,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "923db85b565831c94426b8000727a660", "score": "0.62406653", "text": "func (db *DB) NewAccount() *app.Account {\n\tdb.Lock()\n\tdefer db.Unlock()\n\tdb.maxAccountID++\n\taccount := &app.Account{ID: db.maxAccountID}\n\tdb.accounts[db.maxAccountID] = account\n\treturn account\n}", "title": "" }, { "docid": "a6556b7a9f88620b0730f723850cde34", "score": "0.61230123", "text": "func NewAccount(setts *Settings) (Account, error) {\n\tif setts == nil {\n\t\tsetts = DefaultSettings()\n\t}\n\tif err := initFuncs(setts); err != nil {\n\t\treturn nil, err\n\t}\n\tid, err := generateID(setts.AddrGen)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to generate account id\")\n\t}\n\treturn &account{id: id, setts: setts}, nil\n}", "title": "" }, { "docid": "52ba3911dad6817a803ff6101c88f1c0", "score": "0.6070013", "text": "func Create(accData model.AccountData) (model.Account, error) {\n\tid := uuid.NewV4().String()\n\terr := checkReqFields(accData)\n\tif err != nil {\n\t\treturn model.Account{}, err\n\t}\n\n\taccData.Type = \"accounts\"\n\taccData.ID = id\n\n\tpayload := model.Account{\n\t\tData: &accData,\n\t}\n\t\n\tpayloadJson, err := json.Marshal(payload)\n\tif err != nil {\n\t\treturn model.Account{}, errors.New(err.Error() +\n\t\t\"\\nFailed to marshal the payload\")\n\t}\n\n\tvar resp *http.Response\n\tvar respBody []byte\n\tfor i := 0; i < 3; i++ {\n\t\treqBody := bytes.NewBuffer(payloadJson)\n\t\tresp, err = http.Post(uRL, \"application/json\", reqBody)\n\t\tif err != nil {\n\t\t\treturn model.Account{}, errors.New(err.Error() +\n\t\t\t\t\"\\nFailed sending the POST request\")\n\t\t}\n\n\t\tif resp.StatusCode == http.StatusConflict {\n\t\t\tlog.Println(resp.Status + \". Probably the value of the `id` field alredy exists. Retrying...\")\n\t\t\tif i == 2 {\n\t\t\t\treturn model.Account{}, errors.New(strconv.Itoa(resp.StatusCode) + \": Duplicated Account ID\")\n\t\t\t}\n\t\t\tcontinue\n\t\t} else if resp.StatusCode != http.StatusCreated {\n\t\t\trespBody, err = readResponseBody(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn model.Account{}, err\n\t\t\t}\n\t\t\treturn model.Account{}, errors.New(resp.Status + \"\\n\" +\n\t\t\t\tstring(respBody))\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\trespBody, err = readResponseBody(resp.Body)\n\tif err != nil {\n\t\treturn model.Account{}, err\n\t}\n\n\taccModel, err := mapResponse(respBody)\n\tif err != nil {\n\t\treturn model.Account{}, err\n\t}\n\n\treturn accModel, nil\n}", "title": "" }, { "docid": "2dbca9d630f20f8d21bfc72f33aec40b", "score": "0.6057103", "text": "func NewAccount(value string) Account {\n\treturn Account(value)\n}", "title": "" }, { "docid": "ee1247be897cc05e1a0de808a70d0465", "score": "0.6047067", "text": "func NewAccount(id uint64, ownerKey []byte, balance *big.Int, subState []byte) *Account {\n\treturn &Account{\n\t\tID: id,\n\t\tOwner: ownerKey,\n\t\tBalance: balance.Bytes(),\n\t\tSubState: subState,\n\t}\n}", "title": "" }, { "docid": "dbcb3e4a79e0ce6e50a3a3c9d16c7645", "score": "0.6025112", "text": "func (s *Server) createNewAccount(ctx context.Context, icmd interface{}) (interface{}, error) {\n\tcmd := icmd.(*types.CreateNewAccountCmd)\n\tw, ok := s.walletLoader.LoadedWallet()\n\tif !ok {\n\t\treturn nil, errUnloadedWallet\n\t}\n\n\t// The wildcard * is reserved by the rpc server with the special meaning\n\t// of \"all accounts\", so disallow naming accounts to this string.\n\tif cmd.Account == \"*\" {\n\t\treturn nil, errReservedAccountName\n\t}\n\n\t_, err := w.NextAccount(ctx, cmd.Account)\n\tif err != nil {\n\t\tif errors.Is(err, errors.Locked) {\n\t\t\treturn nil, rpcErrorf(dcrjson.ErrRPCWalletUnlockNeeded, \"creating new accounts requires an unlocked wallet\")\n\t\t}\n\t\treturn nil, err\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "cbc0e6238bd22b614792f6eff716c02d", "score": "0.5960828", "text": "func NewAccount(accID uint64, pubkey []byte, path string, nodeType uint64) (*Account, error) {\n\tnewAccount := &Account{\n\t\tAccountID: accID,\n\t\tPublicKey: pubkey,\n\t\tPath: path,\n\t\tType: nodeType,\n\t}\n\tnewAccount.UpdatePath(newAccount.Path)\n\terr := newAccount.PopulateHash()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn newAccount, nil\n}", "title": "" }, { "docid": "298f512c7ca9732128c111b5dbdc7368", "score": "0.5887026", "text": "func NewAccount(server *Server, conn *connection) *Account {\n\treturn &Account{\n\t\tID: utils.UUID(),\n\t\tconn: conn,\n\t\tserver: server,\n\t\tIn: make(chan string, 1024),\n\t\tOut: make(chan string, 1024),\n\t\tName: \"Unknown\",\n\t}\n}", "title": "" }, { "docid": "209194eb922c5b4403b328249c9f75cc", "score": "0.5880666", "text": "func (r *accountRepositoryImplement) FindNewID() string {\n\tid, err := uuid.NewUUID()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult := r.db.Where(&Account{ID: id.String()}).First(&Account{})\n\tif result.Error != nil && result.Error.Error() != \"record not found\" {\n\t\tpanic(result.Error)\n\t}\n\n\tif result.RowsAffected != 0 {\n\t\treturn r.FindNewID()\n\t}\n\n\treturn id.String()\n}", "title": "" }, { "docid": "57c04d48f52331cb2afe68ad831c4121", "score": "0.5806671", "text": "func NewAccount(bank *Bank, ownerName, number string) (*Account, error) {\n\taccount := Account{\n\t\tOwnerName: ownerName,\n\t\tBank: bank,\n\t\tNumber: number,\n\t}\n\n\taccount.ID = uuid.NewV4().String()\n\taccount.CreatedAt = time.Now()\n\n\terr := account.isValid()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &account, nil\n}", "title": "" }, { "docid": "fe7edc6643261dd2bbea749e21358bec", "score": "0.57574135", "text": "func NewAccountFromEncodedID(encodedID int64) (Account, error) {\n\tentityId, err := entityid.Decode(encodedID)\n\tif err != nil {\n\t\treturn Account{}, err\n\t}\n\n\treturn Account{entityId}, err\n}", "title": "" }, { "docid": "2a9755b06a65319fe1e3eb54bf8bcabc", "score": "0.5737064", "text": "func NewAccount(config *types.Config, accountID string) *Account {\n\treturn &Account{\n\t\tconfig: config,\n\t\taccountID: accountID,\n\t}\n}", "title": "" }, { "docid": "4290458518d55e855516ddce162e85cc", "score": "0.56447476", "text": "func CreateAccount(w http.ResponseWriter, r *http.Request) {\n\tvar newAccount Account\n\tjson.NewDecoder(r.Body).Decode(&newAccount)\n\tcheckCPF := FindAccountByCpf(newAccount.Cpf)\n\tif (checkCPF != Account{}) {\n\t\tw.WriteHeader(400)\n\t\tw.Write([]byte(\"CPF is already used\"))\n\t\treturn\n\t}\n\tnewAccount.CreatedAt = time.Now()\n\tid := len(Accounts)\n\tnewAccount.ID = id\n\thash, err := HashPassword(newAccount.Secret)\n\tif err != nil {\n\t\tw.WriteHeader(400)\n\t\tw.Write([]byte(\"Account could not be created. \"))\n\t\treturn\n\t}\n\tnewAccount.Secret = hash\n\tAccounts = append(Accounts, newAccount)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(Accounts)\n}", "title": "" }, { "docid": "db0956f70bf9dcfecc0599308753c03b", "score": "0.5638081", "text": "func NewAccount(c *Client) *Account {\n\treturn &Account{\n\t\tclient: c,\n\t}\n}", "title": "" }, { "docid": "b514c3e23f4a6e741c02291fd968c350", "score": "0.56294596", "text": "func NewAccount(ch core.Chain) *Account {\n\tacc := new(Account)\n\tacc.Label = \"Primary\"\n\tacc.Algo = \"pass:enc\"\n\tacc.Brain = false\n\tacc.Network = ch\n\n\treturn acc\n}", "title": "" }, { "docid": "272ee362c5b3e1ce1a85c822e3845231", "score": "0.562558", "text": "func NewAccount(addr []byte) *Account {\n\treturn &Account{\n\t\tAddress: addr,\n\t}\n}", "title": "" }, { "docid": "fdd7d0c9e49637a573afb203ea6e894e", "score": "0.56199276", "text": "func Get(name string) (*Account, error) {\n\tif a, ok := get(name); ok {\n\t\treturn a, nil\n\t}\n\treturn create(name)\n}", "title": "" }, { "docid": "fbc63d1b8d0abed844f5c68c6673efb4", "score": "0.5610917", "text": "func (wlt *Manager) NewAccount(passphrase string) (string, error) {\n\tprivateKey, _, err := crypto.NewKeyPair()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn wlt.NewAccountWithPrivKey(privateKey, passphrase)\n}", "title": "" }, { "docid": "51d61d8092a2be5b46e51268a6a64a06", "score": "0.55850106", "text": "func (gt *GoTezos) newAccountService() *AccountService {\n\treturn &AccountService{gt: gt}\n}", "title": "" }, { "docid": "e4a0f5f0ce6b96a9dab6728bed255f96", "score": "0.5582019", "text": "func (s *AccountsService) Create(ctx context.Context, account *Account) (*Account, *http.Response, error) {\n\tdata := &createAccountsAPIPayload{Data: *account}\n\n\tres, err := s.client.MakeRequest(ctx, MakeRequestOptions{\n\t\tMethod: \"POST\",\n\t\tPath: accountsPath,\n\t\tBody: data,\n\t})\n\tif err != nil {\n\t\treturn nil, res, err\n\t}\n\n\tvar ret fetchAccountAPIResponse\n\tif err := s.client.Decode(res, &ret); err != nil {\n\t\treturn nil, res, err\n\t}\n\n\treturn &ret.Data, res, nil\n}", "title": "" }, { "docid": "2b774f13fb2b9089cb7d5098e2a95cb2", "score": "0.55432653", "text": "func CreateAccount(w http.ResponseWriter, r *http.Request) {\n\n\t// Marshal the request JSON into a CreateRequest object\n\trequest := &CreateRequest{}\n\tvar err error\n\tdecoder := json.NewDecoder(r.Body)\n\terr = decoder.Decode(&request)\n\n\tif err != nil {\n\t\tresponse.WriteAPIErrorResponse(w, http.StatusBadRequest, \"ClientError\", \"invalid request parameters\")\n\t\treturn\n\t}\n\n\t// Set default metadata={}\n\tif request.Metadata == nil {\n\t\trequest.Metadata = map[string]interface{}{}\n\t}\n\n\t// Validate the request body\n\tisValid, validationRes := request.Validate()\n\tif !isValid {\n\t\tresponse.WriteAPIErrorResponse(w, http.StatusBadRequest, \"ClientError\", *validationRes)\n\t\treturn\n\t}\n\n\t// Check if the account already exists\n\texistingAccount, err := Dao.GetAccount(request.ID)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to add account %s to pool: %s\",\n\t\t\trequest.ID, err.Error())\n\t\tresponse.WriteAPIErrorResponse(w, http.StatusInternalServerError, \"ServerError\", \"\")\n\t\treturn\n\t}\n\tif existingAccount != nil {\n\t\tresponse.WriteAlreadyExistsError(w)\n\t\treturn\n\t}\n\n\t// Verify that we can assume role in the account,\n\t// using the `adminRoleArn`\n\t_, err = TokenSvc.AssumeRole(&sts.AssumeRoleInput{\n\t\tRoleArn: aws.String(request.AdminRoleArn),\n\t\tRoleSessionName: aws.String(\"MasterAssumeRoleVerification\"),\n\t})\n\n\tif err != nil {\n\t\tresponse.WriteRequestValidationError(\n\t\t\tw,\n\t\t\tfmt.Sprintf(\"Unable to add account %s to pool: adminRole is not assumable by the master account\", request.ID),\n\t\t)\n\t\treturn\n\t}\n\n\t// Prepare the account record\n\tnow := time.Now().Unix()\n\taccount := db.Account{\n\t\tID: request.ID,\n\t\tAccountStatus: db.NotReady,\n\t\tLastModifiedOn: now,\n\t\tCreatedOn: now,\n\t\tAdminRoleArn: request.AdminRoleArn,\n\t\tMetadata: request.Metadata,\n\t}\n\n\t// Create an IAM Role for the principal (end-user) to login to\n\tmasterAccountID := *CurrentAccountID\n\tcreateRolRes, policyHash, err := createPrincipalRole(account, masterAccountID)\n\tif err != nil {\n\t\tlog.Printf(\"failed to create principal role for %s: %s\", request.ID, err)\n\t\tresponse.WriteServerErrorWithResponse(w, \"Internal server error\")\n\t\treturn\n\t}\n\taccount.PrincipalRoleArn = createRolRes.RoleArn\n\taccount.PrincipalPolicyHash = policyHash\n\n\t// Write the Account to the DB\n\terr = Dao.PutAccount(account)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to add account %s to pool: %s\",\n\t\t\trequest.ID, err.Error())\n\t\tresponse.WriteServerErrorWithResponse(w, \"Internal server error\")\n\t\treturn\n\t}\n\n\t// Add Account to Reset Queue\n\terr = Queue.SendMessage(&resetQueueURL, &account.ID)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to add account %s to reset Queue: %s\", account.ID, err)\n\t\tresponse.WriteServerErrorWithResponse(w, \"Internal server error\")\n\t\treturn\n\t}\n\n\t// Publish the Account to an \"account-created\" topic\n\taccountResponse := response.AccountResponse(account)\n\tsnsMessage, err := common.PrepareSNSMessageJSON(accountResponse)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to create SNS account-created message for %s: %s\", account.ID, err)\n\t\tresponse.WriteServerErrorWithResponse(w, \"Internal server error\")\n\t\treturn\n\t}\n\n\t// TODO: Initialize these in a better spot.\n\n\t_, err = SnsSvc.PublishMessage(&accountCreatedTopicArn, &snsMessage, true)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to publish SNS account-created message for %s: %s\", account.ID, err)\n\t\tresponse.WriteServerErrorWithResponse(w, \"Internal server error\")\n\t\treturn\n\t}\n\n\taccountResponseJSON, err := json.Marshal(accountResponse)\n\tif err != nil {\n\t\tlog.Printf(\"ERROR: Failed to marshal account response for %s: %s\", account.ID, err)\n\t\tresponse.WriteServerErrorWithResponse(w, \"Internal server error\")\n\t\treturn\n\t}\n\n\tresponse.WriteAPIResponse(\n\t\tw,\n\t\thttp.StatusCreated,\n\t\tstring(accountResponseJSON),\n\t)\n}", "title": "" }, { "docid": "e8e6e368326c3c9c134ed6efb74a3484", "score": "0.5477154", "text": "func NewAccount(tokenName string, balance bn.Number) sdk.IAccount {\n\tvar acct sdk.IAccount\n\tbcbgls.Mgr.SetValues(bcbgls.Values{bcbgls.SDKKey: UTP.ISmartContract}, func() {\n\t\taddr := CalcAddressFromPubKey(newRandPubKey())\n\t\tUTP.accountList = append(UTP.accountList, addr)\n\n\t\tif balance.IsGreaterThanI(0) {\n\t\t\tTransfer(nil, addr, tokenName, balance)\n\t\t}\n\n\t\tacct = object.NewAccount(UTP.ISmartContract, addr)\n\t})\n\n\treturn acct\n}", "title": "" }, { "docid": "f67a9488bb7125fa184f72ed34770c5c", "score": "0.54759246", "text": "func (register *Register) createNewAccount(details map[string]interface{}) error {\n\tvar name, unsafePassword, hashedPassword, email, isAdministrator string\n\n\tisAdministrator = \"false\"\n\tname = details[\"name\"].(string)\n\tunsafePassword = details[\"password\"].(string)\n\temail = details[\"email\"].(string)\n\thashedPassword = register.getHashedPassword(unsafePassword)\n\n\tfieldList := \"`name`, `password`, `email`, `administrator`\"\n\tquestionList := \"?, ?, ?, ?\"\n\tsql := \"INSERT INTO `account` (\" + fieldList + \") VALUES (\" + questionList + \")\"\n\tquery, err := database.Connection.Prepare(sql)\n\tquery.Exec(name, hashedPassword, email, isAdministrator)\n\treturn err\n}", "title": "" }, { "docid": "c959470de17823c695569e24de67d8cd", "score": "0.54747045", "text": "func New() ID {\n\treturn NewWithTime(time.Now())\n}", "title": "" }, { "docid": "00708124599d05b3881e483d9acca69d", "score": "0.545729", "text": "func RegisterNewAccount(w http.ResponseWriter, r *http.Request) {\n\tsetupCorsResponse(&w, r)\n\t//Creates a struct used to store data decoded from the body\n\tuser := struct {\n\t\tName string `json: \"Name\"`\n\t\tLastName string `json: \"LastName\"`\n\t\tEmail string `json: \"Email\"`\n\t\tPassword string `json: \"Password\"`\n\t\tRepeatPassword string `json: \"RepeatPassword\"`\n\t\tUsername string `json: \"Username\"`\n\t\tDateOfBirth string `json: \"DateOfBirth\"`\n\t\tAddress string `json: \"Address\"`\n\t\tPostalCode string `json: \"PostalCode\"`\n\t\tRole int `json: \"Role\"`\n\t}{\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", 0}\n\n\terr := json.NewDecoder(r.Body).Decode(&user)\n\n\tres, err := PerformUserDataChecks(user.Email, user.Password, user.RepeatPassword)\n\n\tw.WriteHeader(res)\n\n\tif err != nil {\n\t\tJSONResponse(struct{}{}, w)\n\t\treturn\n\t}\n\n\tsalt := GenerateSalt()\n\thashedPassword := GenerateSecurePassword(user.Password, salt)\n\n\tnewUser := User{\n\t\tName: user.Name,\n\t\tLastName: user.LastName,\n\t\tEmail: user.Email,\n\t\tPassword: hashedPassword,\n\t\tUsername: user.Username,\n\t\tDateOfBirth: user.DateOfBirth,\n\t\tAddress: user.Address,\n\t\tPostalCode: user.PostalCode,\n\t\tRole: user.Role,\n\t\tSalt: salt,\n\t}\n\tdb.Debug().Create(&newUser)\n\tdb.Save(&newUser)\n\n\tJSONResponse(struct{}{}, w)\n\treturn\n}", "title": "" }, { "docid": "67812dd303fe0d394f44950e517ae563", "score": "0.54537934", "text": "func NewAccount(service *goa.Service, db *store.DB) *AccountController {\n\treturn &AccountController{\n\t\tController: service.NewController(\"Account\"),\n\t\tdb: db,\n\t}\n}", "title": "" }, { "docid": "a7481b6d13337239b135b7636c0d8cdb", "score": "0.54524845", "text": "func (c *Client) newId() ObjectId {\n\tret := c.nextId\n\tc.nextId++\n\treturn ObjectId(ret)\n}", "title": "" }, { "docid": "217d32a81283a3ad4b6988c2a89a6d63", "score": "0.54341185", "text": "func (c *AccountClient) Get(ctx context.Context, id uuid.UUID) (*Account, error) {\n\treturn c.Query().Where(account.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "db09ea606195f558661a88816216d3db", "score": "0.542151", "text": "func (b *Bot) New(c NewRequest) (string,error) {\n d,err := b.doPost(\"/bot\", c)\n if err != nil {\n return \"\", err\n }\n\n nr := &NewResponse{}\n json.Unmarshal(d, nr)\n\n return nr.ID, nil\n}", "title": "" }, { "docid": "225426449f50f7ced8c5b79dfed962eb", "score": "0.54142046", "text": "func NewFromID(id int) (Athlete, error) {\n\tfor _, a := range athletes {\n\t\tif a.ID == id {\n\t\t\treturn a, nil\n\t\t}\n\t}\n\treturn Athlete{}, errors.New(\"Not found\")\n}", "title": "" }, { "docid": "a7616a6e74225941b9f44e72ca4a7616", "score": "0.54122996", "text": "func (e *AccountService) Create(name string, account *Account) (*Account, *Response, error) {\n\tif account == nil {\n\t\taccount = &Account{}\n\t}\n\taccount.Name = name\n\tendpoint := \"/data/account\"\n\tresp, err := e.client.postRequestDecode(endpoint, account)\n\treturn account, resp, err\n}", "title": "" }, { "docid": "36526adc77865273eecb71ecea8153cf", "score": "0.5406057", "text": "func (e *AccountService) Get(id int) (*Account, *Response, error) {\n\tendpoint := fmt.Sprintf(\"/data/account/%d?depth=complete\", id)\n\taccount := &Account{}\n\tresp, err := e.client.getRequestDecode(endpoint, account)\n\treturn account, resp, err\n}", "title": "" }, { "docid": "65746aa4a7c042e0271d5d03b3666021", "score": "0.5400507", "text": "func (s Provider_account_Results) NewAccount() (Account, error) {\n\tss, err := NewAccount(s.Struct.Segment())\n\tif err != nil {\n\t\treturn Account{}, err\n\t}\n\terr = s.Struct.SetPtr(0, ss.Struct.ToPtr())\n\treturn ss, err\n}", "title": "" }, { "docid": "d18671e9042d542182b0d9a2148c36ed", "score": "0.5389517", "text": "func New(filename string) AccountService {\n\tdb := newInMemoryDb(filename)\n\treturn AccountService{db}\n}", "title": "" }, { "docid": "be96822a0b4e08d7219f69a6e7a11655", "score": "0.53874475", "text": "func (c *AccountHttpClient) Create(acc *form3.Account) (*form3.Account, error) {\n\terr := form3.NewAccount(acc)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t_, err = acc.Validate()\n\n\tif err != nil {\n\t\tlog.Errorf(\"can not create a new account %s\", err.Error())\n\t\treturn nil, ErrorAccountIsInvalid\n\t}\n\n\trequest := &form3.ClientBody{Account: acc}\n\n\tjsonRequest, err := json.Marshal(request)\n\n\tif err != nil {\n\t\tlog.Error(\"Can not marshal JSON\")\n\t\treturn nil, ErrorCanNotMarshalJsonForCreateRequest\n\t}\n\n\tlog.Debugf(\"Create Request %s\", string(jsonRequest))\n\tr := bytes.NewReader(jsonRequest)\n\tres, err := c.HttpClient.Post(c.BaseURL+c.EndPoint, r, nil)\n\tif err != nil {\n\t\tlog.Errorf(\"can not create account %s\", err.Error())\n\t\treturn nil, err\n\t}\n\tif res.StatusCode == 201 {\n\t\tbody, err := ioutil.ReadAll(res.Body)\n\t\tdefer res.Body.Close()\n\t\tif err != nil {\n\t\t\tlog.Error(ErrorReadingCreateResponseBosy.Error())\n\t\t\treturn nil, ErrorReadingCreateResponseBosy\n\t\t}\n\t\tlog.Debugf(\"Response Code %d\", res.StatusCode)\n\t\tobj := &form3.ClientBody{}\n\t\terr = json.Unmarshal(body, obj)\n\t\tif err != nil || obj.Account == nil {\n\t\t\tlog.Error(ErrorUnmarshallingCreateResponseToAccountStruct.Error())\n\t\t\treturn nil, ErrorUnmarshallingCreateResponseToAccountStruct\n\t\t}\n\n\t\treturn obj.Account, nil\n\t}\n\n\t// If status code is not 201\n\tbody, err := ioutil.ReadAll(res.Body)\n\tdefer res.Body.Close()\n\tlog.Debugf(\"Response Code %d\", res.StatusCode)\n\tobj := &form3.ErrorResponse{}\n\terr = json.Unmarshal(body, obj)\n\tif err != nil || obj.Message == \"\" {\n\t\tlog.Error(ErrorUnmarshallingCreateErrorResponse.Error())\n\t\treturn nil, ErrorUnmarshallingCreateErrorResponse\n\t}\n\n\treturn nil, errors.New(fmt.Sprintf(\"can not create a new account %s\", obj.Message))\n}", "title": "" }, { "docid": "7d38dc9b3bb94f3f0f80364a44c4b486", "score": "0.538179", "text": "func NewAccount(accounts []models.Account) *Account {\n\tif accounts == nil {\n\t\taccounts = make([]models.Account, 0)\n\t}\n\n\treturn &Account{accounts: accounts}\n}", "title": "" }, { "docid": "8451e95787f9d4c99192c45e0e533f7c", "score": "0.53788525", "text": "func NewAccount() (*Account, error) {\n\tpriKey, pubKey, _ := crypto.GenerateKeyPair()\n\tsignatureContract, err := contract.CreateStandardContract(pubKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprogramHash := signatureContract.ToProgramHash()\n\taddress, err := programHash.ToAddress()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Account{\n\t\tPrivateKey: priKey,\n\t\tPublicKey: pubKey,\n\t\tProgramHash: *programHash,\n\t\tRedeemScript: signatureContract.Code,\n\t\tAddress: address,\n\t}, nil\n}", "title": "" }, { "docid": "b545c3603e5a5381cb7ed0c6f3da4e60", "score": "0.5372996", "text": "func NewAccount(ctx *pulumi.Context,\n\tname string, args *AccountArgs, opts ...pulumi.ResourceOption) (*Account, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ResourceGroupName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ResourceGroupName'\")\n\t}\n\tif args.PublicNetworkAccess == nil {\n\t\targs.PublicNetworkAccess = pulumi.StringPtr(\"Enabled\")\n\t}\n\taliases := pulumi.Aliases([]pulumi.Alias{\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:purview/v20201201preview:Account\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:purview:Account\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:purview:Account\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:purview/v20210701:Account\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:purview/v20210701:Account\"),\n\t\t},\n\t})\n\topts = append(opts, aliases)\n\tvar resource Account\n\terr := ctx.RegisterResource(\"azure-native:purview/v20201201preview:Account\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "a2d18313f772950b1bfdff1ce4078c6d", "score": "0.537135", "text": "func (s *AccountService) CreateAccount(id string, name string, startingBalance AnyCurrency) Account {\n\tID := ID(id)\n\tac := Account{ID, name, startingBalance.GetMoney()}\n\ts.db.Create(ac)\n\treturn ac\n}", "title": "" }, { "docid": "aaa4b362803966573ce53977936f6646", "score": "0.5366876", "text": "func TestCreateAccount(t *testing.T) {\n\tacc := randomAccount()\n\tresult, err := client.Create(*acc)\n\n\tassert.Nil(t, err)\n\tassert.Equal(t, acc.ID, result.ID)\n\tassert.Equal(t, acc.OrganisationID, result.OrganisationID)\n\tassert.Equal(t, acc.Attributes.BankID, result.Attributes.BankID)\n\tassert.Equal(t, acc.Attributes.BankIDCode, result.Attributes.BankIDCode)\n\tassert.Equal(t, acc.Attributes.BaseCurrency, result.Attributes.BaseCurrency)\n\tassert.Equal(t, acc.Attributes.Bic, result.Attributes.Bic)\n\tassert.Equal(t, acc.Attributes.Country, result.Attributes.Country)\n\n\t_ = client.Delete(acc.ID, 0)\n}", "title": "" }, { "docid": "903ae9543ee45124f85850abe9688202", "score": "0.536534", "text": "func ExampleNewAccount() {\n\tnewAccount, err := account.NewAccount(account.DefaultSettings())\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif err := newAccount.Start(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "98f89f9e08bdfa7c2a46da5f28368b08", "score": "0.534855", "text": "func (cs *CredentialStore) Create(id, typ string) (*Token, error) {\n\tif !validIDRegexp.MatchString(id) {\n\t\treturn nil, errors.WithDetailf(ErrBadID, \"invalid id %q\", id)\n\t}\n\n\tkey := []byte(id)\n\tif cs.DB.Get(key) != nil {\n\t\treturn nil, errors.WithDetailf(ErrDuplicateID, \"id %q already in use\", id)\n\t}\n\n\tsecret := make([]byte, tokenSize)\n\tif _, err := rand.Read(secret); err != nil {\n\t\treturn nil, err\n\t}\n\n\thashedSecret := make([]byte, tokenSize)\n\tsha3pool.Sum256(hashedSecret, secret)\n\n\ttoken := &Token{\n\t\tID: id,\n\t\tToken: fmt.Sprintf(\"%s:%x\", id, hashedSecret),\n\t\tType: typ,\n\t\tCreated: time.Now(),\n\t}\n\n\tvalue, err := json.Marshal(token)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcs.DB.Set(key, value)\n\n\treturn token, nil\n}", "title": "" }, { "docid": "37864f2a9342f50a35870468056b40fa", "score": "0.5340541", "text": "func (r *repositoryORM) Create(newAccount model.Account) (model.Account, error) {\n\tnewAccount.ID = guid.NewGUID()\n\ttx := r.db.Create(&newAccount)\n\tif tx.Error != nil {\n\t\tif strings.Contains(tx.Error.Error(), \"Duplicate entry\") && strings.Contains(tx.Error.Error(), \"accounts.cpf\") {\n\t\t\treturn model.EmptyAccount, customerror.ErrorCPFDuplicated\n\t\t}\n\t\treturn model.EmptyAccount, tx.Error\n\t}\n\treturn newAccount, nil\n}", "title": "" }, { "docid": "b20208d7a901c8c3550198a83e279ee4", "score": "0.53280574", "text": "func (b *AccountController) Create(c *app.CreateAccountContext) error {\n\taccount := b.db.NewAccount()\n\tpayload := c.Payload\n\taccount.Name = payload.Name\n\taccount.CreatedAt = time.Now()\n\tb.db.SaveAccount(account)\n\tc.ResponseData.Header().Set(\"Location\", app.AccountHref(account.ID))\n\treturn c.Created()\n}", "title": "" }, { "docid": "7eb1b009c7da235358cefeb7091c02d1", "score": "0.5320564", "text": "func NewAccount(AccType int) *Account {\n\ta := new(Account)\n\ta.AccountType = AccType\n\ta.CURRENT = 0\n\ta.SAVINGS = 1\n\ta.BUSINESS = 2\n\treturn a\n}", "title": "" }, { "docid": "1a10a02a698f320626a923460755cef1", "score": "0.5305872", "text": "func newAppAccount(pub crypto.PubKey, cash sdk.Coins, creator sdk.Address, typ string,\n\tisActive bool, isAdmin bool, entityName, entityType string) *AppAccount {\n\tbaseaccount := auth.BaseAccount{\n\t\tAddress: pub.Address(),\n\t\tPubKey: pub,\n\t\tCoins: cash,\n\t}\n\tentity := BaseLegalEntity{\n\t\tEntityName: entityName,\n\t\tEntityType: entityType,\n\t}\n\treturn &AppAccount{\n\t\tBaseAccount: baseaccount,\n\t\tBaseLegalEntity: entity,\n\t\tCreator: creator,\n\t\tAccountType: typ,\n\t\tActive: isActive,\n\t\tAdmin: isAdmin,\n\t}\n}", "title": "" }, { "docid": "c343315007de74b984df0e42ea08aabb", "score": "0.5295909", "text": "func (c *Companies) New(company *Company) (companyID string) {\n\tc.mux.Lock()\n\tdefer c.mux.Unlock()\n\tcompanyID = strconv.Itoa(c.lastIndex)\n\tc.lastIndex++\n\tc.cm[companyID] = company\n\treturn\n}", "title": "" }, { "docid": "1c784d6cff0749b369a8fb7428239c2c", "score": "0.5294892", "text": "func New(coint int, db *leveldb.DB) {\n\n\tvar (\n\t\ti int\n\t\tblockchain types.Block\n\t\ttransfer types.Transfer\n\t)\n\n\t// Check if there is a genesis file.\n\tif _, err := os.Stat(\"genesis.json\"); os.IsNotExist(err) {\n\n\t\tvar (\n\t\t\tpassphrase string\n\t\t\taccountsLimit int\n\t\t\tamountsLimit = coint\n\t\t\taccounts []GenesisAccounts\n\t\t)\n\n\t\tlog.Print(\"Enter the number of accounts (1-10):\")\n\n\t\tcount := bufio.NewScanner(os.Stdin)\n\t\tcount.Scan()\n\n\t\taccountsLimit, err := strconv.Atoi(count.Text())\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tif accountsLimit > 10 {\n\t\t\tlog.Fatal(ErrAccountLimit)\n\t\t}\n\n\t\tfor i = 0; accountsLimit > i; i++ {\n\n\t\t\tgenaccount := GenesisAccounts{}\n\n\t\t\t// From account.\n\t\t\tfromMnemonic, err := account.Create()\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\n\t\t\thasher := md5.New()\n\t\t\thasher.Write([]byte(fromMnemonic))\n\t\t\tpassphrase = hex.EncodeToString(hasher.Sum(nil))\n\n\t\t\tfromAccount, err := account.Master(fromMnemonic, passphrase)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\n\t\t\tfromPrivateECDSA, err := common.HexToPrivate(fromAccount.Private())\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\n\t\t\tfromPublicECDSA, err := common.HexToPublic(fromAccount.Public())\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\n\t\t\t// To account.\n\t\t\ttoMnemonic, err := account.Create()\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\n\t\t\ttoAccount, err := account.Master(toMnemonic, passphrase)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\n\t\t\t// Write new account.\n\t\t\tgenaccount.Passphrase = passphrase\n\t\t\tgenaccount.Address = toAccount.Address()\n\t\t\tgenaccount.Private = toAccount.Private()\n\t\t\tgenaccount.Public = toAccount.Public()\n\t\t\tgenaccount.Mnemonic = toMnemonic\n\n\t\t\t// Sender root.\n\t\t\ttransfer.Root = fromAccount.Public()\n\n\t\t\t// Transfer input to account.\n\t\t\ttransfer.Input.To = genaccount.Address\n\t\t\ttransfer.Input.Value = amountsLimit / accountsLimit\n\t\t\ttransfer.Input.Message = \"0x\" + hex.EncodeToString([]byte(\"Genesis account #\"+strconv.Itoa(i)+\" - It was created in Ukraine: \"+time.Now().String()))\n\n\t\t\t// Transfer input to bytes.\n\t\t\ttrx, err := json.Marshal(transfer.Input)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\n\t\t\t// Create new signature.\n\t\t\tsignature, err := common.Sign(fromPrivateECDSA, trx)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t\ttransfer.Signature = signature\n\t\t\ttransfer.Timestamp = time.Now().UTC().Unix()\n\n\t\t\t// Verifycations signature.\n\t\t\tverifycations, err := common.Verify(fromPublicECDSA, trx, signature)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"signature\": signature,\n\t\t\t\t\"verify\": verifycations,\n\t\t\t}).Info(\"Transaction successful\")\n\n\t\t\tblockchain.Transactions, accounts = append(blockchain.Transactions, transfer), append(accounts, genaccount)\n\t\t}\n\n\t\tblockchain.Timestamp, blockchain.Prev = time.Now().UTC().Unix(), block.DefaultPrevHash\n\n\t\tgenerate := block.Components{}\n\t\tblockchain.Current, err = generate.Hash(blockchain, true)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\t// Create new genesis file.\n\t\t_, err = os.Create(\"genesis.json\")\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tmarshalGenesis, err := json.MarshalIndent(&blockchain, \"\", \"\t\")\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\t// Open genesis file.\n\t\topenGenesis, err := os.OpenFile(\"genesis.json\", os.O_WRONLY, 0777)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\t// Write to genesis file.\n\t\t_, err = openGenesis.Write(marshalGenesis)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\t// Create new accounts file.\n\t\t_, err = os.Create(\"accounts.json\")\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tmarshalAccounts, err := json.MarshalIndent(&accounts, \"\", \"\t\")\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\t// Open accounts file.\n\t\topenAccounts, err := os.OpenFile(\"accounts.json\", os.O_WRONLY, 0777)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\t// Write to accounts file.\n\t\t_, err = openAccounts.Write(marshalAccounts)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tlog.Info(\"Generated genesis successful!.\")\n\n\t} else {\n\n\t\tserialize, err := ioutil.ReadFile(\"genesis.json\")\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\t// We unmarshal our byte array which contains our\n\t\t// genesis block content into 'serialize' which we defined above\n\t\tif err = json.Unmarshal(serialize, &blockchain); err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\t// Transfer transactions map to struct.\n\t\tfor _, trx := range blockchain.Transactions {\n\t\t\tif err = mapstructure.Decode(trx, &transfer); err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t\tblockchain.Transactions = append(blockchain.Transactions, transfer)\n\t\t}\n\n\t}\n\n\t// Insert to store.\n\terr := Insert(blockchain, db)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tos.Exit(1)\n\n}", "title": "" }, { "docid": "be989f85d4b2b3e9458ae406b4bd5b27", "score": "0.52936006", "text": "func New() UUID { return NewFromTime(time.Now()) }", "title": "" }, { "docid": "2534a07df3bbd5dcf55227d0be20bf2f", "score": "0.5290943", "text": "func (s *AccountService) Get(ctx context.Context, id string) (Account, *http.Response, error) {\n\taccount := new(Account)\n\n\treq, err := s.client.NewRequest(ctx, http.MethodGet, accountBasePath+\"/\"+id, nil)\n\tif err != nil {\n\t\treturn *account, nil, err\n\t}\n\n\tresp, _, err := s.client.Do(ctx, req, account, false)\n\tif err != nil {\n\t\treturn *account, nil, err\n\t}\n\n\treturn *account, resp, nil\n}", "title": "" }, { "docid": "66e83144edb43bb4e13510327560ab10", "score": "0.5290623", "text": "func PostAccount(ctx iris.Context) {\n\tvar account account.Account\n\tctx.ReadJSON(&account)\n\n\tif err := validator.New().Struct(account); err != nil {\n\t\tctx.JSON(iris.Map{\n\t\t\t\"message\": \"Error :\" + err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\tIDAccount := getLatestAccontID(db)\n\taccount.ID = IDAccount + 1\n\tdb.Create(&account)\n\n\tctx.JSON(iris.Map{\n\t\t\"status\": \"success\",\n\t\t\"ID\": account.ID,\n\t})\n}", "title": "" }, { "docid": "a4b2b7b4d167f1def12f3ebc8fa8d633", "score": "0.5285379", "text": "func NewAccount(AccountId string, Name *Name, Email string, EmailVerified bool, Disabled bool) *Account {\n\ts := new(Account)\n\ts.AccountId = AccountId\n\ts.Name = Name\n\ts.Email = Email\n\ts.EmailVerified = EmailVerified\n\ts.Disabled = Disabled\n\treturn s\n}", "title": "" }, { "docid": "a1e201f2ffcbf992387386b7dc5a2b3c", "score": "0.5282635", "text": "func ContractNewAccount(creator string, accountName string, ownerKey string, activeKey string, recoveryKey string) (*model.Transaction, *errors.AppError) {\n\n\tif activeKey == \"\" {\n\t\tactiveKey = ownerKey\n\t}\n\n\tif recoveryKey == \"\" {\n\t\trecoveryKey = ownerKey\n\t}\n\n\tauth := model.Authorization{\n\t\tcommon.Config.NODE_PRODUCER_NAME,\n\t\t\"active\",\n\t}\n\n\townerAuthority := model.NewAuthority(ownerKey, 1)\n\tactiveAuthority := model.NewAuthority(activeKey, 1)\n\trecoveryAuthority := model.NewAuthority(recoveryKey, 1)\n\n\taction := model.Action{\n\t\tcommon.Config.NODE_PRODUCER_NAME,\n\t\tcommon.Config.NODE_PRODUCER_NAME,\n\t\t\"newaccount\",\n\t\t[]string{common.Config.NODE_PRODUCER_NAME, creator},\n\t\t[]model.Authorization{auth},\n\t\t\"\",\n\t\tmap[string]interface{}{\n\t\t\t\"creator\": creator,\n\t\t\t\"name\": accountName,\n\t\t\t\"owner\": ownerAuthority,\n\t\t\t\"active\": activeAuthority,\n\t\t\t\"recovery\": recoveryAuthority,\n\t\t},\n\t}\n\n\ttrx := model.Transaction{\n\t\t0,\n\t\t0,\n\t\t0,\n\t\t\"\",\n\t\t[]string{},\n\t\t[]string{},\n\t\t[]model.Action{action},\n\t\t[]string{},\n\t\t[]model.Authorization{auth},\n\t\t\"\",\n\t\t0,\n\t\t0,\n\t\t0,\n\t\t\"\",\n\t\t\"none\",\n\t\t[]map[string]interface{}{},\n\t\t0,\n\t\t0,\n\t\t[]model.Action{},\n\t}\n\n\t//right call\n\ttrxPushed, err := ChainPushTransaction(trx, []string{common.Config.NODE_PUB_KEY}, \"\")\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn trxPushed, nil\n}", "title": "" }, { "docid": "33a59f2ca8d4d21fa7ab14ae20749117", "score": "0.52620924", "text": "func NewAccount(\n\tconfig *accounts.AccountConfig,\n\tcoin *Coin,\n\tforceGapLimits *types.GapLimits,\n\tlog *logrus.Entry,\n) *Account {\n\tlog = log.WithField(\"group\", \"btc\").\n\t\tWithFields(logrus.Fields{\"coin\": coin.String(), \"code\": config.Config.Code, \"name\": config.Config.Name})\n\tlog.Debug(\"Creating new account\")\n\n\taccount := &Account{\n\t\tBaseAccount: accounts.NewBaseAccount(config, coin, log),\n\t\tcoin: coin,\n\t\tdbSubfolder: \"\", // set in Initialize()\n\t\tforceGapLimits: forceGapLimits,\n\n\t\t// feeTargets must be sorted by ascending priority.\n\t\tfeeTargets: []*FeeTarget{\n\t\t\t{blocks: 24, code: accounts.FeeTargetCodeEconomy},\n\t\t\t{blocks: 12, code: accounts.FeeTargetCodeLow},\n\t\t\t{blocks: 6, code: accounts.FeeTargetCodeNormal},\n\t\t\t{blocks: 2, code: accounts.FeeTargetCodeHigh},\n\t\t},\n\t\tlog: log,\n\t}\n\treturn account\n}", "title": "" }, { "docid": "513f4076713983be0a625e8232586fd4", "score": "0.52593726", "text": "func (lvm *LEVM) NewAccount(addr common.Address, balance *big.Int) {\n\tlvm.stateDB.GetOrNewStateObject(addr)\n\tlvm.stateDB.SetBalance(addr, balance)\n}", "title": "" }, { "docid": "3c7f45dba87f316052341e87549eff92", "score": "0.52546746", "text": "func NewCard(w http.ResponseWriter, r *http.Request) {\n\tsession, _ := store.Get(r, \"session\")\n\tqueryValues := r.URL.Query()\n\n\tUserID, _ := session.Values[\"userID\"].(string)\n\n\tuser := models.NewUser()\n\tuser.ID = UserID\n\tuser.GetByID()\n\n\tval, ok := queryValues[\"register\"]\n\n\tif !ok {\n\t\tpanic(\"missing register in url !\")\n\t}\n\n\tregisterID := val[0]\n\tregister := models.NewRegister()\n\tregister.ID = registerID\n\tregister.GetByID()\n\n\tid := xid.New()\n\tnewCard := models.Card{ID: id.String()}\n\tregister.Cards = append(register.Cards, newCard)\n\tregister.Update()\n\n\turl := fmt.Sprintf(\"/edit-register?register=%s&card=%s\", register.ID, id)\n\thttp.Redirect(w, r, url, http.StatusFound)\n}", "title": "" }, { "docid": "12fe657b59a248b3c39dfa516af908a8", "score": "0.5254502", "text": "func newAccountPool() *accountPool {\n\treturn &accountPool{\n\t\taccountsByID: make(map[string]*Account),\n\t\tmutex: &sync.Mutex{},\n\t}\n}", "title": "" }, { "docid": "d8f82d2409387e70747481f643928cc3", "score": "0.52538294", "text": "func NewAccount(portfolio map[Asset]decimal.Decimal) (Account, error) {\n\tif len(globalPricelist) == 0 {\n\t\treturn Account{}, ErrEmptyPricelist\n\t}\n\tportfolio, err := NewPortfolio(portfolio)\n\tif err != nil {\n\t\treturn Account{}, err\n\t}\n\ttotalValue := decimal.Zero\n\tfor asset, amount := range portfolio {\n\t\ttotalValue = totalValue.Add(globalPricelist[asset].Mul(amount))\n\t}\n\treturn Account{portfolio: portfolio, value: totalValue}, nil\n}", "title": "" }, { "docid": "76d8a7249aed4c88a70196f93f78d19f", "score": "0.52367514", "text": "func NewAccount(ctx *pulumi.Context,\n\tname string, args *AccountArgs, opts ...pulumi.ResourceOption) (*Account, error) {\n\tif args == nil {\n\t\targs = &AccountArgs{}\n\t}\n\n\tvar resource Account\n\terr := ctx.RegisterResource(\"aws:macie2/account:Account\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "872c2abafba364bf9b4c175c56180388", "score": "0.5220884", "text": "func AskNewAccount(db *sql.DB) {\n\tvar unapprovedAccounts []AccountHolder\n\tunapprovedAccounts = ReadFile()\n\tvar username string\n\tvar pass string\n\tvar fname string\n\tvar lname string\n\tvar bal float64\n\tvar types string\n\tfmt.Println(\"Enter your username: \")\n\tfmt.Scan(&username)\n\tvar usernameHolder []string\n\trows, _ := db.Query(\"SELECT username FROM users\")\n\tfor rows.Next() {\n\t\tvar uN string\n\t\trows.Scan(&uN)\n\t\tusernameHolder = append(usernameHolder, uN)\n\t}\n\tvar continu bool = true\n\tfor i := range usernameHolder {\n\t\tif usernameHolder[i] == username {\n\t\t\tcontinu = false\n\t\t\tbreak\n\t\t}\n\t}\n\tif continu {\n\t\tfmt.Println(\"Enter your password: \")\n\t\tfmt.Scan(&pass)\n\t\tfmt.Println(\"Enter your First Name: \")\n\t\tfmt.Scan(&fname)\n\t\tfmt.Println(\"Enter your Last Name: \")\n\t\tfmt.Scan(&lname)\n\t\tfmt.Println(\"Enter your Account type \\\"c\\\" for checking \\\"s\\\" for savings: \")\n\t\tfmt.Scan(&types)\n\t\tfmt.Println(\"Enter your Initial deposit: \")\n\t\tfmt.Scan(&bal)\n\t\tunapprovedAccounts = append(unapprovedAccounts, CreateAccountHolder(username, pass, fname, lname, types, bal))\n\t\tWriteToFile(unapprovedAccounts)\n\t} else {\n\t\tprintln(\"Please try again with a different username, entered Username has been taken!\")\n\t\tAskNewAccount(db)\n\t}\n\n}", "title": "" }, { "docid": "d89bbd8a9205dcc9202db886ed3d58bf", "score": "0.5220107", "text": "func (api *SignerAPI) New(ctx context.Context) (common.Address, error) {\n\tbe := api.am.Backends(keystore.KeyStoreType)\n\tif len(be) == 0 {\n\t\treturn common.Address{}, errors.New(\"password based accounts not supported\")\n\t}\n\tif resp, err := api.UI.ApproveNewAccount(&NewAccountRequest{MetadataFromContext(ctx)}); err != nil {\n\t\treturn common.Address{}, err\n\t} else if !resp.Approved {\n\t\treturn common.Address{}, ErrRequestDenied\n\t}\n\n\t// Three retries to get a valid password\n\tfor i := 0; i < 3; i++ {\n\t\tresp, err := api.UI.OnInputRequired(UserInputRequest{\n\t\t\t\"New account password\",\n\t\t\tfmt.Sprintf(\"Please enter a password for the new account to be created (attempt %d of 3)\", i),\n\t\t\ttrue})\n\t\tif err != nil {\n\t\t\tlog.Warn(\"error obtaining password\", \"attempt\", i, \"error\", err)\n\t\t\tcontinue\n\t\t}\n\t\tif pwErr := ValidatePasswordFormat(resp.Text); pwErr != nil {\n\t\t\tapi.UI.ShowError(fmt.Sprintf(\"Account creation attempt #%d failed due to password requirements: %v\", (i + 1), pwErr))\n\t\t} else {\n\t\t\t// No error\n\t\t\tacc, err := be[0].(*keystore.KeyStore).NewAccount(resp.Text)\n\t\t\tlog.Info(\"Your new key was generated\", \"address\", acc.Address)\n\t\t\tlog.Warn(\"Please backup your key file!\", \"path\", acc.URL.Path)\n\t\t\tlog.Warn(\"Please remember your password!\")\n\t\t\treturn acc.Address, err\n\t\t}\n\t}\n\t// Otherwise fail, with generic error message\n\treturn common.Address{}, errors.New(\"account creation failed\")\n}", "title": "" }, { "docid": "fd58946d8e13b0ce749a1dc162043631", "score": "0.52196294", "text": "func (a *AccountAPI) Create(ctx context.Context, emailAddress string) (Account, error) {\n\tvar payload bytes.Buffer\n\twriter := multipart.NewWriter(&payload)\n\n\terr := writer.WriteField(accountFieldEmailAddress, emailAddress)\n\tif err != nil {\n\t\treturn Account{}, err\n\t}\n\n\terr = writer.Close()\n\tif err != nil {\n\t\treturn Account{}, err\n\t}\n\n\tresp, err := a.client.callAPI(\n\t\tctx,\n\t\trequestParam{\n\t\t\tpath: a.client.BaseURL + subURLAccountCreate,\n\t\t\tmethod: http.MethodPost,\n\t\t\twriter: writer,\n\t\t})\n\tif err != nil {\n\t\treturn Account{}, err\n\t}\n\tdefer resp.Body.Close()\n\n\taccount := Account{}\n\terr = json.NewDecoder(resp.Body).Decode(&account)\n\tif err != nil {\n\t\treturn Account{}, err\n\t}\n\n\treturn account, nil\n}", "title": "" }, { "docid": "ae647e954945bde8b1a7cf7960f013f7", "score": "0.5216646", "text": "func GetNewNonce(address common.Address) database.Nonce {\n // Get current nonce\n nonce, err := GetLastNonce(address)\n if err != nil {\n fmt.Printf(\"Nonce error: %s\", err)\n return nonce\n }\n nonce.Number += 1\n // Get database\n db := database.DatabaseConnection()\n db.Model(&nonce).Update(\"Number\", nonce.Number)\n\n return nonce\n}", "title": "" }, { "docid": "e381764947c08ce4f5019c03910d208c", "score": "0.52144146", "text": "func newAccount(cfg *AggregateCfg) (*account, error) {\n\terr := validator.Validate(cfg)\n\tif err != nil {\n\t\treturn nil, errors.New(\"error validating config\")\n\t}\n\tif cfg.WeeklyTxnsAmountLimit > 0 &&\n\t\tcfg.WeeklyTxnsAmountLimit < cfg.DailyTxnsAmountLimit {\n\t\treturn nil, errors.New(\"weekly-amount limit must be greater than daily amount limit\")\n\t}\n\tif cfg.NumWeeklyTxnsLimit > 0 &&\n\t\tcfg.NumWeeklyTxnsLimit < cfg.NumDailyTxnsLimit {\n\t\treturn nil, errors.New(\n\t\t\t\"num of weekly-transactions must be greater than num of daily-transactions\",\n\t\t)\n\t}\n\n\treturn &account{\n\t\tlog: cfg.Log,\n\t\teventRepo: cfg.EventRepo,\n\n\t\taccountDeposited: cfg.AccountDeposited,\n\t\taccountWithdrawn: cfg.AccountWithdrawn,\n\t\tduplicateTxn: cfg.DuplicateTxn,\n\t\taccountLimitExceeded: cfg.AccountLimitExceeded,\n\n\t\tdailyLimits: TxnRecord{\n\t\t\tNumTxns: cfg.NumDailyTxnsLimit,\n\t\t\tTotalAmount: cfg.DailyTxnsAmountLimit,\n\t\t},\n\t\tweeklyLimits: TxnRecord{\n\t\t\tNumTxns: cfg.NumWeeklyTxnsLimit,\n\t\t\tTotalAmount: cfg.WeeklyTxnsAmountLimit,\n\t\t},\n\n\t\tdailyTxn: make(map[int]map[int]TxnRecord),\n\t\tweeklyTxn: make(map[int]map[int]TxnRecord),\n\t\ttxnKeysRecord: make([]string, 0),\n\t}, nil\n}", "title": "" }, { "docid": "bd1f20c4bcf45e91b681948d9c7a3180", "score": "0.52074", "text": "func generateBasicAccount() *data.Account {\n\tid, _ := uuid.NewRandom()\n\ttestCountry := data.NewCountryCode(TestCountry)\n\treturn &data.Account{\n\t\tID: id,\n\t\tOrganisationID: id,\n\t\tAttributes: data.Attributes{\n\t\t\tCountry: testCountry,\n\t\t},\n\t}\n\n}", "title": "" }, { "docid": "253da6102414400d10584ba9eaeb20fa", "score": "0.52056605", "text": "func createAccountHandler(w http.ResponseWriter, r *http.Request) {\n\tvar count int // count of returned rows\n\n\tlog.Print(\"Request received to create an Account\")\n\tjson.NewDecoder(r.Body).Decode(&account) // parse json into 'account' struct\n\n\t// check if account not present\n\trows := db.QueryRow(\"select count(*) from account where id=$1\", account.ID)\n\terr := rows.Scan(&count)\n\tif err != nil {\n\t\tlog.Fatal(\"ERROR: %v \", err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\t// update if present\n\tif count != 0 {\n\t\tlog.Print(\"INFO: account already present, updating...\")\n\t\taccount.updateAccountHandler(w, r)\n\t\treturn\n\t}\n\n\t// db query\n\tinsertStmt, err := db.Prepare(\"INSERT INTO account(id, user_name,first_name, last_name) VALUES($1, $2, $3, $4)\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer insertStmt.Close()\n\n\tres, err := insertStmt.Exec(account.ID, account.UserName, account.FirstName, account.LastName)\n\tif err != nil {\n\t\tlog.Fatal(\"ERROR: %v \", err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\trowCnt, err := res.RowsAffected()\n\tif err != nil {\n\t\tlog.Fatal(\"ERROR: %v \", err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tlog.Printf(\"Successfully added account, affected count = %d\\n\", rowCnt)\n\t// response\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusCreated)\n\tjson.NewEncoder(w).Encode(account)\n}", "title": "" }, { "docid": "6a9e0b8dcce94ac64282d4ea837d9938", "score": "0.52054", "text": "func (w *Wallet) NewAccount() (*Account, error) {\n\treturn w.newAccount()\n}", "title": "" }, { "docid": "51ac18718cc36859c2ab4a66efc44c5f", "score": "0.5181277", "text": "func (client *Client) AccountCreate(creator, newAccountName, password string, fee *types.Asset) (*OperResp, error) {\n\ttype Keys struct {\n\t\tPrivate string\n\t\tPublic string\n\t}\n\n\tvar trx []types.Operation\n\tvar listKeys = make(map[string]Keys)\n\n\tempty := map[string]int64{}\n\troles := [4]string{\"owner\", \"active\", \"posting\", \"memo\"}\n\n\tfor _, val := range roles {\n\t\tpriv := GetPrivateKey(newAccountName, val, password)\n\t\tpub := GetPublicKey(\"STM\", priv)\n\t\t//pub := GetPublicKey(\"TST\", priv)\n\t\tlistKeys[val] = Keys{Private: priv, Public: pub}\n\t}\n\n\towner := types.Authority{\n\t\tWeightThreshold: 1,\n\t\tAccountAuths: empty,\n\t\tKeyAuths: map[string]int64{listKeys[\"owner\"].Public: 1},\n\t}\n\n\tactive := types.Authority{\n\t\tWeightThreshold: 1,\n\t\tAccountAuths: empty,\n\t\tKeyAuths: map[string]int64{listKeys[\"active\"].Public: 1},\n\t}\n\n\tposting := types.Authority{\n\t\tWeightThreshold: 1,\n\t\tAccountAuths: empty,\n\t\tKeyAuths: map[string]int64{listKeys[\"posting\"].Public: 1},\n\t}\n\n\tjsonMeta := &types.AccountMetadata{}\n\n\ttx := &types.AccountCreateOperation{\n\t\tFee: fee,\n\t\tCreator: creator,\n\t\tNewAccountName: newAccountName,\n\t\tOwner: &owner,\n\t\tActive: &active,\n\t\tPosting: &posting,\n\t\tMemoKey: listKeys[\"memo\"].Public,\n\t\tJSONMetadata: jsonMeta,\n\t}\n\n\ttrx = append(trx, tx)\n\tresp, err := client.SendTrx(creator, trx)\n\treturn &OperResp{NameOper: \"AccountCreate\", Bresp: resp}, err\n}", "title": "" }, { "docid": "39f7a662b67131e1157cc10bc7428a95", "score": "0.51776195", "text": "func (c *Client) CreateAccount(account *Account) (*Account, error) {\n\tvar u, err = url.Parse(string(c.Endpoint))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tu.Path = \"/v3/company/\" + c.RealmID + \"/account\"\n\tvar v = url.Values{}\n\tv.Add(\"minorversion\", minorVersion)\n\tu.RawQuery = v.Encode()\n\tvar j []byte\n\tj, err = json.Marshal(account)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar req *http.Request\n\treq, err = http.NewRequest(\"POST\", u.String(), bytes.NewBuffer(j))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Accept\", \"application/json\")\n\tvar res *http.Response\n\tres, err = c.Client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode != http.StatusOK {\n\t\treturn nil, parseFailure(res)\n\t}\n\n\tvar r struct {\n\t\tAccount Account\n\t\tTime Date\n\t}\n\terr = json.NewDecoder(res.Body).Decode(&r)\n\treturn &r.Account, err\n}", "title": "" }, { "docid": "18b1a334eb5c576ca40dcf2cb415d93d", "score": "0.51599526", "text": "func NewAccountController(e *echo.Echo) {\n\thandler := &AccountController{}\n\n\te.GET(\"/accounts/:id\", handler.Show)\n\te.POST(\"/accounts\", handler.Create)\n}", "title": "" }, { "docid": "7dbc1a6ae62bb5e95d592cd1e8845523", "score": "0.51484674", "text": "func NewAccount(name, local, domain, pass string) (acc *Account, err error) {\n\tvar hpass []byte\n\tlocal = strings.ToLower(local)\n\n\tif len(pass) > 0 {\n\t\tfor x := 0; x < 3; x++ {\n\t\t\thpass, err = bcrypt.GenerateFromPassword([]byte(pass), bcrypt.DefaultCost)\n\t\t\tif err == nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"smtp: NewAccount: %s\", err.Error())\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tacc = &Account{\n\t\tMailbox: Mailbox{\n\t\t\tName: name,\n\t\t\tLocal: local,\n\t\t\tDomain: domain,\n\t\t},\n\t\tHashPass: string(hpass),\n\t}\n\n\treturn acc, nil\n}", "title": "" }, { "docid": "1f042aae6ae9a2e981936f23142eb4a8", "score": "0.5131114", "text": "func CreateAccount(account model.Account) model.Account {\n\tDB, err := database.NewOpen()\n\n\tsqlStatement := `INSERT INTO account (Email, Password) VALUES ($1, $2) returning A_ID`\n\n\terr = DB.QueryRow(sqlStatement, account.Email, account.Password).Scan(&account.A_ID)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// DB.Close()\n\treturn account\n}", "title": "" }, { "docid": "996b3ef6dc9aaca751712de4b96508b0", "score": "0.5129359", "text": "func NewAccountController(e *echo.Echo, accountUse usecase.AccountUsecase) {\n\thandler := &AccountController{\n\t\taccountUse: accountUse,\n\t}\n\n\te.GET(\"/accounts/:id\", handler.Get)\n}", "title": "" }, { "docid": "1f61fd0e36c1b48332d090eb741844e3", "score": "0.5123897", "text": "func (p *accountPool) One(id string) (a *Account, err error) {\n\tp.mutex.Lock()\n\tdefer p.mutex.Unlock()\n\tvar ok bool\n\tif a, ok = p.accountsByID[id]; !ok {\n\t\terr = fmt.Errorf(\"Unknown account id %s\", id)\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "dd9109df314b89cb84b39040222434e0", "score": "0.51167077", "text": "func CreateAccount(w http.ResponseWriter, r *http.Request) {\n\trequestBody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tresponses.Error(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tvar account models.Account\n\tif err = json.Unmarshal(requestBody, &account); err != nil {\n\t\tresponses.Error(w, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\n\taccount.Violations = make([]string, 0)\n\tif err = account.AccountValidate(); err != nil {\n\t\tresponses.Error(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\taccountInitialized := utils.AccountAlreadyInitialized()\n\tif !accountInitialized {\n\t\terr = repositories.CreateAccount(account)\n\t\tif err != nil {\n\t\t\tresponses.Error(w, http.StatusInternalServerError, err)\n\t\t\treturn\n\t\t}\n\t\tresponses.JSON(w, http.StatusCreated, account)\n\t\treturn\n\t}\n\n\taccount, err = repositories.GetAccount()\n\taccount.Violations = []string{account.GetAccountViolations(0)}\n\tif err != nil {\n\t\tresponses.Error(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tresponses.JSON(w, http.StatusOK, account)\n}", "title": "" }, { "docid": "89666ecdc07ed9659860575f869286ea", "score": "0.51058155", "text": "func postAccount(w http.ResponseWriter, r *http.Request) {\n\tvar account PostAccountParams\n\tbody, err := ioutil.ReadAll(io.LimitReader(r.Body, maxJSONSize))\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, &account.Account); err != nil {\n\t\tlog.Panic(model.NewrequestError(\"Unprocessable entity\", model.ErrorUnprocessableJSON))\n\t}\n\n\tlastID := facade.AddAccount(model.Account{Status: account.Account.Status})\n\tw.Header().Set(contentTypeHeader, contentTypeJSON)\n\terr = json.NewEncoder(w).Encode(\n\t\tAccountCreatedResponse{\n\t\t\tAccount: struct {\n\t\t\t\tID int64 \"json:\\\"ID\\\"\"\n\t\t\t}{ID: lastID}})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "ce57f23ae0f6d4214f7594821a325560", "score": "0.51049745", "text": "func New(min ID, max ID) *Bank {\n\tif min >= max {\n\t\tmin, max = 0, 0xffffffff\n\t}\n\tb := &Bank{\n\t\tbank: make(map[ID]bankEntry),\n\t\tfreeptr: min,\n\t\tmax: max,\n\t\tcontrol: make(chan controlMessage),\n\t\trnd: rand.New(rand.NewSource(time.Now().UnixNano())),\n\t}\n\t// Start control goroutine. This routine mediates all access to\n\t// the Bank, ensuring operations are concurrency-safe. User API\n\t// functions just send messages here.\n\tgo func() {\n\t\tfor {\n\t\t\tm := <-b.control\n\t\t\tswitch msg := m.(type) {\n\t\t\tcase allocID:\n\t\t\t\tmsg.response <- b.alloc(msg.client, msg.exptime)\n\t\t\tcase queryID:\n\t\t\t\tmsg.response <- b.query(msg.id)\n\t\t\tcase releaseID:\n\t\t\t\tmsg.response <- b.release(msg.id, msg.token)\n\t\t\tcase resetID:\n\t\t\t\tmsg.response <- b.reset(msg.id, msg.exptime, msg.token)\n\t\t\tcase destroyBank:\n\t\t\t\tb.destroy()\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\tpanic(\"control: received unknown message\")\n\t\t\t}\n\t\t}\n\t}()\n\tdebug(\"new: new bank created\")\n\treturn b\n}", "title": "" }, { "docid": "89e67b82c46cdace130b97bb0d65a6a1", "score": "0.5098415", "text": "func NewAccount(homeAccountID, env, realm, localAccountID, authorityType, username string) Account {\n\treturn Account{\n\t\tHomeAccountID: homeAccountID,\n\t\tEnvironment: env,\n\t\tRealm: realm,\n\t\tLocalAccountID: localAccountID,\n\t\tAuthorityType: authorityType,\n\t\tPreferredUsername: username,\n\t}\n}", "title": "" }, { "docid": "6482ae565a309b3d88c5980ce36643bf", "score": "0.50979894", "text": "func (s *usecase) NewAccount(a *account.Account) (*account.Account, error) {\n\tacc, err := s.accountManager.Create(a)\n\t// validate the fields and business rule\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn acc, nil\n}", "title": "" }, { "docid": "206c952953f9cd3d2810fa760b3f7b63", "score": "0.5094411", "text": "func New(workerid uint8, seed uint64) interface{} {\n\tlog.Printf(\"init info:%d,%d\", workerid, seed)\n\tshortid, err := shortid.New(workerid, shortid.DefaultABC, seed)\n\tif err != nil {\n\t\tlog.Println(\"some wrong\", err)\n\t}\n\treturn MyID{\n\t\tShortid: shortid,\n\t}\n}", "title": "" }, { "docid": "60f6adaaa0d2a4645e49a607fc3093fd", "score": "0.5093446", "text": "func NewTxnId() string {\n id := atomic.AddInt64(&strestId, int64(1))\n return fmt.Sprintf(\"%d\", id)\n}", "title": "" }, { "docid": "9948707ea6e815a0eb8cec13cc325788", "score": "0.50933415", "text": "func New(params *stripe.CardParams) (*stripe.Card, error) {\n\treturn getC().New(params)\n}", "title": "" }, { "docid": "2f38f23b1f0392bd36e5fc72e70c8ac8", "score": "0.5074157", "text": "func (db *Database) New(params *NewParams) (*User, error) {\n\t// Create a new user.\n\tuser := &User{\n\t\tFullName: params.FullName,\n\t\tUserName: params.UserName,\n\t\tEmail: params.Email,\n\t\tPassword: params.Password,\n\t\tCreatedAt: params.CreatedAt,\n\t}\n\n\t// Create variable to hold the result.\n\tvar res sql.Result\n\tvar err error\n\n\t// Execute the query.\n\tif res, err = db.db.Exec(stmtInsert, user.FullName, user.UserName, user.Email, user.Password, user.CreatedAt); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get last insert ID.\n\tid, err := res.LastInsertId()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tuser.ID = int(id)\n\n\treturn user, nil\n}", "title": "" }, { "docid": "db56f956adcb5ca3ab1948977a66cca0", "score": "0.5073372", "text": "func get_account(stub shim.ChaincodeStubInterface, id string) (Account, error) {\n\tvar account Account\n\taccountAsBytes, err := stub.GetState(id) //getState retreives a key/value from the ledger\n\tif err != nil { //this seems to always succeed, even if key didn't exist\n\t\treturn account, errors.New(\"Failed to get account - \" + id)\n\t}\n\tjson.Unmarshal(accountAsBytes, &account) //un stringify it aka JSON.parse()\n\n\tif len(account.Type_) == 0 { //test if owner is actually here or just nil\n\t\treturn account, errors.New(\"Account does not exist - \" + id + \", '\" + account.Type_ + \"' '\" )\n\t}\n\t\n\treturn account, nil\n}", "title": "" }, { "docid": "4cafaac5c41402759ecfd602a5ed814b", "score": "0.50705856", "text": "func CreateAccount(srv usecase.Service) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvar input struct {\n\t\t\tEmail string `json:\"Email\"`\n\t\t\tPassword string `json:\"password\"`\n\t\t\tActions string `json:\"actions\"`\n\t\t\tTenantID string `json:\"tenant_id\"`\n\t\t}\n\n\t\terr := json.NewDecoder(r.Body).Decode(&input)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tw.Write([]byte(err.Error()))\n\t\t\treturn\n\t\t}\n\n\t\thash_passwd, err := password.Generate(input.Password)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tw.Write([]byte(err.Error()))\n\t\t\treturn\n\t\t}\n\n\t\tnew_tenant := &tenant.Tenant{\n\t\t\tUsers: 0,\n\t\t\tCapacity: 100,\n\t\t}\n\n\t\tnew_tenant.ID, err = srv.CreateTenant(new_tenant)\n\t\tif err != nil {\n\t\t\t// log.Println(err.Error())\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tw.Write([]byte(err.Error()))\n\t\t\treturn\n\t\t}\n\n\t\tif input.Actions == \"\" {\n\t\t\tinput.Actions = \"RW\"\n\t\t\tlog.Println(\"Default admin for register users\")\n\t\t}\n\n\t\tnew_account := &account.Account{\n\t\t\tEmail: input.Email,\n\t\t\tPassword: hash_passwd,\n\t\t\tActions: input.Actions,\n\t\t\tTenantID: new_tenant.ID,\n\t\t}\n\n\t\tnew_account.ID, err = srv.CreateAccount(new_account)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tw.Write([]byte(err.Error()))\n\t\t\treturn\n\t\t}\n\n\t\ttoJ := &delivery_data.Account{\n\t\t\tID: id.IDToString(new_account.ID),\n\t\t\tEmail: new_account.Email,\n\t\t\tActions: new_account.Actions,\n\t\t\tTenantID: id.IDToString(new_account.TenantID),\n\t\t}\n\n\t\tsetUserSession(w, r, new_account, new_tenant)\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusCreated)\n\t\tif err := json.NewEncoder(w).Encode(toJ); err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tw.Write([]byte(err.Error()))\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "aa1871b3e0c401c769dfd480cf40f241", "score": "0.50658256", "text": "func New(scope string) (*UUID, error) {\n\tvar (\n\t\tuuid UUID\n\t\terr error\n\t)\n\n\tif setScopes[scope] == nil {\n\t\treturn nil, errors.New(ErrorMissingScope)\n\t}\n\n\t_, err = crand.Read(uuid.bin[:])\n\n\tif err != nil {\n\t\treturn nil, errors.New(\"Error generating new UUID: \" + err.Error())\n\t}\n\n\t//set scope\n\tuuid.bin[0] = *setScopes[scope] | byte(mrand.Intn(4))\n\tuuid.scope = scope\n\n\t//formatting as canonical string\n\tuuid.hex = fmt.Sprintf(\"%x-%x-%x-%x-%x\",\n\t\tuuid.bin[0:4],\n\t\tuuid.bin[4:6],\n\t\tuuid.bin[6:8],\n\t\tuuid.bin[8:10],\n\t\tuuid.bin[10:16])\n\n\treturn &uuid, nil\n}", "title": "" }, { "docid": "bbf62a3dd9dec17898e856257fec256f", "score": "0.50654674", "text": "func GetAccountById(id int , o orm.Ormer) (*models.Account){\n\taccount :=models.Account{Id: id}\n\terr:= o.Read(&account)\n\tif err == orm.ErrNoRows {\n\t\tfmt.Println(\"error: can`t find the player\")\n\t} else if err == orm.ErrMissPK {\n\t\tfmt.Println(\"error: can`t find the primary key\")\n\t} else {\n\t\tfmt.Println(\"query finished\")\n\t}\n\treturn &account\n}", "title": "" }, { "docid": "1e8007c7516308b361588b3cabd83b1a", "score": "0.50623167", "text": "func (c *Client) CreateAccount(account *Account) error {\n\tjsonBytes, err := json.Marshal(account)\n\n\tif err != nil {\n\t\tlog.Fatalln(\"CeateAccount: \", err)\n\t\treturn err\n\t}\n\n\tjsonStr := string(jsonBytes)\n\n\tid, err := c.client.Post(\"accounts\", jsonStr)\n\n\tif err != nil {\n\t\tlog.Fatal(\"POST /accounts/ \", err)\n\t\treturn err\n\t}\n\n\taccount.ID = id\n\n\treturn nil\n}", "title": "" }, { "docid": "85d3a16e01c245db6fdafdaf32e931a1", "score": "0.5055316", "text": "func (db *DB) NewBottle(account int) *app.Bottle {\n\tdb.Lock()\n\tdefer db.Unlock()\n\tbottles, _ := db.bottles[account]\n\tnewID := 1\n\ttaken := true\n\tfor ; taken; newID++ {\n\t\ttaken = false\n\t\tfor _, b := range bottles {\n\t\t\tif b.ID == newID {\n\t\t\t\ttaken = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tbottle := app.Bottle{ID: newID}\n\tdb.bottles[newID] = append(db.bottles[newID], &bottle)\n\treturn &bottle\n}", "title": "" }, { "docid": "6d4a734f641d46a55af01125e041ff97", "score": "0.50533247", "text": "func newIdentified(id string) identified {\n\treturn identified{ID: id}\n}", "title": "" } ]
bfbac6bf925d63a07d9a4115dbf97370
Network indicates an expected call of Network
[ { "docid": "3eea0c0f1dbdc2f630ef288c9ec0e2d5", "score": "0.6510397", "text": "func (mr *MockFinderMockRecorder) Network(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Network\", reflect.TypeOf((*MockFinder)(nil).Network), arg0, arg1)\n}", "title": "" } ]
[ { "docid": "610d4c39857d4dd6c6dfb5ffef5c5c72", "score": "0.6843517", "text": "func (n *OpenBazaarNode) TestNetworkEnabled() bool { return n.TestnetEnable }", "title": "" }, { "docid": "9741d5c3061177de3052073872dbcd40", "score": "0.6786491", "text": "func (fa TestAddr) Network() string { return fa.Addr }", "title": "" }, { "docid": "7038037e0902fecd4327b161d48ffcae", "score": "0.6704572", "text": "func (a *MockAddr) Network() string {\n\treturn \"mock\"\n}", "title": "" }, { "docid": "7157f3586f831851d8d4d4fcec59270e", "score": "0.6586819", "text": "func (mr *MockHostMockRecorder) Network() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Network\", reflect.TypeOf((*MockHost)(nil).Network))\n}", "title": "" }, { "docid": "c36a47e53b8f8dfc6b309509d7dc10e7", "score": "0.64305884", "text": "func checkCreateNetwork(t *testing.T, expError bool, tenant, network, encap, subnet, gw string, tag int) {\n\tnet := client.Network{\n\t\tTenantName: tenant,\n\t\tNetworkName: network,\n\t\tEncap: encap,\n\t\tSubnet: subnet,\n\t\tGateway: gw,\n\t\tPktTag: tag,\n\t}\n\terr := contivClient.NetworkPost(&net)\n\tif err != nil && !expError {\n\t\tt.Fatalf(\"Error creating network {%+v}. Err: %v\", net, err)\n\t} else if err == nil && expError {\n\t\tt.Fatalf(\"Create network {%+v} succeded while expecing error\", net)\n\t} else if err == nil {\n\t\t// verify network is created\n\t\t_, err := contivClient.NetworkGet(tenant, network)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Error getting network %s/%s. Err: %v\", tenant, network, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "08b29cf7a0151e7ad215a3cd35c557ef", "score": "0.6266514", "text": "func (nt NetworkTypeError) NotFound() {}", "title": "" }, { "docid": "40c2f7095fee10d39c3906f21af8d823", "score": "0.62439626", "text": "func (o *NetworkingProjectNetadpCreate) GetNetworkOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Network, true\n}", "title": "" }, { "docid": "2f62db3ddbe7f951820fcd865181c6fb", "score": "0.6167277", "text": "func (c *C7000) Network(cfg *cfgresources.Network) (bool, error) {\n\treturn false, nil\n}", "title": "" }, { "docid": "ec8bf56b04fe5da0c1cfe9c5ae442f29", "score": "0.6103778", "text": "func NetworkComesBefore(first, second *net.IPNet) bool {\n\tif first != nil && second != nil {\n\t\tif first.IP.Equal(second.IP) {\n\t\t\tfirstMask, _ := first.Mask.Size()\n\t\t\tsecondMask, _ := second.Mask.Size()\n\t\t\tif firstMask < secondMask {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\treturn AddressComesBefore(first.IP, second.IP)\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2791be09b90927a8a74070786ddc6f7e", "score": "0.6076641", "text": "func (nsn ErrNoSuchNetwork) NotFound() {}", "title": "" }, { "docid": "971218d9a98ba3a4fe9463aaf6588063", "score": "0.6045958", "text": "func networkInspectExample() string {\n\treturn `$ pouch network inspect net1\nName: net1\nScope: \nDriver: bridge\nEnableIPV6: false\nID: c33c2646dc8ce9162faa65d17e80582475bbe53dc70ba0dc4def4b71e44551d6\nInternal: false`\n}", "title": "" }, { "docid": "dfc72aeb9230b73b4f06cd764a82f7f5", "score": "0.60186714", "text": "func (i *Ibmc) Network(cfg *cfgresources.Network) error {\n\treturn nil\n}", "title": "" }, { "docid": "b895759f91a6a96a034ca14fd56fa0c4", "score": "0.6004352", "text": "func (addr *Address) Network() string { return \"tcp\" }", "title": "" }, { "docid": "3c7d013c39c1235b01d8334c4b0071c6", "score": "0.59608066", "text": "func (o NetworkInterfaceResponseOutput) Network() pulumi.StringOutput {\n\treturn o.ApplyT(func(v NetworkInterfaceResponse) string { return v.Network }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "513eee862d0995607e24514d9695511a", "score": "0.5952834", "text": "func TestNetworkStatus(t *testing.T) {\n\tedgeNode := tc.GetEdgeNode(tc.WithTest(t))\n\n\targs := flag.Args()\n\tif len(args) == 0 {\n\t\tt.Fatalf(\"Usage: %s [options] state vol_name...\\n\", os.Args[0])\n\t} else {\n\t\tsecs := int(timewait.Seconds())\n\t\tstate := args[0]\n\t\tt.Log(utils.AddTimestamp(fmt.Sprintf(\"networks: '%s' expected state: '%s' secs: %d\\n\",\n\t\t\targs[1:], state, secs)))\n\n\t\tnws := args[1:]\n\t\tif nws[len(nws)-1] == \"&\" {\n\t\t\tnws = nws[:len(nws)-1]\n\t\t}\n\t\tstates = make(map[string][]nwState)\n\t\tfor _, el := range nws {\n\t\t\tstates[el] = []nwState{{state: \"no info from controller\", timestamp: time.Now()}}\n\t\t}\n\n\t\tif !*newitems {\n\t\t\t// observe existing info object and feed them into eveState object\n\t\t\tif err := tc.GetController().InfoLastCallback(edgeNode.GetID(), nil, eveState.InfoCallback()); err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t}\n\n\t\t// we are done if our eveState object is in required state\n\t\tif ready := checkState(eveState, state, nws); ready == nil {\n\n\t\t\ttc.AddProcInfo(edgeNode, checkNet(state, nws))\n\n\t\t\tcallback := func() {\n\t\t\t\tt.Errorf(\"ASSERTION FAILED (%s): expected networks %s in %s state\", time.Now().Format(time.RFC3339Nano), nws, state)\n\t\t\t\tfor k, v := range states {\n\t\t\t\t\tt.Errorf(\"\\tactual %s: %s\", k, v[len(v)-1].state)\n\t\t\t\t\tif checkNewLastState(k, state) {\n\t\t\t\t\t\tt.Errorf(\"\\thistory of states for %s:\", k)\n\t\t\t\t\t\tfor _, st := range v {\n\t\t\t\t\t\t\tt.Errorf(\"\\t\\tstate: %s received in: %s\", st.state, st.timestamp.Format(time.RFC3339Nano))\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\ttc.WaitForProcWithErrorCallback(secs, callback)\n\n\t\t} else {\n\t\t\tt.Log(utils.AddTimestamp(ready.Error()))\n\t\t}\n\n\t\t// sleep to reduce concurrency effects\n\t\ttime.Sleep(1 * time.Second)\n\t}\n}", "title": "" }, { "docid": "ca9124d6b8350e20bf5e163155086639", "score": "0.59443665", "text": "func (a UnresolvedAddr) Network() string {\n\treturn a.NetworkField\n}", "title": "" }, { "docid": "9f11ebfbd3cc14ff658fe96a2415ab84", "score": "0.5930145", "text": "func (o *Transfer) GetNetworkOk() (*TransferNetwork, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Network, true\n}", "title": "" }, { "docid": "ce9bbaf5b2959f3f28e14fd89ca6be12", "score": "0.5916199", "text": "func (a *TCPAddr) Network() string { return \"tcp\" }", "title": "" }, { "docid": "6f12ba42abcf61c55d3681ea3af71b8e", "score": "0.5907637", "text": "func Network(n string) Matcher {\n\treturn func(i echo.Instance) bool {\n\t\treturn i.Config().Cluster.NetworkName() == n\n\t}\n}", "title": "" }, { "docid": "dc1b85d5d6b19d3919585c87913fb46b", "score": "0.59014124", "text": "func (o NetworkPeeringResponseOutput) Network() pulumi.StringOutput {\n\treturn o.ApplyT(func(v NetworkPeeringResponse) string { return v.Network }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "22ee505d8e01e2a3c1464a788edee233", "score": "0.58987015", "text": "func (nnr NetworkNameError) Forbidden() {}", "title": "" }, { "docid": "f7074c0a7cb1ded589313f331531702a", "score": "0.5897838", "text": "func (m *MockHost) Network() network.Network {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Network\")\n\tret0, _ := ret[0].(network.Network)\n\treturn ret0\n}", "title": "" }, { "docid": "33effcf104b71bf9fb7b543f4fb4e847", "score": "0.58966523", "text": "func (socket *MockSocket) Network() *socket.NetworkProtocol {\n\treturn socket.network\n}", "title": "" }, { "docid": "3d488e4749f8e7199dcccae79cb46e3e", "score": "0.5890373", "text": "func (o *NetworkingProjectIpCreate) GetNetworkOk() (*string, bool) {\n\tif o == nil || o.Network == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Network, true\n}", "title": "" }, { "docid": "95dd66b1514a8d0d878a78585d7df424", "score": "0.5887993", "text": "func (this *Device) SupportsNetwork() bool {\n return this.Agent.SupportsNetwork()\n}", "title": "" }, { "docid": "59e1b9b5e63913d3fa8abf59edea235b", "score": "0.58492696", "text": "func (_mr *MockNetworkMockRecorder) StartNetwork() *gomock.Call {\n\treturn _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, \"StartNetwork\", reflect.TypeOf((*MockNetwork)(nil).StartNetwork))\n}", "title": "" }, { "docid": "685ef28cc7b222cd840c114faee918e4", "score": "0.5832088", "text": "func (m *MockFinder) Network(arg0 context.Context, arg1 string) (object.NetworkReference, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Network\", arg0, arg1)\n\tret0, _ := ret[0].(object.NetworkReference)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "c335b3b9ac50ecc443f3f05a04f53a79", "score": "0.5823468", "text": "func (a *Addr) Network() string {\n\treturn a.NetworkStr\n}", "title": "" }, { "docid": "cf6c4302855ede285e62dea92919b9ce", "score": "0.58005095", "text": "func (mr *MockRecordMockRecorder) GetNetwork() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetNetwork\", reflect.TypeOf((*MockRecord)(nil).GetNetwork))\n}", "title": "" }, { "docid": "c19b3558efbbaa6a5aa1341d9fbf9642", "score": "0.57926387", "text": "func (vcd *TestVCD) Test_GetNetworkList(check *C) {\n\tfmt.Printf(\"Running: %s\\n\", check.TestName())\n\tnetworkName := vcd.config.VCD.Network.Net1\n\tif networkName == \"\" {\n\t\tcheck.Skip(\"no network name provided\")\n\t}\n\tnetworks, err := vcd.vdc.GetNetworkList()\n\tcheck.Assert(err, IsNil)\n\tfound := false\n\tfor _, net := range networks {\n\t\t// Check that we don't get invalid fields\n\t\tknownType := net.LinkType == 0 || net.LinkType == 1 || net.LinkType == 2\n\t\tcheck.Assert(knownType, Equals, true)\n\t\t// Check that the `ConnectTo` field is not empty\n\t\tcheck.Assert(net.ConnectedTo, Not(Equals), \"\")\n\t\tif net.Name == networkName {\n\t\t\tfound = true\n\t\t}\n\t}\n\tcheck.Assert(found, Equals, true)\n}", "title": "" }, { "docid": "dc1ade530552284f6d95dcee99280238", "score": "0.57697475", "text": "func (a Addr) Network() string {\n\treturn a.network\n}", "title": "" }, { "docid": "a9512ef7e29279aef47931f05e512d9e", "score": "0.576043", "text": "func TestNetworkConfiguredFailsMisconfigured(t *testing.T) {\n\treactor, err := NewMockReactor()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tctx := context.Background()\n\tr := reactor.(*MockReactor)\n\n\tgo func() {\n\t\tif err := r.Handle(ctx, handler); err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t}()\n\n\t// Now act like a test plan\n\tnetclient := network.NewClient(r.Client, r.RunEnv)\n\tnetclient.MustWaitNetworkInitialized(ctx)\n\tcfg := network.Config{}\n\terr = netclient.ConfigureNetwork(ctx, &cfg)\n\tassert.EqualError(t, err, \"failed to configure network; no callback state provided\", \"the sidecar should not permit invalid network configs\")\n}", "title": "" }, { "docid": "77301bf6c408183b57b6313332942d1c", "score": "0.5737594", "text": "func (w WithdrawEvent) Network() string {\n\treturn w.network\n}", "title": "" }, { "docid": "a3fae40832c8a05c9c34514a9de9acbf", "score": "0.57346195", "text": "func setupNetwork(conn *libvirt.Connect, name string) error {\n\tn, err := conn.LookupNetworkByName(name)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"checking network %s\", name)\n\t}\n\n\t// always ensure autostart is set on the network\n\tautostart, err := n.GetAutostart()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"checking network %s autostart\", name)\n\t}\n\tif !autostart {\n\t\tif err := n.SetAutostart(true); err != nil {\n\t\t\treturn errors.Wrapf(err, \"setting autostart for network %s\", name)\n\t\t}\n\t}\n\n\t// always ensure the network is started (active)\n\tactive, err := n.IsActive()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"checking network status for %s\", name)\n\t}\n\tif !active {\n\t\tif err := n.Create(); err != nil {\n\t\t\treturn errors.Wrapf(err, \"starting network %s\", name)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "54d5b6db86596af1f7d942118f6febc4", "score": "0.5716096", "text": "func networkRequest() {\n\tif len(os.Args[1:]) == 1 {\n\t\t//// Display help\n\t\t////fmt.Println(_NETWORK_HELP_CONTENT)\n\t\tnetworkName := getLocalConfigValue(_LEDGER_NETWORK_KEY)\n\t\tif len(networkName) == 0 {\n\t\t\tfmt.Println(\"The network has not be assigned\")\n\t\t}\n\t\tfmt.Println(networkName)\n\t\treturn\n\t}\n\tswitch os.Args[2] {\n\tcase \"--get\", \"-g\":\n\t\tnetworkName := getLocalConfigValue(_LEDGER_NETWORK_KEY)\n\t\tif len(networkName) == 0 {\n\t\t\tfmt.Println(\" The network has not be assigned\")\n\t\t}\n\t\tfmt.Println(networkName)\n\tcase \"--help\", \"-help\", \"help\", \"-h\":\n\t\t// Display help\n\t\tfmt.Println(_NETWORK_HELP_CONTENT)\n\tcase \"--list\", \"-l\":\n\t\tdisplayNetworkList()\n\tdefault:\n\t\tfmt.Printf(\"%s: not a valid argument for %s\\n\", os.Args[2], os.Args[1])\n\t\tfmt.Println(_NETWORK_HELP_CONTENT)\n\t}\n}", "title": "" }, { "docid": "de5096552611fd036a3be48e0bdddf37", "score": "0.5703104", "text": "func TestConnectednessCorrect(t *testing.T) {\n\tnets := make([]network.Network, 4)\n\tfor i := 0; i < 4; i++ {\n\t\tnets[i] = GenSwarm(t)\n\t}\n\n\t// connect 0-1, 0-2, 0-3, 1-2, 2-3\n\n\tdial := func(a, b network.Network) {\n\t\tDivulgeAddresses(b, a)\n\t\tif _, err := a.DialPeer(context.Background(), b.LocalPeer()); err != nil {\n\t\t\tt.Fatalf(\"Failed to dial: %s\", err)\n\t\t}\n\t}\n\n\tdial(nets[0], nets[1])\n\tdial(nets[0], nets[3])\n\tdial(nets[1], nets[2])\n\tdial(nets[3], nets[2])\n\n\t// The notifications for new connections get sent out asynchronously.\n\t// There is the potential for a race condition here, so we sleep to ensure\n\t// that they have been received.\n\ttime.Sleep(time.Millisecond * 100)\n\n\t// test those connected show up correctly\n\n\t// test connected\n\texpectConnectedness(t, nets[0], nets[1], network.Connected)\n\texpectConnectedness(t, nets[0], nets[3], network.Connected)\n\texpectConnectedness(t, nets[1], nets[2], network.Connected)\n\texpectConnectedness(t, nets[3], nets[2], network.Connected)\n\n\t// test not connected\n\texpectConnectedness(t, nets[0], nets[2], network.NotConnected)\n\texpectConnectedness(t, nets[1], nets[3], network.NotConnected)\n\n\trequire.Len(t, nets[0].Peers(), 2, \"expected net 0 to have two peers\")\n\trequire.Len(t, nets[2].Peers(), 2, \"expected net 2 to have two peers\")\n\trequire.NotZerof(t, nets[1].ConnsToPeer(nets[3].LocalPeer()), \"net 1 should have no connections to net 3\")\n\trequire.NoError(t, nets[2].ClosePeer(nets[1].LocalPeer()))\n\n\ttime.Sleep(time.Millisecond * 50)\n\texpectConnectedness(t, nets[2], nets[1], network.NotConnected)\n\n\tfor _, n := range nets {\n\t\tn.Close()\n\t}\n}", "title": "" }, { "docid": "401539aa4516877858aa5b7aa8040862", "score": "0.56895214", "text": "func (step *TaskStep) Network() error {\n\tswitch step.Method {\n\tcase \"connect\":\n\t\tvar connectOpts = NetworkConnectOpts{}\n\t\terr := json.Unmarshal([]byte(step.PluginConfig), &connectOpts)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Bad config for network connect: %s (%v)\", err, step.PluginConfig)\n\t\t}\n\t\thealthyIPs := []string{}\n\t\tfor _, ip := range connectOpts.IPs {\n\t\t\tblacklistedPeer := &AgentPeerConnection{\n\t\t\t\tIP: ip,\n\t\t\t\tPort: 6783,\n\t\t\t\tBlacklisted: time.Now().Unix(),\n\t\t\t\tOutbound: true,\n\t\t\t}\n\t\t\tif peer := agent.peers[blacklistedPeer.key()]; peer != nil {\n\t\t\t\tif peer.Blacklisted > 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tif errTCP := agent.weave.TestTCPConnection(ip); errTCP != nil {\n\t\t\t\tlogger.Debugf(\"Cannot connect to peer %s: %v\", ip, errTCP)\n\t\t\t\tblacklistedPeer.Info = errTCP.Error()\n\t\t\t\tblacklistedPeer.State = \"blacklisted\"\n\t\t\t\tagent.peers[blacklistedPeer.key()] = blacklistedPeer\n\t\t\t\tif err := agent.syncNetworkRouterStatus(); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thealthyIPs = append(healthyIPs, ip)\n\t\t\t}\n\t\t}\n\t\tif len(healthyIPs) == 0 {\n\t\t\treturn fmt.Errorf(\"No remote peers reachables: %s\", strings.Join(connectOpts.IPs, \", \"))\n\t\t}\n\t\terr = agent.connectPeers(healthyIPs)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failure attempting to add connections to network router: %s\", err)\n\t\t}\n\t\treturn nil\n\tcase \"forget\":\n\t\tvar forgetOpts = NetworkConnectOpts{}\n\t\terr := json.Unmarshal([]byte(step.PluginConfig), &forgetOpts)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Bad config for network forget: %s (%v)\", err, step.PluginConfig)\n\t\t}\n\t\terr = agent.forgetPeers(forgetOpts.IPs)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Cannot forget peers: %s\", err)\n\t\t}\n\t\treturn nil\n\tcase \"attach\":\n\t\tvar attachOpts = NetworkAttachOpts{}\n\t\terr := json.Unmarshal([]byte(step.PluginConfig), &attachOpts)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Bad config for network attach: %s (%v)\", err, step.PluginConfig)\n\t\t}\n\t\tsubnetwork := &subNetwork{\n\t\t\tCidr: attachOpts.Cidr,\n\t\t\tDNSDomain: attachOpts.DNSDomain,\n\t\t}\n\t\tsubnetworks := []*subNetwork{subnetwork}\n\t\t_, err = agent.attachNetworks(attachOpts.ContainerID, subnetworks, attachOpts.DNSName)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Cannot attach container %s to network %s: %s\", attachOpts.ContainerID, attachOpts.Cidr, err)\n\t\t}\n\t\tstep.ResultMessage = fmt.Sprintf(\"Container %s attached to network %s\", attachOpts.ContainerID, attachOpts.Cidr)\n\t\tagent.syncDockerContainer(attachOpts.ContainerID)\n\t\treturn nil\n\tcase \"detach\":\n\t\tvar detachOpts = NetworkAttachOpts{}\n\t\terr := json.Unmarshal([]byte(step.PluginConfig), &detachOpts)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Bad config for network detach: %s (%v)\", err, step.PluginConfig)\n\t\t}\n\t\tsubnetwork := &subNetwork{\n\t\t\tCidr: detachOpts.Cidr,\n\t\t}\n\t\tsubnetworks := []*subNetwork{subnetwork}\n\t\terr = agent.detachNetworks(detachOpts.ContainerID, subnetworks)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Cannot attach container %s to network %s: %s\", detachOpts.ContainerID, detachOpts.Cidr, err)\n\t\t}\n\t\tstep.ResultMessage = fmt.Sprintf(\"Container %s detached from network %s\", detachOpts.ContainerID, detachOpts.Cidr)\n\t\tagent.syncDockerContainer(detachOpts.ContainerID)\n\t\treturn nil\n\tcase \"reset\":\n\t\terr := agent.weave.Destroy()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Cannot reset network router: %s\", err)\n\t\t}\n\t\tstep.ResultMessage = fmt.Sprintf(\"Network router resetted\")\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"Unknown step method %s\", step.Method)\n\t}\n}", "title": "" }, { "docid": "8febc3657c3aa9226a294c4fe3e991ee", "score": "0.56869346", "text": "func (o LookupRegionNetworkEndpointGroupResultOutput) Network() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupRegionNetworkEndpointGroupResult) string { return v.Network }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "306509e089f5947b4b04c3ed96412ca3", "score": "0.56756204", "text": "func TestNetworkConfigured(t *testing.T) {\n\treactor, err := NewMockReactor()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tctx := context.Background()\n\tr := reactor.(*MockReactor)\n\n\tgo func() {\n\t\tif err := r.Handle(ctx, handler); err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t}()\n\n\t// Now act like a test plan\n\tnetclient := network.NewClient(r.Client, r.RunEnv)\n\tnetclient.MustWaitNetworkInitialized(ctx)\n\tcfg := network.Config{\n\t\tNetwork: \"default\",\n\t\tEnable: true,\n\t\tCallbackState: \"reconfigured\",\n\t\tDefault: network.LinkShape{\n\t\t\tLatency: time.Hour,\n\t\t},\n\t}\n\tif err = netclient.ConfigureNetwork(ctx, &cfg); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tassert.Len(t, r.Network.Configured, 2, \"the sidecar passes on configurations to the backing network\")\n\tassert.True(t, reflect.DeepEqual(*r.Network.Active[\"default\"], cfg), \"the sidecar shuold not edit the config\")\n}", "title": "" }, { "docid": "63f3ab72045f9b7908c7a327a6257f51", "score": "0.566138", "text": "func TestAddNetwork(t *testing.T) {\n\t// initialize rsrcMgr since we use it for resource allocation\n\trsrcMgr.Init(nil)\n\n\t// Initialize the ctrler\n\tInit()\n\n\t// Create network\n\tnetwork, err := NewNetwork(\"default\")\n\tif err != nil {\n\t\tt.Errorf(\"Error creating network default. Err: %v\", err)\n\t\treturn\n\t}\n\n\tlog.Infof(\"Successfully Created network: %+v\", network)\n\n\t// Create new endpoint\n\tep, err := network.NewEndPoint(\"alta1234.0\")\n\tif err != nil {\n\t\tt.Errorf(\"Error creating network endpoint. Err: %v\", err)\n\t\treturn\n\t}\n\n\tlog.Infof(\"Successfully Created endpoint: %+v\", ep)\n}", "title": "" }, { "docid": "f3382b4497df90b1ecaba8ceb6bb0296", "score": "0.56574106", "text": "func (mr *MockCountryRecordMockRecorder) GetNetwork() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetNetwork\", reflect.TypeOf((*MockCountryRecord)(nil).GetNetwork))\n}", "title": "" }, { "docid": "3b7b2373ed3d62abeeee0a652e0da72d", "score": "0.5649511", "text": "func (t DNSOverTCP) Network() string {\n\treturn t.network\n}", "title": "" }, { "docid": "13908b1cd0507314d6a53f1bb8d66df4", "score": "0.56457096", "text": "func (mr *MockStoreMockRecorder) GetNetwork(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetNetwork\", reflect.TypeOf((*MockStore)(nil).GetNetwork), arg0)\n}", "title": "" }, { "docid": "f2e91f41b9a1e653c8f7b44297acc5fd", "score": "0.56454974", "text": "func (mr *MockCityRecordMockRecorder) GetNetwork() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetNetwork\", reflect.TypeOf((*MockCityRecord)(nil).GetNetwork))\n}", "title": "" }, { "docid": "c5ad0857bcafac7da067408c76d66bcc", "score": "0.5642975", "text": "func SetUpNetwork(com Communicator) {\n\tif com.NetCode() == OfflineCode {\n\t\treturn\n\t}\n\tReacquire(com)\n\tif com.NetCode() == ServerCode {\n\t\tser, _ := com.(Server)\n\t\tif !Listen(ser) {\n\t\t\tRetryIP(com)\n\t\t\tSetUpNetwork(com)\n\t\t} else {\n\t\t\tgo RunService(ser)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "17933f19cded2cf555c47a08003615ac", "score": "0.56179965", "text": "func CheckNetworkStatus() error {\n\tif SunnyDay {\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"No Internet\")\n}", "title": "" }, { "docid": "520f602d9414f60da77840319b08b168", "score": "0.5614971", "text": "func (o NetworkInterfaceOutput) Network() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NetworkInterface) *string { return v.Network }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d5335574c6983e786a806c99ea0e92ad", "score": "0.5600122", "text": "func (a *Addr) Network() string {\n\treturn \"raw\"\n}", "title": "" }, { "docid": "6d43b17a164db5ab3e0c9b753d3d702d", "score": "0.55930805", "text": "func TestNetworkCreateOnNonExistentTenant(t *testing.T) {\n\t// create netagent\n\tag, _, _ := createNetAgent(t)\n\tAssert(t, ag != nil, \"Failed to create agent %#v\", ag)\n\tdefer ag.Stop()\n\n\t// create network\n\tnt := netproto.Network{\n\t\tTypeMeta: api.TypeMeta{Kind: \"Network\"},\n\t\tObjectMeta: api.ObjectMeta{\n\t\t\tTenant: \"nonExistentNetwork\",\n\t\t\tNamespace: \"nonExistentNetwork\",\n\t\t\tName: \"default\",\n\t\t},\n\t}\n\n\t// create network\n\terr := ag.CreateNetwork(&nt)\n\tAssert(t, err != nil, \"Network create was expected to fail.\")\n}", "title": "" }, { "docid": "d5e10a40a9b09bb20ef7c353aff36d03", "score": "0.5592715", "text": "func (o *IpamNetworkDataData) GetNetworkNameOk() (*string, bool) {\n\tif o == nil || o.NetworkName == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NetworkName, true\n}", "title": "" }, { "docid": "1f42dff9f68f466908564efb61c72a7a", "score": "0.5589056", "text": "func (_m *MockNetwork) StartNetwork() {\n\t_m.ctrl.Call(_m, \"StartNetwork\")\n}", "title": "" }, { "docid": "31e3148be2b2798f7610f3309679f520", "score": "0.5558159", "text": "func (o LookupWorkstationClusterResultOutput) Network() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupWorkstationClusterResult) string { return v.Network }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "f14c8c025a908468faf3eac9f1381c98", "score": "0.5548476", "text": "func (o *IpamNetworkDataData) GetNetworkIsValidOk() (*string, bool) {\n\tif o == nil || o.NetworkIsValid == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NetworkIsValid, true\n}", "title": "" }, { "docid": "6733f2a746ba87344cc41169d3384804", "score": "0.5547879", "text": "func (me TactionType) IsRateLimitNetwork() bool { return me.String() == \"rate-limit-network\" }", "title": "" }, { "docid": "b7d0d116dc6ddc9f08381c3d46d22257", "score": "0.5547714", "text": "func (mr *MockCandidatePropertyGetterMockRecorder) Networks() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Networks\", reflect.TypeOf((*MockCandidatePropertyGetter)(nil).Networks))\n}", "title": "" }, { "docid": "1b2a2717514849cdfb9aea7210d78f09", "score": "0.55460835", "text": "func (d *Dry) InspectNetwork(position int) {\n\n\tif network, err := d.dockerDaemon.NetworkAt(position); err == nil {\n\t\tnetwork, err := d.dockerDaemon.NetworkInspect(network.ID)\n\t\tif err == nil {\n\t\t\td.changeViewMode(InspectNetworkMode)\n\t\t\td.inspectedNetwork = network\n\t\t} else {\n\t\t\td.errormessage(network.ID, \"inspecting network\", err)\n\t\t}\n\t} else {\n\t\td.errormessage(network.ID, \"inspecting network\", err)\n\t}\n}", "title": "" }, { "docid": "466310680edace4fde6afb28c09b0f1b", "score": "0.5523455", "text": "func networkConnectExample() string {\n\treturn `$ pouch network connect net1 container1\ncontainer container1 is connected to network net1`\n}", "title": "" }, { "docid": "92a5d2af10d7a0becd4bee97f4e33723", "score": "0.5523451", "text": "func (d *Driver) ensureNetwork() error {\n\tconn, err := getConnection()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"getting libvirt connection\")\n\t}\n\tdefer conn.Close()\n\n\t// network: default\n\n\t// Start the default network\n\t// It is assumed that the libvirt/kvm installation has already created this network\n\tlog.Infof(\"Ensuring network %s is active\", defaultNetworkName)\n\tif err := setupNetwork(conn, defaultNetworkName); err != nil {\n\t\treturn err\n\t}\n\n\t// network: private\n\n\t// Start the private network\n\tlog.Infof(\"Ensuring network %s is active\", d.PrivateNetwork)\n\tif err := setupNetwork(conn, d.PrivateNetwork); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a7f3a848271b27ee6994e12a95861594", "score": "0.5509512", "text": "func IsNetworkUnavailable(n *corev1.Node) bool {\n\treturn ConditionStatus(n, corev1.NodeNetworkUnavailable) == corev1.ConditionTrue\n}", "title": "" }, { "docid": "47d0aaaafadcafefe9a99a0e532cc15f", "score": "0.5506502", "text": "func (s stack) HasDefaultNetwork() bool {\n\treturn false\n}", "title": "" }, { "docid": "fd61b352b241f81c682ea773ba23f19c", "score": "0.5497374", "text": "func (w *rpcWallet) Network(ctx context.Context) (wire.CurrencyNet, error) {\n\tnet, err := w.client().GetCurrentNet(ctx)\n\treturn net, translateRPCCancelErr(err)\n}", "title": "" }, { "docid": "7f17e89bbd2b125a79507c01c3902807", "score": "0.549696", "text": "func TestNetworkInitialize(t *testing.T) {\n\treactor, err := NewMockReactor()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tctx := context.Background()\n\tr := reactor.(*MockReactor)\n\n\tgo func() {\n\t\tif err := r.Handle(ctx, handler); err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t}()\n\n\t// Now act like a test plan\n\tnetclient := network.NewClient(r.Client, r.RunEnv)\n\tnetclient.MustWaitNetworkInitialized(ctx)\n\tassert.Len(t, r.Network.Configured, 1, \"the network should be configured once for init\")\n}", "title": "" }, { "docid": "768a0e49fe118bc457b283010e04d140", "score": "0.5488466", "text": "func (a Addr) Network() string {\n\treturn \"stdio\"\n}", "title": "" }, { "docid": "768a0e49fe118bc457b283010e04d140", "score": "0.5488466", "text": "func (a Addr) Network() string {\n\treturn \"stdio\"\n}", "title": "" }, { "docid": "8485edc30f227d1e82d0ef47ed54f904", "score": "0.5487172", "text": "func (o RegionNetworkEndpointGroupOutput) Network() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RegionNetworkEndpointGroup) pulumi.StringPtrOutput { return v.Network }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "05e4b62b60de463aeea9fe5704f0cb4c", "score": "0.54846513", "text": "func (ind ErrInvalidNetworkDriver) BadRequest() {}", "title": "" }, { "docid": "75ff04897f87ab9ecdbc06a22bbdc4d8", "score": "0.5464715", "text": "func (une *UnknownNetworkError) NotFound() {}", "title": "" }, { "docid": "2aa2412a38b8305ee62d325b63b7d6b9", "score": "0.54593676", "text": "func (mr *MockFinderMockRecorder) NetworkList(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"NetworkList\", reflect.TypeOf((*MockFinder)(nil).NetworkList), arg0, arg1)\n}", "title": "" }, { "docid": "3b6086b787077b33ce446ce5e52c830c", "score": "0.5455923", "text": "func IsNetErrCode(code int) bool {\n\tswitch code {\n\tcase GetConnErrorCode: // WriteConnErrCode, ReadConnErrCode\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "7f3520a26534817d209bd831df6558b0", "score": "0.54540074", "text": "func (o *VirtualizationVmwareVirtualMachineAllOf) GetNetworkCountOk() (*int64, bool) {\n\tif o == nil || o.NetworkCount == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NetworkCount, true\n}", "title": "" }, { "docid": "62a527a7c8dcd1d7c740334a4b7b9955", "score": "0.54496074", "text": "func NetworkPredicate (pod *v1.Pod, node *v1.Node, e *Extender) (bool, error) {\n // if node.Name == \"n9kinfra-mr-master01\" || node.Name == \"n9kinfra-mr-node01\" || node.Name == \"n9kinfra-mr-node02\" {\n if node.Name == \"n9kinfra-mr-master01\" || node.Name == \"n9kinfra-mr-node01\" {\n return true, nil\n }\n\n return false, nil\n}", "title": "" }, { "docid": "d5e8a8dff641b8699f7ebd15ad4899f0", "score": "0.54479086", "text": "func (o *VirtualizationIweVirtualMachine) GetNetworkCountOk() (*int64, bool) {\n\tif o == nil || o.NetworkCount == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NetworkCount, true\n}", "title": "" }, { "docid": "3d02430d17211b36866e3e81984aacc8", "score": "0.5438721", "text": "func (d CheckPodNetwork) Check() types.DiagnosticResult {\n\td.res = types.NewDiagnosticResult(CheckPodNetworkName)\n\n\tpluginName, ok, err := util.GetOpenShiftNetworkPlugin(d.ClusterNetworkClient)\n\tif err != nil {\n\t\td.res.Error(\"DPodNet1001\", err, fmt.Sprintf(\"Checking network plugin failed. Error: %s\", err))\n\t\treturn d.res\n\t}\n\tif !ok {\n\t\td.res.Warn(\"DPodNet1002\", nil, \"Skipping pod connectivity test. Reason: Not using openshift network plugin.\")\n\t\treturn d.res\n\t}\n\n\tlocalPods, nonlocalPods, err := util.GetLocalAndNonLocalDiagnosticPods(d.KubeClient)\n\tif err != nil {\n\t\td.res.Error(\"DPodNet1003\", err, fmt.Sprintf(\"Getting local and nonlocal pods failed. Error: %s\", err))\n\t\treturn d.res\n\t}\n\n\tif network.IsOpenShiftMultitenantNetworkPlugin(pluginName) {\n\t\tnetnsList, err := d.NetNamespacesClient.NetNamespaces().List(metav1.ListOptions{})\n\t\tif err != nil {\n\t\t\td.res.Error(\"DPodNet1004\", err, fmt.Sprintf(\"Getting all network namespaces failed. Error: %s\", err))\n\t\t\treturn d.res\n\t\t}\n\n\t\td.vnidMap = map[string]uint32{}\n\t\tfor _, netns := range netnsList.Items {\n\t\t\td.vnidMap[netns.NetName] = netns.NetID\n\t\t}\n\t}\n\n\tlocalGlobalPods, localNonGlobalPods := util.GetGlobalAndNonGlobalPods(localPods, d.vnidMap)\n\tnonlocalGlobalPods, nonlocalNonGlobalPods := util.GetGlobalAndNonGlobalPods(nonlocalPods, d.vnidMap)\n\n\td.checkSameNodePodToPodConnection(localGlobalPods, localNonGlobalPods)\n\td.checkDifferentNodePodToPodConnection(localGlobalPods, localNonGlobalPods, nonlocalGlobalPods, nonlocalNonGlobalPods)\n\treturn d.res\n}", "title": "" }, { "docid": "c7ab0856550ea586d520ea98673b65e4", "score": "0.5428108", "text": "func checkDeleteNetwork(t *testing.T, expError bool, tenant, network string) {\n\terr := contivClient.NetworkDelete(tenant, network)\n\tif err != nil && !expError {\n\t\tt.Fatalf(\"Error deleting network %s/%s. Err: %v\", tenant, network, err)\n\t} else if err == nil && expError {\n\t\tt.Fatalf(\"Delete network %s/%s succeded while expecing error\", tenant, network)\n\t} else if err == nil {\n\t\t// verify network is gone\n\t\t_, err := contivClient.NetworkGet(tenant, network)\n\t\tif err == nil {\n\t\t\tt.Fatalf(\"Network %s/%s not deleted\", tenant, network)\n\t\t}\n\n\t\t// verify network state is gone too\n\t\tnetworkID := network + \".\" + tenant\n\t\tnwCfg := &mastercfg.CfgNetworkState{}\n\t\tnwCfg.StateDriver = stateStore\n\t\terr = nwCfg.Read(networkID)\n\t\tif err == nil {\n\t\t\tt.Fatalf(\"Network state %s not deleted\", networkID)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e5ffb230941e39df710ef4d9e3e8427f", "score": "0.54279494", "text": "func TestNetworkAddDelete(t *testing.T) {\n\t// Basic vlan network\n\tcheckCreateNetwork(t, false, \"default\", \"contiv\", \"vlan\", \"10.1.1.1/24\", \"10.1.1.254\", 1)\n\tverifyNetworkState(t, \"default\", \"contiv\", \"vlan\", \"10.1.1.1\", \"10.1.1.254\", 24, 1, 0)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv\")\n\n\t// Basic Vxlan network\n\tcheckCreateNetwork(t, false, \"default\", \"contiv\", \"vxlan\", \"10.1.1.1/16\", \"10.1.1.254\", 1)\n\tverifyNetworkState(t, \"default\", \"contiv\", \"vxlan\", \"10.1.1.1\", \"10.1.1.254\", 16, 1, 1)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv\")\n\n\t// Basic IP range network checks\n\tcheckCreateNetwork(t, false, \"default\", \"contiv\", \"vxlan\", \"10.1.1.10-20/24\", \"10.1.1.254\", 1)\n\tverifyNetworkState(t, \"default\", \"contiv\", \"vxlan\", \"10.1.1.10\", \"10.1.1.254\", 24, 1, 1)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv\")\n\n\t// Try network create with invalid network range\n\tcheckCreateNetwork(t, true, \"default\", \"contiv\", \"vxlan\", \"10.1.1.1-70/26\", \"10.1.1.63\", 1)\n\n\t// Try network create with invalid subnet length\n\tcheckCreateNetwork(t, true, \"default\", \"contiv\", \"vxlan\", \"10.1.1.1/32\", \"10.1.1.1\", 1)\n\n\t// try creating network without tenant\n\tcheckCreateNetwork(t, true, \"tenant1\", \"contiv\", \"vxlan\", \"10.1.1.1/24\", \"10.1.1.254\", 1)\n\n\t// try invalid encap\n\tcheckCreateNetwork(t, true, \"default\", \"contiv\", \"vvvv\", \"10.1.1.1/24\", \"10.1.1.254\", 1)\n\n\t// try invalid pkt tags\n\tcheckCreateNetwork(t, true, \"default\", \"contiv\", \"vlan\", \"10.1.1.1/24\", \"10.1.1.254\", 5000)\n\tcheckCreateNetwork(t, true, \"default\", \"contiv\", \"vxlan\", \"10.1.1.1/24\", \"10.1.1.254\", 20000)\n\n\t// Try gateway outside the network\n\tcheckCreateNetwork(t, true, \"default\", \"contiv\", \"vxlan\", \"10.1.1.1/24\", \"10.1.2.254\", 1)\n\tcheckCreateNetwork(t, true, \"default\", \"contiv\", \"vxlan\", \"10.1.1.65-70/26\", \"10.1.1.1\", 2)\n\n\t// Try deleting a non-existing network\n\tcheckDeleteNetwork(t, true, \"default\", \"contiv\")\n}", "title": "" }, { "docid": "174c4c81ba6c6626465b4887a56ab45d", "score": "0.542072", "text": "func (bh *BlankHost) Network() inet.Network {\n\treturn bh.n\n}", "title": "" }, { "docid": "e91affbb119271726bc1a50c64f63823", "score": "0.5415696", "text": "func (o *IpamNetworkDataData) GetNetworkSizeOk() (*string, bool) {\n\tif o == nil || o.NetworkSize == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NetworkSize, true\n}", "title": "" }, { "docid": "f352185fc444ad782780c7c8202d5eb0", "score": "0.5392685", "text": "func (s stack) CreateNetwork(req abstract.NetworkRequest) (res *abstract.Network, ferr fail.Error) {\n\tnullAN := abstract.NewNetwork()\n\tif s.IsNull() {\n\t\treturn nullAN, fail.InvalidInstanceError()\n\t}\n\n\tdefer debug.NewTracer(nil, tracing.ShouldTrace(\"stack.aws\") || tracing.ShouldTrace(\"stacks.network\"), \"(%v)\", req).WithStopwatch().Entering().Exiting()\n\n\t// Check if network already there\n\tvar xerr fail.Error\n\tif _, xerr = s.rpcDescribeVpcByName(aws.String(req.Name)); xerr != nil {\n\t\tswitch xerr.(type) {\n\t\tcase *fail.ErrNotFound:\n\t\t\tdebug.IgnoreError(xerr)\n\t\t\t// continue\n\t\tdefault:\n\t\t\treturn nullAN, xerr\n\t\t}\n\t} else {\n\t\treturn nullAN, fail.DuplicateError(\"a Network/VPC named '%s' already exists\")\n\t}\n\n\t// if not, create the network/VPC\n\ttheVpc, xerr := s.rpcCreateVpc(aws.String(req.Name), aws.String(req.CIDR))\n\tif xerr != nil {\n\t\treturn nullAN, fail.Wrap(xerr, \"failed to create VPC\")\n\t}\n\n\t// wait until available status\n\tif IsOperation(theVpc, \"State\", reflect.TypeOf(\"\")) {\n\t\tretryErr := retry.WhileUnsuccessful(\n\t\t\tfunc() error {\n\t\t\t\tvpcTmp, innerXErr := s.rpcDescribeVpcByID(theVpc.VpcId)\n\t\t\t\tif innerXErr != nil {\n\t\t\t\t\treturn innerXErr\n\t\t\t\t}\n\t\t\t\tif aws.StringValue(vpcTmp.State) != \"available\" {\n\t\t\t\t\treturn fail.NewError(\"not ready\")\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\ttemporal.GetMinDelay(),\n\t\t\ttemporal.GetDefaultDelay(),\n\t\t)\n\t\tif retryErr != nil {\n\t\t\tswitch retryErr.(type) {\n\t\t\tcase *retry.ErrStopRetry:\n\t\t\t\treturn nullAN, fail.Wrap(fail.Cause(retryErr), \"stopping retries\")\n\t\t\tcase *fail.ErrTimeout:\n\t\t\t\treturn nullAN, fail.Wrap(fail.Cause(retryErr), \"timeout\")\n\t\t\tdefault:\n\t\t\t\treturn nullAN, retryErr\n\t\t\t}\n\t\t}\n\t}\n\n\tdefer func() {\n\t\tif ferr != nil && !req.KeepOnFailure {\n\t\t\tif theVpc != nil {\n\t\t\t\tderr := s.DeleteNetwork(aws.StringValue(theVpc.VpcId))\n\t\t\t\tif derr != nil {\n\t\t\t\t\t_ = ferr.AddConsequence(derr)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\tgw, xerr := s.rpcCreateInternetGateway()\n\tif xerr != nil {\n\t\treturn nullAN, fail.Wrap(xerr, \"failed to create internet gateway\")\n\t}\n\n\tif xerr = s.rpcAttachInternetGateway(theVpc.VpcId, gw.InternetGatewayId); xerr != nil {\n\t\treturn nullAN, fail.Wrap(xerr, \"failed to attach internet gateway to Network\")\n\t}\n\n\tdefer func() {\n\t\tif ferr != nil && !req.KeepOnFailure {\n\t\t\tif derr := s.rpcDetachInternetGateway(theVpc.VpcId, gw.InternetGatewayId); derr != nil {\n\t\t\t\t_ = ferr.AddConsequence(normalizeError(derr))\n\t\t\t}\n\t\t}\n\t}()\n\n\ttables, xerr := s.rpcDescribeRouteTables(aws.String(\"vpc-id\"), []*string{theVpc.VpcId})\n\tif xerr != nil {\n\t\treturn nullAN, xerr\n\t}\n\tif len(tables) < 1 {\n\t\treturn nullAN, fail.InconsistentError(\"no Route Tables\")\n\t}\n\n\tif xerr = s.rpcCreateRoute(gw.InternetGatewayId, tables[0].RouteTableId, aws.String(\"0.0.0.0/0\")); xerr != nil {\n\t\treturn nullAN, fail.Wrap(xerr, \"failed to create route\")\n\t}\n\n\tdefer func() {\n\t\tif ferr != nil && !req.KeepOnFailure {\n\t\t\tif derr := s.rpcDeleteRoute(tables[0].RouteTableId, aws.String(\"0.0.0.0/0\")); derr != nil {\n\t\t\t\t_ = ferr.AddConsequence(normalizeError(derr))\n\t\t\t}\n\t\t}\n\t}()\n\n\tanet := abstract.NewNetwork()\n\tanet.ID = aws.StringValue(theVpc.VpcId)\n\tanet.Name = req.Name\n\tanet.CIDR = req.CIDR\n\tanet.DNSServers = req.DNSServers\n\n\t// Make sure we log warnings\n\t_ = anet.OK()\n\n\treturn anet, nil\n}", "title": "" }, { "docid": "832c5d4f79ce5d2a10d2ed6bc1dec889", "score": "0.53906727", "text": "func (a *UDPAddr) Network() string { return \"udp\" }", "title": "" }, { "docid": "77c5d62529d5f2b4ab0274bfa05ee6d2", "score": "0.538413", "text": "func (o NodeOutput) Network() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Node) pulumi.StringOutput { return v.Network }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "77c5d62529d5f2b4ab0274bfa05ee6d2", "score": "0.538413", "text": "func (o NodeOutput) Network() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Node) pulumi.StringOutput { return v.Network }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "7436445edda12f4bcc29dc235c9f8f78", "score": "0.5369489", "text": "func checkNet(state string, volNames []string) projects.ProcInfoFunc {\n\treturn func(msg *info.ZInfoMsg) error {\n\t\teveState.InfoCallback()(msg) //feed state with new info\n\t\treturn checkState(eveState, state, volNames)\n\t}\n}", "title": "" }, { "docid": "ad746ef5217318cd7f7978ef1e2e5886", "score": "0.53681326", "text": "func (addr *Addr) Network() string {\n\treturn \"websocket\"\n}", "title": "" }, { "docid": "6d15aa88571e5a4ed7cab855ea58fea7", "score": "0.5366535", "text": "func validateNetworkInputs(p netintents.Network) error {\n\t// validate name\n\terrs := validation.IsValidName(p.Metadata.Name)\n\tif len(errs) > 0 {\n\t\treturn pkgerrors.Errorf(\"Invalid network name - name=[%v], errors: %v\", p.Metadata.Name, errs)\n\t}\n\n\t// validate cni type\n\tfound := false\n\tfor _, val := range nettypes.CNI_TYPES {\n\t\tif p.Spec.CniType == val {\n\t\t\tfound = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !found {\n\t\treturn pkgerrors.Errorf(\"Invalid cni type: %v\", p.Spec.CniType)\n\t}\n\n\tsubnets := p.Spec.Ipv4Subnets\n\tfor _, subnet := range subnets {\n\t\terr := nettypes.ValidateSubnet(subnet)\n\t\tif err != nil {\n\t\t\treturn pkgerrors.Wrap(err, \"invalid subnet\")\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3d1a48eaa1da600cd3646c2a7e9639b6", "score": "0.5366306", "text": "func (m *MockCountryRecord) GetNetwork() *net.IPNet {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetNetwork\")\n\tret0, _ := ret[0].(*net.IPNet)\n\treturn ret0\n}", "title": "" }, { "docid": "051182adcc1ef160efde8c0cedba3a20", "score": "0.5351573", "text": "func (session *dummySession) CreateNetworkRequest(method string, url string, payload string, header map[string]string) networkModel.NetworkRequest {\n\tassert.Fail(session.t, \"Unexpected call to CreateNetworkRequest\")\n\treturn nil\n}", "title": "" }, { "docid": "ed9a0d922e942937796b8486696fa89d", "score": "0.5348177", "text": "func ValidateNetworkMode(c *Config) error {\n\tif c.General.Mode == \"\" {\n\t\tc.General.Mode = DefaultNetMode\n\t}\n\tc.General.Mode = strings.ToLower(c.General.Mode)\n\tswitch c.General.Mode {\n\tcase DualStackNetMode:\n\t\tfallthrough\n\tcase IPv4NetMode:\n\t\tfallthrough\n\tcase IPv6NetMode:\n\t\tglog.Infof(\"Building cluster in mode %q\", c.General.Mode)\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported network mode %q entered\", c.General.Mode)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3ed95dd6b101a6bd653a11232224a45d", "score": "0.53472275", "text": "func networkCreateExample() string {\n\treturn `$ pouch network create -n pouchnet -d bridge --gateway 192.168.1.1 --subnet 192.168.1.0/24\npouchnet: e1d541722d68dc5d133cca9e7bd8fd9338603e1763096c8e853522b60d11f7b9`\n}", "title": "" }, { "docid": "c2a69146008d9ec96026868ea77ff259", "score": "0.5346453", "text": "func (o NetworkAttachmentOutput) Network() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *NetworkAttachment) pulumi.StringOutput { return v.Network }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c823aff81b9ad09615cb873541722a1f", "score": "0.5345376", "text": "func validNetwork(i string) bool {\n\t_, _, err := net.ParseCIDR(i)\n\tif err == nil {\n\t\treturn true\n\t}\n\tif net.ParseIP(i) != nil {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "498c264b89d46b365487ea1bbe0f4be1", "score": "0.5345341", "text": "func TestPhaseNetwork(t *testing.T) {\n\tnewIntegrationTest(\"lifecyclephases.example.com\", \"lifecycle_phases\").\n\t\trunTestPhase(t, cloudup.PhaseNetwork)\n}", "title": "" }, { "docid": "962a636a4b1deb44f60cbc0bbbdf0c7d", "score": "0.53373486", "text": "func (self *AltaActor) createNetwork() error {\n\t// Loop thru each endpoint\n\tfor _, endpoint := range self.Model.Spec.Endpoints {\n\t\tnetwork, err := netCtrler.FindNetwork(endpoint.NetworkName)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Network %s not found while creating Alta: %+v\", self.Model.Spec)\n\t\t\treturn errors.New(\"network not found\")\n\t\t}\n\n\t\t// Send the network info to the node\n\t\tvar resp altaspec.ReqSuccess\n\t\turl := \"/network/create\"\n\t\terr = nodeCtrler.NodePostReq(self.Model.CurrNode, url, network.NetSpec, &resp)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error sending network info to node %s. Err: %v\",\n\t\t\t\tself.Model.CurrNode, err)\n\t\t}\n\t}\n\n\t// Move forward in fsm\n\tself.AltaEvent(\"createVol\")\n\n\treturn nil\n}", "title": "" }, { "docid": "50da876ff549956b49b3cefb601193d1", "score": "0.5332948", "text": "func (t *DNSOverTCPTransport) Network() string {\n\treturn t.network\n}", "title": "" }, { "docid": "80791c17c27419c6c6e452d9b600a7d4", "score": "0.53328353", "text": "func (o *IpamNetworkDataData) GetNetworkClassNameOk() (*string, bool) {\n\tif o == nil || o.NetworkClassName == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NetworkClassName, true\n}", "title": "" }, { "docid": "ca0264ff23bbc68ab76c3fc6031caf0d", "score": "0.53292686", "text": "func (c *TestClient) CreateNetwork(project string, n *compute.Network) error {\n\tif c.CreateNetworkFn != nil {\n\t\treturn c.CreateNetworkFn(project, n)\n\t}\n\treturn c.client.CreateNetwork(project, n)\n}", "title": "" }, { "docid": "0d741d1b3687a8392c069811695c9683", "score": "0.5326894", "text": "func (m *MockCityRecord) GetNetwork() *net.IPNet {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetNetwork\")\n\tret0, _ := ret[0].(*net.IPNet)\n\treturn ret0\n}", "title": "" }, { "docid": "9ba01f494d4735baaf358f9731fa5167", "score": "0.53243953", "text": "func set_net(opt *Opts) bool {\n\tif opt.net == false {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "5bbc1c8bf1a3dc6af4379552803ca50e", "score": "0.5311725", "text": "func verifyNetworkState(t *testing.T, tenant, network, encap, subnet, gw string, subnetLen uint, pktTag, extTag int) {\n\tnetworkID := network + \".\" + tenant\n\tnwCfg := &mastercfg.CfgNetworkState{}\n\tnwCfg.StateDriver = stateStore\n\terr := nwCfg.Read(networkID)\n\tif err != nil {\n\t\tt.Fatalf(\"Network state for %s not found. Err: %v\", networkID, err)\n\t}\n\n\t// verify network params\n\tif nwCfg.Tenant != tenant || nwCfg.NetworkName != network ||\n\t\tnwCfg.PktTagType != encap || nwCfg.SubnetIP != netutils.GetSubnetAddr(subnet, subnetLen) || nwCfg.Gateway != gw {\n\t\tt.Fatalf(\"Network state {%+v} did not match expected state\", nwCfg)\n\t}\n\n\t// verify network tags\n\tif (pktTag != 0 && nwCfg.PktTag != pktTag) ||\n\t\t(extTag != 0 && nwCfg.ExtPktTag != extTag) {\n\t\tt.Fatalf(\"Network tags %d/%d did not match expected %d/%d\",\n\t\t\tnwCfg.PktTag, nwCfg.ExtPktTag, pktTag, extTag)\n\t}\n}", "title": "" }, { "docid": "46d1572973090503134637615e28c213", "score": "0.530347", "text": "func (account *SCloudaccount) createNetwork(ctx context.Context, wireId, networkType string, net CANetConf) error {\n\tnetwork := &SNetwork{}\n\tnetwork.Name = net.Name\n\tif hint, err := NetworkManager.NewIfnameHint(net.Name); err != nil {\n\t\tlog.Errorf(\"can't NewIfnameHint form hint %s\", net.Name)\n\t} else {\n\t\tnetwork.IfnameHint = hint\n\t}\n\tnetwork.GuestIpStart = net.IpStart\n\tnetwork.GuestIpEnd = net.IpEnd\n\tnetwork.GuestIpMask = net.IpMask\n\tnetwork.GuestGateway = net.Gateway\n\tnetwork.VlanId = int(net.VlanID)\n\tnetwork.WireId = wireId\n\tnetwork.ServerType = networkType\n\tnetwork.IsPublic = true\n\tnetwork.Status = api.NETWORK_STATUS_AVAILABLE\n\tnetwork.PublicScope = string(rbacscope.ScopeDomain)\n\tnetwork.ProjectId = account.ProjectId\n\tnetwork.DomainId = account.DomainId\n\tnetwork.Description = net.Description\n\n\tnetwork.SetModelManager(NetworkManager, network)\n\t// TODO: Prevent IP conflict\n\tlog.Infof(\"create network %s succussfully\", network.Id)\n\terr := NetworkManager.TableSpec().Insert(ctx, network)\n\treturn err\n}", "title": "" }, { "docid": "96599a031d14b1f7de796674eb952159", "score": "0.52976024", "text": "func WaitForNetwork() error {\n\tmaxAttempt := 3\n\tcheckInterval := time.Second\n\tfor i := 0; i < maxAttempt; i++ {\n\t\tinterfaces, err := net.Interfaces()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(interfaces) > 1 {\n\t\t\treturn nil\n\t\t}\n\t\ttime.Sleep(checkInterval)\n\t}\n\treturn fmt.Errorf(\"too much attempts of waiting for network\")\n}", "title": "" } ]
5d4400e18569a9ac02d42c208cdd4e2e
UnmarshalJSON unmarshals this object with a polymorphic type from a JSON structure
[ { "docid": "ccb7fa69f797117ad12894a0280f6dbf", "score": "0.0", "text": "func (m *MTOShipment) UnmarshalJSON(raw []byte) error {\n\tvar data struct {\n\t\tActualPickupDate strfmt.Date `json:\"actualPickupDate,omitempty\"`\n\n\t\tAgents MTOAgents `json:\"agents,omitempty\"`\n\n\t\tApprovedDate strfmt.Date `json:\"approvedDate,omitempty\"`\n\n\t\tCreatedAt strfmt.DateTime `json:\"createdAt,omitempty\"`\n\n\t\tCustomerRemarks *string `json:\"customerRemarks,omitempty\"`\n\n\t\tDestinationAddress *Address `json:\"destinationAddress,omitempty\"`\n\n\t\tDiversion bool `json:\"diversion,omitempty\"`\n\n\t\tETag string `json:\"eTag,omitempty\"`\n\n\t\tFirstAvailableDeliveryDate strfmt.Date `json:\"firstAvailableDeliveryDate,omitempty\"`\n\n\t\tID strfmt.UUID `json:\"id,omitempty\"`\n\n\t\tMoveTaskOrderID strfmt.UUID `json:\"moveTaskOrderID,omitempty\"`\n\n\t\tMtoServiceItems json.RawMessage `json:\"mtoServiceItems\"`\n\n\t\tPickupAddress *Address `json:\"pickupAddress,omitempty\"`\n\n\t\tPointOfContact string `json:\"pointOfContact,omitempty\"`\n\n\t\tPrimeActualWeight int64 `json:\"primeActualWeight,omitempty\"`\n\n\t\tPrimeEstimatedWeight int64 `json:\"primeEstimatedWeight,omitempty\"`\n\n\t\tPrimeEstimatedWeightRecordedDate strfmt.Date `json:\"primeEstimatedWeightRecordedDate,omitempty\"`\n\n\t\tRejectionReason *string `json:\"rejectionReason,omitempty\"`\n\n\t\tRequestedPickupDate strfmt.Date `json:\"requestedPickupDate,omitempty\"`\n\n\t\tRequiredDeliveryDate strfmt.Date `json:\"requiredDeliveryDate,omitempty\"`\n\n\t\tScheduledPickupDate strfmt.Date `json:\"scheduledPickupDate,omitempty\"`\n\n\t\tSecondaryDeliveryAddress *Address `json:\"secondaryDeliveryAddress,omitempty\"`\n\n\t\tSecondaryPickupAddress *Address `json:\"secondaryPickupAddress,omitempty\"`\n\n\t\tShipmentType MTOShipmentType `json:\"shipmentType,omitempty\"`\n\n\t\tStatus string `json:\"status,omitempty\"`\n\n\t\tUpdatedAt strfmt.DateTime `json:\"updatedAt,omitempty\"`\n\t}\n\tbuf := bytes.NewBuffer(raw)\n\tdec := json.NewDecoder(buf)\n\tdec.UseNumber()\n\n\tif err := dec.Decode(&data); err != nil {\n\t\treturn err\n\t}\n\n\tvar propMtoServiceItems []MTOServiceItem\n\tif string(data.MtoServiceItems) != \"null\" {\n\t\tmtoServiceItems, err := UnmarshalMTOServiceItemSlice(bytes.NewBuffer(data.MtoServiceItems), runtime.JSONConsumer())\n\t\tif err != nil && err != io.EOF {\n\t\t\treturn err\n\t\t}\n\t\tpropMtoServiceItems = mtoServiceItems\n\t}\n\n\tvar result MTOShipment\n\n\t// actualPickupDate\n\tresult.ActualPickupDate = data.ActualPickupDate\n\n\t// agents\n\tresult.Agents = data.Agents\n\n\t// approvedDate\n\tresult.ApprovedDate = data.ApprovedDate\n\n\t// createdAt\n\tresult.CreatedAt = data.CreatedAt\n\n\t// customerRemarks\n\tresult.CustomerRemarks = data.CustomerRemarks\n\n\t// destinationAddress\n\tresult.DestinationAddress = data.DestinationAddress\n\n\t// diversion\n\tresult.Diversion = data.Diversion\n\n\t// eTag\n\tresult.ETag = data.ETag\n\n\t// firstAvailableDeliveryDate\n\tresult.FirstAvailableDeliveryDate = data.FirstAvailableDeliveryDate\n\n\t// id\n\tresult.ID = data.ID\n\n\t// moveTaskOrderID\n\tresult.MoveTaskOrderID = data.MoveTaskOrderID\n\n\t// mtoServiceItems\n\tresult.mtoServiceItemsField = propMtoServiceItems\n\n\t// pickupAddress\n\tresult.PickupAddress = data.PickupAddress\n\n\t// pointOfContact\n\tresult.PointOfContact = data.PointOfContact\n\n\t// primeActualWeight\n\tresult.PrimeActualWeight = data.PrimeActualWeight\n\n\t// primeEstimatedWeight\n\tresult.PrimeEstimatedWeight = data.PrimeEstimatedWeight\n\n\t// primeEstimatedWeightRecordedDate\n\tresult.PrimeEstimatedWeightRecordedDate = data.PrimeEstimatedWeightRecordedDate\n\n\t// rejectionReason\n\tresult.RejectionReason = data.RejectionReason\n\n\t// requestedPickupDate\n\tresult.RequestedPickupDate = data.RequestedPickupDate\n\n\t// requiredDeliveryDate\n\tresult.RequiredDeliveryDate = data.RequiredDeliveryDate\n\n\t// scheduledPickupDate\n\tresult.ScheduledPickupDate = data.ScheduledPickupDate\n\n\t// secondaryDeliveryAddress\n\tresult.SecondaryDeliveryAddress = data.SecondaryDeliveryAddress\n\n\t// secondaryPickupAddress\n\tresult.SecondaryPickupAddress = data.SecondaryPickupAddress\n\n\t// shipmentType\n\tresult.ShipmentType = data.ShipmentType\n\n\t// status\n\tresult.Status = data.Status\n\n\t// updatedAt\n\tresult.UpdatedAt = data.UpdatedAt\n\n\t*m = result\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "f4d64ad56c019d0e64b460fb433ae2cb", "score": "0.74276483", "text": "func (m *item) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) {\n\n if data == nil || string(data) == \"null\" {\n return nil, nil\n }\n\n var err error\n switch(m.Type) {\n case \"limit\":\n mm := LimitItem{}\n err = json.Unmarshal(data, &mm)\n return mm, err\n case \"tech\":\n mm := TechSupportItem{}\n err = json.Unmarshal(data, &mm)\n return mm, err\n case \"activity\":\n mm := ActivityItem{}\n err = json.Unmarshal(data, &mm)\n return mm, err\n default:\n return *m, nil\n }\n}", "title": "" }, { "docid": "61bbe8455ed0d29bac91cb2b3d071e95", "score": "0.67059225", "text": "func (p *FieldType) UnmarshalJSON(b []byte) error {\n\tvar j string\n\terr := json.Unmarshal(b, &j)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf, ok := FieldTypeFromItemTypeString(j)\n\tif !ok {\n\t\treturn fmt.Errorf(\"unknown field type: %s\", j)\n\t}\n\t*p = f\n\treturn nil\n}", "title": "" }, { "docid": "e1aa3bd3a2d646357efc4440d3688b19", "score": "0.6606361", "text": "func (b *BaseModel) 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\", b, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &b.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &b.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &b.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\", b, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b8bd33c282f8c2726624888a467aca2d", "score": "0.65810597", "text": "func (t *TargetServiceBase) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", t, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &t.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\", t, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "be148b77d26be1353ad9b5c1e0d7294b", "score": "0.6557246", "text": "func (t *Type) UnmarshalJSON(data []byte) error {\n\ttp := strings.ToUpper(strings.TrimSpace(string(data)))\n\ttyp := NONE\n\tswitch tp {\n\tcase MD5.value:\n\t\ttyp = MD5\n\tcase SHA1.value:\n\t\ttyp = SHA1\n\tcase SHA256.value:\n\t\ttyp = SHA256\n\t}\n\n\tt.value = typ.value\n\tt.Name = typ.Name\n\tt.order = typ.order\n\treturn nil\n}", "title": "" }, { "docid": "af2a6aa58921fbd709c45073d06f9a7e", "score": "0.65351707", "text": "func (p *Parent) UnmarshalJSON(b []byte) error {\n\tm := make(map[string]interface{})\n\tif err := json.Unmarshal(b, &m); err != nil {\n\t\treturn err\n\t}\n\tif t, ok := m[\"type\"].(string); ok {\n\t\tp.Type = ParentTypeEnum(t)\n\t} else {\n\t\treturn fmt.Errorf(\"the type parameter of parent is not a string\")\n\t}\n\n\tif id, ok := m[string(p.Type)].(string); ok {\n\t\tp.ID = id\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7aa66e4eabb985b24d53a44922e273ce", "score": "0.6495733", "text": "func (s *Serialization) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &s.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3c626d9045d2e2dc48a009238a93a423", "score": "0.6458248", "text": "func (v *easyType) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson42239ddeDecodeGithubComLibforJson(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "74cbfc3e3264bcdab386b1fa59a2b503", "score": "0.64451265", "text": "func (m *backuplocation) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) {\n\n\tif data == nil || string(data) == \"null\" {\n\t\treturn nil, nil\n\t}\n\n\tvar err error\n\tswitch m.Destination {\n\tcase \"BUCKET\":\n\t\tmm := BackupLocationBucket{}\n\t\terr = json.Unmarshal(data, &mm)\n\t\treturn mm, err\n\tcase \"PRE_AUTHENTICATED_REQUEST_URI\":\n\t\tmm := BackupLocationUri{}\n\t\terr = json.Unmarshal(data, &mm)\n\t\treturn mm, err\n\tdefault:\n\t\treturn *m, nil\n\t}\n}", "title": "" }, { "docid": "e84f2fb736ca3c12911d143ca4b3bbef", "score": "0.6440499", "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": "f3e12d5db89079c33997048001197113", "score": "0.6439729", "text": "func (t *UpdateType) UnmarshalJSON(s []byte) error {\n\trepresentation := strings.Trim(string(s), \"\\\"\")\n\tswitch representation {\n\tcase \"add\":\n\t\t*t = AddUpdateType\n\tcase \"delete\":\n\t\t*t = DeleteUpdateType\n\tdefault:\n\t\treturn errUpdateType\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0cd95a80dff5ee0fc993ed55ccb84201", "score": "0.64056605", "text": "func (t *BlobType) UnmarshalJSON(buf []byte) error {\n\tswitch string(buf) {\n\tcase `\"data\"`:\n\t\t*t = DataBlob\n\tcase `\"tree\"`:\n\t\t*t = TreeBlob\n\tdefault:\n\t\treturn errors.New(\"unknown blob type\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "79e2b583fc4508a72cbd2bc59b6f40bb", "score": "0.6378019", "text": "func (x *Type) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = Type(num)\n\treturn nil\n}", "title": "" }, { "docid": "ac68425fc5d46404afa50c63f210471c", "score": "0.63650215", "text": "func (m *fsucollectionsummary) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) {\n\n\tif data == nil || string(data) == \"null\" {\n\t\treturn nil, nil\n\t}\n\n\tvar err error\n\tswitch m.Type {\n\tcase \"GI\":\n\t\tmm := GiFsuCollectionSummary{}\n\t\terr = json.Unmarshal(data, &mm)\n\t\treturn mm, err\n\tcase \"DB\":\n\t\tmm := DbFsuCollectionSummary{}\n\t\terr = json.Unmarshal(data, &mm)\n\t\treturn mm, err\n\tdefault:\n\t\tcommon.Logf(\"Recieved unsupported enum value for FsuCollectionSummary: %s.\", m.Type)\n\t\treturn *m, nil\n\t}\n}", "title": "" }, { "docid": "49ccccb7a3832ee17f8daaaef997b152", "score": "0.636347", "text": "func (t *ActivityType) UnmarshalJSON(bytes []byte) error {\n\tt.ObjectType = NewObject()\n\tt.activity = &activityType{}\n\n\treturn UnmarshalJSON(bytes, t.ObjectType, t.activity)\n}", "title": "" }, { "docid": "62c253846db1740dd70651269a77eee1", "score": "0.6353741", "text": "func (t *LoRaUplinkType) UnmarshalJSON(b []byte) error {\n\tvar tp string\n\terr := json.Unmarshal(b, &tp)\n\tif err != nil {\n\t\treturn err\n\t}\n\tswitch tp {\n\tcase uplinkUplinkType:\n\t\t*t = UplinkUplinkType\n\tcase modemUplinkType:\n\t\t*t = ModemUplinkType\n\tcase joiningUplinkType:\n\t\t*t = JoiningUplinkType\n\tcase gnssUplinkType:\n\t\t*t = GNSSUplinkType\n\tcase wifiUplinkType:\n\t\t*t = WiFiUplinkType\n\tdefault:\n\t\t*t = UnknownUplinkType\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "84815dddd6ab83dca992994de7df2b88", "score": "0.6349568", "text": "func (i *MatcherType) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn fmt.Errorf(\"MatcherType should be a string, got %s\", data)\n\t}\n\n\tvar err error\n\t*i, err = ParseMatcherTypeString(s)\n\treturn err\n}", "title": "" }, { "docid": "7760631277da4f79b590ddb26bfffab1", "score": "0.6331941", "text": "func (r *TempBasalType) UnmarshalJSON(data []byte) error {\n\tvar err error\n\tswitch string(data) {\n\tcase `\"Absolute\"`:\n\t\t*r = Absolute\n\tcase `\"Percent\"`:\n\t\t*r = Percent\n\tdefault:\n\t\terr = fmt.Errorf(\"unknown TempBasalType (%s)\", data)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "6f07ab648b7b659703482bb13aea60f8", "score": "0.6328508", "text": "func (x *ImagesServiceTransform_Type) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = ImagesServiceTransform_Type(num)\n\treturn nil\n}", "title": "" }, { "docid": "53d887735a2dadba4b10023f0a2fa4bf", "score": "0.6322234", "text": "func (s *SecretInfoBase) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"secretType\":\n\t\t\terr = unpopulate(val, \"SecretType\", &s.SecretType)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "12407ba8262936855bdbfb417200eb18", "score": "0.6321685", "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": "67b2fec17152c9f63ee38aed2ffbc49d", "score": "0.63204396", "text": "func (m *Action) UnmarshalJSON(b []byte) (err error) {\n\ttype discriminator struct {\n\t\tKind string `json:\"kind\"`\n\t}\n\tvar d discriminator\n\terr = json.Unmarshal(b, &d)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Resolve into respective struct based on the discriminator value\n\tswitch d.Kind {\n\tcase \"email\":\n\t\tm.emailAction = &EmailAction{}\n\t\treturn json.Unmarshal(b, m.emailAction)\n\tcase \"webhook\":\n\t\tm.webhookAction = &WebhookAction{}\n\t\treturn json.Unmarshal(b, m.webhookAction)\n\t}\n\t// Unknown discriminator value (this type may not yet be supported)\n\t// unmarhsal to raw interface\n\tvar raw interface{}\n\terr = json.Unmarshal(b, &raw)\n\tif err != nil {\n\t\treturn err\n\t}\n\tm.raw = raw\n\treturn nil\n}", "title": "" }, { "docid": "e9084801781850f941744f8d380fb1dd", "score": "0.63095963", "text": "func (s *Sub) UnmarshalJSON(data []byte) error {\r\n\ttype sub Sub\r\n\tvar ss sub\r\n\terr := json.Unmarshal(data, &ss)\r\n\tif err == nil {\r\n\t\t*s = Sub(ss)\r\n\t} else {\r\n\t\t// the id is surrounded by \"\\\" characters, so strip them\r\n\t\ts.ID = string(data[1 : len(data)-1])\r\n\t}\r\n\r\n\treturn nil\r\n}", "title": "" }, { "docid": "a6c3a36e6a2c3b2b71a1661819da2a13", "score": "0.62711674", "text": "func (v *WidgetVizType) 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 = WidgetVizType(value)\n\treturn nil\n}", "title": "" }, { "docid": "8afe867e054553603ee41c8123356faf", "score": "0.62497866", "text": "func (dt *Type) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn fmt.Errorf(\"Filed type should be a string, got %s\", data)\n\t}\n\n\tt := TypeFromString(s)\n\n\tif t == TypeUnknown {\n\t\treturn fmt.Errorf(\"Unknown datatype '%s'\", s)\n\t}\n\n\t*dt = t\n\treturn nil\n}", "title": "" }, { "docid": "523eb815e387cf090700a8f048124e05", "score": "0.62473315", "text": "func (m *dashboard) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) {\n\n\tif data == nil || string(data) == \"null\" {\n\t\treturn nil, nil\n\t}\n\n\tvar err error\n\tswitch m.SchemaVersion {\n\tcase \"V1\":\n\t\tmm := V1Dashboard{}\n\t\terr = json.Unmarshal(data, &mm)\n\t\treturn mm, err\n\tdefault:\n\t\tcommon.Logf(\"Recieved unsupported enum value for Dashboard: %s.\", m.SchemaVersion)\n\t\treturn *m, nil\n\t}\n}", "title": "" }, { "docid": "1cafd6bf2afb7a59c349f2738958259b", "score": "0.6241103", "text": "func (u *TemplateFilterBase) UnmarshalJSON(body []byte) error {\n\ttype wrap struct {\n\t\tdropbox.Tagged\n\t\t// FilterSome : Only templates with an ID in the supplied list will be\n\t\t// returned (a subset of templates will be returned).\n\t\tFilterSome []string `json:\"filter_some,omitempty\"`\n\t}\n\tvar w wrap\n\tvar err error\n\tif err = json.Unmarshal(body, &w); err != nil {\n\t\treturn err\n\t}\n\tu.Tag = w.Tag\n\tswitch u.Tag {\n\tcase \"filter_some\":\n\t\tu.FilterSome = w.FilterSome\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7abc2e9fa97e01b4c3897539ff6d7278", "score": "0.62278396", "text": "func (a *okxAssetType) UnmarshalJSON(data []byte) error {\n\tvar t string\n\terr := json.Unmarshal(data, &t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ta.Item = GetAssetTypeFromInstrumentType(strings.ToUpper(t))\n\treturn nil\n}", "title": "" }, { "docid": "3e27ed8973aab859cb0ca07b12592d41", "score": "0.62218946", "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": "88d5e96c2dd5525182f3eed85f836b18", "score": "0.62186027", "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": "a44a0f4d2bb53cd1a2d1ee14e64d74e4", "score": "0.6211855", "text": "func (responseType *ResponseType) UnmarshalJSON(b []byte) error {\n\tvar str string\n\tif err := json.Unmarshal(b, &str); err != nil {\n\t\treturn err\n\t}\n\treturn responseType.UnmarshalString(str)\n}", "title": "" }, { "docid": "334ade55ffcd1b6e65a825f25dc0fb35", "score": "0.6210298", "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": "f9f05ebc0750c97f478797f36b420aac", "score": "0.61818486", "text": "func (x *NamePart_Type) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = NamePart_Type(num)\n\treturn nil\n}", "title": "" }, { "docid": "233bad1b6f048f08e0bd745afc5da63f", "score": "0.6180393", "text": "func (targetType *TargetType) UnmarshalJSON(byteResult []byte) error {\n\tvar stringValue string\n\tif err := json.Unmarshal(byteResult, &stringValue); err != nil {\n\t\treturn err\n\t}\n\n\ttypes := map[string]TargetType{\n\t\t\"\": TargetType(0),\n\t\tendpoint: ManagedEndpoint,\n\t\tdg: DynamicGroup,\n\t\tsite: Site,\n\t\tdynamicSite: DynamicSite,\n\t}\n\n\tvar ok bool\n\t*targetType, ok = types[stringValue]\n\tif !ok {\n\t\treturn fmt.Errorf(\"incorrect Type of Targets: %s\", stringValue)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6abdcd9c971e0ca151a46b945fa13f49", "score": "0.61774844", "text": "func (m *TUF) UnmarshalJSON(raw []byte) error {\n\tvar data struct {\n\n\t\t// api version\n\t\t// Required: true\n\t\t// Pattern: ^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$\n\t\tAPIVersion *string `json:\"apiVersion\"`\n\n\t\t// spec\n\t\t// Required: true\n\t\tSpec TUFSchema `json:\"spec\"`\n\t}\n\tbuf := bytes.NewBuffer(raw)\n\tdec := json.NewDecoder(buf)\n\tdec.UseNumber()\n\n\tif err := dec.Decode(&data); err != nil {\n\t\treturn err\n\t}\n\n\tvar base struct {\n\t\t/* Just the base type fields. Used for unmashalling polymorphic types.*/\n\n\t\tKind string `json:\"kind\"`\n\t}\n\tbuf = bytes.NewBuffer(raw)\n\tdec = json.NewDecoder(buf)\n\tdec.UseNumber()\n\n\tif err := dec.Decode(&base); err != nil {\n\t\treturn err\n\t}\n\n\tvar result TUF\n\n\tif base.Kind != result.Kind() {\n\t\t/* Not the type we're looking for. */\n\t\treturn errors.New(422, \"invalid kind value: %q\", base.Kind)\n\t}\n\n\tresult.APIVersion = data.APIVersion\n\tresult.Spec = data.Spec\n\n\t*m = result\n\n\treturn nil\n}", "title": "" }, { "docid": "e057c18b3aec055f6e8f3f2833a81ae7", "score": "0.6175256", "text": "func (x *ETeamFanContentAssetType) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = ETeamFanContentAssetType(num)\n\treturn nil\n}", "title": "" }, { "docid": "1fd4fd9b9daea7a08d60273f5fb85506", "score": "0.6153965", "text": "func (a *AttributeTypeAndValue) UnmarshalJSON(b []byte) error {\n\taux := auxAttributeTypeAndValue{}\n\tif err := json.Unmarshal(b, &aux); err != nil {\n\t\treturn err\n\t}\n\ta.Type = nil\n\tif len(aux.Type) > 0 {\n\t\tparts := strings.Split(aux.Type, \".\")\n\t\tfor _, part := range parts {\n\t\t\ti, err := strconv.Atoi(part)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ta.Type = append(a.Type, i)\n\t\t}\n\t}\n\ta.Value = aux.Value\n\treturn nil\n}", "title": "" }, { "docid": "7ddfa923953af75db239e1570a43195e", "score": "0.61537594", "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.61537594", "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": "cd580942e6c29744c13b3179c081a3de", "score": "0.6153062", "text": "func (x *PeerType) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = PeerType(num)\n\treturn nil\n}", "title": "" }, { "docid": "f58026e7396560bcbed47111ae522ea5", "score": "0.61502063", "text": "func (x *QueryType) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = QueryType(num)\n\treturn nil\n}", "title": "" }, { "docid": "c4123caa370d3636ac84cc8c0ef9d879", "score": "0.6141579", "text": "func (n *InterfaceCommon) UnmarshalJSON(b []byte) error {\n\tn.P, n.Error = nil, nil\n\tvar value interface{}\n\tif err := json.Unmarshal(b, &value); err != nil {\n\t\tn.Error = err\n\t\treturn err\n\t}\n\tif value == nil {\n\t\treturn nil\n\t}\n\tn.P = value\n\treturn nil\n}", "title": "" }, { "docid": "3afcec1ef9707e4e1d086e6473221509", "score": "0.6139347", "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": "07edf180a27b04dc4df6649253f1a43d", "score": "0.613204", "text": "func (c *Channel) UnmarshalJSON(b []byte) error {\n\tvar raw map[string]interface{}\n\tif err := json.Unmarshal(b, &raw); err != nil {\n\t\treturn err\n\t}\n\tct, ok := raw[\"type\"]\n\tif ok {\n\t\tc.Type = ct.(string)\n\t\tc.Raw = raw\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f113f5c10e17575e00dc79c479d9f15b", "score": "0.6131106", "text": "func (r *RequestType) UnmarshalJSON(data []byte) error {\n\trt := RequestTypeUndefined\n\t// Convert to string whilst removing quotes\n\tx := string(data)[1 : len(data)-1]\n\t// Find the type in the range of values\n\tfor i, s := range requestTypeStrings {\n\t\tif strings.ToLower(s) == strings.ToLower(x) {\n\t\t\trt = RequestType(i)\n\t\t}\n\t}\n\t*r = rt\n\treturn nil\n}", "title": "" }, { "docid": "986fdc4b1457290ffb8f0434b23341a8", "score": "0.61273295", "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": "60e1704eb6a23869694b282ad16e785e", "score": "0.6124545", "text": "func (a *AuthInfoBase) 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\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"authType\":\n\t\t\terr = unpopulate(val, \"AuthType\", &a.AuthType)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "abfe84080a4836e91a470e3de0f869cc", "score": "0.6122797", "text": "func (obj *ProductTypeUpdate) UnmarshalJSON(data []byte) error {\n\ttype Alias ProductTypeUpdate\n\tif err := json.Unmarshal(data, (*Alias)(obj)); err != nil {\n\t\treturn err\n\t}\n\tfor i := range obj.Actions {\n\t\tvar err error\n\t\tobj.Actions[i], err = mapDiscriminatorProductTypeUpdateAction(obj.Actions[i])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2288c3b2cd845560ec0cd49349ad9fcc", "score": "0.6120657", "text": "func (obj *expRelationshipType) UnmarshalJSON(data []byte) error {\n\tvar ok bool\n\tif *obj, ok = genJSONStrToRelationshipType[noQuotes(data)]; !ok {\n\t\treturn fmt.Errorf(\"unrecognized RelationshipType value %v\", string(data))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8c412e46d79bf097be448f308190b1ee", "score": "0.6118367", "text": "func (t *memoryType) UnmarshalJSON(data []byte) error {\n\tival := 0\n\tif err := json.Unmarshal(data, &ival); err == nil {\n\t\t*t = memoryType(ival)\n\t\treturn nil\n\t}\n\n\tvalue := \"\"\n\tif err := json.Unmarshal(data, &value); err != nil {\n\t\treturn policyError(\"failed to unmarshal memoryType '%s': %v\",\n\t\t\tstring(data), err)\n\t}\n\n\tmtype, err := parseMemoryType(value)\n\tif err != nil {\n\t\treturn policyError(\"failed parse memoryType '%s': %v\", value, err)\n\t}\n\n\t*t = mtype\n\treturn nil\n}", "title": "" }, { "docid": "75e3154797bad07bc52d6c279ef5f304", "score": "0.6108762", "text": "func (m *Type2) UnmarshalJSON(raw []byte) error {\n\tvar data struct {\n\t\tType string `json:\"type,omitempty\"`\n\n\t\t/* length\n\t\t */\n\t\tLength int64 `json:\"length,omitempty\"`\n\t}\n\n\tbuf := bytes.NewBuffer(raw)\n\tdec := json.NewDecoder(buf)\n\tdec.UseNumber()\n\n\tif err := dec.Decode(&data); err != nil {\n\t\treturn err\n\t}\n\n\tm.Length = data.Length\n\n\treturn nil\n}", "title": "" }, { "docid": "d97f5552e2c87ea5b4c5418235d37799", "score": "0.6105359", "text": "func (v *PostUniverseIdsInventoryType) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD77d07e3DecodeGithubComAntihaxGoesiEsi1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "5af6816f562e54070e2a117e69e6e176", "score": "0.6091199", "text": "func (rt *ResourceType) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar v *json.RawMessage\n\n\tv = m[\"properties\"]\n\tif v != nil {\n\t\tvar properties ReadableProperties\n\t\terr = json.Unmarshal(*m[\"properties\"], &properties)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\trt.ReadableProperties = &properties\n\t}\n\n\tv = m[\"id\"]\n\tif v != nil {\n\t\tvar ID string\n\t\terr = json.Unmarshal(*m[\"id\"], &ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\trt.ID = &ID\n\t}\n\n\tv = m[\"name\"]\n\tif v != nil {\n\t\tvar name string\n\t\terr = json.Unmarshal(*m[\"name\"], &name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\trt.Name = &name\n\t}\n\n\tv = m[\"type\"]\n\tif v != nil {\n\t\tvar typeVar string\n\t\terr = json.Unmarshal(*m[\"type\"], &typeVar)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\trt.Type = &typeVar\n\t}\n\n\tv = m[\"location\"]\n\tif v != nil {\n\t\tvar location string\n\t\terr = json.Unmarshal(*m[\"location\"], &location)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\trt.Location = &location\n\t}\n\n\tv = m[\"tags\"]\n\tif v != nil {\n\t\tvar tags map[string]*string\n\t\terr = json.Unmarshal(*m[\"tags\"], &tags)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\trt.Tags = &tags\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e8bf44134c15c559736087d5487d77c4", "score": "0.6089183", "text": "func (rt *ResourceType) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range m {\n\t\tswitch k {\n\t\tcase \"properties\":\n\t\t\tif v != nil {\n\t\t\t\tvar readableProperties ReadableProperties\n\t\t\t\terr = json.Unmarshal(*v, &readableProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\trt.ReadableProperties = &readableProperties\n\t\t\t}\n\t\tcase \"id\":\n\t\t\tif v != nil {\n\t\t\t\tvar ID string\n\t\t\t\terr = json.Unmarshal(*v, &ID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\trt.ID = &ID\n\t\t\t}\n\t\tcase \"name\":\n\t\t\tif v != nil {\n\t\t\t\tvar name string\n\t\t\t\terr = json.Unmarshal(*v, &name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\trt.Name = &name\n\t\t\t}\n\t\tcase \"type\":\n\t\t\tif v != nil {\n\t\t\t\tvar typeVar string\n\t\t\t\terr = json.Unmarshal(*v, &typeVar)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\trt.Type = &typeVar\n\t\t\t}\n\t\tcase \"location\":\n\t\t\tif v != nil {\n\t\t\t\tvar location string\n\t\t\t\terr = json.Unmarshal(*v, &location)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\trt.Location = &location\n\t\t\t}\n\t\tcase \"tags\":\n\t\t\tif v != nil {\n\t\t\t\tvar tags map[string]*string\n\t\t\t\terr = json.Unmarshal(*v, &tags)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\trt.Tags = tags\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c1752d46dcc868a02b8096a7f60e7487", "score": "0.608344", "text": "func (pt *PersistenceType) UnmarshalJSON(data []byte) error {\n\tvar j string\n\terr := json.Unmarshal(data, &j)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresult, ok := persistenceTypeToEnum[j]\n\tif !ok {\n\t\treturn errors.New(\"couldn't find matching PersistenceType enum value\")\n\t}\n\n\t*pt = result\n\treturn nil\n}", "title": "" }, { "docid": "24713b980f6ebea7394edf7630d220e5", "score": "0.6076802", "text": "func (x *EChatRoomType) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = EChatRoomType(num)\n\treturn nil\n}", "title": "" }, { "docid": "3e56bde33416f128b630fe05e73f8d9c", "score": "0.6067885", "text": "func (o *DataItemViber) UnmarshalJSON(raw []byte) error {\n\t// AO0\n\tvar dataAO0 struct {\n\t\tID string `json:\"ID,omitempty\"`\n\n\t\tType string `json:\"type,omitempty\"`\n\t}\n\tif err := swag.ReadJSON(raw, &dataAO0); err != nil {\n\t\treturn err\n\t}\n\n\to.ID = dataAO0.ID\n\n\to.Type = dataAO0.Type\n\n\t// AO1\n\tvar aO1 models.ChannelParamsViber\n\tif err := swag.ReadJSON(raw, &aO1); err != nil {\n\t\treturn err\n\t}\n\to.ChannelParamsViber = aO1\n\n\treturn nil\n}", "title": "" }, { "docid": "c8e843d9c1c9c6e51c372c0e88ccbb18", "score": "0.6059031", "text": "func (x *CloseType) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = CloseType(num)\n\treturn nil\n}", "title": "" }, { "docid": "3694e828a781bddc808c6bf5af5857c2", "score": "0.60559076", "text": "func (x *FrameType) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = FrameType(num)\n\treturn nil\n}", "title": "" }, { "docid": "71798c7707793c4ad57c02bad57dec33", "score": "0.6054087", "text": "func (f *If) 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*f = If(sch)\n\treturn nil\n}", "title": "" }, { "docid": "ed6660690a91635697a596842c240b05", "score": "0.60509384", "text": "func (a *AzureResourcePropertiesBase) 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\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &a.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\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d0dfe2e12a1eb5a3a8b637da79b7ef6a", "score": "0.60343444", "text": "func (p *Payment) UnmarshalJSON(data []byte) error {\n\terr := json.Unmarshal(data, &p.paymentData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar detail Detail\n\tif p.Type == \"ach\" {\n\t\tdetail = new(achDetail)\n\t} else if p.Type == \"credit_card\" {\n\t\tdetail = new(cardDetail)\n\t} else {\n\t\treturn fmt.Errorf(\"unrecognized type\")\n\t}\n\n\terr = json.Unmarshal(p.paymentData.Detail, detail)\n\tif err != nil {\n\t\treturn err\n\t}\n\tp.Detail = detail\n\treturn nil\n}", "title": "" }, { "docid": "32a08ccce851236f3748062f542b3ab0", "score": "0.60339916", "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": "91f2ba6963e429ece13b883033f7058a", "score": "0.6029077", "text": "func (v *GetUniverseTypesTypeIdOk) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson2d81da92DecodeGithubComAntihaxGoesiEsi1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "738f9fa15128fb78c6229a2cd911400c", "score": "0.6028506", "text": "func (bt *BettingType) UnmarshalJSON(data []byte) error {\n\tvar j string\n\terr := json.Unmarshal(data, &j)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresult, ok := bettingTypeToEnum[j]\n\tif !ok {\n\t\treturn errors.New(\"couldn't find matching BettingType enum value\")\n\t}\n\n\t*bt = result\n\treturn nil\n}", "title": "" }, { "docid": "6557ba6ef9c56b699d813522ca5b055e", "score": "0.60278374", "text": "func (rt *RecordType) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn err\n\t}\n\tt, err := recordTypeParse(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*rt = *t\n\treturn nil\n}", "title": "" }, { "docid": "6ae02c0fc5db3ff53b1b90ad277bb774", "score": "0.60182375", "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": "629e6bd81817411606301d9d66585e52", "score": "0.6014538", "text": "func (powercontrol *PowerControl) UnmarshalJSON(b []byte) error { //nolint:dupl\n\ttype temp PowerControl\n\ttype t1 struct {\n\t\ttemp\n\t}\n\tvar t t1\n\n\terr := json.Unmarshal(b, &t)\n\tif err != nil {\n\t\t// See if we need to handle converting MemberID\n\t\tvar t2 struct {\n\t\t\tt1\n\t\t\tMemberID int `json:\"MemberId\"`\n\t\t}\n\t\terr2 := json.Unmarshal(b, &t2)\n\n\t\tif err2 != nil {\n\t\t\t// Return the original error\n\t\t\treturn err\n\t\t}\n\n\t\t// Convert the numeric member ID to a string\n\t\tt = t2.t1\n\t\tt.temp.MemberID = strconv.Itoa(t2.MemberID)\n\t}\n\n\t// Extract the links to other entities for later\n\t*powercontrol = PowerControl(t.temp)\n\n\treturn nil\n}", "title": "" }, { "docid": "08bb2a499fd6163e72a87280be5d7915", "score": "0.6012331", "text": "func (v *BaseObjectWithName) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC7452bc1DecodeGithubComStek29Vk86(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "7fbd62795420fe97d9a071f3dc6ab0e6", "score": "0.6010298", "text": "func (command *Command) UnmarshalJSON(data []byte) error {\n\n\t// Helper struct to get type\n\ttemp := struct {\n\t\tType string `json:\"type\"`\n\t}{}\n\tif err := json.Unmarshal(data, &temp); err != nil {\n\t\treturn err\n\t}\n\n\tif temp.Type == \"GetStatus\" {\n\t\tcommand.GetStatus = &GetStatus{}\n\n\t} else if temp.Type == \"Connect\" {\n\t\terr := json.Unmarshal(data, &command.Connect)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t} else if temp.Type == \"Disconnect\" {\n\t\tcommand.Disconnect = &Disconnect{}\n\n\t} else if temp.Type == \"Discover\" {\n\n\t\terr := json.Unmarshal(data, &command.Discover)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t} else {\n\t\treturn errors.New(\"can not decode unknown command\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "90aeaf99d95ce81e623f1733bbe9cf71", "score": "0.60038424", "text": "func (s *Source) UnmarshalJSON(data []byte) error {\n\ttype source Source\n\tvar v source\n\tif err := json.Unmarshal(data, &v); err != nil {\n\t\treturn err\n\t}\n\t*s = Source(v)\n\n\tvar raw map[string]interface{}\n\tif err := json.Unmarshal(data, &raw); err != nil {\n\t\treturn err\n\t}\n\n\tif d, ok := raw[s.Type]; ok {\n\t\tif m, ok := d.(map[string]interface{}); ok {\n\t\t\ts.TypeData = m\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "83db67abdc9f9fba03eb0fb3bf789b0c", "score": "0.5993248", "text": "func (i *ItemFull) UnmarshalJSON(data []byte) error {\n\t// Step 1.\n\tfields := map[string]interface{}{}\n\terr := json.Unmarshal(data, &fields)\n\tif err != nil {\n\t\treturn errors.New(\"invalid JSON in item data\")\n\t}\n\n\t*i = ItemFull{}\n\t// Step 2 - Format owner as UserModel.Info struct\n\trawOwner, ok := fields[\"owner\"]\n\tif ok {\n\t\tjsonOwner, err := json.Marshal(rawOwner)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\towner := model.Info{}\n\t\tif err = json.Unmarshal(jsonOwner, &owner); err != nil {\n\t\t\treturn err\n\t\t}\n\t\ti.Owner = &owner\n\n\t}\n\n\tchassis.StringField(&i.ID, fields, \"id\")\n\tchassis.StringField(&i.Slug, fields, \"slug\")\n\ttmp := \"\"\n\tchassis.StringField(&tmp, fields, \"item_type\")\n\tif err = i.ItemType.FromString(tmp); err != nil {\n\t\treturn errors.New(\"invalid item type '\" + tmp + \"'\")\n\t}\n\n\tchassis.StringField(&i.Lang, fields, \"lang\")\n\tchassis.StringField(&i.Name, fields, \"name\")\n\tchassis.StringField(&i.Description, fields, \"description\")\n\tchassis.StringField(&i.FeaturedPicture, fields, \"featured_picture\")\n\n\t// we are deleting this fields because they are not needed when calling internally\n\tdelete(fields, \"upvotes\")\n\tdelete(fields, \"user_upvoted\")\n\tdelete(fields, \"rank\")\n\tdelete(fields, \"collections\")\n\tdelete(fields, \"links\")\n\n\t// Step 7.\n\ti.Attrs = fields\n\n\treturn nil\n}", "title": "" }, { "docid": "66c5359648c7e2f5b9f77d4c2ccd634f", "score": "0.59882736", "text": "func (dst *CloudBaseSkuRelationship) UnmarshalJSON(data []byte) error {\n\tvar err error\n\t// this object is nullable so check if the payload is null or empty string\n\tif string(data) == \"\" || string(data) == \"{}\" {\n\t\treturn nil\n\t}\n\n\t// use discriminator value to speed up the lookup\n\tvar jsonDict map[string]interface{}\n\terr = newStrictDecoder(data).Decode(&jsonDict)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to unmarshal JSON into map for the discriminator lookup.\")\n\t}\n\n\t// check if the discriminator value is 'cloud.BaseSku'\n\tif jsonDict[\"ClassId\"] == \"cloud.BaseSku\" {\n\t\t// try to unmarshal JSON data into CloudBaseSku\n\t\terr = json.Unmarshal(data, &dst.CloudBaseSku)\n\t\tif err == nil {\n\t\t\treturn nil // data stored in dst.CloudBaseSku, return on the first match\n\t\t} else {\n\t\t\tdst.CloudBaseSku = nil\n\t\t\treturn fmt.Errorf(\"Failed to unmarshal CloudBaseSkuRelationship as CloudBaseSku: %s\", err.Error())\n\t\t}\n\t}\n\n\t// check if the discriminator value is 'mo.MoRef'\n\tif jsonDict[\"ClassId\"] == \"mo.MoRef\" {\n\t\t// try to unmarshal JSON data into MoMoRef\n\t\terr = json.Unmarshal(data, &dst.MoMoRef)\n\t\tif err == nil {\n\t\t\treturn nil // data stored in dst.MoMoRef, return on the first match\n\t\t} else {\n\t\t\tdst.MoMoRef = nil\n\t\t\treturn fmt.Errorf(\"Failed to unmarshal CloudBaseSkuRelationship as MoMoRef: %s\", err.Error())\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a695e742ceaa5695ddb2a1bc0eb52574", "score": "0.59870243", "text": "func (v *ItemUnion) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeGithubComRestreamGophercon2019FtTesterModels1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "58ab619a579450ee5324b0176cb594e7", "score": "0.5981851", "text": "func (r *CarbUnitsType) UnmarshalJSON(data []byte) error {\n\tvar err error\n\tswitch string(data) {\n\tcase `\"Grams\"`:\n\t\t*r = Grams\n\tcase `\"Exchanges\"`:\n\t\t*r = Exchanges\n\tdefault:\n\t\terr = fmt.Errorf(\"unknown CarbUnitsType (%s)\", data)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "2423f0b034b1e4a855e6a78ee7e54bd6", "score": "0.59805155", "text": "func (v *MessageTypingState) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC7452bc1DecodeGithubComStek29Vk40(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "f481c34b713758542d3940d6f84e008e", "score": "0.59793985", "text": "func (v *Post) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeForumApplicationModels11(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "9f0f66946c1bfc40c84d3c27eddea5ab", "score": "0.5978603", "text": "func (p *Provider) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range m {\n\t\tswitch k {\n\t\tcase \"properties\":\n\t\t\tif v != nil {\n\t\t\t\tvar statusResult StatusResult\n\t\t\t\terr = json.Unmarshal(*v, &statusResult)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tp.StatusResult = &statusResult\n\t\t\t}\n\t\tcase \"tags\":\n\t\t\tif v != nil {\n\t\t\t\tvar tags map[string]*string\n\t\t\t\terr = json.Unmarshal(*v, &tags)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tp.Tags = tags\n\t\t\t}\n\t\tcase \"location\":\n\t\t\tif v != nil {\n\t\t\t\tvar location string\n\t\t\t\terr = json.Unmarshal(*v, &location)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tp.Location = &location\n\t\t\t}\n\t\tcase \"id\":\n\t\t\tif v != nil {\n\t\t\t\tvar ID string\n\t\t\t\terr = json.Unmarshal(*v, &ID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tp.ID = &ID\n\t\t\t}\n\t\tcase \"name\":\n\t\t\tif v != nil {\n\t\t\t\tvar name string\n\t\t\t\terr = json.Unmarshal(*v, &name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tp.Name = &name\n\t\t\t}\n\t\tcase \"type\":\n\t\t\tif v != nil {\n\t\t\t\tvar typeVar string\n\t\t\t\terr = json.Unmarshal(*v, &typeVar)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tp.Type = &typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "174ed52302d6774b3ab6c99989b57e50", "score": "0.59769666", "text": "func (v *BaseResponse) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC5a4559bDecodeBattleshipAppGeneratedModels14(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "fb5dc6f739801e79acfe28d95c84609e", "score": "0.59707737", "text": "func (v *Actor) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonA97f39aeDecodeGithubComGoParkMailRu20202JigglypufInternalPkgModels8(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "203dd39ddbf528bf295b51965c507aec", "score": "0.5968124", "text": "func (st *SegmentType) UnmarshalJSON(data []byte) error {\n\tvar j string\n\terr := json.Unmarshal(data, &j)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresult, ok := segmentTypeToEnum[j]\n\tif !ok {\n\t\treturn errors.New(\"couldn't find matching SegmentType enum value\")\n\t}\n\n\t*st = result\n\treturn nil\n}", "title": "" }, { "docid": "25b1246babadcebc25d8be285d4b615b", "score": "0.5961175", "text": "func (rid *RelationID) UnmarshalJSON(b []byte) error {\n\tr := new(relationID)\n\tif err := unmarshalJSONFlattenByType(b, r); err != nil {\n\t\treturn err\n\t}\n\n\t*rid = RelationID(*r)\n\treturn nil\n}", "title": "" }, { "docid": "91716cc4c556826b37e0dc5ba48a612e", "score": "0.59428304", "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": "05bcfc664d884a07f61c649dc08fcc80", "score": "0.59427637", "text": "func (x *NetworkDevice_TypeId) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = NetworkDevice_TypeId(num)\n\treturn nil\n}", "title": "" }, { "docid": "6026dcbb6e7346352a52cf07d16b5f04", "score": "0.5940631", "text": "func (v *Vote) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeForumApplicationModels(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "9f7dbc63bae53150dac2c6c30376d729", "score": "0.5940609", "text": "func (u *Unstructured) UnmarshalJSON(b []byte) error {\n\treturn json.Unmarshal(b, &u.Object)\n}", "title": "" }, { "docid": "74aaab48bb13acf1f76259a2e0a18429", "score": "0.5939327", "text": "func (v *WidgetSummaryType) 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 = WidgetSummaryType(value)\n\treturn nil\n}", "title": "" }, { "docid": "f07bf73cce2b42b2bcebf52c07b49422", "score": "0.59389234", "text": "func (p *ParquetSerialization) 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\", p, 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\", &p.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &p.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\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f07bf73cce2b42b2bcebf52c07b49422", "score": "0.59389234", "text": "func (p *ParquetSerialization) 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\", p, 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\", &p.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &p.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\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "00524ffdc541c21f77e9509ca134233d", "score": "0.5937672", "text": "func (f *File) UnmarshalJSON(b []byte) error {\n\tff := new(file)\n\tif err := unmarshalJSONFlattenByType(b, ff); err != nil {\n\t\treturn err\n\t}\n\n\t*f = File(*ff)\n\treturn nil\n}", "title": "" }, { "docid": "8fc359a7750b2be9198e10daa82fc4e3", "score": "0.59322536", "text": "func (e *ShadowRootType) UnmarshalJSON(data []byte) error {\n\tswitch string(data) {\n\tcase \"null\":\n\t\t*e = 0\n\tcase \"\\\"user-agent\\\"\":\n\t\t*e = 1\n\tcase \"\\\"open\\\"\":\n\t\t*e = 2\n\tcase \"\\\"closed\\\"\":\n\t\t*e = 3\n\tdefault:\n\t\treturn fmt.Errorf(\"dom.ShadowRootType: UnmarshalJSON on bad input: %s\", data)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "66ae89accfad33f11f7d3fea09fe3ab4", "score": "0.5928868", "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": "1304ddf4be7c6b1558d4e69aec586bf2", "score": "0.59265083", "text": "func (u *EventType) UnmarshalJSON(body []byte) error {\n\ttype wrap struct {\n\t\tdropbox.Tagged\n\t}\n\tvar w wrap\n\tvar err error\n\tif err = json.Unmarshal(body, &w); err != nil {\n\t\treturn err\n\t}\n\tu.Tag = w.Tag\n\tswitch u.Tag {\n\tcase \"admin_alerting_alert_state_changed\":\n\t\tif err = json.Unmarshal(body, &u.AdminAlertingAlertStateChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"admin_alerting_changed_alert_config\":\n\t\tif err = json.Unmarshal(body, &u.AdminAlertingChangedAlertConfig); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"admin_alerting_triggered_alert\":\n\t\tif err = json.Unmarshal(body, &u.AdminAlertingTriggeredAlert); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"app_blocked_by_permissions\":\n\t\tif err = json.Unmarshal(body, &u.AppBlockedByPermissions); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"app_link_team\":\n\t\tif err = json.Unmarshal(body, &u.AppLinkTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"app_link_user\":\n\t\tif err = json.Unmarshal(body, &u.AppLinkUser); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"app_unlink_team\":\n\t\tif err = json.Unmarshal(body, &u.AppUnlinkTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"app_unlink_user\":\n\t\tif err = json.Unmarshal(body, &u.AppUnlinkUser); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"integration_connected\":\n\t\tif err = json.Unmarshal(body, &u.IntegrationConnected); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"integration_disconnected\":\n\t\tif err = json.Unmarshal(body, &u.IntegrationDisconnected); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_add_comment\":\n\t\tif err = json.Unmarshal(body, &u.FileAddComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_change_comment_subscription\":\n\t\tif err = json.Unmarshal(body, &u.FileChangeCommentSubscription); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_delete_comment\":\n\t\tif err = json.Unmarshal(body, &u.FileDeleteComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_edit_comment\":\n\t\tif err = json.Unmarshal(body, &u.FileEditComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_like_comment\":\n\t\tif err = json.Unmarshal(body, &u.FileLikeComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_resolve_comment\":\n\t\tif err = json.Unmarshal(body, &u.FileResolveComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_unlike_comment\":\n\t\tif err = json.Unmarshal(body, &u.FileUnlikeComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_unresolve_comment\":\n\t\tif err = json.Unmarshal(body, &u.FileUnresolveComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_add_folders\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyAddFolders); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_add_folder_failed\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyAddFolderFailed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_content_disposed\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyContentDisposed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_create\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyCreate); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_delete\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyDelete); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_edit_details\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyEditDetails); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_edit_duration\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyEditDuration); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_export_created\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyExportCreated); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_export_removed\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyExportRemoved); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_remove_folders\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyRemoveFolders); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_report_created\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyReportCreated); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"governance_policy_zip_part_downloaded\":\n\t\tif err = json.Unmarshal(body, &u.GovernancePolicyZipPartDownloaded); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"legal_holds_activate_a_hold\":\n\t\tif err = json.Unmarshal(body, &u.LegalHoldsActivateAHold); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"legal_holds_add_members\":\n\t\tif err = json.Unmarshal(body, &u.LegalHoldsAddMembers); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"legal_holds_change_hold_details\":\n\t\tif err = json.Unmarshal(body, &u.LegalHoldsChangeHoldDetails); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"legal_holds_change_hold_name\":\n\t\tif err = json.Unmarshal(body, &u.LegalHoldsChangeHoldName); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"legal_holds_export_a_hold\":\n\t\tif err = json.Unmarshal(body, &u.LegalHoldsExportAHold); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"legal_holds_export_cancelled\":\n\t\tif err = json.Unmarshal(body, &u.LegalHoldsExportCancelled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"legal_holds_export_downloaded\":\n\t\tif err = json.Unmarshal(body, &u.LegalHoldsExportDownloaded); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"legal_holds_export_removed\":\n\t\tif err = json.Unmarshal(body, &u.LegalHoldsExportRemoved); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"legal_holds_release_a_hold\":\n\t\tif err = json.Unmarshal(body, &u.LegalHoldsReleaseAHold); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"legal_holds_remove_members\":\n\t\tif err = json.Unmarshal(body, &u.LegalHoldsRemoveMembers); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"legal_holds_report_a_hold\":\n\t\tif err = json.Unmarshal(body, &u.LegalHoldsReportAHold); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_change_ip_desktop\":\n\t\tif err = json.Unmarshal(body, &u.DeviceChangeIpDesktop); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_change_ip_mobile\":\n\t\tif err = json.Unmarshal(body, &u.DeviceChangeIpMobile); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_change_ip_web\":\n\t\tif err = json.Unmarshal(body, &u.DeviceChangeIpWeb); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_delete_on_unlink_fail\":\n\t\tif err = json.Unmarshal(body, &u.DeviceDeleteOnUnlinkFail); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_delete_on_unlink_success\":\n\t\tif err = json.Unmarshal(body, &u.DeviceDeleteOnUnlinkSuccess); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_link_fail\":\n\t\tif err = json.Unmarshal(body, &u.DeviceLinkFail); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_link_success\":\n\t\tif err = json.Unmarshal(body, &u.DeviceLinkSuccess); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_management_disabled\":\n\t\tif err = json.Unmarshal(body, &u.DeviceManagementDisabled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_management_enabled\":\n\t\tif err = json.Unmarshal(body, &u.DeviceManagementEnabled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_sync_backup_status_changed\":\n\t\tif err = json.Unmarshal(body, &u.DeviceSyncBackupStatusChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_unlink\":\n\t\tif err = json.Unmarshal(body, &u.DeviceUnlink); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"dropbox_passwords_exported\":\n\t\tif err = json.Unmarshal(body, &u.DropboxPasswordsExported); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"dropbox_passwords_new_device_enrolled\":\n\t\tif err = json.Unmarshal(body, &u.DropboxPasswordsNewDeviceEnrolled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"emm_refresh_auth_token\":\n\t\tif err = json.Unmarshal(body, &u.EmmRefreshAuthToken); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"external_drive_backup_eligibility_status_checked\":\n\t\tif err = json.Unmarshal(body, &u.ExternalDriveBackupEligibilityStatusChecked); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"external_drive_backup_status_changed\":\n\t\tif err = json.Unmarshal(body, &u.ExternalDriveBackupStatusChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"account_capture_change_availability\":\n\t\tif err = json.Unmarshal(body, &u.AccountCaptureChangeAvailability); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"account_capture_migrate_account\":\n\t\tif err = json.Unmarshal(body, &u.AccountCaptureMigrateAccount); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"account_capture_notification_emails_sent\":\n\t\tif err = json.Unmarshal(body, &u.AccountCaptureNotificationEmailsSent); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"account_capture_relinquish_account\":\n\t\tif err = json.Unmarshal(body, &u.AccountCaptureRelinquishAccount); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"disabled_domain_invites\":\n\t\tif err = json.Unmarshal(body, &u.DisabledDomainInvites); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"domain_invites_approve_request_to_join_team\":\n\t\tif err = json.Unmarshal(body, &u.DomainInvitesApproveRequestToJoinTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"domain_invites_decline_request_to_join_team\":\n\t\tif err = json.Unmarshal(body, &u.DomainInvitesDeclineRequestToJoinTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"domain_invites_email_existing_users\":\n\t\tif err = json.Unmarshal(body, &u.DomainInvitesEmailExistingUsers); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"domain_invites_request_to_join_team\":\n\t\tif err = json.Unmarshal(body, &u.DomainInvitesRequestToJoinTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"domain_invites_set_invite_new_user_pref_to_no\":\n\t\tif err = json.Unmarshal(body, &u.DomainInvitesSetInviteNewUserPrefToNo); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"domain_invites_set_invite_new_user_pref_to_yes\":\n\t\tif err = json.Unmarshal(body, &u.DomainInvitesSetInviteNewUserPrefToYes); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"domain_verification_add_domain_fail\":\n\t\tif err = json.Unmarshal(body, &u.DomainVerificationAddDomainFail); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"domain_verification_add_domain_success\":\n\t\tif err = json.Unmarshal(body, &u.DomainVerificationAddDomainSuccess); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"domain_verification_remove_domain\":\n\t\tif err = json.Unmarshal(body, &u.DomainVerificationRemoveDomain); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"enabled_domain_invites\":\n\t\tif err = json.Unmarshal(body, &u.EnabledDomainInvites); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"apply_naming_convention\":\n\t\tif err = json.Unmarshal(body, &u.ApplyNamingConvention); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"create_folder\":\n\t\tif err = json.Unmarshal(body, &u.CreateFolder); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_add\":\n\t\tif err = json.Unmarshal(body, &u.FileAdd); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_copy\":\n\t\tif err = json.Unmarshal(body, &u.FileCopy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_delete\":\n\t\tif err = json.Unmarshal(body, &u.FileDelete); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_download\":\n\t\tif err = json.Unmarshal(body, &u.FileDownload); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_edit\":\n\t\tif err = json.Unmarshal(body, &u.FileEdit); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_get_copy_reference\":\n\t\tif err = json.Unmarshal(body, &u.FileGetCopyReference); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_locking_lock_status_changed\":\n\t\tif err = json.Unmarshal(body, &u.FileLockingLockStatusChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_move\":\n\t\tif err = json.Unmarshal(body, &u.FileMove); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_permanently_delete\":\n\t\tif err = json.Unmarshal(body, &u.FilePermanentlyDelete); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_preview\":\n\t\tif err = json.Unmarshal(body, &u.FilePreview); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_rename\":\n\t\tif err = json.Unmarshal(body, &u.FileRename); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_restore\":\n\t\tif err = json.Unmarshal(body, &u.FileRestore); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_revert\":\n\t\tif err = json.Unmarshal(body, &u.FileRevert); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_rollback_changes\":\n\t\tif err = json.Unmarshal(body, &u.FileRollbackChanges); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_save_copy_reference\":\n\t\tif err = json.Unmarshal(body, &u.FileSaveCopyReference); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"folder_overview_description_changed\":\n\t\tif err = json.Unmarshal(body, &u.FolderOverviewDescriptionChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"folder_overview_item_pinned\":\n\t\tif err = json.Unmarshal(body, &u.FolderOverviewItemPinned); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"folder_overview_item_unpinned\":\n\t\tif err = json.Unmarshal(body, &u.FolderOverviewItemUnpinned); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"object_label_added\":\n\t\tif err = json.Unmarshal(body, &u.ObjectLabelAdded); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"object_label_removed\":\n\t\tif err = json.Unmarshal(body, &u.ObjectLabelRemoved); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"object_label_updated_value\":\n\t\tif err = json.Unmarshal(body, &u.ObjectLabelUpdatedValue); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"organize_folder_with_tidy\":\n\t\tif err = json.Unmarshal(body, &u.OrganizeFolderWithTidy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"rewind_folder\":\n\t\tif err = json.Unmarshal(body, &u.RewindFolder); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"undo_naming_convention\":\n\t\tif err = json.Unmarshal(body, &u.UndoNamingConvention); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"undo_organize_folder_with_tidy\":\n\t\tif err = json.Unmarshal(body, &u.UndoOrganizeFolderWithTidy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"user_tags_added\":\n\t\tif err = json.Unmarshal(body, &u.UserTagsAdded); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"user_tags_removed\":\n\t\tif err = json.Unmarshal(body, &u.UserTagsRemoved); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"email_ingest_receive_file\":\n\t\tif err = json.Unmarshal(body, &u.EmailIngestReceiveFile); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_request_change\":\n\t\tif err = json.Unmarshal(body, &u.FileRequestChange); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_request_close\":\n\t\tif err = json.Unmarshal(body, &u.FileRequestClose); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_request_create\":\n\t\tif err = json.Unmarshal(body, &u.FileRequestCreate); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_request_delete\":\n\t\tif err = json.Unmarshal(body, &u.FileRequestDelete); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_request_receive_file\":\n\t\tif err = json.Unmarshal(body, &u.FileRequestReceiveFile); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_add_external_id\":\n\t\tif err = json.Unmarshal(body, &u.GroupAddExternalId); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_add_member\":\n\t\tif err = json.Unmarshal(body, &u.GroupAddMember); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_change_external_id\":\n\t\tif err = json.Unmarshal(body, &u.GroupChangeExternalId); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_change_management_type\":\n\t\tif err = json.Unmarshal(body, &u.GroupChangeManagementType); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_change_member_role\":\n\t\tif err = json.Unmarshal(body, &u.GroupChangeMemberRole); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_create\":\n\t\tif err = json.Unmarshal(body, &u.GroupCreate); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_delete\":\n\t\tif err = json.Unmarshal(body, &u.GroupDelete); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_description_updated\":\n\t\tif err = json.Unmarshal(body, &u.GroupDescriptionUpdated); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_join_policy_updated\":\n\t\tif err = json.Unmarshal(body, &u.GroupJoinPolicyUpdated); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_moved\":\n\t\tif err = json.Unmarshal(body, &u.GroupMoved); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_remove_external_id\":\n\t\tif err = json.Unmarshal(body, &u.GroupRemoveExternalId); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_remove_member\":\n\t\tif err = json.Unmarshal(body, &u.GroupRemoveMember); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_rename\":\n\t\tif err = json.Unmarshal(body, &u.GroupRename); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"account_lock_or_unlocked\":\n\t\tif err = json.Unmarshal(body, &u.AccountLockOrUnlocked); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"emm_error\":\n\t\tif err = json.Unmarshal(body, &u.EmmError); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"guest_admin_signed_in_via_trusted_teams\":\n\t\tif err = json.Unmarshal(body, &u.GuestAdminSignedInViaTrustedTeams); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"guest_admin_signed_out_via_trusted_teams\":\n\t\tif err = json.Unmarshal(body, &u.GuestAdminSignedOutViaTrustedTeams); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"login_fail\":\n\t\tif err = json.Unmarshal(body, &u.LoginFail); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"login_success\":\n\t\tif err = json.Unmarshal(body, &u.LoginSuccess); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"logout\":\n\t\tif err = json.Unmarshal(body, &u.Logout); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"reseller_support_session_end\":\n\t\tif err = json.Unmarshal(body, &u.ResellerSupportSessionEnd); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"reseller_support_session_start\":\n\t\tif err = json.Unmarshal(body, &u.ResellerSupportSessionStart); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sign_in_as_session_end\":\n\t\tif err = json.Unmarshal(body, &u.SignInAsSessionEnd); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sign_in_as_session_start\":\n\t\tif err = json.Unmarshal(body, &u.SignInAsSessionStart); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_error\":\n\t\tif err = json.Unmarshal(body, &u.SsoError); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"create_team_invite_link\":\n\t\tif err = json.Unmarshal(body, &u.CreateTeamInviteLink); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"delete_team_invite_link\":\n\t\tif err = json.Unmarshal(body, &u.DeleteTeamInviteLink); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_add_external_id\":\n\t\tif err = json.Unmarshal(body, &u.MemberAddExternalId); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_add_name\":\n\t\tif err = json.Unmarshal(body, &u.MemberAddName); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_change_admin_role\":\n\t\tif err = json.Unmarshal(body, &u.MemberChangeAdminRole); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_change_email\":\n\t\tif err = json.Unmarshal(body, &u.MemberChangeEmail); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_change_external_id\":\n\t\tif err = json.Unmarshal(body, &u.MemberChangeExternalId); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_change_membership_type\":\n\t\tif err = json.Unmarshal(body, &u.MemberChangeMembershipType); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_change_name\":\n\t\tif err = json.Unmarshal(body, &u.MemberChangeName); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_change_reseller_role\":\n\t\tif err = json.Unmarshal(body, &u.MemberChangeResellerRole); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_change_status\":\n\t\tif err = json.Unmarshal(body, &u.MemberChangeStatus); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_delete_manual_contacts\":\n\t\tif err = json.Unmarshal(body, &u.MemberDeleteManualContacts); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_delete_profile_photo\":\n\t\tif err = json.Unmarshal(body, &u.MemberDeleteProfilePhoto); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_permanently_delete_account_contents\":\n\t\tif err = json.Unmarshal(body, &u.MemberPermanentlyDeleteAccountContents); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_remove_external_id\":\n\t\tif err = json.Unmarshal(body, &u.MemberRemoveExternalId); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_set_profile_photo\":\n\t\tif err = json.Unmarshal(body, &u.MemberSetProfilePhoto); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_space_limits_add_custom_quota\":\n\t\tif err = json.Unmarshal(body, &u.MemberSpaceLimitsAddCustomQuota); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_space_limits_change_custom_quota\":\n\t\tif err = json.Unmarshal(body, &u.MemberSpaceLimitsChangeCustomQuota); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_space_limits_change_status\":\n\t\tif err = json.Unmarshal(body, &u.MemberSpaceLimitsChangeStatus); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_space_limits_remove_custom_quota\":\n\t\tif err = json.Unmarshal(body, &u.MemberSpaceLimitsRemoveCustomQuota); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_suggest\":\n\t\tif err = json.Unmarshal(body, &u.MemberSuggest); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_transfer_account_contents\":\n\t\tif err = json.Unmarshal(body, &u.MemberTransferAccountContents); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"pending_secondary_email_added\":\n\t\tif err = json.Unmarshal(body, &u.PendingSecondaryEmailAdded); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"secondary_email_deleted\":\n\t\tif err = json.Unmarshal(body, &u.SecondaryEmailDeleted); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"secondary_email_verified\":\n\t\tif err = json.Unmarshal(body, &u.SecondaryEmailVerified); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"secondary_mails_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.SecondaryMailsPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"binder_add_page\":\n\t\tif err = json.Unmarshal(body, &u.BinderAddPage); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"binder_add_section\":\n\t\tif err = json.Unmarshal(body, &u.BinderAddSection); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"binder_remove_page\":\n\t\tif err = json.Unmarshal(body, &u.BinderRemovePage); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"binder_remove_section\":\n\t\tif err = json.Unmarshal(body, &u.BinderRemoveSection); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"binder_rename_page\":\n\t\tif err = json.Unmarshal(body, &u.BinderRenamePage); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"binder_rename_section\":\n\t\tif err = json.Unmarshal(body, &u.BinderRenameSection); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"binder_reorder_page\":\n\t\tif err = json.Unmarshal(body, &u.BinderReorderPage); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"binder_reorder_section\":\n\t\tif err = json.Unmarshal(body, &u.BinderReorderSection); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_content_add_member\":\n\t\tif err = json.Unmarshal(body, &u.PaperContentAddMember); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_content_add_to_folder\":\n\t\tif err = json.Unmarshal(body, &u.PaperContentAddToFolder); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_content_archive\":\n\t\tif err = json.Unmarshal(body, &u.PaperContentArchive); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_content_create\":\n\t\tif err = json.Unmarshal(body, &u.PaperContentCreate); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_content_permanently_delete\":\n\t\tif err = json.Unmarshal(body, &u.PaperContentPermanentlyDelete); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_content_remove_from_folder\":\n\t\tif err = json.Unmarshal(body, &u.PaperContentRemoveFromFolder); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_content_remove_member\":\n\t\tif err = json.Unmarshal(body, &u.PaperContentRemoveMember); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_content_rename\":\n\t\tif err = json.Unmarshal(body, &u.PaperContentRename); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_content_restore\":\n\t\tif err = json.Unmarshal(body, &u.PaperContentRestore); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_add_comment\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocAddComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_change_member_role\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocChangeMemberRole); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_change_sharing_policy\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocChangeSharingPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_change_subscription\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocChangeSubscription); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_deleted\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocDeleted); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_delete_comment\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocDeleteComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_download\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocDownload); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_edit\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocEdit); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_edit_comment\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocEditComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_followed\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocFollowed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_mention\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocMention); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_ownership_changed\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocOwnershipChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_request_access\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocRequestAccess); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_resolve_comment\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocResolveComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_revert\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocRevert); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_slack_share\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocSlackShare); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_team_invite\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocTeamInvite); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_trashed\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocTrashed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_unresolve_comment\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocUnresolveComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_untrashed\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocUntrashed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_doc_view\":\n\t\tif err = json.Unmarshal(body, &u.PaperDocView); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_external_view_allow\":\n\t\tif err = json.Unmarshal(body, &u.PaperExternalViewAllow); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_external_view_default_team\":\n\t\tif err = json.Unmarshal(body, &u.PaperExternalViewDefaultTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_external_view_forbid\":\n\t\tif err = json.Unmarshal(body, &u.PaperExternalViewForbid); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_folder_change_subscription\":\n\t\tif err = json.Unmarshal(body, &u.PaperFolderChangeSubscription); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_folder_deleted\":\n\t\tif err = json.Unmarshal(body, &u.PaperFolderDeleted); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_folder_followed\":\n\t\tif err = json.Unmarshal(body, &u.PaperFolderFollowed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_folder_team_invite\":\n\t\tif err = json.Unmarshal(body, &u.PaperFolderTeamInvite); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_published_link_change_permission\":\n\t\tif err = json.Unmarshal(body, &u.PaperPublishedLinkChangePermission); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_published_link_create\":\n\t\tif err = json.Unmarshal(body, &u.PaperPublishedLinkCreate); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_published_link_disabled\":\n\t\tif err = json.Unmarshal(body, &u.PaperPublishedLinkDisabled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_published_link_view\":\n\t\tif err = json.Unmarshal(body, &u.PaperPublishedLinkView); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"password_change\":\n\t\tif err = json.Unmarshal(body, &u.PasswordChange); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"password_reset\":\n\t\tif err = json.Unmarshal(body, &u.PasswordReset); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"password_reset_all\":\n\t\tif err = json.Unmarshal(body, &u.PasswordResetAll); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"classification_create_report\":\n\t\tif err = json.Unmarshal(body, &u.ClassificationCreateReport); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"classification_create_report_fail\":\n\t\tif err = json.Unmarshal(body, &u.ClassificationCreateReportFail); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"emm_create_exceptions_report\":\n\t\tif err = json.Unmarshal(body, &u.EmmCreateExceptionsReport); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"emm_create_usage_report\":\n\t\tif err = json.Unmarshal(body, &u.EmmCreateUsageReport); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"export_members_report\":\n\t\tif err = json.Unmarshal(body, &u.ExportMembersReport); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"export_members_report_fail\":\n\t\tif err = json.Unmarshal(body, &u.ExportMembersReportFail); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"external_sharing_create_report\":\n\t\tif err = json.Unmarshal(body, &u.ExternalSharingCreateReport); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"external_sharing_report_failed\":\n\t\tif err = json.Unmarshal(body, &u.ExternalSharingReportFailed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"no_expiration_link_gen_create_report\":\n\t\tif err = json.Unmarshal(body, &u.NoExpirationLinkGenCreateReport); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"no_expiration_link_gen_report_failed\":\n\t\tif err = json.Unmarshal(body, &u.NoExpirationLinkGenReportFailed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"no_password_link_gen_create_report\":\n\t\tif err = json.Unmarshal(body, &u.NoPasswordLinkGenCreateReport); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"no_password_link_gen_report_failed\":\n\t\tif err = json.Unmarshal(body, &u.NoPasswordLinkGenReportFailed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"no_password_link_view_create_report\":\n\t\tif err = json.Unmarshal(body, &u.NoPasswordLinkViewCreateReport); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"no_password_link_view_report_failed\":\n\t\tif err = json.Unmarshal(body, &u.NoPasswordLinkViewReportFailed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"outdated_link_view_create_report\":\n\t\tif err = json.Unmarshal(body, &u.OutdatedLinkViewCreateReport); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"outdated_link_view_report_failed\":\n\t\tif err = json.Unmarshal(body, &u.OutdatedLinkViewReportFailed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_admin_export_start\":\n\t\tif err = json.Unmarshal(body, &u.PaperAdminExportStart); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"smart_sync_create_admin_privilege_report\":\n\t\tif err = json.Unmarshal(body, &u.SmartSyncCreateAdminPrivilegeReport); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_activity_create_report\":\n\t\tif err = json.Unmarshal(body, &u.TeamActivityCreateReport); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_activity_create_report_fail\":\n\t\tif err = json.Unmarshal(body, &u.TeamActivityCreateReportFail); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"collection_share\":\n\t\tif err = json.Unmarshal(body, &u.CollectionShare); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_transfers_file_add\":\n\t\tif err = json.Unmarshal(body, &u.FileTransfersFileAdd); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_transfers_transfer_delete\":\n\t\tif err = json.Unmarshal(body, &u.FileTransfersTransferDelete); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_transfers_transfer_download\":\n\t\tif err = json.Unmarshal(body, &u.FileTransfersTransferDownload); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_transfers_transfer_send\":\n\t\tif err = json.Unmarshal(body, &u.FileTransfersTransferSend); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_transfers_transfer_view\":\n\t\tif err = json.Unmarshal(body, &u.FileTransfersTransferView); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"note_acl_invite_only\":\n\t\tif err = json.Unmarshal(body, &u.NoteAclInviteOnly); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"note_acl_link\":\n\t\tif err = json.Unmarshal(body, &u.NoteAclLink); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"note_acl_team_link\":\n\t\tif err = json.Unmarshal(body, &u.NoteAclTeamLink); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"note_shared\":\n\t\tif err = json.Unmarshal(body, &u.NoteShared); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"note_share_receive\":\n\t\tif err = json.Unmarshal(body, &u.NoteShareReceive); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"open_note_shared\":\n\t\tif err = json.Unmarshal(body, &u.OpenNoteShared); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_add_group\":\n\t\tif err = json.Unmarshal(body, &u.SfAddGroup); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_allow_non_members_to_view_shared_links\":\n\t\tif err = json.Unmarshal(body, &u.SfAllowNonMembersToViewSharedLinks); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_external_invite_warn\":\n\t\tif err = json.Unmarshal(body, &u.SfExternalInviteWarn); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_fb_invite\":\n\t\tif err = json.Unmarshal(body, &u.SfFbInvite); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_fb_invite_change_role\":\n\t\tif err = json.Unmarshal(body, &u.SfFbInviteChangeRole); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_fb_uninvite\":\n\t\tif err = json.Unmarshal(body, &u.SfFbUninvite); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_invite_group\":\n\t\tif err = json.Unmarshal(body, &u.SfInviteGroup); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_team_grant_access\":\n\t\tif err = json.Unmarshal(body, &u.SfTeamGrantAccess); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_team_invite\":\n\t\tif err = json.Unmarshal(body, &u.SfTeamInvite); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_team_invite_change_role\":\n\t\tif err = json.Unmarshal(body, &u.SfTeamInviteChangeRole); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_team_join\":\n\t\tif err = json.Unmarshal(body, &u.SfTeamJoin); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_team_join_from_oob_link\":\n\t\tif err = json.Unmarshal(body, &u.SfTeamJoinFromOobLink); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sf_team_uninvite\":\n\t\tif err = json.Unmarshal(body, &u.SfTeamUninvite); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_add_invitees\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentAddInvitees); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_add_link_expiry\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentAddLinkExpiry); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_add_link_password\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentAddLinkPassword); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_add_member\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentAddMember); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_change_downloads_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentChangeDownloadsPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_change_invitee_role\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentChangeInviteeRole); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_change_link_audience\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentChangeLinkAudience); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_change_link_expiry\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentChangeLinkExpiry); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_change_link_password\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentChangeLinkPassword); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_change_member_role\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentChangeMemberRole); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_change_viewer_info_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentChangeViewerInfoPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_claim_invitation\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentClaimInvitation); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_copy\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentCopy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_download\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentDownload); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_relinquish_membership\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentRelinquishMembership); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_remove_invitees\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentRemoveInvitees); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_remove_link_expiry\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentRemoveLinkExpiry); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_remove_link_password\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentRemoveLinkPassword); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_remove_member\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentRemoveMember); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_request_access\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentRequestAccess); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_restore_invitees\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentRestoreInvitees); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_restore_member\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentRestoreMember); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_unshare\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentUnshare); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_content_view\":\n\t\tif err = json.Unmarshal(body, &u.SharedContentView); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_folder_change_link_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharedFolderChangeLinkPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_folder_change_members_inheritance_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharedFolderChangeMembersInheritancePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_folder_change_members_management_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharedFolderChangeMembersManagementPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_folder_change_members_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharedFolderChangeMembersPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_folder_create\":\n\t\tif err = json.Unmarshal(body, &u.SharedFolderCreate); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_folder_decline_invitation\":\n\t\tif err = json.Unmarshal(body, &u.SharedFolderDeclineInvitation); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_folder_mount\":\n\t\tif err = json.Unmarshal(body, &u.SharedFolderMount); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_folder_nest\":\n\t\tif err = json.Unmarshal(body, &u.SharedFolderNest); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_folder_transfer_ownership\":\n\t\tif err = json.Unmarshal(body, &u.SharedFolderTransferOwnership); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_folder_unmount\":\n\t\tif err = json.Unmarshal(body, &u.SharedFolderUnmount); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_add_expiry\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkAddExpiry); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_change_expiry\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkChangeExpiry); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_change_visibility\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkChangeVisibility); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_copy\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkCopy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_create\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkCreate); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_disable\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkDisable); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_download\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkDownload); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_remove_expiry\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkRemoveExpiry); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_settings_add_expiration\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkSettingsAddExpiration); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_settings_add_password\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkSettingsAddPassword); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_settings_allow_download_disabled\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkSettingsAllowDownloadDisabled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_settings_allow_download_enabled\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkSettingsAllowDownloadEnabled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_settings_change_audience\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkSettingsChangeAudience); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_settings_change_expiration\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkSettingsChangeExpiration); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_settings_change_password\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkSettingsChangePassword); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_settings_remove_expiration\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkSettingsRemoveExpiration); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_settings_remove_password\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkSettingsRemovePassword); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_share\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkShare); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_link_view\":\n\t\tif err = json.Unmarshal(body, &u.SharedLinkView); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shared_note_opened\":\n\t\tif err = json.Unmarshal(body, &u.SharedNoteOpened); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shmodel_disable_downloads\":\n\t\tif err = json.Unmarshal(body, &u.ShmodelDisableDownloads); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shmodel_enable_downloads\":\n\t\tif err = json.Unmarshal(body, &u.ShmodelEnableDownloads); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"shmodel_group_share\":\n\t\tif err = json.Unmarshal(body, &u.ShmodelGroupShare); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_access_granted\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseAccessGranted); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_add_member\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseAddMember); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_archived\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseArchived); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_created\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseCreated); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_delete_comment\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseDeleteComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_edited\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseEdited); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_edit_comment\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseEditComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_file_added\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseFileAdded); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_file_download\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseFileDownload); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_file_removed\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseFileRemoved); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_file_view\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseFileView); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_permanently_deleted\":\n\t\tif err = json.Unmarshal(body, &u.ShowcasePermanentlyDeleted); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_post_comment\":\n\t\tif err = json.Unmarshal(body, &u.ShowcasePostComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_remove_member\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseRemoveMember); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_renamed\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseRenamed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_request_access\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseRequestAccess); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_resolve_comment\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseResolveComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_restored\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseRestored); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_trashed\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseTrashed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_trashed_deprecated\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseTrashedDeprecated); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_unresolve_comment\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseUnresolveComment); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_untrashed\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseUntrashed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_untrashed_deprecated\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseUntrashedDeprecated); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_view\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseView); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_add_cert\":\n\t\tif err = json.Unmarshal(body, &u.SsoAddCert); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_add_login_url\":\n\t\tif err = json.Unmarshal(body, &u.SsoAddLoginUrl); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_add_logout_url\":\n\t\tif err = json.Unmarshal(body, &u.SsoAddLogoutUrl); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_change_cert\":\n\t\tif err = json.Unmarshal(body, &u.SsoChangeCert); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_change_login_url\":\n\t\tif err = json.Unmarshal(body, &u.SsoChangeLoginUrl); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_change_logout_url\":\n\t\tif err = json.Unmarshal(body, &u.SsoChangeLogoutUrl); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_change_saml_identity_mode\":\n\t\tif err = json.Unmarshal(body, &u.SsoChangeSamlIdentityMode); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_remove_cert\":\n\t\tif err = json.Unmarshal(body, &u.SsoRemoveCert); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_remove_login_url\":\n\t\tif err = json.Unmarshal(body, &u.SsoRemoveLoginUrl); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_remove_logout_url\":\n\t\tif err = json.Unmarshal(body, &u.SsoRemoveLogoutUrl); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_folder_change_status\":\n\t\tif err = json.Unmarshal(body, &u.TeamFolderChangeStatus); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_folder_create\":\n\t\tif err = json.Unmarshal(body, &u.TeamFolderCreate); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_folder_downgrade\":\n\t\tif err = json.Unmarshal(body, &u.TeamFolderDowngrade); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_folder_permanently_delete\":\n\t\tif err = json.Unmarshal(body, &u.TeamFolderPermanentlyDelete); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_folder_rename\":\n\t\tif err = json.Unmarshal(body, &u.TeamFolderRename); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_selective_sync_settings_changed\":\n\t\tif err = json.Unmarshal(body, &u.TeamSelectiveSyncSettingsChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"account_capture_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.AccountCaptureChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"admin_email_reminders_changed\":\n\t\tif err = json.Unmarshal(body, &u.AdminEmailRemindersChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"allow_download_disabled\":\n\t\tif err = json.Unmarshal(body, &u.AllowDownloadDisabled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"allow_download_enabled\":\n\t\tif err = json.Unmarshal(body, &u.AllowDownloadEnabled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"app_permissions_changed\":\n\t\tif err = json.Unmarshal(body, &u.AppPermissionsChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"camera_uploads_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.CameraUploadsPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"capture_transcript_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.CaptureTranscriptPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"classification_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.ClassificationChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"computer_backup_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.ComputerBackupPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"content_administration_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.ContentAdministrationPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"data_placement_restriction_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.DataPlacementRestrictionChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"data_placement_restriction_satisfy_policy\":\n\t\tif err = json.Unmarshal(body, &u.DataPlacementRestrictionSatisfyPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_approvals_add_exception\":\n\t\tif err = json.Unmarshal(body, &u.DeviceApprovalsAddException); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_approvals_change_desktop_policy\":\n\t\tif err = json.Unmarshal(body, &u.DeviceApprovalsChangeDesktopPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_approvals_change_mobile_policy\":\n\t\tif err = json.Unmarshal(body, &u.DeviceApprovalsChangeMobilePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_approvals_change_overage_action\":\n\t\tif err = json.Unmarshal(body, &u.DeviceApprovalsChangeOverageAction); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_approvals_change_unlink_action\":\n\t\tif err = json.Unmarshal(body, &u.DeviceApprovalsChangeUnlinkAction); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"device_approvals_remove_exception\":\n\t\tif err = json.Unmarshal(body, &u.DeviceApprovalsRemoveException); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"directory_restrictions_add_members\":\n\t\tif err = json.Unmarshal(body, &u.DirectoryRestrictionsAddMembers); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"directory_restrictions_remove_members\":\n\t\tif err = json.Unmarshal(body, &u.DirectoryRestrictionsRemoveMembers); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"dropbox_passwords_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.DropboxPasswordsPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"email_ingest_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.EmailIngestPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"emm_add_exception\":\n\t\tif err = json.Unmarshal(body, &u.EmmAddException); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"emm_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.EmmChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"emm_remove_exception\":\n\t\tif err = json.Unmarshal(body, &u.EmmRemoveException); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"extended_version_history_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.ExtendedVersionHistoryChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"external_drive_backup_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.ExternalDriveBackupPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_comments_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.FileCommentsChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_locking_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.FileLockingPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_provider_migration_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.FileProviderMigrationPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_requests_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.FileRequestsChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_requests_emails_enabled\":\n\t\tif err = json.Unmarshal(body, &u.FileRequestsEmailsEnabled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_requests_emails_restricted_to_team_only\":\n\t\tif err = json.Unmarshal(body, &u.FileRequestsEmailsRestrictedToTeamOnly); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"file_transfers_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.FileTransfersPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"google_sso_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.GoogleSsoChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"group_user_management_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.GroupUserManagementChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"integration_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.IntegrationPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"invite_acceptance_email_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.InviteAcceptanceEmailPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_requests_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.MemberRequestsChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_send_invite_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.MemberSendInvitePolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_space_limits_add_exception\":\n\t\tif err = json.Unmarshal(body, &u.MemberSpaceLimitsAddException); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_space_limits_change_caps_type_policy\":\n\t\tif err = json.Unmarshal(body, &u.MemberSpaceLimitsChangeCapsTypePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_space_limits_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.MemberSpaceLimitsChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_space_limits_remove_exception\":\n\t\tif err = json.Unmarshal(body, &u.MemberSpaceLimitsRemoveException); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"member_suggestions_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.MemberSuggestionsChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"microsoft_office_addin_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.MicrosoftOfficeAddinChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"network_control_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.NetworkControlChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_change_deployment_policy\":\n\t\tif err = json.Unmarshal(body, &u.PaperChangeDeploymentPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_change_member_link_policy\":\n\t\tif err = json.Unmarshal(body, &u.PaperChangeMemberLinkPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_change_member_policy\":\n\t\tif err = json.Unmarshal(body, &u.PaperChangeMemberPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.PaperChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_default_folder_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.PaperDefaultFolderPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_desktop_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.PaperDesktopPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_enabled_users_group_addition\":\n\t\tif err = json.Unmarshal(body, &u.PaperEnabledUsersGroupAddition); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"paper_enabled_users_group_removal\":\n\t\tif err = json.Unmarshal(body, &u.PaperEnabledUsersGroupRemoval); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"password_strength_requirements_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.PasswordStrengthRequirementsChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"permanent_delete_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.PermanentDeleteChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"reseller_support_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.ResellerSupportChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"rewind_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.RewindPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"send_for_signature_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.SendForSignaturePolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sharing_change_folder_join_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharingChangeFolderJoinPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sharing_change_link_allow_change_expiration_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharingChangeLinkAllowChangeExpirationPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sharing_change_link_default_expiration_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharingChangeLinkDefaultExpirationPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sharing_change_link_enforce_password_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharingChangeLinkEnforcePasswordPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sharing_change_link_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharingChangeLinkPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sharing_change_member_policy\":\n\t\tif err = json.Unmarshal(body, &u.SharingChangeMemberPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_change_download_policy\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseChangeDownloadPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_change_enabled_policy\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseChangeEnabledPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"showcase_change_external_sharing_policy\":\n\t\tif err = json.Unmarshal(body, &u.ShowcaseChangeExternalSharingPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"smarter_smart_sync_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.SmarterSmartSyncPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"smart_sync_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.SmartSyncChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"smart_sync_not_opt_out\":\n\t\tif err = json.Unmarshal(body, &u.SmartSyncNotOptOut); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"smart_sync_opt_out\":\n\t\tif err = json.Unmarshal(body, &u.SmartSyncOptOut); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"sso_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.SsoChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_branding_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.TeamBrandingPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_extensions_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.TeamExtensionsPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_selective_sync_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.TeamSelectiveSyncPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_sharing_whitelist_subjects_changed\":\n\t\tif err = json.Unmarshal(body, &u.TeamSharingWhitelistSubjectsChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"tfa_add_exception\":\n\t\tif err = json.Unmarshal(body, &u.TfaAddException); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"tfa_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.TfaChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"tfa_remove_exception\":\n\t\tif err = json.Unmarshal(body, &u.TfaRemoveException); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"two_account_change_policy\":\n\t\tif err = json.Unmarshal(body, &u.TwoAccountChangePolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"viewer_info_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.ViewerInfoPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"watermarking_policy_changed\":\n\t\tif err = json.Unmarshal(body, &u.WatermarkingPolicyChanged); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"web_sessions_change_active_session_limit\":\n\t\tif err = json.Unmarshal(body, &u.WebSessionsChangeActiveSessionLimit); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"web_sessions_change_fixed_length_policy\":\n\t\tif err = json.Unmarshal(body, &u.WebSessionsChangeFixedLengthPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"web_sessions_change_idle_length_policy\":\n\t\tif err = json.Unmarshal(body, &u.WebSessionsChangeIdleLengthPolicy); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"data_residency_migration_request_successful\":\n\t\tif err = json.Unmarshal(body, &u.DataResidencyMigrationRequestSuccessful); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"data_residency_migration_request_unsuccessful\":\n\t\tif err = json.Unmarshal(body, &u.DataResidencyMigrationRequestUnsuccessful); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_from\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeFrom); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_to\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeTo); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_profile_add_background\":\n\t\tif err = json.Unmarshal(body, &u.TeamProfileAddBackground); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_profile_add_logo\":\n\t\tif err = json.Unmarshal(body, &u.TeamProfileAddLogo); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_profile_change_background\":\n\t\tif err = json.Unmarshal(body, &u.TeamProfileChangeBackground); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_profile_change_default_language\":\n\t\tif err = json.Unmarshal(body, &u.TeamProfileChangeDefaultLanguage); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_profile_change_logo\":\n\t\tif err = json.Unmarshal(body, &u.TeamProfileChangeLogo); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_profile_change_name\":\n\t\tif err = json.Unmarshal(body, &u.TeamProfileChangeName); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_profile_remove_background\":\n\t\tif err = json.Unmarshal(body, &u.TeamProfileRemoveBackground); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_profile_remove_logo\":\n\t\tif err = json.Unmarshal(body, &u.TeamProfileRemoveLogo); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"tfa_add_backup_phone\":\n\t\tif err = json.Unmarshal(body, &u.TfaAddBackupPhone); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"tfa_add_security_key\":\n\t\tif err = json.Unmarshal(body, &u.TfaAddSecurityKey); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"tfa_change_backup_phone\":\n\t\tif err = json.Unmarshal(body, &u.TfaChangeBackupPhone); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"tfa_change_status\":\n\t\tif err = json.Unmarshal(body, &u.TfaChangeStatus); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"tfa_remove_backup_phone\":\n\t\tif err = json.Unmarshal(body, &u.TfaRemoveBackupPhone); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"tfa_remove_security_key\":\n\t\tif err = json.Unmarshal(body, &u.TfaRemoveSecurityKey); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"tfa_reset\":\n\t\tif err = json.Unmarshal(body, &u.TfaReset); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"changed_enterprise_admin_role\":\n\t\tif err = json.Unmarshal(body, &u.ChangedEnterpriseAdminRole); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"changed_enterprise_connected_team_status\":\n\t\tif err = json.Unmarshal(body, &u.ChangedEnterpriseConnectedTeamStatus); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"ended_enterprise_admin_session\":\n\t\tif err = json.Unmarshal(body, &u.EndedEnterpriseAdminSession); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"ended_enterprise_admin_session_deprecated\":\n\t\tif err = json.Unmarshal(body, &u.EndedEnterpriseAdminSessionDeprecated); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"enterprise_settings_locking\":\n\t\tif err = json.Unmarshal(body, &u.EnterpriseSettingsLocking); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"guest_admin_change_status\":\n\t\tif err = json.Unmarshal(body, &u.GuestAdminChangeStatus); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"started_enterprise_admin_session\":\n\t\tif err = json.Unmarshal(body, &u.StartedEnterpriseAdminSession); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_accepted\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestAccepted); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_accepted_shown_to_primary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestAcceptedShownToPrimaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_accepted_shown_to_secondary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestAcceptedShownToSecondaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_auto_canceled\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestAutoCanceled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_canceled\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestCanceled); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_canceled_shown_to_primary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestCanceledShownToPrimaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_canceled_shown_to_secondary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestCanceledShownToSecondaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_expired\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestExpired); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_expired_shown_to_primary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestExpiredShownToPrimaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_expired_shown_to_secondary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestExpiredShownToSecondaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_rejected_shown_to_primary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestRejectedShownToPrimaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_rejected_shown_to_secondary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestRejectedShownToSecondaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_reminder\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestReminder); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_reminder_shown_to_primary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestReminderShownToPrimaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_reminder_shown_to_secondary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestReminderShownToSecondaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_revoked\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestRevoked); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_sent_shown_to_primary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestSentShownToPrimaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase \"team_merge_request_sent_shown_to_secondary_team\":\n\t\tif err = json.Unmarshal(body, &u.TeamMergeRequestSentShownToSecondaryTeam); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5aa41d68d3546cbacff524bd0ea3e8ba", "score": "0.59262913", "text": "func (r *ResourceType) UnmarshalJSON(b []byte) error {\n\ttype tmp ResourceType\n\tvar s struct {\n\t\ttmp\n\t\tAttributes map[string]interface{} `json:\"attributes\"`\n\t}\n\terr := json.Unmarshal(b, &s)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*r = ResourceType(s.tmp)\n\n\tif s.Attributes == nil {\n\t\treturn nil\n\t}\n\n\t// Populate attributes from the JSON map structure.\n\tattributes := make(map[string]Attribute)\n\tfor attributeName, attributeValues := range s.Attributes {\n\t\tattribute := new(Attribute)\n\t\tattribute.Details = make(map[string]interface{})\n\n\t\tattributeValuesMap, ok := attributeValues.(map[string]interface{})\n\t\tif !ok {\n\t\t\t// Got some strange resource type attribute representation, skip it.\n\t\t\tcontinue\n\t\t}\n\n\t\t// Populate extra and type attribute values.\n\t\tfor k, v := range attributeValuesMap {\n\t\t\tif k == \"type\" {\n\t\t\t\tif attributeType, ok := v.(string); ok {\n\t\t\t\t\tattribute.Type = attributeType\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tattribute.Details[k] = v\n\t\t\t}\n\t\t}\n\t\tattributes[attributeName] = *attribute\n\t}\n\n\tr.Attributes = attributes\n\n\treturn err\n}", "title": "" }, { "docid": "fff06a66fd2db8641f4ba4394fa17d5f", "score": "0.59257334", "text": "func (rt *RecordType) UnmarshalJSON(b []byte) error {\n\tif b[0] == '\"' && b[len(b)-1] == '\"' {\n\t\tb = b[1 : len(b)-1]\n\t} else {\n\t\treturn fmt.Errorf(\"unable to parse a RecordType from %#v\", string(b))\n\t}\n\t*rt = RecordType(string(b))\n\treturn nil\n}", "title": "" }, { "docid": "118e6533cd14243dcd04957be007bdb4", "score": "0.592542", "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": "9dccfb2886c2bc8e786ac512e5076df1", "score": "0.59248966", "text": "func (dst *FeedHome) UnmarshalJSON(data []byte) error {\n\tvar err error\n\t// use discriminator value to speed up the lookup\n\tvar jsonDict map[string]interface{}\n\terr = json.Unmarshal(data, &jsonDict)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to unmarshal JSON into map for the discrimintor lookup.\")\n\t}\n\n\t// check if the discriminator value is 'Article'\n\tif jsonDict[\"type\"] == \"Article\" {\n\t\t// try to unmarshal JSON data into Article\n\t\terr = json.Unmarshal(data, &dst.Article)\n\t\tif err == nil {\n\t\t\treturn nil // data stored in dst.Article, return on the first match\n\t\t} else {\n\t\t\tdst.Article = nil\n\t\t\treturn fmt.Errorf(\"Failed to unmarshal FeedHome as Article: %s\", err.Error())\n\t\t}\n\t}\n\n\t// check if the discriminator value is 'PersonHome'\n\tif jsonDict[\"type\"] == \"PersonHome\" {\n\t\t// try to unmarshal JSON data into PersonHome\n\t\terr = json.Unmarshal(data, &dst.PersonHome)\n\t\tif err == nil {\n\t\t\treturn nil // data stored in dst.PersonHome, return on the first match\n\t\t} else {\n\t\t\tdst.PersonHome = nil\n\t\t\treturn fmt.Errorf(\"Failed to unmarshal FeedHome as PersonHome: %s\", err.Error())\n\t\t}\n\t}\n\n\t// check if the discriminator value is 'article'\n\tif jsonDict[\"type\"] == \"article\" {\n\t\t// try to unmarshal JSON data into Article\n\t\terr = json.Unmarshal(data, &dst.Article)\n\t\tif err == nil {\n\t\t\treturn nil // data stored in dst.Article, return on the first match\n\t\t} else {\n\t\t\tdst.Article = nil\n\t\t\treturn fmt.Errorf(\"Failed to unmarshal FeedHome as Article: %s\", err.Error())\n\t\t}\n\t}\n\n\t// check if the discriminator value is 'person'\n\tif jsonDict[\"type\"] == \"person\" {\n\t\t// try to unmarshal JSON data into PersonHome\n\t\terr = json.Unmarshal(data, &dst.PersonHome)\n\t\tif err == nil {\n\t\t\treturn nil // data stored in dst.PersonHome, return on the first match\n\t\t} else {\n\t\t\tdst.PersonHome = nil\n\t\t\treturn fmt.Errorf(\"Failed to unmarshal FeedHome as PersonHome: %s\", err.Error())\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "05889c4ecf9333717919017350eeb6f0", "score": "0.59214187", "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": "9869befa76ee00d48b59912569b1d268", "score": "0.59195834", "text": "func (r *ResultType) UnmarshalJSON(data []byte) error {\n\tvar asInt int\n\tvar intErr error\n\n\tif err := json.Unmarshal(data, &asInt); err != nil {\n\t\tintErr = err\n\t} else {\n\t\t*r = ResultType(asInt)\n\t\treturn nil\n\t}\n\n\tvar asString string\n\n\tif err := json.Unmarshal(data, &asString); err != nil {\n\t\treturn fmt.Errorf(\"unsupported value type, neither int nor string: %w\", multierror.Append(intErr, err).ErrorOrNil())\n\t}\n\n\tswitch asString {\n\tcase \"TaskRunResult\":\n\t\t*r = TaskRunResultType\n\tcase \"InternalTektonResult\":\n\t\t*r = InternalTektonResultType\n\tdefault:\n\t\t*r = UnknownResultType\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9869befa76ee00d48b59912569b1d268", "score": "0.59195834", "text": "func (r *ResultType) UnmarshalJSON(data []byte) error {\n\tvar asInt int\n\tvar intErr error\n\n\tif err := json.Unmarshal(data, &asInt); err != nil {\n\t\tintErr = err\n\t} else {\n\t\t*r = ResultType(asInt)\n\t\treturn nil\n\t}\n\n\tvar asString string\n\n\tif err := json.Unmarshal(data, &asString); err != nil {\n\t\treturn fmt.Errorf(\"unsupported value type, neither int nor string: %w\", multierror.Append(intErr, err).ErrorOrNil())\n\t}\n\n\tswitch asString {\n\tcase \"TaskRunResult\":\n\t\t*r = TaskRunResultType\n\tcase \"InternalTektonResult\":\n\t\t*r = InternalTektonResultType\n\tdefault:\n\t\t*r = UnknownResultType\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cbb93550e7dc2743ba10b8cd2a235865", "score": "0.59183675", "text": "func (obj *expRemedyType) UnmarshalJSON(data []byte) error {\n\tvar ok bool\n\tif *obj, ok = genJSONStrToRemedyType[noQuotes(data)]; !ok {\n\t\treturn fmt.Errorf(\"unrecognized RemedyType value %v\", string(data))\n\t}\n\treturn nil\n}", "title": "" } ]
70a590a55d1d6eb17ee5e90e18c2edd1
OnEndpointsUpdate indicates an expected call of OnEndpointsUpdate
[ { "docid": "24477c3ba3cf8e8961690fb2863c2c4f", "score": "0.76523703", "text": "func (mr *MockProviderMockRecorder) OnEndpointsUpdate(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"OnEndpointsUpdate\", reflect.TypeOf((*MockProvider)(nil).OnEndpointsUpdate), arg0, arg1)\n}", "title": "" } ]
[ { "docid": "d0d3d2bad4690508844817c5b2845614", "score": "0.7333041", "text": "func (proxier *Proxier) OnEndpointsUpdate(oldEndpoints, endpoints *api.Endpoints) {\n\tnamespacedName := types.NamespacedName{Namespace: endpoints.Namespace, Name: endpoints.Name}\n\tif proxier.endpointsChanges.Update(&namespacedName, oldEndpoints, endpoints) && proxier.isInitialized() {\n//\t\tproxier.syncRunner.Run()\n\t\tproxier.syncProxyRules()\n\t}\n}", "title": "" }, { "docid": "7d90434e7c2bb3108b1773ba334e1588", "score": "0.7062914", "text": "func (m *MockProvider) OnEndpointsUpdate(arg0, arg1 *v1.Endpoints) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"OnEndpointsUpdate\", arg0, arg1)\n}", "title": "" }, { "docid": "914b8628e2f1bb8abd742c9536724c0e", "score": "0.69253695", "text": "func verifyEndpointsUpdate(ctx context.Context, updateCh *testutils.Channel, wantUpdate endpointsUpdateErrTuple) error {\n\tu, err := updateCh.Receive(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"timeout when waiting for a endpoints resource from the management server: %v\", err)\n\t}\n\tgot := u.(endpointsUpdateErrTuple)\n\tif wantUpdate.err != nil {\n\t\tif gotType, wantType := xdsresource.ErrType(got.err), xdsresource.ErrType(wantUpdate.err); gotType != wantType {\n\t\t\treturn fmt.Errorf(\"received update with error type %v, want %v\", gotType, wantType)\n\t\t}\n\t}\n\tcmpOpts := []cmp.Option{cmpopts.EquateEmpty(), cmpopts.IgnoreFields(xdsresource.EndpointsUpdate{}, \"Raw\")}\n\tif diff := cmp.Diff(wantUpdate.update, got.update, cmpOpts...); diff != \"\" {\n\t\treturn fmt.Errorf(\"received unepected diff in the endpoints resource update: (-want, got):\\n%s\", diff)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "36fccc6999036d425bf2b89ca6f5b180", "score": "0.6822206", "text": "func (s *MetalLBSpeaker) OnUpdateEndpoints(eps *k8s.Endpoints) error {\n\tif s.shutDown() {\n\t\treturn ErrShutDown\n\t}\n\tvar (\n\t\tepSliceID = eps.EndpointSliceID\n\t\tsvcID = epSliceID.ServiceID\n\t\tl = log.WithFields(logrus.Fields{\n\t\t\t\"component\": \"MetalLBSpeaker.OnUpdateEndpoints\",\n\t\t\t\"service-id\": svcID,\n\t\t})\n\t\tmeta = fence.Meta{}\n\t)\n\n\ts.Lock()\n\tdefer s.Unlock()\n\n\tif err := meta.FromObjectMeta(&eps.ObjectMeta); err != nil {\n\t\tl.WithError(err).Error(\"failed to parse event metadata\")\n\t}\n\n\tif svc, ok := s.services[svcID]; ok {\n\t\tl.Debug(\"adding event to queue\")\n\t\ts.queue.Add(epEvent{\n\t\t\tMeta: meta,\n\t\t\top: Update,\n\t\t\tid: svcID,\n\t\t\tsvc: convertService(svc),\n\t\t\teps: convertEndpoints(eps),\n\t\t})\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6112f8e8bc199213a96804d37c262e77", "score": "0.6747621", "text": "func (ep *baseEndpoint) changed(endpoints map[string]int) bool {\n\tif len(ep.endpoints) != len(endpoints) {\n\t\treturn true\n\t}\n\n\tfor key, val := range endpoints {\n\t\tif oldVal, exist := ep.endpoints[key]; !exist || oldVal != val {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "7e0b82dd817581ba94c3ae6be6830b2d", "score": "0.66993797", "text": "func verifyNoEndpointsUpdate(ctx context.Context, updateCh *testutils.Channel) error {\n\tsCtx, sCancel := context.WithTimeout(ctx, defaultTestShortTimeout)\n\tdefer sCancel()\n\tif u, err := updateCh.Receive(sCtx); err != context.DeadlineExceeded {\n\t\treturn fmt.Errorf(\"unexpected EndpointsUpdate: %v\", u)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8e8f3f8cc923a6626d919b7faed92e50", "score": "0.6507064", "text": "func (ml *ManagedListener) UpdateEndpoints() {\n\tif InCluster() {\n\t\tif ml.Endpoints == nil {\n\t\t\tml.Endpoints = Endpoints(ml.Clientset, ml.Service)\n\t\t\tml.EndpointsChanged = true\n\t\t}\n\t\tif ml.EndpointsChanged || !ml.canListen() {\n\t\t\tml.IPs = EndpointIPs(ml.Endpoints)\n\t\t\tml.Ports = EndpointSubsetPorts(ml.Endpoints)\n\t\t\tif len(ml.Ports) > 0 {\n\t\t\t\tml.Port = ml.Ports[0]\n\t\t\t} else {\n\t\t\t\tlog.Println(fmt.Errorf(\"%s\", \"No port endpoints available\"))\n\t\t\t}\n\t\t\tml.EndpointsChanged = false\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a16425db52d011fd9842d46650815f63", "score": "0.6465692", "text": "func (r *ReconcileVirtualMachineService) UpdateEndpoints(ctx *context.VirtualMachineServiceContext, service *corev1.Service) error {\n\tctx.Logger.V(5).Info(\"Updating VirtualMachineService endpoints\")\n\tdefer ctx.Logger.V(5).Info(\"Finished updating VirtualMachineService endpoints\")\n\n\tsubsets, err := r.generateSubsetsForService(ctx, service)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Repack subsets in canonical order so that comparison of two subsets gives consistent results.\n\tsubsets = utils.RepackSubsets(subsets)\n\n\t// See if there's actually an update here.\n\tcurrentEndpoints := &corev1.Endpoints{}\n\terr = r.Get(ctx, types.NamespacedName{Name: service.Name, Namespace: service.Namespace}, currentEndpoints)\n\tif err != nil {\n\t\tif !errors.IsNotFound(err) {\n\t\t\tctx.Logger.Error(err, \"Failed to list endpoints\")\n\t\t\treturn err\n\t\t}\n\n\t\tcurrentEndpoints = &corev1.Endpoints{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: service.Name,\n\t\t\t\tLabels: service.Labels,\n\t\t\t},\n\t\t}\n\t} else if apiequality.Semantic.DeepEqual(utils.RepackSubsets(currentEndpoints.Subsets), subsets) {\n\t\t// Ideally, we dont have to repack both the endpoints (current endpoints and the calculated one) before comparing since after the first update\n\t\t// we expect the endpoint subsets to always be in canonical order. However, some controller is re-ordering these endpoint subsets. We sort both\n\t\t// sides for a consistent comparison result. PR: 2623292\n\n\t\tctx.Logger.V(5).Info(\"No change, no need to update endpoints\", \"endpoints\", currentEndpoints)\n\t\treturn nil\n\t}\n\n\tnewEndpoints := r.makeEndpoints(ctx.VMService, currentEndpoints, subsets)\n\n\tcreateEndpoints := len(currentEndpoints.ResourceVersion) == 0\n\n\tctx.Logger.V(5).Info(\"EndpointSubsets have diverged. Will trigger Endpoint Create or Update\",\n\t\t\"currentEndpoints\", currentEndpoints, \"newEndpoints\", newEndpoints, \"isCreate\", createEndpoints)\n\n\tif createEndpoints {\n\t\tctx.Logger.Info(\"Creating service endpoints\", \"endpoints\", newEndpoints)\n\t\terr = r.Create(ctx, newEndpoints)\n\t} else {\n\t\tctx.Logger.Info(\"Updating service endpoints\", \"endpoints\", newEndpoints)\n\t\terr = r.Update(ctx, newEndpoints)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "626d67b86d26efe16acd059d954aeb55", "score": "0.6348656", "text": "func (cp *ConnProducer) UpdateEndpoints(endpoints []EndpointCriteria) {\n\tif len(endpoints) == 0 {\n\t\t// Ignore updates with empty endpoints\n\t\treturn\n\t}\n\tcp.Lock()\n\tdefer cp.Unlock()\n\n\tcp.nextEndpointIndex = 0\n\tcp.endpoints = endpoints\n}", "title": "" }, { "docid": "895147278f48e0b0093e275eda13aee2", "score": "0.6247046", "text": "func (l *LoadBalancer) UpdateEndpoints(urls []url.URL) {\n\tl.strategy.SetEndpoints(urls)\n}", "title": "" }, { "docid": "b080e13bf39872951e9d1c732527612f", "score": "0.62389696", "text": "func (mr *MockProviderMockRecorder) OnEndpointsAdd(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"OnEndpointsAdd\", reflect.TypeOf((*MockProvider)(nil).OnEndpointsAdd), arg0)\n}", "title": "" }, { "docid": "b80dce424dc8049c57d46505db4a6020", "score": "0.62281793", "text": "func (handler *Handler) endpointUpdate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {\n\tif !handler.authorizeEndpointManagement {\n\t\treturn &httperror.HandlerError{http.StatusServiceUnavailable, \"Endpoint management is disabled\", ErrEndpointManagementDisabled}\n\t}\n\n\tendpointID, err := request.RetrieveNumericRouteVariableValue(r, \"id\")\n\tif err != nil {\n\t\treturn &httperror.HandlerError{http.StatusBadRequest, \"Invalid endpoint identifier route variable\", err}\n\t}\n\n\tvar payload endpointUpdatePayload\n\terr = request.DecodeAndValidateJSONPayload(r, &payload)\n\tif err != nil {\n\t\treturn &httperror.HandlerError{http.StatusBadRequest, \"Invalid request payload\", err}\n\t}\n\n\tendpoint, err := handler.EndpointService.Endpoint(portainer.EndpointID(endpointID))\n\tif err == portainer.ErrObjectNotFound {\n\t\treturn &httperror.HandlerError{http.StatusNotFound, \"Unable to find an endpoint with the specified identifier inside the database\", err}\n\t} else if err != nil {\n\t\treturn &httperror.HandlerError{http.StatusInternalServerError, \"Unable to find an endpoint with the specified identifier inside the database\", err}\n\t}\n\n\tif payload.Name != nil {\n\t\tendpoint.Name = *payload.Name\n\t}\n\n\tif payload.URL != nil {\n\t\tendpoint.URL = *payload.URL\n\t}\n\n\tif payload.PublicURL != nil {\n\t\tendpoint.PublicURL = *payload.PublicURL\n\t}\n\n\tif payload.GroupID != nil {\n\t\tendpoint.GroupID = portainer.EndpointGroupID(*payload.GroupID)\n\t}\n\n\tif payload.Tags != nil {\n\t\tendpoint.Tags = payload.Tags\n\t}\n\n\tif payload.Status != nil {\n\t\tswitch *payload.Status {\n\t\tcase 1:\n\t\t\tendpoint.Status = portainer.EndpointStatusUp\n\t\t\tbreak\n\t\tcase 2:\n\t\t\tendpoint.Status = portainer.EndpointStatusDown\n\t\t\tbreak\n\t\tdefault:\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif endpoint.Type == portainer.AzureEnvironment {\n\t\tcredentials := endpoint.AzureCredentials\n\t\tif payload.AzureApplicationID != nil {\n\t\t\tcredentials.ApplicationID = *payload.AzureApplicationID\n\t\t}\n\t\tif payload.AzureTenantID != nil {\n\t\t\tcredentials.TenantID = *payload.AzureTenantID\n\t\t}\n\t\tif payload.AzureAuthenticationKey != nil {\n\t\t\tcredentials.AuthenticationKey = *payload.AzureAuthenticationKey\n\t\t}\n\n\t\thttpClient := client.NewHTTPClient()\n\t\t_, authErr := httpClient.ExecuteAzureAuthenticationRequest(&credentials)\n\t\tif authErr != nil {\n\t\t\treturn &httperror.HandlerError{http.StatusInternalServerError, \"Unable to authenticate against Azure\", authErr}\n\t\t}\n\t\tendpoint.AzureCredentials = credentials\n\t}\n\n\tif payload.TLS != nil {\n\t\tfolder := strconv.Itoa(endpointID)\n\n\t\tif *payload.TLS {\n\t\t\tendpoint.TLSConfig.TLS = true\n\t\t\tif payload.TLSSkipVerify != nil {\n\t\t\t\tendpoint.TLSConfig.TLSSkipVerify = *payload.TLSSkipVerify\n\n\t\t\t\tif !*payload.TLSSkipVerify {\n\t\t\t\t\tcaCertPath, _ := handler.FileService.GetPathForTLSFile(folder, portainer.TLSFileCA)\n\t\t\t\t\tendpoint.TLSConfig.TLSCACertPath = caCertPath\n\t\t\t\t} else {\n\t\t\t\t\tendpoint.TLSConfig.TLSCACertPath = \"\"\n\t\t\t\t\thandler.FileService.DeleteTLSFile(folder, portainer.TLSFileCA)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif payload.TLSSkipClientVerify != nil {\n\t\t\t\tif !*payload.TLSSkipClientVerify {\n\t\t\t\t\tcertPath, _ := handler.FileService.GetPathForTLSFile(folder, portainer.TLSFileCert)\n\t\t\t\t\tendpoint.TLSConfig.TLSCertPath = certPath\n\t\t\t\t\tkeyPath, _ := handler.FileService.GetPathForTLSFile(folder, portainer.TLSFileKey)\n\t\t\t\t\tendpoint.TLSConfig.TLSKeyPath = keyPath\n\t\t\t\t} else {\n\t\t\t\t\tendpoint.TLSConfig.TLSCertPath = \"\"\n\t\t\t\t\thandler.FileService.DeleteTLSFile(folder, portainer.TLSFileCert)\n\t\t\t\t\tendpoint.TLSConfig.TLSKeyPath = \"\"\n\t\t\t\t\thandler.FileService.DeleteTLSFile(folder, portainer.TLSFileKey)\n\t\t\t\t}\n\t\t\t}\n\n\t\t} else {\n\t\t\tendpoint.TLSConfig.TLS = false\n\t\t\tendpoint.TLSConfig.TLSSkipVerify = false\n\t\t\tendpoint.TLSConfig.TLSCACertPath = \"\"\n\t\t\tendpoint.TLSConfig.TLSCertPath = \"\"\n\t\t\tendpoint.TLSConfig.TLSKeyPath = \"\"\n\t\t\terr = handler.FileService.DeleteTLSFiles(folder)\n\t\t\tif err != nil {\n\t\t\t\treturn &httperror.HandlerError{http.StatusInternalServerError, \"Unable to remove TLS files from disk\", err}\n\t\t\t}\n\t\t}\n\t}\n\n\tif payload.URL != nil || payload.TLS != nil || endpoint.Type == portainer.AzureEnvironment {\n\t\t_, err = handler.ProxyManager.CreateAndRegisterProxy(endpoint)\n\t\tif err != nil {\n\t\t\treturn &httperror.HandlerError{http.StatusInternalServerError, \"Unable to register HTTP proxy for the endpoint\", err}\n\t\t}\n\t}\n\n\terr = handler.EndpointService.UpdateEndpoint(endpoint.ID, endpoint)\n\tif err != nil {\n\t\treturn &httperror.HandlerError{http.StatusInternalServerError, \"Unable to persist endpoint changes inside the database\", err}\n\t}\n\n\treturn response.JSON(w, endpoint)\n}", "title": "" }, { "docid": "300c999cf596be19a882f2e6b863028a", "score": "0.61958945", "text": "func (b *blocksProviderImpl) UpdateEndpoints(endpoints []*orderers.Endpoint) {\n\tb.client.UpdateEndpoints(endpoints)\n}", "title": "" }, { "docid": "bcfba60fefd68dde360a84306db313d7", "score": "0.6133974", "text": "func (m *endpointManager) OnUpdate(msg interface{}) {\n\tswitch msg := msg.(type) {\n\tcase *proto.WorkloadEndpointUpdate:\n\t\tlog.WithField(\"workloadEndpointId\", msg.Id).Info(\"Processing WorkloadEndpointUpdate\")\n\t\tm.pendingWlEpUpdates[*msg.Id] = msg.Endpoint\n\tcase *proto.WorkloadEndpointRemove:\n\t\tlog.WithField(\"workloadEndpointId\", msg.Id).Info(\"Processing WorkloadEndpointRemove\")\n\t\tm.pendingWlEpUpdates[*msg.Id] = nil\n\tcase *proto.ActivePolicyUpdate:\n\t\tlog.WithField(\"policyID\", msg.Id).Info(\"Processing ActivePolicyUpdate\")\n\t\tm.ProcessPolicyProfileUpdate(policysets.PolicyNamePrefix + msg.Id.Name)\n\tcase *proto.ActiveProfileUpdate:\n\t\tlog.WithField(\"profileId\", msg.Id).Info(\"Processing ActiveProfileUpdate\")\n\t\tm.ProcessPolicyProfileUpdate(policysets.ProfileNamePrefix + msg.Id.Name)\n\t}\n}", "title": "" }, { "docid": "24508634bda9015d7e21e00cb56b4e25", "score": "0.6106226", "text": "func TestServiceEndpointAzureRM_Update_DoesNotSwallowError(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tr := ResourceServiceEndpointAzureRM()\n\tfor _, resource := range azurermTestServiceEndpointsAzureRM {\n\t\tresourceData := getResourceData(t, resource)\n\t\tflattenServiceEndpointAzureRM(resourceData, &resource, azurermTestServiceEndpointAzureRMProjectID)\n\n\t\tbuildClient := azdosdkmocks.NewMockServiceendpointClient(ctrl)\n\t\tclients := &client.AggregatedClient{ServiceEndpointClient: buildClient, Ctx: context.Background()}\n\n\t\texpectedArgs := serviceendpoint.UpdateServiceEndpointArgs{\n\t\t\tEndpoint: &resource,\n\t\t\tEndpointId: resource.Id,\n\t\t}\n\n\t\tbuildClient.\n\t\t\tEXPECT().\n\t\t\tUpdateServiceEndpoint(clients.Ctx, expectedArgs).\n\t\t\tReturn(nil, errors.New(\"UpdateServiceEndpoint() Failed\")).\n\t\t\tTimes(1)\n\n\t\terr := r.Update(resourceData, clients)\n\t\trequire.Contains(t, err.Error(), \"UpdateServiceEndpoint() Failed\")\n\t}\n}", "title": "" }, { "docid": "3d5f6efe7255d74078366749d0b07f77", "score": "0.6104921", "text": "func (mr *MockProviderMockRecorder) OnEndpointsSynced() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"OnEndpointsSynced\", reflect.TypeOf((*MockProvider)(nil).OnEndpointsSynced))\n}", "title": "" }, { "docid": "abe4403b3cdf7e2076102b41be20bb3e", "score": "0.60993695", "text": "func (adapter *EndpointsAdapter) Update(namespace string, endpoints *corev1.Endpoints) (*corev1.Endpoints, error) {\n\tendpoints, err := adapter.endpointClient.Endpoints(namespace).Update(context.TODO(), endpoints, metav1.UpdateOptions{})\n\tif err == nil {\n\t\terr = adapter.EnsureEndpointSliceFromEndpoints(namespace, endpoints)\n\t}\n\treturn endpoints, err\n}", "title": "" }, { "docid": "bc54f8970a22a85c7cef29d25245dcf1", "score": "0.6093578", "text": "func (proxier *Proxier) OnEndpointsAdd(endpoints *api.Endpoints) {\n\tnamespacedName := types.NamespacedName{Namespace: endpoints.Namespace, Name: endpoints.Name}\n\tif proxier.endpointsChanges.Update(&namespacedName, nil, endpoints) && proxier.isInitialized() {\n//\t\tproxier.syncRunner.Run()\n\t\tproxier.syncProxyRules()\n\t}\n}", "title": "" }, { "docid": "ad4f70d0c103b9e1d97d793bb8e22b93", "score": "0.6053609", "text": "func assertEqualEndpoints(t *testing.T, expected, actual *Endpoint) {\n\tif !reflect.DeepEqual(*expected, *actual) {\n\t\tt.Errorf(\"Expected endpoint: %v, Actual %v\", expected, actual)\n\t}\n}", "title": "" }, { "docid": "8f73f8e564916837ea55e2b85b4231ba", "score": "0.60195786", "text": "func hasToBeUpdated(home, foreign []corev1.EndpointSubset) bool {\n\tif len(home) != len(foreign) {\n\t\tklog.V(6).Info(\"the ep has to be updated because home and foreign subsets lengths are different\")\n\t\treturn true\n\t}\n\tfor i := 0; i < len(home); i++ {\n\t\tif len(home[i].Addresses) != len(foreign[i].Addresses) {\n\t\t\tklog.V(6).Info(\"the ep has to be updated because home and foreign addresses lengths are different\")\n\t\t\treturn true\n\t\t}\n\t\tfor j := 0; j < len(home[i].Addresses); j++ {\n\t\t\tif home[i].Addresses[j].IP != foreign[i].Addresses[j].IP {\n\t\t\t\tklog.V(6).Info(\"the ep has to be updated because home and foreign IPs are different\")\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9bb3b9288fce30ac85d43d1592d55f11", "score": "0.601066", "text": "func (manager *Manager) OnUpdateEndpoint(endpoint *k8sTypes.CiliumEndpoint) {\n\tid := types.NamespacedName{\n\t\tName: endpoint.GetName(),\n\t\tNamespace: endpoint.GetNamespace(),\n\t}\n\n\tmanager.pendingEndpointEventsLock.Lock()\n\tmanager.pendingEndpointEvents[id] = endpoint\n\tmanager.pendingEndpointEventsLock.Unlock()\n\n\tmanager.endpointEventsQueue.Add(id)\n}", "title": "" }, { "docid": "dfe2d0257a5a7adc50ebc4a389740885", "score": "0.5946561", "text": "func (mm *Manager) OnBcsEndpointUpdate(oldObj, newObj interface{}) {\n\toldBcsendpoint, okOld := oldObj.(*v2.BcsEndpoint)\n\tif !okOld {\n\t\tmesosCritical.WithLabelValues(typeBcsEndpoint, eventUpdate).Inc()\n\t\tblog.Errorf(\"[Critical]MesosManager event handler get unknown type oldObj %v OnBcsEndpointUpdate\", oldObj)\n\t\treturn\n\t}\n\tnewBcsendpoint, okNew := newObj.(*v2.BcsEndpoint)\n\tif !okNew {\n\t\tmesosCritical.WithLabelValues(typeBcsEndpoint, eventUpdate).Inc()\n\t\tblog.Errorf(\"[Critical]MesosManager event handler get unknown type newObj %v OnBcsEndpointUpdate\", newObj)\n\t\treturn\n\t}\n\tif reflect.DeepEqual(oldBcsendpoint.Spec.Endpoints, newBcsendpoint.Spec.Endpoints) {\n\t\tmesosEvent.WithLabelValues(typeBcsEndpoint, eventUpdate, statusNotFinish).Inc()\n\t\tblog.Warnf(\"MesosManager BcsEndpoint %s/%s No changed, skip update event\",\n\t\t\tnewBcsendpoint.GetNamespace(), newBcsendpoint.GetName())\n\t\treturn\n\t}\n\tblog.Infof(\"BcsEndpoint %s/%s update, ready to refresh\", newBcsendpoint.GetNamespace(), newBcsendpoint.GetName())\n\tsvcLister := mm.svcLister.BcsServices(newBcsendpoint.GetNamespace())\n\tsvc, err := svcLister.Get(newBcsendpoint.GetName())\n\tif err != nil {\n\t\tmesosCritical.WithLabelValues(typeBcsEndpoint, eventUpdate).Inc()\n\t\tmesosEvent.WithLabelValues(typeBcsEndpoint, eventUpdate, statusFailure).Inc()\n\t\tblog.Errorf(\"[Critical]MesosManager Get BcsService by bcsendpoint Namespace %s failed, %s\",\n\t\t\tnewBcsendpoint.GetNamespace(), err.Error())\n\t\treturn\n\t}\n\tif svc == nil {\n\t\tmesosCritical.WithLabelValues(typeBcsEndpoint, eventUpdate).Inc()\n\t\tmesosEvent.WithLabelValues(typeBcsEndpoint, eventUpdate, statusFailure).Inc()\n\t\tblog.Errorf(\"[Critical]BcsEndpoint %s/%s get no relative BcsService in Cache when updating\",\n\t\t\tnewBcsendpoint.GetNamespace(), newBcsendpoint.GetName())\n\t\treturn\n\t}\n\tmesosEvent.WithLabelValues(typeBcsEndpoint, eventUpdate, statusSuccess).Inc()\n\tmm.updateAppService(svc, newBcsendpoint)\n}", "title": "" }, { "docid": "7d574209f764b32ee6331de43d454ecc", "score": "0.5944567", "text": "func (m *Manager) updateAppEndpointInstances(update *pbConductor.ServiceUpdate) {\n\tif update.Endpoints != nil && len(update.Endpoints) > 0 {\n\t\tfor _, endpoint := range update.Endpoints {\n\t\t\t_, err := m.AppClient.AddAppEndpoint(context.Background(), &pbApplication.AddAppEndpointRequest{\n\t\t\t\tOrganizationId: update.OrganizationId,\n\t\t\t\tAppInstanceId: update.ApplicationInstanceId,\n\t\t\t\tServiceGroupInstanceId: update.ServiceGroupInstanceId,\n\t\t\t\tServiceInstanceId: update.ServiceInstanceId,\n\t\t\t\tServiceName: update.ServiceName,\n\t\t\t\tEndpointInstance: endpoint,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tlog.Error().Str(\"error\", conversions.ToDerror(err).DebugReport()).\n\t\t\t\t\tStr(\"serviceInstanceId\", update.ServiceInstanceId).\n\t\t\t\t\tStr(\"endpointInstanceId\", endpoint.EndpointInstanceId).\n\t\t\t\t\tMsg(\"impossible to update appEndpointInstance\")\n\t\t\t}\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "d600254f79d9671db13a7a526fda7da8", "score": "0.5912675", "text": "func ExampleEndpointsClient_Update() {\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 := armtrafficmanager.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tres, err := clientFactory.NewEndpointsClient().Update(ctx, \"azuresdkfornetautoresttrafficmanager1421\", \"azsmnet6386\", armtrafficmanager.EndpointTypeExternalEndpoints, \"azsmnet7187\", armtrafficmanager.Endpoint{\n\t\tName: to.Ptr(\"azsmnet7187\"),\n\t\tType: to.Ptr(\"Microsoft.Network/trafficManagerProfiles/externalEndpoints\"),\n\t\tID: to.Ptr(\"/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1421/providers/Microsoft.Network/trafficManagerProfiles/azsmnet6386/externalEndpoints/azsmnet7187\"),\n\t\tProperties: &armtrafficmanager.EndpointProperties{\n\t\t\tTarget: to.Ptr(\"another.foobar.contoso.com\"),\n\t\t},\n\t}, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t// You could use response here. We use blank identifier for just demo purposes.\n\t_ = res\n\t// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t// res.Endpoint = armtrafficmanager.Endpoint{\n\t// \tName: to.Ptr(\"azsmnet7187\"),\n\t// \tType: to.Ptr(\"Microsoft.Network/trafficManagerProfiles/externalEndpoints\"),\n\t// \tID: to.Ptr(\"/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1421/providers/Microsoft.Network/trafficManagerProfiles/azsmnet6386/externalEndpoints/azsmnet7187\"),\n\t// \tProperties: &armtrafficmanager.EndpointProperties{\n\t// \t\tEndpointLocation: to.Ptr(\"North Europe\"),\n\t// \t\tEndpointMonitorStatus: to.Ptr(armtrafficmanager.EndpointMonitorStatusCheckingEndpoint),\n\t// \t\tEndpointStatus: to.Ptr(armtrafficmanager.EndpointStatusEnabled),\n\t// \t\tPriority: to.Ptr[int64](1),\n\t// \t\tTarget: to.Ptr(\"another.foobar.contoso.com\"),\n\t// \t\tWeight: to.Ptr[int64](1),\n\t// \t},\n\t// }\n}", "title": "" }, { "docid": "8e60935a9824ef9352689c4507aaadd3", "score": "0.5912417", "text": "func (c *authenticatedConnection) UpdateEndpoints(endpoints []string) error {\n\tif err := c.conn.UpdateEndpoints(endpoints); err != nil {\n\t\treturn driver.WithStack(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9675dee050745be0cb5499b66bdb715f", "score": "0.5903001", "text": "func (endpointSliceStrategy) ValidateUpdate(ctx context.Context, new, old runtime.Object) field.ErrorList {\n\tnewEPS := new.(*discovery.EndpointSlice)\n\toldEPS := old.(*discovery.EndpointSlice)\n\treturn validation.ValidateEndpointSliceUpdate(newEPS, oldEPS)\n}", "title": "" }, { "docid": "0c50673333c18e5d3a3e5a273d05f598", "score": "0.58719057", "text": "func (m *MockProvider) OnEndpointsSynced() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"OnEndpointsSynced\")\n}", "title": "" }, { "docid": "80284554341fc6c7db235e3b9fd47b2d", "score": "0.586877", "text": "func (ep *baseEndpoint) setEndpoints(endpoints map[string]int) {\n\tif !ep.changed(endpoints) {\n\t\treturn\n\t}\n\n\tep.lock.Lock()\n\tep.endpoints = endpoints\n\tep.scheduler = wrrScheduler(ep.endpoints)\n\tep.lock.Unlock()\n}", "title": "" }, { "docid": "9057c12d90743fea8c9d90c3932c4a18", "score": "0.5836237", "text": "func (proxier *Proxier) OnEndpointsDelete(endpoints *api.Endpoints) {\n\tnamespacedName := types.NamespacedName{Namespace: endpoints.Namespace, Name: endpoints.Name}\n\tif proxier.endpointsChanges.Update(&namespacedName, endpoints, nil) && proxier.isInitialized() {\n//\t\tproxier.syncRunner.Run()\n\t\tproxier.syncProxyRules()\n\t}\n}", "title": "" }, { "docid": "fb3ce409605e0ac0348042d2a4ebbe18", "score": "0.58163244", "text": "func (mr *MockProviderMockRecorder) OnEndpointsDelete(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"OnEndpointsDelete\", reflect.TypeOf((*MockProvider)(nil).OnEndpointsDelete), arg0)\n}", "title": "" }, { "docid": "b24fcd013f0c723fbd80cb3e0b71d1b0", "score": "0.5815135", "text": "func TestEventServiceUpdate(t *testing.T) {\n\tvar result EventService\n\terr := json.NewDecoder(strings.NewReader(eventServiceBody)).Decode(&result)\n\n\tif err != nil {\n\t\tt.Errorf(\"Error decoding JSON: %s\", err)\n\t}\n\n\ttestClient := &common.TestClient{}\n\tresult.SetClient(testClient)\n\n\tresult.DeliveryRetryAttempts = 20\n\tresult.DeliveryRetryIntervalSeconds = 60\n\tresult.ServiceEnabled = true\n\terr = result.Update(context.Background())\n\n\tif err != nil {\n\t\tt.Errorf(\"Error making Update call: %s\", err)\n\t}\n\n\tcalls := testClient.CapturedCalls()\n\n\tif !strings.Contains(calls[0].Payload, \"DeliveryRetryAttempts:20\") {\n\t\tt.Errorf(\"Unexpected DeliveryRetryAttempts update payload: %s\", calls[0].Payload)\n\t}\n\n\tif !strings.Contains(calls[0].Payload, \"DeliveryRetryIntervalSeconds:60\") {\n\t\tt.Errorf(\"Unexpected DeliveryRetryIntervalSeconds update payload: %s\", calls[0].Payload)\n\t}\n\n\tif strings.Contains(calls[0].Payload, \"ServiceEnabled\") {\n\t\tt.Errorf(\"Unexpected DeliveryRetryIntervalSeconds update payload: %s\", calls[0].Payload)\n\t}\n}", "title": "" }, { "docid": "8510929941911d6c9d2d40d4907ad8fa", "score": "0.58011645", "text": "func (c *Conn) epUpdate(ctx context.Context) {\n\tvar lastEndpoints []string\n\tvar lastCancel func()\n\tvar lastDone chan struct{}\n\n\tvar regularUpdate <-chan time.Time\n\tif !version.IsMobile() {\n\t\t// We assume that LinkChange notifications are plumbed through well\n\t\t// on our mobile clients, so don't do the timer thing to save radio/battery/CPU/etc.\n\t\tticker := time.NewTicker(28 * time.Second) // just under 30s, a likely UDP NAT timeout\n\t\tdefer ticker.Stop()\n\t\tregularUpdate = ticker.C\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tif lastCancel != nil {\n\t\t\t\tlastCancel()\n\t\t\t}\n\t\t\treturn\n\t\tcase <-c.startEpUpdate:\n\t\tcase <-regularUpdate:\n\t\t}\n\n\t\tif lastCancel != nil {\n\t\t\tlastCancel()\n\t\t\t<-lastDone\n\t\t}\n\t\tvar epCtx context.Context\n\t\tepCtx, lastCancel = context.WithCancel(ctx)\n\t\tlastDone = make(chan struct{})\n\n\t\tgo func() {\n\t\t\tdefer close(lastDone)\n\n\t\t\tc.updateNetInfo() // best effort\n\t\t\tc.cleanStaleDerp()\n\n\t\t\tendpoints, err := c.determineEndpoints(epCtx)\n\t\t\tif err != nil {\n\t\t\t\tc.logf(\"magicsock.Conn: endpoint update failed: %v\", err)\n\t\t\t\t// TODO(crawshaw): are there any conditions under which\n\t\t\t\t// we should trigger a retry based on the error here?\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif stringsEqual(endpoints, lastEndpoints) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlastEndpoints = endpoints\n\t\t\t// TODO(bradfiz): get nearestDerp back to ipn for a HostInfo update\n\t\t\tc.epFunc(endpoints)\n\t\t}()\n\t}\n}", "title": "" }, { "docid": "35a4841c0f863c2cbc6cc54093a61b3e", "score": "0.5801046", "text": "func (l *L7EndpointsCalculator) ValidateEndpoints(endpointData []types.EndpointsData, endpointPodMap types.EndpointPodMap, dupCount int) error {\n\t// Endpoint count from EndpointPodMap\n\tcountFromPodMap := len(endpointPodMap) + dupCount\n\tif countFromPodMap == 0 {\n\t\tl.logger.Info(\"Detected endpoint count from endpointPodMap going to zero\", \"endpointPodMap\", endpointPodMap)\n\t\treturn fmt.Errorf(\"%w: Detect endpoint count goes to zero\", types.ErrEPCalculationCountZero)\n\t}\n\t// Endpoint count from EndpointData\n\tcountFromEndpointData := 0\n\tfor _, ed := range endpointData {\n\t\tcountFromEndpointData += len(ed.Addresses)\n\t}\n\tif countFromEndpointData == 0 {\n\t\tl.logger.Info(\"Detected endpoint count from endpointData going to zero\", \"endpointData\", endpointData)\n\t\treturn fmt.Errorf(\"%w: Detect endpoint count goes to zero\", types.ErrEPSEndpointCountZero)\n\t}\n\n\tif countFromEndpointData != countFromPodMap {\n\t\tl.logger.Info(\"Detected error when comparing endpoint counts\", \"countFromEndpointData\", countFromEndpointData, \"countFromPodMap\", countFromPodMap, \"endpointData\", endpointData, \"endpointPodMap\", endpointPodMap, \"dupCount\", dupCount)\n\t\treturn fmt.Errorf(\"%w: Detect endpoint mismatch, count from endpoint slice=%d, count after calculation=%d\", types.ErrEPCountsDiffer, countFromEndpointData, countFromPodMap)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "af964a632a2d12c2eda43a4198f4a79a", "score": "0.58001196", "text": "func (c *endpointCache) Update(event Event) {\n\tc.mtx.Lock()\n\tdefer c.mtx.Unlock()\n\n\t// Happy path.\n\tif event.Err == nil {\n\t\tc.updateCache(event.Instances)\n\t\tc.err = nil\n\t\treturn\n\t}\n\n\t// Sad path. Something's gone wrong in sd.\n\tc.logger.Log(\"err\", event.Err)\n\tif !c.options.invalidateOnError {\n\t\treturn // keep returning the last known endpoints on error\n\t}\n\tif c.err != nil {\n\t\treturn // already in the error state, do nothing & keep original error\n\t}\n\tc.err = event.Err\n\t// set new deadline to invalidate Endpoints unless non-error Event is received\n\tc.invalidateDeadline = c.timeNow().Add(c.options.invalidateTimeout)\n\treturn\n}", "title": "" }, { "docid": "07c006c90e77e19b6bb37020a154ce46", "score": "0.5795574", "text": "func (proxier *Proxier) OnEndpointsSynced() {\n\tproxier.mu.Lock()\n\tproxier.endpointsSynced = true\n\tproxier.mu.Unlock()\n\n\tproxier.syncProxyRules()\n}", "title": "" }, { "docid": "23d8288ed3d9d2f8f008def9565f255a", "score": "0.57927006", "text": "func (a *apiEndpoint) Update() error {\n\ta.e.mutex.RLock()\n\ta.SetEntry(\"server\", api.String(a.e.poolEntry.Desc))\n\ta.SetEntry(\"status\", api.String(a.e.status.String()))\n\tif a.e.lastErr != nil {\n\t\ta.SetEntry(\"last_error\", api.String(a.e.lastErr.Error()))\n\t\ta.SetEntry(\"last_error_time\", api.String(a.e.lastErrTime.Format(time.RFC3339)))\n\t} else {\n\t\ta.SetEntry(\"last_error\", api.Null)\n\t\ta.SetEntry(\"last_error_time\", api.Null)\n\t}\n\ta.SetEntry(\"pendingPayloads\", api.Number(a.e.NumPending()))\n\ta.SetEntry(\"publishedLines\", api.Number(a.e.LineCount()))\n\ta.SetEntry(\"averageLatency\", api.Float(a.e.AverageLatency()/time.Millisecond))\n\ta.e.mutex.RUnlock()\n\n\treturn nil\n}", "title": "" }, { "docid": "f4c681914e767dc6b16244cd1e2ca511", "score": "0.577304", "text": "func (ln *LocalNode) updateEndpoints() {\n\tip4, udp4 := ln.endpoint4.get()\n\tip6, udp6 := ln.endpoint6.get()\n\n\tif ip4 != nil && !ip4.IsUnspecified() {\n\t\tln.set(qnr.IPv4(ip4))\n\t} else {\n\t\tln.delete(qnr.IPv4{})\n\t}\n\tif ip6 != nil && !ip6.IsUnspecified() {\n\t\tln.set(qnr.IPv6(ip6))\n\t} else {\n\t\tln.delete(qnr.IPv6{})\n\t}\n\tif udp4 != 0 {\n\t\tln.set(qnr.UDP(udp4))\n\t} else {\n\t\tln.delete(qnr.UDP(0))\n\t}\n\tif udp6 != 0 && udp6 != udp4 {\n\t\tln.set(qnr.UDP6(udp6))\n\t} else {\n\t\tln.delete(qnr.UDP6(0))\n\t}\n}", "title": "" }, { "docid": "f52aa4bfe068a02c46c14b50befe304c", "score": "0.5764902", "text": "func (m *endpointManager) markAllEndpointForRefresh() {\n\tfor k, v := range m.activeWlEndpoints {\n\t\tif _, ok := m.pendingWlEpUpdates[k]; ok {\n\t\t\t// Endpoint already has a pending update, make sure we don't overwrite it.\n\t\t\tcontinue\n\t\t}\n\t\tm.pendingWlEpUpdates[k] = v\n\t}\n}", "title": "" }, { "docid": "83048dce9e89f0f48378603e0ad540ac", "score": "0.5712357", "text": "func (m *MockProvider) OnEndpointsAdd(arg0 *v1.Endpoints) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"OnEndpointsAdd\", arg0)\n}", "title": "" }, { "docid": "95cc8837c661ac1494b3707cdf40aca5", "score": "0.5708148", "text": "func shouldHandleUpdate(e event.UpdateEvent) bool {\n\tswitch v := e.ObjectOld.(type) {\n\tcase *corev1.ConfigMap:\n\t\treturn !reflect.DeepEqual(v.Data, e.ObjectNew.(*corev1.ConfigMap).Data)\n\tcase *corev1.Secret:\n\t\treturn !reflect.DeepEqual(v.Data, e.ObjectNew.(*corev1.Secret).Data)\n\t}\n\treturn true\n}", "title": "" }, { "docid": "2cdc01002ba4e58ecb0c7f28db1f6c89", "score": "0.5688902", "text": "func (endpointSliceStrategy) AllowCreateOnUpdate() bool {\n\treturn false\n}", "title": "" }, { "docid": "b21a76df567b159ba155408e797773f9", "score": "0.5682525", "text": "func (e *EndpointController) SyncServiceEndpoints() error {\n\tservices, err := e.client.Services(api.NamespaceAll).List(labels.Everything())\n\tif err != nil {\n\t\tglog.Errorf(\"Failed to list services: %v\", err)\n\t\treturn err\n\t}\n\tvar resultErr error\n\tfor _, service := range services.Items {\n\t\tif service.Spec.Selector == nil {\n\t\t\t// services without a selector receive no endpoints from this controller;\n\t\t\t// these services will receive the endpoints that are created out-of-band via the REST API.\n\t\t\tcontinue\n\t\t}\n\n\t\tglog.V(5).Infof(\"About to update endpoints for service %s/%s\", service.Namespace, service.Name)\n\t\tpods, err := e.client.Pods(service.Namespace).List(labels.Set(service.Spec.Selector).AsSelector())\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"Error syncing service: %s/%s, skipping\", service.Namespace, service.Name)\n\t\t\tresultErr = err\n\t\t\tcontinue\n\t\t}\n\t\tendpoints := []api.Endpoint{}\n\n\t\tfor _, pod := range pods.Items {\n\t\t\tport, err := findPort(&pod, service.Spec.ContainerPort)\n\t\t\tif err != nil {\n\t\t\t\tglog.Errorf(\"Failed to find port for service %s/%s: %v\", service.Namespace, service.Name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif len(pod.Status.PodIP) == 0 {\n\t\t\t\tglog.Errorf(\"Failed to find an IP for pod %s/%s\", pod.Namespace, pod.Name)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tinService := false\n\t\t\tfor _, c := range pod.Status.Conditions {\n\t\t\t\tif c.Type == api.PodReady && c.Status == api.ConditionFull {\n\t\t\t\t\tinService = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !inService {\n\t\t\t\tglog.V(5).Infof(\"Pod is out of service: %v/%v\", pod.Namespace, pod.Name)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tendpoints = append(endpoints, api.Endpoint{IP: pod.Status.PodIP, Port: port})\n\t\t}\n\t\tcurrentEndpoints, err := e.client.Endpoints(service.Namespace).Get(service.Name)\n\t\tif err != nil {\n\t\t\tif errors.IsNotFound(err) {\n\t\t\t\tcurrentEndpoints = &api.Endpoints{\n\t\t\t\t\tObjectMeta: api.ObjectMeta{\n\t\t\t\t\t\tName: service.Name,\n\t\t\t\t\t},\n\t\t\t\t\tProtocol: service.Spec.Protocol,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tglog.Errorf(\"Error getting endpoints: %v\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tnewEndpoints := &api.Endpoints{}\n\t\t*newEndpoints = *currentEndpoints\n\t\tnewEndpoints.Endpoints = endpoints\n\n\t\tif len(currentEndpoints.ResourceVersion) == 0 {\n\t\t\t// No previous endpoints, create them\n\t\t\t_, err = e.client.Endpoints(service.Namespace).Create(newEndpoints)\n\t\t} else {\n\t\t\t// Pre-existing\n\t\t\tif currentEndpoints.Protocol == service.Spec.Protocol && endpointsEqual(currentEndpoints, endpoints) {\n\t\t\t\tglog.V(5).Infof(\"protocol and endpoints are equal for %s/%s, skipping update\", service.Namespace, service.Name)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t_, err = e.client.Endpoints(service.Namespace).Update(newEndpoints)\n\t\t}\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"Error updating endpoints: %v\", err)\n\t\t\tcontinue\n\t\t}\n\t}\n\treturn resultErr\n}", "title": "" }, { "docid": "f969e2e41da1a58a3bb26e8ea2a6c9aa", "score": "0.5674912", "text": "func (endpointSliceStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {\n\tnewEPS := obj.(*discovery.EndpointSlice)\n\toldEPS := old.(*discovery.EndpointSlice)\n\n\t// Increment generation if anything other than meta changed\n\t// This needs to be changed if a status attribute is added to EndpointSlice\n\togNewMeta := newEPS.ObjectMeta\n\togOldMeta := oldEPS.ObjectMeta\n\tnewEPS.ObjectMeta = v1.ObjectMeta{}\n\toldEPS.ObjectMeta = v1.ObjectMeta{}\n\n\tif !apiequality.Semantic.DeepEqual(newEPS, oldEPS) {\n\t\togNewMeta.Generation = ogOldMeta.Generation + 1\n\t}\n\n\tnewEPS.ObjectMeta = ogNewMeta\n\toldEPS.ObjectMeta = ogOldMeta\n\n\tdropDisabledConditionsOnUpdate(oldEPS, newEPS)\n}", "title": "" }, { "docid": "7f186740feee92ae51110ac84bca21ca", "score": "0.5616617", "text": "func assertEqualEndpointLists(t *testing.T, expected, actual []*Endpoint) {\n\texpectedSet := map[string]*Endpoint{}\n\tfor _, ep := range expected {\n\t\tuid, found := ep.getSingleValuedAttrs()[DestinationUID.AttrName()]\n\t\tif !found {\n\t\t\tt.Fatalf(\"expected ep found with no UID is an indication of bad test data: '%v'\", ep)\n\t\t}\n\t\texpectedSet[uid] = ep\n\t}\n\tactualSet := map[string]*Endpoint{}\n\tfor _, ep := range actual {\n\t\tuid, found := ep.getSingleValuedAttrs()[DestinationUID.AttrName()]\n\t\tif !found {\n\t\t\tt.Errorf(\"actual ep found with no UID '%s'\", epDebugInfo(ep))\n\t\t\tcontinue\n\t\t}\n\t\tactualSet[uid] = ep\n\t}\n\tfor uid, expectedEp := range expectedSet {\n\t\tactualEp, found := actualSet[uid]\n\t\tif !found {\n\t\t\tt.Errorf(\"expecting endpoint\\nShortForm: %s\\nLongForm : %s\\nfound none\", epDebugInfo(expectedEp), *expectedEp)\n\t\t\tcontinue\n\t\t}\n\t\tassertEqualEndpoints(t, expectedEp, actualEp)\n\t\tdelete(actualSet, uid)\n\t}\n\tfor _, ep := range actualSet {\n\t\tt.Errorf(\"unexpected endpoint found: %s\", epDebugInfo(ep))\n\t}\n\tif len(expected) != len(actual) {\n\t\tt.Errorf(\"expected endpoint count: %d do not tally with actual count: %d\", len(expected), len(actual))\n\t}\n}", "title": "" }, { "docid": "bb366c5e5c3c2f1a9c04c55e95057e5c", "score": "0.56094456", "text": "func (p *KubernetesProvider) manageEpEvent(endpoints *corev1.Endpoints) error {\n\tklog.V(3).Infof(\"received update of endpoint %v\", endpoints.Name)\n\n\tnattedNS, err := p.NatNamespace(endpoints.Namespace, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tforeignEps, err := p.foreignEpCaches[nattedNS].get(endpoints.Name, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !hasToBeUpdated(endpoints.Subsets, foreignEps.Subsets) {\n\t\tklog.V(5).Infof(\"ep %v hasn't to be updated\", endpoints.Name)\n\t\treturn nil\n\t}\n\n\tklog.V(5).Infof(\"ep %v has to be updated\", endpoints.Name)\n\tforeignEps.Subsets = p.updateEndpoints(endpoints.Subsets, foreignEps.Subsets)\n\n\tif foreignEps.Labels == nil {\n\t\tforeignEps.Labels = make(map[string]string)\n\t}\n\tforeignEps.Namespace = nattedNS\n\t_, err = p.foreignClient.Client().CoreV1().Endpoints(nattedNS).Update(context.TODO(), foreignEps, metav1.UpdateOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tklog.V(3).Infof(\"Endpoint %v with version %v correctly reconciliated\", endpoints.Name, endpoints.ResourceVersion)\n\treturn nil\n}", "title": "" }, { "docid": "4caacfc0a91cc59d2bbfe6449ca00ef9", "score": "0.56047237", "text": "func (endpointSliceStrategy) AllowUnconditionalUpdate() bool {\n\treturn true\n}", "title": "" }, { "docid": "60e07c94c2bb883fcb59d30b9f890a1c", "score": "0.557487", "text": "func updateIstioServiceEndpoints(se *v1alpha3.ServiceEntry, action discovery.EventType, targetInst *event.InstanceEntry) error {\n\ttargetInstanceId := targetInst.InstanceId\n\tnewInsts := []*event.InstanceEntry{}\n\tvar seAsMSE *event.MicroserviceEntry\n\t// Convert ServiceEntry back to service center service to apply changes to its service center instances\n\tif res := event.NewServiceEntry(se).Convert(); res == nil {\n\t\treturn fmt.Errorf(\"failed to parse existing Istio ServiceEntry\")\n\t} else {\n\t\tseAsMSE = res\n\t}\n\tswitch discovery.EventType(action) {\n\tcase discovery.EVT_DELETE:\n\t\t// Filter out the deleted instance\n\t\tfor _, existingInst := range seAsMSE.Instances {\n\t\t\tif existingInst.InstanceId != targetInstanceId {\n\t\t\t\tnewInsts = append(newInsts, existingInst)\n\t\t\t}\n\t\t}\n\t\tif len(seAsMSE.Instances) == len(newInsts) {\n\t\t\tlog.Warnf(\"could not push delete for target Service Center instance id %s, instance was not found\\n\", targetInstanceId)\n\t\t}\n\t\tseAsMSE.Instances = newInsts\n\tcase discovery.EVT_CREATE:\n\t\t// CREATE still requires check to determine whether the endpoint already exists; UPDATE is used in this case.\n\t\tfallthrough\n\tcase discovery.EVT_UPDATE:\n\t\tupdated := false\n\t\tfor i, existingInst := range seAsMSE.Instances {\n\t\t\tif existingInst.InstanceId == targetInstanceId {\n\t\t\t\t// Found existing instance, update with new instance\n\t\t\t\tseAsMSE.Instances[i] = targetInst\n\t\t\t\tupdated = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !updated {\n\t\t\t// Instance does not already exist, add as new instance\n\t\t\tseAsMSE.Instances = append(seAsMSE.Instances, targetInst)\n\t\t}\n\t}\n\t// Convert the microservice entry back to istio service entry; the serviceports for the changed endpoints will be regenerated appropriately by conversion logic\n\tvar regenedSe *v1alpha3.ServiceEntry\n\tif res := seAsMSE.Convert(); res == nil {\n\t\treturn fmt.Errorf(\"failed to parse changes for Istio ServiceEntry\")\n\t} else {\n\t\tregenedSe = res.ServiceEntry\n\t}\n\t// Only take regened ports and new workloadentries, preserves rest of original serviceentry\n\tse.Spec.Endpoints = regenedSe.Spec.Endpoints\n\tse.Spec.Ports = regenedSe.Spec.Ports\n\treturn nil\n}", "title": "" }, { "docid": "9b8a222d2cdfb54c0a5932491c1ed621", "score": "0.5572566", "text": "func (c *Direct) newEndpoints(localPort uint16, endpoints []string) (changed bool) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\t// Nothing new?\n\tif c.localPort == localPort && sameStrings(c.endpoints, endpoints) {\n\t\treturn false // unchanged\n\t}\n\tc.logf(\"client.newEndpoints(%v, %v)\", localPort, endpoints)\n\tc.localPort = localPort\n\tc.endpoints = append(c.endpoints[:0], endpoints...)\n\tif len(endpoints) > 0 {\n\t\tc.everEndpoints = true\n\t}\n\treturn true // changed\n}", "title": "" }, { "docid": "a79edd931c08ae26f0d94133a861c4a2", "score": "0.5551593", "text": "func TestAzureDevOpsServiceEndpointDockerRegistry_Update_DoesNotSwallowError(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tr := resourceServiceEndpointDockerRegistry()\n\tresourceData := schema.TestResourceDataRaw(t, r.Schema, nil)\n\tflattenServiceEndpointDockerRegistry(resourceData, &dockerRegistryTestServiceEndpoint, dockerRegistryTestServiceEndpointProjectID)\n\n\tbuildClient := azdosdkmocks.NewMockServiceendpointClient(ctrl)\n\tclients := &config.AggregatedClient{ServiceEndpointClient: buildClient, Ctx: context.Background()}\n\n\texpectedArgs := serviceendpoint.UpdateServiceEndpointArgs{\n\t\tEndpoint: &dockerRegistryTestServiceEndpoint,\n\t\tEndpointId: dockerRegistryTestServiceEndpoint.Id,\n\t\tProject: dockerRegistryTestServiceEndpointProjectID,\n\t}\n\n\tbuildClient.\n\t\tEXPECT().\n\t\tUpdateServiceEndpoint(clients.Ctx, expectedArgs).\n\t\tReturn(nil, errors.New(\"UpdateServiceEndpoint() Failed\")).\n\t\tTimes(1)\n\n\terr := r.Update(resourceData, clients)\n\trequire.Contains(t, err.Error(), \"UpdateServiceEndpoint() Failed\")\n}", "title": "" }, { "docid": "4a4d61e098964d8b8f9f5afb94c0b2af", "score": "0.5547494", "text": "func (mr *MockClientMockRecorder) OIDCEndpoints(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"OIDCEndpoints\", reflect.TypeOf((*MockClient)(nil).OIDCEndpoints), arg0)\n}", "title": "" }, { "docid": "c3a0890d7bcbcf9918daf7fb48530459", "score": "0.5541171", "text": "func (p *KubernetesProvider) updateEndpoints(eps, foreignEps []corev1.EndpointSubset) []corev1.EndpointSubset {\n\tsubsets := make([]corev1.EndpointSubset, 0)\n\n\tfor i := 0; i < len(eps); i++ {\n\t\tsubsets = append(subsets, corev1.EndpointSubset{})\n\t\tsubsets[i].Addresses = make([]corev1.EndpointAddress, 0)\n\t\tsubsets[i].Ports = eps[i].Ports\n\n\t\tfor _, addr := range eps[i].Addresses {\n\n\t\t\tif addr.NodeName == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif *addr.NodeName != p.nodeName {\n\t\t\t\taddr.NodeName = &p.homeClusterID\n\t\t\t\taddr.TargetRef = nil\n\n\t\t\t\tsubsets[i].Addresses = append(subsets[i].Addresses, addr)\n\t\t\t}\n\t\t}\n\n\t\tif len(foreignEps) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, e := range foreignEps[i].Addresses {\n\t\t\tif *e.NodeName != p.homeClusterID {\n\t\t\t\tsubsets[i].Addresses = append(subsets[i].Addresses, e)\n\t\t\t}\n\t\t}\n\t}\n\treturn subsets\n}", "title": "" }, { "docid": "54d53a97db501c661f6456ca9a56a27e", "score": "0.55079997", "text": "func (m *bpfEndpointManager) onWorkloadEndpointUpdate(msg *proto.WorkloadEndpointUpdate) {\n\tlog.WithField(\"wep\", msg.Endpoint).Debug(\"Workload endpoint update\")\n\twlID := *msg.Id\n\toldWL := m.wlEps[wlID]\n\twl := msg.Endpoint\n\tif oldWL != nil {\n\t\tfor _, t := range oldWL.Tiers {\n\t\t\tfor _, pol := range t.IngressPolicies {\n\t\t\t\tpolSet := m.policiesToWorkloads[proto.PolicyID{\n\t\t\t\t\tTier: t.Name,\n\t\t\t\t\tName: pol,\n\t\t\t\t}]\n\t\t\t\tif polSet == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tpolSet.Discard(wlID)\n\t\t\t}\n\t\t\tfor _, pol := range t.EgressPolicies {\n\t\t\t\tpolSet := m.policiesToWorkloads[proto.PolicyID{\n\t\t\t\t\tTier: t.Name,\n\t\t\t\t\tName: pol,\n\t\t\t\t}]\n\t\t\t\tif polSet == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tpolSet.Discard(wlID)\n\t\t\t}\n\t\t}\n\n\t\tfor _, profName := range oldWL.ProfileIds {\n\t\t\tprofID := proto.ProfileID{Name: profName}\n\t\t\tprofSet := m.profilesToWorkloads[profID]\n\t\t\tif profSet == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tprofSet.Discard(wlID)\n\t\t}\n\t}\n\tm.wlEps[wlID] = msg.Endpoint\n\tfor _, t := range wl.Tiers {\n\t\tfor _, pol := range t.IngressPolicies {\n\t\t\tpolID := proto.PolicyID{\n\t\t\t\tTier: t.Name,\n\t\t\t\tName: pol,\n\t\t\t}\n\t\t\tif m.policiesToWorkloads[polID] == nil {\n\t\t\t\tm.policiesToWorkloads[polID] = set.New()\n\t\t\t}\n\t\t\tm.policiesToWorkloads[polID].Add(wlID)\n\t\t}\n\t\tfor _, pol := range t.EgressPolicies {\n\t\t\tpolID := proto.PolicyID{\n\t\t\t\tTier: t.Name,\n\t\t\t\tName: pol,\n\t\t\t}\n\t\t\tif m.policiesToWorkloads[polID] == nil {\n\t\t\t\tm.policiesToWorkloads[polID] = set.New()\n\t\t\t}\n\t\t\tm.policiesToWorkloads[polID].Add(wlID)\n\t\t}\n\t\tfor _, profName := range wl.ProfileIds {\n\t\t\tprofID := proto.ProfileID{Name: profName}\n\t\t\tprofSet := m.profilesToWorkloads[profID]\n\t\t\tif profSet == nil {\n\t\t\t\tprofSet = set.New()\n\t\t\t\tm.profilesToWorkloads[profID] = profSet\n\t\t\t}\n\t\t\tprofSet.Add(wlID)\n\t\t}\n\t}\n\tm.dirtyWorkloads.Add(wlID)\n}", "title": "" }, { "docid": "baf680a4041ba207103afae20510f0ce", "score": "0.5501346", "text": "func Update(client *gophercloud.ServiceClient, endpointID string, opts UpdateOptsBuilder) (r UpdateResult) {\n\tb, err := opts.ToEndpointUpdateMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\t_, r.Err = client.Patch(endpointURL(client, endpointID), &b, &r.Body, nil)\n\treturn\n}", "title": "" }, { "docid": "46a8b40bf28fa437f3c999d282ac00a4", "score": "0.54801166", "text": "func UpdateEndpoint(projectProvider provider.ProjectProvider, serviceAccountProvider provider.ServiceAccountProvider, memberMapper provider.ProjectMemberMapper, userInfoGetter provider.UserInfoGetter) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq, ok := request.(updateReq)\n\t\tif !ok {\n\t\t\treturn nil, errors.NewBadRequest(\"invalid request\")\n\t\t}\n\t\terr := req.Validate()\n\t\tif err != nil {\n\t\t\treturn nil, errors.NewBadRequest(err.Error())\n\t\t}\n\t\tsaFromRequest := req.Body\n\t\tuserInfo, err := userInfoGetter(ctx, req.ProjectID)\n\t\tif err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\t\tsa, err := serviceAccountProvider.Get(userInfo, req.ServiceAccountID, nil)\n\t\tif err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\n\t\tproject, err := projectProvider.Get(userInfo, req.ProjectID, &provider.ProjectGetOptions{})\n\t\tif err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\n\t\t// update the service account name\n\t\tif sa.Spec.Name != saFromRequest.Name {\n\t\t\t// check if service account name is already reserved in the project\n\t\t\texistingSAList, err := serviceAccountProvider.List(userInfo, project, &provider.ServiceAccountListOptions{ServiceAccountName: saFromRequest.Name})\n\t\t\tif err != nil {\n\t\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t\t}\n\n\t\t\tif len(existingSAList) > 0 {\n\t\t\t\treturn nil, errors.NewAlreadyExists(\"service account\", saFromRequest.Name)\n\t\t\t}\n\t\t\tsa.Spec.Name = saFromRequest.Name\n\t\t}\n\n\t\tcurrentGroup, err := memberMapper.MapUserToGroup(sa.Spec.Email, project.Name)\n\t\tif err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\n\t\t}\n\n\t\tnewGroup := rbac.GenerateActualGroupNameFor(project.Name, saFromRequest.Group)\n\t\tif newGroup != currentGroup {\n\t\t\tsa.Labels[serviceaccount.ServiceAccountLabelGroup] = newGroup\n\t\t}\n\n\t\tupdatedSA, err := serviceAccountProvider.Update(userInfo, sa)\n\t\tif err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\n\t\tresult := convertInternalServiceAccountToExternal(updatedSA)\n\t\tresult.Group = newGroup\n\t\treturn result, nil\n\t}\n}", "title": "" }, { "docid": "19db4a9fffd237b8ae0721be0f95bee3", "score": "0.54779375", "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": "701736662cfc671e48bd96869a3e08ed", "score": "0.54771304", "text": "func (m *MockProvider) OnEndpointsDelete(arg0 *v1.Endpoints) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"OnEndpointsDelete\", arg0)\n}", "title": "" }, { "docid": "ed908b770489b9a1480d5087aa5f0012", "score": "0.5476149", "text": "func (s *SubnetSpec) shouldUpdate(existingSubnet network.Subnet) bool {\n\t// No modifications for non-managed subnets\n\tif !s.IsVNetManaged {\n\t\treturn false\n\t}\n\n\t// Update the subnet a NAT Gateway was added for backwards compatibility.\n\tif s.NatGatewayName != \"\" && existingSubnet.SubnetPropertiesFormat.NatGateway == nil {\n\t\treturn true\n\t}\n\n\t// Update the subnet if the service endpoints changed.\n\tif existingSubnet.ServiceEndpoints != nil || len(s.ServiceEndpoints) > 0 {\n\t\tvar existingServiceEndpoints []network.ServiceEndpointPropertiesFormat\n\t\tif existingSubnet.ServiceEndpoints != nil {\n\t\t\tfor _, se := range *existingSubnet.ServiceEndpoints {\n\t\t\t\texistingServiceEndpoints = append(existingServiceEndpoints, network.ServiceEndpointPropertiesFormat{Service: se.Service, Locations: se.Locations})\n\t\t\t}\n\t\t}\n\t\tnewServiceEndpoints := make([]network.ServiceEndpointPropertiesFormat, len(s.ServiceEndpoints))\n\t\tfor _, se := range s.ServiceEndpoints {\n\t\t\tse := se\n\t\t\tnewServiceEndpoints = append(newServiceEndpoints, network.ServiceEndpointPropertiesFormat{Service: ptr.To(se.Service), Locations: &se.Locations})\n\t\t}\n\n\t\tdiff := cmp.Diff(newServiceEndpoints, existingServiceEndpoints)\n\t\treturn diff != \"\"\n\t}\n\treturn false\n}", "title": "" }, { "docid": "8c86b72627941104ae93cc08b9462e07", "score": "0.5471621", "text": "func TestUpdateEdgeLBPoolObject(t *testing.T) {\n\ttests := []struct {\n\t\tdescription string\n\t\tservice *v1.Service\n\t\toptions ServiceTranslationOptions\n\t\tpool *models.V2Pool\n\t\texpectedWasChanged bool\n\t\texpectedBackends []*models.V2Backend\n\t\texpectedFrontends []*models.V2Frontend\n\t\texpectedError error\n\t}{\n\t\t{\n\t\t\t// Test that a pool that is in \"in sync\" with the Service resource's spec is detected as not requiring an update.\n\t\t\tdescription: \"pool that is \\\"in sync\\\" with the Service resource's spec is detected as not requiring an update\",\n\t\t\tservice: serviceExposingPort80,\n\t\t\toptions: serviceTranslationOptionsForPort80,\n\t\t\tpool: edgelbpooltestutil.DummyEdgeLBPool(\"baz\", func(p *models.V2Pool) {\n\t\t\t\tp.Haproxy.Backends = []*models.V2Backend{\n\t\t\t\t\tbackendForServiceExposingPort80,\n\t\t\t\t}\n\t\t\t\tp.Haproxy.Frontends = []*models.V2Frontend{\n\t\t\t\t\tfrontendForServiceExposingPort80,\n\t\t\t\t}\n\t\t\t}),\n\t\t\texpectedWasChanged: false,\n\t\t\texpectedBackends: []*models.V2Backend{\n\t\t\t\tbackendForServiceExposingPort80,\n\t\t\t},\n\t\t\texpectedFrontends: []*models.V2Frontend{\n\t\t\t\tfrontendForServiceExposingPort80,\n\t\t\t},\n\t\t\texpectedError: nil,\n\t\t},\n\t\t{\n\t\t\t// Test that a pool that was \"in sync\" with a deleted Service resource is detected as requiring an update.\n\t\t\tdescription: \"pool that was \\\"in sync\\\" with a deleted Service resource is detected as requiring an update\",\n\t\t\tservice: deletedServiceExposingPort80,\n\t\t\toptions: serviceTranslationOptionsForPort80,\n\t\t\tpool: edgelbpooltestutil.DummyEdgeLBPool(\"baz\", func(p *models.V2Pool) {\n\t\t\t\tp.Haproxy.Backends = []*models.V2Backend{\n\t\t\t\t\tbackendForServiceExposingPort80,\n\t\t\t\t}\n\t\t\t\tp.Haproxy.Frontends = []*models.V2Frontend{\n\t\t\t\t\tfrontendForServiceExposingPort80,\n\t\t\t\t}\n\t\t\t}),\n\t\t\texpectedWasChanged: true,\n\t\t\texpectedBackends: []*models.V2Backend{},\n\t\t\texpectedFrontends: []*models.V2Frontend{},\n\t\t\texpectedError: nil,\n\t\t},\n\t\t{\n\t\t\t// Test that a pool for which a backend was manually changed is detected as requiring an update.\n\t\t\tdescription: \"pool for which a backend was manually changed is detected as requiring an update\",\n\t\t\tservice: serviceExposingPort80,\n\t\t\toptions: serviceTranslationOptionsForPort80,\n\t\t\tpool: edgelbpooltestutil.DummyEdgeLBPool(\"baz\", func(p *models.V2Pool) {\n\t\t\t\t// Change the target port for the backend.\n\t\t\t\tbackend := computeBackendForServicePort(testClusterName, serviceExposingPort80, serviceExposingPort80.Spec.Ports[0])\n\t\t\t\tbackend.Services[0].Endpoint.Port = 10101\n\t\t\t\tp.Haproxy.Backends = []*models.V2Backend{\n\t\t\t\t\t// Will have to be replaced by \"backendForServiceExposingPort80\".\n\t\t\t\t\tbackend,\n\t\t\t\t}\n\t\t\t\tp.Haproxy.Frontends = []*models.V2Frontend{\n\t\t\t\t\tfrontendForServiceExposingPort80,\n\t\t\t\t}\n\t\t\t}),\n\t\t\texpectedWasChanged: true,\n\t\t\texpectedBackends: []*models.V2Backend{\n\t\t\t\tbackendForServiceExposingPort80,\n\t\t\t},\n\t\t\texpectedFrontends: []*models.V2Frontend{\n\t\t\t\tfrontendForServiceExposingPort80,\n\t\t\t},\n\t\t\texpectedError: nil,\n\t\t},\n\t\t{\n\t\t\t// Test that a pool for which a frontend was manually changed is detected as requiring an update.\n\t\t\tdescription: \"pool for which a frontend was manually changed is detected as requiring an update\",\n\t\t\tservice: serviceExposingPort80,\n\t\t\toptions: serviceTranslationOptionsForPort80,\n\t\t\tpool: edgelbpooltestutil.DummyEdgeLBPool(\"baz\", func(p *models.V2Pool) {\n\t\t\t\tp.Haproxy.Backends = []*models.V2Backend{\n\t\t\t\t\tbackendForServiceExposingPort80,\n\t\t\t\t}\n\t\t\t\t// Change the bind port for the frontend.\n\t\t\t\tfrontend := computeFrontendForServicePort(testClusterName, serviceExposingPort80, serviceExposingPort80.Spec.Ports[0], serviceTranslationOptionsForPort80)\n\t\t\t\tfrontend.BindPort = pointers.NewInt32(10101)\n\t\t\t\tp.Haproxy.Frontends = []*models.V2Frontend{\n\t\t\t\t\t// Will have to be replaced by \"frontendForServiceExposingPort80\".\n\t\t\t\t\tfrontend,\n\t\t\t\t}\n\t\t\t}),\n\t\t\texpectedWasChanged: true,\n\t\t\texpectedBackends: []*models.V2Backend{\n\t\t\t\tbackendForServiceExposingPort80,\n\t\t\t},\n\t\t\texpectedFrontends: []*models.V2Frontend{\n\t\t\t\tfrontendForServiceExposingPort80,\n\t\t\t},\n\t\t\texpectedError: nil,\n\t\t},\n\t\t{\n\t\t\t// Test that a pool with existing backends/frontends but no backends/frontends for the current Service resource is detected as requiring an update, and has all expected backends and frontends after being updated in-place.\n\t\t\tdescription: \"pool with existing backends/frontends but no backends/frontends for the current Service resource is detected as requiring an update\",\n\t\t\tservice: serviceExposingPort80,\n\t\t\toptions: serviceTranslationOptionsForPort80,\n\t\t\tpool: edgelbpooltestutil.DummyEdgeLBPool(\"baz\", func(p *models.V2Pool) {\n\t\t\t\tp.Haproxy.Backends = []*models.V2Backend{\n\t\t\t\t\t// Will have to exist (and come before \"backendForServiceExposingPort80\") in the end.\n\t\t\t\t\tpreExistingBackend1,\n\t\t\t\t\tpreExistingBackend2,\n\t\t\t\t\tpreExistingBackend3,\n\t\t\t\t}\n\t\t\t\tp.Haproxy.Frontends = []*models.V2Frontend{\n\t\t\t\t\t// Will have to exist (and come before \"frontendForServiceExposingPort80\") in the end.\n\t\t\t\t\tpreExistingFrontend1,\n\t\t\t\t\tpreExistingFrontend2,\n\t\t\t\t}\n\t\t\t}),\n\t\t\texpectedWasChanged: true,\n\t\t\texpectedBackends: []*models.V2Backend{\n\t\t\t\tpreExistingBackend1,\n\t\t\t\tpreExistingBackend2,\n\t\t\t\tpreExistingBackend3,\n\t\t\t\tbackendForServiceExposingPort80,\n\t\t\t},\n\t\t\texpectedFrontends: []*models.V2Frontend{\n\t\t\t\tpreExistingFrontend1,\n\t\t\t\tpreExistingFrontend2,\n\t\t\t\tfrontendForServiceExposingPort80,\n\t\t\t},\n\t\t\texpectedError: nil,\n\t\t},\n\t\t{\n\t\t\t// Test that a pool with existing backends/frontends is detected as requiring an update after a port is removed from the Service resource.\n\t\t\tdescription: \"pool with existing backends/frontends is detected as requiring an update after a port is removed from the Service resource\",\n\t\t\tservice: serviceExposingPort80,\n\t\t\toptions: serviceTranslationOptionsForPort80,\n\t\t\tpool: edgelbpooltestutil.DummyEdgeLBPool(\"baz\", func(p *models.V2Pool) {\n\t\t\t\tp.Haproxy.Backends = []*models.V2Backend{\n\t\t\t\t\tpreExistingBackend1,\n\t\t\t\t\tpreExistingBackend2,\n\t\t\t\t\tpreExistingBackend3,\n\t\t\t\t\tbackendForServiceExposingPort80,\n\t\t\t\t\t// Add an extra backend owned by \"serviceExposingPort80\" to simulate removal of a port.\n\t\t\t\t\tcomputeBackendForServicePort(testClusterName, serviceExposingPort80, v1.ServicePort{\n\t\t\t\t\t\tNodePort: 34568,\n\t\t\t\t\t\tPort: 90,\n\t\t\t\t\t\tProtocol: v1.ProtocolTCP,\n\t\t\t\t\t\tTargetPort: intstr.FromInt(8080),\n\t\t\t\t\t}),\n\t\t\t\t}\n\t\t\t\tp.Haproxy.Frontends = []*models.V2Frontend{\n\t\t\t\t\tpreExistingFrontend1,\n\t\t\t\t\tpreExistingFrontend2,\n\t\t\t\t\tfrontendForServiceExposingPort80,\n\t\t\t\t\t// Add an extra frontend owned by \"serviceExposingPort80\" to simulate removal of a port.\n\t\t\t\t\tcomputeFrontendForServicePort(testClusterName, serviceExposingPort80, v1.ServicePort{\n\t\t\t\t\t\tNodePort: 34568,\n\t\t\t\t\t\tPort: 90,\n\t\t\t\t\t\tProtocol: v1.ProtocolTCP,\n\t\t\t\t\t\tTargetPort: intstr.FromInt(8080),\n\t\t\t\t\t}, ServiceTranslationOptions{}),\n\t\t\t\t}\n\t\t\t}),\n\t\t\texpectedWasChanged: true,\n\t\t\texpectedBackends: []*models.V2Backend{\n\t\t\t\tpreExistingBackend1,\n\t\t\t\tpreExistingBackend2,\n\t\t\t\tpreExistingBackend3,\n\t\t\t\tbackendForServiceExposingPort80,\n\t\t\t},\n\t\t\texpectedFrontends: []*models.V2Frontend{\n\t\t\t\tpreExistingFrontend1,\n\t\t\t\tpreExistingFrontend2,\n\t\t\t\tfrontendForServiceExposingPort80,\n\t\t\t},\n\t\t\texpectedError: nil,\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\tt.Logf(\"test case: %s\", test.description)\n\t\t// Create a mock KubernetesResourceCache.\n\t\tkubeCache := cachetestutil.NewFakeKubernetesResourceCache()\n\t\t// Create and customize a mock EdgeLB manager.\n\t\tmanager := new(edgelbmanagertestutil.MockEdgeLBManager)\n\t\tmanager.On(\"PoolGroup\").Return(testEdgeLBPoolGroup)\n\t\t// Update the EdgeLB pool object in-place.\n\t\tmustUpdate, _, err := NewServiceTranslator(testClusterName, test.service, test.options, kubeCache, manager).updateEdgeLBPoolObject(test.pool)\n\t\t// Check that expected errors have been propagated (if any).\n\t\tassert.Equal(t, test.expectedError, err)\n\t\t// Check that the need for a pool update was adequately detected.\n\t\tassert.Equal(t, test.expectedWasChanged, mustUpdate)\n\t\t// Check that all expected backends are present.\n\t\tassert.Equal(t, test.expectedBackends, test.pool.Haproxy.Backends)\n\t\t// Check that all expected frontends are present.\n\t\tassert.Equal(t, test.expectedFrontends, test.pool.Haproxy.Frontends)\n\t}\n}", "title": "" }, { "docid": "343a89f038012f3dd4fd654ceaf9220a", "score": "0.54604346", "text": "func (mr *MockProcMockRecorder) OnSvcConfigUpdate(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"OnSvcConfigUpdate\", reflect.TypeOf((*MockProc)(nil).OnSvcConfigUpdate), arg0)\n}", "title": "" }, { "docid": "9e7e54f5892661e4ea55e8c2f53216c6", "score": "0.5454469", "text": "func (c *HAProxyController) processEndpointsSrvs(oldEndpoints, newEndpoints *store.Endpoints) {\n\t// Compare new Endpoints with old Endpoints Addresses and sync HAProxySrvs\n\t// Also by the end we will have a temporary array holding available HAProxysrv slots\n\tavailable := []*store.HAProxySrv{}\n\tnewEndpoints.HAProxySrvs = oldEndpoints.HAProxySrvs\n\tfor _, srv := range newEndpoints.HAProxySrvs {\n\t\tif _, ok := newEndpoints.Addresses[srv.IP]; !ok {\n\t\t\tavailable = append(available, srv)\n\t\t\tif !srv.Disabled {\n\t\t\t\tsrv.IP = \"127.0.0.1\"\n\t\t\t\tsrv.Disabled = true\n\t\t\t\tsrv.Modified = true\n\t\t\t}\n\t\t}\n\t}\n\t// Check available HAProxySrvs to add new Addresses\n\tavailableIdx := len(available) - 1\n\tfor newAdr := range newEndpoints.Addresses {\n\t\tif availableIdx < 0 {\n\t\t\tbreak\n\t\t}\n\t\tif _, ok := oldEndpoints.Addresses[newAdr]; !ok {\n\t\t\tsrv := available[availableIdx]\n\t\t\tsrv.IP = newAdr\n\t\t\tsrv.Disabled = false\n\t\t\tsrv.Modified = true\n\t\t\tavailable = available[:availableIdx]\n\t\t\tavailableIdx--\n\t\t}\n\t}\n\t// Dynamically updates HAProxy backend servers with HAProxySrvs content\n\tfor srvName, srv := range newEndpoints.HAProxySrvs {\n\t\tif srv.Modified {\n\t\t\tif newEndpoints.BackendName == \"\" {\n\t\t\t\tlogger.Errorf(\"No backend Name for endpoints of service `%s` \", newEndpoints.Service.Value)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tlogger.Error(c.Client.SetServerAddr(newEndpoints.BackendName, srvName, srv.IP, 0))\n\t\t\tstatus := \"ready\"\n\t\t\tif srv.Disabled {\n\t\t\t\tstatus = \"maint\"\n\t\t\t}\n\t\t\tlogger.Debugf(\"server '%s/%s' changed status to %v\", newEndpoints.BackendName, srvName, status)\n\t\t\tlogger.Error(c.Client.SetServerState(newEndpoints.BackendName, srvName, status))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "eca913b56a8a25e6cac7ad8adcffa1ac", "score": "0.5453792", "text": "func TestEndpointGroupUpdate(t *testing.T) { //nolint:dupl\n\tvar result EndpointGroup\n\terr := json.NewDecoder(strings.NewReader(endpointGroupBody)).Decode(&result)\n\n\tif err != nil {\n\t\tt.Errorf(\"Error decoding JSON: %s\", err)\n\t}\n\n\ttestClient := &common.TestClient{}\n\tresult.SetClient(testClient)\n\n\tresult.AccessState = StandbyAccessState\n\tresult.GroupType = ClientGroupType\n\tresult.Preferred = true\n\tresult.TargetEndpointGroupIdentifier = 9\n\terr = result.Update()\n\n\tif err != nil {\n\t\tt.Errorf(\"Error making Update call: %s\", err)\n\t}\n\n\tcalls := testClient.CapturedCalls()\n\n\tif !strings.Contains(calls[0].Payload, \"AccessState:Standby\") {\n\t\tt.Errorf(\"Unexpected AccessState update payload: %s\", calls[0].Payload)\n\t}\n\n\tif !strings.Contains(calls[0].Payload, \"GroupType:Client\") {\n\t\tt.Errorf(\"Unexpected GroupType update payload: %s\", calls[0].Payload)\n\t}\n\n\tif strings.Contains(calls[0].Payload, \"Preferred\") {\n\t\tt.Errorf(\"Unexpected Preferred update payload: %s\", calls[0].Payload)\n\t}\n\n\tif !strings.Contains(calls[0].Payload, \"TargetEndpointGroupIdentifier:9\") {\n\t\tt.Errorf(\"Unexpected TargetEndpointGroupIdentifier update payload: %s\", calls[0].Payload)\n\t}\n}", "title": "" }, { "docid": "5b4d1fc474d2b72f8a30fbb12cfa934f", "score": "0.5442976", "text": "func (mr *MockProviderMockRecorder) OnServiceUpdate(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"OnServiceUpdate\", reflect.TypeOf((*MockProvider)(nil).OnServiceUpdate), arg0, arg1)\n}", "title": "" }, { "docid": "3b0cc609260046a7432da5d1ce92a2e9", "score": "0.5393423", "text": "func TestEndpoint_DeepEquals(t *testing.T) {\n\t// epEqualsTestCase encapsulates test data for subtests involving reflect.DeepEquals() for Endpoint.\n\ttype epEqualsTestCase struct {\n\t\t// Name to use for the sub test\n\t\ttcName string\n\t\t// The set of attributes to change.\n\t\tattrToChange attrToChange\n\t\t// Expected result from reflect.DeepEquals()\n\t\texpectation bool\n\t}\n\n\t// Build parameterized test cases for subtests.\n\ttestCases := make([]epEqualsTestCase, len(allAttrToChange))\n\t// Test cases involving a single attribute change.\n\t// Example, only the label for DestinationService differs between the two Endpoints.\n\tfor idx, attrToChange := range allAttrToChange {\n\t\ttestCases[idx] = epEqualsTestCase{\n\t\t\tattrToChange.String(),\n\t\t\tattrToChange,\n\t\t\t// Only the following values of attrToChange should return true for DeepEquals().\n\t\t\tattrToChange == noAttrChange || attrToChange == diffDomainOrder || attrToChange == diffServiceOrder,\n\t\t}\n\t}\n\t// Test cases involving multiple attribute changes.\n\totherTestCases := []epEqualsTestCase{{\n\t\t\"MultipleAttributes\",\n\t\tdiffNamespace | diffDomains,\n\t\tfalse,\n\t}}\n\ttestCases = append(testCases, otherTestCases...)\n\n\tfor _, tc := range testCases {\n\t\tt.Run(tc.tcName, func(t *testing.T) {\n\t\t\tt.Parallel()\n\t\t\tfirstEp, _ := buildEndpoint(t, noAttrChange, true)\n\t\t\tsecondEp, _ := buildEndpoint(t, tc.attrToChange, true)\n\t\t\tactual := reflect.DeepEqual(*firstEp, *secondEp)\n\t\t\tif tc.expectation != actual {\n\t\t\t\tt.Errorf(\"Expecting %v, found %v.\\nFirst: [%v]\\nSecond [%v]\",\n\t\t\t\t\ttc.expectation, actual, *firstEp, *secondEp)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "11996584d9184b6c6da90ad13321470c", "score": "0.53852296", "text": "func TestBeforeUpdate(t *testing.T) {\n\ttestCases := []struct {\n\t\tname string\n\t\ttweakSvc func(oldSvc, newSvc *api.Service) // given basic valid services, each test case can customize them\n\t\texpectErr bool\n\t}{\n\t\t{\n\t\t\tname: \"no change\",\n\t\t\ttweakSvc: func(oldSvc, newSvc *api.Service) {\n\t\t\t\t// nothing\n\t\t\t},\n\t\t\texpectErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"change port\",\n\t\t\ttweakSvc: func(oldSvc, newSvc *api.Service) {\n\t\t\t\tnewSvc.Spec.Ports[0].Port++\n\t\t\t},\n\t\t\texpectErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"bad namespace\",\n\t\t\ttweakSvc: func(oldSvc, newSvc *api.Service) {\n\t\t\t\tnewSvc.Namespace = \"#$%%invalid\"\n\t\t\t},\n\t\t\texpectErr: true,\n\t\t},\n\t\t{\n\t\t\tname: \"change name\",\n\t\t\ttweakSvc: func(oldSvc, newSvc *api.Service) {\n\t\t\t\tnewSvc.Name += \"2\"\n\t\t\t},\n\t\t\texpectErr: true,\n\t\t},\n\t\t{\n\t\t\tname: \"change ClusterIP\",\n\t\t\ttweakSvc: func(oldSvc, newSvc *api.Service) {\n\t\t\t\toldSvc.Spec.ClusterIP = \"1.2.3.4\"\n\t\t\t\tnewSvc.Spec.ClusterIP = \"4.3.2.1\"\n\t\t\t},\n\t\t\texpectErr: true,\n\t\t},\n\t\t{\n\t\t\tname: \"change selectpor\",\n\t\t\ttweakSvc: func(oldSvc, newSvc *api.Service) {\n\t\t\t\tnewSvc.Spec.Selector = map[string]string{\"newkey\": \"newvalue\"}\n\t\t\t},\n\t\t\texpectErr: false,\n\t\t},\n\t}\n\n\tfor _, tc := range testCases {\n\t\toldSvc := makeValidService()\n\t\tnewSvc := makeValidService()\n\t\ttc.tweakSvc(&oldSvc, &newSvc)\n\t\tctx := genericapirequest.NewDefaultContext()\n\t\terr := rest.BeforeUpdate(Strategy, ctx, runtime.Object(&oldSvc), runtime.Object(&newSvc))\n\t\tif tc.expectErr && err == nil {\n\t\t\tt.Errorf(\"unexpected non-error for %q\", tc.name)\n\t\t}\n\t\tif !tc.expectErr && err != nil {\n\t\t\tt.Errorf(\"unexpected error for %q: %v\", tc.name, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fb6c5df11eb6c6f8b352b91a1a0fcd45", "score": "0.5384397", "text": "func (f *leaseTracker) createOrUpdateEndpoints(ctx context.Context, ns, n string) error {\n\twantSubsets := []corev1.EndpointSubset{{\n\t\tAddresses: []corev1.EndpointAddress{{\n\t\t\tIP: f.selfIP,\n\t\t}},\n\t\tPorts: []corev1.EndpointPort{{\n\t\t\tName: autoscalerPortName,\n\t\t\tPort: autoscalerPort,\n\t\t\tProtocol: corev1.ProtocolTCP,\n\t\t}}},\n\t}\n\n\texists := true\n\tvar lastErr error\n\tif err := wait.PollImmediate(retryInterval, retryTimeout, func() (bool, error) {\n\t\te, err := f.endpointsLister.Endpoints(ns).Get(n)\n\t\tif apierrs.IsNotFound(err) {\n\t\t\texists = false\n\t\t\treturn true, nil\n\t\t}\n\n\t\tif err != nil {\n\t\t\tlastErr = err\n\t\t\t// Do not return the error to cause a retry.\n\t\t\treturn false, nil\n\t\t}\n\n\t\tif equality.Semantic.DeepEqual(wantSubsets, e.Subsets) {\n\t\t\treturn true, nil\n\t\t}\n\n\t\twant := e.DeepCopy()\n\t\twant.Subsets = wantSubsets\n\t\tif _, lastErr = f.kc.CoreV1().Endpoints(ns).Update(ctx, want, metav1.UpdateOptions{}); lastErr != nil {\n\t\t\t// Do not return the error to cause a retry.\n\t\t\treturn false, nil\n\t\t}\n\n\t\tf.logger.Infof(\"Bucket Endpoints %s updated with IP %s\", n, f.selfIP)\n\t\treturn true, nil\n\t}); err != nil {\n\t\treturn lastErr\n\t}\n\n\tif exists {\n\t\treturn nil\n\t}\n\n\tif err := wait.PollImmediate(retryInterval, retryTimeout, func() (bool, error) {\n\t\t_, lastErr = f.kc.CoreV1().Endpoints(ns).Create(ctx, &corev1.Endpoints{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: n,\n\t\t\t\tNamespace: ns,\n\t\t\t},\n\t\t\tSubsets: wantSubsets,\n\t\t}, metav1.CreateOptions{})\n\t\t// Do not return the error to cause a retry.\n\t\treturn lastErr == nil, nil\n\t}); err != nil {\n\t\treturn lastErr\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b6e7267368a532a1f526251b7bde075d", "score": "0.53699404", "text": "func (mr *MockTestClientMockRecorder) UpdateTestPoints(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UpdateTestPoints\", reflect.TypeOf((*MockTestClient)(nil).UpdateTestPoints), arg0, arg1)\n}", "title": "" }, { "docid": "1d98725eb483aff4737a8009942ef56e", "score": "0.5367325", "text": "func (mock *SubscriberMock) OnHealthUpdateCalls() []struct {\n\tStatus string\n} {\n\tvar calls []struct {\n\t\tStatus string\n\t}\n\tlockSubscriberMockOnHealthUpdate.RLock()\n\tcalls = mock.calls.OnHealthUpdate\n\tlockSubscriberMockOnHealthUpdate.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "40002822ed227d4d35cfbb3115ccc1ec", "score": "0.5362534", "text": "func (adapter *EndpointsAdapter) EnsureEndpointSliceFromEndpoints(namespace string, endpoints *corev1.Endpoints) error {\n\tendpointSlice := endpointSliceFromEndpoints(endpoints)\n\tcurrentEndpointSlice, err := adapter.endpointSliceClient.EndpointSlices(namespace).Get(context.TODO(), endpointSlice.Name, metav1.GetOptions{})\n\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\tif _, err = adapter.endpointSliceClient.EndpointSlices(namespace).Create(context.TODO(), endpointSlice, metav1.CreateOptions{}); errors.IsAlreadyExists(err) {\n\t\t\t\terr = nil\n\t\t\t}\n\t\t}\n\t\treturn err\n\t}\n\n\t// required for transition from IP to IPv4 address type.\n\tif currentEndpointSlice.AddressType != endpointSlice.AddressType {\n\t\terr = adapter.endpointSliceClient.EndpointSlices(namespace).Delete(context.TODO(), endpointSlice.Name, metav1.DeleteOptions{})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = adapter.endpointSliceClient.EndpointSlices(namespace).Create(context.TODO(), endpointSlice, metav1.CreateOptions{})\n\t\treturn err\n\t}\n\n\tif apiequality.Semantic.DeepEqual(currentEndpointSlice.Endpoints, endpointSlice.Endpoints) &&\n\t\tapiequality.Semantic.DeepEqual(currentEndpointSlice.Ports, endpointSlice.Ports) &&\n\t\tapiequality.Semantic.DeepEqual(currentEndpointSlice.Labels, endpointSlice.Labels) {\n\t\treturn nil\n\t}\n\n\t_, err = adapter.endpointSliceClient.EndpointSlices(namespace).Update(context.TODO(), endpointSlice, metav1.UpdateOptions{})\n\treturn err\n}", "title": "" }, { "docid": "276519b3e1281af2860ab2f454cf17f1", "score": "0.536092", "text": "func (m *peerMap) upsertEndpoint(ep *endpoint, oldDiscoKey key.DiscoPublic) {\n\tif m.byNodeKey[ep.publicKey] == nil {\n\t\tm.byNodeKey[ep.publicKey] = newPeerInfo(ep)\n\t}\n\tepDisco := ep.disco.Load()\n\tif epDisco == nil || oldDiscoKey != epDisco.key {\n\t\tdelete(m.nodesOfDisco[oldDiscoKey], ep.publicKey)\n\t}\n\tif ep.isWireguardOnly {\n\t\t// If the peer is a WireGuard only peer, add all of its endpoints.\n\n\t\t// TODO(raggi,catzkorn): this could mean that if a \"isWireguardOnly\"\n\t\t// peer has, say, 192.168.0.2 and so does a tailscale peer, the\n\t\t// wireguard one will win. That may not be the outcome that we want -\n\t\t// perhaps we should prefer bestAddr.AddrPort if it is set?\n\t\t// see tailscale/tailscale#7994\n\t\tfor ipp := range ep.endpointState {\n\t\t\tm.setNodeKeyForIPPort(ipp, ep.publicKey)\n\t\t}\n\n\t\treturn\n\t}\n\tset := m.nodesOfDisco[epDisco.key]\n\tif set == nil {\n\t\tset = map[key.NodePublic]bool{}\n\t\tm.nodesOfDisco[epDisco.key] = set\n\t}\n\tset[ep.publicKey] = true\n}", "title": "" }, { "docid": "44a29bd634cf49c713a5e95018e4150d", "score": "0.5350291", "text": "func updateContainerEndpoints(msg balancer.Message, dockerHost string, endpointPort int) {\n\turl := fmt.Sprintf(\"http://127.0.0.1:%d\", endpointPort)\n\tif dockerHost != \"\" {\n\t\turl = fmt.Sprintf(\"http://%s:%d\", dockerHost, endpointPort)\n\t}\n\tbody := bytes.NewBuffer(nil)\n\tif err := json.NewEncoder(body).Encode(&msg); err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tresp, err := http.Post(url, \"application/json\", body)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tlog.Println(\"Set --docker-host flag to fix this.\")\n\t\treturn\n\t}\n\tif resp.StatusCode != 200 {\n\t\tlog.Println(\"Failed:\", resp.Status)\n\t} else {\n\t\tif msg.Remove {\n\t\t\tlog.Println(\"Removed\", msg.Endpoint.Id, msg.Endpoint.Addr())\n\t\t} else {\n\t\t\tlog.Println(\"Added\", msg.Endpoint.Id, msg.Endpoint.Addr())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "149a7e1089161367bd1731478a341169", "score": "0.53450644", "text": "func (OnlyUpdateWhenGenerationNotChanged) Update(e event.UpdateEvent) bool {\n\tif e.MetaOld == nil {\n\t\tlog.Error(nil, \"Update event has no old metadata\", \"event\", e)\n\t\treturn false\n\t}\n\tif e.ObjectOld == nil {\n\t\tlog.Error(nil, \"Update event has no old runtime object to update\", \"event\", e)\n\t\treturn false\n\t}\n\tif e.ObjectNew == nil {\n\t\tlog.Error(nil, \"Update event has no new runtime object for update\", \"event\", e)\n\t\treturn false\n\t}\n\tif e.MetaNew == nil {\n\t\tlog.Error(nil, \"Update event has no new metadata\", \"event\", e)\n\t\treturn false\n\t}\n\treturn e.MetaNew.GetGeneration() == e.MetaOld.GetGeneration()\n}", "title": "" }, { "docid": "7a61a89da7cce05e98dd808f1f4226b4", "score": "0.5343223", "text": "func (mr *MockAPIMockRecorder) UpdateIgnitionEndpointToken(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UpdateIgnitionEndpointToken\", reflect.TypeOf((*MockAPI)(nil).UpdateIgnitionEndpointToken), arg0, arg1, arg2, arg3)\n}", "title": "" }, { "docid": "dc33bf262cb121ae8bfcfbddff5794f4", "score": "0.5325551", "text": "func (m *endpointManager) refreshPendingWlEpUpdates(updatedPolicies []string) {\n\tif updatedPolicies == nil {\n\t\treturn\n\t}\n\n\tlog.Debugf(\"Checking if any active endpoint policies need to be refreshed\")\n\tfor endpointId, workload := range m.activeWlEndpoints {\n\t\tif _, present := m.pendingWlEpUpdates[endpointId]; present {\n\t\t\t// skip this endpoint as it is already marked as pending update\n\t\t\tcontinue\n\t\t}\n\n\t\tvar activePolicyNames []string\n\t\tprofilesApply := true\n\n\t\tif len(workload.Tiers) > 0 {\n\t\t\tactivePolicyNames = append(activePolicyNames, prependAll(policysets.PolicyNamePrefix, workload.Tiers[0].IngressPolicies)...)\n\t\t\tactivePolicyNames = append(activePolicyNames, prependAll(policysets.PolicyNamePrefix, workload.Tiers[0].EgressPolicies)...)\n\n\t\t\tif len(workload.Tiers[0].IngressPolicies) > 0 && len(workload.Tiers[0].EgressPolicies) > 0 {\n\t\t\t\tprofilesApply = false\n\t\t\t}\n\t\t}\n\n\t\tif profilesApply && len(workload.ProfileIds) > 0 {\n\t\t\tactivePolicyNames = append(activePolicyNames, prependAll(policysets.ProfileNamePrefix, workload.ProfileIds)...)\n\t\t}\n\n\tPolicies:\n\t\tfor _, policyName := range activePolicyNames {\n\t\t\tfor _, updatedPolicy := range updatedPolicies {\n\t\t\t\tif policyName == updatedPolicy {\n\t\t\t\t\tlog.WithFields(log.Fields{\"policyName\": policyName, \"endpointId\": endpointId}).Info(\"Endpoint is being marked for policy refresh\")\n\t\t\t\t\tm.pendingWlEpUpdates[endpointId] = workload\n\t\t\t\t\tbreak Policies\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b5aae488fc67ae60a6c64a700d150b19", "score": "0.5306413", "text": "func (pushBots *PushBots) initializeEndpoints(endpointOverride string) {\n\tendpointBase := productionEndPoint\n\n\tif endpointOverride != \"\" {\n\t\tendpointBase = endpointOverride\n\t}\n\n\tpushBots.endpoints = map[string]pushBotRequest{\n\t\t\"registerdevice\": pushBotRequest{Endpoint: endpointBase + \"deviceToken\", HttpVerb: \"PUT\"},\n\t\t\"unregisterdevice\": pushBotRequest{Endpoint: endpointBase + \"deviceToken/del\", HttpVerb: \"PUT\"},\n\t\t\"alias\": pushBotRequest{Endpoint: endpointBase + \"alias\", HttpVerb: \"PUT\"},\n\t\t\"tagdevice\": pushBotRequest{Endpoint: endpointBase + \"tag\", HttpVerb: \"PUT\"},\n\t\t\"untagdevice\": pushBotRequest{Endpoint: endpointBase + \"tag/del\", HttpVerb: \"PUT\"},\n\t\t\"geos\": pushBotRequest{Endpoint: endpointBase + \"geo\", HttpVerb: \"PUT\"},\n\t\t\"addnotificationtype\": pushBotRequest{Endpoint: endpointBase + \"activate\", HttpVerb: \"PUT\"},\n\t\t\"removenotificationtype\": pushBotRequest{Endpoint: endpointBase + \"deactivate\", HttpVerb: \"PUT\"},\n\t\t\"broadcast\": pushBotRequest{Endpoint: endpointBase + \"push/all\", HttpVerb: \"POST\"},\n\t\t\"pushone\": pushBotRequest{Endpoint: endpointBase + \"push/one\", HttpVerb: \"POST\"},\n\t\t\"batch\": pushBotRequest{Endpoint: endpointBase + \"push/all\", HttpVerb: \"POST\"},\n\t\t\"badge\": pushBotRequest{Endpoint: endpointBase + \"badge\", HttpVerb: \"PUT\"},\n\t\t\"recordanalytics\": pushBotRequest{Endpoint: endpointBase + \"stats\", HttpVerb: \"PUT\"},\n\t}\n}", "title": "" }, { "docid": "483afe108ff8438068daf91de032ac52", "score": "0.52736735", "text": "func (r *ReconcileVirtualMachineService) createOrUpdateEndpoints(ctx *context.VirtualMachineServiceContext, service *corev1.Service) error {\n\tctx.Logger.V(5).Info(\"Updating VirtualMachineService Endpoints\")\n\tdefer ctx.Logger.V(5).Info(\"Finished updating VirtualMachineService Endpoints\")\n\n\tsubsets, err := r.generateSubsetsForService(ctx, service)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tendpoints := &corev1.Endpoints{}\n\tendpointsKey := types.NamespacedName{Name: service.Name, Namespace: service.Namespace}\n\n\t// The kube apiserver sorts the Endpoint subsets before saving, so the order that we create or\n\t// update with isn't necessarily the order we'll get back. Basically unroll controller-runtime's\n\t// CreateOrUpdate() here to handle resorting the subsets before the DeepEqual() comparison.\n\n\tmutateFn := func(epSubsets []corev1.EndpointSubset) error {\n\t\tendpoints.Name = service.Name\n\t\tendpoints.Namespace = service.Namespace\n\t\t// NCP apparently needs the same Labels as what is present on the Service, and I'm not aware\n\t\t// of anything else setting Labels, so just sync the Labels (and Annotations) with the Service.\n\t\tendpoints.Labels = service.Labels\n\t\tendpoints.Annotations = service.Annotations\n\t\tendpoints.Subsets = epSubsets\n\t\treturn controllerutil.SetControllerReference(ctx.VMService, endpoints, r.scheme)\n\t}\n\n\tif err := r.Get(ctx, endpointsKey, endpoints); err != nil {\n\t\tif !apiErrors.IsNotFound(err) {\n\t\t\tctx.Logger.Error(err, \"Failed to get Endpoints\")\n\t\t\treturn err\n\t\t}\n\n\t\tif err := mutateFn(subsets); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tctx.Logger.Info(\"Creating Service Endpoints\", \"endpoints\", endpoints)\n\t\treturn r.Create(ctx, endpoints)\n\t}\n\n\t// Copy the Endpoints and resort the subsets so that DeepEquals() doesn't return false when the\n\t// subsets are just sorted differently, causing the Endpoints to churn.\n\texistingEndpoints := endpoints.DeepCopy()\n\texistingEndpoints.Subsets = utils.RepackSubsets(existingEndpoints.Subsets)\n\n\tif err := mutateFn(utils.RepackSubsets(subsets)); err != nil {\n\t\treturn err\n\t}\n\n\tif !apiequality.Semantic.DeepEqual(endpoints, existingEndpoints) {\n\t\tctx.Logger.Info(\"Updating Service Endpoints\", \"endpoints\", endpoints)\n\t\tif err := r.Update(ctx, endpoints); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6e60fc5b6708afbb95ac32a8fb965137", "score": "0.52726054", "text": "func TestGetConcurrentAPIEndpoints(t *testing.T) {\n\tfor _, tc := range []struct {\n\t\tname string\n\t\tddURL, eventsDDURL, apiKey string\n\t\tadditionalEndpoints map[string][]string\n\t\tadditionalEventsEndpoints map[string][]string\n\t\texpectedEndpoints []apicfg.Endpoint\n\t\texpectedEventsEndpoints []apicfg.Endpoint\n\t}{\n\t\t{\n\t\t\tname: \"default\",\n\t\t\tapiKey: \"test\",\n\t\t\texpectedEndpoints: []apicfg.Endpoint{\n\t\t\t\t{\n\t\t\t\t\tAPIKey: \"test\",\n\t\t\t\t\tEndpoint: mkurl(config.DefaultProcessEndpoint),\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedEventsEndpoints: []apicfg.Endpoint{\n\t\t\t\t{\n\t\t\t\t\tAPIKey: \"test\",\n\t\t\t\t\tEndpoint: mkurl(config.DefaultProcessEventsEndpoint),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"set only process endpoint\",\n\t\t\tddURL: \"https://process.datadoghq.eu\",\n\t\t\tapiKey: \"test\",\n\t\t\texpectedEndpoints: []apicfg.Endpoint{\n\t\t\t\t{\n\t\t\t\t\tAPIKey: \"test\",\n\t\t\t\t\tEndpoint: mkurl(\"https://process.datadoghq.eu\"),\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedEventsEndpoints: []apicfg.Endpoint{\n\t\t\t\t{\n\t\t\t\t\tAPIKey: \"test\",\n\t\t\t\t\tEndpoint: mkurl(config.DefaultProcessEventsEndpoint),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"set only process-events endpoint\",\n\t\t\teventsDDURL: \"https://process-events.datadoghq.eu\",\n\t\t\tapiKey: \"test\",\n\t\t\texpectedEndpoints: []apicfg.Endpoint{\n\t\t\t\t{\n\t\t\t\t\tAPIKey: \"test\",\n\t\t\t\t\tEndpoint: mkurl(config.DefaultProcessEndpoint),\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedEventsEndpoints: []apicfg.Endpoint{\n\t\t\t\t{\n\t\t\t\t\tAPIKey: \"test\",\n\t\t\t\t\tEndpoint: mkurl(\"https://process-events.datadoghq.eu\"),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"multiple eps\",\n\t\t\tapiKey: \"test\",\n\t\t\tadditionalEndpoints: map[string][]string{\n\t\t\t\t\"https://mock.datadoghq.com\": {\n\t\t\t\t\t\"key1\",\n\t\t\t\t\t\"key2\",\n\t\t\t\t},\n\t\t\t\t\"https://mock2.datadoghq.com\": {\n\t\t\t\t\t\"key3\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tadditionalEventsEndpoints: map[string][]string{\n\t\t\t\t\"https://mock-events.datadoghq.com\": {\n\t\t\t\t\t\"key2\",\n\t\t\t\t},\n\t\t\t\t\"https://mock2-events.datadoghq.com\": {\n\t\t\t\t\t\"key3\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedEndpoints: []apicfg.Endpoint{\n\t\t\t\t{\n\t\t\t\t\tEndpoint: mkurl(config.DefaultProcessEndpoint),\n\t\t\t\t\tAPIKey: \"test\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tEndpoint: mkurl(\"https://mock.datadoghq.com\"),\n\t\t\t\t\tAPIKey: \"key1\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tEndpoint: mkurl(\"https://mock.datadoghq.com\"),\n\t\t\t\t\tAPIKey: \"key2\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tEndpoint: mkurl(\"https://mock2.datadoghq.com\"),\n\t\t\t\t\tAPIKey: \"key3\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedEventsEndpoints: []apicfg.Endpoint{\n\t\t\t\t{\n\t\t\t\t\tEndpoint: mkurl(config.DefaultProcessEventsEndpoint),\n\t\t\t\t\tAPIKey: \"test\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tEndpoint: mkurl(\"https://mock-events.datadoghq.com\"),\n\t\t\t\t\tAPIKey: \"key2\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tEndpoint: mkurl(\"https://mock2-events.datadoghq.com\"),\n\t\t\t\t\tAPIKey: \"key3\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t} {\n\t\tt.Run(tc.name, func(t *testing.T) {\n\t\t\tcfg := config.Mock(t)\n\t\t\tcfg.Set(\"api_key\", tc.apiKey)\n\t\t\tif tc.ddURL != \"\" {\n\t\t\t\tcfg.Set(\"process_config.process_dd_url\", tc.ddURL)\n\t\t\t}\n\n\t\t\tif tc.eventsDDURL != \"\" {\n\t\t\t\tcfg.Set(\"process_config.events_dd_url\", tc.eventsDDURL)\n\t\t\t}\n\n\t\t\tif tc.additionalEndpoints != nil {\n\t\t\t\tcfg.Set(\"process_config.additional_endpoints\", tc.additionalEndpoints)\n\t\t\t}\n\n\t\t\tif tc.additionalEventsEndpoints != nil {\n\t\t\t\tcfg.Set(\"process_config.events_additional_endpoints\", tc.additionalEventsEndpoints)\n\t\t\t}\n\n\t\t\teps, err := endpoint.GetAPIEndpoints(cfg)\n\t\t\tassert.NoError(t, err)\n\t\t\tassert.ElementsMatch(t, tc.expectedEndpoints, eps)\n\n\t\t\teventsEps, err := endpoint.GetEventsAPIEndpoints(cfg)\n\t\t\tassert.NoError(t, err)\n\t\t\tassert.ElementsMatch(t, tc.expectedEventsEndpoints, eventsEps)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "694b75ceaf38b8a0ee47d698122327a4", "score": "0.52558404", "text": "func (mock *MailgunMock) UpdateWebhookCalls() []struct {\n\tKind string\n\tURL string\n} {\n\tvar calls []struct {\n\t\tKind string\n\t\tURL string\n\t}\n\tlockMailgunMockUpdateWebhook.RLock()\n\tcalls = mock.calls.UpdateWebhook\n\tlockMailgunMockUpdateWebhook.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "9da7b4c44ce1b994ede8d75774fff4d6", "score": "0.524884", "text": "func (ml *ManagedListener) UpdateEndpointsWithBackoff() {\n\tvar ServicePrefix = fmt.Sprintf(\"Service %-32.32s\", ml.Key)\n\n\tTry := func() (err error) {\n\t\tdefer ml.Monitor()()\n\t\tml.UpdateEndpoints()\n\t\tif !ml.canListen() {\n\t\t\terr = fmt.Errorf(\"%s !canListen %v:%v\",\n\t\t\t\tServicePrefix,\n\t\t\t\tml.IPs,\n\t\t\t\tml.Port,\n\t\t\t)\n\t\t}\n\t\treturn\n\t}\n\n\tExpBackoff := ConfigureBackoff(5*time.Second, 1*time.Minute, 3*time.Minute, ml.Canceled)\n\n\tNotify := func(err error, t time.Duration) {\n\t\tlog.Printf(\"%v started %s elapsed %s break after %s\",\n\t\t\terr,\n\t\t\tExpBackoff.StartTime().Format(\"15.04.999\"),\n\t\t\tDurationString(ExpBackoff.GetElapsedTime()),\n\t\t\tDurationString(ExpBackoff.MaxElapsedTime))\n\t}\n\n\tvar err error\n\tfor {\n\t\tif err = backoff.RetryNotify(Try, ExpBackoff, Notify); err != nil {\n\t\t\tlog.Printf(\"%s accept retry timeout: %v\\n\", ServicePrefix, err)\n\t\t\tcontinue\n\t\t}\n\t\tbreak\n\t}\n}", "title": "" }, { "docid": "2a23aa1646cff91432d07b70395b1869", "score": "0.5244292", "text": "func (s) TestEDSWatch_TwoWatchesForSameResourceName(t *testing.T) {\n\ttests := []struct {\n\t\tdesc string\n\t\tresourceName string\n\t\twatchedResource *v3endpointpb.ClusterLoadAssignment // The resource being watched.\n\t\tupdatedWatchedResource *v3endpointpb.ClusterLoadAssignment // The watched resource after an update.\n\t\twantUpdateV1 endpointsUpdateErrTuple\n\t\twantUpdateV2 endpointsUpdateErrTuple\n\t}{\n\t\t{\n\t\t\tdesc: \"old style resource\",\n\t\t\tresourceName: edsName,\n\t\t\twatchedResource: e2e.DefaultEndpoint(edsName, edsHost1, []uint32{edsPort1}),\n\t\t\tupdatedWatchedResource: e2e.DefaultEndpoint(edsName, edsHost2, []uint32{edsPort2}),\n\t\t\twantUpdateV1: endpointsUpdateErrTuple{\n\t\t\t\tupdate: xdsresource.EndpointsUpdate{\n\t\t\t\t\tLocalities: []xdsresource.Locality{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tEndpoints: []xdsresource.Endpoint{{Address: fmt.Sprintf(\"%s:%d\", edsHost1, edsPort1), Weight: 1}},\n\t\t\t\t\t\t\tID: internal.LocalityID{\n\t\t\t\t\t\t\t\tRegion: \"region-1\",\n\t\t\t\t\t\t\t\tZone: \"zone-1\",\n\t\t\t\t\t\t\t\tSubZone: \"subzone-1\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tPriority: 0,\n\t\t\t\t\t\t\tWeight: 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\twantUpdateV2: endpointsUpdateErrTuple{\n\t\t\t\tupdate: xdsresource.EndpointsUpdate{\n\t\t\t\t\tLocalities: []xdsresource.Locality{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tEndpoints: []xdsresource.Endpoint{{Address: fmt.Sprintf(\"%s:%d\", edsHost2, edsPort2), Weight: 1}},\n\t\t\t\t\t\t\tID: internal.LocalityID{\n\t\t\t\t\t\t\t\tRegion: \"region-1\",\n\t\t\t\t\t\t\t\tZone: \"zone-1\",\n\t\t\t\t\t\t\t\tSubZone: \"subzone-1\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tPriority: 0,\n\t\t\t\t\t\t\tWeight: 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\tdesc: \"new style resource\",\n\t\t\tresourceName: edsNameNewStyle,\n\t\t\twatchedResource: e2e.DefaultEndpoint(edsNameNewStyle, edsHost1, []uint32{edsPort1}),\n\t\t\tupdatedWatchedResource: e2e.DefaultEndpoint(edsNameNewStyle, edsHost2, []uint32{edsPort2}),\n\t\t\twantUpdateV1: endpointsUpdateErrTuple{\n\t\t\t\tupdate: xdsresource.EndpointsUpdate{\n\t\t\t\t\tLocalities: []xdsresource.Locality{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tEndpoints: []xdsresource.Endpoint{{Address: fmt.Sprintf(\"%s:%d\", edsHost1, edsPort1), Weight: 1}},\n\t\t\t\t\t\t\tID: internal.LocalityID{\n\t\t\t\t\t\t\t\tRegion: \"region-1\",\n\t\t\t\t\t\t\t\tZone: \"zone-1\",\n\t\t\t\t\t\t\t\tSubZone: \"subzone-1\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tPriority: 0,\n\t\t\t\t\t\t\tWeight: 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\twantUpdateV2: endpointsUpdateErrTuple{\n\t\t\t\tupdate: xdsresource.EndpointsUpdate{\n\t\t\t\t\tLocalities: []xdsresource.Locality{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tEndpoints: []xdsresource.Endpoint{{Address: fmt.Sprintf(\"%s:%d\", edsHost2, edsPort2), Weight: 1}},\n\t\t\t\t\t\t\tID: internal.LocalityID{\n\t\t\t\t\t\t\t\tRegion: \"region-1\",\n\t\t\t\t\t\t\t\tZone: \"zone-1\",\n\t\t\t\t\t\t\t\tSubZone: \"subzone-1\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tPriority: 0,\n\t\t\t\t\t\t\tWeight: 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}\n\n\tfor _, test := range tests {\n\t\tt.Run(test.desc, func(t *testing.T) {\n\t\t\toverrideFedEnvVar(t)\n\t\t\tmgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})\n\t\t\tdefer cleanup()\n\n\t\t\t// Create an xDS client with the above bootstrap contents.\n\t\t\tclient, close, err := xdsclient.NewWithBootstrapContentsForTesting(bootstrapContents)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"Failed to create xDS client: %v\", err)\n\t\t\t}\n\t\t\tdefer close()\n\n\t\t\t// Register two watches for the same endpoint resource and have the\n\t\t\t// callbacks push the received updates on to a channel.\n\t\t\tew1 := newEndpointsWatcher()\n\t\t\tedsCancel1 := xdsresource.WatchEndpoints(client, test.resourceName, ew1)\n\t\t\tdefer edsCancel1()\n\t\t\tew2 := newEndpointsWatcher()\n\t\t\tedsCancel2 := xdsresource.WatchEndpoints(client, test.resourceName, ew2)\n\n\t\t\t// Configure the management server to return a single endpoint\n\t\t\t// resource, corresponding to the one being watched.\n\t\t\tresources := e2e.UpdateOptions{\n\t\t\t\tNodeID: nodeID,\n\t\t\t\tEndpoints: []*v3endpointpb.ClusterLoadAssignment{test.watchedResource},\n\t\t\t\tSkipValidation: true,\n\t\t\t}\n\t\t\tctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)\n\t\t\tdefer cancel()\n\t\t\tif err := mgmtServer.Update(ctx, resources); err != nil {\n\t\t\t\tt.Fatalf(\"Failed to update management server with resources: %v, err: %v\", resources, err)\n\t\t\t}\n\n\t\t\t// Verify the contents of the received update.\n\t\t\tif err := verifyEndpointsUpdate(ctx, ew1.updateCh, test.wantUpdateV1); err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t\tif err := verifyEndpointsUpdate(ctx, ew2.updateCh, test.wantUpdateV1); err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\t// Cancel the second watch and force the management server to push a\n\t\t\t// redundant update for the resource being watched. Neither of the\n\t\t\t// two watch callbacks should be invoked.\n\t\t\tedsCancel2()\n\t\t\tif err := mgmtServer.Update(ctx, resources); err != nil {\n\t\t\t\tt.Fatalf(\"Failed to update management server with resources: %v, err: %v\", resources, err)\n\t\t\t}\n\t\t\tif err := verifyNoEndpointsUpdate(ctx, ew1.updateCh); err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t\tif err := verifyNoEndpointsUpdate(ctx, ew2.updateCh); err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\t// Update to the resource being watched. The un-cancelled callback\n\t\t\t// should be invoked while the cancelled one should not be.\n\t\t\tresources = e2e.UpdateOptions{\n\t\t\t\tNodeID: nodeID,\n\t\t\t\tEndpoints: []*v3endpointpb.ClusterLoadAssignment{test.updatedWatchedResource},\n\t\t\t\tSkipValidation: true,\n\t\t\t}\n\t\t\tif err := mgmtServer.Update(ctx, resources); err != nil {\n\t\t\t\tt.Fatalf(\"Failed to update management server with resources: %v, err: %v\", resources, err)\n\t\t\t}\n\t\t\tif err := verifyEndpointsUpdate(ctx, ew1.updateCh, test.wantUpdateV2); err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t\tif err := verifyNoEndpointsUpdate(ctx, ew2.updateCh); err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "e61d5217f82b0de46fe0a2f1a8daf554", "score": "0.52094615", "text": "func UpdateProductEndPoint(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintln(w, \"not implemented yet !\")\n}", "title": "" }, { "docid": "03c874b8c8693824fc3417d1b642b7b9", "score": "0.52033114", "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": "4b9397e1cd59163fce0fa34f4b51847e", "score": "0.52014565", "text": "func (mr *MockHandlerMockRecorder) Update(ctx, exactType, tasks interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Update\", reflect.TypeOf((*MockHandler)(nil).Update), ctx, exactType, tasks)\n}", "title": "" }, { "docid": "c1a27a2cd7c2c00a65947b53c9787cd6", "score": "0.51925105", "text": "func (s) TestResolverBadServiceUpdate(t *testing.T) {\n\tmgmtServer, err := e2e.StartManagementServer(e2e.ManagementServerOptions{})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer mgmtServer.Stop()\n\n\t// Create a bootstrap configuration specifying the above management server.\n\tnodeID := uuid.New().String()\n\tcleanup, err := xdsbootstrap.CreateFile(xdsbootstrap.Options{\n\t\tNodeID: nodeID,\n\t\tServerURI: mgmtServer.Address,\n\t})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer cleanup()\n\n\tconst serviceName = \"my-service-client-side-xds\"\n\ttcc, rClose := buildResolverForTarget(t, resolver.Target{URL: *testutils.MustParseURL(\"xds:///\" + serviceName)})\n\tdefer rClose()\n\n\t// Configure a listener resource that is expected to be NACKed because it\n\t// does not contain the `RouteSpecifier` field in the HTTPConnectionManager.\n\thcm := testutils.MarshalAny(&v3httppb.HttpConnectionManager{\n\t\tHttpFilters: []*v3httppb.HttpFilter{e2e.HTTPFilter(\"router\", &v3routerpb.Router{})},\n\t})\n\tlis := &v3listenerpb.Listener{\n\t\tName: serviceName,\n\t\tApiListener: &v3listenerpb.ApiListener{ApiListener: hcm},\n\t\tFilterChains: []*v3listenerpb.FilterChain{{\n\t\t\tName: \"filter-chain-name\",\n\t\t\tFilters: []*v3listenerpb.Filter{{\n\t\t\t\tName: wellknown.HTTPConnectionManager,\n\t\t\t\tConfigType: &v3listenerpb.Filter_TypedConfig{TypedConfig: hcm},\n\t\t\t}},\n\t\t}},\n\t}\n\tresources := e2e.UpdateOptions{\n\t\tNodeID: nodeID,\n\t\tListeners: []*v3listenerpb.Listener{lis},\n\t\tSkipValidation: true,\n\t}\n\tctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)\n\tdefer cancel()\n\tif err := mgmtServer.Update(ctx, resources); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\twantErr := \"no RouteSpecifier\"\n\tval, err := tcc.errorCh.Receive(ctx)\n\tif err != nil {\n\t\tt.Fatal(\"Timeout when waiting for error to be propagated to the ClientConn\")\n\t}\n\tgotErr := val.(error)\n\tif gotErr == nil || !strings.Contains(gotErr.Error(), wantErr) {\n\t\tt.Fatalf(\"Received error from resolver %q, want %q\", gotErr, wantErr)\n\t}\n\n\t// Configure good listener and route configuration resources on the\n\t// management server.\n\trdsName := \"route-\" + serviceName\n\tcdsName := \"cluster-\" + serviceName\n\tresources = e2e.UpdateOptions{\n\t\tNodeID: nodeID,\n\t\tListeners: []*v3listenerpb.Listener{e2e.DefaultClientListener(serviceName, rdsName)},\n\t\tRoutes: []*v3routepb.RouteConfiguration{e2e.DefaultRouteConfig(rdsName, serviceName, cdsName)},\n\t\tSkipValidation: true,\n\t}\n\tif err := mgmtServer.Update(ctx, resources); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Expect a good update from the resolver.\n\tval, err = tcc.stateCh.Receive(ctx)\n\tif err != nil {\n\t\tt.Fatalf(\"Timeout waiting for an update from the resolver: %v\", err)\n\t}\n\trState := val.(resolver.State)\n\tif err := rState.ServiceConfig.Err; err != nil {\n\t\tt.Fatalf(\"Received error in service config: %v\", rState.ServiceConfig.Err)\n\t}\n\n\t// Configure another bad resource on the management server.\n\tresources = e2e.UpdateOptions{\n\t\tNodeID: nodeID,\n\t\tListeners: []*v3listenerpb.Listener{lis},\n\t\tSkipValidation: true,\n\t}\n\tif err := mgmtServer.Update(ctx, resources); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Expect an error update from the resolver.\n\tval, err = tcc.errorCh.Receive(ctx)\n\tif err != nil {\n\t\tt.Fatal(\"Timeout when waiting for error to be propagated to the ClientConn\")\n\t}\n\tgotErr = val.(error)\n\tif gotErr == nil || !strings.Contains(gotErr.Error(), wantErr) {\n\t\tt.Fatalf(\"Received error from resolver %q, want %q\", gotErr, wantErr)\n\t}\n}", "title": "" }, { "docid": "027f6d3028a5fa8ad56ba333e2c5fa33", "score": "0.5184379", "text": "func (s *GraviteeSession) AddOrUpdateEndpoints(id string, endpoints []ApiDetailsEndpoint, replaceAll bool) error {\n\tres, err := s.getRaw(\"apis\", id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tjson, err := gabs.ParseJSON(res)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif replaceAll {\n\t\tjson.Array(\"proxy\", \"endpoints\")\n\t}\n\n\tfor _, ep := range endpoints {\n\t\terr := s.addOrUpdateEndpointSingle(json, ep)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// clean-up (PUT request will fail if the following properties are set)\n\tjson.Delete(\"context_path\")\n\tjson.Delete(\"created_at\")\n\tjson.Delete(\"deployed_at\")\n\tjson.Delete(\"id\")\n\tjson.Delete(\"owner\")\n\tjson.Delete(\"picture_url\")\n\tjson.Delete(\"state\")\n\tjson.Delete(\"updated_at\")\n\n\treturn s.putRaw(json.Bytes(), \"apis\", id)\n}", "title": "" }, { "docid": "83bd4339dcb4b669b6fcd15e6f946dee", "score": "0.51842475", "text": "func MakeUpdateEndpoint(s service.TodoService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(UpdateRequest)\n\t\tt, error := s.Update(ctx, req.Todo)\n\t\treturn UpdateResponse{\n\t\t\tError: error,\n\t\t\tT: t,\n\t\t}, nil\n\t}\n}", "title": "" }, { "docid": "f83d5843d79cae126298677abeaa2bf3", "score": "0.5179206", "text": "func (i *IpScheduler) OnUpdate(old, new interface{}) {}", "title": "" }, { "docid": "f8aa977b6b20435224c5005d124cfb33", "score": "0.5175763", "text": "func (mr *MockIpsecServerMockRecorder) IpsecCbUpdate(arg0, arg1 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"IpsecCbUpdate\", reflect.TypeOf((*MockIpsecServer)(nil).IpsecCbUpdate), arg0, arg1)\n}", "title": "" }, { "docid": "0051a634f858eb5b3794e208f2b2ba30", "score": "0.517353", "text": "func (s) TestEDSWatch(t *testing.T) {\n\ttests := []struct {\n\t\tdesc string\n\t\tresourceName string\n\t\twatchedResource *v3endpointpb.ClusterLoadAssignment // The resource being watched.\n\t\tupdatedWatchedResource *v3endpointpb.ClusterLoadAssignment // The watched resource after an update.\n\t\tnotWatchedResource *v3endpointpb.ClusterLoadAssignment // A resource which is not being watched.\n\t\twantUpdate endpointsUpdateErrTuple\n\t}{\n\t\t{\n\t\t\tdesc: \"old style resource\",\n\t\t\tresourceName: edsName,\n\t\t\twatchedResource: e2e.DefaultEndpoint(edsName, edsHost1, []uint32{edsPort1}),\n\t\t\tupdatedWatchedResource: e2e.DefaultEndpoint(edsName, edsHost2, []uint32{edsPort2}),\n\t\t\tnotWatchedResource: e2e.DefaultEndpoint(\"unsubscribed-eds-resource\", edsHost3, []uint32{edsPort3}),\n\t\t\twantUpdate: endpointsUpdateErrTuple{\n\t\t\t\tupdate: xdsresource.EndpointsUpdate{\n\t\t\t\t\tLocalities: []xdsresource.Locality{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tEndpoints: []xdsresource.Endpoint{{Address: fmt.Sprintf(\"%s:%d\", edsHost1, edsPort1), Weight: 1}},\n\t\t\t\t\t\t\tID: internal.LocalityID{\n\t\t\t\t\t\t\t\tRegion: \"region-1\",\n\t\t\t\t\t\t\t\tZone: \"zone-1\",\n\t\t\t\t\t\t\t\tSubZone: \"subzone-1\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tPriority: 0,\n\t\t\t\t\t\t\tWeight: 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\tdesc: \"new style resource\",\n\t\t\tresourceName: edsNameNewStyle,\n\t\t\twatchedResource: e2e.DefaultEndpoint(edsNameNewStyle, edsHost1, []uint32{edsPort1}),\n\t\t\tupdatedWatchedResource: e2e.DefaultEndpoint(edsNameNewStyle, edsHost2, []uint32{edsPort2}),\n\t\t\tnotWatchedResource: e2e.DefaultEndpoint(\"unsubscribed-eds-resource\", edsHost3, []uint32{edsPort3}),\n\t\t\twantUpdate: endpointsUpdateErrTuple{\n\t\t\t\tupdate: xdsresource.EndpointsUpdate{\n\t\t\t\t\tLocalities: []xdsresource.Locality{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tEndpoints: []xdsresource.Endpoint{{Address: fmt.Sprintf(\"%s:%d\", edsHost1, edsPort1), Weight: 1}},\n\t\t\t\t\t\t\tID: internal.LocalityID{\n\t\t\t\t\t\t\t\tRegion: \"region-1\",\n\t\t\t\t\t\t\t\tZone: \"zone-1\",\n\t\t\t\t\t\t\t\tSubZone: \"subzone-1\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tPriority: 0,\n\t\t\t\t\t\t\tWeight: 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}\n\n\tfor _, test := range tests {\n\t\tt.Run(test.desc, func(t *testing.T) {\n\t\t\toverrideFedEnvVar(t)\n\t\t\tmgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})\n\t\t\tdefer cleanup()\n\n\t\t\t// Create an xDS client with the above bootstrap contents.\n\t\t\tclient, close, err := xdsclient.NewWithBootstrapContentsForTesting(bootstrapContents)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"Failed to create xDS client: %v\", err)\n\t\t\t}\n\t\t\tdefer close()\n\n\t\t\t// Register a watch for a endpoint resource and have the watch\n\t\t\t// callback push the received update on to a channel.\n\t\t\tew := newEndpointsWatcher()\n\t\t\tedsCancel := xdsresource.WatchEndpoints(client, test.resourceName, ew)\n\n\t\t\t// Configure the management server to return a single endpoint\n\t\t\t// resource, corresponding to the one being watched.\n\t\t\tresources := e2e.UpdateOptions{\n\t\t\t\tNodeID: nodeID,\n\t\t\t\tEndpoints: []*v3endpointpb.ClusterLoadAssignment{test.watchedResource},\n\t\t\t\tSkipValidation: true,\n\t\t\t}\n\t\t\tctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)\n\t\t\tdefer cancel()\n\t\t\tif err := mgmtServer.Update(ctx, resources); err != nil {\n\t\t\t\tt.Fatalf(\"Failed to update management server with resources: %v, err: %v\", resources, err)\n\t\t\t}\n\n\t\t\t// Verify the contents of the received update.\n\t\t\tif err := verifyEndpointsUpdate(ctx, ew.updateCh, test.wantUpdate); err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\t// Configure the management server to return an additional endpoint\n\t\t\t// resource, one that we are not interested in.\n\t\t\tresources = e2e.UpdateOptions{\n\t\t\t\tNodeID: nodeID,\n\t\t\t\tEndpoints: []*v3endpointpb.ClusterLoadAssignment{test.watchedResource, test.notWatchedResource},\n\t\t\t\tSkipValidation: true,\n\t\t\t}\n\t\t\tif err := mgmtServer.Update(ctx, resources); err != nil {\n\t\t\t\tt.Fatalf(\"Failed to update management server with resources: %v, err: %v\", resources, err)\n\t\t\t}\n\t\t\tif err := verifyNoEndpointsUpdate(ctx, ew.updateCh); err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\t// Cancel the watch and update the resource corresponding to the original\n\t\t\t// watch. Ensure that the cancelled watch callback is not invoked.\n\t\t\tedsCancel()\n\t\t\tresources = e2e.UpdateOptions{\n\t\t\t\tNodeID: nodeID,\n\t\t\t\tEndpoints: []*v3endpointpb.ClusterLoadAssignment{test.updatedWatchedResource, test.notWatchedResource},\n\t\t\t\tSkipValidation: true,\n\t\t\t}\n\t\t\tif err := mgmtServer.Update(ctx, resources); err != nil {\n\t\t\t\tt.Fatalf(\"Failed to update management server with resources: %v, err: %v\", resources, err)\n\t\t\t}\n\t\t\tif err := verifyNoEndpointsUpdate(ctx, ew.updateCh); err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "2da9f4c0284b105e7f4c9ae3431b5a20", "score": "0.5173105", "text": "func (pb *Pubsub) WatchEndpoints(clusterName string, cb func(resource.EndpointsUpdate, error)) (first bool, cancel func() bool) {\n\twi := &watchInfo{\n\t\tc: pb,\n\t\trType: resource.EndpointsResource,\n\t\ttarget: clusterName,\n\t\tedsCallback: cb,\n\t}\n\n\twi.expiryTimer = time.AfterFunc(pb.watchExpiryTimeout, func() {\n\t\twi.timeout()\n\t})\n\treturn pb.watch(wi)\n}", "title": "" }, { "docid": "70ec215d14bd316bb031baeb8239cd59", "score": "0.5171844", "text": "func hasChanges(old *networking.Ingress, current *networking.Ingress) bool {\n\told.Status.LoadBalancer.Ingress = current.Status.LoadBalancer.Ingress\n\told.ResourceVersion = current.ResourceVersion\n\treturn !reflect.DeepEqual(old, current)\n}", "title": "" }, { "docid": "025cebabdc32fa1a9f94688375a158c3", "score": "0.5164302", "text": "func (tw *TestWatch) NextEndpoints(endpoints []string) {\n\ttw.OnEvent(func() {\n\t\ttw.endpoints <- endpoints\n\t})\n}", "title": "" }, { "docid": "3495fd403c3dd92fa5ac2e5b0b3a85f0", "score": "0.5163", "text": "func MakeUpdateEndpoint(service integratedservices.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(UpdateRequest)\n\n\t\terr := service.Update(ctx, req.ClusterID, req.ServiceName, req.Spec)\n\n\t\tif err != nil {\n\t\t\tif serviceErr := serviceError(nil); errors.As(err, &serviceErr) && serviceErr.ServiceError() {\n\t\t\t\treturn UpdateResponse{Err: err}, nil\n\t\t\t}\n\n\t\t\treturn UpdateResponse{Err: err}, err\n\t\t}\n\n\t\treturn UpdateResponse{}, nil\n\t}\n}", "title": "" }, { "docid": "3edae2d76dec356966fe36458b03aad1", "score": "0.51605344", "text": "func (c *Controller) shouldContinueOnUpdateFailed() error {\n\t// Check configuration option regarding should we continue when errors met on the way\n\t// c.chopConfig.OnStatefulSetUpdateFailureAction\n\tvar continueUpdate = false\n\tif continueUpdate {\n\t\t// Continue update\n\t\treturn nil\n\t}\n\n\t// Do not continue update\n\treturn errors.New(fmt.Sprintf(\"Update stopped due to previous errors\"))\n}", "title": "" }, { "docid": "3ae363d1cfba63ef7202ae51d99948b4", "score": "0.5160377", "text": "func (mr *MockDeviceServiceClientMockRecorder) Update(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Update\", reflect.TypeOf((*MockDeviceServiceClient)(nil).Update), varargs...)\n}", "title": "" }, { "docid": "553044e4e57ed2818fb889001e022c96", "score": "0.5155866", "text": "func (a *DefaultApiService) UpdateEndpoint(ctx _context.Context, id string) ApiUpdateEndpointRequest {\n\treturn ApiUpdateEndpointRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "title": "" }, { "docid": "9efe6ea7a5af67a205051009ca895afc", "score": "0.51553035", "text": "func (c *Direct) SetEndpoints(localPort uint16, endpoints []string) (changed bool) {\n\t// (no log message on function entry, because it clutters the logs\n\t// if endpoints haven't changed. newEndpoints() will log it.)\n\treturn c.newEndpoints(localPort, endpoints)\n}", "title": "" }, { "docid": "9d80ade363b24727c88b97959367ca7f", "score": "0.5146911", "text": "func (fr *FirewallRule) CheckEndpoints() error {\n\t//TODO Authorize only one condition per endpoint for the moment\n\tendpoints := []*FirewallRuleEndpointType{\n\t\tfr.GetEndpoint1(),\n\t\tfr.GetEndpoint2(),\n\t}\n\n\tfor _, endpoint := range endpoints {\n\t\tif endpoint == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := endpoint.ValidateEndpointType(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t//TODO check no ids present\n\t//TODO check endpoints exclusivity clause\n\t//TODO VN name in endpoints\n\n\treturn nil\n}", "title": "" }, { "docid": "e5a8bb2497e59fbe3ba4d7a4b75b7eac", "score": "0.5144577", "text": "func (_m *IntervalClient) Update(ctx context.Context, reqs []requests.UpdateIntervalRequest) ([]common.BaseResponse, errors.EdgeX) {\n\tret := _m.Called(ctx, reqs)\n\n\tvar r0 []common.BaseResponse\n\tif rf, ok := ret.Get(0).(func(context.Context, []requests.UpdateIntervalRequest) []common.BaseResponse); ok {\n\t\tr0 = rf(ctx, reqs)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]common.BaseResponse)\n\t\t}\n\t}\n\n\tvar r1 errors.EdgeX\n\tif rf, ok := ret.Get(1).(func(context.Context, []requests.UpdateIntervalRequest) errors.EdgeX); ok {\n\t\tr1 = rf(ctx, reqs)\n\t} else {\n\t\tif ret.Get(1) != nil {\n\t\t\tr1 = ret.Get(1).(errors.EdgeX)\n\t\t}\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "212eb022322fd7e3a691a7668c421bb3", "score": "0.51283437", "text": "func CanUpdate(oldPlan, newPlan ServicePlan, service Service, parameters UpdateParameters) bool {\n\tif !service.PlanUpdateable {\n\t\treturn false\n\t}\n\tif oldPlan.ID != newPlan.ID {\n\t\tif oldPlan.RDSProperties.Shared != newPlan.RDSProperties.Shared {\n\t\t\treturn false\n\t\t}\n\t\tif oldPlan.RDSProperties.Engine != newPlan.RDSProperties.Engine {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "737558f05ca196f33aab65dd092c16a0", "score": "0.5127888", "text": "func (s) TestResourceResolverNoChangeNoUpdate(t *testing.T) {\n\tfakeClient := fakeclient.NewClient()\n\trr := newResourceResolver(&clusterResolverBalancer{xdsClient: fakeClient})\n\trr.updateMechanisms([]DiscoveryMechanism{\n\t\t{\n\t\t\tType: DiscoveryMechanismTypeEDS,\n\t\t\tCluster: testClusterNames[0],\n\t\t},\n\t\t{\n\t\t\tType: DiscoveryMechanismTypeEDS,\n\t\t\tCluster: testClusterNames[1],\n\t\t\tMaxConcurrentRequests: newUint32(100),\n\t\t},\n\t})\n\tctx, ctxCancel := context.WithTimeout(context.Background(), defaultTestTimeout)\n\tdefer ctxCancel()\n\tgotEDSName1, err := fakeClient.WaitForWatchEDS(ctx)\n\tif err != nil {\n\t\tt.Fatalf(\"xdsClient.WatchCDS failed with error: %v\", err)\n\t}\n\tif gotEDSName1 != testClusterNames[0] {\n\t\tt.Fatalf(\"xdsClient.WatchEDS called for cluster: %v, want: %v\", gotEDSName1, testClusterNames[0])\n\t}\n\tgotEDSName2, err := fakeClient.WaitForWatchEDS(ctx)\n\tif err != nil {\n\t\tt.Fatalf(\"xdsClient.WatchCDS failed with error: %v\", err)\n\t}\n\tif gotEDSName2 != testClusterNames[1] {\n\t\tt.Fatalf(\"xdsClient.WatchEDS called for cluster: %v, want: %v\", gotEDSName2, testClusterNames[1])\n\t}\n\n\t// Invoke callback, should get an update.\n\tfakeClient.InvokeWatchEDSCallback(gotEDSName1, testEDSUpdates[0], nil)\n\t// Shouldn't send update, because only one resource received an update.\n\tshortCtx, shortCancel := context.WithTimeout(context.Background(), defaultTestShortTimeout)\n\tdefer shortCancel()\n\tselect {\n\tcase u := <-rr.updateChannel:\n\t\tt.Fatalf(\"get unexpected update %+v\", u)\n\tcase <-shortCtx.Done():\n\t}\n\tfakeClient.InvokeWatchEDSCallback(gotEDSName2, testEDSUpdates[1], nil)\n\tselect {\n\tcase u := <-rr.updateChannel:\n\t\tif diff := cmp.Diff(u.priorities, []priorityConfig{\n\t\t\t{\n\t\t\t\tmechanism: DiscoveryMechanism{\n\t\t\t\t\tType: DiscoveryMechanismTypeEDS,\n\t\t\t\t\tCluster: testClusterNames[0],\n\t\t\t\t},\n\t\t\t\tedsResp: testEDSUpdates[0],\n\t\t\t\tchildNameGen: newNameGenerator(0),\n\t\t\t},\n\t\t\t{\n\t\t\t\tmechanism: DiscoveryMechanism{\n\t\t\t\t\tType: DiscoveryMechanismTypeEDS,\n\t\t\t\t\tCluster: testClusterNames[1],\n\t\t\t\t\tMaxConcurrentRequests: newUint32(100),\n\t\t\t\t},\n\t\t\t\tedsResp: testEDSUpdates[1],\n\t\t\t\tchildNameGen: newNameGenerator(1),\n\t\t\t},\n\t\t}, cmp.AllowUnexported(priorityConfig{}, nameGenerator{})); diff != \"\" {\n\t\t\tt.Fatalf(\"got unexpected resource update, diff (-got, +want): %v\", diff)\n\t\t}\n\tcase <-ctx.Done():\n\t\tt.Fatal(\"Timed out waiting for update from update channel.\")\n\t}\n\n\t// Send the same resources with the same priorities, shouldn't any change.\n\trr.updateMechanisms([]DiscoveryMechanism{\n\t\t{\n\t\t\tType: DiscoveryMechanismTypeEDS,\n\t\t\tCluster: testClusterNames[0],\n\t\t},\n\t\t{\n\t\t\tType: DiscoveryMechanismTypeEDS,\n\t\t\tCluster: testClusterNames[1],\n\t\t\tMaxConcurrentRequests: newUint32(100),\n\t\t},\n\t})\n\tshortCtx, shortCancel = context.WithTimeout(context.Background(), defaultTestShortTimeout)\n\tdefer shortCancel()\n\tif n, err := fakeClient.WaitForWatchEDS(shortCtx); err == nil {\n\t\tt.Fatalf(\"unexpected watch started for EDS: %v\", n)\n\t}\n\tshortCtx, shortCancel = context.WithTimeout(context.Background(), defaultTestShortTimeout)\n\tdefer shortCancel()\n\tselect {\n\tcase u := <-rr.updateChannel:\n\t\tt.Fatalf(\"unexpected update: %+v\", u)\n\tcase <-shortCtx.Done():\n\t}\n\n\t// Close the resource resolver. Should stop EDS watch.\n\trr.stop()\n\tedsNameCanceled1, err := fakeClient.WaitForCancelEDSWatch(ctx)\n\tif err != nil {\n\t\tt.Fatalf(\"xdsClient.CancelCDS failed with error: %v\", err)\n\t}\n\tif edsNameCanceled1 != gotEDSName1 && edsNameCanceled1 != gotEDSName2 {\n\t\tt.Fatalf(\"xdsClient.CancelEDS called for %v, want: %v or %v\", edsNameCanceled1, gotEDSName1, gotEDSName2)\n\t}\n\tedsNameCanceled2, err := fakeClient.WaitForCancelEDSWatch(ctx)\n\tif err != nil {\n\t\tt.Fatalf(\"xdsClient.CancelCDS failed with error: %v\", err)\n\t}\n\tif edsNameCanceled2 != gotEDSName2 && edsNameCanceled2 != gotEDSName1 {\n\t\tt.Fatalf(\"xdsClient.CancelEDS called for %v, want: %v or %v\", edsNameCanceled2, gotEDSName1, gotEDSName2)\n\t}\n}", "title": "" } ]